Skip to content

Support 'sudo toolbox ...' #267

Closed
Closed

Description

@dustymabe

One of the use cases from running toolbox on Fedora CoreOS is to debug the system (not development). When running as root I see an error:

[root@coreos ~]# toolbox 
toolbox: /etc/subgid and /etc/subuid don't have entries for user root
See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more
information.
[root@coreos ~]# exit
logout
[core@coreos ~]$ sudo toolbox
toolbox: /etc/subgid and /etc/subuid don't have entries for user root
See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more
information.
[core@coreos ~]$

Is this expected?

Activity

  1. dustymabe commented on Sep 20, 2019

    @dustymabe
    CollaboratorAuthor

    This works with https://github.com/cgwalters/coretoolbox

    Considering we decided that we don't want to have two implementations and that we'll work together on toolbox I don't believe that's a helpful reminder.

  2. cgwalters commented on Sep 20, 2019

    @cgwalters
    Collaborator

    Considering we decided that we don't want to have two implementations and that we'll work together on toolbox I don't believe that's a helpful reminder.

    Where was that decided?

  3. dustymabe commented on Sep 20, 2019

    @dustymabe
    CollaboratorAuthor

    Well it seems like we've discussed "toolbox" a lot. In coreos/fedora-coreos-tracker#38 and https://github.com/debarshiray/toolbox/issues/8 and coreos/fedora-coreos-tracker#90. @mike-nguyen and @yuqi-zhang have been working together with @debarshiray IIUC to align the efforts. We have not added it to our design document so I guess we are missing a formal agreement, but in the meeting a week ago I didn't hear anyone dissenting on including toolbox once the deps were aligned. Outside of the meeting you spoke up and we tried to address the concerns you had in the next meeting. I thought we had addressed those concerns.

  4. cgwalters commented on Sep 20, 2019

    @cgwalters
    Collaborator

    but in the meeting a week ago I didn't hear anyone dissenting on including toolbox once the deps were aligned.

    I dissent until we have resolved the discussion in https://github.com/debarshiray/toolbox/issues/265

  5. debarshiray commented on Sep 23, 2019

    @debarshiray
    Member

    When running as root I see an error:

    [root@coreos ~]# toolbox 
    toolbox: /etc/subgid and /etc/subuid don't have entries for user root
    See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more
    information.
    [root@coreos ~]# exit
    logout
    [core@coreos ~]$ sudo toolbox
    toolbox: /etc/subgid and /etc/subuid don't have entries for user root
    See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more
    information.
    [core@coreos ~]$
    

    Is this expected?

    That's caused by an explicit sanity check in Toolbox to ensure that people have sane /etc/subuid and /etc/subgid files, which are crucial for rootless Podman. It's meant for users who tend to upgrade across major OS releases and might have created their local user account with an old version of shadow-utils that didn't update those files. An upfront human readable error is better than weird rootless Podman failures later in the process.

    Clearly this check needs to be skipped when running as root. :)

    I can imagine a few more things that might cause problems when running as root. eg., $XDG_RUNTIME_DIR might be unset, no user or session D-Bus to talk to the Flatpak session helper to monitor configuration files that need to be kept synchronized, and need to skip useradd in toolbox init-container.

  6. debarshiray commented on Sep 23, 2019

    @debarshiray
    Member

    https://github.com/debarshiray/toolbox/pull/273 solves this specific issue, but we still need to work through the other differences between root and rootless scenarios.

  7. dustymabe commented on Sep 25, 2019

    @dustymabe
    CollaboratorAuthor

    I can imagine a few more things that might cause problems when running as root. eg., $XDG_RUNTIME_DIR might be unset

    You were right! I now hit this:

    mkdir: cannot create directory '/toolbox': Operation not permitted
    

    because of toolbox_runtime_directory="$XDG_RUNTIME_DIR"/toolbox

  8. martymichal commented on Sep 26, 2019

    @martymichal
    Member

    Just found an old issue from Podman where they were solving this kind of problem: podman-container-tools/podman#427. Their solution was to create /run/containers instead of /run/user/UID/containers.

  9. dustymabe commented on Oct 16, 2019

    @dustymabe
    CollaboratorAuthor

    Workaround:

    [root@coreos ~]# export XDG_RUNTIME_DIR=/opt/                                                                          
    [root@coreos ~]# toolbox -v enter
    
  10. dustymabe commented on Oct 16, 2019

    @dustymabe
    CollaboratorAuthor

    Next issue:

    [root@coreos ~]# export XDG_RUNTIME_DIR=/opt/
    [root@coreos ~]# toolbox -v enter
    toolbox: running as real user ID 0
    toolbox: resolved absolute path for /usr/bin/toolbox to /usr/bin/toolbox
    toolbox: TOOLBOX_PATH is /usr/bin/toolbox
    toolbox: Fedora generational core is f30
    toolbox: base image is fedora-toolbox:30
    toolbox: container is fedora-toolbox-30
    toolbox: checking if container fedora-toolbox-30 exists
    toolbox: container fedora-toolbox-30 not found
    toolbox: found 0 containers
    No toolbox containers found. Create now? [y/N] y
    toolbox: Fedora generational core is f30
    toolbox: base image is fedora-toolbox:30
    toolbox: container is fedora-toolbox-30
    toolbox: failed to read property Listen from sssd-kcm.socket
    toolbox: parsing value  of property Listen in sssd-kcm.socket
    toolbox: checking if 'podman create' supports --ulimit host
    /usr/bin/toolbox: line 758: man: command not found
    toolbox: looking for image localhost/fedora-toolbox:30
    toolbox: looking for image registry.fedoraproject.org/f30/fedora-toolbox:30
    Image required to create toolbox container.
    Download registry.fedoraproject.org/f30/fedora-toolbox:30 (500MB)? [y/N]: y
    toolbox: pulling image registry.fedoraproject.org/f30/fedora-toolbox:30
    Trying to pull registry.fedoraproject.org/f30/fedora-toolbox:30...
    Getting image source signatures
    Copying blob 5eb34e12d23e done
    Copying blob b2b686c4a538 done
    Copying config 06478f0b37 done
    Writing manifest to image destination
    Storing signatures
    toolbox: base image fedora-toolbox:30 resolved to registry.fedoraproject.org/f30/fedora-toolbox:30
    toolbox: checking if container fedora-toolbox-30 already exists
    toolbox: checking if /usr is mounted read-only or read-write
    toolbox: mount-point of /usr is /usr
    toolbox: mount flags of /usr on the host are ro,relatime,seclabel,attr2,inode64,prjquota
    toolbox: /root canonicalized to /var/roothome
    toolbox: checking if /home is a symbolic link to /var/home
    toolbox: /home is a symbolic link to /var/home
    toolbox: calling org.freedesktop.Flatpak.SessionHelper.RequestSession
    Error connecting: Cannot autolaunch D-Bus without X11 $DISPLAY
    toolbox: failed to call org.freedesktop.Flatpak.SessionHelper.RequestSession
    
    

    so we'd need to figure out how to launch dbus without X11 $DISPLAY variable

  11. added
    1. Bug
    5. Help Wanted
    on Nov 7, 2019
  12. 22 remaining items

  13. debarshiray commented on Dec 18, 2020

    @debarshiray
    Member

    I think this can be closed now. Any follow-up issues with sudo toolbox can be tracked in separate issues.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. Bug5. Help Wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions