[05:31] morning anyone around? [05:51] i'm trying to write a upstart script that will enable mobile broadband when a usb modem is attached. Not sure what start on event should trigger the script [05:54] there's no interface until the wwan if enabled, so i can't use start on net-device-added [06:08] start on tty-device-added ID_VENDOR_ID=something ID_MODEL_ID=something ID_IFACE=00, also use /dev/serial/by-id/usb-something_something-if00-port0 [06:16] hi ion have you done this with a usb modem before? [06:16] yeah [06:18] I could use some more help I've been trying for 2 hours and it's driving me insane :( [06:18] using lsusb I got 12d1:1435 [06:18] huawei [06:20] Run udevadm info --export-db and take the ID_VENDOR_ID and ID_MODEL_ID entries corresponding to your device verbatim. [06:20] Also check that ID_IFACE matches. [06:22] ok standby please I'm doing this right now [06:27] ok that was a long list to scroll through [06:28] ID_VENDOR_ID=12d1 ID_MODEL_ID=1436 [06:28] I don't see an ID_IFACE [06:30] oh there are several "groups" od devices….in another one it says if00-port0 [06:31] ion what do I do now? [06:34] It seems newer systems have ID_USB_INTERFACE_NUM instead. [06:35] I’m looking at an inactive config from an old setup. [06:35] yes I found it 00 [07:06] ion if you're still there how should I use this information? [07:48] Sorry, what information? [07:53] the info I got from running udevadm as you told me to run. I was hoping that as you had done this with usb modems that you could guide me [07:59] Just add a set of udev properties that uniquely identifies the interface as parameters to the tty-device-added event matcher. ID_VENDOR_ID, ID_MODEL_ID and ID_USB_INTERFACE_NUM probably. [08:00] The job should start whenever a matching device is plugged in. [08:02] jodh: abi-compliance-checker now kind of works in saucy. [08:04] hello, since Quantal (and also on Raring) my system takes an unusually long time to shutdown (up to 10 sec.). Sometimes I see messages flickering saying "killing all remaining processes failed" and "mount: / is busy". what is the best way to debug such an issue? i have tried to change the log-priority to debug but it seems that nothing gets logged related to shutdown [09:12] ion I've been trying with something simple like this just to see that the event is trigger and that something happens, but nothing in the upstart log or any file created [09:12] start on (tty-device-added DEVNAME=*ttyUSB0 ID_VENDOR_ID=12d1) [09:12] echo "upstart" >> /tmp/upstart_test [09:28] janchor: See https://code.launchpad.net/~jamesodhunt/ubuntu/saucy/sysvinit/log-processes-and-open-files-on-shutdown/+merge/163740. I'm waiting for this to get merged. [09:29] xnox: kind of? [09:29] jodh: it prints a warning "use gcc << 4.8 to have all checks" [09:30] jodh: but autopkgtest for acc now passes and it's in saucy now, mostly working with 4.8. basically gcc4.8 stopped dumping translation unit files..... [09:33] hi jodh xnox have you use tty-device-added and can tell me what I might be doing wrong with the simple script above? [09:33] Do you have any errors in syslog? [09:34] ion I couldn't see anything there or in the upstart script's log [09:35] Does you ‘echo "upstart"…’ line have ‘exec’ in front? [09:35] your [09:36] when I just did tart on tty-device-added; exec env it worked and logged all the data as we got earlier via udevadm. [09:37] no I was looking at examples in the cookbook and they didn't have exec in front so I did the same. But I will try now with exec [09:37] I mean, a line that just starts with “echo” is an error and you should have an error message in the system log. [09:38] If you didn’t find it, you should figure out where it went because that’s where all the parse errors will be in the future as well. [09:38] ion that was it [09:38] ok I will remove exec and check the logs again [09:40] joshu: look in /var/log/upstart/*.log. The example I'm looking at in the cookbook for tty-device-added certainly shows "exec env". [09:40] i can honestly say I can't find an error, but I might have missed it [09:41] jodh yes I've done that example and you're correct I did it with exec env. But with regards to echo there are many examples with exec in front so I thought that was convention ;) [09:41] *without [09:42] "echo "start on (event-A and event-B)" >> /etc/init/myjob.override" [09:42] That’s not the contents of a job file, that’s a shell command. [09:46] then I'm wrong. my apologies [09:48] ion do I put the different "matchers" in parentheses or just like this: start on tty-device-added ID_VENDOR_ID=12d1 ID_MODEL_ID=1436 ID_USB_INTERFACE_NUM=00 [09:48] That should work, i think. [09:49] I mean, that doesn’t require parentheses for sure. [09:49] If the key-value pairs are also exactly right, it ought to work. [09:50] ok I'm just checking. and for this script should I have a stop event handler? [09:50] it's just a "task" right? [09:53] If your job will run wvdial/pppd/something like that, you don’t want it to be a “task”. [09:54] My job had “stop on runlevel [06] or tty-device-removed ” [09:56] Right makes sense if it's not a task do I add respawn or daemon or those are also not applicable to this? [09:57] You can add “respawn”. I’d avoid “daemon” and just make the program run in foreground. [10:00] so just want to make sure I understand. The upstart is triggered when the usb modem is added and is differentiated from other similar devices by the 3 specific attributes. The script will start the mobile broadband connection using nmcli con up id "mobile-connection". If the connection dies the respawn will start it again. Is this correct? [10:09] I take it nmcli controls another daemon that is running independently and then exits immediately? In that case, you do want “task” and no “stop on” stanza. [10:09] In that case, it’s nm’s job to restart the connection. [10:15] ion so far I've only been successful in echoing when the device is added. When I try to start the connection as I can do manually with nmcli con up id "blah blah" I get an error in upstart log it says [10:16] "Error: No suitable device found: no device found for connection "mobile-connection" [10:24] Network-manager probably isn’t ready to start it at the very moment udev sees the tty device. [10:26] hmm so do I need to add another start condition? [10:47] i've tried adding a script block with sleep 10 and then exec nmcli and still the same rror [10:50] i think I've got it [10:54] @jodh thanks, this patch could be useful for my problem, i'm gonna apply it on the respective init scripts and test it [11:07] ion i got it working with a 20 sec sleep. I've been adding and removing the modem to test and it works well. I'm just not sure about the respawn and task (no stop stanza). I don't know enough how nmcli works. You suggested the latter two. [11:08] Using sleep introduces a race condition. If you want to use network-manager for this, you probably shouldn’t use that udev event. [11:08] Can one not configure network-manager to start the connection automatically? [11:09] not for mobile broadband no [11:10] i've googled and people use a bash script [11:10] sleep 10; nmcli nm wwan on; nmcli con up id "name" [11:12] ion https://gist.github.com/anonymous/4a97cdb935c026781010 [15:12] <[diecast]> setting up a new init.. http://pastebin.com/QA71qv9S [15:12] <[diecast]> getting "stop: Unknown instance:" when trying to run it [17:46] @jodh i have opened a new bug report containing shutdown-lsof.log of my system: https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/1207848 [20:49] Is anyone available to help? trying to figure out why my upstart script (http://pastebin.com/uiXkd901) is not working properly on my headless server. [23:56] is there a main config file? looking for a way to add an 'include' directory that I can drop additional upstart configs in... other than /etc/init