ZFS - Equivalent to running virt-customize --run-command

harmonyp

Member
Nov 26, 2020
196
4
23
47
How can you run the following on a ZFS system?

Code:
virt-customize --run-command 'apt install netplan -y' -a /var/lib/vz/images/104/vm-104-disk-0.raw
 
Last edited:
Can't get that to work.

My issue is I have a ZFS virtual machine that has no network interfaces I need to install netplan how would I go about doing that on ZFS? Maybe @Dunuin can save me again :)

If it wasn't ZFS normally I would just shutdown the VM and run

Code:
virt-customize --run-command 'apt install netplan -y' -a /var/lib/vz/images/104/vm-104-disk-0.raw

Maybe I can chroot in?
 
Last edited:
Something like qm guest exec can work if the VM is running? But the QEMU Guest Agent needs to be installed first.
That would require the network on the VM to be working though.

The solution was

Code:
mkdir -p /mnt/100
mount /dev/zvol/zfs/vm-100-disk-0-part2 /mnt/100

Then chroot in

Code:
chroot /mnt/100

and finally run commands

Code:
apt install netplan -y
 
By the way...
No, it does not. You only need access to the Proxmox node and QEMU GA needs to be running inside the VM. But glad you got it working anyway.
Still the question if it would have helped. I guess a guest without a network interface also can't use apt to install packages without a internet connection.
 
By the way...

Still the question if it would have helped. I guess a guest without a network interface also can't use apt to install packages without a internet connection.
You can copy the contents of the package (or an archive of multiple ones) via stdin, or use virtio-fs or 9p to provide a file share. I guess there is little you can't do via a virtual PCI(e) device... ;-)