From time to time – like every quarter – my grub want’s to make me crazy and does not load. How to solve it? Read along!
Using Dell xps15 with ubuntu 17 and win10 uefi dualboot via grub2. Some partitions are encrypted as follows:
$ blkid # /boot/efi /dev/nvme0n1p1: LABEL="ESP" UUID="" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="" # /boot /dev/nvme0n1p11: LABEL="boot_ubuntu" UUID=" TYPE="ext4" PARTLABEL="boot_ubuntu" PARTUUID="" # ubu (crypt) /dev/nvme0n1p10: UUID="" TYPE="crypto_LUKS" PARTUUID="" # mapped (after luksOpen) /dev/mapper/ubu_crypt: UUID="" TYPE="ext4" = 10 # OPTIONAL: # srv_crypt /dev/nvme0n1p6: UUID="" TYPE="crypto_LUKS" PARTUUID="" # home_crypt /dev/nvme0n1p7: UUID="" TYPE="crypto_LUKS" PARTUUID="" # live usb /dev/sda1: LABEL="UBUNTU 16_0" UUID="" TYPE="vfat" PARTUUID="" /dev/loop0: TYPE="squashfs" # other-legacy-etc /dev/nvme0n1: PTUUID="" PTTYPE="gpt" /dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="" /dev/nvme0n1p8: UUID="" TYPE="crypto_LUKS" PARTUUID="" /dev/nvme0n1p12: LABEL="WINRETOOLS" UUID="" TYPE="ntfs" PARTUUID="" /dev/nvme0n1p13: LABEL="Image" UUID="" TYPE="ntfs" PARTUUID="" /dev/nvme0n1p3: LABEL="OS" UUID="" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="" /dev/nvme0n1p4: UUID="" TYPE="ext4" PARTUUID="" /dev/nvme0n1p5: LABEL="datasss" UUID="" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="" /dev/nvme0n1p9: LABEL="DaTa" UUID="" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID=""
quick story
- boot into live ubuntu usb
- mount crypt partitions
- mount other partitions
- chroot into system
- run grub install (mkconfig) to reinstal grub to the selected disk (not partition but disk)
- update-grub (finds the loadable OSes kernels – linux and win)
- check fstab and crypttab
- check other-then-root crypt partition mounting
- initramfs-update (generate the grub menu)
- config BIOS
- errata
# NEEDED export DISK_FOR_GRUB='/dev/nvme0n1' export PART_UBU='/dev/nvme0n1p10' export PART_BOOT='/dev/nvme0n1p11' export PART_BOOT_EFI='/dev/nvme0n1p1' export CRYPT_ALIAS_UBU='ubu' # (OPT) export PART_HOME='/dev/nvme0n1p7' export CRYPT_ALIAS_HOME='home_crypt' # be able to mount encrypted ubu partition sudo modprobe dm-crypt sudo cryptsetup luksOpen $PART_UBU $CRYPT_ALIAS_UBU # insert the code of the crypt partition # the $CRYPT_ALIAS_UBU is then in /etc/fstab and also /etc/crypttab sudo mkdir /mnt /mnt/boot /mnt/boot/efi sudo mount /dev/mapper/$CRYPT_ALIAS_UBU /mnt sudo mount $PART_BOOT /mnt/boot sudo mount $PART_BOOT_EFI /mnt/boot/efi # mount the live-ubuntu folders to your mounted ubuntu dir for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done # chroot into the ubuntu install sudo chroot /mnt # fill these from your upper choice export CRYPT_ALIAS_UBU='ubu_crypt' # (OPT) export CRYPT_ALIAS_HOME='home_crypt' # install grub to the disk (not partition, but disk - no p# suffix) grub-install $DISK_FOR_GRUB # (opt) make a backup of your system fstab and crypttab cp /etc/fstab /etc/fstab_orig cp /etc/crypttab /etc/crypttab_orig # (opt) copy the info about mounted # cp /proc/mounts /etc/mtab # all now mounted disks should be remounted on startup? # let it find the distros on the mounted /boot partition - recreate config # both are the same: # grub-mkconfig -o /boot/grub/grub.cfg update-grub # if you got some /boot/efi Input/output error you can correct the possibly corrupted partitions sudo fsck -p -f -C0 $PART_BOOT_EFI # and rerun the update-grub update-grub # it should output the kernels found! # - if not something is wrong # - make sure you `cp /proc/mounts` # or try: `grep -v rootfs /proc/mounts > /etc/mtab` - if your boot is on the same parition as ubuntu install # - make sure you mounte the boot partition if it's separate # FSTAB, CRYPTTAB # check wheather you have the same crypt partition names as your aliases # you used for their luksOpen - they must be the same as the ones in # /etc/fstab and /etc/crypttab cat /etc/crypttab | grep $CRYPT_ALIAS_UBU cat /etc/fstab | grep $CRYPT_ALIAS_UBU # (OPT) cat /etc/crypttab | grep $CRYPT_ALIAS_HOME cat /etc/fstab | grep $CRYPT_ALIAS_HOME # they also have to have the correct UUID and setup.. # fstab example: /dev/mapper/ubu / ext4 rw,relatime,data=ordered 0 1 # crypttab example: ubu_crypt UUID=xxx none luks,discard # also add all the other partitions which you would like to mount on start # update-initramfs update-initramfs -u -k all # if it outputed lines like the following, containing all your wanted kernels you should be fine # > update-initramfs: Generating /boot/initrd.img-4.13.0-36-generic # CHECK other-then-root crypt partitions mounting # as you are chrooted using your root partition $PART_UBU you cannot test the mounting of it # however, you can test mounting of other crypt partitions - test your fstab and crypttab config sudo cryptdisks_start $CRYPT_ALIAS_HOME # normal output: ``` * Starting crypto disk... * home_crypt (starting).. Please unlock disk home_crypt: * home_crypt (started)... ``` # exit and umount exit sudo umount /mnt/boot /mnt/dev /mnt/proc /mnt/sys /mnt # restart sudo reboot -n ``` # BIOS setup UEFI boot option Maybe you need to add the option in UEFI bios - advanced booting options Dell xps15 select disk: FS0 go to boot /efi/grub find shim.efi name it: ubuntu click add select to defaultly boot from this # ERRATA if the login holds after you successfully input the crypttab partition code it may be because some old CRYPT_ALIAS has made it's way into the grub boot option ## QUICK ONE TIME FIX manually edit the grub boot line before Enter press e on the selected boot option in grub menu check whether the `load`... line has the correct /dev/mapper/$CRYPT_ALIAS_NAME rewrite it and press `ctrl+x` DONE
If this happen:
FUCK the fstab was overwritten maybe the crypttab also - ok added the backup commands into the tutor - you can recreate them from the backup ## otherwise recreate them manuallyAutomount a luks encrypted volume on system start### /etc/crypttab ``` sudo cryptsetup luksDump /dev/nvme0n1p6 | grep "UUID" >> /etc/crypttab sudo cryptsetup luksDump /dev/nvme0n1p7 | grep "UUID" >> /etc/crypttab ``` edit the file: ``` sudo vim /etc/crypttab ``` add the label = to the uuids ``` home_crypt UUID=<uuid> none luks srv_crypt UUID=<uuid> none luks ``` try loading ``` sudo cryptdisks_start home_crypt ``` ### /etc/fstab ``` /dev/mapper/home_crypt /home ext4 rw,relatime 0 2 ```
if you get something like
initramfs-tools configuration sets RESUME=/dev/mapper/swap_crypt
check your /etc/initramfs-tools/*
„`
cd /etc/initramfs-tools
ag RESUME
„`
and change it to your liking
# well then
we meet again when my kernel 4.4.0.97-130 stopped booting
got error
during `update-initramfs -u -k 4.4`
„`
WARNING: missing /lib/modules/4.4
Ensure all necessary drivers are built into the linux image
depmod: ERROR: could not open directory /lib/modules/4.4: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_IQZ8LU/lib/modules/4.4/moudles.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_IQZ8LU/lib/modules/4.4/moudles.builtin: No such file or directory
„`
„`
> apt autoremove -s
…
will be REMOVED:
linux-image-extra-4.4.0-97-generic linux-signed-image-4.4.0-97-generic
…
„`
issue on askubuntu = https://ubuntuforums.org/showthread.php?t=2358909
## possible causes
received sigrtmin+21 from plymouthd
driver ath10k_pci – from spinup ubuntu probably – not found on startup