2

I am trying to make grub boot into a chroot directory /slack containing a Slackware Linux installation. This directory was created by issuing the following command:

  installpkg --root /slack a/*.t?z

where a/ directory contains the basic a/ instalation packages from slackware. I sucessfully chrooted into /slack and created the initrd image, by executing mkinitcpio command.

Finally, I created the following entry in /boot/grub/menu.lst:

title  Slackware Linux
root   (hd0,2)
kernel /slack/boot/vmlinuz root=/dev/sda3 rw init=/slack/boot/chrootinit 
initrd /slack/boot/initrd.gz
boot

where /slack/boot/chrootinit is a script that chroots into /slack:

exec /usr/sbin/chroot /slack /sbin/init

The system boots sucessfully but even with the "rw" option, the root partition is mounted as readonly. Several warning messages about this problem are displayed and the system finally hangs. Any solutions?

(REF: http://forum.soft32.com/linux2/Booting-chrooted-directory-ftopict51395.html)

1
  • i was wrong, this is a question re. the rw boot option :/ Jul 18, 2012 at 0:16

1 Answer 1

3

I am not sure why the filesystem is being mounted read-only since you have specified rw. Perhaps the kernel is actually mounting the initrd image read-write instead, and then that initrd image mounts your root fs as read-only.

In any case, typically the kernel is expected to mount the root fs read-only, and then at some point, init will remount it read-write.

Perhaps you could modify your chrootinit script to perform that step first:

/bin/mount -o remount,rw /
exec /usr/sbin/chroot /slack /sbin/init
2
  • Yes, that worked, I just had to change rw back to ro in grub`s entries because it complains root fs must be mounted first as read only before remounting. Just for curiosity, in a normal linux intallation, who is responsible for doing this remounting as read and write? Jul 17, 2012 at 16:38
  • It varies, but it usually happens in an rc script, early in the init process. On my Debian box, I see it gets remounted in /etc/rcS.d/S07checkroot.sh, after setting up udev and some other kernel services.
    – mrb
    Jul 17, 2012 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .