Flatpak: socket path too long if username is longer than 17 characters
I got a support request from an Endless user, saying that they can't create new VMs in Boxes. I found the following in their journal:
okt 23 18:41:12 endless gnome-boxes[7324]: machine.vala:636: Failed to start Zorin-OS-12: Unable to start domain: internal error: Monitor path /sysroot/home/endlessgnome/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/domain-1-boxes-unknown/monitor.sock too big for destination
And this in the Boxes troubleshooting log (from a different session):
2018-10-19T18:10:22.837513Z qemu-system-x86_64: -chardev socket,id=charmonitor,path=/sysroot/home/endlessgnome/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/domain-1-boxes-unknown/monitor.sock,server,nowait: UNIX socket path '/sysroot/home/endlessgnome/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/domain-1-boxes-unknown/monitor.sock' is too long
Path must be less than 108 bytes
2018-10-19 18:10:22.927+0000: shutting down, reason=failed
man 7 unix
confirms that, on Linux, named sockets' paths are limited to 108 bytes. This problem was made more likely for this user by several factors:
- Flatpak sets $XDG_CONFIG_DIR to $HOME/.var/app/org.gnome.Boxes/config which is 23 bytes longer than $HOME/.config
- On Endless, homedirs are in /sysroot/home not /home – 8 bytes longer
I tried to reproduce this problem on a Fedora machine to rule out any distro-specific issue, by creating an (administrator) user named 'twentyonecharusername'. Sure enough, I can't create any VMs using the Boxes flatpak, though I can on my user ('wjt'). I don't get quite as much detail in my troubleshooting log though – not sure why.
2018-10-23 20:09:18.084+0000: starting up libvirt version: 4.1.0, qemu version: 2.11.2, hostname: gelf
LC_ALL=C PATH=/app/bin:/usr/bin HOME=/home/twentyonecharusername USER=twentyonecharusername LOGNAME=twentyonecharusername QEMU_AUDIO_DRV=spice /app/bin/qemu-system-x86_64 -name guest=boxes-unknown,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/home/twentyonecharusername/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/domain-1-boxes-unknown/master-key.aes -machine pc-i440fx-2.11,accel=kvm,usb=off,dump-guest-core=off -cpu Broadwell-noTSX-IBRS -m 2048 -realtime mlock=off -smp 4,sockets=1,cores=2,threads=2 -uuid a763c7d8-7c0e-4cb8-a541-bbf584c280ba -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/home/twentyonecharusername/.var/app/org.gnome.Boxes/config/libvirt/qemu/lib/domain-1-boxes-unknown/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-reboot -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -device usb-hub,id=hub0,bus=usb.0,port=1 -drive file=/home/twentyonecharusername/.var/app/org.gnome.Boxes/data/gnome-boxes/images/boxes-unknown,format=qcow2,if=none,id=drive-ide0-0-0,cache=writeback -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 -drive file=/home/twentyonecharusername/manjaro-kde-17.1.12-stable-x86_64.iso,format=raw,if=none,id=drive-ide0-1-0,readonly=on -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 -netdev user,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:49:de:99,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -chardev spiceport,id=charchannel1,name=org.spice-space.webdav.0 -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0 -device usb-tablet,id=input0,bus=usb.0,port=2 -device usb-mouse,id=input1,bus=usb.0,port=3 -device usb-kbd,id=input2,bus=usb.0,port=4 -spice port=0,disable-ticketing,image-compression=off,seamless-migration=on -device virtio-vga,id=video0,max_outputs=1,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=5 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=6 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2,bus=usb.0,port=1.1 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3,bus=usb.0,port=1.2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on
2018-10-23 20:09:18.089+0000: shutting down, reason=failed
I tried using flatpak run --command=bash org.gnome.Boxes
, manually overriding XDG_CONFIG_HOME
and friends to be a shorter path, then launched gnome-boxes
and was able to create the VM using exactly the same ISO, so I am reasonably sure this is the same issue and it is not distro specific