LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Can't boot up original host OS after installing and booting up LFS (https://www.linuxquestions.org/questions/linux-from-scratch-13/cant-boot-up-original-host-os-after-installing-and-booting-up-lfs-4175674640/)

ProfSucrose 05-05-2020 04:20 PM

Can't boot up original host OS after installing and booting up LFS
 
Hello!

I just finished the LFS book and was able to boot up the system successfully, however I can no longer boot up my host OS which I need to fix my broken GRUB config file.

Is there any way I can still boot up my original host system and interact with the LFS filesystem that way? I apologize if I'm being stupid, I'm not super experienced with Linux!

(I'm running this on VirtualBox and the host system was Ubuntu if that changes anything)

Thanks to anyone who responds!

colorpurple21859 05-05-2020 06:53 PM

This is assuming your booting from lfs grub and the entry for ubuntu isn't working. Boot into lfs, mount ubuntu root partition at /mnt open ubuntu /mnt/boot/grub/grub.cfg, scroll down to where the menuentry for ubuntu starts, copy the ubuntu menuentry lines to the end of your lfs /boot/grub/grub.cfg reboot and you should have a working entry for ubuntu. If that doesn't work you will need to give more information on your setup and error messages.

ProfSucrose 05-05-2020 07:19 PM

(I apologize for my stupidity) I can't seem to access and modify my grub configuration while on the LFS system?

colorpurple21859 05-05-2020 08:15 PM

nevermind scratch that. at the grub menu press c to get grub prompt
assuming you only have one drive and you know what partition ubuntu is on counting partitions from one, for example if ubuntu / is on the second partition
Code:

grub> configfile (hd0,2)/boot/grub/grub.cfg
should give you the ubuntu grub menu. Change the 2 accordingly for the partition that ubuntu is on. boot into ubuntu run
Code:

sudo grub-install /dev/sda
change accordingly if your drive naming is different.

vsayanam 05-07-2020 12:56 PM

if you can give more information, you can expect some solutions from the members. In my case it has happened many times. I do not keep any data in my PC and I simply reinstall host OS. Sometime, the drive letter like /dev/sda2 or /dev/sda3 may not be correct. I press letter e on the keyboard on the line showing OSes to check the correct drive letter. I do not follow the LFS book when grub is mentioned as I have many partitions for various Linux distros. Please reply with more information.

colorpurple21859 05-07-2020 02:29 PM

I may be wrong, but I'm assuming that the op followed the lfs guide to the letter, not realizing that they wouldn't have a boot menu for the host system. Also assuming there is only one standard drive and a standard partition layout. That is sure a lot of assuming and you know what the saying about that is lol.

GarethInWales 05-11-2020 08:50 AM

A maybe longwinded resolution but one that works for me :)
I had the same problem when first I got as far as the grub config back in 7.x
My setup is on virtual box as well and uses separate HD for LFS and the build system.
I installed the LFS bootloader to the LFS HD not the hostOS HD, so pressing f12 during boot allows me to choose what HD the system boots from; the hostOS system or LFS.

If you have LFS on a separate partition on the same drive as your hostOS make a new HD image, live-boot an ubuntu iso in your virtual machine and use gparted to clone the LFS partition to the new drive, then install https://help.ubuntu.com/community/Boot-Repair and recover the original system boot.
You would have to set up the linked folders across the HD's shouldn't be too bad, or use this script as a template https://pastebin.com/hbzvxueM . (its a copy and paste out of the 9.0 LFS handbook with a few changes)


I hope you find this useful:)


All times are GMT -5. The time now is 12:11 PM.