/srv/irclogs.ubuntu.com/2012/04/19/#upstart.txt

djszapijodh: ping13:44
jodhdjszapi: hello13:44
djszapijodh: I am not getting my upstart job logged13:45
djszapithere is certainly issues with it and I have used console log13:45
djszapibut there is no /var/log/upstart/foobar.log entry.13:45
jodhdoes the directory /var/log/upstart/ exist?13:46
djszapiI do not see anything related: http://paste.kde.org/459902/ this is my upstart job: http://paste.kde.org/459908/13:46
djszapinope13:46
djszapiit does not exist13:46
djszapion this pandaboard13:46
djszapiupstart 1.3-0ubuntu12~linaro213:46
jodhdjszapi: http://upstart.ubuntu.com/cookbook/#stanzas-by-category13:47
jodhdjszapi: console log didn't get introduced until 1.4.13:47
djszapiby default or altogether ?13:48
jodhdjszapi: if you run "init-checkconf foo.conf" you should get a msg about invalid stanza as "console log" won't be understood.13:48
jodhdjszapi: the feature was added in Upstart 1.4 and you are running Upstart 1.313:48
djszapiinit-checkconf cannot be run as root13:49
djszapiand I am not supposed to have another user for this.13:49
djszapiat any rate, I trust you.13:49
djszapijodh: shall I use console output ?13:50
djszapiand 2>&1 ?13:50
jodhdjszapi: I suggest you read http://upstart.ubuntu.com/cookbook/#debugging13:51
jodhdjszapi: it's all in there13:51
jodhdjszapi: correct - init-checkconf runs as a normal user.13:52
djszapijodh: what is wrong about this: http://upstart.ubuntu.com/cookbook/#console-output13:52
jodhdjszapi: nothing - there are many options. It's your decision :)13:52
djszapijodh: what do you recommend ?13:52
djszapithere is some operational issues with my binary13:52
djszapiit works if I run manually.13:52
djszapibut it does not function if it is run by upstart13:52
djszapithe binary is running and all that jazz, but no proper effect on the functionality.13:53
djszapiit opens a serial port, and begins to listen to that13:53
jodhdjszapi: I'd recommend reading http://upstart.ubuntu.com/cookbook/#debugging then.13:53
djszapiand if there is a data, it parses.13:53
djszapiand act accordingly, that is all. What I now see, it does not act as expected.13:53
djszapiso needs to be debugged.13:53
jodhyes - see also http://upstart.ubuntu.com/cookbook/#debugging-a-script-which-appears-to-be-behaving-oddly13:54
jodhwhich might be the answer in your case. You'll just have to try it.13:54
djszapithat is a complete no go13:54
djszapiI would like to separate the logging out for my stuff13:54
djszapiI would not like to grep in a bunch of stuff13:54
djszapiand that is what console output is for, afterwards.13:56
jodhI think you have misunderstood - the 'grep' is an example in the section above. *You* don't need to grep, you need to test your script with '/bin/sh -e'.13:56
djszapiI do not understand13:57
djszapiPlease note that I do not use script13:58
djszapiand there is no "failing" either.13:58
djszapiwhat I would actually like to get, is a 2>&1 like operation, and console output seems to be designed for that.13:58
djszapias in: exec /usr/bin/foobar-commandline receive > /var/log/foobar.log 2>&113:59
jodhdjszapi: you can do exactly that if you want to.14:00
djszapiwhat happend with Scott ?14:01
djszapione or two years ago I had the discussions with him.14:01
djszapihe stepped down as the upstart maintainer ?14:01
jodhyes - he is now working at Google.14:04
djszapiI know that, but I did not know he stepped down from the upstart maintenance.14:04
djszapiinteresting, after the launch: stop foobar; start foobar and the "foobar" binary works just fine...14:06
djszapiwhat is the difference ?14:06
djszapithe serialport is opened by that process after the launch, so I do not really understand.14:07
djszapijodh: is the serialport available for writing for such a job ?14:08
djszapijodh: the modem is not set up on the serial port :(14:23
djszapiwhile the upstart job is running, just later.14:23
djszapihow can that be ?14:23
djszapisince the modem does not respond to the commands that time I send out.14:24
djszapiso I guess the modem is not set up, but why ?14:24
djszapiI had the impression "start on runlevel [23]" should be just fine14:24
djszapijodh: what should trigger the start of my job instead of the initlevel thingie ?14:35
jodhdjszapi: you should probably add 'and X-device-added a=b c=d' for the modem device. See http://upstart.ubuntu.com/cookbook/#upstart-udev-bridge, upstart-events(7) and upstart-udev-bridge(8).14:42
djszapijodh: I have honestly no ideas about the subsystem :/14:46
jodhdjszapi: what device does your app open? /dev/ttyS0?14:46
djszapi/dev/ttyUSB014:47
djszapiPL2303 (usb-serial converter)14:47
djszapijodh: http://paste.kde.org/459968/14:48
djszapiperhaps usbdev ?14:48
jodhso, have your job 'start on tty-device-added DEVPATH=*ttyUSB0'14:49
djszapiE: SUBSYSTEM=tty14:49
djszapi udevadm info --export-db | grep -B 2 -A 2 /dev/ttyUSB014:49
djszapifrom this output14:49
djszapithis one then ? start on (tty-device-added)14:51
djszapistop on (tty-device-removed)14:51
djszapihmm, the documentation does not mention the DEVPATH14:51
djszapijust inside the log, but not for the "start/stop" lines.14:52
jodhI've given you the answer above. I'm guessing you either don't have your usb device plugged in or you didn't run udevadm as root?14:52
djszapiwell, the documentation does not mention any DEVPATH examples.14:53
djszapithe documentation only speaks about the log wrt those.14:53
jodh?14:53
djszapishow me the documentation example for the DEVPATH usage.14:54
djszapithese are the examples: start on (graphics-device-added or drm-device-added)14:55
djszapistart on (graphics-device-added or drm-device-added)14:55
djszapi1) Both contain brakcets14:55
djszapibrackets*14:56
djszapi2) None of the presents the usage of DEVPATH14:56
djszapijodh: did not help14:57
jodhdjszapi: what did not help? Please be specific.14:58
djszapijodh: http://paste.kde.org/459974/14:59
djszapiwhat I told above14:59
djszapisame symptom14:59
djszapithe modem was not able to reply to the message sent out while running the relevant binary from the upstart job.14:59
jodhdjszapi: I suggest you (1) comment out the 'stop on' and make the job 'start onrunlevel [23] and  tty-device-added DEVPATH=*ttyUSB0'.15:01
jodhdjszapi: also, comment out respawn.15:02
djszapi init-checkconf /etc/init/piruag.conf 15:02
djszapiERROR: failed to ask Upstart to check conf file15:02
djszapirespawm is very important15:02
jodhdjszapi: do this before running init-checkconf as presumably you're running on a console: eval `dbus-launch --auto-syntax`15:05
djszapijodh: I am now having only two lines: 1) start onrunlevel [23] and  tty-device-added DEVPATH=*ttyUSB0 2) exec /usr/bin/foobar-commandline receive15:05
jodhdjszapi: ...?15:06
djszapiFile /etc/init/foobar.conf: syntax ok15:06
djszapijodh: what is not clear ?15:06
jodhdjszapi: so what happens now? does the job work with the 2 lines or not?15:07
djszapitesting15:08
djszapijodh: I think the point is not ttyUSB015:09
djszapijodh: IMO, the point is that this specific modem is set up at that time.15:09
djszapiif they are the same, then ok.15:09
djszapijodh: that way, it does not even run after the bootup15:11
djszapiprobably no space between on and runlevel15:11
djszapiand I have just copied and pasted your line. :-)15:11
djszapijodh: that line actually broke the initscripts15:17
djszapieven ssh does not work from outside anymore :(15:17
djszapijodh: get it back, sorry but no ... my binary does not even run anymore with that "start on runlevel..." etc line15:18
djszapiare you sure brackets are not needed or other quirk ?15:19
jodhdjszapi: init-checkconf will tell you if the file is valid.15:22
djszapijodh: at any rate, the binary is not even started this way15:23
djszapiany ideas ?15:23
djszapitoo bad upstart is this hard to use :/15:25
jodhif your app isn't setting the modem, sounds like you need to find out what is. If it is being configured by an Upstart job, you can make your job 'start on stopped <thing>' since at that stage the modem will presumably be configured. If it's being done by a sysv script, then 'start on stopped rc'.15:34
djszapiI have no clue what you are talking about.15:35
djszapimy application does configure the modem, but it should obviously available for commands. As for me, upstart seems to be either broken or quite undocumented.15:36
jodhdjszapi: it is neither.15:38
djszapiwell, it does not work15:38
djszapiand I do not find in the documentation either how it is supposed to work either.15:38
djszapias for me, it is time consuming either way as a "customer".15:39
djszapiscript echo "`env`" > /dev/.initramfs/job-A.log15:40
djszapiend script15:40
djszapithis logged nothing, so even this part of the documentation is hilariously broken15:40
jodhdjszapi: incorrect - that tells you the either you have a corrupt .conf file (your paste is incorrect in that 'echo' should be on the line below), or your job never started.15:41
jodhdjszapi: have you tried "start <job>" on a booted system maybe? do you get a log file then?15:42
djszapino log, no15:44
djszapieven after start stuff15:44
djszapijodh: ^15:45
djszapistart on (runlevel [23] and tty-device-added DEVPATH=*ttyUSB0)15:45
djszapiscript echo "`env`" > /dev/.initramfs/job-A.log15:45
djszapiend script15:45
djszapiexec /usr/bin/...15:45
jodhdjszapi: as stated above, that is incorrect syntax: the first 'script' should be on a line on it's own, as shown in the cookbook and as documented in init(5).15:47
djszapino15:47
djszapidocumentation shows this: start on (graphics-device-added or drm-device-added)15:47
djszapiscript echo "`env`" > /dev/.initramfs/job-A.log15:47
djszapiend script15:47
djszapihave you actually checked the documentation ?15:47
djszapialso: init-checkconf /etc/init/piruag.conf 15:48
djszapiFile /etc/init/piruag.conf: syntax ok15:48
djszapis/piruag/foobar/15:48
jodhdjszapi: what you have pasted above is therefore *not* what is in piruag.conf as it is invalid. the cookbook is correct. Maybe your web-browser is mis-rendering it. It views perfectly for me in ff and chromium.15:50
djszapihuh ?15:50
djszapiyour irc client is wrong then15:51
djszapisince it was a simple copy/paste15:51
djszapiplease do not argue about useless things15:51
djszapilet us just nicely proceed15:51
djszapiI would not like to spend yet another few hours with upstart to run a simply binary lol15:51
djszapionce tty is set up properly.15:51
djszapis/simply/simple/15:52
djszapiI do not understand why this hard to use an initiscript.15:52
djszapithis is a perfectly valid syntax made according to the documentation (TM): http://paste.kde.org/459992/15:53
jodhdjszapi: right - your problem is that you've specified both a 'script' section and an 'exec'. That's not valid, or rather the last valid entry will be selected (the exec), hence you won't get a log.15:58
djszapiinit check returns /valid/15:58
djszapifix the check.15:58
jodhdjszapi: put the call to /usr/bin/foobar-commandline at the end of the script section and comment out the exec section.15:58
jodhdjszapi: it's valid, but not what you want.15:59
djszapiwhat is the point of upstart if it is this hard to run a binary once the serial port is set up  ?15:59
jodhit isn't hard - you just need to read the documentation. If the documentation is unclear or needs more examples, please raise bugs so we can rectify the situation.16:00
djszapiwell, you did not even provide any working solution so far16:00
djszapiso it seems to be even hard for you.16:00
djszapiso what can I say as a newcomer...16:01
jodhdjszapi: I don't have a modem and I didn't write your application :)16:01
djszapiit has nothing to do with my application16:01
djszapiit expects a modem set up16:01
djszapiwhich is obviously a sane thing if you wanna configure it ....16:01
djszapihttp://paste.kde.org/460028/ -> this is the env16:02
djszapiquite poor from what I can say.16:02
djszapianyway, I have no clues...16:03
djszapiany help is welcome...16:03
djszapiotherwise I need to admit it is incredibly hard from upstart, and not worth spending the time with.16:03
jodhdjszapi: so your application runs correctly from the command-line on a booted system?16:04
djszapilike I said in the very beginnig, of course...16:04
djszapieven from upstart ...16:04
djszapinot during the boot, but I said it many times really :)16:04
djszapiso clearly, the modem is not up and running16:04
djszapiand still, the last line I got for the "start on ..." is broken16:05
djszapithe binary is not even executed anymore16:05
djszapijodh: ^16:07
SpamapSdjszapi: what release of Ubuntu are you on?16:18
djszapiupstart 1.1316:19
djszapi(like I said in the beginning)16:19
djszapiwhy should the ubuntu version matter ?16:19
SpamapSdjszapi: I wasn't here in the beginning. Please try to be a bit more polite.16:19
SpamapSdjszapi: There is no such thing as 1.1316:20
djszapiweird, I see you were online.16:20
djszapiof course there is.16:20
SpamapS1.5 is the newest release of upstart16:20
djszapi1.3-0ubuntu12~linaro216:20
djszapiyes, 1.316:20
SpamapSOk, 1.3 not 1.13 :)16:20
djszapiit drives me crazy :/16:21
SpamapSdjszapi: so if you add this to your exec line, you can get the error messages from your command logged to syslog:16:21
SpamapS2>&1 | logger -t pickatag16:21
djszapithat is not gonna work without console log IIRC16:21
djszapiconsole output16:21
SpamapSdjszapi: you may also want to increase the log priority to 'info' so that you can see upstart events being processed. 'initctl log-priority info'16:21
SpamapSdjszapi: you don't have syslogging?16:22
SpamapSdjszapi: ok, change that to this then:16:22
djszapiI do have syslog16:22
djszapibut I would rather prefer a dedicated log just for this.16:22
SpamapS>> /run/mylog.log 2> /run/myerr.log16:22
djszapi-> /run ?16:23
djszapiyou mean /var/log/ ?16:23
SpamapSchoose whatever you want16:23
djszapi-> /run does not really fit the lfsh16:23
SpamapSok, you get the idea.16:24
djszapihttp://paste.kde.org/460052/16:25
SpamapSdjszapi: yeah that should work16:27
djszapiok, it does not16:27
djszapilike I said before16:27
djszapiespecially because console output is not there.16:28
djszapiand even if I was putting there, I would have the same information, I already do have.16:28
djszapithe modem does not respond.16:28
djszapimost likely because it is not set up16:28
djszapiso I do not understand what addition we would gain in here.16:28
djszapiAny ideas pushing the topic forward ?16:28
djszapiwhat I need is not the logging of my application, I already know where it fails.16:29
djszapiI would need to know what to trigger the application for.16:29
djszapithe documentation does not just work, period.16:29
djszapinor the aforementioned ideas.16:29
djszapiI do not understand why one needs to spend many hours to run a binary once the serial port and the modem in there are ready. :/16:30
djszapiit should be this simple: I would like to run my daemon once the system is fully set up: ok, use this.16:30
djszapishould be just one option.16:30
SpamapSdjszapi: where does it fail then?16:32
djszapihuh ?16:32
SpamapSdjszapi: is there hardware missing?16:32
djszapihave you actually read what I wrote ? :-)16:32
SpamapSdjszapi: sounds like the device added event is emitted by udev too soon.16:32
djszapisorry, but really getting frustrated. I would not like to spend /enormous/ amount of time to run a binary once the system is fully set up.16:33
SpamapSdjszapi: I'm done. Good luck with upstart. You will get no help until you can be nice.16:33
djszapiyou have not clearly read what I wrote.16:33
djszapiI wrote that the modem does not respond back then while trying to configure it.16:33
SpamapSOk, I typed that while you said sorry.16:33
SpamapSdjszapi: so that tells me that you need an event for when the modem is ready, not when the serial port is added16:34
djszapiI would need a common event which tells the system is up!16:34
djszapinow you can run anything.16:34
djszapieverything is set up.16:34
SpamapS"system is up" is hard to define.16:34
djszapiI do not care about low-level stuff, like a certain specific device is run16:34
SpamapSmobile systems have resources that come and go.16:34
djszapiwith the certain specific vendor and so on ids.16:35
djszapithis is quite low-level.16:35
djszapisuper low-level16:35
djszapi"system is set up" -> done16:35
djszapirun the binary16:35
djszapiwhat is so hard about it ?16:35
SpamapSrunlevel 2 should be that the system is ready to run anything statically onfigurable16:35
SpamapSconfigurable rather16:35
djszapilike I said, runlevel 2 did not work.16:36
djszapigetting no replies from the modem16:36
SpamapSRight, so there is something not-static that you are dependent on.16:36
djszapimeanwhile if I make a stop myjob; start myjob, I do get replies16:36
djszapieither an "OK" or an "ERROR".16:36
SpamapSdjszapi: perhaps try 'stopped udevtrigger and runlevel [23]'16:36
djszapiit is quite static, trust me :)16:36
SpamapSdjszapi: udevtrigger will flush all events that the kernel knows about at system boot.16:37
djszapiI am not sure udevtrigger stopping check is a good point for that.16:37
djszapiLike I wrote: "start on (runlevel [23] and tty-device-added DEVPATH=*ttyUSB0)" does not even run the binary anymore16:37
djszapiso it is already a broken check.16:37
djszapiextending a broken check... I do not expect anything working.16:38
djszapistart on (stopped udevtrigger and runlevel [23] and tty-device-added DEVPATH=*ttyUSB0)16:38
djszapiI do not expect it to work either.16:38
SpamapSdjszapi: it will delay the start a bit... perhaps until the modem is ready16:39
SpamapSdjszapi: Otherwise, the modem needs to be polled16:40
djszapino way16:40
djszapiif I stop and start, it runs fine16:40
djszapiwithout doing that, it does not appear.16:40
djszapiso no, sorry.16:40
SpamapSdjszapi: let me put it another way. What actual event would you expect to signify that the modem is ready?16:41
djszapimodem is continously ready16:41
djszapisince it gets power supply, and not turned off.16:41
djszapiso I would expect once /dev/ttyUSB0 is available, it should work oob16:41
SpamapSdjszapi: so perhaps there's a bug in the code that emits the event about ttyUSB0 being ready when it isn't16:43
djszapiI do not understand why I am having these troubles if it is super simple by using SystemV.16:43
SpamapSdjszapi: because systemv takes 5x longer to start16:45
SpamapSdjszapi: its still a race, its just that one car is WAY slower than the other :)16:46
djszapiI do not feel it funny, sorry for that...16:46
SpamapSdjszapi: you can try putting yourself way after rc runs.. 'start on stopped rc RUNLEVEL=[23]'16:48
SpamapSdjszapi: but thats really just slowing down the race a bit. Not solving the issue.16:48
djszapihuh ?16:48
SpamapSdjszapi: perhaps also try 'respawn' which will retry a few times16:49
SpamapSdjszapi: you need an event that is reliable. Your ttyUSB0 event is clearly not reliable. :-P16:49
djszapijodh said to remove the respawn...16:49
djszapiyou have nothing to prove that saying.16:49
djszapireally.16:49
SpamapSI don't, because you won't show me the output of your program16:49
djszapiubuntu should drop upstart to the trash :)16:50
djszapiit is unusable even for simple cases like this.16:51
SpamapSdjszapi: this has nothign to do with upstart.16:51
djszapiofc it does.16:51
djszapisince it works with other systems like aforementioned.16:51
SpamapSdjszapi: upstart is operating properly... as I said, you just don't have an event you can rely on.16:51
djszapithat makes no sense, sorry.16:51
djszapistop/start works fine!16:51
SpamapSdjszapi: so if I tune up my engine and get my car to go 220mph, but that makes the tires melt.. its the engine's fault?16:52
djszapihuh ?16:52
SpamapSdjszapi: upstart is just the point where you're interfacing with the plumbing of the entire system16:52
SpamapSdjszapi: stop/start works fine because the device has had enough time to initialize16:52
djszapiI joined this channel more than three hours ago16:52
djszapiand still not solved16:53
djszapilike...wtf ?16:53
SpamapSdjszapi: well you've been really difficult. I'm trying to help.16:53
SpamapSdjszapi: lets back up, because I want to make sure I'm as helpful as possible.16:53
djszapiI have not realized I would have any solution for the issue, really.16:53
SpamapSdjszapi: you have this job which uses 'start on runlevel [23] and tty-device-added DEVPATH=*ttyUSB0  .. right?16:54
djszapito run a daemon after the system is fully up takes more than three hours :(16:54
SpamapSdjszapi: and you refuse to try adding 'stopped udevtrigger' right?16:55
djszapinot right16:55
SpamapSdjszapi: and upstart tries to start the program, but the program fails with some kind of error about the serial port not being ready, right?16:55
djszapino, the program does not fail16:55
SpamapSahh16:55
SpamapS<-- misunderstood16:55
SpamapSdjszapi: ok, so the program never starts?16:56
djszapiand, no, I am now trying this as recommended: start on stopped rc RUNLEVEL=[23]16:56
djszapiit does start16:56
SpamapSdjszapi: and its in 'stop/waiting' after the system fully boots?16:56
* djszapi ponders how many hours have to wasted yet for upstart :(16:57
djszapibe*16:57
djszapiSpamapS: again: the binary runs with start on stopped rc RUNLEVEL=[23], but the modem does not respond with either "OK" or "ERROR" like after running stop/start16:57
djszapitart on runlevel [23] and tty-device-added DEVPATH=*ttyUSB0 and stopped udevtrigger -> did not work16:58
djszapithe daemon did not even run16:58
SpamapSdjszapi: is it possible that the modem doesn't initialize itself until the first time you run the program?16:59
djszapihuh ?16:59
djszapilike I said, the modem is fully powered16:59
djszapiit is configured17:00
djszapiit is working17:00
djszapithe running ubuntu stuf makes it not responding17:00
SpamapSdjszapi: what I'm saying is, could it be that the modem won't respond to the first program that talks to it.17:00
djszapiduring the bootup for probably some false bootup sequence.17:00
djszapiI do not see how that would be possible really.17:00
djszapiif I do not try to run the program, but I run after the bootup17:01
djszapieverything is alright.17:01
SpamapSdjszapi: ok so it still is just a race.. and we need to find the event that means "the modem is active"17:01
djszapiagain, again and again: I need to run my program once the system is set up !17:01
SpamapSI would have expected tty-device-added to be that17:01
djszapidarn upstart, it is not possible to do such a basic thing...17:01
SpamapSdjszapi: systems are mobile17:01
SpamapSdjszapi: tty devices come and go17:01
SpamapSdjszapi: 'stopped udevtrigger' is "when all the hardware that is plugged in at boot time is initialized"17:02
djszapiwell17:02
SpamapSdjszapi: perhaps take out the tty-device-added part17:02
djszapi19:58 < djszapi> tart on runlevel [23] and tty-device-added DEVPATH=*ttyUSB0 and stopped udevtrigger -> did not work17:02
SpamapSdjszapi: so     start on runlevel [23] and stopped udevtrigger17:02
djszapiI am not sure it is a good thing to base a system on a such a brittle tool.17:03
SpamapSdjszapi: the tool is actually quite strong. the events are just not easy to understand, because parallelism is hard.17:04
djszapiI do not care about the events17:04
djszapihave you still not realized ? :)17:04
djszapiI would like to run my binary once everything is set up!17:04
djszapiI do not care about premature optimization.17:05
djszapiwhich causes -3-4 hours from more people's life.17:05
SpamapSdjszapi: I actually fully understand that. I want there to be more clear, simpler events like 'boot-hardware-initialized'. I created the event 'static-network-up' for this reason.17:05
SpamapSdjszapi: I also think that runlevel 2 should probably be delayed until after 'stopped udevtrigger' .. but people want the boot to proceed without waiting for all the hardware17:06
djszapiI am not the people.17:06
SpamapSdjszapi: then you must understand the events. :)17:07
djszapino17:07
djszapiAgain, I would like to run a binary once everything is set up!17:07
SpamapSdjszapi: that is runlevel [23] and stopped udevtrigger17:08
djszapidid not work17:08
djszapimodem does not respond.17:08
SpamapShmmm... one thing..17:08
SpamapSI notice udevtrigger uses post-stop to run 'udevadm settle'17:08
SpamapSso perhaps the events will still be going after that event17:09
SpamapS*argh*17:09
djszapiUpstart, to the trash!17:09
SpamapSdjszapi: I have to go soon.. but I think this is worth a bug. It should be possible to ask for a job which waits for udevadm settle to finish.17:10
SpamapSdjszapi: let me make this clear. This has nothing to do with upstart. It is just a deficiency in the system plumbing available on top of upstart in Ubuntu.17:10
SpamapSdjszapi: upstart is doing everything right. Ubuntu has just failed to expose the events in a way that makes sense.17:10
SpamapSI am surprised that your tty-device-added doesn't work17:11
djszapiis there *ANY* workaround ?17:11
djszapiput a sleep into the script ?17:11
djszapibut that is blocking.17:12
djszapiunless the kernel events are async.17:12
djszapiwhich is probably the case.17:12
slangasekif the goal is to delay the startup of the job, sure, you can use a sleep17:12
djszapiin any case, sleep would be blocking.17:12
slangasekwhat do you mean by "async"?17:12
SpamapSdjszapi: a sleep might work. You can also try putting 'udevadm settle' right before it running the program (or in a pre-start)17:12
SpamapSdjszapi: sleep would be blocking, exactly, thats why it might work ;)17:12
djszapican you tell me the line exactly?17:13
slangasekpre-start exec sleep 10?17:13
djszapiohh it is just sleep 1017:13
djszapipre-start ?17:13
djszapiwhy is that ?17:13
SpamapSslangasek: any ideas on an event for 'when all the hardware currently plugged in is available'17:13
slangasekdjszapi: or you can put it at the top of the 'script'17:13
SpamapSdjszapi: so that when you respawn you don't run it again17:13
slangasekSpamapS: I was thinking 'stopped udevtrigger' should do this, but I have the same uncertainty you do about whether post-stop scripts are required to complete before starting jobs that are 'stop on'17:14
djszapihttp://paste.kde.org/ -> slt ?17:16
slangasekI think you missed the last part of that link17:16
djszapihttp://paste.kde.org/460106/17:17
slangasekI don't think you need both the udevadm settle *and* the sleep... but certainly that should be enough17:17
djszapisorry, bruteforce for everything...just work...17:18
slangasekI would expect that to work17:19
slangasekbtw, the 'console output' is irrelevant there, I think you've misunderstood what that does: that tells where to send stdout/stderr from the job script, but you're redirecting all of that to files anyway17:20
djszapiso no harm either...17:20
slangasekyes17:21
djszapiI guess "udevadm settle" is better to have than random sleep amount ?17:22
slangasekSpamapS: so if 'on stopped udevtrigger' doesn't catch the udevadm settle, we should probably split the trigger and settle out into separate jobs for dependency purposes17:22
slangasekdjszapi: yes17:22
slangasekdid it work for you when using both?17:22
djszapislangasek: yes17:22
djszapinow cleaning up17:22
SpamapSslangasek: indeed, I was thinking we might also just emit another event after the udevadmsettle.. 'stopped udevadm' or 'stopped udevtrigger' is very hard to read. :-P17:23
SpamapSsomething like boot-devices-ready ?17:23
djszapihttp://paste.kde.org/460112/ -> Anything to improve on this ?17:23
djszapican I use exec + pre-script at all ?17:24
djszapior just script + pre-script ?17:24
slangasekdjszapi: ok.  then I also suggest dropping the 'runlevel [23] and' from the start condition17:24
slangasekbecause a) it should be redundant, and b) it can cause the job to deadlock in certain corner cases involving runlevel changes, so it's best to not have it17:24
slangasekSpamapS: 'coldplug-finished'?17:24
slangasekor 'udev-coldplug-finished'17:25
slangasekwhich is more explicit about what you get than 'boot-devices'17:25
SpamapSslangasek: still feels very "I know about plumbing"17:25
djszapislangasek: could you please my worry about ?17:25
slangasekdjszapi: yes, 'pre-start exec udevadm settle' would be fine there17:25
djszapicomment on*17:25
slangasekand would be more idiomatic17:25
djszapithat was not my question...17:25
* SpamapS suspends to save battery17:25
djszapimy question was related to the exec mybinary...17:26
djszapi+ pre-script...17:26
slangasekdjszapi: ah, right - yes, that's also allowed17:26
slangasekin general, it's preferred to use 'exec' instead of 'script' if you only have one command because it spares you a needless shell execution17:27
slangasekbut you can intermix them freely17:27
djszapiI have been said above I cannot.17:27
slangasekmust have been a misunderstanding; you can17:28
slangasekand SpamapS and jodh certainly both know that :)17:28
slangasekSpamapS: I can see the point that a more generic name would be appropriate... particularly since that means we can adjust the underlying implementation as needed to fulfill that interface contract17:28
djszapislangasek: did not work17:31
slangasekdjszapi: pastebin the one that didn't work, please?17:31
djszapisee above17:31
djszapirunlevel [23] -> this was removed from that17:31
slangasekok17:31
slangasekwell, re-add it then if you must :/  that's not ideal, but it's more important that it work17:32
djszapiI am not saying that is the culsprit17:32
slangasekbtw, what does your disk partitioning scheme look like?17:32
djszapithe original working got a decent cleanup17:32
djszapimy worry is that if it works only with hard coded sleep :(17:32
djszapithat would be a pity17:32
djszapiso that would defeat the robust system purpose.17:33
slangasektrue, it would; and we've tried hard to avoid using sleep in our startup scripts because sleep only hides a race, it never fixes it17:33
djszapiwe can agree upon this.17:34
slangasekthis is exactly why you'll find resistance to the idea that SysV is doing anything right - it's not, it's just much, much slower ;)17:37
djszapislangasek: only sleep helps17:38
djszapiI have put back everything except sleep17:38
slangasekclever17:39
slangasekthat means there's a kernel bug17:39
slangasekbecause calling 'udevadm settle' following 'stopped udevtrigger' guarantees that the kernel's queue of coldplug events is empty and udev has processed them all17:40
slangasekactually, wait, it doesn't guarantee there's a kernel bug either, because USB in particular can have devices show up on the bus for the first time *after* coldplugging17:40
slangasekdjszapi: I would suggest editing /etc/init/udevmonitor.conf to comment out the 'stop' rule, then reboot, then call 'service udevmonitor stop' by hand after boot17:42
slangasekthen post /var/log/udev somewhere17:42
djszapiI do not have time for that, sorry.17:42
slangasek... unless you prefer to stick with the 'sleep' option17:42
slangasekok17:42
djszapihacking the base system upside down is even worse than any sleep17:42
slangasekfundamentally, this scores one of the weaknesses of relying on any sort of a static event to tell you the devices are all up... because upstart can't actually be sure they are, because the kernel and udev aren't sure that they are17:43
slangaseks/scores/underscores/17:43
djszapitell me a better way17:43
djszapiwhich is working, really.17:43
slangasekwhich is why the tty-device-added would have been the better solution, but you ran into problems there17:43
djszapithat is broken17:43
slangasekand to understand why it wasn't work, I'd need to see a udev log17:43
djszapigive me a foobar.conf17:44
djszapiand command set17:44
djszapiI can spend half an hour with this17:44
djszapinot more.17:44
djszapiif you think that helps you, I can help17:44
djszapibut I do not have more time, sorry.17:44
slangasekif you have a solution that works for you, let's not spend any more time on it17:44
djszapisleep 30 -> this is the current solution17:45
djszapibut super fragile.17:45
slangasekthe only way it would help me is to give me the satisfaction of knowing your job was written the Right Way ;)17:45
djszapithere is no right way17:45
slangasekbut to make any progress I definitely need to see a complete udev log17:45
djszapiwe went through those, none of them worked.17:45
djszapigive me a start line17:46
djszapiI can spend half an hour17:46
djszapiwarning: not more17:46
djszapi/etc/init/udevmonitor.conf -> stop rule: commented17:46
slangasekright17:47
slangasekthen reboot17:47
djszapino matter what start line ?17:47
slangasekyes17:47
djszapiin my job ?17:47
djszapiyes what ?17:47
djszapistart on runlevel [23] and stopped udevtrigger17:48
djszapithis is the current start line17:48
slangasekthen, once booted and you can confirm that your tty is present in /dev/, run 'service udevmonitor stop' and post /var/log/udev17:48
slangasekyes - to give you a better start line for your job, I first need the debugging info from udev17:48
slangasekwhich requires a reboot just to get that17:48
slangasekso ignore your own job for now, we just need the complete udev log17:49
djszapiI am paid for this job, I cannot ignore ;)17:49
slangasekthe purpose of this reboot is to *just* get the udev log17:49
slangasekwhether the job starts or not on this reboot is irrelevant to this question17:50
djszapiroot@linaro-ubuntu-desktop:~# service udevmonitor stop17:50
djszapiudevmonitor stop/waiting17:50
djszapiroot@linaro-ubuntu-desktop:~# 17:50
djszapiyou got I was joking right ?17:50
slangasekheh... sorry, sometimes it's hard to get the humor on IRC17:50
djszapi->/var/log/udev is HUGE17:51
* djszapi is intalling wgetpaste17:51
djszapiheh not available, darn...17:51
slangasekpastebinit :)17:51
djszapihow ?17:51
djszapiscrolling over a large file is not possible17:52
djszapitime and buffer wise17:52
slangasekthere's a "pastebinit" command in the Ubuntu archive17:52
djszapihere you go anyway: http://paste.pocoo.org/show/584182/17:52
djszapidone by wgetpaste from the host17:52
djszapiafter scp'ing the file in question17:52
slangasekok17:52
djszapipastebinit is not a vailable on my linaro ubuntu for the pandaboard, sorry.17:53
slangasekwell, it's in the Ubuntu archive ;)  but ok17:53
slangasekare you using an initramfs when booting?17:53
djszapino clue, sorry.17:54
slangasekok17:54
slangasekI'll assume you are then17:54
slangasekudev starts at 9.82s after boot.  kernel sees ttyUSB0 at 13.35s after boot.  That may or may not be enough time that coldplugging has missed the event17:56
djszapidmesg | grep initramfs17:56
djszapi[    0.372070] Trying to unpack rootfs image as initramfs...17:56
* slangasek nods17:56
djszapiwhat next ?17:57
slangasekso I would expect 'start on tty-device-added DEVNAME=ttyUSB0' to do the right thing17:57
slangasekis that one that you tried?17:57
djszapinope17:57
djszapitty-device-added DEVPATH=*ttyUSB017:58
djszapiI tried that one.17:58
djszapiNote the star.17:58
slangasekyeah17:58
slangasekthat should *also* have worked17:58
djszapithen yep, I tried.17:58
djszapiwent nowhere usable.17:58
djszapican I restore the stop rule in here: /etc/init/udevmonitor.conf ?17:59
slangasekyes17:59
djszapihttp://paste.kde.org/460154/ -> this essentially right ?17:59
slangasekoh, actually, I see that the tty subsystem event comes before the usb-serial subsystem event18:00
djszapioh ?18:00
djszapiPL2303 usb-serial converter18:00
djszapithat resides between the pandaboard and the modem.18:00
djszapibecause the pandaboard and the modem both have male serialport connection18:01
djszapiand I have not bothered with fixing that.18:01
djszapisince I had a usb-serial converter by off-hand.18:01
djszapiboth should work anyway...18:01
djszapiso what can we do if any ?18:02
slangasekwhoops, no, we don't get a usb-serial udev event anyway, only a kernel event18:02
slangasekand that udev event is emitted after both the kernel events18:02
djszapiwell18:03
djszapiI am now trying the start on tty-device-added DEVNAME=ttyUSB0 line18:03
djszapilet me know if you need any logs.18:03
djszapiafter a boot18:03
slangasekno logs, though I'm interested to know if that works18:03
djszapilol18:03
slangasekoh wait18:03
slangasekDEVNAME=/dev/ttyUSB018:03
djszapiyeah ?18:03
slangasekso DEVNAME=ttyUSB0 will definitely fail18:03
slangaseksorry18:04
djszapiright, that is why I have been recommended by the stars18:04
djszapithough hard coding is not that bad in this special case18:04
djszapisince it is always like that18:04
djszapittyUSB0 is right under /dev18:04
djszapiif not, many stuff will break in the world :D18:04
slangasekyeah; either DEVNAME=*/ttyUSB0 or DEVNAME=/dev/ttyUSB0 should work18:04
slangasekand if those don't work, I think this is a kernel driver bug18:05
djszapinow: start on tty-device-added DEVNAME=/dev/ttyUSB018:05
djszapiphantastic...18:05
slangasekbecause we should not be seeing these events before the driver is initialized and ready for use18:05
djszapithere is already a pl2303 kernel bug18:05
djszapiI did not even bother to report it18:05
djszapisince I have no clue where to report that18:05
djszapiand I do not wanna spend hours for finding where to report18:05
slangasekI could tell you where based on 'uname -r'18:06
djszapi3.1.1-26-linaro-lt-omap18:06
djszapilinaro just wraps upstream IMO18:07
slangasekin a manner of speaking18:07
slangasekin the case of the pl2303 bug, that's probably true18:08
slangasekthis bug may be an omap-specific usb bug though18:08
djszapiperhaps18:08
djszapibut the other bug was appearing on my Lenovo Thinkpad 510 laptop18:08
djszapitwo connected usb-serial18:08
djszapisecond did not work18:08
djszapinot even with stty -F :)18:09
djszapiin any case18:09
slangasekhttps://bugs.launchpad.net/linux-linaro to report issues with the omap kernel18:09
djszapimy binary is not even run (according to "ps aux | grep foobar") after the start on ... line.18:09
slangasekhmm, really?18:09
djszapireally.18:09
djszapithat is what I said above as well18:10
slangasekI think you should just revert to the 'sleep' for now then, sorry18:10
djszapihttp://paste.kde.org/460160/18:10
slangasekhmm18:10
slangasekI don't know why that's not working18:11
djszapiI wonder how long sleep I should put in there.18:11
djszapinot to get a brittle system18:11
slangaseknor do I18:12
djszapistart on runlevel [23] and stopped udevtrigger18:16
djszapido I need both before a sleep ?18:16
djszapior just the second ?18:16
slangasekprobably the second is enough18:16
djszapilet me try.18:17
djszapisleep 20 is now what I do18:17
djszapitrying atm with 10 secs.18:17
djszapiI just wonder what the border is. :-)18:18
djszapiI will not use this low value for sure.18:18
djszapi(in the end)18:18
djszapislangasek: second is enough, yeah.18:27
djszapislangasek: what should be the stop line ?18:27
djszapijodh, SpamapS and slangasek: thank you for your help18:35
slangasekstop line> I don't know, when do you want it to stop? :)  'stop on runlevel [016]' would be typical18:46
marcoceppiI've written an upstart script, and the script requires a HOME environment, I have a user for the daemon to run as, how do I let upstart script know where HOME is and pass that env on to the exec command?22:57
marcoceppiI tried adding evn HOME="/home/user" to the upstart script with no luck22:58
slangaseks/evn/env/ ?22:58
marcoceppislangasek: yes typo in chat, not a typo in the config22:59
slangasekok, just checking22:59
marcoceppihere is the current upstart script22:59
marcoceppi(if it helps)22:59
marcoceppihttp://paste.ubuntu.com/937599/22:59
slangasekit's possible you also need to 'export HOME'23:03
slangasekI'm not sure what the semantics of env vs. export are, honestly23:03
slangasekI'm not convinced the manpage describes the current behavior accurately23:03
slangasekhmm... but I see other jobs on the system that use that just fine23:04
marcoceppiI'll give export a quick try23:04

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!