[SOLVED] My LFS system won't boot up after accidentally setting grub to hd1 instead of hd0
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I don't think you need to chroot. Just mount the LFS root partition somewhere convenient and edit grub.cfg by hand. You aren't reinstalling grub, after all, just changing the location information you give grub once it's loaded.
btw if you boot from a live disc, the /boot partition you see will be the one on the disc, so it may well be empty. To see the boot partition on your hard drive, you need to mount your root (say on /mnt) and then look at /mnt/boot.
ok i will chroot, but can you explain why my /boot directory in LFS hierarchy is empty? i am sure i installed installed grub in /boot (/boot is a separate directory)
You install grub as a piece of software but you install grub as bootloader as well. Those are two different things.
If you boot and see a grub command, the bootloader part is done but you messed up the config.
You can change the config without chroot but you would need to mount the LFS-partition and edit the grub config file.
I don't think you need to chroot. Just mount the LFS root partition somewhere convenient and edit grub.cfg by hand. You aren't reinstalling grub, after all, just changing the location information you give grub once it's loaded.
btw if you boot from a live disc, the /boot partition you see will be the one on the disc, so it may well be empty. To see the boot partition on your hard drive, you need to mount your root (say on /mnt) and then look at /mnt/boot.
I mounted /boot on /mnt/boot, but its still empty, i can't find my config file there
was i supposed to move/copy the linux kernel dir in /boot? i did't do it
If it isn't in the boot partition /dev/sdb9 check your / partition and/or other partitions, maybe the boot partition didn't get mounted when grub was installed and/or the wrong partition was mounted at /boot.
If you choose to do this, you will need to mount the separate partition, move all files in the current /boot directory
(e.g. the linux kernel you just built in the previous section) to the new partition.
i also followed this instruction: 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.
so i deleted the /boot from code like this:
Code:
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,2)
menuentry "GNU/Linux, Linux 5.10.17-lfs-10.1" {
linux /vmlinuz-5.10.17-lfs-10.1 root=/dev/sda2 ro
}
EOF
at the grub menu press c for a grub prompt grub>
at the grub prompt
Code:
grub>set
post the following line
Code:
prefix=
In post 9 you say your mounting /dev/sda9 to /boot but according to your grub.cfg /dev/sda2 is the partition where your kernel is located not /dev/sda9
Which partition is suppose to be the / partition?
Last edited by colorpurple21859; 05-17-2021 at 05:41 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.