Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 634362 - start-stop-daemon fails to start some daemons on LXC host
Summary: start-stop-daemon fails to start some daemons on LXC host
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal critical (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-15 18:46 UTC by Ciprian Ciubotariu
Modified: 2017-11-17 23:31 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ciprian Ciubotariu 2017-10-15 18:46:03 UTC
I have a headless server with a few LXC containers running. Up until upenrc-0.28 I only had a minor problem with samba starting up after reboot. Now I have openrc-0.32.1, and it seems the developer of start-stop-daemon decided to only start sshd once on a physical machine, regardless of whether sshd is fired up on the host or in any LXC container. Same for vixie-cron, but that's not a critical problem.

Here is the problem: after boot I don't have sshd anymore on the host system, because by chance one of the LXC containers started it first. This kindof leaves me out of the system.

As a workaround to this bug I decided to stop sshd in all containers (for now, until you fix it), but I cannot do the same with vixie-cron since backup jobs are scheduled in each container.

Here is a sample session trying to start sshd on LXC host pinky while sshd is running in container mail. You can see start-stop-daemon misdiagnoses sshd as running, and decides to not restart it. Next I log into mail via lxc-console, stop sshd inside it, and now start-stop-daemon happily starts sshd on host pinky.

cipi@pinky ~ $ sudo rc-service sshd restart
     * Stopping sshd ... [ ok ]
     * Starting sshd ...
     * start-stop-daemon: /usr/sbin/sshd is already running
[ !! ]
     * ERROR: sshd failed to start
cipi@pinky ~ $ sudo lxc-console -n mail

Connected to tty 1
                  Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself
mail ~ # rc-service sshd stop
 * No permission to apply cgroup settings
 * Stopping sshd ...                                                                                                                                                                                                                   [ ok ]
mail ~ # logout
cipi@pinky ~ $ sudo rc-service sshd restart
 * Starting sshd ... [ ok ]
cipi@pinky ~ $ 


Also, if now I log into mail I can start sshd inside, since running inside the container processes are isolated. However start-stop-daemon on the host can see all running processes inside containers, and it MUST NOT match processes by name only to check if a daemon is running or not. If that were the case start-stop-daemon is not needed at all!!! You could simply write ps -A | grep -q sshd && echo "already started" || echo "starting sshd"
Comment 1 Ciprian Ciubotariu 2017-10-18 16:11:15 UTC
I already got a duplicate for this bug: https://bugs.gentoo.org/634634
Comment 2 William Hubbs gentoo-dev 2017-11-17 23:31:09 UTC
This should be fixed in the stable tree at this point. Please let me
know if it isn't.

Thanks,

William