Bug 461417 - spice-vdagentd not autostarting due to "X-GNOME-Autostart-Phase" in desktop file; consider patching it out
Summary: spice-vdagentd not autostarting due to "X-GNOME-Autostart-Phase" in desktop f...
Status: CONFIRMED
Alias: None
Product: neon
Classification: KDE Neon
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Neon Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-04 12:41 UTC by Sebastian Gauna
Modified: 2022-11-05 23:59 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Gauna 2022-11-04 12:41:07 UTC
SUMMARY

When running KDE Neon as a VM guest in QEMU, I'm not getting screen auto-resize or clipboard sharing, etc. I have to manually run 'spice-vdagent'. It works out of the box in Ubuntu though.

If I want to enable the service with 'sudo systemctl enable spice-vdagentd I get:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
 
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

STEPS TO REPRODUCE
1. Run KDE Neon guest VM in QEMU
2. Open it with Virtual Machine Manager or Remove Viewer
3. If opening it with Virtual Machine Manager enable the option "Autoresize VM with window"
4. Resize VM window.
5. Also, copy something to clipboard in your host
6. Try to paste it in your guest
7. Copy something to clipboard in your guest
8. Try to paste it in your host

OBSERVED RESULT
Guest resolution does not adjust.
Clipboard sharing does not occur.

