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

Support running inside Toolbx containers #3370

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Oct 2, 2023

  1. [component] Ensure consistency across rootful and rootless containers

    Currently, if 'sos report' is run inside a rootful Toolbx [1] container
    with the HOST environment variable set, it creates the report inside the
    host operating system's /var/tmp, which is at $HOST/var/tmp inside the
    container:
      # toolbox enter
      ⬢# HOST=/run/host sos report
      ...
      Your sosreport has been generated and saved in:
              /run/host/var/tmp/sosreport-toolbox-2023-10-01-trpwqii.tar.xz
      ...
    
    However, if it's run as 'sudo sos report' inside a rootless Toolbx
    container with the HOST environment variable set, it creates the report
    inside the container's /var/tmp:
      $ toolbox enter
      ⬢$ sudo su -
      ⬢# HOST=/run/host sos report
      ...
      Your sosreport has been generated and saved in:
              /var/tmp/sosreport-toolbox-2023-10-01-nwjqcff.tar.xz
      ...
    
    Toolbx [1] containers are ultimately Podman containers that are designed
    to be used as interactive command line environments for development and
    troubleshooting the host operating system.  So, one can replicate the
    above with a podman(1) invocation as well.
    
    This happens because the 'container' environment variable isn't set
    inside the sudo(8) session.  Instead of relying on environment
    variables, which often go missing in unexpected ways, it will be better
    to check for the /run/.containerenv and /.dockerenv stamp files that
    identify Podman and Docker containers respectively.
    
    [1] https://containertoolbx.org/
        https://github.com/containers/toolbox
    
    Resolves: sosreport#3370
    
    Signed-off-by: Debarshi Ray <debarshir@gnome.org>
    debarshiray committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    065a5df View commit details
    Browse the repository at this point in the history
  2. [sos] Support running inside Toolbx containers

    Toolbx [1] containers are Podman containers that are designed to be
    used as interactive command line environments for development and
    troubleshooting the host operating system.  Currently, those trying to
    use them for troubleshooting with 'sos report' have been setting the
    HOST environment variable inside their containers.
    
    It will improve the troubleshooting experience if sos(1) could detect
    that it's running inside a Toolbx container and automatically configure
    itself to do the right thing.
    
    Toolbx containers can be distinguished from other Podman containers by
    the presence of the /run/.toolboxenv file.
    
    [1] https://containertoolbx.org/
        https://github.com/containers/toolbox
    
    Resolves: sosreport#3370
    
    Signed-off-by: Debarshi Ray <debarshir@gnome.org>
    debarshiray committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    9c91fcc View commit details
    Browse the repository at this point in the history