99
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 24 Aug 2023
99 points (96.3% liked)
Linux
48335 readers
453 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
I recently had GRUB issues which I managed to fix so I'm a little fresh in my mind. It's 10pm here so I'll be sleeping soon though.
Check the Arch wiki for how to fix GRUB, it has a lot of helpful tips: https://wiki.archlinux.org/title/GRUB
I put Mint onto a USB and then booted into the Live to be able to have full OS to fix GRUB, rather than using the rescue interface. So definitely do that if you have a spare PC you can use to put an image on a USB.
Here's some other links I saved:
https://bbs.archlinux.org/viewtopic.php?id=283343
https://wiki.archlinux.org/title/GRUB
https://wiki.archlinux.org/title/EFI_system_partition#Mount_the_partition
https://superuser.com/questions/165116/mount-dev-proc-sys-in-a-chroot-environment
And I'll post my commands I used to rebuild GRUB
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82/boot/grub$ find . -name normal.mod
./x86_64-efi/normal.mod
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82/boot/grub$ ls
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82/boot/grub$ vi grub.cfg
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82/boot/grub$ cd ../..
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo mount -o bind /dev dev
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo mount -o bind /proc proc
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ chroot .
chroot: cannot change root directory to '.': Operation not permitted
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo chroot .
[root@mint /]# find . -name grubx64.efi
[root@mint /]# sudo fdisk -l
sudo: unable to allocate pty: No such device
[root@mint /]# exit
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ mount -o bind /dev/pts dev/pts
mount: /media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82/dev/pts: must be superuser to use mount.
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo mount -o bind /dev/pts dev/pts
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo chroot .
[root@mint /]# sudo fdisk -l
[root@mint /]# lsblk
lsblk: failed to access sysfs directory: /sys/dev/block: No such file or directory
[root@mint /]# exit
exit
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo mount -t sysfs /sys /mnt/sys
mount: /mnt/sys: mount point does not exist.
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo mount -t sysfs /sys
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo mount -t sysfs /sys sys
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82$ sudo chroot .
[root@mint /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 2.6G 1 loop
sda 8:0 1 14.6T 0 disk
└─sda1 8:1 1 14.6T 0 part
sdb 8:16 0 476.9G 0 disk
└─sdb1 8:17 0 476.9G 0 part
sdc 8:32 1 232.9G 0 disk
├─sdc1 8:33 1 223.1G 0 part
└─sdc2 8:34 1 9.8G 0 part [SWAP]
sdd 8:48 1 14.6T 0 disk
└─sdd1 8:49 1 14.6T 0 part
sde 8:64 1 29.1G 0 disk
├─sde1 8:65 1 2.8G 0 part
├─sde2 8:66 1 4.1M 0 part
└─sde3 8:67 1 26.4G 0 part
nvme0n1 259:0 0 931.5G 0 disk
├─nvme0n1p1 259:1 0 500M 0 part
├─nvme0n1p2 259:2 0 2G 0 part
└─nvme0n1p3 259:3 0 929G 0 part /
[root@mint /]# fdisk -l
[root@mint /]# mount /dev/nvme0n1p1 /efi
[root@mint /]# grub-install --target=x86_64-efi --efi-directory=efi --bootloader-id=GRUB
Installing for x86_64-efi platform.
Installation finished. No error reported.
So for a step by step,
I booted into Mint and opened a terminal and cd to my OS drive.
I checked my grub folder:
mint@mint:/media/mint/a96b3354-70dd-45ed-8c6c-95171e9f1e82/boot/grub$ ls
fonts grub.cfg grub.cfg.broke grubenv locale themes x86_64-efi
made an edit with vi (irrelevant here)
went back to / on my OS drive
mounted the various partitions needed, that's all the mount -o bind commands, dev, proc, dev/pts, sys
then chroot to my OS drive so that I'm working inside my Arch install not the Mint install
then I mount the efi and grub install
[root@mint /]# mount /dev/nvme0n1p1 /efi
[root@mint /]# grub-install --target=x86_64-efi --efi-directory=efi --bootloader-id=GRUB