[Users] Debian Jessie and 'vzctl start $CTID --wait'

Roman Haefeli reduzent at gmail.com
Tue May 19 01:11:42 PDT 2015


On Mon, 2015-05-18 at 16:46 -0700, Kir Kolyshkin wrote:
> On 02/09/2015 02:06 AM, Roman Haefeli wrote:
> > Hi all
> >
> > I'm doing some testing with Debian Jessie (8.0) Containers. Debian
> > Jessie comes with systemd as its default init system. I wonder what is
> > the correct way to tell vzctl when a container is done starting up. What
> > was a simple line in /etc/inittab for sysv-init, seems more complex in
> > systemd. Creating a systemd service unit that touches /.vzfifo is
> > actually not that difficult. However, I have troubles figuring out how
> > to make sure vz-init-done.service is started after all other services
> > have been started.
> >
> > Has anyone experience with systemd-enabled OpenVZ containers? Are you
> > using --wait at all?
> 
> This is already implemented in official Debian 8 template. 

Ah, I should have checked the official template first, then.

> This is how 
> it's done

I came up with a similar solution myself, but will adapt my template to
the way you described. Thanks for the detailed information.


Roman



> (assuming you are in CT root directory):
> 
> # Create vzfifo service
> cat >> lib/systemd/system/vzfifo.service << EOF
> #  This file is part of systemd.
> #
> #  systemd is free software; you can redistribute it and/or modify it
> #  under the terms of the GNU General Public License as published by
> #  the Free Software Foundation; either version 2 of the License, or
> #  (at your option) any later version.
> 
> [Unit]
> Description=Tell that Container is started
> ConditionPathExists=/proc/vz
> ConditionPathExists=!/proc/bc
> After=multi-user.target quotaon.service quotacheck.service
> 
> [Service]
> Type=forking
> ExecStart=/bin/touch /.vzfifo
> TimeoutSec=0
> RemainAfterExit=no
> SysVStartPriority=99
> 
> [Install]
> WantedBy=multi-user.target
> EOF
> 
> # Enable services
> for service in vzfifo; do
>          systemctl enable $service > /dev/null 2>&1
> done
> 
> Also you probably want to set multi-user as a default systemd target
> (if it is not set that way already):
> 
> # Set default target as multi-user target
> rm -f lib/systemd/system/default.target
> ln -s multi-user.target lib/systemd/system/default.target
> mkdir -p etc/systemd/system/default.target.wants
> 
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://lists.openvz.org/mailman/listinfo/users




More information about the Users mailing list