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.
Hello everyone, I'm new here, and decided to post because I can't seem to find a way to set up my already existing GRUB so that it let's me boot my LFS system. I'm currently on chapter 8.4 of the book, and I'm kinda scared to do something wrong at this point haha.
The laptop I'm working on currently has 3 OS's, Windows 7, Debian and the LFS system I'm working on.
For my Debian instalation I used
sda 5 for /
sda 6 for swap
sda 7 for /home
sda 8 for /boot
And for my LFS system I have :
sda 9 for /
sda 10 for /home
sda 11 for /boot
and the same swap partition as my Debian installation.
Now the problem is that the book says that if I do what it says, it'll overwrite my current bootloader, and I don't want that. After I'm done here I want to be able to boot onto Windows 7,Debian and LFS through GRUB, but I can't seem to find a way to do that.
I'd be grateful if anybody could guide me through this, or point me to a website or thread where this has been solved (For some reason the forum's search function doesn't seem to be working for me or something, so I apologize if this has been asked, but google isn't helping much).
For a reference, I'm running on Debian Wheezy with Linux 3.2.0-4-686 as my host system.
Okay, LFS by default only comes with Grub to detect the local OS. If you want to add other operating systems you'll need to first uninstall Grub, install os-prober, and then re-install Grub.
Next unpack the os-prober sources and change directory, and then use this script to install os-prober:
Code:
zcat ../os-prober.reiserfs.diff.gz | patch -p1 --verbose || exit 1
make
cp -a linux-boot-prober os-prober /usr/bin
cp -a linux-boot-probes os-probes /usr/lib
( cd /usr/lib/linux-boot-probes
for probe in common/* ; do
ln -sf $probe .
done
cd mounted
for probe in common/* x86/* ; do
ln -sf $probe .
done
)
( cd /usr/lib/os-probes
for probe in common/* ; do
ln -sf $probe .
done
cd init
for probe in common/* ; do
ln -sf $probe .
done
cd ../mounted
for probe in common/* x86/* ; do
ln -sf $probe .
done
)
cp -a newns /usr/lib/os-prober
cp -a common.sh /usr/share/os-prober
mkdir -p /usr/share/doc/os-prober_1.63
cp -a README TODO /usr/share/doc/os-prober_1.63
Now rebuild and re-install Grub, and it should auto-detect any installed OS on your PC.
Okay, LFS by default only comes with Grub to detect the local OS. If you want to add other operating systems you'll need to first uninstall Grub, install os-prober, and then re-install Grub.
Next unpack the os-prober sources and change directory, and then use this script to install os-prober:
Code:
zcat ../os-prober.reiserfs.diff.gz | patch -p1 --verbose || exit 1
make
cp -a linux-boot-prober os-prober /usr/bin
cp -a linux-boot-probes os-probes /usr/lib
( cd /usr/lib/linux-boot-probes
for probe in common/* ; do
ln -sf $probe .
done
cd mounted
for probe in common/* x86/* ; do
ln -sf $probe .
done
)
( cd /usr/lib/os-probes
for probe in common/* ; do
ln -sf $probe .
done
cd init
for probe in common/* ; do
ln -sf $probe .
done
cd ../mounted
for probe in common/* x86/* ; do
ln -sf $probe .
done
)
cp -a newns /usr/lib/os-prober
cp -a common.sh /usr/share/os-prober
mkdir -p /usr/share/doc/os-prober_1.63
cp -a README TODO /usr/share/doc/os-prober_1.63
Now rebuild and re-install Grub, and it should auto-detect any installed OS on your PC.
I appreciate the answer and will try this if there isn't another option, but I was wondering, is there no way to make it work by editing my grub.cfg file in my host system? I'd like to try to do this instead of having a program do it for me.
If there is no other option then of course I will try the above.
Editing the grub.cfg file is not recommended since it uses shell scripting methods rather than plaintext as Grub-Legacy. It can be done, but due to the complexity it involves, I'll avoid doing so as it could damage your system, and be counter-productive.
Because of this, os-prober is recommended to use as a supplement to Grub for external OS detection.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153
Rep:
I ALWAYS manually edit the grub config file once grub is installed and working, the automatic detection system of grub is not always accurate and often misses bits, I do a LOT of switching systems I have 12 bootable systems at the moment and when I install a new system or experimental kernel I just manually edit the /media/Boot/grub/grub.cfg file ( the path to your grub.cfg file will be different, I use a separate boot partition with a rescue system on it for when I get it wrong! ).
To add a new system just add something like this:
Code:
menuentry "LFSEudev 3.116 rc1 on (/dev/sda12)" {
savedefault
gfxpayload=1280x1024x32,1280x1024
set root=(hd0,12)
linux /boot/bzImage-3.16.0 root=/dev/sda12 ro
}
To the other entries, this was an experimental kernel I was trying on sda12 my main system but I have been mucking about with the kernel so I have a number of such entries, the auto prober would not necessarily detect all the alternate kernels nor would it allow me to set the title of the entry as above.
Before you manually alter your grub.cfg file make a backup and make sure you can boot to an emergency CD to restore it in case you muck it up.
I skipped this chapter (no grub on mbr) and i boot from usb.. you can use this way if you want: http://www.supergrubdisk.org/put-sup...-from-windows/
At boot choose "Detect any grub2 configuration file (grub.cfg)" option.
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd1,2)
menuentry "GNU/Linux, Linux 3.13.3-lfs-7.5" {
linux /boot/vmlinuz-3.13.3-lfs-7.5 root=/dev/sda2 ro
}
If you have multiple hard drives, you can always install LFS to a stand-alone drive and use the BIOS/UEFI boot selection option and use the standard Grub configuration in the book.
Example: If you have Windows 8.1 installed to /dev/sda, and you have LFS installed to /dev/sdb, just use the boot selection. Most PC's have this using ETC or F1 to Select Boot Device.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.