Skip to content

Don't create a duplicate root user when dropbear-initramfs installed#1

Merged
lugoues merged 3 commits intolugoues:mainfrom
CiaranG:main
Apr 30, 2025
Merged

Don't create a duplicate root user when dropbear-initramfs installed#1
lugoues merged 3 commits intolugoues:mainfrom
CiaranG:main

Conversation

@CiaranG
Copy link

@CiaranG CiaranG commented Oct 18, 2024

Without this check, it's not possible to use dropbear-initramfs, even if you don't request the tailscale ssh support (using --ssh when setting up). Two root user directories get created, and it's random which ends up being the one used depending on which order the initramfs hooks execute. This means that although dropbear fires up as the ssh server, it doesn't have access to its authorized_keys file.

I've just changed the tailscale initramfs hook here to skip over creating a root user home directory if dropbear-initramfs is installed. It still redundantly creates it if the --ssh option wasn't specified when doing the initial setup, but I guess that's ok.

@Kerambad
Copy link

I had the same problem.

@CiaranG
Copy link
Author

CiaranG commented Nov 23, 2024

I wonder if your suggested approach still allows tailscale-initramfs to create the user if it happens to run first?

@Kerambad
Copy link

Should be fine, but I did not test it.
I just check, if there is already a root user. If yes it wont create a new one and reuses the old.
These lines are still always running: for x in passwd group; do echo "$x: files"; done >"$DESTDIR/etc/nsswitch.conf" echo "root:x:0:0:root:$home:/bin/sh" > "$DESTDIR/etc/passwd" echo "root:!:19808:0:99999:7:::" > "$DESTDIR/etc/shadow" echo "root:x:0:" >"$DESTDIR/etc/group"
I have the solution form here: https://github.com/darkrain42/tailscale-initramfs

Co-authored-by: Marek Schütze <marek-schuetze@mail.de>
@lugoues lugoues merged commit 755dbe1 into lugoues:main Apr 30, 2025
1 check failed
@lugoues
Copy link
Owner

lugoues commented Apr 30, 2025

Thanks y'all for the contribution! Sorry this took so long

@0x0309
Copy link

0x0309 commented Nov 2, 2025

@lugoues I had this same issue, then found this fix is not part of the apt install version yet.

@lugoues
Copy link
Owner

lugoues commented Nov 3, 2025

@lugoues I had this same issue, then found this fix is not part of the apt install version yet.

Oh god I'm dumb, sorry about that. I'll update that tomorrow.

@lugoues
Copy link
Owner

lugoues commented Nov 4, 2025

@lugoues I had this same issue, then found this fix is not part of the apt install version yet.

v0.4 has been released
https://github.com/lugoues/tailscale-initramfs/releases/tag/v0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants