You are not logged in.

#1 2016-06-18 23:16:05

chuckd833
Member
Registered: 2016-06-17
Posts: 8

[SOLVED] Boot to GRUB RESCUE shell after altering partitions

I'm running dual boot w/ Windows 10 and Arch in EFI/GPT mode and use GRUB to boot to Windows or Arch.

Before I explain, here is info about my disk:

# parted /dev/sda print
Model: ATA SAMSUNG MZHPU128 (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name                                     Flags
 1      1049kB  106MB  105MB   fat32           EFI system partition               boot, esp
 2      106MB   123MB  16.8MB                     Microsoft reserved partition    msftres
 3      123MB   105GB  105GB   ntfs              Basic data partition                msftdata
 8      105GB   116GB  10.5GB  ext4
 4      116GB   118GB  2147MB  linux-swap(v1)  Linux swap
 5      118GB   126GB  8338MB  ext4            Linux filesystem
 6      126GB   127GB  861MB   ntfs                                                              hidden, diag
 7      127GB   128GB  818MB   ntfs            Basic data partition                    hidden, diag

I was running out of space on my root partition

/dev/sda5

so I booted to Windows 10 and shrunk

/dev/sda3

using Disk Utility.

I booted to Arch again and created a new partition using gui gparted in KDE/Plasma 5:

/dev/sda8

Now

/dev/sda8

and

/dev/sda5

weren't next to each other so I moved SWAP

/dev/sda4

to before

/dev/sda8

In gparted I then tried moving

/dev/sda8

to after

/dev/sda5

That move wasn't permitted (I forget why). So I changed everything back to its original state in gparted and rebooted. It rebooted to

grub rescue>

I managed to load GRUB as per normal from there running:

grub rescue> set prefix=(hd0,5)/boot/grub
grub rescue> set root=(hd0,5)
grub rescue> insmod normal
grub rescue> normal

And then could boot to Arch as per normal.

So either

grubx64.efi

wasn't pointing to

/boot/grub/grub.cfg

or

grub.cfg

was wrong.

So from TTY, I reinstalled grub and ran:

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

Still booted back to

grub rescue>

Again from TTY, I mounted /dev/sda1 to /mnt/boot/efi then ran:

# grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --bootloader-id=grub
# grub-mkconfig -o /boot/grub/grub.cfg
# cd /mnt/boot/efi/EFI/arch/
{/mnt/boot/efi/EFI/arch/}# ls -l
total 114K
-rwxr-xr-x 1 root root 114K Jun 18 13:50 grubx64.efi
{/mnt/boot/efi/EFI/arch/}# cp grubx64.efi /mnt/boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
# reboot

This time it booted to:

grub>

not GRUB RESCUE.

Then (after mounting /dev/sda1 to /mnt/boot/efi) from tty I regenerated the initramfs image. I ran the following:

# mkinitcpio -p linux
# grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --bootloader-id=grub
# grub-mkconfig -o /boot/grub/grub.cfg
# cd /mnt/boot/efi/EFI/Microsoft/Boot/
{/mnt/boot/efi/EFI/Microsoft/Boot/}# mv bootmgfw.efi bootmgfw.efi.old
{/mnt/boot/efi/EFI/Microsoft/Boot/}# cd /mnt/boot/efi/EFI/arch/
{/mnt/boot/efi/EFI/arch/}# cp grubx64.efi /mnt/boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
# reboot

And I still booted to:

grub>

Now the second time I created my grubx64.efi was at 15:30 but it doesn't look like I actually created it, even though I ran the same commands, because:

{esp/EFI/arch/}# ls -l
total 114K
-rwxr-xr-x 1 root root 114K Jun 18 13:50 grubx64.efi

Other info:

# cat grub.cfg
#
# 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
set root='hd0,gpt5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
else
  search --no-floppy --fs-uuid --set=root d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
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_AU
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=-1
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=-1
fi
play 480 440 1
### 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-d7e7e36c-5481-4491-81a0-a62cb4cbb3e7' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt 
	insmod ext2
	set root='hd0,gpt5'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
	else
	  search --no-floppy --fs-uuid --set=root d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=d7e7e36c-5481-4491-81a0-a62cb4cbb3e7 rw  quiet
	echo	'Loading initial ramdisk ...'
	initrd	 /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-d7e7e36c-5481-4491-81a0-a62cb4cbb3e7' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-d7e7e36c-5481-4491-81a0-a62cb4cbb3e7' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt 
		insmod ext2
		set root='hd0,gpt5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
		else
		  search --no-floppy --fs-uuid --set=root d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=d7e7e36c-5481-4491-81a0-a62cb4cbb3e7 rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	 /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-d7e7e36c-5481-4491-81a0-a62cb4cbb3e7' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt 
		insmod ext2
		set root='hd0,gpt5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
		else
		  search --no-floppy --fs-uuid --set=root d7e7e36c-5481-4491-81a0-a62cb4cbb3e7
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=d7e7e36c-5481-4491-81a0-a62cb4cbb3e7 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/40_custom.pacsave ###
# 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.

menuentry "Windows 10" {
	echo "Loading Windows 10 (unfortunately)..."
	insmod part_gpt
	insmod fat
	insmod search_fs_uuid
	insmod chain
	search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 BE6E-4439
	chainloader /EFI/Microsoft/Bootold/bootmgfw.efi
}

menuentry "System shutdown" {
	echo "System shutting down..."
	halt
}

menuentry "System restart" {
	echo "System rebooting..."
	reboot
}
### END /etc/grub.d/40_custom.pacsave ###

### 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 ###

### BEGIN /etc/grub.d/60_memtest86+ ###
### END /etc/grub.d/60_memtest86+ ###

My UUID for /dev/sda5 in grub.cfg is the same as below:

# blkid
/dev/sda1: LABEL="SYSTEM" UUID="BE6E-4439" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="1eb5b1bc-323e-4062-bbeb-c7dbf026072b"
/dev/sda3: LABEL="Windows" UUID="5A186ED9186EB423" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="fd93909c-5aa1-4461-9c4d-fe4150f12db2"
/dev/sda4: LABEL="Linux Swap" UUID="0c74b7aa-ae8e-4ede-9b76-7f5a1c485803" TYPE="swap" PARTLABEL="Linux swap" PARTUUID="28ffd5c8-b170-4162-9667-12fdce053df0"
/dev/sda5: LABEL="Arch Linux" UUID="d7e7e36c-5481-4491-81a0-a62cb4cbb3e7" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="eed37174-6c42-4f9d-befd-77ac0b229cbf"
/dev/sda6: UUID="1AE6B39CE6B3769B" TYPE="ntfs" PARTUUID="d91b968b-dceb-456b-851a-c2d95fb7bf36"
/dev/sda7: LABEL="Windows RE tools" UUID="146E6F0C6E6EE648" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="a5360c4f-a70f-4052-94c3-16fbdd45e643"
/dev/sda8: UUID="d53b1628-6abf-4e9a-b1f9-93f36de1656c" TYPE="ext4" PARTUUID="fa028d51-b835-4c66-aff9-84aab4cd1662"
/dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="e8bc3061-0c55-4ea3-8168-5eac66b2ea86"

[EDIT] In fstab my / is /dev/sda7.

# cat /etc/fstab
# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# UUID=d7e7e36c-5481-4491-81a0-a62cb4cbb3e7 LABEL=Arch\134x20Linux
/dev/sda7           	/         	ext4      	rw,relatime,data=ordered	0 1

# UUID=BE6E-4439 LABEL=SYSTEM
/dev/sda1           	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 2

# /dev/sda7 LABEL=Arch\134x20Linux
UUID=d7e7e36c-5481-4491-81a0-a62cb4cbb3e7	/         	ext4      	rw,relatime,data=ordered	0 1

I read somewhere it wasn't a good idea to run fstab after installation but given it's not booting maybe I should do it.

[EDIT]

So I just manually changed fstab from: sda7 to sda5

and that didn't fix the problem. I still booted to: grub>

Any ideas how to proceed?

Last edited by chuckd833 (2016-06-19 17:19:41)

Offline

#2 2016-06-19 00:19:58

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: [SOLVED] Boot to GRUB RESCUE shell after altering partitions

Your fstab mount twice the root. So perhaps it is better if you use only one and use its label, but remove strange characters in it.


do it good first, it will be faster than do it twice the saint wink

Offline

#3 2016-06-19 04:29:24

madpierre
Member
Registered: 2016-05-27
Posts: 188

Re: [SOLVED] Boot to GRUB RESCUE shell after altering partitions

My recommendation is to re-install Arch- clean; partition and format.

Last edited by madpierre (2016-06-19 04:30:19)

Offline

#4 2016-06-19 17:18:36

chuckd833
Member
Registered: 2016-06-17
Posts: 8

Re: [SOLVED] Boot to GRUB RESCUE shell after altering partitions

@The Saint:
I deleted the other / and it still booted to grub>. Not sure which characters in fstab are strange so didn't remove any. I tried to regenerate fstab but the command wasn't recognised.

@madpierre:
I think I'll go down the re-install path since I need more storage anyway. Then I can join the two 9GB partitions. Still I'd like to know how to fix this since I am still able to boot to grub from "grub>" and then run Arch. Anyway it'll be faster to reinstall than find/wait for a solution.


So to be clear for others: Solution for me is to reinstall.

Thanks for replies.

Last edited by chuckd833 (2016-06-19 17:24:48)

Offline

#5 2016-06-20 05:44:15

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: [SOLVED] Boot to GRUB RESCUE shell after altering partitions

chuckd833 wrote:

Not sure which characters in fstab are strange so didn't remove any. I tried to regenerate fstab but the command wasn't recognised.

The characters are \134\x20.
If you used genfstab you should delete the previous fstab or rename it (better).
Post

efibootmgr -v

do it good first, it will be faster than do it twice the saint wink

Offline

Board footer

Powered by FluxBB