Background
In recent updates, Debian Bullseye (Debian 11) introduced a bug in udev that causes the command
ls /dev/serial/by-id/*
to fail, because the bug prevents the creation of this device path.
As of writing this, the bug remains unfixed in the regular Debian repositories, but it is already fixed in optional Debian repositories.
How to Diagnose
To check if the OS is affected by the bug, run:
sudo apt -y update && sudo apt -y upgrade
apt-cache policy udev
If the command’s output displays a version that contains deb11u
2, then the impacted udev is installed. The output will resemble:
udev:
Installed: 247.3-7+deb11u2
Candidate: 247.3-7+deb11u2
Version table:
*** 247.3-7+deb11u2 500
500 http://deb.debian.org/debian bullseye/main arm64 Packages
100 /var/lib/dpkg/status
Note:
- Depending on the Debian flavor, some distributions have the bullseye-updates activated
- This also cotains a fixed version meanwhile, so it is essential to update the system via apt to the latest state before checking for the buggy version
Automatic Solution
This shell script will automatically check if the affected udev version is installed and potentially remedy it.
Run this command:
curl -sf -L https://raw.githubusercontent.com/Sineos/useful_bits/main/Linux/fix_debian_udev.sh | sudo bash
WARNING:
- This script requires root privileges and will error if not run as root
- We have no intention of conducting any malicious activity on your installation. However, it is good practice to exercise caution when executing foreign scripts under root privileges.
- If you do not feel comfortable with it, then follow the manual process below
In detail, above script will perform the following steps:
- Check for Debian 11 → If not, then exit
- Check for root rights → If not, then exit
- Update the system via
apt update && apt upgrade
- Check for buggy
deb11u2
version string → If not, then exit - Check for an already installed backports repository → If not, then download / install the key and add the repository to apt
- Update udev to latest “bullseye-backports” version, that is listed here
The script will also create some kind of debug log file under /tmp/debug_fix_udev.log
If you experience any issues with this script, then start a new post and attach the above-mentioned log.
Manual Solution
To remedy the situation, you can use the following approach:
- Execute
sudo apt edit-sources
- In the editor that opens (if asked, choose
nano
) add the following line at the end:deb http://ftp.debian.org/debian bullseye-backports main non-free contrib
- Save and close
- Run:
sudo apt update
- Closely monitor the output of the above command. On errors, see below
- Run:
sudo apt install udev -t bullseye-backports
- Reboot
Depending on the “flavor” of Debian Bullseye, e.g. Armbian, Pi OS , MainsailOS etc, it can happen that the public keys of the repository are not available in the keyring.
This results in an error message during apt update
similar to:
W: GPG error: http://ftp.debian.org/debian bullseye-backports InRelease:
The following signatures couldn't be verified because the public key is not
available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
E: The repository 'http://ftp.debian.org/debian bullseye-backports InRelease'
is not signed.
N: Updating from such a repository can't be done securely, and is therefore
disabled by default.
This error message can be solved by executing:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
After these commands, rerun the above steps 4. to 7.
Note:
- Using
apt-key
is considered deprecated and no longer recommended.- Unfortunately, the “correct” approach is considerably more complicated, and therefore not implemented in this context.
- The automatic script version above will use the recommended approach