Skip to content

TrueNAS SCALE

Is an Operating System for server based on Debian. It uses ZFS

Setup

Notes

Applications

Hosting Docker on VM

  • Recommendation: host the files in TrueNAS, not in the VM
    • So you can use compression, snapshots, …

UEFI

There's an issue with the Debian bootloader and the VM: You have to copy debian/grubx64.efi to EFI/BOOT/bootx64.efi This is inside /boot/efi/

Network

There are issues with routing VM network to VM Host - see this post - Connect to the console - Start 1. Configure network interface - Disable DHCP on your main interface - Create a new interface with N, bridge, and set the alias to 192.168.1.1/24 (or whatever is appropriate for your network). - Apply and persist - Reboot

Network File System

A dataset can contain all required data accessible via Network File System - config in this post too - When creating the dataset: - ACL Type: NFSv4 - ACL Mode: Passthrough - Create users & groups, same GUID as VM - When creating the NFS share - Set the service to be NFSv4 - Set the host to the Docker host ip - Security: SYS - Maproot user & Maproot group: the one created - Mount the NFS on the client and set on boot - see NFS

Nextcloud

  • Sync can be disabled to speed up performance on the dataset
  • Guide here if you use a host VM + Docker
  • If you use Snap
    • Copy the content of /var/snap/nextcloud to the /nfs/nextcloud
    • Edit /etc/fstab to add a mount from NFS to /var/snap/nextcloud
      • ⚠️ Don't mount a bind from the /nfs to the snap, otherwise you'll have an ordering problem in fstab

Data

NFS

  • NFSv4 should be a bit better

Virtual Machine

  • Access virsh: sudo virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" COMMAND
  • Get the domain of the VM: In the TrueNAS interface → Virtualization → Select the VM → Download Logs and observe the name

Install Windows in a VM

See Kernel-based Virtual Machine

Enable TPM Virtualization

  1. ⚠️ Not supported OOTB!
  2. Binary installation
    1. sudo chmod +x /bin/apt* /bin/dpkg*
    2. Download the swtpm, swtpm-libs, libtpms0, swtpm-tools, gnutls-bin packages
    3. Install them with sudo apt install -f /path/to/file.deb
    4. sudo chmod -x /bin/apt* /bin/dpkg*
  3. System setup
    1. sudo chmod 770 /var/lib/swtpm-localca/
    2. sudo nano /etc/apparmor.d/abstractions/libvirt-qemu and add at the end - Source
      1. IDTOREPLACE can be found when starting the VM (which will fail) and check the kern log: cat /var/log/kern.log or is the VM UUID (seen in virsh edit) without the - /var/db/system/syslog-IDTOREPLACE/log/swtpm/libvirt/qemu/** rw, /var/lib/libvirt/swtpm/** krw, /var/log/swtpm/** rw,
    3. systemctl reload apparmor.service
  4. Run the VM - need to do that everytime
    1. sudo virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" edit DOMAINVM and add at the end (but before </devices>) - Source xml <devices> <tpm model='tpm-tis'> <backend type='emulator' version='2.0'/> </tpm> </devices>
    2. sudo virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" start DOMAINVM
      1. Simple Protocol for Independent Computing Environments and VNC web displays available from the interface won't be initialized - so you have to rely on a local VNC viewer
      2. Port is not opened if you didn't start the machine from the web UI at least once

Display settings for SPICE

  • Port: 5900 or higher
  • Resolution: 1024x768
  • Bind: 0.0.0.0
  • Web interface: true

References