/srv/irclogs.ubuntu.com/2010/08/05/#upstart.txt

tgiesso, apologies if i'm out of date, because all the info i could find on this was really old09:23
tgiesbut is there a sound way to get upstart to run a daemon as a given user09:24
tgiesi don't want it to be getting file handles as root or anything09:25
TeTeTanybody has seen an upstart job not returning on 'sudo stop <jobname>' and the job not being terminated>09:44
TeTeT?09:44
ionWhat does initctl status jobname say?10:30
iontgies: For now, use su10:31
tgiesfair enough10:35
TeTeTion: it says identd stop/spawned, process 1095. Though the process still runs10:35
ion“exec su -c 'exec command' user” to avoid leaving extraneous shells around10:36
iontetet: Is its pid 1095?10:36
TeTeTion: yes, it is10:36
ionCurious10:36
ionWhat happens if you kill the process manually?10:36
TeTeTion: it's gone and 'sudo status identd' says 'identd stop/waiting'10:39
TeTeTstarting it with 'sudo start identd' works just fine then10:39
ionAnything interesting in syslog? Also, please pastebin the job definition.10:40
TeTeTion: http://pastebin.ubuntu.com/473444/10:41
TeTeTion: maybe the 'expect daemon' is wrong?10:41
TeTeTion: it seems so, I commented it and now I can start/stop the job10:41
ionYeah, the ‘expect’ stanza in the current release of Upstart only supports very specific cases of forking programs, and it’s very easy to confuse it. The 0.10 release will have a much better implementation of following processes that daemonize. If one doesn’t know *exactly* how the main process daemonizes itself, better just launch it in a way that it doesn’t daemonize at all and not use ‘expect’.10:44
TeTeTion: ok, thanks. pidentd seems to be tailored for use through identd regularly, so the '-b' option makes it a daemon. But if the expect clause is not needed it's all good. Thanks for your interest and help10:50
tgieshow do i go about telling upstart that yes, the job really is stopped, when the status is "start/killed" with an invalid pid11:36
ionAs i said, it’s very easy to confuse it... Would it be okay to reboot? :-P11:37
tgiesmaybe11:39
ionHere’s a horrible kluge if not: http://heh.fi/tmp/workaround-upstart-snafu11:41
ion./workaround-upstart-snafu N, where N is the pid from initctl status.11:41
tgiesi was su -c'ing as a user that i didn't realize had its login shell set to /bin/false11:42
tgiesand upstart got really mad11:42
tgieswow ok12:01
tgiesit's having a hideous time trying to trace out the pid of my ircd12:01
tgiesi think it needs to follow through a few more forks than "expect daemon" allows for12:04
tgiesand it's coming up short12:04
ionWhy fork more than twice to daemonize?12:13
tgieswell, for one thing, this is being su -c'd so it can run as an unprivileged user12:16
tgiesand i think that might be affecting what pid ends up getting tracked.12:17
tgiesit ends up tracking pid 1191 when the correct pid is 119312:21
ionProbably best to make the ircd not fork.12:22
tgies(for instance)12:22
tgieshmm, don't know if i can12:22
tgiesokay, i did12:35
tgieseh. now it ends up with the pid of the sh -c /path/to/ircd12:36
* cwillu_at_work huggles tgies 12:37
cwillu_at_worksomebody who shares my "run as user" woes :)12:37
ionexec su -c 'exec /path/to/ircd' ...12:39
tgiesoh piss i forgot about freaking exec(2)12:42
tgiesthanks12:42
tgieshmmm12:49
tgiesTHAT'S fine now12:49
tgiesbut it still gets lost and hangs on "stop ircd"12:49
tgiesweird12:50
ionAnd there’s no ‘expect’ stanza?12:50
tgiesthe process goes away but it never returns and it never changes job state12:50
ionWhat does initctl status jobname say?12:51
cwillu_at_worktgies, do you have a post-start or -stop script?12:51
cwillu_at_workstop ircd won't return until that finishes iirc12:52
tgiescwillu_at_work: that would be the obvious culprit but no12:56
tgieshmm, i can't get it to break again12:56
tgiesinteresting12:56
tgiesit all works fine now, and that bothers me12:56
cwillu_at_workdid you modify it while it was running maybe?12:56
tgiesdon't think so12:58
Keybukmbiebl: BOF was good17:56
Keybukpost-BOF corridor was also good17:56
mbieblfollowed it via the live-stream17:57
mbieblfwiw, I think continuing to ship sysv init scripts and installing the upstart scripts in parallel is the way to go for Debian17:59
mbieblThis way the kfreebsd case is solved18:00
Keybukyeah I think so18:00
Keybukand the chroot case18:00
mbieblI guess we just need a bit of magic in /etc/init.d/rc and /lib/lsb/init-functions18:00
Keybukinsserv in Debian18:01
Keybukbut yeah, rc too18:01
Keybukwe could do it as a18:01
Keybuk# X-Upstart-Job: xxx18:01
Keybukcomment18:01
Keybukthat gets looked for if sys-rc/inserv are running under Upstart instead of sysvinit18:01
mbieblor the simple convention, that if /etc/init.d/rc finds a file named <service>.conf in /etc/init, it skips running /etc/init.d/<service>18:02
mbieblBut the # X-Upstart-Job: is more flexibel18:03
mbieblin case a sysv init script is replaced by several upstart jobs18:03
mbieblor vice versa, i.e. there is no direct match between the sysv and upstart job name18:04
mbieblcontinuing shipping sysv init scripts also gives people the comfy feeling, that they can easily switch back :-)18:07
Keybukright that's what I thought18:16
Keybuksince then you can do deps and stuff18:16
goraxehi, I'm trying to code a 'user' stanzer for upstart21:57
goraxeI'm trying to figure out the test suite, I can't seem to figure out the TEST_ALLOC_FAIL macro ...21:58
goraxeI'm getting this error as a result of running the tests (null):alloc.c:634: Assertion failed in nih_unref: ref != NULL21:59
Keybukright, sounds like the first argument to nih_unref is NULL? :-)22:03
goraxeokay, is nih_unref called by nih_free?22:05
goraxehttp://pastebin.com/RRMgMEeg22:06
goraxeis the test function 22:06
Keybukposssssibly22:07
Keybukyou can't pass NULL to any nih function22:07
AlanJenkinsevening all22:08
Keybukevening AlanJenkins22:08
AlanJenkinshey Keybuk =)22:08
AlanJenkinsanyone here running arch linux with upstart?22:09
goraxeKeybuk: I have pushed my current code to https://code.launchpad.net/~goraxe/upstart/user_sid22:10
AlanJenkinsanyone know if there is an archive of upstart job definitions? I am trying to write some jobs for arch linux and could do with some example jobs to learn from22:15
AlanJenkinsi have the ones that come with upstart but they are a little basic22:15
Keybukgoraxe: where are you getting the assertion error?22:16
KeybukAlanJenkins: Ubuntu is probably the easiest place22:16
Keybukgoraxe: oh, scratch that22:17
Keybukgoraxe: pretty obvious - you never initialise job->user to NULL in job_new22:17
AlanJenkinsKeybuk: hmmm ok will have to grab a copy of ubuntu and run it in a vm22:17
goraxeKeybuk: thanks22:17
AlanJenkinsthought that may be the case but thought i would ask =)22:17
AlanJenkinsthanks Keybuk 22:17
Keybuknp22:18
goraxewas a bit of a quick cnp job to try and learn the code base22:18
Keybukchrome os is another good source22:18
AlanJenkinsmmm forgot about that one... think i have the image knocking around somewhere too22:19
AlanJenkinswill check chrome first i think22:19
AlanJenkinsB/quit23:10

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