- Debug your brand-new kernel. For example, you got kernel panic unable to mount rootfs and you really don't know where the problem is, missing filesystems support in kernel or maybe missing support for your SCSI/SATA/whatever or your 2nd sata controller driver started before 1st and your 'sda' is 'sdb'. Really, initramfs sh is very useful. You can check dmesg, you can check /dev for devices and try to mount rootfs manually to get the error.
- Luks encrypted rootfs.
- LVM-based rootfs,
- System rescue tool.
- Support for LVM.
- Support for dmcrypt Luks.
- Support for booting from rootfs over encrypted lvm (encrypted lv or encrypted pv).
- Support for TuxOnIce
- Support for UUID and LABEL based root and enc_root.
Be aware! Current code is under heavy development, make sure to read ChangeLog before starting with better-initramfs.
Clone git repository from github:
git clone https://github.com/slashbeast/better-initramfs.git
This doc is based on Funtoo/Gentoo GNU/Linux so package names etc. can be different than in your distro.
Prepare static linked binary files (emerge with USE=static):
sys-apps/busybox (must-have) sys-fs/cryptsetup (optional, if you don't use dmcrypt) sys-fs/lvm2 (optional, if you don't use LVM)
If you don't have Funtoo/Gentoo-based system, you may need to install binary files manualy, go to initramfs_root/bin dir and:
cp -v /bin/busybox busybox cp -v /sbin/cryptsetup cryptsetup cp -v /sbin/lvm.static lvm ln -s busybox sh
Then build image with:
Available kernel boot parameters:
- drop to busybox's sh just before mount rootfs to /newroot.
- try resuming with TuxOnIce. Remember to set resume= variable by kernel boot params.
- Use only with tuxonice switch, set resume device/file. This have nothing to do with initramfs..
- Scan all disks for volume groups and activate them.
cryptsetup luksOpenon enc_root variable.
- for example
/dev/sda2if sda2 is your encrypted rootfs. This variable is ignored if luks isn't enabled.
- for example
/dev/mapper/enc_rootif you have LUKS-encrypted rootfs,
/dev/mapper/vg-rootfsor similar if lvm or just
/dev/sdXXif you haven't rootfs over lvm or encrypted.
- rootfstype=<filesystem type>
- Set type of filesystem on your rootfs if you do not want to use 'auto',
- Set how many seconds initramfs should wait [for devices]. Useful for rootfs on USB device.
Few example on grub(1) config, all switches and variables are configured by kernel boot command line.
title Funtoo bzImage-2.6.32-gentoo-r5 kernel /bzImage-2.6.32-gentoo-r5 root=/dev/mapper/enc_root enc_root=/dev/sda2 luks initrd /initramfs.cpio.gz
LVM based rootfs:
title Funtoo bzImage-2.6.32-gentoo-r5 kernel /bzImage-2.6.32-gentoo-r5 root=/dev/mapper/main-rootfs lvm initrd /initramfs.cpio.gz
LVM based rootfs, rescueshell:
title Funtoo bzImage-2.6.32-gentoo-r5 kernel /bzImage-2.6.32-gentoo-r5 root=/dev/mapper/main-rootfs lvm rescueshell initrd /initramfs.cpio.gz
Rootfs on LVM over dmcrypt (encrypted pv) with tuxonice and rootfstype env:
title Funtoo bzImage-2.6.33 kernel /bzImage-2.6.33 luks enc_root=/dev/sda2 lvm root=/dev/mapper/vg-rootfs rootfstype=ext4 resume=swap:/dev/mapper/vg-swap tuxonice initrd /initramfs.cpio.gz
This code is released under Simplified BSD License, see LICENSE for more information.
- better-initramfs is written and maintained by:
- Piotr Karbowski <firstname.lastname@example.org>
- Thanks to:
- Yamashita Takao for testing and code suggestions.