From Marss86

Revision as of 19:13, 25 April 2012 by Avadh (Talk | contribs) (Serial Console Setup)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Increase QEMU Image Size

Follow steps given below to increase the size of QEMU image.

1- Convert to a raw image

   qemu-img convert system.qcow -O raw system.raw

2- Increase the size of the raw image

   dd if=/dev/zero of=system.raw seek=N obs=1GB count=0

where N is the number of GigaBytes

IF NTFS: Fix the NTFS BPB Edit the raw file: hexedit system.raw Goto to offset 7E00: 7E00 Change 80 to FF at offset 7E1A and save: FF --> Ctrl-x --> y

3. Use gparted or other similar live-cd system to resize your 'ext' or 'ntfs' partitions

4. Boot to your new disk image and make sure everything is working fine.

5. If you need to save space, convert back to qcow

   qemu-img convert system.raw -O qcow growed-system.qcow


When running QEMU under gdb, gdb stops on every signal received by QEMU. QEMU uses SIGUSR2 as timeout for VM, we can ignore this signals and continue with our debugging. To disable this signals you can give following command in gdb terminal.

   (gdb) handle SIGUSR1 SIGUSR2 noprint nostop

Serial Console Setup

Reference: [1]

Create /etc/init/ttyS0.conf file with following contents:

# ttyS0 - getty
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[012345]
stop on runlevel [!012345]

exec /sbin/getty -L 115200 ttyS0 vt102

Only change in the file from above link is I have added run level 0 and 1 also to start serial console. After enabling this serial console you can use '-serial pty' option in Marss command line to forward serial console to a 'char' device. Then you can use any scripting language to perform repetitive tasks.

If you want to see kernel message and boot messages in serial port (ttyS0) then add console=ttyS0 and console=ttyS0,115200 to kernel commadline as shown here:

    kernel              /* Standard kenrel parameter */ console=ttyS0 console=ttyS0,115200

Automatic Login to Console

If you want to automatically login to either serial or default console than add following line at the end of tty configuration.

For default console tty1 edit /etc/init/tty1.conf:

exec /bin/login -f root < /dev/tty1 > /dev/tty1 2>&1

For serial console ttyS0 edit /etc/init/ttyS0.conf:

exec /bin/login -f root < /dev/ttyS0 > /dev/ttyS0 2>&1

VM Doesn't boot when running for more than 8 cores

This issue is due to serial execution of CPUs take too much time for linux kernel to boot (mounting partitions timer expires in most of the cases). To solve this issue add rootdelay parameter to your kernel command in /boot/grub/menu.lst file as shown below.

kernel          /boot/vmlinuz-2.6.38-10-virtual root=UUID=8c581cbb-4c0b-4503-a7f4-0bf9d6c57e15 ro quiet splash  rootdelay=200
Personal tools