wiki-system/full-zfs-ecrypt-uefi-boot-t...

120 lines
3.8 KiB
Markdown
Raw Permalink Normal View History

2020-09-23 16:06:13 +02:00
## Fixing Debian/Ubuntu UEFI boot manager with Debian/Ubuntu Live
source : [Code Bites](https://emmanuel-galindo.github.io/en/2017/04/05/fixing-debian-boot-uefi-grub/)
Steps summary:
- Boot Debian Live
- Verify Debian Live was loaded with UEFI
- Review devices location and current configuration
- Mount broken system (via chroot)
- Reinstall grub-efi
- Verify configuration
- Logout from chroot and reboot
### Verify Debian Live was loaded with UEFI :
~~~
2020-09-23 16:24:27 +02:00
FromLive $ dmesg | grep -i efi
2020-09-23 16:06:13 +02:00
~~~
~~~
2020-09-23 16:24:27 +02:00
FromLive $ ls -l /sys/firmware/efi | grep vars
2020-09-23 16:06:13 +02:00
~~~
### Mount broken system (via chroot)
Mounting another system via chroot is the usual procedure to recover broken systems. Once the chroot comand is issues, Debian Live will treat the broken systems “/” (root) as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the Debian Live.
#### My system is full ZFS
You have to add *-f* to force import because zfs think he should be on an other system.
*-R* is to use an altroot path.
~~~
2020-09-23 16:24:27 +02:00
FromLive $ sudo su
FromLive # zpool import -f -R /mnt rpool
2020-09-23 16:06:13 +02:00
~~~
~~~
2020-09-23 16:24:27 +02:00
FromLive # zfs mount rpool/ROOT/ubuntu_myid
2020-09-23 16:06:13 +02:00
~~~
I'm in the case where ny zpool is encrypt !
see : [zfs trouble encrypt zpool](zfs-trouble-live-boot-solution)
### Prepare chroot env
Mount the critical virtual filesystems with the following single command:
~~~
2020-09-23 16:24:27 +02:00
FromLive # for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
2020-09-23 16:06:13 +02:00
~~~
Mount all zfs file system on rpool.
~~~
2020-09-23 16:24:27 +02:00
FromLive # zfs mount -a
2020-09-23 16:06:13 +02:00
~~~
Chroot to your normal (and broken) system device
~~~
2020-09-23 16:24:27 +02:00
FromLive # chroot /mnt
2020-09-23 16:06:13 +02:00
~~~
2020-09-24 17:06:36 +02:00
import also bpool but do not mount it *-N* :
2020-09-23 16:06:13 +02:00
~~~
2020-09-24 17:06:36 +02:00
InsideChroot # zpool import -N bpool
2020-09-23 16:06:13 +02:00
~~~
Mount your EFI partition:
~~~
2020-09-23 16:24:27 +02:00
InsideChroot # mount -a
2020-09-23 16:06:13 +02:00
~~~
You should see :
2020-09-23 16:11:09 +02:00
* all your rpool zfs vol
2020-09-23 16:06:13 +02:00
* /boot from your bpool.
* Your efi partition.
2020-09-23 16:11:09 +02:00
~~~
2020-09-23 16:24:27 +02:00
InsideChroot # df -h
2020-09-23 16:11:09 +02:00
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
udev 16G 0 16G 0% /dev
tmpfs 3,2G 1,8M 3,2G 1% /run
rpool/ROOT/ubuntu_19k4ww 272G 3,7G 269G 2% /
bpool/BOOT/ubuntu_19k4ww 1,2G 270M 929M 23% /boot
2020-09-23 16:19:42 +02:00
rpool/USERDATA/yourlogin_43xnpb 280G 12G 269G 5% /home/yourlogin
2020-09-23 16:11:09 +02:00
rpool/USERDATA/root_43xnpb 269G 640K 269G 1% /root
rpool/ROOT/ubuntu_19k4ww/srv 269G 128K 269G 1% /srv
rpool/ROOT/ubuntu_19k4ww/var/lib 269G 34M 269G 1% /var/lib
rpool/ROOT/ubuntu_19k4ww/var/log 269G 47M 269G 1% /var/log
rpool/ROOT/ubuntu_19k4ww/var/spool 269G 128K 269G 1% /var/spool
/dev/nvme0n1p1 511M 16M 496M 4% /boot/efi
rpool/ROOT/ubuntu_19k4ww/var/games 269G 128K 269G 1% /var/games
rpool/ROOT/ubuntu_19k4ww/var/snap 269G 128K 269G 1% /var/snap
rpool/ROOT/ubuntu_19k4ww/var/mail 269G 128K 269G 1% /var/mail
rpool/ROOT/ubuntu_19k4ww/usr/local 269G 256K 269G 1% /usr/local
rpool/ROOT/ubuntu_19k4ww/var/www 269G 128K 269G 1% /var/www
rpool/ROOT/ubuntu_19k4ww/var/lib/AccountsService 269G 128K 269G 1% /var/lib/AccountsService
rpool/ROOT/ubuntu_19k4ww/var/lib/NetworkManager 269G 256K 269G 1% /var/lib/NetworkManager
rpool/ROOT/ubuntu_19k4ww/var/lib/apt 269G 77M 269G 1% /var/lib/apt
rpool/ROOT/ubuntu_19k4ww/var/lib/dpkg 269G 41M 269G 1% /var/lib/dpkg
/dev/nvme0n1p1 511M 16M 496M 4% /boot/efi
~~~
2020-09-23 16:06:13 +02:00
### Reinstall grub-efi
~~~
2020-09-23 16:24:27 +02:00
InsideChroot # apt-get install --reinstall grub-efi
2020-09-23 16:06:13 +02:00
~~~
~~~
2020-09-23 16:24:27 +02:00
InsideChroot # update-grub
2020-09-23 16:06:13 +02:00
~~~