/srv/irclogs.ubuntu.com/2013/08/20/#upstart.txt

jmuxHi. Im on Ubuntu 12.04. I'm using FAI for software updates and want to run FAI on boot and trigger a reboot after the system was updated. Currently my job starts on starting kdm to run before X. Calling reboot just deadlocks the system in a state of starting an stopping jobs. How can I reboot my system from within an upstart job?09:02
jmuxjoint #kubuntu-devel09:06
xnoxjmux: can you paste your job?09:14
jmuxxnox: http://paste.ubuntu.com/6005780/ and http://paste.ubuntu.com/6005791/09:34
jmuxxnox: the first script is the upstart job, the second the actual script (/etc/init.d/goto-configure-online). The FAI call is at the end of the second script (fai -N softupdate).09:37
xnoxjmux: that looks weird. usually scripts under /etc/init.d/* are started as normal sysv-init scripts by upstart when it is ready. Your start on condition for network is not deterministic. 09:38
xnoxjmux: maybe "start on (local-filesystems and net-device-up IFACE!=lo)" is better as you will have network at that point.09:38
xnoxjmux: you only need to reboot if "/var/run/reboot-required" is present after upgrades.09:39
xnoxjmux: instead of FAI, i'd use unattended-upgrades and cron those instead.09:41
xnoxjmux: with respect to hang debug the script & environment it's running under. is it expecting input or some other environment vars?09:41
xnoxjmux: instead of starting your init.d script from the upstart job: add proper LSB headers, remove upstart job, and let the init.d script be started by sysv-init.09:42
jmuxxnox: probably - this is an old job originating from 10.04 :-)09:42
xnoxas it should be.09:42
xnoxjmux: it looks very odd. in 12.04 there are many improvements for sssd/slapd et.al.  i'd start splitting that mega script into smaller chunks / separate jobs. whilst carefully considering if all the chunks are still needed.09:44
jmuxxnox: I'm fixed on FAI and the update has to run on boot. The update is triggered via a variable in LDAP.09:45
xnoxjmux: i see.09:45
jmuxJust some background - this is running on a client, we have our own APT repositories and we just update during startup, especially if you do a dist-upgrade from a previous release.. So back to my original problem - is there a way to reboot my machine from within an upstart job without deadlocking upstart? 09:51
xnoxjmux: one can. e.g. cloud-init has ability to apply updates and reboot the machine. but it does it before starting $most of the sysv-init scripts. One would reboot with "reboot", not "poweroff".10:01
jmuxxnox: ok - I'll check cloud-init and adopt my upstart jobs to the new "have network" dependency.10:07
jmuxI don't think there is a big difference between reboot or poweroff for upstart.10:09
xnoxjmux: poweroff cuts the power to the machine. and it doesn't come back up. with reboot it does.10:10
xnoxjmux: this may have been different in the past, but with newer kernels that's what the behaviour is.10:11
xnox(and should be)10:11
jmuxxnox: yeah - I know :-) But from the upstart POV it just has to stop all jobs and prevent new jobs from starting, which it currently fails to handle, at least on 12.04.10:13
xnoxjmux: oh I see. so upstart stops all the jobs that it manages, and then changes the runlevel to stop all the init.d scripts. At that point sendsigs/syv-init completes the shutdown sequences.10:15
xnoxjmux: those init.d scripts can hang the shutdown, and unfortunately it's outside of upstart's control at that point (upstart is not running any more)10:15
xnoxincreasing the upstart logging (e.g. boot with kernelarg --debug) should show if it's upstart job that hang.10:16
jmuxxnox: I'll check that and report back, but it may take a few minutes.10:20
=== Md_ is now known as Md

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