You are not logged in.

#1 2018-11-10 04:34:47

MrCush
Member
Registered: 2018-10-13
Posts: 19

Update ruined grub file. Reinstalling grub doesn't help

For some reason my Bluetooth completely stopped functioning.  So I jumped over to Windows and saw it wasn't functioning there.  Couldn't end up figuring it out so I ran my Lenovo software (I have an Lenovo Yoga 920) and it had a bios update along with some driver updates.  Decided to give it a chance and run those updates after reading online that these shouldn't be an issue with Linux.  I updated and my Bluetooth was working again.  Except it screwed up my grub boot loader.  So I read up on how to get it working again and everyone said to basically just reinstall.  So I:

1. Boot into livecd
2. Setup wifi
3. Mount main file system
4. Mount efi partition
5. chroot into main file system
6. check to make sure grub, efibootmgr, and os-prober are installed (they were)
7. I run:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

it installs fine

8.  I run:

grub-mkconfig -o /boot/grub/grub.cfg

and it seems to run fine with a simple warning that google says is expected and can be ignored.

SO, I reboot and jump into bios and see that I now have an arch boot loader again.  I also have an old ubuntu boot loader sitting in there as well.
I boot from arch boot loader and it jumps straight into a grub screen that looks like the live cd.  On the screen it says:

GNU GRUB version 2.02
Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions
grub>

With a blinking cursor.  I have no idea what this is, I'm extremely frustrated at this point as I have performed a lot of research and done a lot of steps prior to this trying to get this to work (gave you the short and sweet version) but I would really appreciate some help at this point and a breather.
I've spent months setting this up and got it looking perfect for me and really don't want to screw something up.  I plan on moving it over to an external SSD when I can afford one to not have to deal with this dual boot nonsense after this and have a nice plug and play.  I hate Windows and wish I didn't need some of its software for work and school sad

Anyways, I appreciate any help given!  Thanks!

Partition scheme:

/dev/nvme0n1p1 - EFI System
/dev/nvme0n1p2 - Microsoft Reserved
/dev/nvme0n1p3 - Microsoft basic data
/dev/nvme0n1p4 - Microsoft basic data
/dev/nvme0n1p5 - Windows recovery environment
/dev/nvme0n1p6 - Linux swap
/dev/nvme0n1p8 - Linux filesystem

EDIT: Also, I had to disable secure boot again since the new bios had re-enabled it. (Along with VM being disabled that I re-enabled as well)

EDIT2: I read that typing exit on this grub screen brings you to boot screen. I did this and had the options to boot into:
Grub (Samsung)
EFI USB Device
ubuntu (Samsung)
arch (Samsung)
Windows Boot Manager (Samsung)

Clicking on grub, Ubuntu, or arch brings me right back to the grub terminal screen. The efi usb device is the live cd, and you know what windows is

EDIT3: So I did a bit more googling.  I typed 'ls' on the grub command line and got this:

(hd0) (hd0,msdos2) (hd1) (hd1,gpt8) (hd1,gpt6) (hd1,gpt5) (hd1,gpt4) (hd1,gpt3) (hd1,gpt2) (hd1,gpt1)

I then typed:

ls (hd1,gpt8)/boot

and got:

amd-ucode.img vmlinuz-linux initramfs-linux.img initramfs-linux-fallback.img grub/ efi/

This is my arch partition.  Doing

ls (hd1,gpt8)/boot/grub

leaves me with

grub.cfg x86_64-efi/ grub.cfg.example lacale/ themes/ fonts/ grubenv

I then typed:

linux (hd1,gpt8)/boot/vmlinuz-linux root=/dev/nvme0n1p8
initrd (hd1,gpt8)/boot/initramfs-linux.img
boot

That got me booted back into my system.  Now how do I fix this?  I'd rather not have to do this everytime.  I'm glad I got this far though xD

Last edited by MrCush (2018-11-10 05:40:38)

Offline

#2 2018-11-10 09:00:04

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Update ruined grub file. Reinstalling grub doesn't help

3. Mount main file system
4. Mount efi partition

To rule out the obvious: did you mount the efi partition in relation to the live systems root or the installed systems root? (Exact commands in exact order?)

Offline

#3 2018-11-10 18:33:51

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

seth wrote:

3. Mount main file system
4. Mount efi partition

To rule out the obvious: did you mount the efi partition in relation to the live systems root or the installed systems root? (Exact commands in exact order?)

I hope it's something this simple and I'm getting confused somewhere here.
My exact commands were:

iwconfig
ip link set wlp107s0 up
rfkill unblock all
ip link set wlp107s0 up

I entered command  to list wifi networks here but forget what its called, I'm not at my pc right now so doing this off of memory. Next I;
Now that I think about it, I'm not sure if I did

