[arch-general] Arch VM + QEMU/KVM + libvirt + Systemd

arnaud gaboury arnaud.gaboury at gmail.com
Tue Feb 11 02:36:22 EST 2014


Dear all,

I have been reading and working hard these past few days to set up a
Arch VM guest on my Arch host.

The guest partition is on /dev/sdc and mounted on my root partition as
/dahlia (name of the machine). First question : is this Ok or shall I
instead use /machine/dahlia as container directory. Then, this
partition is mounted twice indeed. One time on my host fstab as
/dahlia and a second time on my guest fstab as /. It sounds to me
redundant.

Then I installed Arch with pacstrap on /dahlia. No bootloader but
Linux (i will remove the last one later as I want to share the kernel
with the host). After many errors due to some missing libs,
installation went fine.

I managed everything about cgroups, even spent hours on
/etc/cgconfig.conf which is not mandatory since systemd 205. I can see
a dahlia folder in all controllers (sys/fs/cgroup/$CONTROLLER-NAME).

As for systemd, I enabled cgconfig , libvirt-guest.service and
systemd-machined.service

gabx at hortensia ➤➤ ~ % systemctl status systemd-machined.service
systemd-machined.service - Virtual Machine and Container Registration Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-machined.service; static)
   Active: active (running) since Tue 2014-02-11 08:09:25 CET; 12min ago
     Docs: man:systemd-machined.service(8)
           http://www.freedesktop.org/wiki/Software/systemd/machined
 Main PID: 980 (systemd-machine)
   CGroup: /system.slice/systemd-machined.service
           └─980 /usr/lib/systemd/systemd-machined

Feb 11 08:09:25 hortensia systemd[1]: Starting Virtual Machine and
Container Registration Service...
Feb 11 08:09:25 hortensia systemd[1]: Started Virtual Machine and
Container Registration Service.
Hint: Some lines were ellipsized, use -l to show in full.


Now comes the tricky part : registering my container with slice mechanism.

$ machine ctl
returns empty.
 /sys/fs/cgroup/systemd/machine.slice directory contains nothing about
dahlia container.

gabx at hortensia ➤➤ ~ # systemd-nspawn -M /dahlia
Invalid machine name: /dahlia

gabx at hortensia ➤➤ ~ # systemd-nspawn -bD /dahlia
Spawning namespace container on /dahlia (console is /dev/pts/1).
Init process in the container running as PID 1208.
execv() failed: No such file or directory
Container failed with error code 1.


I put a machine-dahlia.slice unit file in /etc/systemd/system, but I
am not sure it is enough.

I read I shall register the container with logind, but no idea how.

How can I register my container for systemd to recognize it ? Shall I
use the usual way with libvirt and virsh ?

Thank you for help in such a tricky set up.


--


More information about the arch-general mailing list