Rescuing a qemu android-x86 image

· by [Joakim Verona] · Read in about 2 min · (236 words) ·

I use a number of qemu based android-x86 for various purposes, such as storing proprietary certificate handling software in them.

One of the virtual machines suddenly refused to boot. It kept hanging during the display of the android logo in the early boot sequence.

Booting the virtual machine in debug mode revealed that there was an issue with the ext3 root filesystem.

Very odd. This is how I solved it


yum install guestfish
guestfish -a  ~/android-x86/certstore.img

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> help
Add disk images to examine using the -a or -d options, or the 'add' command.
Or create a new disk image using -N, or the 'alloc' or 'sparse' commands.
Once you have done this, use the 'run' command.

For more information about a command, use 'help cmd'.

To read the manual, type 'man'.

><fs> run
><fs> list-filesystems
/dev/sda1: ext3
><fs> fsck ext3 /dev/sda1

At this point theres a progress bar, and a segfault. If I try guestfish and run again, there is no error report or progress bar.

Then I can boot the vm as usual.

qemu-kvm -m 512 -hda ~/android-x86/certstore.img -vga std -usbdevice tablet

The error in the boot happened again at a later time, and I could again recover the image the exact same way.