{"id":549,"date":"2023-08-02T10:53:59","date_gmt":"2023-08-02T08:53:59","guid":{"rendered":"https:\/\/gilbert.busana.lu\/?p=549"},"modified":"2024-01-19T13:31:41","modified_gmt":"2024-01-19T12:31:41","slug":"install-qemu-agents-inside-vms","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=549","title":{"rendered":"Install QEMU guest agent inside VM"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">On Linux<\/h2>\n\n\n\n<p>1. Install the agent inside the VM:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>apt install qemu-guest-agent<\/code><\/pre><\/div>\n\n\n\n<p>2. Shut down the VM<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>shutdown -h now<\/code><\/pre><\/div>\n\n\n\n<p>3. Enable the guest agent in Proxmox Interface<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"507\" src=\"https:\/\/gilbert.busana.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-1024x507.png\" alt=\"\" class=\"wp-image-552\" srcset=\"https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-1024x507.png 1024w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-300x149.png 300w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-768x380.png 768w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-1536x761.png 1536w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-2048x1014.png 2048w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/08\/QEMU-agent-624x309.png 624w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>4. Start the VM and check if the agent is running<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-file=\"Check if alive\" data-lang=\"Bash\"><code>systemctl status qemu-guest-agent<\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">On FreeBSD 13<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Place\u00a0<code><em>virtio_console.ko<\/em><\/code>\u00a0in\u00a0<em><code>\/boot\/modules<\/code>.<\/em> (<em>wget http:\/\/web.busana.lu\/qemu\/<code>virtio_console.ko<\/code><\/em>)<\/li>\n\n\n\n<li>Run&nbsp;<em><code>kldload virtio_console.ko<\/code>.<\/em><\/li>\n\n\n\n<li>Place\u00a0<code><em>qemu-ga<\/em><\/code>\u00a0in\u00a0<code><em>\/usr\/local\/bin<\/em><\/code>. (<em>wget http:\/\/web.busana.lu\/qemu\/<code><code><em>qemu-ga<\/em><\/code><\/code><\/em>).<\/li>\n\n\n\n<li>Place\u00a0<em><code>qemu-guest-agent<\/code>\u00a0<\/em>in\u00a0<code><em>\/usr\/local\/etc\/rc.d<\/em><\/code>. (<em>wget http:\/\/wwb.busana.lu\/qemu\/<code>qemu-guest-agent<\/code><\/em>)<\/li>\n\n\n\n<li>Place&nbsp;<code><em>qemu-guest-agent<\/em><\/code>&nbsp;in another location of your choice. This will be a copy that is re-added to the rc.d directory each time TrueNAS boots (<em>\/usr\/local\/qemuGB\/qemu-guest-agent<\/em>).<\/li>\n\n\n\n<li>Create Tunables in the TrueNAS web UI. System -&gt; Tunables.\n<ol class=\"wp-block-list\">\n<li>Variable=<code><em>qemu_guest_agent_enable<\/em><\/code>&nbsp;Value=<code><em>YES<\/em><\/code>&nbsp;Type=<code><em>RC<\/em><\/code>&nbsp;Enabled=<code><em>yes<\/em><\/code><\/li>\n\n\n\n<li>Variable=<code><em>qemu_guest_agent_flags<\/em><\/code>&nbsp;Value=<code><em>-d -v -l \/var\/log\/qemu-ga.log<\/em><\/code>&nbsp;Type=<code><em>RC<\/em><\/code> Enabled=<code><em>yes<\/em><\/code><\/li>\n\n\n\n<li>Variable=<code><em>virtio_console_load<\/em><\/code>&nbsp;Value=<code><em>YES<\/em><\/code>&nbsp;Type=<code><em>LOADER<\/em><\/code>&nbsp;Enabled=<code><em>yes<\/em><\/code><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Create Init\/Shutdown Scripts in the TrueNAS web UI. Tasks -&gt; Init\/Shutdown Scripts.\n<ol class=\"wp-block-list\">\n<li>Type=<code><em>Command<\/em><\/code>&nbsp;Command=<code><em>service qemu-guest-agent start<\/em><\/code>&nbsp;When=<code><em>POSTINIT<\/em><\/code> Enabled=<code><em>yes<\/em><\/code>&nbsp;Timeout=<code><em>10<\/em><\/code><\/li>\n\n\n\n<li>Type=<code><em>Command<\/em><\/code>&nbsp;Command=<code><em>cp \/[path to a local copy of qemu-guest-agent file] \/usr\/local\/etc\/rc.d<\/em><\/code>&nbsp; When=<code><em>PREINIT<\/em><\/code>&nbsp;Enabled=<code><em>yes<\/em><\/code>&nbsp;Timeout=<code><em>10<\/em><\/code> (<em>cp \/usr\/local\/qemuGB\/qemu-guest-agent \/usr\/local\/etc\/rc.d<\/em>).<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Reboot TrueNAS.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>On Linux 1. Install the agent inside the VM: 2. Shut down the VM 3. Enable the guest agent in Proxmox Interface 4. Start the VM and check if the agent is running On FreeBSD 13<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[8,28],"tags":[],"class_list":["post-549","post","type-post","status-publish","format-standard","hentry","category-proxmox","category-vm"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=549"}],"version-history":[{"count":7,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":559,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions\/559"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}