Martin T
2022-Mar-20 20:09 UTC
How to make the libvirt VM installed under the regular user boot during the system bootup?
Hi. I installed a virtual machine under a regular user(in other words, not under root user) with virt-install and configured this VM to boot automatically: $ virsh dominfo vm Id: 1 Name: vm UUID: eef95dd6-5efe-4059-8dcc-3e35db12f55d OS Type: hvm State: running CPU(s): 4 CPU time: 253.7s Max memory: 4194304 KiB Used memory: 4194304 KiB Persistent: yes Autostart: enable Managed save: no Security model: none Security DOI: 0 $ ls -l /home/user/.config/libvirt/qemu/autostart/ total 0 lrwxrwxrwx 1 user user 47 Apr 30 16:59 vm.xml -> /home/user/.config/libvirt/qemu/vm.xml $ The vm indeed starts automatically, but only when the regular user has logged in. I would like libvirtd(started by the systemd) to execute this VM already during the system bootup when the regular user has not yet logged in. How to accomplish this? I also made a symlink under /etc/libvirt/qemu/autostart/, but this did not help. thanks, Martin
Martin Kletzander
2022-Mar-21 09:15 UTC
How to make the libvirt VM installed under the regular user boot during the system bootup?
On Sun, Mar 20, 2022 at 10:09:36PM +0200, Martin T wrote:>Hi. > >I installed a virtual machine under a regular user(in other words, not >under root user) with virt-install and configured this VM to boot >automatically: > >$ virsh dominfo vm >Id: 1 >Name: vm >UUID: eef95dd6-5efe-4059-8dcc-3e35db12f55d >OS Type: hvm >State: running >CPU(s): 4 >CPU time: 253.7s >Max memory: 4194304 KiB >Used memory: 4194304 KiB >Persistent: yes >Autostart: enable >Managed save: no >Security model: none >Security DOI: 0 > >$ ls -l /home/user/.config/libvirt/qemu/autostart/ >total 0 >lrwxrwxrwx 1 user user 47 Apr 30 16:59 vm.xml -> >/home/user/.config/libvirt/qemu/vm.xml >$ >This is still using the session daemon, which only starts when you connect to it or when you log in with the session daemon service setup to start automatically. There are two ways to overcome this. One is to use the system daemon instead (virsh -c qemu:///system) which you can also set as your default for example by setting uri_default = "qemu:///system" in ~/.config/libvirt/libvirt.conf and there are other means as well. If you are running a system with systemd then you can also setup lingering for your user (loginctl enable-linger <your-user>) as that would enable running the user services even without being logged in.>The vm indeed starts automatically, but only when the regular user has >logged in. I would like libvirtd(started by the systemd) to execute >this VM already during the system bootup when the regular user has not >yet logged in. How to accomplish this? I also made a symlink under >/etc/libvirt/qemu/autostart/, but this did not help. > > >thanks, >Martin >-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20220321/2b4a6174/attachment.sig>