Posts

Showing posts from February, 2020

using libguestfs virt-customize tool to modify qcow2 image and reset root password.

ibguestfs is a C library and a set of tools for accessing and modifying virtual disk images used in platform virtualization. The tools can be used for viewing and editing virtual machines managed by libvirt and files inside VMs, scripting changes to VMs, creating VMs, and much else beside. virt-customize is one of them as example. If you forgot root user password here is how you can modify . # virsh shutdown debian9-vm1 # virt-customize -a /var/lib/libvirt/images/debian9-vm1.qcow2 --root-password password:NewRootUserPasswordHere  not only this but you can edit many more. The –run-command option is used to execute any command inside a virtual image file. 1) register with rhel subscription virt-customize -a rhel-server-7.6.qcow2 --run-command 'subscription-manager attach --pool [subscription-pool]'     Install software or packages- virt-customize -a rhel-server-7.6.qcow2 --install net-tools  Upload a file into image virt-customize -a rhel-se...