Skip to content

fix(base): support readlink applet from busybox - #2682

Open
bdrung wants to merge 1 commit into
dracut-ng:mainfrom
bdrung:readlink
Open

fix(base): support readlink applet from busybox#2682
bdrung wants to merge 1 commit into
dracut-ng:mainfrom
bdrung:readlink

Conversation

@bdrung

@bdrung bdrung commented Aug 27, 2026

Copy link
Copy Markdown
Member

busybox's readlink applet does not support the option -e option.

These readlink calls can be replaced by realpath, but realpath is not included in the initrd. So support using readlink (when busybox is used) and fall back to keep using readlink otherwise. Since realpath will return successfully on non-existing path, check the path exists if needed.

Part of: #2437

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

@bdrung
bdrung requested a review from a team as a code owner August 27, 2026 12:17
@github-actions github-actions Bot added base Issues related to the base module modules Issue tracker for all modules labels Aug 27, 2026
@devkontrol

Copy link
Copy Markdown
Collaborator

Do we now need to also install realpath into the generated initrd ?

@bdrung

bdrung commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

Oh, that is a valid point. Let me reconsider the solution.

@devkontrol
devkontrol marked this pull request as draft August 27, 2026 17:36
@bdrung
bdrung marked this pull request as ready for review September 1, 2026 17:47
@bdrung

bdrung commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Reworked the code to use realpath and fall back to readlink.

Comment thread modules.d/80base/dracut-lib.sh Outdated
busybox's `readlink` applet does not support the option `-e` option.

These `readlink` calls can be replaced by `realpath`, but `realpath` is
not included in the initrd. So support using `readlink` (when busybox is
used) and fall back to keep using `readlink` otherwise. Since `realpath`
will return successfully on non-existing path, check the path exists if
needed.

Part of: dracut-ng#2437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

base Issues related to the base module modules Issue tracker for all modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants