/srv/irclogs.ubuntu.com/2013/10/17/#upstart.txt

kiorkyhi; im trying to debug upstart inside a docker, and i would like to attach a gdb to it, but as it crashes directly, i cant10:50
kiorky(idea is to launch one docker with the compiled init and attach a gdb from another shell)10:51
kiorkyif someone has an idea on how i can debug ...10:51
jodhKiorky: I've never used docker. Do you get any crash output? You could boot your docker environment specifying bash as your init, then start upstart in a separate pid namespace running with --no-startup-event, then attach gdb to that pid.12:03
kiorkyjodh: well the difficulty is the docker magic between12:04
kiorkyjodh: and that upstart wants pid - 112:04
kiorkyjodh: well, i want to debug the start process, that's the real problem amongst all12:05
jodhkiorky: in all likelihood, the crash is probably due to some environment issue: try installing procenv into the docker environment (its in the debian and ubuntu archives, or https://launchpad.net/procenv/), and boot the docker container so that procenv runs first, logs the environment output, then execs upstart. I've blogged about how to do this for lxc here:12:05
jodhhttp://ifdeflinux.blogspot.co.uk/2013/04/observing-initial-lxc-environment-using.html12:05
kiorkyjodh: i dont know why but init dies, without logs, so my idea was to gdb it12:05
kiorkyjodh: lookin' thx12:06
jodhkiorky: yes, you can run upstart in the docker environment as *pid 1* if you put it into a new pid namespace within your docker environment.12:06
kiorkyjodh: ha i see!12:06
jodhkiorky: are you sure there is no stdout/stderr output being logged by docker somewhere? no docker option to record the console?12:06
kiorkyjodh: normally, all goes to docker logs, but anything is captured12:07
kiorkyjodh: i have some logs, but nothing fatal12:07
kiorkyjust that the docker boot and after a little while, dies12:07
kiorkywithout explanation12:07
kiorkybut i will look your blog post and go forward into trying to exec init inside a new pid namespace12:08
jodhkiorky: I've covered the technique in the cookbook too: http://upstart.ubuntu.com/cookbook/#debugging-another-instance-of-upstart-running-as-root-with-pid-112:09
kiorkyjodh: in your setup, init starts and then you attach with gdb isnt it ?12:10
kiorkyjodh: problem there is that init dies before i can even attach to it12:11
kiorkyjodh: i mean on the cookbook12:11
jodhkiorky: Well, in the lxc example yes, but not in the first example using my clone utility.12:12
jodhkiorky: I still think it might be quicker to use the procenv trick to get a dump of the docker environment, then run procenv in a "normal" environment and diff the files. 12:14
kiorkyjodh: the clone is same, you one already running, isnt it ?12:16
kiorky:)12:16
modafinilI'm really at my wits-end here -- how can I, in an unprivileged upstart job, emit an event to start another job?13:58
modafinilI have a job to make logs for a service, so I want the service to start this job 'make sure my logs dir is owned by serviceuser' and then run itself unprivileged (using setgid/setuid)13:59
modafinilReally annoying that pre-start runs as the setuid user :/14:00
modafinilobviusly sudo doesn't work14:00
jodhmodafinil: easy - turn it round: have the job that handles your logs run as root, then make the job that actually runs the service (with setuid/setgid), specify 'start on stopped <log_job>'.14:13
modafiniljodh: the problem is that i have a bunch of jobs, and i want them all to use this one job (and set the variable of where the logs dir is)14:13
modafinili think i figured it out though14:13
modafinili can 'start on starting acmeco-*' to wildcard match in the log creation job14:14
jodhmodafinil: have the root job that starts first 'export logdir' so that "$logdir" is available to all the non-priv jobs.14:16
modafiniljodh: i agree that would work, but its not really workable for this specific situation -- theres hundreds of different services and i don't want to have one thing that needs to know about them all14:20
modafinilthis wildcard match definitely works though14:20
modafinili appreciate your help! thanks!14:21
kiorkyjodh: simpler solution; add a sleep(3) and recompile upstart ;) so i have the time to attach gdb with lxc-execute15:51

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