/srv/irclogs.ubuntu.com/2012/05/22/#upstart.txt

louischatriotHello09:59
djszapislangasek ping17:20
djszapiI have installed 12.04 on my pandaboard, and that comes with this upstart version: 1.5-0ubuntu5. This version seems to support the logging out of the box in /var/log/upstart/myjob.log17:21
slangasekyep17:22
djszapihandy, I can use "tail -f /var/log/upstart/myjob.log"17:22
slangasek:)17:22
djszapislangasek: my job is not run after a reboot, I do not understand17:31
djszapiupstart job: http://paste.kde.org/484466/17:32
djszapilol it started VERY late.17:32
djszapiminutes after the boot17:32
slangasekwith the 'stopped udevtrigger' start condition?17:33
djszapiI presume17:34
djszapibtw, does the upstart job have rights to write this folder ? /root/.config/MyStuff/foobar.conf ?17:34
djszapithe daemon works fine, if I run manually.17:34
djszapibut not if it is run via the upstart stuff17:34
djszapithe creation of that configuration does not happen in the latter case.17:35
djszapiif I execute exactly the same command as root, then the daemon works fine17:38
djszapigot a clue ?17:38
djszapislangasek: ^17:39
slangasekan upstart job will run as root unless otherwise specified17:39
djszapibut why is it not working then without the upstart invocation ? :o17:39
djszapiit works fine manually...17:40
slangasekdunno17:40
slangasekseems like a case for strace17:40
djszapiI have not clue how to read the strace output17:40
djszapiI really see such a spammy output.17:40
slangasekI could interpret, but since you mention this is proprietary code, that may leak details of the inner workings that you might not wish to share17:41
djszapiexactly.17:41
slangasekthe main thing would be to scan the strace output for references to that file17:41
slangasekand see what it's doing17:41
djszapiare you usre ?17:41
djszapisure*17:41
slangasekI'm sure that's how I would debug it in your place :)17:43
djszapiexec strace ... ?17:45
djszapiin the upstart job ?17:45
djszapislangasek: ^17:47
slangasekyes17:47
slangasekprobably best to use 'exec strace -ff -o /var/log/debugging-my-app [...]'17:48
slangasekso that upstart doesn't itself have to process all the spammy output17:48
djszapislangasek: damn18:18
djszapiI found the issue18:18
djszapifor some reason the stuff is not saved into ~/.config but into /.config (root fs, yes)18:18
djszapiif I run the daemon explicitely, the place for saving those is ~/.config18:19
djszapislangasek: what does upstart do differently ?18:19
slangasekdoes your program rely on $HOME being set?18:22
slangasekbecause $HOME isn't set for upstart jobs18:22
djszapislangasek: why the heck is that not set ??18:23
slangasekwhy *would* it be?18:23
slangasekyou're not running the job in a login session18:24
slangasekit wouldn't be set for any init scripts started at boot time either18:24
djszapiwell, /.config is super weird location18:25
djszapiit is the source of super maintenance waste of time18:25
djszapiconfig files are usually saved into a $HOME directory.18:25
slangaseknot for system-level services, they aren't18:26
djszapiofc, I run the job in a login session.18:26
slangasekand upstart jobs are system-level services18:26
slangasekyou can always do 'env HOME=/root' as part of the job18:26
djszapiI know, but that is a hack.18:26
slangaseknope18:26
slangasekyour assumption that $HOME should be set for you is incorrect18:26
djszapino18:27
djszapiwell18:27
djszapilet us ask differently.18:27
djszapiwhere are the system-level configs are stored ?18:27
djszapiyou cannot automate that.18:27
djszapiperhaps directly in /etc/18:27
djszapias in: /etc/MyCompany/myapp.conf18:27
slangaseksystem-level configs are stored in /etc, yes18:27
slangasekand normally, system-level programs don't need to be told that18:27
slangasekyou appear to have a program which is normally run as a user and you're trying to run it as a system job18:28
aaronlevyI'm having trouble getting an upstart service to start on boot (ec2). I tried start on "network-services" as well as "memcached" but it doesn't seem to be even trying. Any suggestions on next steps to debug? I don't see anything in syslog for the service or anything 'init' related. 18:32
aaronlevy1.5/precise fwiw18:33
djszapislangasek: I am running a program which has stuff to store18:35
djszapiso I need to use a configuration file18:35
djszapino matter which user runs that, it is run18:35
slangasekdjszapi: fine, but that's a problem between your upstart job and the program itself18:36
slangasekupstart should not be setting $HOME18:36
slangasekaaronlevy: 'start on started memcached' may be what you're looking for18:37
aaronlevyslangasek: Sorry, typo. I do have "start on started <foo>"18:38
slangasekaaronlevy: is memcached an upstart job?18:38
slangasekif it's an init script, this won't work18:38
aaronlevyYeah, it's init (or at least it doesn't have a .conf in /etc/init). Oddly that is the example they use in the cookbook18:39
slangasekreally?18:39
slangasekso 'start on started memcached' will definitely fail; there are no upstart events generated for memcached in the current package18:39
slangasekbecause it's an init script and not an upstart job18:40
slangasekjodh: ^^ it might be a good idea to not use memcached as an example in the cookbook, for this reason?18:40
aaronlevyYeah that might help :)… there are a handful of examples using it (task=, instances)18:40
aaronlevyHmm. What is the recommended event to chain to (with networking available)?18:41
slangasekaaronlevy: what does the job you're trying to run actually do?  Does it have anything to do with memcached?18:41
slangasek'start on runlevel [2345]' is the generic "my network and filesystem are available" rule18:42
aaronlevyslangasek: loosely. I was just using that as a separate test. I can do pre-start stuff to make sure what i need is running… just need it to at least try and start itself :)18:42
aaronlevyslangasek: fwiw, the cookbook also uses "network-services' as an abstract job example. But doesn't seem like that is an upstart job either. I guess I should have checked, but it does make things a little unclear18:43
aaronlevyThanks for your help18:44
slangasekhmm, that's a rather unclear example, isn't it :/18:44
slangasek(1, 2) This job is not actually available in Ubuntu yet, but is expected to be added early in the 11.10 development cycle.18:45
slangasekoops18:45
aaronlevyHmm. using [2345] still nothing. 18:53
aaronlevywait. I messed up syntax. trying again18:54
aaronlevyYup, working. Thanks again.18:59
djszapislangasek: is there a way to run the daemon explicitely as root ?19:39
djszapifrom the upstart job, that is.19:39
djszapiexec does not have a "-u" user switch19:40
djszapisu - ... or how ?19:40
djszapithat way, the HOME variable would be set19:40
slangasekno, it wouldn't19:42
slangasekif you want a HOME variable, set a HOME variable - I told you how :)19:42
slangasekwell, running with su would set it maybe, but that's bad form19:43
slangasekbecause then you get a pam session as well, and you don't want that19:43
slangasekyour application requires $HOME to be set, so just add 'env HOME=/root' and be done with it19:44
slangaseknow, you *can* run upstart jobs as different users; there are 'setuid' and 'setgid' verbs.  But that has nothing to do with login shells and isn't going to set $HOME, and root is the default user19:45
djszapislangasek: I do not understand why upstart tries to use a "user" (root as default) without setting the HOME user variable.19:49
djszapithat makes no sense.19:49
djszapithen do not use the "root" user.19:49
slangasekwell, I'm sorry you don't understand, but this is how Unix *works*.19:49
slangasekthis is nothing new to upstart.19:49
djszapirunning stuff as a user has the consequency you *do* need to set the HOME variable.19:49
slangasekyou would have gotten the exact same behavior with an init script.19:50
djszapisince the something that runs as a user would like to have a safe location for its stuff inside the home path...19:50
djszapiit is not all the apps' responsibility to set the stuff explicitely.19:51
djszapislangasek: ^19:54
slangasekdjszapi: no, it's not the app's responsibility, it's the upstart *job's* responsibility19:57
slangasekthere's really no sense in arguing about this further; as I said, this is completely in line with how init scripts work, and it's not going to change19:57
djszapithis is really a bad design19:58
slangasekyou're arguing with 30 years of history :)20:03
djszapiso did wayland...20:03
djszapiand won...20:03
qkslvrwolfhello, all.  I'm fairly new to working with upstart.  Working with VMs using Opennebula using LVM.20:07
qkslvrwolfI'm trying to get the contextualization to work.20:08
qkslvrwolfusing upstart20:08
qkslvrwolfopennebula suggests updating /etc/init/networking.conf and /etc/init/network-interface.conf20:08
qkslvrwolfand having both of them run the static network IP address script in the pre-start scripts of both those files.20:09
qkslvrwolfI've done that, but I get "couldn't read /etc/network/interfaces" and "interface ethX declared allow-auto twice" in dmesg20:10
slangasekqkslvrwolf: umm.  are these opennebula suggestions available online somewhere?  I'd like to read exactly what they're suggesting and why20:11
qkslvrwolfyes20:11
qkslvrwolfone sec...20:11
qkslvrwolfhttp://dev.opennebula.org/projects/opennebula/repository/show/share/scripts20:12
qkslvrwolfhttp://dev.opennebula.org/projects/opennebula/repository/revisions/master/show/share/scripts/ubuntu/net-vmcontext20:13
qkslvrwolfthe second one is the more direct link20:13
qkslvrwolfthe README file has the suggestions I'm following.20:13
slangasekyuck20:13
slangasekfwiw, I strongly advise against editing the stock upstart jobs20:14
qkslvrwolfok20:14
qkslvrwolfFair.  20:14
qkslvrwolfCan you point me in the right direction for accomplishing a dynamic assignment of a static IP in a VM, then?20:14
qkslvrwolfie., assign a static IP based on a dynamically generated mac address?20:15
qkslvrwolfat VM boot time?20:15
slangasekso you could do something like this, as a *separate* upstart job: http://paste.ubuntu.com/1001688/20:16
slangasekthough honestly, I think this would make more sense as an upstart rule20:16
slangaseksorry20:16
slangasekudev rule20:16
qkslvrwolfWould you mine letting me know why you feel that way? 20:30
qkslvrwolf(learning purposes, not disagreement)20:30
slangasekbecause it's part of setting up the attributes on the device itself20:31
slangasekthat's absolutely something that udev rules are for20:31
qkslvrwolfeven though it's for the IP address?20:32
qkslvrwolfnot the mac address?20:32
slangasekoh, I misunderstood the goal, sorry20:33
qkslvrwolfNo, I'm sure I wasn't clear.20:33
slangasekin that case, yeah, it can be done as an upstart job20:33
qkslvrwolfok20:34
qkslvrwolfAnd I'm guessing it makes most sense as a system job in /etc/init?20:36
slangasekif you're doing it as an upstart job, definitely20:36
slangasekbtw, how does this upstream script know which interface it's being called for?20:37
qkslvrwolfthe upstream script (if I used it unmodified) just does an ifconfig -a and takes steps for any interfaces it finds that aren't loopback.20:38
qkslvrwolfwhich is basically generating a stanza for /etc/network/interfaces20:38
qkslvrwolfbased on the mac address it finds.20:38
qkslvrwolfwhich it did correctl...after boot I was able to ifup my interfaces and they came up fine20:39
qkslvrwolfduring boot i got errors.20:39
qkslvrwolfbut I didn't change anything20:39
slangasekah, right20:39
slangasekso the problem is that it generates it once for /etc/init/networking.conf, and again for /etc/init/network-interface.conf, since *both* jobs are guaranteed to fire :)20:40
qkslvrwolfright.20:40
qkslvrwolfi wondered about that.20:40
slangasekand the upstream script doesn't clean up after itself20:40
qkslvrwolfSo if I just chose one of them, it would probably work better?20:40
slangasekyeah20:40
qkslvrwolfis there one I should prefer?20:40
slangasekpreferably /etc/init/network-interface.conf20:40
qkslvrwolfok.  But won't that fire for each interface?20:41
qkslvrwolfthe script handles them all at once...but then I guess networking starts on local-filesystems which probably doesn't guarantee the interfaces are up?20:42
slangasekcorrect, /etc/init/networking.conf isn't guaranteed to happen after all interfaces are up20:46
slangasekso if you have more than one interface... yeah, it'll still fire more than once :/20:47
qkslvrwolfOk.  I actually just tested... I went ahead and kept it in networking.conf and removed form network-interface and it worked.  If it gives me problems I'll re-evaluage20:47
* slangasek nods20:48
qkslvrwolfthank you so very much for your time...i appreciate the help.20:48
slangaseksure thing :)20:48
djszapislangasek: anyway, I would personally change how qt works20:48
djszapimy dependency handling the configuration stuff, but the maintainer does not appreciate that :D20:49
djszapiso if both sides are stubborn, I need to work around both limitations :D20:49
djszapiof course everybody using a daemon with that framework has to do the same20:50
slangasekit's just a one-line fix-up in the upstart job ;)20:52
djszapifor /everybody/20:53
djszapiusing a daemon with this framework at least20:53
slangasekwell, yes20:53
djszapiperhaps even with others having the same design20:53
slangasekthough I don't think qt is a particularly common framework for daemons20:53
djszapiit should be solved like I said20:53
djszapino separate framework attentions should be made.20:54
djszapior perhaps attention there would also be good for robustness20:54
djszapiwhy not ?20:54
djszapiqtcore is a total cool fit for daemons20:54
slangasekexcept for the bit where it cares about $HOME, which daemons should not ;)20:54
slangasekthis is *not* a standard part of a daemon's environment20:55
djszapilike I said20:55
djszapiI proposed the change there as well20:55
djszapiif not set, do not use /.config20:55
djszapibut some sensible.20:55
djszapibut the bare minimum is a /big/ and /fat/ warning20:55
djszapislangasek: thank you for your help anyway21:06
slangaseksure thing21:07
djszapithough env HOME=/root will not work21:07
djszapislangasek: or is that an upstart specific syntax ? I thought that runs bash21:07
djszapis/env/export/ might work21:07
slangasekthat's an upstart-specific verb21:08
slangasekyou set it outside your script21:08
slangasekso:21:08
djszapiI do not have script...21:08
slangasekenv HOME=/root21:08
slangasekexec $foo21:08
slangasekthe init(5) manpage explains this verb21:08
djszapislangasek: right21:16

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