X13/fedora_chroot.md

74 lines
1.4 KiB
Markdown

## Find root partition
```
sudo lsblk -f
```
## Enter
- `--bind` makes the contents accessible in both locations
- `-t` defines the filesystem type.
```
sudo mount /dev/nvme0n1p5 /mnt
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount -t proc /proc /mnt/proc
sudo mount -t sysfs /sys /mnt/sys
sudo mount -t tmpfs tmpfs /mnt/run
sudo mount --bind /etc/resolv.conf /mnt/etc/resolv.conf
sudo chroot /mnt
```
### Info
#### efi vars
In order to successfully use efibootmgr the EFI variables filesystem must be accessible.
```
mount | grep efivars # check rw EFI vars
mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars # make rw if ro
```
#### Boot entries
The path of the EFI image to boot must use \ (backslash) instead of / (forward slash)
```
# List
efibootmgr
# Add
efibootmgr --create --disk /dev/nvme0n1 --part 1 -L Fedora -l \EFI\fedora\grubx64.efi
# Order
efibootmgr -o 0000,0001,001C,001D,001E,001F,0020,0021,0022,0023,0024,0025
# Show
efibootmgr | grep Fedora
# Boot0002* Fedora HD(1,GPT,a90b01c2-def6-3d28,0x800,0x82000)/\EFI\fedora\grubx64.efi
# Delete
efibootmgr -b -0 -B
```
### Grub
```
lsblk -f -p
dnf reinstall shim-* grub2-*
grub2-mkconfig -o /boot/grub2/
```
## Exit
```
exit
umount /mnt/dev
umount /mnt/proc
umount /mnt/sys
umount /mnt/run
umount /mnt
```