Size: 4575
Comment: mention break= options, add blkid (as vol_id is unsupported with squeeze), fix typo
|
Size: 5121
Comment: minor English correction
|
Deletions are marked like this. | Additions are marked like this. |
Line 8: | Line 8: |
Boot with {{{rootdelay=9}}} to shorten the time of waiting for the root device to come up. Also it adds time to scsi device to settle before calling mdadm or lvm thus excluding potential races. | To fix wrong fs recognition work around boot with {{{ rootfstype=<rootfstype> }}} In releases older than Debian 8 (jessie), it may be necessary to add a delay for disks to be discovered before setting up RAID and LVM. Boot with e.g. {{{ rootdelay=9 }}} |
Line 12: | Line 20: |
Read {{{man initramfs-tools}}} to learn about the {{{break=something}}} kernel parameter (where valid arguments for {{{something}}} are: {{{top}}}, {{{modules}}}, {{{premount}}}, {{{mount}}}, {{{mountroot}}}, {{{bottom}}}, {{{init}}}), which starts a debug shell. You can try, for example, {{{break=premount}}}. You can edit {{{/boot/grub/menu.lst}}} to add this to the end of the kernel line, or you can do it interactively from the grub boot menu: "e" to edit, and "b" to boot once you've edited the kernel line. | Read {{{man initramfs-tools}}} to learn about the {{{break=something}}} kernel parameter (where valid arguments for {{{something}}} are: {{{top}}}, {{{modules}}}, {{{premount}}}, {{{mount}}}, {{{mountroot}}}, {{{bottom}}}, {{{init}}}), which starts a debug shell. You can try, for example, {{{break=premount}}}. You can edit {{{/boot/grub/grub.cfg}}} to add this to the end of the kernel line, or you can do it interactively from the grub boot menu: "e" to edit, and "b" to boot once you've edited the kernel line. |
Line 39: | Line 47: |
# for releases >= squeeze: blkid -o value -s TYPE /dev/sda1 |
|
Line 41: | Line 51: |
# for releases >= squeeze: blkid -o value -s TYPE /dev/sda1 |
|
Line 47: | Line 55: |
If the output of aboves command differ, your partition was not cleanly formated. For example mkfs.ext2 does not clear all sectors when formating a partition. | If the output of above commands differ, your partition was not cleanly formated. For example mkfs.ext2 does not clear all sectors when formating a partition. |
Line 57: | Line 65: |
Add "debug" bootparam and find the logfile in /dev/.initramfs/initramfs.debug. (You'll need initramfs-tools 0.92m at least for that feature. | Add "debug" bootparam and find the logfile in /run/initramfs/initramfs.debug. (You'll need initramfs-tools 0.92m at least for that feature. |
Line 88: | Line 96: |
Notice that both methods don't work with multi-segmented initramfs images, which may consist of an uncompressed cpio archive with a compressed one, concatenated together. The {{{getinitramfs}}} script proposed in [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790095|the bug report #790095 to initramfs-tools]] may help you to unpack such initrd images. |
|
Line 90: | Line 102: |
If you specify {{{debug}}} as a kernel option during boot, initramfs-tools (>= 0.92m) writes shell script traces to {{{/dev/.initramfs/initramfs.debug}}}, which will be available after the system has booted. | If you specify {{{debug}}} as a kernel option during boot, initramfs-tools (>= 0.92m) writes shell script traces to {{{/run/initramfs/initramfs.debug}}}, or (if {{{/run}}} is unavailable in the initramfs) {{{/run/initramfs/initramfs.debug}}}, which will be available after the system has booted. |
Line 106: | Line 118: |
CategoryKernel | CategoryKernel | CategoryBootProcess |
Translation(s): none
initramfs-tools is used in Debian to build the initramfs that contains the early userspace and the needed kernel modules to be able to mount any possible root.
Boot
To fix wrong fs recognition work around boot with
rootfstype=<rootfstype>
In releases older than Debian 8 (jessie), it may be necessary to add a delay for disks to be discovered before setting up RAID and LVM. Boot with e.g.
rootdelay=9
Rescue shell (also known as initramfs shell)
Read man initramfs-tools to learn about the break=something kernel parameter (where valid arguments for something are: top, modules, premount, mount, mountroot, bottom, init), which starts a debug shell. You can try, for example, break=premount. You can edit /boot/grub/grub.cfg to add this to the end of the kernel line, or you can do it interactively from the grub boot menu: "e" to edit, and "b" to boot once you've edited the kernel line.
Ok, now you landed in the initramfs debug shell. This is a surprisingly complete environment provided by "busybox". You can use vi, for example, but not everything is fully the same as bash. For example, sleep only accepts integer arguments. You may find more complete commands in /bin (for example, /bin/sleep does accept decimal arguments, but you will need to use /bin/sleep in your scripts).
The following steps should help to narrow down the problem.
- Check root device existence
ls -l /dev/[hs]da*
If above does not exist checkout for eventual driver conflict or other informationdmesg
- Check root boot argument
- It needs to be the same than above root device
cat /proc/cmdline
- Check correct fs recognition
# for releases >= squeeze: blkid -o value -s TYPE /dev/sda1 # for releases <= lenny: /lib/udev/vol_id -t /dev/sda1 # compare with: fstype /dev/sda1
- If the output of above commands differ, your partition was not cleanly formated. For example mkfs.ext2 does not clear all sectors when formating a partition.
- Check if the ata/ide/scsi driver is loaded
cat /proc/modules
- saving output from an initramfs script into a logfile you can review later
- Add "debug" bootparam and find the logfile in /run/initramfs/initramfs.debug. (You'll need initramfs-tools 0.92m at least for that feature. Also see further down in this document on how to save other data, or save data across reboots.
You can exit the shell with exit or ^D and the boot should resume.
initramfs content
It can happen that due to a bug in the initramfs creation a newer initramfs lacks important libraries or utilities. Easiest way is to check contents with lsinitramfs
lsinitramfs /boot/initrd.img-2.6.32-5-686 | less
Old way is to compare the file list of working contra non-working initramfs.
cd $TMPDIR mkdir initramfs{,-old} cd initramfs gunzip -c -9 /boot/initrd.img-2.6.32-5-686 \ | cpio -i -d -H newc --no-absolute-filenames find > ../initramfs.content cd ../initramfs-old gunzip -c -9 /boot/initrd.img-2.6.32-5-686.bak \ | cpio -i -d -H newc --no-absolute-filenames find > ../initramfs-old.content cd .. diff -u initramfs-old.content initramfs.content
If the intiramfs creation of both those images went well there should be no diff. If you are comparing initramfs for different kernels you should see a difference in the modules aka other dir and newer drivers in /lib/modules/$(uname -r)
Notice that both methods don't work with multi-segmented initramfs images, which may consist of an uncompressed cpio archive with a compressed one, concatenated together. The getinitramfs script proposed in the bug report #790095 to initramfs-tools may help you to unpack such initrd images.
Saving debug information
If you specify debug as a kernel option during boot, initramfs-tools (>= 0.92m) writes shell script traces to /run/initramfs/initramfs.debug, or (if /run is unavailable in the initramfs) /run/initramfs/initramfs.debug, which will be available after the system has booted.
You can write other data to files in that directory to be able to access them later, when the system has booted. Since /dev is a tmpfs however, they won't persist across a reboot.
If you need to get debug data off the system and it can mount the root filesystem, you can do something like
mount -o remount,rw /root dmesg > /root/root/initramfs.dmesg mount -o remount,ro /root ^D
If that does not work, use a USB stick: plug it in, observe the kernel output, mkdir /mnt, mount the device node there, and write to the flash drive. Remember to umount before pulling out the stick.