How to reboot system by skipping BIOS

OS: Debian Wheezy

kexec makes you skip BIOS, MBR, and Grub stage for system startup.

boot sequences

Debian Wiki only says check the manual. I mean seriously RTFM is not a guide.

Install kexec-tools:

$ sudo aptitude install kexec-tools

Check kernel option and image files you will use:

$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.4.0-10.dmz.1-liquorix-amd64 root=UUID=07cf8c3a-d5a5-4b41-833f-16a9afebf70c ro quiet

or run fdisk -l to use /dev/partiton format. /dev/sda1 can replace UUID string from above.

$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00012f86

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 301510655 150754304 83 Linux
/dev/sda2 301510656 303464447 976896 83 Linux
/dev/sda3 303466494 312580095 4556801 5 Extended
/dev/sda5 303466496 312580095 4556800 82 Linux swap / Solaris

Add the kernel image:
Make sure the kernel image is stand alone or uses initrd file. If it uses initrd file, you must pass it to kexec. Watching kernel panic message is quite something.
Kernel panic – not syncing: VFS: Unable to mount root fs unknown block(0,0)

$ sudo kexec -l /vmlinuz --append="root=UUID=07cf8c3a-d5a5-4b41-833f-16a9afebf70c
ro quiet" --initrd=/initrd.img

Or

$ sudo kexec -l /vmlinuz --append="root=/dev/sda1 ro quiet" --initrd=/initrd.img

Reboot system:


$ sudo kexec -e

The system will start right from the kernel sequence.

About janpenguin

Email: janpenguin [at] riseup [dot] net Every content on the blog is made by Free and Open Source Software in GNU/Linux.
This entry was posted in GNU/Linux and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s