[04:08] In lucid, I have an upstart task that runs "iptables-restore /etc/iptab". [04:09] If this fails, I want the system to freak out and disable all services -- say, switching to single-user mode. [04:09] How would I configure this? [04:46] Can I have two "pre-start exec" lines (instead of a pre-start script)? [06:06] twb: no [06:40] Okey dokey [18:21] hello [18:21] any clues how i can enforce that the all of the network interfaces are up before sysvinit scripts run?.. [18:28] atpa8a: I've already answered your question three times [18:29] * ion notices Keybuk isn’t a Conan fan. [18:29] Conan? [18:30] Keybuk: sorry, must've missed [18:30] atpa8a: to change the state in which sysvinit scripts are run, you edit the /etc/init/rc-sysinit.conf file [18:30] keybuk: http://www.youtube.com/watch?v=iNu3MW-lb6Y [18:30] and change the "start on" kine [18:31] as you can see, right now it says to start when the *loopback* network interface is up [18:31] but no other [18:31] if you alter that start on line, you can delay sysvinit scripts as long as you like [18:31] e.g. until all network interfaces are up [18:31] or until the cows come home [18:31] Keybuk: i tried removing that IFACE= at all and tried making it IFACE=eth0 but nothing helped [18:32] still slapd fails to start because the network is not up yet [18:33] start on filesystem and net-device-up IFACE=eth0 [18:33] that's what i have there now [18:35] slapd[2826]: daemon: bind(9) failed errno=99 (Cannot assign [18:35] requested address) [18:36] atpa8a: is eth0 the right interface? [18:36] then it's likely that slapd is in fact waiting for something else [18:36] yes [18:36] well [18:37] slapd needs eth0:0 really [18:37] should i try that? [18:37] aha! bridges [18:37] aliases [18:37] right [18:37] so you need to add something like "and started networking" [18:37] e.g. [18:37] is there like... IFACE=all? [18:37] start on filesystem and net-device-up IFACE=lo and started networking [18:38] meaning filesystem ready, loopback device up, and all virtual devices [18:38] no, because then you'd have to define "all" [18:38] gotcha [18:38] started networking should work [18:38] e.g. on a laptop with a USB ethernet device, does "all" mean including that or not? [18:38] and if it means including that, what if it's not plugged in? [18:38] i see [18:39] you may want [18:39] start on filesystem \ [18:39] and net-device-up IFACE=lo \ [18:39] and net-device-up IFACE=eth0 \ [18:39] and started networking [18:39] because you'll want eth0 as well as the alises [18:40] can't i just use 'and started networkin' without net-device-up?.. [18:40] started networking just means ifup -a returned [18:40] ok... so that would supercede net-device-up, right? [18:40] no [18:41] they do different things [18:41] nope.. ifup just starts the things that configure the ifaces [18:41] physical network devices, for which you have hardware, are up when you get net-device-up [18:41] non-physical network devices (virtual, bridges, aliases) are up on the ifup -a [18:41] got it [18:42] trying [18:42] Tho it does mean all statically configured devices are up.. right? [18:42] thanks a bunch [18:42] hmm [18:42] SpamapS: no, because at the point networking runs, the actual devices may not have modules loaded yet ;) [18:42] SpamapS: so you can't guarantee that [18:42] should i... just in case add eth1 as well? [18:42] atpa8a: at some point it's worth filing a bug that slapd should use IP_FREEBIND [18:42] Keybuk: so ifup -a may fork modprobes and such, even for iface eth0 inet static ? [18:42] but that's for another day ;) [18:43] SpamapS: ifup doesn't fork modprobes unless you've stuck modprobe in a pre-up ;) [18:43] Keybuk: thought about just filing a bug with ubuntu to fix rc-sysvinit.conf [18:43] atpa8a: fix? [18:43] atpa8a: this is not considered a bug in Ubuntu [18:43] Ubuntu has *never* delayed starting services until after network interfaces are configured [18:43] this is because the default out-of-the-box behaviour in Ubuntu isn't to configure network interfaces until *user login* [18:44] services are supposed to work without a configured network interface [18:44] Keybuk: so started networking should mean all statically configured, non transient hardware, has been configured. yes? [18:44] thus the IP_FREEBIND [18:44] SpamapS: yes [18:44] SpamapS: assuming you have such a thing [18:44] hmm [18:44] Keybuk: thinking about servers mostly [18:45] Is IP_FREEBIND POSIX or a linux innovation? [18:45] so if my interfaces are all static, 'and started networking' should be enough? [18:45] Linux I believe [18:45] atpa8a: yes [18:45] I could see it being a problem for some upstreams if its linux only. [18:45] atpa8a: though see notes about modprobe above [18:45] SpamapS: #ifdef is their friend [18:46] Right, most will be fine w/ that [18:46] Keybuk: sure, thanks a bunch [18:46] some will be adamantly opposed. [18:46] i've a feeling slapd might be one of those [18:46] SpamapS: if you can find any upstream not using at least one Linux-specific API, I'd be impressed ;-) [18:46] and that's why distros carry patches [18:46] after all, as soon as you see setsockopt() or ioctl() or anything like that - you're in linux-specific-land [18:47] Keybuk: I've recently proposed hanging rc-sysinit to start on filesystem and started networking rather than net-device-up IFACE=lo so that users can expect that any static interfaces will always be configured before runlevel 2.... given what we've talked about here.. I think that its still a good idea. [18:47] s/hanging/changing/ [18:47] SpamapS: the trouble there is you run the risk of locking the boot [18:47] because people use sysvinit to bring up the dependencies of static interfaces [18:48] in theory though I have no problem with delaying rc-sysinit as long as you like [18:48] because things should not be using rc-sysinit [18:48] slapd should have its own .conf etc. [18:48] Hanging it or failing a bunch of stuff.. I'll choose failing a bunch of stuff. But we need a generic solution. [18:49] Keybuk: its own.conf that will 'start on runlevel [2345]' ? ;) [18:49] we don't even *have* rc-sysinit on Chromium OS after all ;-) [18:49] SpamapS: I thought you were introducing jobs to replace those? :) [18:49] I am.. definitely. Haven't gotten much traction on those. [18:49] I always take no traction as silent assent ; [18:49] ;) [18:49] Right.. my DMB app has been delayed twice unfortunately. [18:50] upstart scrips for slapd and a few other services are nowhere to be found for ubuntu [18:50] otherwise I might have uploaded network-services.conf and wait-for-state.conf already. :) [18:50] i did consider making my own but... i'm not an experienced SA [18:50] atpa8a: bug! :p [18:50] don't know the intricacies [18:50] Keybuk: there's a bug already but it's on hold [18:50] * atpa8a is java dev [18:51] SA is a hobby :P [18:52] bb [18:52] testing the script [18:55] ion: you realise that killed my X server and I hate you, right? :-) [18:56] Eh :-D [18:56] flash seems to hate dual-head non-twinview nvidia [19:00] hello, is anyone actively working on /proc/PID/oom_score_adj support? /proc/PID/oom_adj is deprecated and upstarts oom stanza uses this interface... [19:00] wraiden: nobody is actively working on it [19:00] i ask because i don't want to do duplicated work on this if anyone has picked the issue up allreda [19:00] k [19:00] so please feel free to pick it up [19:01] k [19:01] I believe both APIs are still supported, right? [19:01] will take a similar aproach as udev [19:01] yes [19:01] try and write to oom_score_adj [19:02] but it polutes dmesg with a warning [19:02] if that fails with EEXIST, fall back to oom_adj ? [19:02] yes [19:02] and no [19:02] udev checks for filepointer lower than 0 [19:02] so other errorcodes are picked up to [19:03] i think [19:03] right, but you also want to check errno [19:03] if you got EPERM from oom_score_adj you shouldn't fall back to oom_adj [19:03] i cook something up over the weekend [19:03] because you'll just get the same error ;-) [19:03] EEXIST should be the only reason to fallback [19:03] but please do cook a patch up, and send it to the ML [19:03] gratefully accepted [19:04] aye sir ;) [19:05] the only thing is that the score interface has grater values [19:05] so the off case must be -1000 [19:06] the testsuite tests the values... could be problematic... as it will produce falsepositives on the offbound value checks [19:06] that is why we have a test suite ;-) [19:06] decide on appropriate behaviour, write tests for it, etc. [19:06] mhm [19:08] hello again [19:08] those changes seem to hange the boot... [19:08] hang that is [19:08] atpa8a: that implies to me that your network interfaces are (at least, in part) brought up by sysvinit scripts [19:08] so your boot is: [19:08] - waiting for networking to start sysvinit [19:08] - unable to start networking because it's waiting for sysvinit [19:08] ok... [19:08] ie. deadlock [19:09] so here's your next trick: [19:09] remove the bits you added to rc-sysinit [19:09] now create a new job [19:09] /etc/init/slapd-interlock.conf [19:09] start on slapd-interlock and net-device-up IFACE=eth1 and started networking [19:09] (that's it) [19:09] and in /etc/init.d/slapd, in the start case, add [19:09] initctl emit slapd-interlock [19:10] hmm [19:10] you may need some protection here to make sure it only runs on actual boot, e.g. by checking $RUNLEVEL or some shit - I haven't fiddled with sysvinit scripts in a while to remember what that is [19:10] what this will do is: [19:10] sysvinit scripts will start as normal [19:10] slapd will start [19:10] it will run "initctl emit slapd-interlock" and wait for that event to complete [19:10] the .conf file in Upstart will pick up that event, and block it [19:10] while it also waits for net-device-up IFACE=eth0 and started networking [19:11] (i think) i'm following... [19:11] and then when all three happen, that ".conf" is running, so the event is unblocked, so initctl emit finished, so slapd carries on [19:11] let me try\ [19:11] thanks a bunch [19:15] hmm [19:16] seems like i cannot boot into single user mode either... [19:20] keybuk: is it ok if i change the tests for offbound values in the testsuite to values for the score interface? the will be offbound in booth cases then and we can avoid to check two interfaces with distinct test code... [19:21] livecd ftw! [19:23] atpa8a: single user mode is a sysvinit thing ;-) [19:23] wraiden: you can change the tests, but be careful to not change the thing they're testing [19:23] current job files should work unchanged [20:03] hmm [20:03] Keybuk: would you say... it'd be better to call it networking-interlock.conf? [20:04] kinda a common thing for all services that face the same situation [20:04] and emit networking-interlock as well? [20:04] yes, but the first job would release the interlock [20:04] the second would hang [20:04] which is why it's specific to slapd [20:05] i see [20:05] can it be made generic?.. [20:09] not without converting slapd to upstart [20:11] gotcha [20:15] hmm [20:15] just to confirm... i don't need 'start on filesystem' in slapd-interlock.conf, right? [20:17] right [20:18] thanks [20:22] what would happen if i just do /etc/init.d/slapd restart when there's the emit in it? [20:24] nothing happened... [20:25] ok... [20:25] trying booting now [20:31] hmm [20:31] something didn't work... [20:33] heh [20:33] typos :P [20:35] ok [20:35] now that i fixed it... it's not working when starting manually [20:35] gotta do the emit conditionally... [20:46] [ $RUNLEVEL ] && initctl emit slapd-interlock [20:46] that should do it\ [20:46] testing [20:58] mhm, the changed valid range of values for the oom handling isn't easy to handle... [21:00] if i change it do accept 1000 to -1000 in the parser and change it by divide with 59 in the fallback (ugly hack, i know) we could get away wir [21:00] *with a string change for any supported locale... [21:04] another approach would be to check for the existence of /proc/self/oom_score_adj in init startup code, set a flag according to existence and use that to change behavior accordingly wich would eliminate ugly hacks to adapt the value in fallback case [21:05] but that would complicate the testcase... [21:07] btw: isn't EEXIST the error for "i want to crate a file but it exists" and not "file i want to open don't exist" ? [21:08] posix manpage for open (which fopen refers to) defines it as the fist rather than the second... [21:24] i'll take the flag oom_score_adj and check for the flag road... [21:24] +existence [21:37] hmm [21:37] something isn't working... [21:37] http://pastie.org/1661174 [21:51] but it says initctl status slapd-interlock ~ [21:51] slapd-interlock start/running [22:09] hmm [22:10] fixed it by using 'net-device-up IFACE=eth0:3 \' [22:10] working now [22:10] thank you gents [22:10] Keybuk: thank you much! [22:10] oh cool [22:10] isn't networking enough to check for? [22:10] I didn't even know you could do that :p [22:11] wraiden: apparently not [22:11] y? [22:11] http://pastie.org/1661174 [22:11] that was before i used IFACE=eth0:3 and it didn't work [22:12] y do you add the interface up events? [22:12] hmm :P Keybuk recommended [22:12] arnt they prerequisites for networking? [22:13] no [22:13] ah [22:14] if you have a wiki i can drop this solution into, i'll document it [22:14] putting it in my private wiki now === atpa8a_ is now known as atpa8a [22:44] thank you folkes [22:44] very helpful [22:48] Keybuk: first compiletested only version without messing with the testsuite is here: http://pastie.org/1661386 [22:51] my concern about that approach is that it changes the behaviour of Upstart if you reboot into an older kernel [22:51] suddenly jobs go from running to "parse error" [22:52] yes [22:53] problem here is that the interfaces arnt compatible with respect to value range ... [22:54] one approach to that would be [22:54] a possible way out would be to accept the new range by default and [22:54] oom NN = old range [22:54] oom score NN = new range [22:54] divide the value [22:54] and accept both [22:54] accepting the new range only would change the behaviour of existing jobs [22:54] (though I bet there are none out there using the score rather than just "never") [22:55] that was my thinking eighter... [22:57] a percent value would be nice [22:57] could be used as operator to calculate the right value for each interface [22:57] -operator + base [22:58] that's no real difference than just sticking to the old vange [22:58] range [22:58] more fun, "oom less than " and let upstart pick the values? :P [22:59] that would by far overwehlm my rusty c skills *hehe* [23:00] how do I set an environment variable in a job file? [23:02] by reading: man 5 init [23:02] search foe env [23:02] *for [23:04] i'll go for the "oom score =" one i think ... [23:04] well, no = in upstartyland but I think that makes the most sense [23:05] jepp [23:06] we need to support both interfaces, as noone upstream boundling conf files for upstart can predict which interface a user might have avaiable... [23:07] that leads to the question: is any upstream package shipping upstart definitions? [23:09] anyway a nice to have [23:10] wraiden: there are definitely both upstreams and distributions shipping upstart config files [23:10] so they must not be broken [23:10] what to do in a case where the new interface is usable but only the old one has defined value? [23:10] multiply it by sufficient numbers to turn it into the new value [23:11] + and the old one is not available (after its removal) [23:11] the behaviours are the same, just the ranges have changed [23:11] k [23:11] likewise if you only have new value in the .conf and only the old interface is available, you divide [23:11] will hack that together... [23:11] (I'd multiply when parsing the old value so that the oom score in the job is always -1000..1000) [23:12] then divide again when writing to the old interface [23:12] mhm [23:25] I wonder just how many bugs on LP, at this point, are about pre-stop being fucking busted? [23:27] whats busted with it? [23:28] the multiplying and dividing isn't easily possible... [23:29] why not easily possible? [23:29] there's an operator for them in C and everything [23:29] the values on the old interface are asyncronous reguarding positive and negative values [23:29] normalise the base, adjust the scale [23:29] you cant get -16 [23:29] maths 101 [23:30] -16 is "the minimum" and -17 is "never" with +15 being "always" [23:30] so I guess you make +15 be 1000, -17 be -1000 [23:30] i would have used a simple * 62.5 [23:31] optionally -16 is either -999 or -1000-1000/17 [23:31] look at what the kerneld oes [23:31] ie. the code that deals with writing to the deprecated interface [23:31] I'm sure it already has the exact algorithm to scale to the new one [23:35] if (task->signal->oom_adj == OOM_ADJUST_MAX) [23:35] task->signal->oom_score_adj = OOM_SCORE_ADJ_MAX; [23:36] else [23:36] task->signal->oom_score_adj = (oom_adjust * OOM_SCORE_ADJ_MAX) / [23:36] -OOM_DISABLE; [23:37] * wraiden feeds his cats... [23:47] still trying to get the env setup up, I did read 'man 5 init', but the script being called does not see the PERL5LIB, any ideas http://pastebin.com/VDRdWM3V [23:49] it should [23:49] (though the "export PERL5LIB" there doesn't do what you think) [23:51] keybuk /root# [23:51] keybuk /root# cat /etc/init/test.conf [23:51] env DEMO=this:is:a:test [23:51] exec echo $DEMO > /tmp/demo [23:51] keybuk /root# start test [23:51] test start/running, process 13507 [23:51] keybuk /root# cat /tmp/demo [23:51] this:is:a:test [23:54] how about adding a oom_score_adj int to job_class so that we only need to calculate in the conf parsing case and just use what we have calculated? [23:54] that's what I meant [23:59] your right, it did work