Hi,

Would it be possible to enhance the book's coverage of using a separate /boot partition? I found this particularly challenging when it came time to boot the system. The book suggests in section 2.2.1.3. Convenience Partitions that having a small 100M partition is highly recommended, but then does not explain how to create a corresponding grub.cfg file in section 8.

I built LFS on a second harddrive attached to an Arch linux instance. So, there were two drives, /dev/sda with several partitions for Arch to live on and use, and /dev/sdb where I created three partitions for LFS to live on and use /dev/sdb1 for /boot, /dev/sdb2 for swap, and /dev/sdb3 for /. When I finished the LFS book, my intention was to disconnect the first hard drive and leave the second. So, I knew that it would become /dev/sda. But in section 8.4.3. Setting Up the Configuration, it was still /dev/sdb. So, I ran the following command (appropriately):

Linux From Scratch grub-install /dev/sdb

which installed the bootloader on my LFS drive. Then I took a look at grub.cfg as printed in the book:

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,2)
menuentry "GNU/Linux, Linux 4.2-lfs-7.8-rc1" {
linux /boot/vmlinuz-4.2-lfs-7.8-rc1 root=/dev/sda2 ro
}

and tweaked, and crashed on boot, and tweaked and crashed on boot, etc... until finally, I arrived at a correct grub.cfg:

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,1)
menuentry "GNU/Linux, Linux 4.2-lfs-7.8-rc1" {
linux /vmlinuz-4.2-lfs-7.8-rc1 root=/dev/sda3 ro
}

What is interesting about the file differences is that the first root is really just a reference to the partition where the kernel file resides (/boot) , whereas the second is where / is. I know this seems straightforward to some?, but I think it would help to provide a separate grub.cfg example with a separate /boot partition as well as a little more explanatory text for the file itself.

The following is the note from the book and an alternative that might help:

Linux From Scratch From GRUB's perspective, the kernel files are relative to the partition used. If you used a separate /boot partition, remove /boot from the above linux line. You will also need to change the set root line to point to the boot partition.

Alternative:

If you used a separate /boot partition, which was highly recommended, you will need to change your grub.cfg accordingly. set root=(hd0,2) refers to /dev/sda2, this needs to be updated to point to your /boot partition. e.g. if your boot partition is on /dev/sdb1, set root=(hd1,1) is an appropriate value. The line, linux /boot/vmlinuz-4.2-lfs-7.8-rc1 root=/dev/sda2 ro, requires two modifications to support a separate boot partition. The first is to remove /boot from the reference to the kernel file since that file will no longer be found as a subdirectory under the root directory. When you /boot is mounted initially, it will be the root directory, so /boot/vmlinuz-4.2-lfs-7.8-rc1 will become /vmlinuz-4.2-lfs-7.8-rc1. The second is to change root=/dev/sda2 to point to the partition where / is located. e.g. if your / partition is on /dev/sdb3, set root=/dev/sdb3 is an appropriate value. Keep in mind that these partition references point to the partitions that will be selected at the time the configuration is read, so if you move a drive into a different slot, the references will need to be updated to refer to the correct partition before attempting to boot.

Example - LFS is stored on /dev/sdb (a second hard drive), with three partitions, one for /boot - /dev/sdb1, one for / - /dev/sdb2, and one for swap - /dev/sdb3:

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd1,1) # refer to /boot's partition /dev/sdb1
menuentry "GNU/Linux, Linux 4.2-lfs-7.8-rc1" {
linux /vmlinuz-4.2-lfs-7.8-rc1 root=/dev/sdb2 ro # /boot becomes / and the root partition is /dev/sdb2
}

Just a thought, I expect it's a bit wordy, but it conveys the idea.

Thanks,

Will






-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to