Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Asked
Modified 1 month ago
Viewed 12k times
4

Somehow my grub got corrupted while updating my Pop!_OS System. I rewrote the partition, grub-install, boot-repair, I tried anything.

Well, I can boot by typing the following lines.

set prefix=(hd1,gpt3)/boot/grub
set root=(hd1,gpt3)
insmod normal
normal

But I can't get grub to do it automatically. It's not "that bad", but it's really annoying to type that down everytime I boot.

Is there any config File I can use to "automate" that stuff again? Thank you in advise!

**

EDIT: I tried update-grub, grub-install. Various methods, I just don't get it.

**

Here's some basic information:

Kernel: 5.19.0-76051900-generic

Partitions:

/dev/md0p3       /
/dev/md0p4       /home
/dev/md0p1       /boot/efi

Here is a tree of my /boot directory:

.
├── config-5.18.10-76051810-generic
├── config-5.19.0-76051900-generic
├── efi
│   ├── EFI
│   │   ├── BOOT
│   │   │   ├── bkpbootx64.efi
│   │   │   └── bootx64.efi
│   │   ├── pop
│   │   │   ├── grub.cfg
│   │   │   └── grubx64.efi
│   │   ├── pop_os
│   │   │   ├── grub.cfg
│   │   │   └── grubx64.efi
│   │   └── Pop_OS-f8340379-32a0-45b0-82fa-f157f426bd50
│   │       ├── cmdline
│   │       ├── initrd.img
│   │       ├── initrd.img-previous
│   │       ├── vmlinuz.efi
│   │       └── vmlinuz-previous.efi
│   └── loader
│       ├── entries
│       │   ├── Pop_OS-current.conf
│       │   └── Pop_OS-oldkern.conf
│       └── loader.conf
├── grub
│   ├── fonts
│   │   └── unicode.pf2
│   ├── grub.cfg
│   ├── grubenv
│   ├── locale
        # Tons of locale-files
│   │   └── zh_TW.mo
│   ├── unicode.pf2
│   └── x86_64-efi
│       #Tons of .mod files
│       ├── xzio.mod
│       ├── zfscrypt.mod
│       ├── zfsinfo.mod
│       ├── zfs.mod
│       └── zstd.mod
├── grub.bak
│   ├── grub.cfg
│   └── grubenv
├── initrd.img -> initrd.img-5.19.0-76051900-generic
├── initrd.img-5.17.5-76051705-generic-nouveau
├── initrd.img-5.18.10-76051810-generic
├── initrd.img-5.19.0-76051900-generic
├── initrd.img.old -> initrd.img-5.18.10-76051810-generic
├── System.map-5.18.10-76051810-generic
├── System.map-5.19.0-76051900-generic
├── vmlinuz -> vmlinuz-5.19.0-76051900-generic
├── vmlinuz-5.18.10-76051810-generic
├── vmlinuz-5.19.0-76051900-generic
└── vmlinuz.old -> vmlinuz-5.18.10-76051810-generic
3
  • I think that entry you are manually typing should be in grub.cfg. I see you have three copies of that (two is normal). Looks like maybe you have a duplicate in EFI, one of those is probably stale, and I'd bet the stale one is the default. Try changing your boot order; check file dates and maybe delete the duplicate (after changing boot order).
    user10489
    –  user10489
    2022-08-19 11:30:36 +00:00
    Commented Aug 19, 2022 at 11:30
  • Have you updated grub? run sudo update-grub
    PonJar
    –  PonJar
    2022-08-19 12:01:15 +00:00
    Commented Aug 19, 2022 at 12:01
  • The sudo update-grub updates menu. You may need a reinstall & then menu update. Try sudo grub-install If UEFI & correct ESP - efi system partition is in fstab (check mount if changing) & you have been able to manually boot no extra mount or parameters required. I show a reinstall on my sytem: ubuntuforums.org/showthread.php?t=2478104 If not booted into system, you many need chroot or Boot-Repair.
    oldfred
    –  oldfred
    2022-08-19 14:01:58 +00:00
    Commented Aug 19, 2022 at 14:01

4 Answers 4

0

Firstly, I'd suggest you create a new grub cfg file by typing as a root user:

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

then, again as root user

update-grub2

Note: if update-grub2 is not present use update-grub

2
  • Yea, tried that and didn't work, same results
    Ven
    –  Ven
    2022-08-21 11:11:58 +00:00
    Commented Aug 21, 2022 at 11:11
  • @Ven then I think you need to set a default booting kernel in your OS
    2hexed
    –  2hexed
    2022-08-22 02:07:31 +00:00
    Commented Aug 22, 2022 at 2:07
0

To define a new boot option for the new kernel you have installed, go to the (/boot/loader/entries) directory with root access and create a new file with the extension .conf and name this file the same as the name of the newly installed kernel, for example: ef8547eded9a4d-5.19.0-76051900-generic.conf

And then write your desired settings inside this file.

Below is an example of the settings for you:

title PopOs(Workstation)

version 5.19.0-76051900-generic

linux /vmlinuz-5.19.0-76051900-generic

initrd /initrd.img-5.19.0-76051900-generic

options root=UUID=52d3d64b-5de1-4483-9fd9-e171b7acdbe9 ro 

resume=UUID=0cb3dec1-cce5-46d6-89b6>

grub_users $grub_users

grub_arg --unrestricted
1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    Community
    –  Community Bot
    2022-09-01 17:48:04 +00:00
    Commented Sep 1, 2022 at 17:48
0

This happened to me when I was trying to create a Xubuntu distribution on a USB disk. I tried the sudo update-grub option given above and it didn't work. The fix for me was to boot into linux using the commands you suggest except that my root partition was (hd2,gpt2) and then I had to reinstall the grub bootloader. I used lsblk to find the name of my boot device which was /dev/nvme1n1 and then I used the install command:

sudo grub-install --boot-directory=/boot /dev/nvme1n1

I expect all this could also be done from a live Ubuntu USB disk too if there are difficulties getting linux to boot from the grub command line (finding the right disk can be tricky if you have a lot of disks). You can mount the hard disk and change the command to point to the mounted location of the boot directory.

0

i was managed my boots with efi-shell and its default hook.(it is (efiroot)/startup.nsh )

Abandon all bootloader garbages years before and happy with it.

Peoples continuously wrestling with grub. Preblems occurs frequently.

So i suggest all to learn how to manage it via (efi-shell + startup.nsh) and get rid of grub etc completely as permanent fix.

%9x of pc/laptops alredy efi enabled.(%100 new sold) Others can still use grub.

it is easy tiny bit learn not big deal. docs online every where.

edit: efi-shell available for most distros repo as binary package. most distros configure kernel as efi-stub means kernel is essentially an efi-executable file.

Booting/Dropping directly to efi-shell cannot means you lost change of recovery that bootloaders provide. You are able to create your own taste of recovery via it.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.