Score:1

Enable Bluetooth Keyboard before LUKS decryption - Ubuntu 20.04

id flag

I need to have my Keychron K8 Bluetooth keyboard working to write my boot-time LUKS disk decryption password.

At the moment, I can only use the laptop keyboard as the Bluetooth stack is not enabled yet.

I found (but not tried yet) the way to enable the module at initramfs time but I'm not sure how it is related to the Systemd Bluetooth Service.

Has anyone with the same issue got a solution?

Thank you,
Igor

Score:0
bo flag

Try with:

  1. Update initramfs: Update your initramfs image to include the necessary Bluetooth components. You can do this with the following command:

    sudo update-initramfs -u

  2. Edit your kernel command line: Edit your kernel command line to include the following options:

    rd.luks.options=luks,keyscript=/usr/share/initramfs-tools/scripts/local-top/btdecryption

  3. Create the btdecryption script: Create a new file called "btdecryption" in the "/usr/share/initramfs-tools/scripts/local-top" directory, and add the following contents:

# Wait for Bluetooth keyboard to connect
echo "Waiting for keyboard to connect..."
until hcitool con | grep -q "Keyboard Address"; do
    sleep 1
done
echo "Keyboard connected."

# Get password from keyboard
echo "Enter password:"
password=""
while [ ${#password} -lt 1 ]; do
    read -s -n 1 char
    if [ "$char" == "" ]; then
        echo ""
        break
    fi
    password="$password$char"
    echo -n "*"
done

# Pass password to LUKS
echo $password
  1. Make the script executable: Make the "btdecryption" script executable with the following command:

    sudo chmod +x /usr/share/initramfs-tools/scripts/local-top/btdecryption

  2. Update initramfs again: Update your initramfs image again to include the new script:

    sudo update-initramfs -u

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.