LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 02-03-2022, 04:00 PM   #1
LQ496873
Member
 
Registered: Jan 2006
Distribution: openSUSE Leap 15.3
Posts: 120

Rep: Reputation: Disabled
grub-install removes filesystem (!)


I give in.. I need help! I've been trying for so long to get my LFS to boot. I wanted to use EFI but I couldn't get my NVME drive to be seen in 'BIOS' as bootable.

So I went back to the old ways.

I have grub installed on my /boot partition but when I fire up the computer grub starts and then stops with error: unknown filesystem.

After messing about for far too long trying to identify my nvme drive in grub-speak, and recreating /boot, and reinstalling grub I noticed when I issue...
Code:
grub-install --target i386-pc /dev/nvme0n1
... my fat filesystem is removed.

Code:
Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  538MB   537MB                         bios_grub
 2      538MB   54.2GB  53.7GB  btrfs
 3      54.2GB  56.4GB  2147MB  linux-swap(v1)        swap
How can I change the 'Unknown filesystem' back to fat?

I've tried using things like fdisk but I just end up with an empty partition.

Any help would be very much appreciated!

Last edited by LQ496873; 02-03-2022 at 04:04 PM.
 
Old 02-03-2022, 09:52 PM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,396

Rep: Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594
The bios-grub flag is used to tell grub where to install grub bootloader code. When grub-install was ran information at the beginning of the partition was overwritten with grub code, removing filesystem information. The files should still be there even through you cant' acess them.

Boot a systemrescue cd, remove the bios-grub flag, and use testdisk to recover the partition, then run a file system check.

grub-install may work with the --force option, if not you will need to create another empty 2mb partition flagged as bios-grub. Another option is to use lilo as it doesn't need this extra partition.

Last edited by colorpurple21859; 02-03-2022 at 10:00 PM.
 
Old 02-04-2022, 09:40 AM   #3
LQ496873
Member
 
Registered: Jan 2006
Distribution: openSUSE Leap 15.3
Posts: 120

Original Poster
Rep: Reputation: Disabled
Thank you.

I've tried recovering the partition but testdisk couldn't find anything. I wiped the entire drive and started over and tried with ext2 instead of fat. grub-install didn't remove the partition but now nothing gets written to /boot. I've just ended up with working but cluttered /boot on the host system. I don't understand why you have to bind /boot on the host to /mnt/lfs/boot... surely something has to be written to /boot partition on my lfs drive.

Overall, I give up!
 
Old 02-04-2022, 05:04 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,396

Rep: Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594
Quote:
I don't understand why you have to bind /boot on the host to /mnt/lfs/boot...
It really depends on how your system is setup whether or not you need to do this. I have boot partitions on my system but ignore this recommendation when installing lfs. I also use the host system bootloader to boot the lfs partition instead of running grub-install within lfs.
 
Old 02-04-2022, 05:48 PM   #5
LQ496873
Member
 
Registered: Jan 2006
Distribution: openSUSE Leap 15.3
Posts: 120

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colorpurple21859 View Post
I also use the host system bootloader to boot the lfs partition instead of running grub-install within lfs.
I think I'm just going to have to try this. I've spent yet another day on it and nothing. I completely wiped the nvme and went through all the motions from "8.59. GRUB-2.06" but following the UEFI steps. Everything installs as it should, my boot directory has the correct files and folders, the boot partition is definitely correct, grub installs without errors, efibootmgr (both inside and out of chroot) shows LFS but when I reboot into 'BIOS' it's not seen as bootable. I had more luck installing as legacy (in fact it still shows up as bootable if I enable legacy support) but no joy booting the OS. The emergency boot disk creates fine too but when I boot off it the only thing it sees is itself.

It's so frustrating! On the plus-side... I've spent more time learning about bootloaders, grub and filesystems in the past few days than I had in the last 25 years! I almost understand it now!

Thank you for your help.

Last edited by LQ496873; 02-04-2022 at 05:50 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
Apt removes gnome after new Debian 5.0.3 install? lawpoop Linux - Desktop 1 08-04-2010 05:18 PM
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. dissolved soul Ubuntu 2 01-13-2007 12:55 PM
iptables port forwarding removes net access? Avatar Linux - Networking 2 05-21-2004 12:56 PM
nano removes ifconfig ? shania Linux - Newbie 4 10-30-2003 03:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 09:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration