[02:39] <rgl> hello
[02:39] <rgl> anyone running upstart on a linux-vserver guest?  I can't get it to run at all :/
[02:40] <Keybuk> what does it do?
[02:40] <rgl> I really dunno, but it seems it doesnt do anything, it just sits there wating for something :|
[02:41] <rgl> I also tried to use the --versbose switch, but it doesn't output anyting at all
[02:41] <rgl> err verbose
[02:41] <rgl> also, it doesn't quit unless I send it the KILL signal
[02:42] <Keybuk> have you got anything in /etc/event.d ?
[02:42] <Keybuk> does --debug reveal any insights?
[02:43] <rgl> humm the --debug switch doesn't show up in the init --help
[02:43] <rgl> lemme try it :D
[02:44] <rgl> humm nope, no output.  I have to say, that there us no /dev/console in the guest
[02:44] <rgl> s,us,is
[02:44] <Keybuk> the lack of /dev/console will be why :)
[02:44] <Keybuk> do you have anything in /etc/event.d in the guest?
[02:46] <rgl> Keybuk, http://paste.linux-vserver.org/607
[02:47] <Keybuk> could you add /dev/console to the guest (and /dev/null)
[02:47] <Keybuk> and try then?
[02:48] <rgl> I'll have to see how to do it heheh  gimme a sec :D
[02:48] <Keybuk> mknod .../dev/console c 5 1
[02:49] <rgl> its not that simple.
[02:50] <rgl> oh its seems there is no way to have it inside a guest :(
[02:51] <Keybuk> ?!
[02:51] <rgl> you known linux-vserver.org?
[02:51] <rgl> I maean, do you use it :D
[02:52] <Keybuk> I don't know it, no
[02:52] <Keybuk> is that the one that doesn't start init as process #1 ?
[02:52] <rgl> it does
[02:53] <rgl> is there a way to make upstart write in a file instead?
[02:53] <Keybuk> if you don't mind changing the code ... sure
[02:53] <Keybuk> main() in init/main.c ... comment out this bit:
[02:53] <Keybuk>         for (i = 0; i < 3; i++)
[02:53] <Keybuk>                 close (i);
[02:53] <Keybuk>         process_setup_console (NULL, CONSOLE_OUTPUT);
[02:53] <Keybuk>         if (! restart)
[02:53] <Keybuk>                 reset_console ();
[02:54] <rgl> lemme see if I can build it :D
[02:54] <Keybuk> (that code's probably bogus anyway, we should let the kernel assign our stdin/out/err
[02:54] <Keybuk> but there's a bug in the ubuntu initramfs ;p)
[02:55] <rgl> this is not using initramfs at all
[02:55] <rgl> its just running /sbin/init in a different namespace
[02:56] <Keybuk> yes, I mean the reason that code is there is because our initramfs assumed that init re-opened /dev/console (sysvinit also does) -- I plan to fix *that*, so upstart just uses whatever it's given
[02:56] <rgl> sorry, but how do _I build a ubuntu package in place?  will debian/rules binary do the trick?
[02:56] <Keybuk> debian/rules build
[02:56] <Keybuk> fakeroot debian/rules binary
[02:56] <Keybuk> or just dpkg-buildpackage -rfakeroot
[02:57] <rgl> You?  oh are you the upstream developer? :))
[02:57] <Keybuk> of upstart, yes
[02:57] <rgl> cool, nice to meet you :)
[02:58] <phsdv> Hi, a short question, can I currently (upstart 0.3.0) define a function within the 'script' 'end script' block?
[02:58] <_ion> It's a sh script.
[02:59] <Keybuk> phsdv: sure, you can only use it within that block though
[02:59] <phsdv> ok, thanks, than my problem lies somewhere else.
[03:00] <Keybuk> phsdv: careful not to use bashisms, /bin/sh may not be bash :)
[03:01] <phsdv> my first script (start on startup) terminates with code 1
[03:01] <phsdv> my bin/sh is a links to bash
[03:02] <phsdv> s/links/link
[03:02] <Keybuk> sladen: so rgl is having some problems getting upstart to run inside a vserver
[03:02] <Keybuk> debugging is made harder by the lack of /dev/console in there ...
[03:03] <Keybuk> I remember a bug that "kill 1" doesn't work in a vserver guest ... is init assigned PID 1 ?
[03:03] <sladen> rgl: IIRC, vserver calls  /etc/init.d/rc  directly, unless you specify 'fakeinit' in which case vserver calls /sbin/init instead
[03:03] <rgl> sladen, but it can directlly call init :)
[03:03] <rgl> sladen, and that way I can use all the nice features of upstart :D
[03:04] <sladen> Keybuk: PID 1 (other pids aren't) is virtualised inside a context so that, the init process always /appears/ as pid 1
[03:04] <Keybuk> sladen: if it calls getpid() does it get 1?
[03:04] <sladen> Keybuk: should do; but.  that might be good to check
[03:05] <rgl> you guys known which packages provides the strings command?
[03:05] <Keybuk> binutils
[03:06] <sladen> Bertl (current vserver maintainer) appears to be asleep
[03:06] <sladen> Keybuk: does upstart query its own pid?
[03:06] <sladen> Keybuk: and be speffial if it isn't?
[03:07] <Keybuk> sladen: yes
[03:07] <Keybuk> if getpid() != 1, then it execs /sbin/telinit instead
[03:08] <rgl> Keybuk, still no luck, no output :(
[03:09] <rgl> oh, I just commented to code you pasted here, but maybe I should open up a file instead
[03:24] <sladen> rgl: can you try compiling http://www.paul.sladen.org/ubuntu/tmp/getpid.c and saving as /sbin/init ?
[03:25] <rgl> sladen, it is 1 ;)
[03:25] <rgl> sladen, I've already tried that
[03:25] <sladen> rgl: and the parent pid?
[03:25] <rgl> oh that I dunno :|
[03:26] <rgl> I'll run that getpid then :)
[03:30] <rgl> sladen, its this:
[03:30] <rgl> argv[0] : "/sbin/init"
[03:30] <rgl> getpid(): 1
[03:30] <rgl> getppid(): 8081
[03:30] <rgl> everytime I run it, the ppid is different
[03:31] <sladen> Keybuk: you don't check the parent pid aswell do you?
[03:32] <sladen> Keybuk: seems that /isn't/ virtualised
[03:34] <Keybuk> no
[03:34] <Keybuk> no reason to check that
[03:34] <Keybuk> I assume that the parent id of everything else shows up as 1?
[03:34] <Keybuk> and that vserver doesn't break the "init gets SIGCHLD for everything" semantics?
[03:55] <rgl> Keybuk, sladen: I've added some printfs and it seems to run till nih_main_loop (), now I don't known what happens inside of it
[03:58] <sladen> Keybuk: does sysvinit also reply on getting SIGCHLD for everything?
[04:13] <rgl> can't get it to work, I've change it to write stdout/stderr to a file, but upstart never writes anything to stdout :(
[04:22] <sladen> Keybuk: ^^what crack are you doing with file i/o ?
[04:22] <sladen> rgl: I don't have a recent vserver box setup, if can you give me SSH access to a machine I can have a quick look at it
[04:27] <rgl> sladen, I can give you access to a vmware instance that I have here, gimme 10 mins or so to set it up
[04:27] <sladen> rgl: yup that would work
[04:28] <Keybuk> sladen: "with file i/o" ?  how do you mean?
[04:33] <sladen> Keybuk: "I've change it to write stdout/stderr to a file, but upstart never writes anything to stdout"
[04:33] <sladen> rgl: stdout is probably buffered btw
[04:35] <rgl> sladen, humm, my printf work fine, because stdout only seems to be line buffered
[04:36] <rgl> sladen, oh, this is taking some time to setup, cause this instance didnt have build-essential installed :(
[04:39] <sladen> rgl: there isn't a hurry, don't worry
[04:40] <sladen> setvbuf(...) should get you a non-buffered stdout
[04:40] <sladen> or you can call flush() lots of times
[04:46] <Keybuk> sladen: it uses syslog() and openlog(LOG_CONS) for most output
[04:46] <Keybuk> is it possible that's busted? :)
[04:57] <sladen> rgl: just check to see if the syslog output is turning up in the root server...
[04:59] <rgl> sladen, it can't communicate with root server syslog
[04:59] <rgl> sladen, oh well, I'm having trouble getting to the ssh port from inet to this vmware :((
[05:01] <sladen> rgl: syslog is a syscall, did you check...?
[05:02] <sladen> thought I'm not entirely sure what goes via libc and what via the kernel
[05:03] <rgl> sladen, on the guest there are no new messages
[05:03] <rgl> err on the host
[05:03] <rgl> or root server
[05:06] <sladen> my http://www.paul.sladen.org/vserver/fix0r.txt list says "fix: We need to write a fake `console' driver that can pipe to a file.
[05:06] <sladen> for that other issue
[05:08] <Keybuk> sladen: how much effort do you put into supporting unix datagram sockets, credential parsing, etc.?
[05:08] <Keybuk> I assume you mangle the credentials to reflect the vserver fake pid 1?
[05:09] <Keybuk> and does each vserver guest have an independent copy of the unix abstract namespace?
[05:09] <Keybuk> (as every upstart instance would try to bind to \0/com/ubuntu/upstart
[05:16] <sladen> Keybuk: pretty much all of that stuff was virtualised by a few years back;  since namespaces came in they got used to
[05:17] <Keybuk> ok
[05:19] <sladen> ppid of init not being virtualised to be '1' aswell surprisedme
[05:19] <sladen> but all of these things could do with double checking
[05:38] <sladen>  /etc/init.d/rc: line 165: /dev/console: No such file or directory
[05:39] <sladen> so that's actually rc
[05:44] <Keybuk> I don't think it's unreasonable for anything to assume that /dev/console exists
[05:50] <rgl> sladen, Herbert (aka Bertl) is on #vserver ;)
[05:51] <sladen> Keybuk: it doesn't in this case :-P
[05:52] <sladen> Keybuk: one reason the Unix kernel succeeded was by simiplfying the internal design, such that syscalls were *allowed* to fail
[05:54] <sladen> Keybuk: userspace should not assume anything.  Be Liberal in what you accept and Conversative in what you (the program) assumes.
[05:54] <sladen> Keybuk: you're also trying to make a backwards compatible sysvinit replacement, if it's not, that's a bug
[06:00] <Keybuk> from your own notes, sysvinit also assumes /dev/console exists
[06:00] <Keybuk> so upstart is behaving the same as sysvinit in this case :)
[06:03] <Keybuk> and it's not true that upstart is intended to be a drop-in sysvinit replacement
[06:03] <Keybuk> for example, it doesn't listen on /dev/initctl
[06:03] <Keybuk> it's intended to be compatible from a user tools and application stand-point, so that you don't need to re-teach your fingers, or fix apache
[06:04] <Keybuk> but that is done by replacing those parts with new ones, not by talking to the old ones
[07:29] <rgl> sladen, did you manage to find anything wrong with it?
[07:29] <sladen> rgl: sorry, I got waylaid with other stuff
[07:30] <rgl> sladen, ah ok.  will'll have some time today to see it?
[07:31] <sladen> rgl: "/etc/vservers/edgy/apps/init/cmd.start" no such file?
[07:32] <rgl> sladen, that appear after executing what command?
[08:08] <concept10> does upstart use the same debian type run-levels?
[10:25] <rgl> sladen, ping :D