Score:0

Systemd-boot ALERT! /dev/mapper does not exist. Dropping to shell

pt flag

I am running Ubuntu 22.10. I want to shift from GRUB2 to systemd-boot and I followed the following guides How to replace grub with bootloader "systemd-boot" in ubuntu 20.04? and Replace GRUB2 with systemd-boot on Ubuntu 18.04. However, when I boot using systemd-boot, I get the following error, Systemd-boot ALERT! /dev/mapper does not exist. Dropping to shell.

/etc/kernel/postinst.d/zz-update-systemd-boot

#!/bin/bash
#
# This is a simple kernel hook to populate the systemd-boot entries
# whenever kernels are added or removed.
#
       
# The UUID of your disk.
UUID="7c1b4f71-a3aa-4394-8c93-de5adf80d801"
#UUID="CHANGEME"
#UUID="205A-4B07"

# The LUKS volume slug you want to use, which will result in the
# partition being mounted to /dev/mapper/CHANGEME.
#VOLUME="CHANGEME"
VOLUME="/dev/nvme0n1p2"

# Any rootflags you wish to set.
#ROOTFLAGS="CHANGEME"    

# Our kernels.
KERNELS=()
FIND="find /boot -maxdepth 1 -name 'vmlinuz-*' -type f -print0 | sort -rz"
while IFS= read -r -u3 -d $'\0' LINE; do
    KERNEL=$(basename "${LINE}")
    KERNELS+=("${KERNEL:8}")
done 3< <(eval "${FIND}")

# There has to be at least one kernel.
if [ ${#KERNELS[@]} -lt 1 ]; then
    echo -e "\e[2msystemd-boot\e[0m \e[1;31mNo kernels found.\e[0m"
    exit 1
fi
       
# Perform a nuclear clean to ensure everything is always in perfect
# sync.
rm /boot/efi/loader/entries/*.conf
rm -rf /boot/efi/ubuntu
mkdir /boot/efi/ubuntu
      
# Copy the latest kernel files to a consistent place so we can keep
# using the same loader configuration.
LATEST="${KERNELS[@]:0:1}"
echo -e "\e[2msystemd-boot\e[0m \e[1;32m${LATEST}\e[0m"
for FILE in config initrd.img System.map vmlinuz; do
    cp "/boot/${FILE}-${LATEST}" "/boot/efi/ubuntu/${FILE}"
    cat << EOF > /boot/efi/loader/entries/ubuntu.conf
title   Ubuntu GNOME
linux   /ubuntu/vmlinuz
initrd  /ubuntu/initrd.img
options cryptdevice=UUID=${UUID}:${VOLUME} root=/dev/mapper/${VOLUME} ro rootflags=${ROOTFLAGS}
EOF
done
    
# Copy any legacy kernels over too, but maintain their version-based
# names to avoid collisions.
if [ ${#KERNELS[@]} -gt 1 ]; then
    LEGACY=("${KERNELS[@]:1}")
    for VERSION in "${LEGACY[@]}"; do
        echo -e "\e[2msystemd-boot\e[0m \e[1;32m${VERSION}\e[0m"
        for FILE in config initrd.img System.map vmlinuz; do
            cp "/boot/${FILE}-${VERSION}" "/boot/efi/ubuntu/${FILE}-${VERSION}"
            cat << EOF > /boot/efi/loader/entries/ubuntu-${VERSION}.conf
title   Ubuntu GNOME ${VERSION}
linux   /ubuntu/vmlinuz-${VERSION}
initrd  /ubuntu/initrd.img-${VERSION}
options cryptdevice=UUID=${UUID}:${VOLUME} root=/dev/mapper/${VOLUME} ro rootflags=${ROOTFLAGS}
EOF
        done
    done
fi

# Success!
exit 0

lsblk -f

nvme0n1                                                                              
├─nvme0n1p1 vfat     FAT32       205A-4B07                              41.2M    92% /boot/efi
├─nvme0n1p2 ext4     1.0         7c1b4f71-a3aa-4394-8c93-de5adf80d801    473M    92% /
└─nvme0n1p3 ext4     1.0         c859be11-26eb-43ec-b0eb-8be05c7cdde3   19.8G    90% /home

I then ran this command before following the rest of the guide

efibootmgr --disk /dev/nvme0n1p --part 1 --create --label "PreLoader" --loader /EFI/systemd/PreLoader.efi

Thank you.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.