This is a guide for Installing and Configuring QEMU Guest Agent for TrueNAS 13. It is based on the QEMU Guest Agent and VirtIO Console driver from FreeBSD 13.
Due to the TrueNAS kernel lacking certain FreeBSD drivers, it's necessary to download the FreeBSD 13 kernel, extract the VirtIO Console driver and integrate it into the TrueNAS system. This ensures TrueNAS compatibility with virtualized environments.
Required packages for this guide:
FreeBSD 13 Binary Packages:
Download FreeBSD 13.1 kernel.txz and extract ./boot/kernel/virtio_console.ko
driver to /boot/modules/
directory.
Load the VirtIO Console driver with
kldload /boot/modules/virtio_console.ko
Download FreeBSD 13 QEMU Guest Agent package.
Install downloaded qemu-guest-agent
package using pkg add
.
Backup installed /usr/local/etc/rc.d/qemu-guest-agent
to /root/qga_backup/
. This will be a copy that is re-added to the rc.d directory each time TrueNAS boots.
Create the following Tunables in the TrueNAS web UI under System -> Tunables:
qemu_guest_agent_enable
, Value: YES
, Type: RC
, Enabled: yes
qemu_guest_agent_flags
, Value: -d -v -l /var/log/qemu-ga.log
, Type: RC
, Enabled: yes
virtio_console_load
, Value: YES
, Type: LOADER
, Enabled: yes
Set up Init/Shutdown Scripts in Tasks -> Init/Shutdown Scripts:
Command
, Command: service qemu-guest-agent start
, When: POSTINIT
, Enabled: yes
, Timeout: 10
Command
, Command: cp /root/qga_backup/qemu-guest-agent /usr/local/etc/rc.d
, When: PREINIT
, Enabled: yes
, Timeout: 10
Reboot TrueNAS to apply changes.
Via bash script:
Execute the following commands on your TrueNAS system:
curl -O https://raw.githubusercontent.com/gushmazuko/truenas-qemu-guest-agent/master/install.sh
chmod +x install.sh
./install.sh
Reboot TrueNAS to apply changes.
Or via ansible:
Execute ansible-playbook on your TrueNAS system:
ansible-playbook ./install_qemu_guest_agent_on_truenas.yml \
-e working_host=truenas.example.com \
-e ansible_ssh_port=22
Reboot TrueNAS to apply changes.
Following these steps ensures the successful installation and configuration of the QEMU Guest Agent
on TrueNAS 13, improving its functionality in virtualized environments.