Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)

share|improve this question
    
i was wrong, this is a question re. the rw boot option :/ –  Ulrich Dangel Jul 18 '12 at 0:16

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer
    
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? –  Slack question Jul 17 '12 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 '12 at 16:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.