[systemd-devel] Failed to start Container: minus sign is replaced to slash in container name
Lennart Poettering
lennart at poettering.net
Tue Jan 12 12:43:13 PST 2016
On Tue, 12.01.16 21:23, Stefan Schweter (stefan at schweter.it) wrote:
> Dear systemd-users,
>
> e.g. when a container name includes a minus sign like:
>
> ls -l /var/lib/machines
> insgesamt 4
> drwxr-xr-x 22 root root 4096 12. Jan 21:14 host.cis.uni-muenchen.de
>
> Enabling the systemd-nspawn service with:
>
> systemctl enable systemd-nspawn at host.cis.uni-muenchen.de
> Created symlink from
> /etc/systemd/system/machines.target.wants/systemd-nspawn at host.cis.uni-muenchen.de.service
> to /usr/lib/systemd/system/systemd-nspawn at .service.
Yeah, the way systemd encodes slashes in unit names is by converting
them to dots. Thus when you actually want a dash you need to escape
it. The tool systemd-escape can help you with getting this right from
shell scripts. See the last example in the systemd-escape(1) man page
For details.
But, given that this is a bit nasty to use, you can alternatively just
use "machinectl start ..." and "machinectl enable ..." which will do
the escaping for you, prefix the systemd-nspawn@ thing and the suffix
the .service thing, and is otherwise equvialent to systemctl start and
systemctl enable.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list