
Sent: Tuesday, August 27, 2024 at 10:34 AM From: "Michal Prívozník" <mprivozn@redhat.com> To: "daggs" <daggs@gmx.com> Cc: users@lists.libvirt.org Subject: Re: autostart sessiioned vms
On 8/26/24 19:33, daggs wrote:
Greetings Michal,
Sent: Monday, August 26, 2024 at 11:52 AM From: "Michal Prívozník" <mprivozn@redhat.com> To: "daggs" <daggs@gmx.com>, users@lists.libvirt.org Subject: Re: autostart sessiioned vms
On 8/23/24 14:23, daggs via Users wrote:
Greetings,
I'm running sessioned vms which I want to start them up at boot. I've marked a vm inside a use as autostart, added libvirtd to the boot order and rebooted but it didn't started the vm. I tried adding libvirt-guests to bott services but my sessioned vm is still not autostarting. what is the proper way to do so?
There are two modes of operation:
1) qemu:///system 2) qemu:///session
The former runs a system-wide VMs, the latter runs per-user VMs. The former runs libvirtd under root, the latter runs libvirtd under given user. If you enable libvirtd at startup, it's very likely that you're starting the system-wide instance (i.e. qemu:///system).
Usually, per-user daemons (like dbus, pipewire) are started after user logs in. That's where you want to place libvirtd start too. I'm not sure what init system you're using, but perhaps it has a way to start a per-user service - consult documentation to your init system.
BTW: user daemon is started automatically upon connection opening. For instance, running the following starts a session daemon:
$ virsh uri
Oh, and if you're using autostart for other objects than domains, then you need to start corresponding daemons.
Michal
I'm using openrc. so based on the above, if I login as the user where the vm is defined, it should start it?
If you configure your session manager then yes. For instance, I'm using KDE and I can configure what files should be executed after login.
that system uses only cli, I need the vms to start at boot
what happens if I log out from the user? the vm stays up?
Yes, the daemon won't die unless there's no VM running and no client connected for 120 seconds (by default). what do you mean by "client"
Michal