Skip to content

Instantly share code, notes, and snippets.

@JBlond
Created November 9, 2024 09:12
Show Gist options
  • Save JBlond/72be5c61c3eae25799d461dab91afc8d to your computer and use it in GitHub Desktop.
Save JBlond/72be5c61c3eae25799d461dab91afc8d to your computer and use it in GitHub Desktop.
truenas-qemu-guest-agent

TrueNAS 13 QEMU Guest Agent

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.

Requirements

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:

Manual Installation

  1. Install
sed -i .orig 's/enabled: yes/enabled: no/' /usr/local/etc/pkg/repos/local.conf
sed -i .orig 's/enabled: no/enabled: yes/' /usr/local/etc/pkg/repos/FreeBSD.conf
pkg update
pkg install qemu-guest-agent
  1. Backup

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.

  1. Create the following Tunables in the TrueNAS web UI under System -> Tunables:

    1. Variable: qemu_guest_agent_enable, Value: YES, Type: RC, Enabled: yes
    2. Variable: qemu_guest_agent_flags, Value: -d -v -l /var/log/qemu-ga.log, Type: RC, Enabled: yes
    3. Variable: virtio_console_load, Value: YES, Type: LOADER, Enabled: yes
  2. Set up Init/Shutdown Scripts in Tasks -> Init/Shutdown Scripts:

    1. Type: Command, Command: service qemu-guest-agent start, When: POSTINIT, Enabled: yes, Timeout: 10
    2. Type: Command, Command: cp /root/qga_backup/qemu-guest-agent /usr/local/etc/rc.d, When: PREINIT, Enabled: yes, Timeout: 10
  3. Reboot TrueNAS to apply changes.

sed -i .orig 's/enabled: yes/enabled: no/' /usr/local/etc/pkg/repos/local.conf
sed -i .orig 's/enabled: no/enabled: yes/' /usr/local/etc/pkg/repos/FreeBSD.conf
pkg update
pkg install qemu-guest-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment