Fixing grub after partition editing

I finally got around to increasing the size of my /home partition, since I’ve been running out of available space for a while. Though I assumed this would not affect booting, since the partition is not one used directly, I was sorely mistaken. Upon restarting my computer, I found myself in the grub recovery prompt, instead of regular boot menu. The following are the commands I used to boot back into Arch, and fix the grub configuration.

Firstly, from grub recovery:

ls

This lists all available partitions. From here, we can try to identify which one hold the root directory:

ls (hd0,gpt1)/

Note that the partition names will differ from system to system. Once this is identified, the defaults can be identified with:

set

In my case, the output was as follows:

prefix=(hd0,gpt9)/boot/grub

root=hd0,gpt9

The set command can then be used to change these, by entering the desired line directly after the command. Once this is done, entering normal mode, and booting can be done as follows:

insmod normal

normal

Once booting properly, grub had to be reinstalled to the boot partition, and the configuration updated accordingly. This setup will differ from machine to machine, but mine is as follows. Please note, the ‘update-grub’ command is not used, since this is strictly a Debian (and derivative) command, and is not available on Arch.

sudo mount -t vfat /dev/sda1 /boot/efi/

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --recheck

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

In my case, the target installation type is 64 bit efi, which has its configurations located in /dev/sda1. All of the available configurations (includes my Windows, and old Ubuntu) can be listed in /boot/efi/EFI/ once the partition is mounted. I decided to set the ID of this particular one to arch for simplicity, though any name can be used. Note that, since this isĀ  a re-installation, I used the same name as my previous install to overwrite it. Finally, once it is freshly installed, a new configuration file is generated (note os-prober is used here), and upon reboot everything worked as per normal.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s