EXPECTED RESULT
Auto adjust guest resolution.
Clipboard sharing.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.26
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.7
Comment 1 Nate Graham 2022-11-04 18:20:50 UTC
As that error message shows, the systemd service file is misconfigured. You'll need to report this to the QEMU people.
Comment 2 Sebastian Gauna 2022-11-05 10:47:37 UTC
(In reply to Nate Graham from comment #1)
> As that error message shows, the systemd service file is misconfigured.
> You'll need to report this to the QEMU people.

Sorry if I didn't explain myself well, the error happens inside the VM within the guest, not in the host, besides it works just fine in Ubuntu 22.04 guests...
Comment 3 Sebastian Gauna 2022-11-05 11:00:23 UTC
I mean, I installed nothing form QEMU in the Neon guest as I didn't either in the Ubuntu guest.

In a fresh installation of Ubuntu service spice-vdagentd is installed and started by default.
In a fresh installation of Neon it's not even enabled.

There's no QEMU involved here as far as I can tell, QEMU is in my host.
Besides, being that KDE Neon is Ubuntu, it seems to me that something was modified in Neon.

Sorry, I don't understand why I should report this to QEMU...
Comment 4 Sebastian Gauna 2022-11-05 13:55:38 UTC
I can confirm you that this is a Neon specific problem since I just installed a Kubuntu 22.04 VM guest and spice-vdagentd starts just fine by default.
Comment 5 Nate Graham 2022-11-05 14:02:28 UTC
What app provides the spice-vdagent.desktop autostart file? If it's not QEMU, it has to be something else.
Comment 6 Sebastian Gauna 2022-11-05 15:24:56 UTC
Sorry, I'm not a Linux expert, I don't understand exactly how it works, because spice has 2 executables:
/usr/bin/spice-vdagent
/usr/sbin/spice-vdagentd

There is no .desktop file as far as I can see, it runs as a service
It just comes preinstalled out of the box in Ubuntu, Kubuntu and Neon but in Neon the service is not enabled...

if you throw a 'sudo service spice-vdagent status' or 'sudo service spice-vdagentd status' in a fresh and clean installation of Ubuntu or Kubuntu you get:

     Loaded: loaded (/lib/systemd/system/spice-vdagentd.service; indirect; vendor preset: enabled)
     Active: active (running) since Sat 2022-11-05 10:51:41 -03; 1h 26min ago
TriggeredBy: ● spice-vdagentd.socket
    Process: 1162 ExecStart=/usr/sbin/spice-vdagentd $SPICE_VDAGENTD_EXTRA_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 1164 (spice-vdagentd)
      Tasks: 2 (limit: 4551)
     Memory: 960.0K
        CPU: 3.711s
     CGroup: /system.slice/spice-vdagentd.service
             └─1164 /usr/sbin/spice-vdagentd
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Now if you do the same in a fresh install of Neon you get:

○ spice-vdagentd.service - Agent daemon for Spice guests
     Loaded: loaded (/lib/systemd/system/spice-vdagentd.service; indirect; vendor preset: enabled)
     Active: inactive (dead)
TriggeredBy: ● spice-vdagentd.socket
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And in Neon if you try to enable the service, you get the error I posted...

The file /lib/systemd/system/spice-vdagentd.service has de the same content in the three distros

I really don't know what else to look for.
Comment 7 Nate Graham 2022-11-05 15:30:03 UTC
If the output and outcome of running `sudo systemctl enable spice-vdagentd` is different between Ubuntu/Kubuntu and Neon, that's due to either differences in those distros' Systemd versions and configurations, or differences in the service files for spice which come from the app that provides them, not any KDE software code. Moving to Neon.
Comment 8 Nate Graham 2022-11-05 15:30:34 UTC
Are you using Neon 20.04, or the newer 22.04?
Comment 9 Sebastian Gauna 2022-11-05 15:34:21 UTC
Both my host and VMs are 22.04
My host was a 20.04 ugraded to 22.04 and the VMs are installed with the latest ISO
Comment 10 Sebastian Gauna 2022-11-05 15:36:49 UTC
(In reply to Nate Graham from comment #7)
> If the output and outcome of running `sudo systemctl enable spice-vdagentd`
> is different between Ubuntu/Kubuntu and Neon, that's due to either
> differences in those distros' Systemd versions and configurations, or
> differences in the service files for spice which come from the app that
> provides them, not any KDE software code. Moving to Neon.

Actually in Ubuntu/Kubuntu there's no need to run 'sudo systemctl enable spice-vdagentd' it just enabled by default
Comment 11 Nate Graham 2022-11-05 15:40:43 UTC
Sure. Like I said, there appears to be a difference in either systemd, its configuration, or the app that provides the relevant systemd service. So far it's still l not looking like a KDE issue, unless the problem is a systemd misconfiguration.

Can you find out what the version of systemd is on your Neon system where it's broken, and on your Ubuntu and Kubuntu systems where it works?

Then do the same thing for the package that provides spice-vdagent.
Comment 12 Sebastian Gauna 2022-11-05 15:59:36 UTC
Output of 'systemctl --version' is 'systemd 249 (249.11-0ubuntu3.6)' for the three of them.

Output of 'apt list --installed spice*' is 'spice-vdagent/jammy,now 0.22.1-1 amd64 [installed,automatic]' for the three of them as well.
Comment 13 tagwerk19 2022-11-05 19:44:50 UTC
(In reply to Nate Graham from comment #11)
> ... So far it's still l not looking like a KDE issue, unless the problem is a systemd
> misconfiguration ...
I think it's something that's happening with the Neon upgrade to the Ubuntu 22.04 base

If I install an Ubuntu 20.04 Neon Testing as a KVM Guest:
   neon-testing-20220929-1047.iso

I see:

   $ ps ax | grep vdagent
      1375 ?        Ssl    0:00 /usr/bin/spice-vdagent
      1379 ?        Ss     0:00 /usr/sbin/spice-vdagentd
      2208 pts/2    S+     0:00 grep --color=auto vdagent

and Copy/Paste works between the host (which is running Fedora 36) and guest .

If I bring it up to date:

   # pkcon refresh
   # pkcon update

it is still OK:

   $ ps ax | grep vdagent
      1130 ?        Ssl    0:00 /usr/bin/spice-vdagent
      1139 ?        Ss     0:00 /usr/sbin/spice-vdagentd
      1253 pts/1    S+     0:00 grep --color=auto vdagent

If I upgrade to 22.04, it breaks. I no longer see the agent:

   $ ps ax | grep vdagent
      1216 pts/1    S+     0:00 grep --color=auto vdagent

and Copy/Paste between the host and guest no longer works.

If I try the suggested "systemctl enable"

   # systemctl enable spice-vdagentd

I get the error message as quoted:

   The unit files have no installation config ...

If I install a new Neon Testing, one based on Ubuntu 22.04:
   neon-testing-20221030-0733.iso

I don't see the agent:

   $ ps ax | grep vdagent
      1528 pts/1    S+     0:00 grep --color=auto vdagent

Copy/Paste no longer works between the host and guest and an update doesn't make a difference:

   # pkcon refresh
   # pkcon update

   $ ps ax | grep vdagent
      1217 pts/1    S+     0:00 grep --color=auto vdagent

Does this help?
Comment 14 tagwerk19 2022-11-05 23:07:41 UTC
Also happened to Fedora 34...
    https://bugzilla.redhat.com/show_bug.cgi?id=1951580
with similar error messages
    https://germano.fedorapeople.org/bugreport/spice/spice_vda_fedora34kde.txt
Comment 15 Nate Graham 2022-11-05 23:31:18 UTC
Ah, so it's just that old bug in Systemd: https://github.com/systemd/systemd/issues/18791

Until Systemd fixes the bug, you can work around it by removing the line with "X-GNOME-Autostart-Phase" on it from the .desktop file of the autostart entry for the app, which are not relevant to KDE Plasma and can be harmlessly deleted.

It looks like Fedora patched their package to do this, so users don't have to. Perhaps the Neon folks can do the same. Or maybe someone can submit a patch to systemd that fixes the bug.
Comment 16 Sebastian Gauna 2022-11-05 23:52:37 UTC
So then the problem is not happening in Ubuntu because it uses Gnome, and it's no happening in Kubuntu because they probably patched it for that distro?
Comment 17 Nate Graham 2022-11-05 23:55:26 UTC
That, or they patched out using systemd for autostart. Which you can also turn off for yourself, but it could have other consequences and slow down Plasma's startup process.
Comment 18 Sebastian Gauna 2022-11-05 23:59:07 UTC
OK, thanks