Greetings Michal,
Sent: Monday, August 26, 2024 at 11:52 AM
From: "Michal Prívozník" <mprivozn(a)redhat.com>
To: "daggs" <daggs(a)gmx.com>, users(a)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?
what happens if I log out from the user? the vm stays up?
Dagg