multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Obscure error when attempting to create instance with name longer than 46 characters

Open joes opened this issue 2 years ago • 2 comments

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

joes avatar Sep 05 '22 12:09 joes

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.

luis4a0 avatar Sep 05 '22 15:09 luis4a0

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

sharder996 avatar Sep 07 '22 17:09 sharder996