[05:31] <joshu> morning anyone around?
[05:51] <joshu> 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] <joshu> there's no interface until the wwan if enabled, so i can't use start on net-device-added
[06:08] <ion> 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] <joshu> hi ion have you done this with a usb modem before?
[06:16] <ion> yeah
[06:18] <joshu> I could use some more help I've been trying for 2 hours and it's driving me insane :(
[06:18] <joshu> using lsusb I got 12d1:1435
[06:18] <joshu> huawei
[06:20] <ion> Run udevadm info --export-db and take the ID_VENDOR_ID and ID_MODEL_ID entries corresponding to your device verbatim.
[06:20] <ion> Also check that ID_IFACE matches.
[06:22] <joshu> ok standby please I'm doing this right now
[06:27] <joshu> ok that was a long list to scroll through
[06:28] <joshu> ID_VENDOR_ID=12d1 ID_MODEL_ID=1436
[06:28] <joshu> I don't see an ID_IFACE
[06:30] <joshu> oh there are several "groups" od devices….in another one it says if00-port0
[06:31] <joshu> ion what do I do now?
[06:34] <ion> It seems newer systems have ID_USB_INTERFACE_NUM instead.
[06:35] <ion> I’m looking at an inactive config from an old setup.
[06:35] <joshu> yes I found it 00
[07:06] <joshu> ion if you're still there how should I use this information?
[07:48] <ion> Sorry, what information?
[07:53] <joshu> 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] <ion> 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] <ion> The job should start whenever a matching device is plugged in.
[08:02] <xnox> jodh: abi-compliance-checker now kind of works in saucy.
[08:04] <janchor> 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] <joshu> 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] <joshu> start on (tty-device-added DEVNAME=*ttyUSB0 ID_VENDOR_ID=12d1)
[09:12] <joshu> echo "upstart" >> /tmp/upstart_test
[09:28] <jodh> 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] <jodh> xnox: kind of?
[09:29] <xnox> jodh: it prints a warning "use gcc << 4.8 to have all checks"
[09:30] <xnox> 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] <joshu> 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] <ion> Do you have any errors in syslog?
[09:34] <joshu> ion I couldn't see anything there or in the upstart script's log
[09:35] <ion> Does you ‘echo "upstart"…’ line have ‘exec’ in front?
[09:35] <ion> your
[09:36] <joshu> 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] <joshu> 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] <ion> 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] <ion> 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] <joshu> ion that was it
[09:38] <joshu> ok I will remove exec and check the logs again
[09:40] <jodh> 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] <joshu> i can honestly say I can't find an error, but I might have missed it
[09:41] <joshu> 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] <joshu> *without
[09:42] <joshu> "echo "start on (event-A and event-B)" >> /etc/init/myjob.override"
[09:42] <ion> That’s not the contents of a job file, that’s a shell command.
[09:46] <joshu> then I'm wrong. my apologies
[09:48] <joshu> 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] <ion> That should work, i think.
[09:49] <ion> I mean, that doesn’t require parentheses for sure.
[09:49] <ion> If the key-value pairs are also exactly right, it ought to work.
[09:50] <joshu> ok I'm just checking. and for this script should I have a stop event handler?
[09:50] <joshu> it's just a "task" right?
[09:53] <ion> If your job will run wvdial/pppd/something like that, you don’t want it to be a “task”.
[09:54] <ion> My job had “stop on runlevel [06] or tty-device-removed <the same pattern as above>”
[09:56] <joshu> 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] <ion> You can add “respawn”. I’d avoid “daemon” and just make the program run in foreground.
[10:00] <joshu> 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] <ion> 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] <ion> In that case, it’s nm’s job to restart the connection.
[10:15] <joshu> 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] <joshu> "Error: No suitable device found: no device found for connection "mobile-connection"
[10:24] <ion> Network-manager probably isn’t ready to start it at the very moment udev sees the tty device.
[10:26] <joshu> hmm so do I need to add another start condition?
[10:47] <joshu> i've tried adding a script block with sleep 10 and then exec nmcli and still the same rror
[10:50] <joshu> i think I've got it
[10:54] <janchor> @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] <joshu> 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] <ion> 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] <ion> Can one not configure network-manager to start the connection automatically?
[11:09] <joshu> not for mobile broadband no
[11:10] <joshu> i've googled and people use a bash script
[11:10] <joshu> sleep 10; nmcli nm wwan on; nmcli con up id "name"
[11:12] <joshu> 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] <janchor> @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] <ajp> 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] <crankharder> 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