Public bug reported:

Package:
cryptsetup-initramfs

Ubuntu release:
Ubuntu 26.04

Summary:
During boot on a LUKS root system, cryptsetup/initramfs emits ignored errors 
because realpath is called from initramfs cryptroot/cryptsetup scripts, but the 
generated initramfs does not contain a realpath command. Adding 
/usr/bin/realpath to the initramfs via a local hook fixes the issue.

Observed behavior:
During boot, I see ignored errors related to realpath missing. Searching the 
installed scripts shows realpath is called by stock initramfs/cryptsetup 
scripts:

/usr/share/initramfs-tools/scripts/local-bottom/cryptroot:
    if [ -d "$d2" ] && d2="$(realpath "$d2")"; then

/lib/cryptsetup/functions:
    if [ -d "$d2" ] && d2="$(realpath -e -- "$d2")"; then

/usr/lib/cryptsetup/functions:
    if [ -d "$d2" ] && d2="$(realpath -e -- "$d2")"; then

/usr/share/initramfs-tools/hook-functions also references realpath
during initramfs generation.

On the affected system:

    lsinitramfs /boot/initrd.img-$(uname -r) | grep -E '(^|/)realpath$'

returns no result.

The initramfs does include BusyBox:

    lsinitramfs /boot/initrd.img-$(uname -r) | grep -E '(^|/)busybox$'
    usr/bin/busybox

The host BusyBox supports the realpath applet:

    busybox --list | grep '^realpath$'
    realpath

However, adding a symlink in initramfs from /usr/bin/realpath to
/usr/bin/busybox resulted in:

    realpath: applet not found

So the BusyBox inside the generated initramfs apparently does not
provide the realpath applet even though the host busybox command does.

Expected behavior:
If stock cryptsetup/initramfs scripts call realpath during initramfs boot, the 
generated initramfs should include a working realpath command, or the scripts 
should avoid assuming realpath exists.

Workaround:
Creating this local hook fixes the boot-time realpath errors:

    /etc/initramfs-tools/hooks/realpath

    #!/bin/sh
    set -e

    PREREQ=""

    prereqs() {
        echo "$PREREQ"
    }

    case "$1" in
        prereqs)
            prereqs
            exit 0
            ;;
    esac

    . /usr/share/initramfs-tools/hook-functions

    copy_exec /usr/bin/realpath /usr/bin/realpath

Then:

    chmod 0755 /etc/initramfs-tools/hooks/realpath
    update-initramfs -u -k "$(uname -r)"

After rebuilding, this confirms the workaround:

    lsinitramfs /boot/initrd.img-$(uname -r) | grep -E 'usr/bin/realpath$'
    usr/bin/realpath

Impact:
The system still boots, but the error appears during early boot on a LUKS root 
system and is confusing/noisy in exactly the path where users need reliable 
diagnostics. It may also break scripts that require realpath rather than 
treating it as optional.

Suggested fix:
cryptsetup-initramfs/initramfs-tools should ensure a working realpath command 
is present in the initramfs when scripts that call realpath are included, or 
change those scripts to use a safe fallback.

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: cryptsetup-initramfs 2:2.8.4-1ubuntu4
ProcVersionSignature: Ubuntu 7.0.0-27.27-generic 7.0.6
Uname: Linux 7.0.0-27-generic x86_64
ApportVersion: 2.34.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
Date: Sat Jul 11 14:09:34 2026
InstallationDate: Installed on 2025-01-05 (552 days ago)
InstallationMedia: Ubuntu-Server 24.04.1 LTS "Noble Numbat" - Release amd64 
(20240827)
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: cryptsetup
UpgradeStatus: Upgraded to resolute on 2026-06-26 (15 days ago)

** Affects: cryptsetup (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug resolute

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160412

Title:
  Ubuntu 26.04 cryptsetup initramfs scripts call realpath but initramfs
  does not include /usr/bin/realpath

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/2160412/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to