[systemd-devel] Failed to start Container: minus sign is replaced to slash in container name

Stefan Schweter stefan at schweter.it
Wed Jun 1 23:27:32 UTC 2016


Am 12.01.2016 um 21:43 schrieb Lennart Poettering:
> 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
> 

Hi Lennart and all other systemd users,

I tried to enable + start a container named debian-sid. E.g. the
following command works without any problems:

systemd-nspawn -M debian-sid

Then I used the machinectl tool for enabling the container:

[root at build ~]# machinectl enable debian-sid
Created symlink
/etc/systemd/system/machines.target.wants/systemd-nspawn at debian\x2dsid.service
→ /usr/lib/systemd/system/systemd-nspawn at .service.

When starting the container:

[root at build ~]# machinectl start debian-sid
Job for systemd-nspawn at debian\x2dsid.service failed because the control
process exited with error code.
See "systemctl status "systemd-nspawn at debian\\x2dsid.service"" and
"journalctl -xe" for details.

The output of the journalctl is:

Jun 02 01:21:40 build.name.eu systemd-nspawn[6477]: Invalid machine
name: debian\x2dsid
Jun 02 01:21:40 build.name.eu systemd[1]:
systemd-nspawn at debian\x2dsid.service: Main process exited, cod
Jun 02 01:21:40 build.name.eu systemd[1]: Failed to start Container
debian\x2dsid.
-- Subject: Unit systemd-nspawn at debian\x2dsid.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-nspawn at debian\x2dsid.service has failed.
-- 
-- The result is failed.


How can I start the container with machinectl? It worked with previous
systemd versions :) Tested with systemd 230 on Arch Linux.

Thanks again + regards,

Stefan


More information about the systemd-devel mailing list