Cannot boot vms with a trailing - in the name

Asked by Michael Antosh

When booting a VM with libvirt/qemu named 'miiiiiiiiiiiike-s-antoshnment-junkliance-trash-internal-v001-54cn5' a file gets created in /run/system/machines named qemu-10-miiiiiiiiiiiike-s-antoshnment-junkliance-trash-internal-. When that generated name ends with a '-', the VM is unable to boot:

# virsh start miiiiiiiiiiiike-s-antoshnment-junkliance-trash-internal-v001-54cn5
error: Failed to start domain miiiiiiiiiiiike-s-antoshnment-junkliance-trash-internal-v001-54cn5
error: Invalid machine name

If I change the VM name such that the generated name ends with a character other than '-', the VM will start. Is there a fix for this or workaround? Our users can pick their VM names.

# uname -a
Linux csgdmlx-ost-1-2.company.com 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"

# apt list --installed | grep -e libvirt -e qemu -e dbus -e systemd
dbus-user-session/focal-updates,focal-security,focal-security,now 1.12.16-2ubuntu2.1 amd64 [installed,automatic]
dbus/focal-updates,focal-security,focal-security,now 1.12.16-2ubuntu2.1 amd64 [installed]
ipxe-qemu-256k-compat-efi-roms/focal,now 1.0.0+git-20150424.a25a16d-0ubuntu4 all [installed,automatic]
ipxe-qemu/focal-updates,now 1.0.0+git-20190109.133f4c4-0ubuntu3.2 all [installed,automatic]
libdbus-1-3/focal-updates,focal-security,focal-security,now 1.12.16-2ubuntu2.1 amd64 [installed]
libnss-systemd/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed]
libpam-systemd/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed]
libsystemd0/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed]
libvirt-clients/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed]
libvirt-daemon-driver-qemu/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed,automatic]
libvirt-daemon-driver-storage-rbd/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed,automatic]
libvirt-daemon-system-systemd/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed,automatic]
libvirt-daemon-system/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed]
libvirt-daemon/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed]
libvirt0/focal-updates,now 6.0.0-0ubuntu8.11 amd64 [installed,automatic]
python3-dbus/focal,now 1.2.16-1build1 amd64 [installed]
python3-libvirt/focal,now 6.1.0-1 amd64 [installed]
python3-slip-dbus/focal,now 0.6.5-2 all [installed,automatic]
qemu-block-extra/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 amd64 [installed,automatic]
qemu-kvm/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 amd64 [installed,automatic]
qemu-system-common/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 amd64 [installed,automatic]
qemu-system-data/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 all [installed,automatic]
qemu-system-gui/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 amd64 [installed,automatic]
qemu-system-x86/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 amd64 [installed,automatic]
qemu-utils/focal-updates,focal-security,focal-security,now 1:4.2-3ubuntu6.17 amd64 [installed,automatic]
systemd-container/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed,automatic]
systemd-sysv/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed]
systemd-timesyncd/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed]
systemd/focal-updates,now 245.4-4ubuntu3.7 amd64 [installed]

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

If you escape the minus signs, does it help?

Eg

virsh start miiiiiiiiiiiike\-s\-antoshnment\-junkliance\-trash\-internal\-v001\-54cn5

Revision history for this message
Michael Antosh (antosh) said :
#2

Escaping the machine name doesn't seem to help. Here's some additional libvirt debug logs and the dbus error:

libvirt:
2021-07-19 20:36:25.909+0000: 2614: info : virDBusCall:1543 : DBUS_METHOD_CALL: 'org.freedesktop.machine1.Manager.CreateMachineWithNetwork' on '/org/freedesktop/machine1' at 'org.freedesktop.machine1'
2021-07-19 20:36:25.910+0000: 2614: info : virDBusCall:1551 : DBUS_METHOD_ERROR: 'org.freedesktop.machine1.Manager.CreateMachineWithNetwork' on '/org/freedesktop/machine1' at 'org.freedesktop.machine1' error org.freedesktop.DBus.Error.InvalidArgs: Invalid machine name
2021-07-19 20:36:25.910+0000: 2614: error : virSystemdCreateMachine:400 : Invalid machine name

dbus:
method call time=1626730240.788467 sender=:1.176442 -> destination=org.freedesktop.machine1 serial=400 path=/org/freedesktop/machine1; interface=org.freedesktop.machine1.Manager; member=CreateMachineWithNetwork
   string "qemu-99073-pumapushprocessor-stage-tte-operational-android-v027-"
   array of bytes [
      fc 07 39 36 33 3c 43 86 bc ba 03 b3 03 14 46 11
   ]
   string "libvirt-qemu"
   string "vm"
   uint32 1995423
   string ""
   array [
      int32 99082
   ]
   array [
      struct {
         string "Slice"
         variant string "machine.slice"
      }
      struct {
         string "After"
         variant array [
               string "libvirtd.service"
            ]
      }
      struct {
         string "Before"
         variant array [
               string "virt-guest-shutdown.target"
            ]
      }
   ]
method call time=1626730240.788688 sender=:1.3 -> destination=org.freedesktop.DBus serial=3263047 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetConnectionUnixUser
   string ":1.176442"
method return time=1626730240.788703 sender=org.freedesktop.DBus -> destination=:1.3 serial=99081 reply_serial=3263047
   uint32 0
error time=1626730240.788798 sender=:1.3 -> destination=:1.176442 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=400
   string "Invalid machine name"

Can you help with this problem?

Provide an answer of your own, or ask Michael Antosh for more information if necessary.

To post a message you must log in.