/srv/irclogs.ubuntu.com/2016/07/14/#upstart.txt

rlarkinHi, looking for a good link to help trouble shoot an init script inside an LXD container20:42
rlarkinthe service ( salt-master version 15.08 ) starts just fine directly, and other init scripts are working as expected.  but salt-master always fails with 'job failed to start' .  I can't figure out what is expected ( and not there ) by the init script.20:44
rlarkinI am reading the cookbook page...20:45
AnrDaemonFirst, enable logging of init script. That's "console log". Second, enable logging of your program, if it has one.20:47
AnrDaemonAnd third, pastebin your init script so far. Let's take a look.20:47
rlarkink20:49
rlarkinhttp://pastebin.com/9d6er0RC20:51
rlarkindoing logging20:51
AnrDaemonWell, that' snot upstart script.20:51
rlarkinhuh.  I just assumed trusty was upstart20:52
AnrDaemonIt is, but what you linked is an abomination.20:52
rlarkinlol, that's good to know20:52
rlarkinit's what came with the package 20:52
AnrDaemonThey are still living in the 2008…20:53
rlarkinwow20:53
rlarkinI was trying to figure out what might be missing from my container environment and not finding anything.  but it sounds like what I really need is a new init script.20:54
AnrDaemonhttp://pastebin.com/v67FsCHt20:55
AnrDaemonThat'a about all that you need. Likely.20:55
AnrDaemonIf salt-master have a switch to run explicitly in foreground and not daemonize, use that.20:55
rlarkinit has -d (daemonize) and -l debug options20:56
rlarkinthat's so simple.  20:56
AnrDaemonWell, okay. Just leave -d out. Upstart does process control, so it needs to know what is running.20:56
AnrDaemonYes, it is, in many cases.20:57
rlarkinthanks man20:58
AnrDaemonThere's 3 types of daemons. 1. Very simple ones, no config at all. 2. Those required config in comandline. 3. Those with external config.20:58
AnrDaemonUpstart is good for 1 and 3, you just start daemon and it does everything it has to do.20:58
rlarkinthis is 3 (in a default location)20:58
AnrDaemon#2, of course, needs some treatment more often than not :/20:58
AnrDaemonAnd not always a trivial treatment, given you can't pass options from pre-start to start.20:59
rlarkincool.  I'm adding this to my deployment20:59
AnrDaemonDo note the script don't have any start or stop clauses. You'll have to figure these your yourself, once you have your daemon up and running.21:02
rlarkinsure, thanks21:02
AnrDaemonAlso check the cookbot for "expect …" syntax, if upstart still losing the tail.21:02
AnrDaemoncookbook**21:02
AnrDaemon(Some services fork to drop privileges after initialization, no way around that, unless you start them with restricted privileges to begin with, which is not always possible, i.e. if they need ports in 0..1023 range.)21:04
rlarkink.  21:04
rlarkinsalt-master is not starting with the simple init script either.  so I think my container env is missing something that's not needed by all services21:05
AnrDaemonLook in logs. (add "console log" to the script, add -l debug or what not to the daemon parameters.)21:07
AnrDaemonLog is in /var/log/upstart/<servicename>*21:07
AnrDaemon"console log" is an overall good idea, though.21:08
rlarkinthere's no 'salt-master' file in /var/log/upstart.  21:09
rlarkinthe return is instantaneous21:09
rlarkinroot@salt01:/etc/init.d# service salt-master start 21:09
rlarkinstart: Job failed to start21:09
AnrDaemon1. Delete "salt-master" from /etc/init.d.21:11
rlarkinok21:11
AnrDaemon1. Run init-checkconf /etc/init/salt-master.conf21:11
AnrDaemonIt will at least tell you if it is syntactically correct.21:11
rlarkinFile /etc/init/salt-master.conf: syntax ok21:12
AnrDaemoninitctl start salt-master21:12
rlarkininitctl: Job failed to start21:12
AnrDaemonWhat's in logs?21:13
rlarkinthere's still no salt-master in /var/log/upstart21:13
AnrDaemonAnything in system log?21:13
rlarkinso far, syslog has only dhcp messages.21:13
AnrDaemonTry something real simple? Like exec /bin/printf "Started ok"21:15
rlarkinok.  this one fails with an instanc 'Job failed to start':  http://pastebin.com/D3ZuaXrd21:19
rlarkinbut this one works just fine: http://pastebin.com/k70KwXfh21:20
rlarkinpermissions are identical21:21
rlarkinmy paste is wrong, old one from klipper.  I changed it to /usr/bin/printf21:24
rlarkinminor detail21:24
AnrDaemonAgain, for the … time.21:32
AnrDaemonDo not confuse init script and upstart job. They are located in different places and started by different mechanics.21:33
AnrDaemonAlso sorry, it is /usr/bin/printf21:35
AnrDaemonJust tried this script myself: http://pastebin.com/e4MFSCYM21:36
AnrDaemon# initctl start xxx21:36
AnrDaemonxxx start/running, process 1941521:36
rlarkinok yeah, that works21:39
AnrDaemonSo, if you now replace /usr/bin/printf with /usr/bin/salt-master -l debug etc. it should at least try to start it.21:42
rlarkinusing initctl and not service, salt-master started after I commented out #limit nofile 100000 10000021:44
rlarkinand when I remove the abominable script I can start salt-master with 'service'21:45
AnrDaemon100k ? :D21:46
AnrDaemonEven MySQL don't need that many.21:46
AnrDaemonHappily working with 32k21:46
rlarkinoh, actually it works when /etc/init.d/salt-master still exists.  I guess it's not even relevant here.  Hi upstart, nice to meet you.21:47
AnrDaemonAs long as it is not installed… Or not called directly… You're using21:48
AnrDaemonupstart.21:48
AnrDaemonI suggested to get rid of it to reduce confusion.21:48
rlarkinat 50000 it works21:48
rlarkinthanks so much AnrDaemon21:49
AnrDaemonDoes it actually do need that many open files?21:49
rlarkinin a much bigger environment , yes.  but then I probably wouldn't be using a container21:50
AnrDaemonFair point.21:50
rlarkinI'm actually trying to stand up a dev test  env, so pretty small.  just a dozen or so clients ( not thousands )21:50
rlarkinthe default lxd env probably sets a cap21:51
rlarkinok, thanks for you help.  thanks to you I can go have some family time :)21:51
AnrDaemon:D21:56

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