multipass
multipass copied to clipboard
Obscure error when attempting to create instance with name longer than 46 characters
Obscure error when attempting to create instance with name longer than 46 characters
To Reproduce
When name is 47 characters long or more: FAIL
$ multipass launch -v --name "o1234567890123456789012345678901234567890123456" focal
[2022-09-05T11:52:34.078] [error] [lxd request] Operation completed with error: (400) Failed to run: forklimits limit=memlock:unlimited:unlimited fd=3 -- /snap/lxd/23537/bin/qemu-system-x86_64 -S -name o1234567890123456789012345678901234567890123456 -uuid 94d09ee5-a3d6-4091-9ecb-9d2ed3026390 -daemonize -cpu host,hv_passthrough -nographic -serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=allow,resourcecontrol=deny -readconfig /var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.conf -spice unix=on,disable-ticketing=on,addr=/var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.spice -pidfile /var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.pid -D /var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.log -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas lxd: : Process exited with non-zero value 1
launch failed: Operation completed with error: (400) Failed to run: forklimits limit=memlock:unlimited:unlimited fd=3 -- /snap/lxd/23537/bin/qemu-system-x86_64 -S -name o1234567890123456789012345678901234567890123456 -uuid 94d09ee5-a3d6-4091-9ecb-9d2ed3026390 -daemonize -cpu host,hv_passthrough -nographic -serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=allow,resourcecontrol=deny -readconfig /var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.conf -spice unix=on,disable-ticketing=on,addr=/var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.spice -pidfile /var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.pid -D /var/snap/lxd/common/lxd/logs/multipass_o1234567890123456789012345678901234567890123456/qemu.log -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas lxd: : Process exited with non-zero value 1
When name is 46 characters long or less: OK
$ multipass launch -v --name "o123456789012345678901234567890123456789012345" focal
Launched: o123456789012345678901234567890123456789012345
Expected behavior
A human-friendly error message, such as: "Invalid name - name is longer than 46 characters"
Additional info
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
$ multipass version
multipass 1.10.1
multipassd 1.10.1
$ multipass get local.driver
lxd
$ lxd version
5.5
Hi @joes, thanks for reporting. This is a limitation of LXD only. We are working in making failures more verbose when using LXD as backend. We will keep this one in mind.
Rather than add more restrictions and create backend specific logic, one way of fixing this would be to use UUIDs to internally identify instances and have the name just be a label. See #255