/srv/irclogs.ubuntu.com/2007/02/25/#upstart.txt

=== AStorm [n=astralst@chello084010114027.chello.pl] has joined #upstart
=== AStorm [n=astralst@chello084010114027.chello.pl] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart
=== cortana [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
=== theCore_ [n=alex@ubuntu/member/theCore] has joined #upstart
=== wasabi [n=wasabi@ubuntu/member/wasabi] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart
=== Keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
=== __keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
AlexExtremehey Keybuk, i'm having a few problems with my set of jobs I'm writing :/09:27
Keybukoh, what's up?09:27
AlexExtremei've got the mount-kernel-filesystems job which runs on startup, that runs ok09:28
AlexExtremethen there are jobs with 'start on stopped mount-kernel-filesystems ok'09:28
AlexExtremenone of those are run09:28
Keybuksounds like mount-kernel-filesystems is failing09:28
Keybukdid you try --debug?09:28
AlexExtremedoh, there's a debug option09:28
AlexExtremeit also doesn't work if I omit the ok part09:29
Keybukdefinitely sounds like it's failing09:29
AlexExtremehmm09:30
Keybuk(need to get that information into "initctl jobs" somehow)09:30
Keybukit shows up in initctl events09:31
AlexExtremeit seems to be hanging.... the last command in the mount-kernel-filesystems script is an echo which I put there for debugging, upstart gives no debug output after that09:31
Keybukdoubt it's hanging09:31
AlexExtremeso it handles the starting event, and it's now in the started state09:31
AlexExtremenothing happens after that09:31
KeybukI usually have jobs like "exec openvt -c 2 initctl jobs" and "exec openvt -c 3 initctl events"09:32
Keybukrun on startup09:32
Keybukthey're handy for debugging as well09:32
AlexExtremehttp://frugalware.org/paste/886 << that's the job, can you see any problems with it?09:33
Keybuknot offhand09:34
Keybukoh09:35
Keybuksorry09:35
Keybukit *doesn't* work if you omit "ok"09:35
Keybukthat's interesting09:35
AlexExtremeyeah09:35
Keybukgrep for mount-kernel-filesystems in other jobs09:36
AlexExtremehttp://frugalware.org/paste/88709:36
Keybukhmm09:37
Keybuknothing blocking there09:38
Keybukwhat does init do with --debug?09:38
AlexExtremehold on, i'll take a screenshot09:38
AlexExtremehttp://www.alex-smith.me.uk/files/upstartdebug.png09:39
Keybukinteresting09:40
AlexExtremethe "End of kernel fses" is an echo at the end of the job09:40
AlexExtremelast command in the job, should exit ok09:40
Keybukit doesn't look like it's reaped the child09:41
Keybukthis is in vmware?09:41
Keybukoh, qemu09:41
Keybukok09:41
Keybukadd a shell09:41
Keybukstart on startup09:42
Keybukexec openvt -c 2 bash09:42
Keybuk-- 09:42
AlexExtremek, hold on09:42
Keybukthen change m-k-f to be started when that's started (start on started shell)09:42
Keybukyou should then be able to Alt+F2 and see what's up09:42
Keybukalso would be useful:  init=/usr/bin/strace init09:43
AlexExtremethat's weird...09:43
AlexExtremeit won't start the shell09:44
AlexExtremei think it's because i'm booting qemu with -kernel, -append, etc without using a real bootloader inside it09:44
AlexExtremei'll try a real install, give me a few mins09:46
Keybukthat shouldn't matter?09:47
AlexExtremeno, it messes with the consoles i think, because openvt fails09:47
Keybukodd09:50
Keybuk(at least you're not trying to run it in openvz :p)10:07
AlexExtreme:)10:08
Keybukstill not sure what *that* bug is10:09
KeybukI strongly suspect openvz doesn't give init pid #1 :p10:09
AlexExtremehmm10:09
AlexExtremedoes openvt require the device node for the vt you're trying to open, by any chance?10:10
Keybukoh, could do10:11
Keybukheh10:11
AlexExtremeudev hasn't run yet ;)10:11
KeybukI always debug this stuff with an initramfs that takes care of that kind of thing10:11
AlexExtremeah, well10:12
AlexExtremefrugalware has no initramfs (yet)10:12
AlexExtremewe're gonna add support for initramfs soon though10:12
Keybukcan you try the strace thing?10:13
AlexExtremei'm about to10:14
AlexExtremeit doesn't like that because init isn't pid 110:17
Keybukoh, meh10:18
KeybukI so need to add something for that ;p10:18
AlexExtreme:)10:19
AlexExtremebrb, need to get some food10:19
AlexExtremeback10:29
Keybuk;)10:29
AlexExtremenow10:29
=== AlexExtreme tries to figure out what's wrong
AlexExtremeto me it seems that it's a bug in upstart10:29
Keybuksomething's not right, certainly10:30
Keybukwhat kernel?10:30
AlexExtreme2.6.20.110:30
Keybukit looks like it's not getting SIGCHLD10:31
Keybukor getting stuck there10:31
Keybukrun bash with console owner on startup10:31
AlexExtremek10:35
AlexExtremegot a shell10:35
AlexExtremeweirsd10:35
AlexExtreme*weird10:35
AlexExtremeinitctl list says mount-kernel-filesystems is waiting and in the stop stare10:35
AlexExtreme*state10:35
AlexExtremedamn keyboard10:35
Keybukodd10:36
Keybuk--debug shows nothing?10:36
AlexExtremedebug doesn't say anything about stopping10:36
Keybukhmm10:37
Keybukyou're always going to mount a fresh /dev over the top there, aren't you10:38
Keybukis there a /dev/console FILE by any chance? :p10:38
Keybukif so ... cat it10:39
AlexExtremeno console10:41
Keybukthat's your problem, anyhoo10:41
AlexExtremeit's there on the actual filesystem but not on the ramdisk10:41
Keybukno /dev/console, no /dev/null10:41
Keybukcan't start jobs in that state10:41
AlexExtremeack10:41
AlexExtremei'll have mount-kernel-filesystems create it then10:42
Keybukif you look at my example mount-kernel-filesystems job, I make sure to copy those devices into the ramdisk from /lib/udev/devices10:42
AlexExtremeyeah10:42
AlexExtremebut there's no null or console in that dir for some reason ;)10:42
Keybukyou don't copy them in at all10:48
Keybukhttp://upstart.ubuntu.com/wiki/ComplexEventConfig/UseCases10:59
AlexExtremehmm11:03
AlexExtremequick question: the scripts are run with -e... how would i stop it from terminating the script if a command gives an error?11:07
=== pkt [n=pantelis@athedsl-149244.otenet.gr] has joined #upstart
Keybuk|| true11:13
Keybukon each command that you want to ignore the error for11:14
AlexExtremek11:16
Keybuk(or ||: )11:16
KeybukI tend to dislike that because it looks like Perl11:17
AlexExtremeyeah11:17
Keybuk:; is just as bad11:18
AlexExtremeyay11:27
AlexExtremei've converted the whole of frugalware's rcS.d to upstart jobs11:27
AlexExtremepretty simple ones though, i haven't done anything about responding to udev events yet11:28
Keybukhow are you handling mounting the filesystem?11:29
AlexExtremeit's just a straight conversion of the SysV scripts atm11:31
Keybukah right11:32
_ionThrowing random ideas around, episode 59:11:37
_ionstart on filesystem-checked11:37
_ionemits filesystem-mounted11:37
_ionblock script11:37
_ion    prereq_mountpoints=...11:37
_ion    for m in $prereq_mountpoints; do11:37
_ion        echo "wait filesystem-mounted MOUNTPOINT=${m}";11:37
_ion    done11:37
_ionend script11:37
_ionThe block script is run whenever the job is being started. If it prints any 'wait' lines, the job only goes to 'starting' when all corresponding events have been received.11:37
_ionRace conditions are avoided (or are they?) by not processing new events until the currently running block script has finished (thus the writer of job must be careful with what she does inside a block script)11:37
Keybukthat's quite similar to something iwj and I discussed a while back11:39
Keybuklet me see if I can dig it out11:39
Keybukits possible its on my old laptop11:40
Keybukhttp://www.chiark.greenend.org.uk/~ijackson/d/upstart.text11:41
Keybuk(it's somewhat insance, since ian wrote it, but the core is the idea that upstart implements a turing complete programming language which jobs can use to respond to events in a race-free manner -- since the program is run before the next event, rather than alongside)11:46
_ionInteresting.11:48
_ionBut determining the prerequisite mountpoints based on the current MOUNTPOINT env var surely needs shell scripting or running external processes some other way. Using that syntax, how would one achieve that?11:52
Keybukthat's what I thought11:53
Keybukit was a lot of complexity for no visible gain11:53
AlexExtremenice12:03
AlexExtremehttp://frugalware.org/~alex/bootchart-upstart.png12:03
AlexExtremecompared to this from sysvinit: http://frugalware.org/~alex/bootchart-sysvinit.png12:04
_ionLooks like the connection to frugalware.org is going to timeout.12:07
AlexExtremestrange12:07
AlexExtremeworks here12:07
_iontraceroute reaches taurus.int.elte.hu (157.181.141.18). After it it's all * * *s.12:09
AlexExtremehold on, let me drop it on my server12:10
AlexExtremehttp://www.alex-smith.me.uk/files/bootcharts/12:11
_ionNow the pictures loaded.12:11
pktAlexExtreme: yes but it seems that with sysinit you were running more services, correct?12:11
_ionBut if i reload, it's "connecting..." again for ages.12:11
AlexExtremeyes, i know, it's not completely accurate12:11
Keybuk18s is nice12:12
pktalso, are you running SMP?12:12
AlexExtremepkt, no, this was in a vmware VM, it was only using 1 core12:12
pktThat is nice :-)12:12
pktI guess the worst thing in startup time is the shell scripts (especially when they do extensive fs ops)12:13
AlexExtremeyes12:14
Keybukthat's what einit tries to address12:14
pktwith very carefully tuned sysvinit + scripts I could do ~25s in a 386sx/25 (2.6.8 stripped down)12:14
pktOf course some current subsystems take more time to initialize :-(12:15
AlexExtremenow i need to try and work out what the hell is wrong with my fsck script, it seems to interfere with the sysv compat stuff. if fsck gets run, it tries to run runlevel 4 and runlevel 0 at the same time12:15
_ionWould converting dash to a library and linking to it instead of execing shells help at all?12:15
_ion(with upstart, that is)12:15
AlexExtremeprobably12:15
AlexExtremebut that wouldn't work for distros without dash12:15
pkt_ion I think redhat does something close to that with their shell12:16
pktthey have something that includes several typically external programs as libraries 12:16
pktbut is not usable as a shell (i.e., not interactive)12:16
pktOf course, this caused both positive and negative feelings to many :-)12:17
Keybukisn't that just busybox?12:25
pktKeybuk: no, it is (was?) a redhat-specific shell-like thing that included e.g., functionality for setting up LVM/RAID etc12:26
pktbut I 'm forgetting its name ...12:26
Keybukok12:26
Keybukwhat einit does it has C modules that handle the common things like setting hostname, checking and mounting filesystems, activating swap, etc.12:26
Keybukin practice, these things aren't that configurable (it's not like a shell script, which you can just edit)12:26
Keybukand everything is configured from one large einit.xml12:27
_ionThe initialization of dash doesn't take long, so the answer to my question is probably "no".12:27
_iondash -c ''  0.00s user 0.00s system 0% cpu 0.009 total12:27
pktyep the xml part sucks12:27
pkt_ion, I don 't think that dash per se is the problem12:27
pktusually the problem is like an "abstraction penalty" for using unix utilities for stuff that would only take a few lines of C code12:28
_ion(Side note: "perse" in Finnish means an arse.)12:28
pktoops :-)12:29
pktbut I did leave a blank12:29
Keybukie. forking then execing grep, which loads localisation libraries and parses a file linewise matching against regular expression objects ... instead of using strstr()12:29
pktexactly (and I could think of even worse stuff when amateur admins are involved :-)12:30
Keybuke.g. /etc/event.d/hostname12:31
Keybukthe shell version looks something like:12:31
Keybuk - stat /etc/hostname12:31
Keybuk - fork/exec cat: fopen/stat /etc/hostname, read, write to stdout, close, capture stdout into variable12:31
Keybuk - compare variable against empty string12:31
Keybuk - fork/exec hostname: capture stdout12:31
Keybuk - compare variable against empty string12:32
Keybuk - set variable to localhost12:32
Keybuk - fork/exec hostname, set hostname12:32
Keybukin C, that might be:12:32
Keybuk - gethostname()12:32
Keybuk - fopen(/etc/hostname)12:32
Keybuk - if opened: fgets12:32
Keybuk - else if still unset: strcpy12:33
Keybuk - sethostname()12:33
Keybuk4 syscalls instead of ~10012:33
_ionYeah12:33
pktKeybuk: the only problem is that you can only provide "embedded" functionality in the "shell" for very simple stuff (those that cannot be configured in a gazillion different ways)12:34
Keybukpkt: I don't follow?12:35
pktE.g., redhat that provides the LVM functionality in their "shell" actually provides a "stripped-down" version12:35
Keybukah12:35
KeybukI see12:35
pktOtherwise you get a *huge* "shell/interpreter" which is again a loss12:36
pktIt is, as always, a tradeoff :-)12:36
Keybukflexibility vs. speed12:36
pktActually "speed for a special case" or "robust speed"12:37
Keybuka while ago, a friend and I wondered whether it'd be possible to write a scripting language based around syscalls12:37
pktthat is roughly what I thought as well, that sort of a "DSL" for booting would provide the largest benefit/cost ratio12:38
KeybukDSL?12:38
_ionDomain-specific language IIRC12:39
pktDomain-Specific Language, yep12:39
Keybukright12:39
pktbut I view upstart as being an important step towards this direction12:39
Keybukright now we have <action> exec and <action> script, we can always add <action> foo later :p12:40
Keybukpre-start perl ...12:41
Keybukend perl12:41
Keybuk:p12:41
AlexExtremeugh :p12:41
_ionHaha12:41
pkt:)12:41
pktI think the important think in upstart is to think really hard about the interactions of the base system components (especially for desktops)12:42
pktThis is no trivial problem (which is why I have seen no perfect "job" set or job language yet)12:42
pktOnce this is sorted out more or less it will be much easier to take the "extra step"12:43
Keybukrobust first, speed later12:43
pktPlus it may be proven that the extra speed doesn 't really matter after all12:44
pktBut the really hard stuff (at least for me) is to figure out how to support as many common use-cases as possible with as few "artificial waits" as possible12:45
=== juergbi [n=juerg@80-219-17-102.dclient.hispeed.ch] has joined #upstart
pktAnd do that in a world where stuff (from all levels of the stack) come and go all the time12:45
pkt(think e.g., ATA over Ethernet over WLAN :-)12:46
Keybukindeed12:46
pktplus the fact that e.g., a developer will want to also start/stop stuff on demand12:48
pktand the fact that some unix beasts (like shells) are a bit "special" on how you need to handle them 12:51
pktOr they loose their settings :-)12:51
pkts/settings/history12:51
Keybukheh01:00
pktyep, *every single pitfall* of sysvinit, I 've hit it ;-)01:02
AlexExtreme:)01:02
AlexExtremerandom thought: sysvinit scripts provide a start and a stop. with upstart, to do the stop part you'd have to create a seperate job, no? (at least, for things that aren't daemons, like saving mixer settings. daemons would get SIGTERM)01:04
Keybukyou can do it either way01:05
Keybukcould you have a mixer-settings job that restored them in pre-start and saved them in post-stop01:05
Keybukthen you could "start mixer-settings" and "stop mixer-settings" :p01:05
Keybukor you could have two separate jobs that do it in script01:05
Keybukit depends what makes more sense really01:06
Keybukyou could do that for everything01:06
Keybukie. have a hostname job that sets the hostname in pre-start but does nothing in post-stop01:06
Keybuk(or even unsets it)01:07
Keybukthen the "hostname" job would be running all the time the hostname was set01:07
Keybukand you could stop hostname to unset it01:07
Keybukand restart the job to reset it01:07
AlexExtremebut01:07
Keybukbut that makes somewhat less sense than just having a set-hostname task01:07
AlexExtremeif you did it with pre-start and post-stop01:07
AlexExtremewouldn't it not work because you need an exec/script/respawn/whatever ?01:08
Keybukno01:08
Keybukthose are optional01:08
AlexExtremehmm01:08
Keybukyou can have process-less jobs now01:08
Keybukit was supposed to work in 0.3.5, but I broke it just before release01:08
Keybukit works in trunk01:08
AlexExtremebut if they were missing and you did start mixer-settings, wouldn't it run the pre-start script, then jump straight to stopping and run post-stop?01:09
Keybukno, sticks in running01:11
AlexExtremeah01:11
AlexExtremeok01:11
Keybukhttp://upstart.ubuntu.com/wiki/JobsAsStates01:12
AlexExtremeah01:14
AlexExtremeI see01:14
KeybukI tend to think in terms of what a sysadmin would rather do01:15
Keybukwhat makes more sense01:15
AlexExtreme:)01:15
Keybukstop the mixer job to save them and mute the card01:15
AlexExtremesounds logical01:15
Keybuk(and thus restart the mixer to save the settings)01:15
Keybukor run the save-mixer-settings job to save them01:16
KeybukI can't decide whether we need lots of small options for job control "start on", "stop on", "when", "from", "foo", etc.01:22
Keybukor just one big option01:22
=== Md [i=md@freenode/staff/md] has joined #upstart
AlexExtremeIMO one big option would be too complex, i personally like it with small options01:43
AlexExtremebtw, what is the problem with logd?01:43
Keybukkill it, any job with it as stdout ends up dying mysteriously and silently01:44
AlexExtremeah :/01:44
Keybukso interestingly:02:53
Keybuksome jobs can be defined by what starts or stops them02:53
Keybukbut others it's easier to define by when they should be running02:53
=== space-m0nkey [n=chatzill@client-82-3-73-143.manc.adsl.virgin.net] has joined #upstart
=== jonib1 [n=jonas@ua-83-227-144-18.cust.bredbandsbolaget.se] has joined #upstart
AlexExtremehmm03:45
AlexExtremeACTION=="add", SUBSYSTEM=="block", KERNEL=="*[!0-9] ", RUN="/sbin/initctl emit block-device-added %k"03:45
AlexExtremeis that rule ok for a block device added?03:46
AlexExtremeor should I add -eDEVNAME=%k too?03:46
=== j_ack [n=rudi@p508D94A9.dip0.t-ipconnect.de] has joined #upstart
=== elpaso [n=ale@host193-86.pool8252.interbusiness.it] has joined #upstart
elpasohello04:42
elpasois there anybody out there?04:43
=== elpaso [n=ale@host193-86.pool8252.interbusiness.it] has left #upstart ["Kopete]
=== space-m0nkey [n=chatzill@client-82-3-73-143.manc.adsl.virgin.net] has joined #upstart
=== cortana [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
=== jonib1 [n=jonas@ua-83-227-144-18.cust.bredbandsbolaget.se] has left #upstart []
=== space-m0nkey [n=chatzill@client-82-3-73-143.manc.adsl.virgin.net] has joined #upstart
=== cortana [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
=== space-m0nkey [n=chatzill@client-82-3-73-143.manc.adsl.virgin.net] has joined #upstart
=== cortana [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart

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