You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sudo(8) inside toolbox containers asks for a password with Podman 2.0.5 #523
When using toolbox on F33 Silverblue rawhide, entering a newly created toolbox results in an error as follows ...
/usr/bin/id: cannot find name for group ID 1000
Inside of toolbox, when issuing a command sudoer privileges are required for, such as dnf like so ...
sudo dnf install vim-enhanced terminator results in the following prompt to the user ...
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
then, if I enter the user password the result is password attempt failure ...
[sudo] password for ssnow:
Sorry, try again.
[sudo] password for ssnow:
Sorry, try again.
changed the title [-]F33 Silverblue Rawhide version of toolbox forces password when using sudo but doesn't respect sudoer password #593[/-][+]F33 Silverblue Rawhide version of toolbox forces password when using sudo but doesn't respect sudoer password [/+]on Aug 4, 2020
I did some testing on Fedora Workstation 32 and Fedora Workstation 33 (on virtual machines) and I can confirm that on F32 was working fine, but on F33 I got the same issue.
So, this is an issue with the Fedora 33 itself, not just the Silverblue version.
After some testing I noticed some differences:
The podman's version is different.
F32: 2.0.2
F33: 2.1.0-dev
The files /etc/group and /etc/shadow are different.
At the toolbox container in Fedora 33 the user doesn't have its own group and it's not at the group wheel.
Also, the user doesn't have an entry at the /etc/shadow file and the rootuser has the password locked.
The diff for the /etc/group file (inside the container) between the Fedora 32 and the Fedora 33. The username for the user was vagrant:
The problem is still present in rawhide (F33SB) with the exception of the message on entering toolbox (/usr/bin/id: cannot find name for group ID 1000) is no longer popping up.
I confirm that I too saw error (/usr/bin/id: cannot find name for group ID 1000) so i removed fedora-toolbox-33 image and re-created toolbox but now I cannot use sudo command. I am stuck now.
I follow up with the findings I did the other day and I manage to get the sudo working.
Steps:
(All this in a Fedora Workstation 33 in a VM)
Create the container.
[vagrant@ci-node-33 ~]$ toolbox create
Created container: fedora-toolbox-33
Enter with: toolbox enter
Enter into the container with toolbox and try the command sudo:
⬢[vagrant@toolbox ~]$ sudo ls
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for vagrant:
As the user didn't have the right groups and it wasn't at the shadow file (as I showed at the previous comment), I deleted and re-created the user, trying to use the same commands and parameters that toolbox does (at the init-container command):
# Delete the user
⬢[root@toolbox /]# userdel --force vagrant
# Create the user
⬢[root@toolbox /]# useradd --home-dir /home/vagrant/ --no-create-home --shell /bin/bash --uid 1000 --groups wheel vagrant
# Check the user groups (this time are OK)
⬢[root@toolbox /]# id vagrant
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant),10(wheel)
# Delete the user password
⬢[root@toolbox /]# passwd --delete vagrant
Removing password for user vagrant.
passwd: Note: deleting a password also unlocks the password.
passwd: Success
# Check that the user is at the file /etc/shadow (this is important for PAM authentication and sudo)
⬢[root@toolbox /]# grep vagrant /etc/shadow
vagrant::18493:0:99999:7:::
# Logout from the container
⬢[root@toolbox /]# exit
[vagrant@ci-node-33 ~]$
Enter into the container using toolboxand try the sudo command:
[vagrant@ci-node-33 ~]$ toolbox enter
⬢[vagrant@toolbox vagrant]$ sudo id
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
uid=0(root) gid=0(root) groups=0(root)
Now it works! 😄
Conclusion
Something seems to go wrong at the user generation, at the init-container command (somewhere around here).
Thank you for reporting this and trying to find the culprit! It seems that Podman in Rawhide changed the way it handles the --userns=keep-id option when creating containers. It creates now the user and the group. The first problem seems to be related to this functionality itself because the user group does not have a name despite having the correct GUID (I reported that upstream: podman-container-tools/podman#7389).
The other part (having to type password for sudo) is caused by the fact that the code path pointed out by @juanje is only triggered if the current user is not present in the container. That code takes care of creating the user, adding it to the correct groups and deleting passwords for the user and root. I think the code in the init-container command needs to be restructured a bit to be called even such cases.
It seems that Podman in Rawhide changed the way
it handles the --userns=keep-id option when creating
containers. It creates now the user and the group. The
first problem seems to be related to this functionality
itself because the user group does not have a name
despite having the correct GUID (I reported that upstream: podman-container-tools/podman#7389).
Seems like it's not actually creating the group. Otherwise you'd have a name. It's just creating the user.
I wonder if it's also creating a home directory. I hope not.
This is happening for me now on Silverblue 32 using fedora-toolbox:f32 image
toolbox version: 0.0.93
podman version: 2.0.5
Yeah, I have the issue on Silverblue 32 now on any new toolbox instance of F32. With old toolbox instance, it still works, but not with new creations. So, whatever was done to "fix" it, broke it on F32.
On SilverBlue, can I pull only given package and test it? It seems it needs to be rebased to test a package. Any method of testing the package(including containers, if possible) without needing to touch my base system is fine.
On SilverBlue, can I pull only given package and test it?
It seems it needs to be rebased to test a package.
Any method of testing the package(including containers,
if possible) without needing to touch my base system is fine.
rpm-ostree override replace and rpm-ostree override reset are your friends.
Unfortunately, you can't test things like Podman and Toolbox inside a container.
Should this be reopened? Definitively still happening with 0.0.95. toolbox create seems to put the user into the guest's /etc/passwd alright, but forgets about copying the /etc/group entry. Something like echo 'martin:x:1000' | sudo tee -a /etc/group in the container fixes it.
Definitively still happening with 0.0.95. toolbox create seems to
put the user into the guest's /etc/passwd alright, but forgets about
copying the /etc/group entry. Something like
echo 'martin:x:1000' | sudo tee -a /etc/group in the container fixes it.
What's still happening? You mean you are seeing this error when entering a container:
Activity
[-]F33 Silverblue Rawhide version of toolbox forces password when using sudo but doesn't respect sudoer password #593[/-][+]F33 Silverblue Rawhide version of toolbox forces password when using sudo but doesn't respect sudoer password [/+]test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
juanje commentedon Aug 14, 2020
I did some testing on Fedora Workstation 32 and Fedora Workstation 33 (on virtual machines) and I can confirm that on F32 was working fine, but on F33 I got the same issue.
So, this is an issue with the Fedora 33 itself, not just the Silverblue version.
After some testing I noticed some differences:
2.0.22.1.0-dev/etc/groupand/etc/shadoware different.At the toolbox container in Fedora 33 the user doesn't have its own group and it's not at the group
wheel.Also, the user doesn't have an entry at the
/etc/shadowfile and therootuser has the password locked.The diff for the
/etc/groupfile (inside the container) between the Fedora 32 and the Fedora 33. The username for the user wasvagrant:The diff for the
/etc/shadow:TheOneandOnlyJakfrost commentedon Aug 18, 2020
The problem is still present in rawhide (F33SB) with the exception of the message on entering toolbox (/usr/bin/id: cannot find name for group ID 1000) is no longer popping up.
pnemade commentedon Aug 19, 2020
I confirm that I too saw error (/usr/bin/id: cannot find name for group ID 1000) so i removed fedora-toolbox-33 image and re-created toolbox but now I cannot use
sudocommand. I am stuck now.juanje commentedon Aug 19, 2020
I follow up with the findings I did the other day and I manage to get the
sudoworking.Steps:
(All this in a Fedora Workstation 33 in a VM)
toolboxand try the commandsudo:It fails! 😞
podman:shadowfile (as I showed at the previous comment), I deleted and re-created the user, trying to use the same commands and parameters thattoolboxdoes (at theinit-containercommand):toolboxand try thesudocommand:Now it works! 😄
Conclusion
Something seems to go wrong at the user generation, at the
init-containercommand (somewhere around here).martymichal commentedon Aug 20, 2020
Thank you for reporting this and trying to find the culprit! It seems that Podman in Rawhide changed the way it handles the
--userns=keep-idoption when creating containers. It creates now the user and the group. The first problem seems to be related to this functionality itself because the user group does not have a name despite having the correct GUID (I reported that upstream: podman-container-tools/podman#7389).The other part (having to type password for sudo) is caused by the fact that the code path pointed out by @juanje is only triggered if the current user is not present in the container. That code takes care of creating the user, adding it to the correct groups and deleting passwords for the user and root. I think the code in the
init-containercommand needs to be restructured a bit to be called even such cases.debarshiray commentedon Aug 28, 2020
Seems like it's not actually creating the group. Otherwise you'd have a name. It's just creating the user.
I wonder if it's also creating a home directory. I hope not.
debarshiray commentedon Aug 28, 2020
podman-container-tools/podman#6829 was the offending Podman change.
efouladi commentedon Aug 28, 2020
This is happening for me now on Silverblue 32 using fedora-toolbox:f32 image
toolbox version: 0.0.93
podman version: 2.0.5
lebel commentedon Aug 30, 2020
Yeah, I have the issue on Silverblue 32 now on any new toolbox instance of F32. With old toolbox instance, it still works, but not with new creations. So, whatever was done to "fix" it, broke it on F32.
minioin commentedon Aug 30, 2020
Can confirm this issue on Fedora 32 SB with toolbox 0.0.93 and podman 2.0.5.
ljrk0 commentedon Aug 30, 2020
This is not related or confined to Fedora only, Arch with toolbox 0.0.94 and podman 2.0.5 has the same problem.
cmd/initContainer: Split out the code to configure the user
18 remaining items
minioin commentedon Aug 31, 2020
On SilverBlue, can I pull only given package and test it? It seems it needs to be rebased to test a package. Any method of testing the package(including containers, if possible) without needing to touch my base system is fine.
debarshiray commentedon Aug 31, 2020
rpm-ostree override replaceandrpm-ostree override resetare your friends.Unfortunately, you can't test things like Podman and Toolbox inside a container.
miabbott commentedon Sep 2, 2020
Thanks so much for the workaround @juanje
The only change I made for my user on a Silverblue host was making the home directory
/var/home/<user>martinpitt commentedon Sep 7, 2020
Should this be reopened? Definitively still happening with 0.0.95.
toolbox createseems to put the user into the guest's /etc/passwd alright, but forgets about copying the/etc/groupentry. Something likeecho 'martin:x:1000' | sudo tee -a /etc/groupin the container fixes it.ljrk0 commentedon Sep 7, 2020
Have recorded the same experience in #549 (comment) -- commented there as this doesn't (usually) break sudo.
debarshiray commentedon Sep 7, 2020
What's still happening? You mean you are seeing this error when entering a container:
That's podman-container-tools/podman#7389
I shied away from adding a similar workaround to Toolbox itself because it wouldn't correctly factor in things like
/etc/login.defs.Or did I misunderstand?
martinpitt commentedon Sep 8, 2020
@debarshiray : Thanks for the podman issue pointer! That looks like the root cause indeed. In the meantime, there workaround above is easy enough.
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523
test/system: Skip the new test for cheking the issue containers#523