Boxes window disappears but process keeps running

Sometimes GNOME Boxes (installed as flatpak on Fedora 30 Silverblue) window disappears from the shell. Don’t know why; I only know I did not close the window. In fact flatpak ps shows the process still running.

How can I restore the window?
If I start another window, I won’t be able to launch the box already running in the other process.
If I flatpak kill the process, I’ll have to restart again the box. I’d like to avoid this and understand what’s happening.

This is the info of the running instance:

$ cat /run/user/1000/.flatpak/2870861365/info 
[Application]
name=org.gnome.Boxes
runtime=runtime/org.gnome.Platform/x86_64/3.32

[Instance]
instance-id=2870861365
instance-path=/home/fede/.var/app/org.gnome.Boxes
app-path=/var/lib/flatpak/app/org.gnome.Boxes/x86_64/stable/fb1b815fa89f283b240136a2b3668f05e29feeaf58c34adc6750ff25277cc2f8/files
app-commit=fb1b815fa89f283b240136a2b3668f05e29feeaf58c34adc6750ff25277cc2f8
app-extensions=org.gnome.Boxes.Locale=a4c7cb7e9906db6ec3210bfea83ff781637cb2e0ff5c6ba7474d4550ca2f7ee4
runtime-path=/var/lib/flatpak/runtime/org.gnome.Platform/x86_64/3.32/66c67084d6f1e2ad8ed6d3a1d40819be017b14ad87355c8a071187ac30c5f040/files
runtime-commit=66c67084d6f1e2ad8ed6d3a1d40819be017b14ad87355c8a071187ac30c5f040
runtime-extensions=org.gnome.Platform.Locale=c021ac7e6913c506fd08718be097c055b78f8d122220870f5e954c30be2b374a;org.freedesktop.Platform.html5-codecs=dfca6ff90bc40f1895340fb83d2e5b4bfbf2ea55e1bb264240af7aa58309268a
branch=stable
arch=x86_64
flatpak-version=1.4.1
session-bus-proxy=true
system-bus-proxy=true

[Context]
shared=network;ipc;
sockets=x11;wayland;pulseaudio;fallback-x11;
devices=all;
filesystems=home;xdg-run/dconf;~/.config/dconf:ro;

[Session Bus Policy]
org.freedesktop.Tracker1=talk
org.freedesktop.timedate1=talk
ca.desrt.dconf=talk
org.freedesktop.Accounts=talk

[Environment]
GI_TYPELIB_PATH=/app/lib/girepository-1.0
GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0:/usr/lib/extensions/gstreamer-1.0:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/share
DCONF_USER_CONFIG_DIR=.config/dconf

I think if you just pkill gnome-boxes the VMs will stay running though not sure if Boxes will be able to start cleanly afterwards.

pkill doesn’t kill the process actually.

I’ll have to use flatpak kill as I cannot wait…

do you think it’s a flatpak or a Boxes issue?

Strange, I cannot kill it in any way:

$ flatpak ps
Instance   PID  Application     Runtime
4145347    9054 org.gnome.Boxes org.gnome.Platform
2870861365 3465 org.gnome.Boxes org.gnome.Platform

$ flatpak kill org.gnome.boxes
error: org.gnome.boxes is not running.

Ok, I had to kill the instance:

$ flatpak ps
Instance   PID  Application     Runtime
2870861365 3465 org.gnome.Boxes org.gnome.Platform

$ flatpak kill org.gnome.boxes
error: org.gnome.boxes is not running.

$ flatpak kill 3465
error: 3465 is not running.

$ flatpak kill 2870861365

Should have been org.gnome.Boxes. Well, a better error message would have been “there’s no org.gnome.boxes app. Did you mean org.gnome.Boxes?”.

A fundamental issue we currently have in the Boxes Flatpak is that each instance of it has its own libvirtd daemon. This way, once you close Boxes (or it crashes), you loose access to that libvirtd process. Opening a new Boxes instance will spawn a new libvirtd in the sandbox, not reuse the one spawned in the previous container.

Besides, once you open a new instance of Boxes and try to connect to the VM you had opened before, libvirt will complain that there’s already a qemu-* process using that disk/image. That’s why flatpak kill “fixes” the issue. It kills all the processes in the first container and allows everything to start over again. That’s, of course, not an acceptable solution.

For this reason, I’m currently working on using the Flatpak “Background” portal to allow Boxes to run in the background when there are existing operations such as a VM you left running, a clone VM operation, etc… https://github.com/flatpak/xdg-desktop-portal/pull/319

2 Likes