ip link set wlp107s0 down
wifi-menu

selected my wifi and entered password

netctl enable wlp107so...

the ... is for the remainder of the default profile name I set up

ping google.com
^C
mount /dev/nvme0n1p8 /mnt
mount /dev/nvme0n1p1 /boot

thing about it I could have done that or:

mount /dev/nvme0n1p1 /mnt/boot

for the efi partition or not.  I can give that another shot but I really don't know.  Could have been either since I had done it like 4 times prior to getting in through the backdoor via grub terminal. I then:

arch-chroot /mnt
sudo pacman -S grub efibootmgr os-prober
n

Did that to check to make sure they were still installed which they were.  Then I:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Everything installed fine, lastly:

exit
unmount -a
y
reboot

And that's the end of the story

Last edited by MrCush (2018-11-10 19:05:47)

Offline

#4 2018-11-10 18:39:31

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Update ruined grub file. Reinstalling grub doesn't help

You mounted nvme0n1p1 into the live system, so when you chrooted into /mnt, it had no relevance…

mount /dev/nvme0n1p1 /mnt/boot

Offline

#5 2018-11-10 19:05:17

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

seth wrote:

You mounted nvme0n1p1 into the live system, so when you chrooted into /mnt, it had no relevance…

mount /dev/nvme0n1p1 /mnt/boot

Ya, that's what I was just trying to remember.  I don't know which I did.  I will give it another go.  I edited my post with full commands as a heads up.  I appreciate your response.  You're the only one who cares sad haha.  Thanks again.  I'll report back with an update.

Offline

#6 2018-11-10 19:21:19

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

Reporting back.  Unfortunately it made no difference =/.  Made sure to mount it

mount /dev/nvme0n1p1 /mnt/boot

and grub installed just fine.
Everytime I do grub-mkconfig it shows this:

WARNING: Failed to connect to lvmetad. 
Falling back to device scanning.
Done

But from what I've seen online, that's completely fine.  However when I remember reinstalling grub after deleting Ubuntu, I swear it went through a list saying it recognized Linux and Windows.  Am I wrong?
Anyways, I still have the grub command line with the only way to actually get into my linux system via method described above in OP.  I have a feeling that grub is bloated and needs to be cleaned up in order to get working.  Maybe I'm wrong.

Last edited by MrCush (2018-11-10 19:23:54)

Offline

#7 2018-11-13 02:38:51

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

Damn well I had planned on purchasing an external SSD on Black Friday/cyber Monday specifically with the purpose of moving my arch install over to it so that I could just plug and play by making boot order for external SSD the primary if it’s plugged in. Could this potentially fix this issue since it doesn’t seem as if anyone knows how to fix my current situation? I had planned on just making an EFI partition, swap partition, and ext4 Linux file system partition for the remainder on the SSD and simply copying over my arch partition from my main hard drive to the external SSD. Uninstalling grub and reinstalling it. Does this sound legit?

Offline

#8 2018-11-13 05:47:22

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Re: Update ruined grub file. Reinstalling grub doesn't help

Are you mounting /boot outside of, or within chroot. I still think Seth is right and you are mounting in the live system. You need to mount it in chroot.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#9 2018-11-13 09:20:08

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Update ruined grub file. Reinstalling grub doesn't help

Check the timestamps in the files on the boot partition to be absolutely sure.
Did you simply "chroot" or "arch-chroot"? See https://wiki.archlinux.org/index.php/Chroot

Ultimately post the grub.cfg

Offline

#10 2018-11-13 21:08:08

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

Roken wrote:

Are you mounting /boot outside of, or within chroot. I still think Seth is right and you are mounting in the live system. You need to mount it in chroot.

wait....maybe I misunderstood.  Is it because I am mounting it prior to arch-chroot'ing into my system?  I was under the impression it was because I had miss-typed it by mounting it to /boot instead of /mnt/boot
The last time I tried it, I made sure I mounted it to /mnt/boot and not just /boot.  However if I need to mount it after I chroot into the arch system then that could be the issue and I can try again and mount it after I chroot.

seth wrote:

Check the timestamps in the files on the boot partition to be absolutely sure.
Did you simply "chroot" or "arch-chroot"? See https://wiki.archlinux.org/index.php/Chroot

Ultimately post the grub.cfg

I am definitely using:

arch-chroot /mnt

I'll copy pasta my grub.cfg in just a sec

EDIT: Wow my grub.cfg has a big red 'x' on it in my file manager and when I open it it is completely empty.  I don't understand why that is since I've gone into this file in the past and seen what it looks like when it is filled.  I guess the big red x is because its file type is unknown.  And I'm sorry but what do you mean by checking the timestamps in the boot partition?  Do you mean to look into my EFI partition and see the timestamps?  Or simply to look into my /boot directory and check like the last time the grub.cfg was edited?  And is there anyway I can use a default grub.cfg and change the values inside to get it working correctly since mkconfig doesn't seem to be working right.

