/srv/irclogs.ubuntu.com/2014/04/01/#upstart.txt

delkinHello. I am trying to create an upstart script that runs on `starting hostname`. When I simulate this with `start hostname` my script runs well, but when I restart the machine it doesnt... does anyone have a hint on this issue?10:47
delkinthe objective is to change the hostname of the machine to be equal to the mac address.10:48
jodhdelkin: what happens on restart? Do you get any errors in /var/log/upstart/$job.log ?10:50
delkinjodh: I didnt know about that file. Thanks. I will have a look10:51
jodhdelkin: you might want to take a look at http://upstart.ubuntu.com/cookbook/#debugging. An alternative approach btw is to create an /etc/init/hostname.override that contains your custom 'exec hostname ...' command which will replace the default in /etc/init/hostname.conf.10:54
jodhdelkin: that would also be easier since otherwise your new job will have to set the hostname, then call 'stop hostname || true' to ensure that the real hostname job doesn't run and change the hostname again.10:55
delkinjodh: I see. Thanks a lot. I also believe I will have a tough time changing the hostname. It seems that before the hostname service runs the file system is Read-only, so I cannot update the /etc/hostname.10:56
delkinjodh: can you suggest me the best moment when (triggered by which service) I should try to change the /etc/hostname file?10:57
jodhdelkin: yes, the hostname job does run before the fs is writeable, but that doesn't stop you from changing the hostname - just 'exec hostname -b myhostname'. You can create another job that specifies 'start on filesystem' that essentially calls 'exec hostname > /etc/hostname'. However, you do have the problem that anything that reads the hostname directly from /etc/hostname between those jobs running will11:02
jodhhave the incorrect value :(11:02
delkinjodh: I will try to set that new upstart script to `start on (started filesystem and starting static-network-up)`. Something like this, i guess11:06
delkinjodh: i'm afraid that the all network services run while the file system is still Read-only. This is not good :\11:19
xnoxdelkin: "start on remote-filesystem" should be enough, no?11:28
delkinxnox: :( nop. Looks like the hostname is set before that.11:43
xnoxdelkin: well, hostname is and can be set before filesystems are RW. So you can't have both, e.g. you cannot block setting hostname until filesystems are RW.11:44
xnoxdelkin: i am not sure i understand your issue then.11:44
delkinxnox: I am trying to change the hostname during boot to have the mac address in it. Every machine with this configuration would have its mac address as hostname.11:47
xnoxdelkin: create a task which fires upon udev event which adds a network interface and local-filesystem, echo desired hostname into /etc/hostname; start --no-wait hostname.11:48
xnoxdelkin: this will update the hostname dynamically on each boot, based on first network interface that comes up.11:48
delkinxnox: I believe that at some point the networking services will look at the /etc/hostname file to set the hostname and let know that to the rest of the network. I am trying to find when I can set the /etc/hostnames (the sweet spot). I have realize that if it is to early the file system is Read-only. If it is too late the networking services already checked the /etc/hostname, so it doesnt matter what I put there anymore11:49
delkinxnox: I will try that11:49
xnoxdelkin: after filesystems are RW, after you update /etc/hostname, you need to run "start --no-wait hostname" which will update hostname (e.g. upon ssh connection new hostname will be visible)11:50
delkinxnox: so, it will basically override the old hostname, right? I am afraid that it can take minutes before I can ssh using the new hostname. I will give it a try. Thanks!11:55
xnoxdelkin: huh? fix your dns server to assign correct hostnames =)11:56
delkinxnox: the problem is that the DNS takes time to propagate, i think11:57
delkinxnox: that's why I wanted to do the changes before the network services even started11:58
delkinxnox: i'm just afraid that at that point the file system is still read only11:59
xnoxdelkin: yes, they are but e.g. ssh server is not up yet, so it doesn't matter.11:59
delkinxnox: the trouble is that the old hostname is published to the DNS when the network services start. Even if I change the hostname before the ssh server, the DNS still thinks that my machine is named with the old hostname12:03
delkinxnox: I found that if I  `ifdown -a` and then `ifup -a` it will trigger an update in the DNS server.14:58
SpamapShey I have a box in production whose init is overwhelmed ..17:33
SpamapSroot         1 91.1  0.0  37772 13384 ?        Rs   11:02 359:42 /sbin/init17:33
SpamapSnot responding to initctl17:34
SpamapSslangasek: ^^ any ideas?17:34
SpamapSjodh: ^^ You?17:34
SpamapSahh17:34
SpamapSpipe(0x7fff759353d0)                    = -1 EMFILE (Too many open files)17:34
slangasekwow17:34
slangasekyuck17:34
SpamapSslangasek: caused by bug 130088517:35
slangasekok17:35
SpamapSslangasek: basically.. OpenStack with neutron creates a network-interface job per tap interface17:35
SpamapSand on this box, they're trying, and failing, so fast that upstart can't stop them anymore17:36
slangasekSpamapS: I guess you can forcibly adjust the file limit through /proc to temporarily restore it17:36
SpamapSI'm killing processes now to try and get enough room to finish17:36
slangasekok17:36
SpamapSslangasek: raising it just raised the nr open :(17:39
SpamapS# cat /proc/sys/fs/file-nr17:39
SpamapS268801000000017:39
SpamapSoh n/m17:42
SpamapSroot@ci-overcloud-novacompute6-sq4g5z35pfzt:/proc/1# echo -n "Max open files=unlimited:unlimited" > limits17:48
SpamapS-su: echo: write error: Invalid argument17:48
SpamapSslangasek: ^^ any ideas?17:48
slangasekmm, I don't know the syntax for updating limits offhand17:49
SpamapSslangasek: ok so I used the minimal program here: http://linux.die.net/man/2/prlimit17:59
SpamapSslangasek: worked17:59
SpamapSslangasek: seems init is subjecting itself to the soft limit of 1024 .. given the logging.. that seems like something it should raise on its own.18:00
SpamapSor refuse to log more things18:01
SpamapSslangasek: shall I report as a bug? Seems worthy of a fix even for trusty.18:01
slangasekSpamapS: yeah, I'd say it's bugworthy18:17
SpamapSslangasek: ok, will add an Ubuntu task to the bug we're tracking in our project. THanks.18:18
SpamapSerr, an upstart task18:18
SpamapSahh looks like jodh is already looking at that bug.18:21
SpamapSslangasek: https://bugs.launchpad.net/upstart/+bug/1300663 for reference.18:22
xnoxSpamapS: if you know the rougue job/jobs you can set "console none" on them via an override file, thus upstart will not log anything for them... still a workaround though.18:49
SpamapSxnox: yes thats what we're doing now for all of our compute nodes18:49
xnoxconsole output, would work and spew to console if that's collected / managed.18:50
SpamapStap interfaces will come and go at a high rate for nova-compute18:50
SpamapSxnox: no thanks18:50
xnox=))))18:50
SpamapSthe real problem, ifdown sqawking on ignored interfaces, is fixed, but I'd rather not be overwhelmed on console or logfiles if some other bug comes up18:51
stgraberSpamapS: haha, yeah, I got bored of ifdown being a bit too verbose a couple weeks back when doing lxc stress testing, at some point I was wondering what was taking 2GB of my /var/log ;)19:30
stgraberevery run of my test script was basically creating around 10000 veth pairs, so triggering the job around 20000, that pretty quickly made a mess in /var/log/upstart ;)19:31
SpamapSAfter thinking for the last hour.. I wonder if 'console output' would make more sense for network-interface19:47
stgraberit sure would make debugging much harder20:03
stgraberat least for me20:03
stgrabercurrently when something is wrong with networking, I ask for a tarball of /var/log/upstart + /etc/network/interfaces and between the two I can pretty much always figure out what happened. If things were just printing to the console, we'd loose that and as everything is event based, chances are that the console output would be pretty unreadable should something actually go wrong.20:04
=== modafinil_ is now known as modafinil

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