distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Error] Fedora's shadow-utils passwd implementation needs '--stdin'

Open nathanchance opened this issue 1 year ago • 0 comments

Describe the bug

After Fedora switched their passwd implementation away from its own package and into shadow-utils (https://src.fedoraproject.org/rpms/shadow-utils/c/91360f25a8c8b810d59bec2803a2477a2647c775?branch=rawhide), I am unable to start a container that includes it.

To Reproduce

$ git show -s --format=%H
5201a2d2e547bf1fe6a89cfdbe29274096b95be8

$ ./distrobox create -i ghcr.io/nathanchance/dev/fedora:latest -n dev-fedora
Creating 'dev-fedora' using image ghcr.io/nathanchance/dev/fedora        [ OK ]
Distrobox 'dev-fedora' successfully created.
To enter, run:

distrobox enter dev-fedora

$ ./distrobox enter dev-fedora
Starting container...                            [ OK ]
Installing basic packages...                     [ OK ]
Setting up devpts mounts...                      [ OK ]
Setting up read-only mounts...                   [ OK ]
Setting up read-write mounts...                  [ OK ]
Setting up host's sockets integration...         [ OK ]
Integrating host's themes, icons, fonts...       [ OK ]
Setting up package manager exceptions...         [ OK ]
Setting up rpm exceptions...                     [ OK ]
Setting up dpkg exceptions...                    [ OK ]
Setting up distrobox profile...                  [ OK ]
Setting up sudo...                               [ OK ]
Setting up groups...                             [ OK ]
Setting up users...                              Error: An error occurred

Expected behavior

I expect to be able to start my container :)

Logs

$ podman logs dev-fedora
...
+ '[' /home/nathan '!=' /home/nathan ']'
+ '[' '!' -e /etc/passwd.done ']'
++ cat /proc/sys/kernel/random/uuid
+ temporary_password=7867745a-41ea-4493-8b7b-83d8fd18924a
+ printf %s:%s nathan 7867745a-41ea-4493-8b7b-83d8fd18924a
+ chpasswd -e
+ printf %s: nathan
+ chpasswd -e
+ '[' 0 -eq 0 ']'
+ printf '%s\n%s\n' 7867745a-41ea-4493-8b7b-83d8fd18924a 7867745a-41ea-4493-8b7b-83d8fd18924a
+ passwd root
The password for root is unchanged.
Changing password for root
Enter the new password (minimum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
+ '[' 1 -ne 0 ']'
+ printf 'Error: An error occurred\n'
Error: An error occurred

Desktop (please complete the following information):

  • Are you using podman, docker or lilipod? podman
  • Which version or podman, docker or lilipod? 4.9.2
  • Which version of distrobox? 5201a2d2e547bf1fe6a89cfdbe29274096b95be8
  • Which host distribution? Arch Linux
  • How did you install distrobox? From git.

Additional context

The following diff allows the container to start but I am not sure if there are implications for other passwd implementations so I am not submitting it.

diff --git a/distrobox-init b/distrobox-init
index fa444e0..f434766 100755
--- a/distrobox-init
+++ b/distrobox-init
@@ -1983,7 +1983,7 @@ if [ ! -e /etc/passwd.done ]; then

        if [ "${rootful}" -eq 0 ]; then
                # We're rootless so we don't care about account password, so we remove it
-               printf "%s\n%s\n" "${temporary_password}" "${temporary_password}" | passwd root
+               printf "%s\n%s\n" "${temporary_password}" "${temporary_password}" | passwd -s root
                printf "%s:" "root" | chpasswd -e
        else
                # We're rootful, so we don't want passwordless accounts, so we lock them

nathanchance avatar Feb 15 '24 19:02 nathanchance