Fixing pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2 umount error

Tags: , , , ,

So last night a RHEL3 machine at went down for patching and sadly it didn’t come back. Here’s what was sitting on the console when I got to the console. Nice… a kernel panic :/

pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2 umount
/initrd/proc failed: 2 Freeing ununsed kernel memory: 228k freed Kernel
panic: No init found. Try passing init= option to kernel.

So after spending a significant amount of time troubleshooting the file systems, rebuilding the initrd, trying different init=arguments and trying different kernels I took a good hard look at the error message. Its talking about /sysroot/initrd but I don’t see a directory named /initrd when I look at the root filesystem. So I tried this:

mkdir /initrd
reboot

And to my surprise the system starts happily booting along. All that over a little directory, sheesh. Turns out that this directory was removed by someone or something that thought it wasn’t needed, doh.

One Response to “Fixing pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2 umount error”

  1. Kristian Reese Says:

    I came across this problem as well with iscsi LUNs using qlogic HBA’s. The solution in a nutshell for me was to rebuild initrd with the new SCSI ID’s of the LUNs and update the multipath configuration.

    boot from cdrom and linux rescue

    mkdir /target
    mount /dev/sda1 /target

    SDA_ID=”`/sbin/scsi_id -g -u -s /block/sda`”
    SDB_ID=”`/sbin/scsi_id -g -u -s /block/sdb`”
    SDC_ID=”`/sbin/scsi_id -g -u -s /block/sdc`”

    cp /target/root/multipath-files/multipath.conf /target/etc/multipath.conf
    sed -i -e “s:@SDAID@:${SDA_ID}:g” \
    -e “s:@SDBID@:${SDB_ID}:g” \
    -e “s:@SDCID@:${SDC_ID}:g” /taret/etc/multipath.conf

    losetup /dev/loop1 /target/root/multipath-files/initrd.img

    mkdir /target/root/multipath-files/tmp
    mount /dev/loop1 /target/root/multipath-files/tmp
    cp /target/etc/multipath.conf /target/root/multipath-files/tmp/etc/multipath.conf
    umount /target/root/multipath-files/tmp
    losetup -d /dev/loop1
    rmdir /target/root/multipath-files/tmp

    cp /target/root/multipath-files/initrd.img /target/root/multipath-files/initrd.img.tmp
    gzip /target/root/multipath-files/initrd.img.tmp
    mv /target/root/multipath-files/initrd.img.tmp.gz /target/boot/initrd-KERNEL_VERSION-mpath.img


    Kristian Reese

Join the Conversation