Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Distrobox fails to initiate user on Void Linux guest. #52

Closed
byte-wolf opened this issue Dec 25, 2021 · 7 comments · Fixed by #53
Closed

[Issue] Distrobox fails to initiate user on Void Linux guest. #52

byte-wolf opened this issue Dec 25, 2021 · 7 comments · Fixed by #53
Labels
bug Something isn't working

Comments

@byte-wolf
Copy link

Info

Host system: Arch (EndeavourOS)
Container tech: Docker
Shell: zsh
Username on host system: simonw
Guest systems tried:

  • Void Linux Thin (Failed)
  • Void Linux Full (Failed)
  • Fedora Toolbox (Succeeded)

Steps taken

distrobox-create -i ghcr.io/void-linux/void-linux:latest-full-x86_64 -n void-box-full -v
distrobox-enter --name void-box-full

I tried starting the container with docker and it worked as expected:

docker run -it  dce757d093a4         
/ # cat etc/passwd
root:x:0:0:root:/root:/bin/sh
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
/ # exit

Log output

$ docker logs -f void-box-full
+ [ ! -f /run/.containerenv ]
+ [ ! -f /.dockerenv ]
+ [ -z 1000 ]
+ [ -z /home/simonw ]
+ [ -z simonw ]
+ [ -z 1000 ]
+ basename bash
+ shell_pkg=bash
+ command -v mount
+ command -v passwd
/usr/sbin/mount
+ command -v sudo
+ command -v apk
/usr/sbin/passwd
+ command -v apt-get
+ command -v dnf
+ command -v pacman
+ command -v slackpkg
+ command -v xbps-install
/usr/sbin/xbps-install
+ xbps-install -Sy bash procps-ng shadow sudo util-linux
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: [1722KB 0%] 178MB/s ETA: 00m00s
x86_64-repodata: [1722KB 6%] 703KB/s ETA: 00m14s
x86_64-repodata: [1722KB 56%] 831KB/s ETA: 00m01s
x86_64-repodata: 1722KB [avg rate: 1467KB/s]
Package `procps-ng' already installed.
Package `shadow' already installed.
Package `util-linux' already installed.
2 packages will be downloaded:

2 packages will be installed:

  bash-5.1.008_1 
  sudo-1.9.8p2_1 

Size to download:             2608KB
Size required on disk:          11MB
Space available on disk:       577GB


[*] Downloading packages
bash-5.1.008_1.x86_64.xbps.sig: [512B 100%] 41MB/s ETA: 00m00s
bash-5.1.008_1.x86_64.xbps.sig: 512B [avg rate: 41MB/s]
bash-5.1.008_1.x86_64.xbps: [1540KB 0%] 95MB/s ETA: 00m00s
bash-5.1.008_1.x86_64.xbps: [1540KB 40%] 766KB/s ETA: 00m01s
bash-5.1.008_1.x86_64.xbps: 1540KB [avg rate: 1890KB/s]
bash-5.1.008_1: verifying RSA signature...
sudo-1.9.8p2_1.x86_64.xbps.sig: [512B 100%] 29MB/s ETA: 00m00s
sudo-1.9.8p2_1.x86_64.xbps.sig: 512B [avg rate: 29MB/s]
sudo-1.9.8p2_1.x86_64.xbps: [1066KB 0%] 163MB/s ETA: 00m00s
sudo-1.9.8p2_1.x86_64.xbps: [1066KB 76%] 891KB/s ETA: 00m00s
sudo-1.9.8p2_1.x86_64.xbps: 1066KB [avg rate: 1164KB/s]
Registered /usr/bin/bash into /etc/shells.
Registered /bin/bash into /etc/shells.
Setting up permissions to /etc/sudoers...
sudo-1.9.8p2_1: verifying RSA signature...

[*] Collecting package files
bash-5.1.008_1: collecting files...
sudo-1.9.8p2_1: collecting files...

[*] Unpacking packages
bash-5.1.008_1: unpacking ...
bash-5.1.008_1: registered 'sh' alternatives group
sudo-1.9.8p2_1: unpacking ...

[*] Configuring unpacked packages
bash-5.1.008_1: configuring ...
bash-5.1.008_1: installed successfully.
sudo-1.9.8p2_1: configuring ...
sudo-1.9.8p2_1: installed successfully.

2 downloaded, 2 installed, 0 updated, 2 configured, 0 removed.
+ HOST_MOUNTS_RO=/etc/machine-id /var/lib/flatpak /var/lib/systemd/coredump /var/log/journal
+ mount_bind /run/host/etc/machine-id /etc/machine-id ro
+ source_dir=/run/host/etc/machine-id
+ target_dir=/etc/machine-id
+ mount_flags=ro
+ [ -d /run/host/etc/machine-id ]
+ [ -f /run/host/etc/machine-id ]
+ [ -d /run/host/etc/machine-id ]
+ [ -f /run/host/etc/machine-id ]
+ touch /etc/machine-id
+ [ ro =  ]
+ mount --rbind -o ro /run/host/etc/machine-id /etc/machine-id
+ return 0
+ mount_bind /run/host/var/lib/flatpak /var/lib/flatpak ro
+ source_dir=/run/host/var/lib/flatpak
+ target_dir=/var/lib/flatpak
+ mount_flags=ro
+ [ -d /run/host/var/lib/flatpak ]
+ [ -f /run/host/var/lib/flatpak ]
+ return 0
+ mount_bind /run/host/var/lib/systemd/coredump /var/lib/systemd/coredump ro
+ source_dir=/run/host/var/lib/systemd/coredump
+ target_dir=/var/lib/systemd/coredump
+ mount_flags=ro
+ [ -d /run/host/var/lib/systemd/coredump ]
+ [ -d /run/host/var/lib/systemd/coredump ]
+ mkdir -p /var/lib/systemd/coredump
+ [ ro =  ]
+ mount --rbind -o ro /run/host/var/lib/systemd/coredump /var/lib/systemd/coredump
+ return 0
+ mount_bind /run/host/var/log/journal /var/log/journal ro
+ source_dir=/run/host/var/log/journal
+ target_dir=/var/log/journal
+ mount_flags=ro
+ [ -d /run/host/var/log/journal ]
+ [ -d /run/host/var/log/journal ]
+ mkdir -p /var/log/journal
+ [ ro =  ]
+ mount --rbind -o ro /run/host/var/log/journal /var/log/journal
+ return 0
+ HOST_MOUNTS=/media /run/media /run/udev/data /mnt /var/mnt /run/systemd/journal /run/libvirt /var/lib/libvirt
+ mount_bind /run/host/media /media rw
+ source_dir=/run/host/media
+ target_dir=/media
+ mount_flags=rw
+ [ -d /run/host/media ]
+ [ -f /run/host/media ]
+ return 0
+ mount_bind /run/host/run/media /run/media rw
+ source_dir=/run/host/run/media
+ target_dir=/run/media
+ mount_flags=rw
+ [ -d /run/host/run/media ]
+ [ -d /run/host/run/media ]
+ mkdir -p /run/media
+ [ rw =  ]
+ mount --rbind -o rw /run/host/run/media /run/media
+ return 0
+ mount_bind /run/host/run/udev/data /run/udev/data rw
+ source_dir=/run/host/run/udev/data
+ target_dir=/run/udev/data
+ mount_flags=rw
+ [ -d /run/host/run/udev/data ]
+ [ -d /run/host/run/udev/data ]
+ mkdir -p /run/udev/data
+ [ rw =  ]
+ mount --rbind -o rw /run/host/run/udev/data /run/udev/data
+ return 0
+ mount_bind /run/host/mnt /mnt rw
+ source_dir=/run/host/mnt
+ target_dir=/mnt
+ mount_flags=rw
+ [ -d /run/host/mnt ]
+ [ -d /run/host/mnt ]
+ mkdir -p /mnt
+ [ rw =  ]
+ mount --rbind -o rw /run/host/mnt /mnt
+ return 0
+ mount_bind /run/host/var/mnt /var/mnt rw
+ source_dir=/run/host/var/mnt
+ target_dir=/var/mnt
+ mount_flags=rw
+ [ -d /run/host/var/mnt ]
+ [ -f /run/host/var/mnt ]
+ return 0
+ mount_bind /run/host/run/systemd/journal /run/systemd/journal rw
+ source_dir=/run/host/run/systemd/journal
+ target_dir=/run/systemd/journal
+ mount_flags=rw
+ [ -d /run/host/run/systemd/journal ]
+ [ -d /run/host/run/systemd/journal ]
+ mkdir -p /run/systemd/journal
+ [ rw =  ]
+ mount --rbind -o rw /run/host/run/systemd/journal /run/systemd/journal
+ return 0
+ mount_bind /run/host/run/libvirt /run/libvirt rw
+ source_dir=/run/host/run/libvirt
+ target_dir=/run/libvirt
+ mount_flags=rw
+ [ -d /run/host/run/libvirt ]
+ [ -f /run/host/run/libvirt ]
+ return 0
+ mount_bind /run/host/var/lib/libvirt /var/lib/libvirt rw
+ source_dir=/run/host/var/lib/libvirt
+ target_dir=/var/lib/libvirt
+ mount_flags=rw
+ [ -d /run/host/var/lib/libvirt ]
+ [ -f /run/host/var/lib/libvirt ]
+ return 0
+ [ -d /usr/lib/rpm/macros.d/ ]
+ grep -q Defaults !fqdn /etc/sudoers
+ printf Defaults !fqdn\n
+ grep -q simonw ALL = (root) NOPASSWD:ALL /etc/sudoers
+ printf %s ALL = (root) NOPASSWD:ALL\n simonw
+ grep -q simonw /etc/group
+ groupadd --force --gid 1000 simonw
+ id simonw
id: 'simonw': no such user
/usr/bin/entrypoint: 295: SHELL: parameter not set
+ [ 2 -ne 0 ]
+ printf Error: An error occurred\n
Error: An error occurred

Issue

As you can see "an error occurred". Maybe it has something to do with user creation?

+ id simonw
id: 'simonw': no such user

I don't know if this is a wide spread issue or an issue specific to my setup. Maybe someone has an idea or can recreate it.

@byte-wolf byte-wolf changed the title [Error] Distrobox fails to initiate user on Void Linux guest. [Issue] Distrobox fails to initiate user on Void Linux guest. Dec 25, 2021
@89luca89
Copy link
Owner

Hi @byte-wolf
The error is not on no such user, the id command is just used to check if the user already exists (which does not in case of docker)
The error is that the SHELL environment variable is not set, and there is no default value for it.

I've created a new pull request HERE with a fix for it, can you check if it fixes your issue?
Thanks!

@89luca89 89luca89 mentioned this issue Dec 25, 2021
@89luca89 89luca89 added the bug Something isn't working label Dec 26, 2021
@byte-wolf
Copy link
Author

This indeed fixed the issue and I am now able to enter my distrobox with this branch :-)

@byte-wolf
Copy link
Author

However, I have noticed another issue specific to Void Linux as a guest system. (Does not happen with fedora-toolbox as a guest system). In the bash session in void I am unable to delete written characters with backspace and the up arrow key does recall past commands, but it appends them to the end of the current command, making it unusable.

And I think im using bash and not sh:

$ ps -p $$
    PID TTY          TIME CMD
   6789 pts/1    00:00:00 bash

(inside the distrobox)

@89luca89
Copy link
Owner

89luca89 commented Dec 26, 2021

Seems like that specifically void is not picking up the environment variables we're passing
One of the symptoms was that SEHLL was not defined (which is highly unusual)
The other is this delete problem, which probably relies in the absence of a TERM variable or some other env

Can you do a envcommand to print the environment variables?

EIDIT: the problem persists between podman and docker, if we use sh -l as login shell, it works as intended, bash and zsh will behave in this way, I tend to think this is a problem with some setups not taking effect

@89luca89
Copy link
Owner

89luca89 commented Dec 26, 2021

Found it! Missing package ncurses-base 👍

Added to the PR branch, it works now for me, can you check?

EDIT: to be clear this is a packaging decision on Void's side, all other will set ncurses as a dependency of bash, you can see it HERE, so just to be sure, let's install ncurses manually for all 👍

@byte-wolf
Copy link
Author

Yes, it now works as intended. Thank you for your help and I hope this helps others trying to experiment with a void distrobox :-)

@89luca89
Copy link
Owner

Cool will merge the PR and close the issue then, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants