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

K3s docker image is missing user info for root #9789

Closed
brandond opened this issue Mar 26, 2024 · 1 comment
Closed

K3s docker image is missing user info for root #9789

brandond opened this issue Mar 26, 2024 · 1 comment
Assignees
Milestone

Comments

@brandond
Copy link
Contributor

brandond commented Mar 26, 2024

When execing into the k3s image, the root user (that k3s runs as) has no userinfo (no name, default home dir, groups, so on)

/ # PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

@k3s-server-1:/# id
uid=0 gid=0 groups=0

@k3s-server-1:/# whoami
whoami: cannot find name for user ID 0: No such file or directory

@k3s-server-1:/# groups
groups: cannot find name for group ID 0
0

@k3s-server-1:/# cat /etc/passwd
cat: /etc/passwd: No such file or directory

This doesn't necessarily break anything, but it is somewhat irritating if you're trying to interact with the container and expect userinfo to be available.

@fmoral2
Copy link
Contributor

fmoral2 commented Apr 15, 2024

Validated on Version:

-$  k3s version v1.29.3+k3s-06b64449 (06b64449)

Environment Details

Infrastructure
Cloud EC2 instance

Node(s) CPU architecture, OS, and Version:
SUSE Linux Enterprise Server 15 SP4

Cluster Configuration:

  • 1 server

Steps to validate the fix

  1. run k3s on docker and exec into it
  2. Validate user infos

Reproduction Issue:


/k3s$ sudo docker exec -it k3s-server sh
/ # id
uid=0 gid=0 groups=0
/ # k3s -v
k3s version v1.28.8+k3s1 (653dd61a)
go version go1.21.8
/ # whoami
whoami: cannot find name for user ID 0: No such file or directory

 

Validation Results:

 

 ~ # whoami
root
 
~ # cat /etc/passwd /etc/group
root:x:0:0:root:/:/bin/sh
root:x:0:

~ # groups
root

@fmoral2 fmoral2 closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done Issue
Development

No branches or pull requests

2 participants