Last edited by MrCush (2018-11-13 21:50:49)

Offline

#11 2018-11-14 00:54:37

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

Alright, I have an update that I felt deserved its own post.  I tried mounting to a different location.  These are my exact commands:

mount /dev/nvme0n1p8 /mnt
mount /dev/nvmeon1p1 /mnt/boot/efi
arch-chroot /mnt
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/efi/grub/grub.cfg

This....worked.  To a degree.  It doesn't recognize my Windows install, only my arch install.  Now I can go into bios and boot from the Windows boot loader if need be and I don't go on Windows but rarely when I need to use a specific software but it would be nice if it had recognized Windows either way.  If not, then I'd much rather it boot straight into Arch instead of the bootloader screen where I have to select Arch from it.  So I decided to check on my grub.cfg file and it's still empty.  There's nothing in it.  I have an efi directory in /boot but the directory is empty as well.  Why is this?  Did I put in the commands correctly?  I was kinda going in blind when I added /efi in the grub-install command as well as the grub-mkconfig command so I'm not sure if I should have done that or not but it seemed like the right thing since I had mounted to /mnt/boot/efi.  How is grub recognizing Linux if the config file is empty?  Thanks.

Last edited by MrCush (2018-11-14 00:56:23)

Offline

#12 2018-11-14 06:51:34

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Update ruined grub file. Reinstalling grub doesn't help

I doubt it's empty... how do you know you have read permission for the file? grub-mkconfig is an insane, crazy program which generates garbage, and also makes the grub.cfg only readable as root for "security" reasons.

IMHO just write your own grub.cfg, it's incredibly simple. I'm in the process of rewriting the wiki documentation on this; see https://wiki.archlinux.org/index.php/Us … figuration

Note that grub.cfg can be incredibly simple. Here's a sample one with a lot of flexibility for different situations, including loading Windows: https://ptpb.pw/mk7y


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#13 2018-11-14 16:55:39

MrCush
Member
Registered: 2018-10-13
Posts: 19

Re: Update ruined grub file. Reinstalling grub doesn't help

eschwartz wrote:

I doubt it's empty... how do you know you have read permission for the file? grub-mkconfig is an insane, crazy program which generates garbage, and also makes the grub.cfg only readable as root for "security" reasons.

IMHO just write your own grub.cfg, it's incredibly simple. I'm in the process of rewriting the wiki documentation on this; see https://wiki.archlinux.org/index.php/Us … figuration

Note that grub.cfg can be incredibly simple. Here's a sample one with a lot of flexibility for different situations, including loading Windows: https://ptpb.pw/mk7y

Thank you for that.  I assumed that I could at least read it without root permissions like every other file I have opened.  I'm going to post my current grub.cfg and take a look at the link you gave me after I get out of class. Note that I do now have grub recognizing my Arch installation, just not my Windows.

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  140cbf24-08ee-4c5a-87f3-d26f179ef7e4
else
  search --no-floppy --fs-uuid --set=root 140cbf24-08ee-4c5a-87f3-d26f179ef7e4
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-140cbf24-08ee-4c5a-87f3-d26f179ef7e4' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root  140cbf24-08ee-4c5a-87f3-d26f179ef7e4
	else
	  search --no-floppy --fs-uuid --set=root 140cbf24-08ee-4c5a-87f3-d26f179ef7e4
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=140cbf24-08ee-4c5a-87f3-d26f179ef7e4 rw  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/amd-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-140cbf24-08ee-4c5a-87f3-d26f179ef7e4' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-140cbf24-08ee-4c5a-87f3-d26f179ef7e4' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  140cbf24-08ee-4c5a-87f3-d26f179ef7e4
		else
		  search --no-floppy --fs-uuid --set=root 140cbf24-08ee-4c5a-87f3-d26f179ef7e4
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=140cbf24-08ee-4c5a-87f3-d26f179ef7e4 rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/amd-ucode.img /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-140cbf24-08ee-4c5a-87f3-d26f179ef7e4' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  140cbf24-08ee-4c5a-87f3-d26f179ef7e4
		else
		  search --no-floppy --fs-uuid --set=root 140cbf24-08ee-4c5a-87f3-d26f179ef7e4
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=140cbf24-08ee-4c5a-87f3-d26f179ef7e4 rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

Offline

#14 2018-11-14 17:40:29

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Update ruined grub file. Reinstalling grub doesn't help

Well, the section which is generated by os-prober is empty, so either you didn't have os-prober installed, or os-prober detected nothing. I've got no clue which one might be the case, but I do know that writing a custom grub.cfg is both easy and more reliable. wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB