Score:0

Why I can't change qcow2 password via chroot

us flag

I have a Linux qcow2 image, and I want to change the root password.

I combined qemu-nbd and chroot commands to access the filesystem in this qcow2 file.

qemu-nbd --connect=/dev/nbd0 ./linux.qcow2
sudo mount /dev/nbd0p1 /mnt/sysimage
sudo mount -t proc none /mnt/sysimage/proc
sudo mount -o bind /dev /mnt/sysimage/dev
sudo mount -o bind /run /mnt/sysimage/run

sudo chroot /mnt/sysimage /bin/bash

After all the above, use the passwd to reset the password.

However, after booting this image in QEMU, it proves to not working.

All the helps on Goolge point to guestfs tool, which depends a long list of software. I indeed don't need these dependencies merely for a password reset.

So, besides mounting filesystem, what else does guestfs do?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.