Compare commits

...

952 Commits
0.0.99 ... main

Author SHA1 Message Date
Debarshi Ray eb73692618 build, pkg/nvidia: Bump NVIDIA Container Toolkit to 1.17.5
NVIDIA Container Toolkit 1.17.5 requires Go >= 1.22 [1], and starts
using enable-cuda-compat hooks in the Container Device Interface
specification generated by it [2].  For example:
  "hookName": "createContainer",
  "path": "/usr/bin/nvidia-cdi-hook",
  "args": [
    "nvidia-cdi-hook",
    "enable-cuda-compat",
    "--host-driver-version=570.153.02"
  ]

The new hook makes it possible to have containers with a
/usr/local/cuda/compat/libcuda.so.* that's newer than the proprietary
NVIDIA driver on the host operating system, so that applications can use
a newer CUDA without having to update the driver [3].  Even though this
sounds useful, the hook has been disabled until it's handled by the
'init-container' command and there's a clear way to test it.

The src/go.sum file was updated with 'go mod tidy'.

[1] NVIDIA Container Toolkit commit 5bdf14b1e7c24763
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/5bdf14b1e7c24763
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/941
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/950

[2] NVIDIA Container Toolkit commit 76040ff2ad63fb82
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/76040ff2ad63fb82
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/906
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/948

[3] https://docs.nvidia.com/deploy/cuda-compatibility/

https://github.com/containers/toolbox/pull/1662
2025-06-11 21:30:11 +02:00
Debarshi Ray a49f70effe build: Bump tags.cncf.io/container-device-interface to 0.8.1
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1662
2025-06-11 15:22:06 +02:00
Debarshi Ray 40e3c5a63f Prepare 0.1.2
https://github.com/containers/toolbox/pull/1653
2025-06-03 22:08:50 +02:00
Debarshi Ray 231904e5ad build: Unbreak 'go build' by using micro version in go.mod's go line
Currently, 'go build' is failing on Fedora 42 Workstation:
  $ meson compile -C builddir --verbose
  ...
  /path/src/go-build-wrapper /path/src /path/builddir src/toolbox 0.1.1
      cc /lib64/ld-linux-x86-64.so.2 false
  go: updates to go.mod needed; to update it:
          go mod tidy
  ninja: build stopped: subcommand failed.

... with Go version:
  $ go version
  go version go1.24.3 linux/amd64
  $ rpm -q golang
  golang-1.24.3-2.fc42.x86_64

Strangely, the CI hasn't been failing on Fedora 42 with the same Go
version [1].

Starting from Go version 1.21.0, Go started using an explicit 0 micro
version instead of skipping it - compare Go 1.20 and 1.21.0 [2].  It
looks like recent versions of Go are pedantic about using the exact
version number.

[1] https://github.com/containers/toolbox/pull/1657

[2] https://github.com/golang/go/releases/tag/go1.20
    https://github.com/golang/go/releases/tag/go1.21.0

https://github.com/containers/toolbox/pull/1659
2025-06-03 22:07:00 +02:00
Debarshi Ray 9ac6728597 build: Bump github.com/spf13/viper to 1.20.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1656
2025-06-02 22:34:17 +02:00
Debarshi Ray 7ee347278e .github, build, playbooks: Bump github.com/spf13/viper to 1.20.0
... to reduce the number of indirect dependencies [1].

The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

This reverts commit 8b62d7e95d because the
go.opencensus.io dependency was removed from github.com/spf13/viper in
version 1.20.0 [1].

[1] Viper commit 7ad8e1ea014790e2
    https://github.com/spf13/viper/commit/7ad8e1ea014790e2
    https://github.com/spf13/viper/pull/1860
    https://github.com/spf13/viper/issues/1845

https://github.com/containers/toolbox/pull/1657
2025-06-02 22:33:30 +02:00
Debarshi Ray a0314d88fe build: Bump golang.org/x/sys to 0.29.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1656
2025-06-02 22:30:22 +02:00
Debarshi Ray 740e92cf7b build: Bump golang.org/x/sys to 0.28.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1656
2025-06-02 22:30:18 +02:00
Debarshi Ray 858916cae4 build: Bump golang.org/x/sys to 0.27.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1656
2025-06-02 22:30:16 +02:00
Debarshi Ray 2333edfac5 build: Bump github.com/fsnotify/fsnotify to 1.8.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1655
2025-06-02 19:48:33 +02:00
Debarshi Ray 5ed2442214 Give access to the CA certificates from the host
This uses the same approach taken by Flatpak [1] to ensure that the
certificates from certificate authorities (or CAs) that are available
inside a Toolbx container are kept synchronized with the host operating
system.  Any program that uses PKCS #11 to access CA certificates should
see the same ones both inside the container and on the host.

During every 'enter' and 'run' command, toolbox(1) ensures that an
instance of 'p11-kit server' is running on the host listening on a local
file system socket that's accessible to both the container and the host.
If an instance is already running, then a second one is not created.
The location of the socket is injected into the container through the
P11_KIT_SERVER_ADDRESS environment variable.

Just like Flatpak, the singleton 'p11-kit server' process is not
terminated when the last 'enter' or 'run' command exits.

The Toolbx container's entry point configures it to use the
p11-kit-client.so PKCS #11 module instead of the usual p11-kit-trust.so
module.  This talks to the 'p11-kit server' instance running on the host
over the socket instead of reading the CA certificates that are present
inside the container.

However, unlike Flatpak, this doesn't use D-Bus to set up the
communication between the container and the host, because when invoked
as 'sudo toolbox ...' there's no user or session D-Bus instance
available for the root user.

This set-up is skipped if 'p11-kit server' can't be run on the host, or
if the /etc/pkcs11/modules directory for configuring PKCS #11 modules or
p11-kit-client.so are missing inside the container.  None of these are
considered hard dependencies to accommodate size-constrained OSes like
Fedora CoreOS that might not have 'p11-kit server', and existing Toolbx
containers and old images that might not have p11-kit-client.so.

The UBI-based toolbox images haven't yet been updated to contain
p11-kit-client.so.  Until that happens, containers created from them
won't have access to the CA certificates from the host.

The CI needs to be run without 'p11-kit server' because the lingering
singleton process causes Bats to hang when tearing down the suite of
system tests [2].  To terminate the 'p11-kit server' instance run by the
system tests, it needs to be distinguishable from the instance run by
'normal' use of Toolbx by the user.  One way to do this is to isolate
the host operating system's XDG_RUNTIME_DIR from the system tests.
Unfortunately, this is easier said than done [3].  So, this workaround
has to suffice until the problem is solved.

On the Ubuntu 22.04 CI nodes, it's not possible to remove the p11-kit
package that provides 'p11-kit server', because it leads to:
  $ sudo dpkg --purge p11-kit
  dpkg: dependency problems prevent removal of p11-kit:
   adoptium-ca-certificates depends on p11-kit.

Therefore, as a workaround only the /usr/libexec/p11-kit/p11-kit-server
binary that provides the 'server' command is removed.  The rest of the
p11-kit package is left untouched.

[1] Flatpak commit 66b2ff40f7caf3a7
    https://github.com/flatpak/flatpak/commit/66b2ff40f7caf3a7
    https://github.com/flatpak/flatpak/pull/1757
    https://github.com/p11-glue/p11-kit/issues/68

[2] https://bats-core.readthedocs.io/en/stable/writing-tests.html

[3] https://github.com/containers/toolbox/pull/1652

https://github.com/containers/toolbox/issues/626
2025-06-02 15:58:46 +02:00
Debarshi Ray 9e776b6c94 pkg/utils: Add a function to check if p11-kit-client.so is present
A subsequent commit will use this to give Toolbx containers access to
the certificates from certificate authorities on the host.

The ideal goal is to ensure that all supported Toolbx containers and
images have p11-kit-client.so in them.  In practice, some of them never
will.  Either because it's an existing container or an older version of
an image that was already present in the local containers/storage image
store, or because the operating system is too old.

Therefore, there needs to be a way to check at runtime if a Toolbx
container has p11-kit-client.so or not.

https://github.com/containers/toolbox/issues/626
2025-06-01 15:26:01 +02:00
Debarshi Ray 456f37794d cmd/root, pkg/utils: Split out the code to acquire a file lock
A subsequent commit will use this to give Toolbx containers access to
the certificates from certificate authorities on the host.

This changes the user-visible error message from:
  $ toolbox --verbose list
  ...
  DEBU Migrating to newer Podman: failed to create migration lock file
      /run/user/1000/toolbox/migrate.lock: open
      /run/user/1000/toolbox/migrate.lock: no such file or directory
  Error: failed to create migration lock file

... to:
  $ toolbox --verbose list
  ...
  DEBU Migrating to newer Podman: failed to create lock file
      /run/user/1000/toolbox/migrate.lock: open
      /run/user/1000/toolbox/migrate.lock: no such file or directory
  Error: failed to create lock file

Or, from:
  $ toolbox --verbose list
  ...
  DEBU Migrating to newer Podman: failed to acquire migration lock on
      /run/user/1000/toolbox/migrate.lock: bad file descriptor
  Error: failed to acquire migration lock

... to:
  $ toolbox --verbose list
  ...
  DEBU Migrating to newer Podman: failed to acquire lock on
      /run/user/1000/toolbox/migrate.lock: bad file descriptor
  Error: failed to acquire lock

This is admittedly less specific without the debug logs, but it's
probably alright because it's such an unlikely error.

https://github.com/containers/toolbox/issues/626
2025-06-01 15:26:01 +02:00
Debarshi Ray b7be82d51e pkg/utils: Update fallback release to 42 for non-fedora hosts
Fedora 40 reached End of Life on 13th May 2025:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1651
2025-05-30 15:07:17 +02:00
Debarshi Ray 7cfe9a7f18 .zuul: Drop testing on Fedora 40
Fedora 40 reached End of Life on 13th May 2025:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1650
2025-05-29 23:44:56 +02:00
Jens Petersen 88a08351b2 .github/workflows, images/ubuntu: Add image definition for Ubuntu 25.04
https://github.com/containers/toolbox/pull/1638

Signed-off-by: Jens Petersen <petersen@redhat.com>
2025-05-29 23:22:43 +02:00
Debarshi Ray 836c0557f4 test/system: Optimize the environment variable tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The runtime environment tests, which includes the environment variable
tests, are particularly slow because they don't skip the I/O even when
testing error handling.  This makes them a good target for
optimizations.

The environment variable tests query the values of different environment
variables from different containers without changing their state.
Therefore, a lot of disk I/O can be avoided by creating these containers
only once for all the tests.

This can reduce the time needed to run the environment variable tests
from almost 26 minutes to almost 9 minutes.

https://github.com/containers/toolbox/pull/1646
2025-05-12 23:26:00 +02:00
Debarshi Ray a5a0d5350f test/system: Remove redundant clean-up
The IMAGE_CACHE_DIR environment variable is defined as
"${BATS_SUITE_TMPDIR}/image-cache" [1].  Earlier, it used to be
"${BATS_RUN_TMPDIR}/image-cache".

There's no need to clean up anything inside BATS_RUN_TMPDIR or
BATS_SUITE_TMPDIR after the test suite has finished running, because
their life cycle is managed by Bats [2].

[1] Commit 3a549a6252
    https://github.com/containers/toolbox/commit/3a549a6252e990d6
    https://github.com/containers/toolbox/pull/1452

[2] https://bats-core.readthedocs.io/en/stable/writing-tests.html

Fallout from 9820550c82

https://github.com/containers/toolbox/pull/1645
2025-05-12 17:58:15 +02:00
Debarshi Ray d64682af0d test/system: Don't use XDG_CACHE_HOME or HOME for temporary files
The XDG_CACHE_HOME environment variable is supposed to default to
$HOME/.cache [1], just as it did in the test suite, and this location is
meant to be used as a cache for 'normal' use by the user.  Test suites
generally don't qualify as 'normal' use.

One expects that deleting the cache shouldn't affect 'normal' use other
than degrading performance.  However, deleting these temporary files
used by the test suite will cause actual breakage.  Even if the user
doesn't manually delete the cache, two concurrent invocations of the
test suite can do so or lead to other unexpected collisions, because the
paths are constant across multiple invocations.

Therefore, it's better to limit the scope of the test suite's temporary
files within the sandbox offered by Bats [2].  The sandbox is clearly
labelled as being used by Bats, is unique for each invocation, and Bats
takes care of cleaning everything up once it has finished running.

Note that there's no need for the system-test-storage sub-directory
under BATS_SUITE_TMPDIR.  So it was left out.

[1] https://specifications.freedesktop.org/basedir-spec/latest/

[2] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1645
2025-05-12 17:41:52 +02:00
Debarshi Ray e98032352e images/ubuntu: Create the directory for configuring PKCS#11 modules
The p11-kit-modules package in Ubuntu provides p11-kit-client.so, but
the /etc/pkcs11/modules directory that's necessary to configure p11-kit
to use p11-kit-client.so is not created by any package.

It's better to ensure that the /etc/pkcs11/modules directory exists in
the image, instead of having the Toolbx container's entry point create
it at runtime, because it can be a confirmation that p11-kit was built
to read the module configuration from this location.

This should have been part of commit aa8507730d.

https://github.com/containers/toolbox/issues/626
2025-05-07 19:03:18 +02:00
Debarshi Ray 26b3314fa5 images/arch: Create the directory for configuring PKCS#11 modules
The /etc/pkcs11 directory and /etc/pkcs11/pkcs11.conf.example file are
created by the p11-kit package in Arch Linux, and the lib11-kit package
provides p11-kit-client.so.  However, the /etc/pkcs11/modules directory
that's necessary to configure p11-kit to use p11-kit-client.so is not
created by any package.

It's better to ensure that the /etc/pkcs11/modules directory exists in
the image, instead of having the Toolbx container's entry point create
it at runtime, because it can be a confirmation that p11-kit was built
to read the module configuration from this location.

This should have been part of commit 259de86c8f.

https://github.com/containers/toolbox/issues/626
2025-05-07 17:43:29 +02:00
Debarshi Ray f0a7304e75 pkg/utils: Mark a private function as such and drop one that's unused
It's been a while since it's been necessary to read the ID field from
os-release(5) outside this package or the VARIANT_ID field anywhere at
all.  Therefore, it's time to adjust the code to reflect this reality.

Fallout from 8caa7cd828

https://github.com/containers/toolbox/pull/1642
2025-05-07 01:50:25 +02:00
Debarshi Ray 5881bc43f3 test/system: Optimize the D-Bus tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The runtime environment tests, which includes the D-Bus tests, are
particularly slow because they don't skip the I/O even when testing
error handling.  This makes them a good target for optimizations.

The D-Bus tests check if methods can be called across the user or
session and system D-Bus instances from different containers without
changing their state.  Therefore, a lot of disk I/O can be avoided by
reating these containers only once for all the tests.

This can reduce the time needed to run the D-Bus tests from almost 10
minutes to almost 5 minutes.

https://github.com/containers/toolbox/pull/1641
2025-05-06 23:16:27 +02:00
Debarshi Ray 7a413e66b9 Move the code for Ubuntu support into its own file
This will reduce the size of the src/pkg/utils/utils.go file and make it
easier to specify which part of the code base is maintained by whom.

https://github.com/containers/toolbox/pull/1639
2025-05-06 02:39:28 +02:00
Debarshi Ray c794e183da Move the code for Red Hat Enterprise Linux support into its own file
This will reduce the size of the src/pkg/utils/utils.go file and make it
easier to specify which part of the code base is maintained by whom.

https://github.com/containers/toolbox/pull/1639
2025-05-06 02:20:18 +02:00
Debarshi Ray ab76cbca67 Move the code for Fedora support into its own file
This will reduce the size of the src/pkg/utils/utils.go file and make it
easier to specify which part of the code base is maintained by whom.

https://github.com/containers/toolbox/pull/1639
2025-05-06 02:07:17 +02:00
Debarshi Ray f9ebd5195b Move the code for Arch Linux support into its own file
This will reduce the size of the src/pkg/utils/utils.go file and make it
easier to specify which part of the code base is maintained by whom.

https://github.com/containers/toolbox/pull/1639
2025-05-06 01:56:01 +02:00
Debarshi Ray 1b9dd007ea test/system: Optimize the networking tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The runtime environment tests, which includes the networking tests, are
particularly slow because they don't skip the I/O even when testing
error handling.  This makes them a good target for optimizations.

The networking tests check the behaviour and configuration of the
network in different containers without changing their state.
Therefore, a lot of disk I/O can be avoided by creating these containers
only once for all the tests.

This can reduce the time needed to run the networking tests from almost
15 minutes to almost 6 minutes.

https://github.com/containers/toolbox/pull/1637
2025-05-01 23:28:17 +02:00
Debarshi Ray 259de86c8f images/arch: Avoid losing p11-kit-client.so by accident
The libp11-kit package was added to the arch-toolbox image to ensure the
presence of p11-kit-client.so.  Currently, the package is already pulled
in by various dependencies, like the gnutls and p11-kit packages.
Therefore, it doesn't increase the size of the base image, but serves as
a safeguard against any inadvertent changes.

A subsequent commit will use this to give Toolbx containers access to
the certificates from certificate authorities on the host.  This commit
was kept separate from the changes to toolbox(1) to ensure that the
arch-toolbox image is ready before that happens.

https://github.com/containers/toolbox/issues/626
2025-05-01 20:37:18 +02:00
Debarshi Ray aa8507730d .github/workflows, images/ubuntu: Add p11-kit-client.so to newer Ubuntus
A subsequent commit will use this to give Toolbx containers access to
the certificates from certificate authorities on the host.  This commit
was kept separate from the changes to toolbox(1) to ensure that the
ubuntu-toolbox images are ready before that happens.

Unfortunately, Ubuntu 16.04 Xenial Xerus has p11-kit 0.23.2 [1], while
p11-kit-client.so was introduced in p11-kit 0.23.10 [2].  Therefore,
this feature will be disabled for Ubuntu 16.04.

This reverts parts of commit 1e9308625a to
re-enable building the ubuntu-toolbox:18.04 image.

[1] https://code.launchpad.net/~git-ubuntu-import/ubuntu/+source/p11-kit/+git/p11-kit/+ref/ubuntu/xenial-updates

[2] p11-kit commit 0684cd7b7f815b41
    https://github.com/p11-glue/p11-kit/commit/0684cd7b7f815b41
    https://github.com/p11-glue/p11-kit/pull/15

https://github.com/containers/toolbox/issues/626
2025-05-01 20:29:12 +02:00
Debarshi Ray 02fe08f70e cmd/initContainer: Style fix
Use a strings.Builder [1] instance instead of raw string literals for
consistency.

Fallout from 772b66bf3e

[1] https://pkg.go.dev/strings#Builder

https://github.com/containers/toolbox/pull/1636
2025-05-01 20:28:04 +02:00
Debarshi Ray 3017a46c03 test/system: Optimize the group and user tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The runtime environment tests, which includes the group and user tests,
are particularly slow because they don't skip the I/O even when testing
error handling.  This makes them a good target for optimizations.

The group and user tests check the group and user configuration in
different containers without changing their state.  Therefore, a lot of
disk I/O can be avoided by creating these containers only once for all
the tests.

This can reduce the time needed to run the group and user tests from
almost 22 minutes to almost 5 minutes.

https://github.com/containers/toolbox/pull/1635
2025-05-01 20:24:07 +02:00
Debarshi Ray 69d6b11a9b test/system: Optimize the help tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The tests for toolbox(1) invocations forwarded to the host, which
includes the help tests, are particularly slow because they never skip
the I/O.  This makes them a good target for optimizations.

The help tests for toolbox(1) invocations forwarded to the host use the
same default Toolbx container to invoke toolbox(1) from without changing
its state.  Therefore, a lot of disk I/O can be avoided by creating the
default container only once for all those tests.

This can reduce the time needed to run the help tests from almost 7
minutes to a few seconds.

https://github.com/containers/toolbox/pull/1635
2025-05-01 18:05:28 +02:00
Debarshi Ray a062224db3 Link to the website instead of the code repository (part 2)
Now that there's a website at https://containertoolbx.org/ it makes more
sense to link to it instead of the code repository.  The website is a
superset of the code repository and contains a lot more useful
information for someone who is not familiar with the Toolbx project.

https://github.com/containers/toolbox/pull/1632
2025-05-01 14:11:42 +02:00
Debarshi Ray 6b703b8d3c cmd: Simplify string building
When the fmt.Fprintf() [1] function is used to write to a
strings.Builder [2] instance, it uses the io.Writer [3] interface, which
is the strings.Builder.Write() method.  This method is practically the
same as the strings.Builder.WriteString() method, other than the fact
that the former accepts a slice of bytes and the latter accepts a
string.  So, the difference is the initial call to fmt.Fprintf().

Therefore, unless format verbs [4] are needed to build the string,
fmt.Fprintf() can be replaced with strings.Builder.WriteString().  It
reduces one function call and is shorter to type.

Fallout from the following:
  * e390f15469
  * 7542f5fc86
  * e58992066f
  * 8dd2f8e80a
  * 063bdf965f

[1] https://pkg.go.dev/fmt#Fprintf

[2] https://pkg.go.dev/strings#Builder

[3] https://pkg.go.dev/io#Writer

[4] https://pkg.go.dev/fmt

https://github.com/containers/toolbox/pull/1632
2025-05-01 00:15:00 +02:00
Debarshi Ray 2956ecacb4 cmd, pkg/utils: Split out the code to get the initialization stamp path
This will prevent any silly bug in getting the initialization stamp path
from breaking the communication protocol between the 'enter' or 'run'
commands on the host and the Toolbx container's entry point process.

https://github.com/containers/toolbox/pull/1633
2025-05-01 00:13:48 +02:00
Debarshi Ray 63309e4666 cmd/initContainer: Sprinkle some debug logs
https://github.com/containers/toolbox/pull/1631
2025-04-30 22:32:34 +02:00
Debarshi Ray ee182260b7 cmd/initContainer: Split out the code to configure Kerberos
This is meant to reduce the size of the initContainer() function that
implements the heart of the 'init-container' command.

The debug log and error message were tweaked to match the name of the
function and for consistency with the configureRPM() function.

https://github.com/containers/toolbox/pull/1631
2025-04-30 16:19:30 +02:00
Debarshi Ray 06f81546ef cmd/initContainer: Split out the code to configure RPM
This is meant to reduce the size of the initContainer() function that
implements the heart of the 'init-container' command.

https://github.com/containers/toolbox/pull/1631
2025-04-30 16:19:30 +02:00
Debarshi Ray 69702119b4 .github/workflows, test/system: Test the Kerberos configuration
https://github.com/containers/toolbox/pull/1631
2025-04-30 16:12:22 +02:00
Debarshi Ray 9ec4f139df .github/workflows, test/system: Test the RPM configuration
https://github.com/containers/toolbox/pull/1631
2025-04-30 01:45:20 +02:00
Debarshi Ray c512909acc build: Bump github.com/spf13/viper to 1.19.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1630
2025-04-28 14:10:39 +02:00
Debarshi Ray c2096cb7fa build: Bump github.com/spf13/viper to 1.18.2
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1630
2025-04-28 13:56:45 +02:00
Debarshi Ray 4dac44d42e build: Bump github.com/spf13/viper to 1.18.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1630
2025-04-28 13:55:13 +02:00
Debarshi Ray 454c05685a build: Bump github.com/spf13/viper to 1.18.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1630
2025-04-28 13:44:22 +02:00
Debarshi Ray 9989ffac14 cmd/root, pkg/utils: Use errors.Is() instead of os.IsNotExist()
The os.IsNotExist() function [1] predates the introduction of the
errors.Is() function [2] in Go 1.13 [3].  From Go >= 1.16, the
documentation explicitly recommends the use of errors.Is() instead of
os.IsNotExist() [4].

The Go implementation of Toolbx never used any Go older than 1.13 [5],
and currently it requires Go >= 1.21 [6].  So, there's no reason not to
use the more modern and recommended alternative.

[1] https://pkg.go.dev/os#IsNotExist

[2] https://pkg.go.dev/errors#Is

[3] https://go.dev/blog/go1.13-errors

[4] Go commit b641f0dcf48aa748
    https://github.com/golang/go/commit/b641f0dcf48aa748
    https://github.com/golang/go/issues/41122

[5] Commit d857471aa2
    https://github.com/containers/toolbox/commit/d857471aa2f233e5
    https://github.com/containers/toolbox/pull/318

[6] Commit 82e85bac9f
    https://github.com/containers/toolbox/commit/82e85bac9f5e69a5
    https://github.com/containers/toolbox/pull/1614

https://github.com/containers/toolbox/pull/1629
2025-04-28 13:39:49 +02:00
Debarshi Ray e9e77fb069 pkg/utils: Test PathExists
https://github.com/containers/toolbox/pull/1629
2025-04-28 13:29:28 +02:00
Debarshi Ray c4df57944e cmd/run: Style fixes
Fallout from d8289fb832 and
815d7f6035

https://github.com/containers/toolbox/pull/1628
2025-04-26 00:10:31 +02:00
Debarshi Ray 389216cdca cmd/initContainer: Tweak the debug logs for brevity
Debug logs are sweeter when they are shorter.

Fallout from 6e848b250b and
91a019bef6

https://github.com/containers/toolbox/pull/1628
2025-04-25 23:48:53 +02:00
Debarshi Ray fd427863b0 cmd/initContainer: Style fixes
Fallout from the following:
  * 7542f5fc86
  * 786723116c
  * 6e848b250b

https://github.com/containers/toolbox/pull/1628
2025-04-25 23:48:48 +02:00
Debarshi Ray 94a75d631b build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.17.4
... for CVE-2025-23359 or GHSA-4hmh-pm5p-9j7j.

The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1627
2025-04-23 03:06:16 +02:00
Debarshi Ray e824bf7216 build: Bump github.com/NVIDIA/go-nvlib to 0.7.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1626
2025-04-23 00:02:03 +02:00
Debarshi Ray ec286bb186 pkg/utils: Optimize getting the runtime directory
The runtime directory is needed a few times during the course of
commonly used Toolbx commands.  It's used at start-up for all commands
except 'completion' and 'init-container' to synchronize the invocation
of 'podman system migrate'.  The entry point (ie., 'init-container')
uses it to read the generated Container Device Interface specification
and create the initialization stamp file.  The 'enter' and 'run'
commands use it to write the CDI specification and twice to detect the
creation of the initialization stamp file.

Since the runtime directory is always the same within a process, there's
no need to repeatedly go through all the steps of parsing the user and
group IDs, creating the directory, setting its ownership, and logging
the name of directory.  Once the directory is successfully created, it's
path can be cached and returned for subsequent use.

In case an error occurred while setting up the runtime directory,
subsequent attempts to get it will go through all the steps again.  This
doesn't matter much in practice because toolbox(1) can't continue in the
absence of a working runtime directory.

https://github.com/containers/toolbox/pull/1624
2025-04-11 22:10:53 +02:00
Debarshi Ray 3321bb20b6 cmd/root: Style fix
Fallout from 4a1aa4652e and
c2ba67569b

https://github.com/containers/toolbox/pull/1623
2025-04-11 17:12:06 +02:00
Debarshi Ray fb4cb2eb90 cmd/run: Style fixes
Fallout from d8289fb832 and
815d7f6035

https://github.com/containers/toolbox/pull/1623
2025-04-11 17:11:35 +02:00
Debarshi Ray c2520f2016 .zuul: Enable testing on Fedora 42
https://github.com/containers/toolbox/pull/1619
2025-03-29 01:03:01 +01:00
Debarshi Ray 4f4c3c9d19 build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.17.3
... for CVE-2024-0135 or GHSA-9v84-cc9j-pxr6, CVE-2024-0136 or
GHSA-vcfp-63cx-4h59, and CVE-2024-0137 or GHSA-frhw-w3wm-6cw4.

The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1614
2025-01-31 00:24:26 +01:00
Debarshi Ray ebd2fc1f8b build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.17.2
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1614
2025-01-30 23:01:26 +01:00
Debarshi Ray 8b603ad05f build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.17.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1614
2025-01-30 21:36:14 +01:00
Debarshi Ray 82e85bac9f build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.17.0
... for CVE-2024-0134 or GHSA-7jm9-xpwx-v999.

NVIDIA Container Toolkit 1.17.0 requires Go >= 1.21, even though it's
not mentioned in its go.mod file [1].

The src/go.sum file was updated with 'go mod tidy'.

[1] https://github.com/NVIDIA/nvidia-container-toolkit/issues/886

https://github.com/containers/toolbox/pull/1614
2025-01-30 21:36:14 +01:00
Debarshi Ray 4717be5e23 build: Bump github.com/NVIDIA/go-nvlib to 0.7.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1614
2025-01-30 00:28:24 +01:00
Debarshi Ray 957601f1d8 build: Bump github.com/NVIDIA/go-nvml to 0.12.4-1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1614
2025-01-29 21:20:28 +01:00
Debarshi Ray 85fcd6f4c7 build: Bump golang.org/x/sys to 0.26.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1613
2025-01-29 21:09:10 +01:00
Debarshi Ray 09773b9af2 build: Bump golang.org/x/sys to 0.25.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1613
2025-01-29 21:03:54 +01:00
Debarshi Ray bff269a9e9 build: Bump github.com/spf13/viper to 1.17.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1612
2025-01-27 18:46:01 +01:00
Debarshi Ray 5196d21294 build: Bump github.com/spf13/viper to 1.16.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1612
2025-01-27 17:58:27 +01:00
Debarshi Ray 03fd9c5498 build: Bump github.com/spf13/viper to 1.15.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

The src/go.sum file was skipped from the codespell test because it's
generated with 'go mod tidy'.  Otherwise codespell would complain:
  : github.com/spf13/viper v1.15.0
      h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
  > github.com/spf13/viper v1.15.0/go.mod
      h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
  : github.com/stretchr/objx v0.1.0/go.mod
      h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
  ./src/go.sum:384: KeT ==> key, kept

https://github.com/containers/toolbox/pull/1612
2025-01-27 14:51:32 +01:00
Debarshi Ray 8829db69c5 build: Bump github.com/spf13/viper to 1.14.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1612
2025-01-24 19:57:48 +01:00
Debarshi Ray 9c19e2d8f0 build: Bump github.com/spf13/viper to 1.13.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1612
2025-01-24 17:35:47 +01:00
Debarshi Ray 6400ff245d build: Bump github.com/spf13/viper to 1.12.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1612
2025-01-24 01:37:29 +01:00
Debarshi Ray 10e1544938 build: Bump github.com/spf13/viper to 1.11.0
The indirect dependencies in the src/go.mod file, and the src/go.sum
file were updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1612
2025-01-23 17:44:43 +01:00
Debarshi Ray 97ad50d303 build: Bump github.com/briandowns/spinner to 1.23.2
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1611
2025-01-23 17:39:42 +01:00
Debarshi Ray 8b62d7e95d .github/workflows, playbooks: Unbreak 'go mod download'
Currently, the CI is failing because 'go mod download' is encountering an
expired TLS certificate:
  $ go mod download
  go: github.com/spf13/viper@v1.10.1 requires
      go.opencensus.io@v0.23.0: unrecognized import path "go.opencensus.io":
        https fetch: Get "https://go.opencensus.io/?go-get=1": tls: failed to
        verify certificate: x509: certificate has expired or is not yet valid:
        current time 2025-01-23T17:00:16+01:00 is after 2025-01-21T03:43:04Z

Therefore, disable the TLS certificate check until the certificate gets
updated or the dependency gets removed [1].

[1] https://pkg.go.dev/cmd/go#hdr-Environment_variables

https://github.com/containers/toolbox/pull/1611
2025-01-23 17:39:42 +01:00
Debarshi Ray 4b61032711 build: Bump github.com/stretchr/testify to 1.10.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1610
2025-01-20 21:27:35 +01:00
Debarshi Ray 0bb4ff8b80 .zuul: Drop testing on Fedora 39
Fedora 39 reached End of Life on 26th November 2024:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1602
2024-12-09 18:47:05 +01:00
Debarshi Ray b378596b14 test/system: Try to handle /etc/resolv.conf on host as absolute symlink
Some Arch Linux hosts have /etc/resolv.conf as an absolute symbolic link
to /run/systemd/resolve/stub-resolv.conf, instead of being a relative
symbolic link to ../run/systemd/resolve/stub-resolv.conf or a regular
file.  eg., the images built by arch-boxes [1].

This changes the target that the Toolbx container's /etc/resolv.conf
points at and confuses the tests [2].

Ideally, these host operating systems should be fixed to use relative
symbolic links.  This is highlighted by skipping the tests, because
there's no point in failing them until that happens.

This is a step towards running the CI on Arch Linux.

[1] https://gitlab.archlinux.org/archlinux/arch-boxes
    https://geo.mirror.pkgbuild.com/images/latest/

[2] Commit 88a95b07af
    https://github.com/containers/toolbox/commit/88a95b07af335be2
    https://github.com/containers/toolbox/issues/187

https://github.com/containers/toolbox/issues/1438
2024-11-18 20:45:44 +01:00
Debarshi Ray f900585739 test/system: Enable 102-list.bats on Arch Linux
This is a step towards running the CI on Arch Linux.

https://github.com/containers/toolbox/issues/1438
2024-11-17 11:26:29 +01:00
Penn Bauman fead837404 test/system: Enable 101-create.bats on Arch Linux
This is a step towards running the CI on Arch Linux.

https://github.com/containers/toolbox/issues/1438
https://github.com/containers/toolbox/pull/1535
2024-11-17 11:26:29 +01:00
Penn Bauman e805291a10 test/system: Support host operating systems without VERSION_ID
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will run the CI on Arch Linux.  Hence, the code to
get the default release from the host operating system can no longer
assume the presence of the VERSION_ID field in os-release(5).

Note that the arch-toolbox image is tagged with 'latest', in accordance
with OCI conventions, not 'rolling' [2,3], which is the os-release(5)
BUILD_ID.

A similar change was made to toolbox(1) in commits 2ee82affeb and
d14fd7bb50.

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

[2] Commit 2568528cb7
    https://github.com/containers/toolbox/commit/2568528cb7f52663
    https://github.com/containers/toolbox/pull/861

[3] Commit a4e5861ae5
    https://github.com/containers/toolbox/commit/a4e5861ae5c93625
    https://github.com/containers/toolbox/pull/1308

https://github.com/containers/toolbox/issues/1438
https://github.com/containers/toolbox/pull/1535
2024-11-17 11:26:29 +01:00
Debarshi Ray d8ad631ae1 test/system: Check the line count in the standard error & output streams
https://github.com/containers/toolbox/pull/1596
2024-11-15 21:53:56 +01:00
Debarshi Ray 02648e61ea test/system: Fix typo
This wasn't negatively impacting the validity of the test, but it was
inconsistent with the pattern used elsewhere.

Fallout from 55c0e63786

https://github.com/containers/toolbox/pull/1596
2024-11-15 19:45:40 +01:00
Debarshi Ray d29adbf10e test/system: Ensure that error messages go to the standard error stream
Currently, there's no way to get assert_line to use the stderr_lines
array [1].  This is worked around by assigning stderr_lines to the
'lines' array.

[1] https://github.com/bats-core/bats-assert/issues/42

https://github.com/containers/toolbox/pull/1595
2024-11-15 18:54:38 +01:00
Debarshi Ray f97d524af4 test/system: Check whole lines instead of partials
https://github.com/containers/toolbox/pull/1595
2024-11-14 22:57:26 +01:00
Debarshi Ray adc8650660 test/system: Optimize the 'create' tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

In the case of these two particular tests, toolbox(1) is supposed to
validate the command line options before trying to find the image.  So,
there's no need to copy the image from the test suite's image cache
directory to its local container/storage store.

If the toolbox(1) code breaks, then either it won't throw the expected
error or it will download the image before validating the command line
options.  The first possibility will be easily detected.  The other
could have been harder to notice, but, fortunately, commit
55c0e63786 added variants of these tests without the --assumeyes
option and there are other tests to ensure that images cannot be
downloaded without that option.  So, any unexpected attempts to download
the image will be caught by those variants of these tests.

Fallout from 32b147b9ff

https://github.com/containers/toolbox/pull/1595
2024-11-14 22:55:42 +01:00
Debarshi Ray 91c539606a test/system: Remove unnecessary --assumeyes
It shouldn't be necessary to use the --assumeyes option when creating a
Toolbx container, if the corresponding image is already present in the
local containers/storage image store.  It's harmful to test it with the
option, even when it shouldn't be needed, because it's off by default
and most users won't enable it.

Therefore, it's better to test the most common scenario that most users
will encounter.

https://github.com/containers/toolbox/pull/1595
2024-11-14 12:43:26 +01:00
Debarshi Ray fbffd45384 playbooks, test/system: Drop the PODMAN and SKOPEO environment variables
The toolbox(1) binary always relies on the PATH environment variable to
find the podman(1) and skopeo(1) binaries.  There's no way to override
those with the PODMAN and SKOPEO environment variables, and they only
affect any direct use of podman(1) and skopeo(1) within the test suite.

Therefore, offering the PODMAN and SKOPEO environment variables in their
current form is needlessly confusing and misleading, and can lead to
surprises arising from different podman(1) and skopeo(1) binaries being
used in different places.  Either toolbox(1) should also honour them or
the test suite shouldn't offer them.  The former is more complicated
without any obvious need for it, so the latter was chosen.

https://github.com/containers/toolbox/pull/1592
2024-11-14 02:06:33 +01:00
Debarshi Ray c11a03ce37 playbooks: Use pkgconfig(bash-completion) to install bash-completion.pc
Unlike Fedora, where the package providing bash-completion.pc changed in
Fedora 41 onwards [1,2], it hasn't changed in CentOS Stream 9.  So, this
doesn't change the behaviour of the CI.

However, the Fedora Packaging Guidelines recommend using pkgconfig(...)
to depend on a *.pc file [3], instead of the name of the package, and
there has been a problem on Fedora caused by not doing that.  Therefore,
it's better to follow the guidelines for consistency and safety.

[1] Fedora bash-completion commit d1f5dc48c0440cc6
    https://src.fedoraproject.org/rpms/bash-completion/c/d1f5dc48c0440cc6
    https://bugzilla.redhat.com/show_bug.cgi?id=1457164

[2] Commit 204919917e
    https://github.com/containers/toolbox/commit/204919917e4af528

[3] https://docs.fedoraproject.org/en-US/packaging-guidelines/PkgConfigBuildRequires/

https://github.com/containers/toolbox/pull/1593
2024-11-14 01:20:00 +01:00
Debarshi Ray 204919917e playbooks: Restore the generation & installation of the Bash completions
The package providing /usr/share/pkgconfig/bash-completion.pc changed
from bash-completion to bash-completion-devel in Fedora 41 onwards [1].
This meant that the Bash completions were no longer being generated and
installed by the CI.

[1] Fedora bash-completion commit d1f5dc48c0440cc6
    https://src.fedoraproject.org/rpms/bash-completion/c/d1f5dc48c0440cc6
    https://bugzilla.redhat.com/show_bug.cgi?id=1457164

https://github.com/containers/toolbox/pull/1593
2024-11-12 23:09:38 +01:00
Debarshi Ray 05202bb35c test/system: Skip the test before doing any needless work
https://github.com/containers/toolbox/pull/1591
2024-11-12 01:35:36 +01:00
Debarshi Ray 9b1f7aa573 .github/workflows, test/system: Enable 102-list.bats on Ubuntu 22.04
https://github.com/containers/toolbox/pull/1591
2024-11-12 01:35:36 +01:00
Debarshi Ray b443428126 playbooks/dependencies-centos-9-stream: Show the Bash version
Fallout from 6626b11e15

https://github.com/containers/toolbox/pull/1587
2024-11-06 01:01:50 +01:00
Debarshi Ray bb2cda1db0 cmd/create: Replace deprecated github.com/briandowns/spinner API
A new API was added to github.com/briandowns/spinner 1.23.0 to deprecate
the io.Writer output in favour of a pointer to an os.File [1].  This new
API enables the spinner to automatically detect whether the output is
connected to a terminal or not, which is convenient.

Commit 944b3ac95f already bumped the required
github.com/briandowns/spinner version to 1.23.0, so take advantage of
that.

[1] github.com/briandowns/spinner commit 1445186377e2e283
    https://github.com/briandowns/spinner/commit/1445186377e2e283
    https://github.com/briandowns/spinner/issues/142

https://github.com/containers/toolbox/pull/1586
2024-11-01 23:48:04 +01:00
Debarshi Ray 38ca815f84 build: Bump github.com/briandowns/spinner to 1.23.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1585
2024-11-01 15:16:11 +01:00
Debarshi Ray 944b3ac95f build: Bump github.com/briandowns/spinner to 1.23.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1585
2024-11-01 14:05:45 +01:00
Debarshi Ray baab11e997 build: Bump github.com/briandowns/spinner to 1.22.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1585
2024-11-01 13:50:18 +01:00
Debarshi Ray fda91a240d build: Bump github.com/briandowns/spinner to 1.21.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1585
2024-11-01 13:46:03 +01:00
Debarshi Ray 930918073b build: Bump github.com/briandowns/spinner to 1.20.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1584
2024-11-01 13:25:43 +01:00
Debarshi Ray b8650a10c4 build: Bump github.com/briandowns/spinner to 1.19.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1584
2024-11-01 13:22:12 +01:00
Debarshi Ray aa6c7a3336 build: Bump github.com/briandowns/spinner to 1.18.1
Note that github.com/briandowns/spinner 1.18.1 introduced an undesired
dependency on github.com/mattn/go-isatty for the IsTerminal() API, which
was later removed in 1.23.1 [1].  Fewer dependencies are always good
because it reduces the amount of code in use.

Therefore, this is a step towards using github.com/briandowns/spinner
1.23.1.  Instead of bumping it straight to its final desired version,
doing it in smaller steps makes it easier to bisect any uncaught
regressions in future.

The src/go.sum file was updated with 'go mod tidy'.

[1] github.com/briandowns/spinner commit 8f269dd04fbfe236
    https://github.com/briandowns/spinner/commit/8f269dd04fbfe236
    https://github.com/briandowns/spinner/pull/156

https://github.com/containers/toolbox/pull/1584
2024-11-01 13:21:55 +01:00
Debarshi Ray 896b6b96b6 NEWS: Fix regression annotations
Fallout from b9ed02a283

https://github.com/containers/toolbox/pull/1583
2024-11-01 10:37:30 +01:00
Debarshi Ray b9ed02a283 Prepare 0.1.1
Now that Toolbx 0.1.0 has been released, it's a good time to revisit the
format of the release notes.

The release notes are now written in the past tense as suggested by the
Kubernetes guidelines [1].  They are broken down into different sections
to make it easier to understand the impact of the changes, with the
names of the sections loosely taken from projects like Flatpak [2].

[1] https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md

[2] https://github.com/flatpak/flatpak/blob/main/NEWS

https://github.com/containers/toolbox/pull/1581
2024-10-31 19:24:31 +01:00
dependabot[bot] f4324df383 build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.16.2
... for CVE-2024-0132 or GHSA-mjjw-553x-87pq, and CVE-2024-0133 or
GHSA-f748-7hpg-88ch.

https://github.com/containers/toolbox/pull/1579
https://github.com/containers/toolbox/security/dependabot/17
https://github.com/containers/toolbox/security/dependabot/18

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-29 22:39:26 +01:00
Debarshi Ray f98f3f5353 build: Bump golang.org/x/sys to 0.23.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1580
2024-10-29 22:35:01 +01:00
Jean-Baptiste Trystram 325cf696b5 cmd/initContainer: Unbreak 'enter' if NVIDIA Persistence Daemon is used
If the NVIDIA Persistence Daemon is used, then 'enter' fails with:
  $ sudo systemctl start nvidia-persistenced.service
  $ toolbox enter
  Error: mount: /run/nvidia-persistenced/socket: mount point does not exist.
         dmesg(1) may have more information after failed mount system call.
  failed to apply mount from Container Device Interface for NVIDIA

This is due to the socket at /run/nvidia-persistenced/socket being
listed in the Container Device Interface specification when the NVIDIA
Persistence Daemon is used.

Fallout from 6e848b250b

https://github.com/containers/toolbox/issues/1572
2024-10-29 13:01:49 +01:00
Debarshi Ray 201380fb44 pkg/nvidia: Unbreak 'enter' if proprietary driver is there but not used
If the proprietary NVIDIA driver is installed, particularly
libnvidia-ml.so.1, but the kernel driver is not being used, then 'enter'
fails with:
  $ toolbox enter
  Error: failed to initialize NVIDIA Management Library

This was tested on Fedora 39 Workstation with the proprietary NVIDIA
driver from RPM Fusion, which makes it possible to easily disable the
driver without uninstalling it [1].

Note that, with and without this change, there's a delay of a few
seconds inside nvmlInit() from the NVIDIA Management Library.

[1] https://rpmfusion.org/Howto/NVIDIA

https://github.com/containers/toolbox/issues/1573
2024-10-24 20:23:45 +02:00
Debarshi Ray d21f8e895c Prepare 0.1.0
https://github.com/containers/toolbox/pull/1570
2024-10-23 13:12:36 +02:00
Debarshi Ray 2bac22bc28 .zuul, playbooks: Optimize the CI on stable Fedora nodes
Currently, the runtime environment tests have been frequently timing out
on stable Fedora nodes.  Instead of taking the shortcut of increasing
the timeout, they were split by the Toolbx images they use, similar to
what already happens for Fedora Rawhide nodes [1].

[1] Commit 987f5e2592
    https://github.com/containers/toolbox/commit/987f5e259289b4b3
    https://github.com/containers/toolbox/pull/1551

https://github.com/containers/toolbox/pull/1571
2024-10-23 13:06:45 +02:00
Ievgen Popovych 1e9308625a workflows: ubuntu-images: Do not build 16.04 and 18.04
..since they are not updated anymore
(2 years and over 1 year respectively).

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2024-10-21 18:40:48 +03:00
Tom Reinders 3dadbfe517 workflows: ubuntu-images: Do not fail the workflow early
...if one of the releases fails, let other releases build and publish.

Signed-off-by: Tom Reinders <t.reinders@recognize.nl>
2024-10-21 18:40:48 +03:00
Tom Reinders 3496110fae images: ubuntu: 24.04: Fix missing `unminimize` script
`unminimize` has been moved to a dedicated package:
https://discourse.ubuntu.com/t/oracular-oriole-release-notes/44878#unminimize-33

Fixes: #1566
Signed-off-by: Tom Reinders <t.reinders@recognize.nl>
2024-10-21 13:06:10 +03:00
David Scholberg 67c487ec1a images: ubuntu: Add 24.10 interim, remove 23.10 (interim, EOL)
Signed-off-by: David Scholberg <recombinant.vector@gmail.com>
2024-10-21 11:11:28 +03:00
Debarshi Ray ed14cd483a Revert "playbooks, test/system: Work around bug in pasta(1) networks"
The bug in pasta(1) that necessitated this workaround has since been
fixed in passt 2024_05_10.7288448 [1].  Some host operating systems like
CentOS Stream 10 no longer have slirp4netns(1), and it's generally
better to test the defaults.

This reverts commit b58f9a5108.

[1] https://github.com/containers/podman/issues/22575
    https://archives.passt.top/passt-dev/20240508090338.2735208-1-sbrivio@redhat.com/
    https://archives.passt.top/passt-user/20240510225714.6aa8e6c0@elisabeth/

https://github.com/containers/toolbox/pull/1562
2024-10-04 22:17:50 +02:00
Debarshi Ray b524f4cebd pkg/utils: Update fallback release to 40 for non-fedora hosts
Fedora 38 reached End of Life on 21st May 2024:
https://docs.fedoraproject.org/en-US/releases/eol/

https://bugzilla.redhat.com/show_bug.cgi?id=2316312
https://github.com/containers/toolbox/pull/1561
2024-10-03 22:10:26 +02:00
Debarshi Ray 1e90c72185 test/system: Unbreak the downstream Fedora CI
The working directory from which bats(1) is invoked might not be part of
the Toolbx container.  eg., the downstream Fedora CI invokes the tests
as:
  $ cd /path/to/toolbox/test/system
  $ bats .

... and it led to:
  not ok 8 help: Try unknown command (forwarded to host)
  # tags: commands-options
  # (from function `assert_line' in file
      ./libs/bats-assert/src/assert.bash, line 488,
  #  in test file ./002-help.bats, line 135)
  #   `assert_line --index 0
        "Error: unknown command \"foo\" for \"toolbox\""' failed
  #
  # -- line differs --
  # index    : 0
  # expected : Error: unknown command "foo" for "toolbox"
  # actual   : Error: crun: chdir to `/usr/share/toolbox/test/system`:
      No such file or directory: OCI runtime attempted to invoke a
      command that was not found
  # --
  #

https://github.com/containers/toolbox/pull/1560
2024-10-02 22:52:01 +02:00
Debarshi Ray 57a4b49d4f Prepare 0.0.99.6
https://github.com/containers/toolbox/pull/1556
2024-09-30 12:29:55 +02:00
Debarshi Ray 13546e45b6 build: Exclude the meson.build files when installing the system tests
... because they serve no purpose.

https://github.com/containers/toolbox/pull/1557
2024-09-30 01:26:21 +02:00
Debarshi Ray 1d943b6c2a build: Remove files duplicated in the list of directories
Fallout from 2594199fef

https://github.com/containers/toolbox/pull/1557
2024-09-30 01:23:10 +02:00
Debarshi Ray 5eb3e85134 pkg/nvidia: Clean up NVIDIA Management Library when no longer in use
The NVIDIA Management Library API expects nvmlShutdown() to be called
once it's no longer in use [1].

Fallout from 8dd2f8e80a

[1] https://docs.nvidia.com/deploy/nvml-api/group__nvmlInitializationAndCleanup.html

https://github.com/containers/toolbox/pull/1555
2024-09-29 23:04:00 +02:00
Jordan Petridis 1d6b0b9136 profile.d: Add whitespace padding to the PS1
Add an extra space after the ⬢ so things are less smooshed together.

https://github.com/containers/toolbox/pull/1542
2024-09-29 13:25:31 +02:00
Ruilong Wu d7bafb82ed build: Make it build on loongarch64
Go 1.19 added support for 64-bit LoongArch on Linux (GOOS=linux,
GOARCH=loong64) [1], and the path of the dynamic linker (ie., PT_INTERP)
was taken from the ABI specification [2].

Tested by the Debian loong64 port [3].

[1] https://tip.golang.org/doc/go1.19#loong64

[2] https://sourceware.org/glibc/wiki/ABIList

[3] https://buildd.debian.org/status/fetch.php?pkg=golang-github-containers-toolbox&arch=loong64&ver=0.0.99.3%2Bgit20230118%2B446d7bfdef6a-2.1&stamp=1722443115

https://github.com/containers/toolbox/pull/1523
2024-09-28 13:12:52 +02:00
Debarshi Ray fb9e2e7ade test/system: Optimize the resource limits tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The runtime environment tests, which includes the resource limit tests,
are particularly slow because they don't skip the I/O even when testing
error handling.  This makes them a good target for optimizations.

The resource limit tests query the values for different resources from
the same default container without changing its state.  Therefore, a lot
of disk I/O can be avoided by creating the default container only once
for all the tests.

This can save even 30 minutes.

https://github.com/containers/toolbox/pull/1552
2024-09-28 01:32:12 +02:00
Debarshi Ray 987f5e2592 .zuul, playbooks, test/system: Optimize the CI on Fedora nodes
The test suite has expanded to 415 system tests.  These tests can be
very I/O intensive, because many of them copy OCI images from the test
suite's image cache directory to its local container/storage store,
create containers, and then delete everything to run the next test with
a clean slate.  This makes the system tests slow.

Unfortunately, Zuul's max-job-timeout setting defaults to an upper limit
of 3 hours or 10800 seconds for jobs [1], and this is what Software
Factory uses [2].  So, there comes a point beyond which the CI can't be
prevented from timing out by increasing the timeout.

One way of scaling past this maximum time limit is to run the tests in
parallel across multiple nodes.  This has been implemented by splitting
the system tests into different groups, which are run separately by
different nodes.

First, the tests were grouped into those that test commands and options
accepted by the toolbox(1) binary, and those that test the runtime
environment within the Toolbx containers.  The first group has more
tests, but runs faster, because many of them test error handling and
don't do much I/O.

The runtime environment tests take especially long on Fedora Rawhide
nodes, which are often slower than the stable Fedora nodes.  Possibly
because Rawhide uses Linux kernels that are built with debugging
enabled, which makes it slower.  Therefore, this group of tests were
further split for Rawhide nodes by the Toolbx images they use.  Apart
from reducing the number of tests in each group, this should also reduce
the amount of time spent in downloading the images.

The split has been implemented with Bats' tagging system that is
available from Bats 1.8.0 [3].  Fortunately, commit 87eaeea6f0
already added a dependency on Bats >= 1.10.0.  So, there's nothing to
worry about.

At the moment, Bats doesn't expose the tags being used to run the test
suite to setup_suite() and teardown_suite() [4].  Therefore, the
TOOLBX_TEST_SYSTEM_TAGS environment variable was used to optimize the
contents of setup_suite().

[1] https://zuul-ci.org/docs/zuul/latest/tenants.html

[2] Commit 83f28c52e4
    https://github.com/containers/toolbox/commit/83f28c52e47c2d44
    https://github.com/containers/toolbox/pull/1548

[3] https://bats-core.readthedocs.io/en/stable/writing-tests.html

[4] https://github.com/bats-core/bats-core/issues/1006

https://github.com/containers/toolbox/pull/1551
2024-09-28 01:28:58 +02:00
Debarshi Ray e435704d4a test/system: Simplify line count checks by using Bats >= 1.10.0
Commit 87eaeea6f0 already added a dependency on Bats >= 1.10.0,
which is present on Fedora >= 39.  Therefore, it should be exploited
wherever possible to simplify things.

https://github.com/containers/toolbox/pull/1551
2024-09-27 12:50:16 +02:00
Debarshi Ray cb98871f16 playbooks/system-test: Remove Bats' timing information
They haven't been of any use lately, and they do add some extra noise to
each line in the CI logs.

https://github.com/containers/toolbox/pull/1551
2024-09-26 22:41:48 +02:00
Debarshi Ray 679bf87eb9 .zuul: Enable testing on Fedora 41
https://github.com/containers/toolbox/pull/1550
2024-09-26 21:20:13 +02:00
Debarshi Ray 861cf8546e doc/toolbox: Clarify that Toolbx isn't a security mechanism
Using the word 'containerized' gives the false impression of heightened
security.  As if it's a mechanism to run untrusted software in a
sandboxed environment without access to the user's private data (such as
$HOME), hardware peripherals (such as cameras and microphones), etc..
That's not what Toolbx is for.

Toolbx aims to offer an interactive command line environment for
development and troubleshooting the host operating system, without
having to install software on the host.  That's all.  It makes no
promise about security beyond what's already available in the usual
command line environment on the host that everybody is familiar with.

https://github.com/containers/toolbox/issues/1020
2024-09-26 21:19:26 +02:00
Debarshi Ray ebf693394a doc/toolbox: Tweak
Mention that Toolbx is meant for system administrators to troubleshoot
the host operating system.  The word 'debugging' is often used in the
context of software development, and hence most readers might not
interpret it as 'troubleshooting'.

https://github.com/containers/toolbox/pull/1549
2024-09-26 21:19:26 +02:00
Debarshi Ray d731d8f087 cmd, doc, test/system: Synchronize the summary with the code repository
https://github.com/containers/toolbox/pull/1549
2024-09-26 21:18:31 +02:00
Debarshi Ray 85bed43a40 images/fedora/f39: Synchronize README.md
Only the images for currently maintained Fedoras (ie., 39) were updated.

https://github.com/containers/toolbox/pull/1549
2024-09-26 19:33:55 +02:00
Debarshi Ray 2eccaf8211 README.md, images/fedora/f39: Tweak
Use 'software development' instead of just 'development' when
introducing Toolbx.  The additional context makes it more understandable
to the reader.

https://github.com/containers/toolbox/pull/1549
2024-09-26 19:33:52 +02:00
Debarshi Ray 66280a617a build: Use the same linker flags as NVIDIA Container Toolkit
The previous commit explains how the NVIDIA Container Toolkit is
sensitive to some linker flags.  Therefore, use the same linker flags
that are used by NVIDIA Container Toolkit to build the nvidia-cdi-hook,
nvidia-ctk, etc. binaries, because they use the same Go APIs that
toolbox(1) does [1].  It's better to use the same build configuration to
prevent subtle bugs from creeping in.

[1] NVIDIA Container Toolkit commit 772cf77dcc2347ce
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/772cf77dcc2347ce
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/333

https://github.com/containers/toolbox/pull/1548
2024-09-26 18:54:20 +02:00
Debarshi Ray 83f28c52e4 build: Notify distributors that the '-z now' linker flag is unsupported
The '-z now' flag, which is the opposite of '-z lazy', is unsupported as
an external linker flag [1], because of how the NVIDIA Container Toolkit
stack uses dlopen(3) to load libcuda.so.1 and libnvidia-ml.so.1 at
runtime [2,3].

The NVIDIA Container Toolkit stack doesn't use dlsym(3) to obtain the
address of a symbol at runtime before using it.  It links against
undefined symbols at build-time available through a CUDA API definition
embedded directly in the CGO code or a copy of nvml.h.  It relies upon
lazily deferring function call resolution to the point when dlopen(3) is
able to load the shared libraries at runtime, instead of doing it when
toolbox(1) is started.

This is unlike how Toolbx itself uses dlopen(3) and dlsym(3) to load
libsubid.so at runtime.

Compare the output of:
  $ nm /path/to/toolbox | grep ' subid_init'

... with those from:
  $ nm /path/to/toolbox | grep ' nvmlGpuInstanceGetComputeInstanceProfileInfoV'
          U nvmlGpuInstanceGetComputeInstanceProfileInfoV
  $ nm /path/to/toolbox | grep ' nvmlDeviceGetAccountingPids'
          U nvmlDeviceGetAccountingPids

Using '-z now' as an external linker flag forces the dynamic linker to
resolve all symbols when toolbox(1) is started, and leads to:
  $ toolbox
  toolbox: symbol lookup error: toolbox: undefined symbol:
      nvmlGpuInstanceGetComputeInstanceProfileInfoV

With the recent expansion of the test suite, it's necessary to increase
the timeout for the Fedora nodes to prevent the CI from timing out.

Fallout from 6e848b250b

[1] NVIDIA Container Toolkit commit 1407ace94ab7c150
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/1407ace94ab7c150
    https://github.com/NVIDIA/go-nvml/issues/18
    https://github.com/NVIDIA/nvidia-container-toolkit/issues/49

[2] https://github.com/NVIDIA/nvidia-container-toolkit/tree/main/internal/cuda

[3] https://github.com/NVIDIA/go-nvml/blob/main/README.md
    https://github.com/NVIDIA/go-nvml/tree/main/pkg/dl
    https://github.com/NVIDIA/go-nvml/tree/main/pkg/nvml

https://github.com/containers/toolbox/pull/1548
2024-09-26 18:53:33 +02:00
Debarshi Ray dd23baa29a cmd/initContainer, test/system: Handle NVIDIA's create-symlinks CDI hook
NVIDIA Container Toolkit 0.16.0 started using create-symlinks hooks in
the Container Device Interface specification generated by it [1].  For
example:
  "hookName": "createContainer",
  "path": "/usr/bin/nvidia-cdi-hook",
  "args": [
    "nvidia-cdi-hook",
    "create-symlinks",
    "--link",
    "libnvidia-allocator.so.560.35.03::/usr/lib64/libnvidia-allocator.so.1",
    "--link",
    "../libnvidia-allocator.so.1::/usr/lib64/gbm/nvidia-drm_gbm.so"
  ]

Fallout from 649d02f8a6

[1] NVIDIA Container Toolkit commit aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/548

https://github.com/containers/toolbox/pull/1545
2024-09-20 17:17:17 +02:00
Debarshi Ray c399243b46 cmd/initContainer: Shuffle some code around
The following commit will handle create-symlinks hooks in the Container
Device Interface specification for the proprietary NVIDIA driver,
because NVIDIA Container Toolkit 0.16.0 started using those [1].  So,
make some space for the new code.

This will make the following commit easier to read.

Fallout from 649d02f8a6

[1] NVIDIA Container Toolkit commit aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/548

https://github.com/containers/toolbox/pull/1545
2024-09-19 13:59:44 +02:00
Debarshi Ray f2dc3b8f63 .zuul, test/system: Simplify line count checks by using Bats >= 1.10.0
Commit 87eaeea6f0 already added a dependency on Bats >= 1.10.0,
which is present on Fedora >= 39.  Therefore, it should be exploited
wherever possible to simplify things.

Currently, the CI has been frequently timing out on stable Fedora nodes.
So, increase the timeout from 1 hour 50 minutes to 2 hours to avoid
that.

For what it's worth, the timeout for Fedora Rawhide nodes is 2 hours 10
minutes and it seems enough.

https://github.com/containers/toolbox/pull/1546
2024-09-19 13:55:55 +02:00
Debarshi Ray 9a87d15188 cmd/initContainer: Unbreak application of CDI hooks for NVIDIA
NVIDIA Container Toolkit 0.16.0 changed the hook arguments in the
Container Device Interface specification generated by it [1].

Fallout from 649d02f8a6

[1] NVIDIA Container Toolkit commit 179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/issues/435

https://github.com/containers/toolbox/pull/1544
2024-09-17 15:18:45 +02:00
Debarshi Ray c386a442f7 cmd/initContainer: Log unknown Container Device Interface hook arguments
NVIDIA Container Toolkit 0.16.0 changed the hook arguments in the
Container Device Interface specification generated by it [1].  Having
the unknown hook arguments show up in the debug logs makes it easier to
understand what happened.

[1] NVIDIA Container Toolkit commit 179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/issues/435

https://github.com/containers/toolbox/pull/1543
2024-09-17 14:12:21 +02:00
Debarshi Ray bd19633a87 cmd/initContainer: Simplify code
Fallout from 6e848b250b

https://github.com/containers/toolbox/pull/1543
2024-09-17 14:12:14 +02:00
Debarshi Ray 8dd2f8e80a cmd/run, pkg/nvidia: Detect mismatched NVIDIA kernel & user space driver
The proprietary NVIDIA driver has a kernel space part and a user space
part, and they must always have the same matching version.  Sometimes,
the host operating system might end up with mismatched parts.  One
reason could be that the different third-party repositories used to
distribute the driver might be incompatible with each other.  eg., in
the case of Fedora it could be RPM Fusion and NVIDIA's own repository.

This shows up in the systemd journal as:
  $ journalctl --dmesg
  ...
  kernel: NVRM: API mismatch: the client has the version 555.58.02, but
          NVRM: this kernel module has the version 560.35.03.  Please
          NVRM: make sure that this kernel module and all NVIDIA driver
          NVRM: components have the same version.
  ...

Without any special handling of this scenario, users would be presented
with a very misleading error:
  $ toolbox enter
  Error: failed to get Container Device Interface containerEdits for
      NVIDIA

Instead, improve the error message to be more self-documenting:
  $ toolbox enter
  Error: the proprietary NVIDIA driver's kernel and user space don't
      match
  Check the host operating system and systemd journal.

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Debarshi Ray 977c3d98a4 pkg/nvidia: Tweak a debug log to avoid an abbreviation
It's better to avoid abbreviations when the length of the string and the
depth of the indentation are favourable.

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Debarshi Ray 09dcdb492a pkg/nvidia: Share the Logrus logger with the info.Interface
A new API was added to github.com/NVIDIA/go-nvlib 0.4.0 to specify a
logger to be used by a info.Interface [1].  Commit 649d02f8a6
already bumped the required go-nvlib version to 0.6.0, so take advantage
of that.

[1] github.com/NVIDIA/go-nvlib commit 21c8f035ca66b29d
    https://github.com/NVIDIA/go-nvlib/commit/21c8f035ca66b29d
    https://github.com/NVIDIA/go-nvlib/pull/28

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Debarshi Ray ce7a0d4ce2 pkg/nvidia: Avoid creating an info.Interface with the nvcdi.Interface
NVIDIA Container Toolkit 0.16.0 added a new API to avoid creating a new
info.Interface when creating a nvcdi.Interface, if an info.Interface
already exists [1].  Commit 649d02f8a6 already bumped the required
NVIDIA Container Toolkit version to 0.16.0, so take advantage of that.

[1] NVIDIA Container Toolkit commit 8fc4b9c742f894ef
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/8fc4b9c742f894ef
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/516

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Amber Connelly dcd4c4382c Add man pages and progress bars to Arch Linux image
Signed-off-by: Amber Connelly <113668892+ac-z@users.noreply.github.com>
2024-09-14 12:10:28 +02:00
Debarshi Ray a653325279 build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.16.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1540
2024-09-11 13:48:54 +02:00
Debarshi Ray fd5fd49ebf build: Bump github.com/NVIDIA/go-nvlib to 0.6.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1540
2024-09-11 00:39:23 +02:00
Debarshi Ray 649d02f8a6 build: Bump go-nvlib to 0.6.0 and nvidia-container-toolkit to 1.16.0
Note that github.com/NVIDIA/go-nvlib > 0.2.0 isn't API compatible with
github.com/NVIDIA/nvidia-container-toolkit 1.15.0.  The next release of
nvidia-container-toolkit is 1.16.0 and it requires go-nvlib 0.6.0.

Therefore, these two Go modules need to be updated together.

The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1540
2024-09-10 23:51:25 +02:00
Debarshi Ray a8dd3c691c build: Bump golang.org/x/sys to 0.22.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1539
2024-09-10 23:37:30 +02:00
Debarshi Ray 9196dd6925 build: Bump golang.org/x/sys to 0.21.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1539
2024-09-10 23:14:54 +02:00
Debarshi Ray 3ef85e1c78 build: Bump golang.org/x/sys to 0.20.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1539
2024-09-10 22:32:25 +02:00
Debarshi Ray 369781a6d6 test/system: Test attempts to create the same container twice
https://github.com/containers/toolbox/issues/957
2024-09-10 21:17:38 +02:00
Debarshi Ray 26a76f2d7f cmd/run, test/system: Handle exit code 127 in 'run' from forwarded call
When 'toolbox run' is invoked on the host, an exit code of 127 from
'podman exec' means either that the specified command couldn't be found
or that the working directory didn't exist.  The only way to tell these
two scenarios apart is to actually look inside the container.

Secondly, Toolbx containers always have an executable toolbox(1) binary
at /usr/bin/toolbox and it's assumed that /usr/bin is always part of the
PATH environment variable.

When 'toolbox run toolbox ...' is invoked, the inner toolbox(1)
invocation will be forwarded back to the host by the Toolbx container's
/usr/bin/toolbox, which is always present as an executable.  Hence, if
the outer 'podman exec' on the host fails with an exit code of 127,
then it doesn't mean that the container didn't have a toolbox(1)
executable, but that some subordinate process started by the container's
toolbox(1) failed with that exit code.

Therefore, handle this as a special case to avoid losing the exit code.
Otherwise, it leads to:
  $ toolbox run toolbox run non-existent-command
  bash: line 1: exec: non-existent-command: not found
  Error: command non-existent-command not found in container
      fedora-toolbox-40
  $ echo "$?"
  0

Instead, it will now be:
  $ toolbox run toolbox run non-existent-command
  bash: line 1: exec: non-existent-command: not found
  Error: command non-existent-command not found in container
      fedora-toolbox-40
  $ echo "$?"
  127

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 20:35:48 +02:00
Debarshi Ray 1a88195729 cmd/run, test/system: Handle exit code 126 in 'run' from forwarded call
When 'toolbox run' is invoked on the host, an exit code of 126 from
'podman exec' means that the specified command couldn't be invoked
because it's not an executable.  eg., the command was actually a
directory.  Note that this doesn't mean that the command couldn't be
found.  That's denoted by exit code 127.

Secondly, Toolbx containers always have an executable toolbox(1) binary
at /usr/bin/toolbox and it's assumed that /usr/bin is always part of the
PATH environment variable.

When 'toolbox run toolbox ...' is invoked, the inner toolbox(1)
invocation will be forwarded back to the host by the Toolbx container's
/usr/bin/toolbox, which is always present as an executable.  Hence, if
the outer 'podman exec' on the host fails with an exit code of 126,
then it doesn't mean that the container didn't have a working toolbox(1)
executable, but that some subordinate process started by the container's
toolbox(1) failed with that exit code.

Therefore, handle this as a special case to avoid showing an extra error
message.  Otherwise, it leads to:
  $ toolbox run toolbox run /etc
  bash: line 1: /etc: Is a directory
  bash: line 1: exec: /etc: cannot execute: Is a directory
  Error: failed to invoke command /etc in container fedora-toolbox-40
  Error: failed to invoke command toolbox in container fedora-toolbox-40
  $ echo "$?"
  126

Instead, it will now be:
  $ toolbox run toolbox run /etc
  bash: line 1: /etc: Is a directory
  bash: line 1: exec: /etc: cannot execute: Is a directory
  Error: failed to invoke command /etc in container fedora-toolbox-40
  $ echo "$?"
  126

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 20:32:10 +02:00
Debarshi Ray 3ad77e6b2d cmd/run: Re-align
The lines were getting too wide to fit within a vertical 1080x1920
display.  Therefore, restrict them to 120 characters per line.

Fallout from f8e21a31b3

https://github.com/containers/toolbox/pull/1534
2024-09-09 18:26:40 +02:00
Debarshi Ray ca8e62ecf2 pkg/utils, test/system: Test podman(1) invocations forwarded to the host
The test suite uses its own separate local container/storage store to
isolate itself from the default store, so that the tests' interactions
with containers and images don't affect anything else.  This is done by
using the CONTAINERS_STORAGE_CONF environment variable [1] to specify a
separate storage.conf(5) file [2].

Therefore, when running the test suite, the CONTAINERS_STORAGE_CONF
environment variable must be preserved when forwarding toolbox(1)
invocations inside containers to the host.  Otherwise, the initial
toolbox(1) invocation on the host and the forwarded invocation running
on the host won't use the same local container/storage store.

This problem only impacts test cases that cover toolbox(1) code paths
that invoke podman(1).

[1] https://docs.podman.io/en/latest/markdown/podman.1.html

[2] https://manpages.debian.org/testing/containers-storage/containers-storage.conf.5.en.html

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 15:20:57 +02:00
Ondřej Míchal fa2466029d cmd, test/system: Retain exit codes when forwarding to host
Some changes by Debarshi Ray.

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 14:10:31 +02:00
Debarshi Ray 1a3f4ff4c6 test/system: Tweak a name
https://github.com/containers/toolbox/pull/1534
2024-09-06 17:05:50 +02:00
Debarshi Ray d287588f3d cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones
This will make it easier to propagate the exit codes of subordinate
processes through an exitError instance, when toolbox(1) is invoked
inside a container, and invocation is forwarded to the host.

Cobra doesn't honour the root command's SilenceErrors, if an error
occurred when parsing the command line for a command, even though the
command was found.  However, Cobra does honour SilenceErrors, if the
error occurred afterwards.

Therefore, to avoid setting SilenceErrors in each and every command, it
was set in the PersistentPreRunE hook (ie., preRun), which is called
after all command line parsing has been successfully completed.

https://github.com/containers/toolbox/issues/957
2024-09-05 21:27:53 +02:00
Debarshi Ray ee90bc957b cmd/root: Mark a private member as such
https://github.com/containers/toolbox/pull/1533
2024-09-05 21:27:53 +02:00
Debarshi Ray 76a8508019 test/system: Test the output messages when a container is created
https://github.com/containers/toolbox/pull/1536
2024-09-05 21:25:38 +02:00
Debarshi Ray c6a1de3eee test/system: Remove unnecessary --assumeyes
It shouldn't be necessary to use the --assumeyes option when creating a
Toolbx container, if the corresponding image is already present in the
local containers/storage image store.  It's harmful to test it with the
option, even when it shouldn't be needed, because it's off by default
and most users won't enable it.

Therefore, it's better to test the most common scenario that most users
will encounter.

https://github.com/containers/toolbox/pull/1536
2024-09-05 16:36:39 +02:00
Debarshi Ray 983beb1352 test/system: Test attempts to create the same container twice
https://github.com/containers/toolbox/pull/1536
2024-09-05 14:51:30 +02:00
Ondřej Míchal 62fcc093e7 pkg/utils, test/system: Retain errors without -v when forwarding to host
https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-03 16:41:29 +02:00
Debarshi Ray 87eaeea6f0 test/system: Simplify the line count checks by relying on Bats >= 1.10.0
Fedoras 37 and 38 didn't have Bats 1.10.0.  However, they reached End of
Life on 15th November 2023 and 21st May 2024 respectively, and were
dropped from the CI [1,2].  Fedora 39 is the oldest supported Fedora and
it has Bats 1.10.0.

Therefore, there's no need to retain compatibility with Bats < 1.10.0.

[1] Commit 9c2b5e9a4b
    https://github.com/containers/toolbox/pull/1418

[2] Commit b684b190d1
    https://github.com/containers/toolbox/pull/1527

https://github.com/containers/toolbox/pull/1532
2024-09-03 12:08:10 +02:00
Ondřej Míchal c8c9e95ed0 test/system: Test that CLI errors are shown inside Toolbx containers
https://github.com/containers/toolbox/pull/1525
2024-08-30 18:44:28 +02:00
Debarshi Ray 67d40024ce test/system: Consolidate teardown() to remove both containers & images
It's far more consistent and understandable if all tests start with a
clean state without any containers or images present.  Otherwise, the
subtle side-effects of having some image left behind from a previous
test can lead to surprises, and there's no need to spend time wondering
whether some tests should only clean up the containers or both
containers and images.

This additional work of cleaning up the images for all tests makes it
necessary to increase the timeout for all Fedora nodes to prevent the CI
from timing out.

https://github.com/containers/toolbox/pull/1526
2024-08-29 21:13:44 +02:00
Debarshi Ray 3f359f3edd build: Bump tags.cncf.io/container-device-interface to v0.8.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1529
2024-08-29 19:43:01 +02:00
Debarshi Ray dc839ccf64 build: Bump tags.cncf.io/container-device-interface to v0.7.2
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1529
2024-08-29 19:02:44 +02:00
Debarshi Ray b684b190d1 .zuul: Drop testing on Fedora 38
Fedora 38 reached End of Life on 21st May 2024:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1527
2024-08-15 00:10:26 +02:00
Debarshi Ray 18d47d1fee test/system: Replace the RHEL toolbox:8.9 image with toolbox:8.10
Red Hat Enterprise Linux 8.9 reached End of Life when RHEL 8.10 was
released on 22nd May 2024:
https://access.redhat.com/articles/3078
https://access.redhat.com/support/policy/updates/errata

For what it's worth, RHEL 8's full support phase ended on the 31st of
May 2024 and it wil be in maintenance support, as RHEL 8.10, until the
corresponding day in 2029.

https://github.com/containers/toolbox/pull/1522
2024-07-31 18:03:23 +02:00
Debarshi Ray cb6eee85ef README.md: Add GitHub star history chart
... from https://star-history.com/.

https://github.com/containers/toolbox/pull/1511
2024-06-18 09:59:46 +02:00
Debarshi Ray 6e848b250b cmd, pkg/nvidia: Enable the proprietary NVIDIA driver
This uses the NVIDIA Container Toolkit [1] to generate a Container
Device Interface specification [2] on the host during the 'enter' and
'run' commands.  The specification is saved as JSON in the runtime
directories at /run/toolbox or $XDG_RUNTIME_DIR/toolbox to make it
available to the Toolbx container's entry point.  The environment
variables in the specification are directly passed to 'podman exec',
while the hooks and mounts are handled by the entry point.

Toolbx containers already have access to all the devices in the host
operating system's /dev, and containers share the kernel space driver
with the host.  So, this is only about making the user space driver
available to the container.  It's done by bind mounting the files
mentioned in the generated CDI specification from the host to the
container, and then updating the container's dynamic linker cache.

This neither depends on 'nvidia-ctk cdi generate' to generate the
Container Device Interface specification nor on 'podman create --device'
to consume it.

The main problem with nvidia-ctk and 'podman create' is that the
specification must be saved in /etc/cdi or /var/run/cdi, both of which
require root access, for it to be visible to 'podman create --device'.
Toolbx containers are often used rootless, so requiring root privileges
for hardware support, something that's not necessary on the host, will
be a problem.

Secondly, updating the toolbox(1) binary won't let existing containers
use the proprietary NVIDIA driver, because 'podman create' only affects
new containers.

Therefore, toolbox(1) uses the Go APIs used by 'nvidia-ctk cdi generate'
and 'podman create --device' to generate, save, load and apply the CDI
specification itself.  This removes the need for root privileges due to
/etc/cdi or /var/run/cdi, and makes the driver available to existing
containers.

Until Bats 1.10.0, 'run --keep-empty-lines' had a bug where it counted
the trailing newline on the last line as a separate line [3].  However,
Bats 1.10.0 is only available in Fedora >= 39 and is absent from Fedora
38.

Based on an idea from Ievgen Popovych.

[1] https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/
    https://github.com/NVIDIA/nvidia-container-toolkit

[2] https://github.com/cncf-tags/container-device-interface

[3] Bats commit 6648e2143bffb933
    https://github.com/bats-core/bats-core/commit/6648e2143bffb933
    https://github.com/bats-core/bats-core/issues/708

https://github.com/containers/toolbox/issues/116
2024-06-12 18:01:52 +02:00
Debarshi Ray ef98adbb7a playbooks: Avoid using potentially broken DNF5
The Zuul executor got updated from Ansible 2.13.7 to 2.15.10, which now
has support for DNF5 [1] and the previous DNF5 Change [2] for Fedora 39
is now aiming at Fedora 41 (and Rawhide) [3].  Unfortunately, Ansible's
'dnf5' module is still under development and doesn't seem to match the
state of DNF5 in Fedora Rawhide, which causes:
  TASK [Install RPM packages]
  fedora-rawhide | ERROR
  fedora-rawhide | {
  fedora-rawhide |   "failures": [],
  fedora-rawhide |   "msg": "Could not import the libdnf5 python module
      using /usr/bin/python3 (3.12.3 (main, Apr 17 2024, 00:00:00) [GCC
      14.0.1 20240411 (Red Hat 14.0.1-0)]). Please install
      python3-libdnf5 package or ensure you have specified the correct
      ansible_python_interpreter. (attempted
      ['/usr/libexec/platform-python', '/usr/bin/python3',
      '/usr/bin/python2', '/usr/bin/python'])"
  fedora-rawhide | }

Trying to explicitly install python3-libdnf5, as suggested above, using
Ansible's 'command' module before using the 'package' module to install
the Toolbx dependencies, still ends up with:
  TASK [Install RPM packages]
  fedora-rawhide | MODULE FAILURE:
  fedora-rawhide | Traceback (most recent call last):
  fedora-rawhide |   File "<stdin>", line 107, in <module>
  fedora-rawhide |   File "<stdin>", line 99, in _ansiballz_main
  fedora-rawhide |   File "<stdin>", line 47, in invoke_module
  fedora-rawhide |   File "<frozen runpy>", line 226, in run_module
  fedora-rawhide |   File "<frozen runpy>", line 98, in _run_module_code
  fedora-rawhide |   File "<frozen runpy>", line 88, in _run_code
  fedora-rawhide |   File "/tmp/ansible_ansible.legacy.dnf5_payload_kecazv78/ansible_ansible.legacy.dnf5_payload.zip/ansible/modules/dnf5.py",
      line 708, in <module>
  fedora-rawhide |   File "/tmp/ansible_ansible.legacy.dnf5_payload_kecazv78/ansible_ansible.legacy.dnf5_payload.zip/ansible/modules/dnf5.py",
      line 704, in main
  fedora-rawhide |   File "/tmp/ansible_ansible.legacy.dnf5_payload_kecazv78/ansible_ansible.legacy.dnf5_payload.zip/ansible/modules/dnf5.py",
      line 487, in run
  fedora-rawhide | AttributeError: 'Base' object has no attribute
      'load_config_from_file'

Therefore, force the use of DNF4 when an Ansible job is being attempted
more than once [4].

[1] Ansible commit a81b787a05100986
    https://github.com/ansible/ansible/commit/a81b787a05100986
    https://github.com/ansible/ansible/issues/78898

[2] https://fedoraproject.org/wiki/Changes/ReplaceDnfWithDnf5

[3] https://fedoraproject.org/wiki/Changes/SwitchToDnf5

[4] https://zuul-ci.org/docs/zuul/latest/job-content.html#var-zuul.attempts

https://github.com/containers/toolbox/pull/1509
2024-06-12 00:16:48 +02:00
Debarshi Ray d9cdfe80d9 cmd/create, cmd/root: Style fixes
https://github.com/containers/toolbox/pull/1508
2024-06-10 22:29:48 +02:00
Debarshi Ray 91a019bef6 cmd/initContainer: Prevent passwd(1) from confusing the log parser
When a Toolbx container is started for the first time and the entry
point invokes 'passwd --delete root' to actually remove the password for
root, passwd(1) writes the following to its standard error stream:
  passwd: Note: deleting a password also unlocks the password.

This doesn't happen when the same container is stopped and started once
again.

Since, passwd(1) directly writes to its standard error stream without
going through Logrus, the corresponding log entry in 'podman logs'
doesn't have a 'level' key, and is assumed by the log parser in the
'enter' and 'run' commands to be an error.  If the entry point doesn't
actually encounter an error, then this confusion doesn't have any
user-visible effect.  However, if the entry point does encounter an
error after this point, then the message from passwd(1) gets prepended
to it and presented to the user:
  $ toolbox enter
  Error: passwd: Note: deleting a password also unlocks the password.
  failed to set KCM as the default Kerberos credential cache

Prevent this by intercepting the standard error stream of passwd(1) and
make it go through Logrus when passwd(1) fails.  Losing this particular
message when passwd(1) actually succeeds in removing the password is not
a big problem, because it's somewhat redundant.

Fallout from 815d7f6035

https://github.com/containers/toolbox/issues/750
2024-06-10 21:55:29 +02:00
Debarshi Ray c22b09d095 .github/workflows: Enable more tests on Ubuntu 22.04 by setting SHELL
The SHELL environment variable goes mysteriously missing from the
runtime environment of the GitHub Actions workflow [1].  This breaks the
'create' and 'enter' commands with:
  Error: failed to get the current user's default shell

... and therefore tests involving them can't be run until this is
resolved.

It's been a year since this problem was first encountered and no
solution is in sight.  Therefore, it will be better to work around this
by explicitly setting the SHELL environment variable on Ubuntu 22.04 to
increase the number of tests run by the CI.

The 'list' tests couldn't be enabled due to:
  $ bats test/system
  ...
  not ok 110 list: Containers and images
  # (from function `assert_line' in file
      test/system/libs/bats-assert/src/assert.bash, line 479,
  #  in test file test/system/102-list.bats, line 502)
  #   `assert_line --index 1 --partial
        "registry.fedoraproject.org/fedora-toolbox:34"' failed
  #
  # -- line does not contain substring --
  # index     : 1
  # substring : registry.fedoraproject.org/fedora-toolbox:34
  # line      : 5c5b1421750d  quay.io/toolbx/ubuntu-toolbox:22.04
                  28 hours ago
  # --
  #
  ...

The 'run' tests couldn't be enabled due to:
  $ bats --print-output-on-failure --verbose-run test/system
  ...
  not ok 134 run: 'sudo id' inside the default container
  # (from function `assert_success' in file
      test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/104-run.bats, line 208)
  #   `assert_success' failed
  # ~ ~/work/toolbox/toolbox/containers/toolbox
  # stderr:
  # runner is not in the sudoers file.  This incident will be reported.
  #
  # -- command failed --
  # status : 1
  # output :
  # --
  #
  ...

The 'user' tests couldn't be enabled due to:
  $ bats test/system
  ...
  not ok 243 user: runner in passwd(5) inside the default container
  # (from function `assert_line' in file
      test/system/libs/bats-assert/src/assert.bash, line 509,
  #  in test file test/system/206-user.bats, line 190)
  #   `assert_line --regexp
        "^$USER::$user_id_real:$user_id_real:$user_gecos:$HOME:$SHELL$"'
        failed
  # ~ ~/work/toolbox/toolbox/containers/toolbox
  #
  # -- no output line matches regular expression --
  # regexp : ^runner::1001:1001:,,,:/home/runner:/bin/bash$
  # output (27 lines):
  #   root0:0:root:/root:/bin/bash
  #   ...
  #   runner::1001:127::/home/runner:/bin/bash
  # --
  #
  ...

The 'ulimit' tests couldn't be enabled due to:
  $ bats test/system
  ...
  not ok 271 ulimit: real-time non-blocking time (hard) in 3504ms
  # (from function `assert_line' in file
      test/system/libs/bats-assert/src/assert.bash, line 488,
  #  in test file test/system/210-ulimit.bats, line 43)
  #   `assert_line --index 0 "$limit"' failed
  # ~ ~/work/toolbox/toolbox/containers/toolbox
  #
  # -- line differs --
  # index    : 0
  # expected : unlimited
  # actual   :
  # --
  #
  ...

The 'dbus' tests couldn't be enabled due to:
  $ bats --print-output-on-failure --verbose-run test/system
  ...
  not ok 206 dbus: session bus inside the default container
  # (from function `assert_success' in file
      test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/211-dbus.bats, line 50)
  #   `assert_success' failed
  # ~ ~/work/toolbox/toolbox/containers/toolbox
  # stderr:
  # bash: line 1: exec: gdbus: not found
  # Error: command gdbus not found in container ubuntu-toolbox-22.04
  #
  # -- command failed --
  # status : 127
  # output :
  # --
  #
  ...

[1] https://github.com/orgs/community/discussions/59413

https://github.com/containers/toolbox/pull/1507
2024-06-05 22:53:12 +02:00
Debarshi Ray 05e700af2a test/system: Rewrite a test using the standard Bats helpers
The test was earlier rewritten in commit b0beb68255 with custom
code in the hope that it would make it more reliable.  The test has
proven to be reliable in recent times, and the cause for its past
unreliability is unclear.  Therefore, it will be better to remove the
custom code in favour of the standard Bats helpers for the sake of
consistency and readability.

Until Bats 1.10.0, 'run --keep-empty-lines' had a bug where it counted
the trailing newline on the last line as a separate line [1].  However,
Bats 1.10.0 is only available in Fedora >= 39 and is absent from Fedora
38.

[1] Bats commit 6648e2143bffb933
    https://github.com/bats-core/bats-core/commit/6648e2143bffb933
    https://github.com/bats-core/bats-core/issues/708

https://github.com/containers/toolbox/pull/1506
2024-06-05 20:10:04 +02:00
Debarshi Ray 8fbd6012d4 test/system: Remove an unnecessary --verbose
The extra debug logs from 'toolbox --verbose' are not needed for the
test case to work, and other tests don't gratuitously use --verbose
either.

Fallout from 55b5018026

https://github.com/containers/toolbox/pull/1506
2024-06-05 20:09:00 +02:00
Debarshi Ray 3de56c0c31 build: Bump github.com/sirupsen/logrus to 1.9.3
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1503
2024-06-05 14:22:32 +02:00
Debarshi Ray efa8da9c49 build: Bump github.com/sirupsen/logrus to 1.8.3
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1503
2024-06-05 14:22:32 +02:00
Debarshi Ray d8dc8bb052 build: Bump github.com/fsnotify/fsnotify to 1.7.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1501
2024-06-05 14:21:45 +02:00
Debarshi Ray 120e86cb31 build: Bump github.com/fsnotify/fsnotify to 1.6.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1501
2024-06-05 14:21:45 +02:00
Debarshi Ray ae963b13a5 build: Bump github.com/fsnotify/fsnotify to 1.5.4
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1501
2024-06-05 14:21:45 +02:00
Debarshi Ray 37c5c9fbe6 build: Bump golang.org/x/sys to 0.19.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray b6b5545845 build: Bump golang.org/x/sys to 0.18.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray d25192f33a build: Bump golang.org/x/sys to 0.17.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 4d6a2d240e build: Bump golang.org/x/sys to 0.16.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 15c768ac21 build: Bump golang.org/x/sys to 0.15.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 61a0132e6a build: Bump golang.org/x/sys to 0.14.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 32d185e3f3 build: Bump golang.org/x/sys to 0.13.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray c8d3c5f6ac build: Bump golang.org/x/sys to 0.12.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray c74a60078a build: Bump golang.org/x/sys to 0.11.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray d4a56db757 build: Bump golang.org/x/sys to 0.10.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray c3a2f08c69 build: Bump golang.org/x/sys to 0.9.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 817a8958e1 build: Bump golang.org/x/sys to 0.8.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray a38ffc7ca9 build: Bump golang.org/x/sys to 0.7.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 6c0bf638f0 build: Bump golang.org/x/sys to 0.6.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 4eeb505845 build: Bump golang.org/x/sys to 0.5.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray 30a50330a8 build: Bump golang.org/x/sys to 0.4.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray e81573d089 build: Bump golang.org/x/sys to 0.3.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Debarshi Ray bf43499d0b build: Bump golang.org/x/sys to 0.2.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1502
2024-06-05 14:08:49 +02:00
Ievgen Popovych 96260744ab images: ubuntu: Add 24.04 as most recent LTS
Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2024-06-04 16:55:52 +02:00
Ievgen Popovych 833e0cf90d images: ubuntu: Remove 23.04 since it is EOL
Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2024-06-04 16:55:52 +02:00
Debarshi Ray 6239f32ec7 build: Bump github.com/stretchr/testify to 1.9.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1500
2024-06-03 18:18:32 +02:00
Debarshi Ray de217737e9 build: Bump github.com/stretchr/testify to 1.8.4
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1500
2024-06-03 18:14:55 +02:00
Debarshi Ray 1aa04607b6 build: Bump github.com/stretchr/testify to 1.7.5
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1500
2024-06-03 18:12:31 +02:00
Debarshi Ray 815d7f6035 cmd/run: Show the entry point's debug logs & errors in 'enter' & 'run'
Until now, if the entry point of a Toolbx container encountered an
error, while starting the container as part of the 'enter' and 'run'
commands, the specific error wouldn't be presented to the user by those
commands.  Instead, the user would have to use 'podman start --attach'
or 'podman logs' to retrieve it.  Same for the debug logs coming from
the entry point.

The lack of relevant information and insight made it difficult for users
to debug their containers or file high quality bug reports.

This is addressed by using 'podman logs', as part of the 'enter' and
'run' commands to fetch everything from the entry point's standard error
and output streams, which means both debug logs and errors, separating
them out, and presenting them to the user depending on the chosen debug
or verbosity level.

The debug logs from 'podman logs' are in the logfmt format [1], because
that's the default behaviour of Logrus when a terminal device is not
attached [2].  Logs without a 'level' key are assumed to be errors.

It's assumed that the 'podman logs' process can crash or terminate,
because the entry point crashed or got killed due to an out-of-band
'podman stop' or encountered an error.  Under such circumstances, the
'enter' and 'run' commands will terminate immediately if they have
already read any error coming from the entry point, if not then they
will wait for the timeout.

If the entry point successfully initializes the Toolbx container, then
'enter' and 'run' will cancel the 'podman logs' process, parse and show
any pending logs, and then terminate.

It's possible to detect the creation of the initialization stamp file
before all that was written by the entry point has been read from
'podman logs', causing all or some of the debug logs to be not shown as
part of 'enter' and 'run'.  This is because the creation of the
initialization stamp file is detected by a quick inotify(7) watch within
the 'enter' and 'run' processes, while the logs slowly change hands
across multiple entities - from the entry point to conmon(8) to the
systemd journal to 'podman logs'.

[1] https://brandur.org/logfmt

[2] https://pkg.go.dev/github.com/sirupsen/logrus#section-readme

https://github.com/containers/toolbox/issues/750
2024-06-03 16:58:11 +02:00
Debarshi Ray e390f15469 cmd, test/system: Support intentially failing the entry point for tests
A subsequent commit will show the debug logs and errors from a Toolbx
container's entry point as part of the 'enter' and 'run' commands.  To
test this behaviour, it will be necessary to intentially fail the entry
point.

Moreover, container start-up is a concurrent operation.  If the entry
point fails too early, then it will be caught by the 'podman inspect'
right after the 'podman start' before the inotify(7) watches are put in
place.  Otherwise, it will be handled by the timeout.  Therefore, it
will be necessary to shake out any bugs arising out of unexpected races.

To address this, two environment variables have been introduced:
  * TOOLBX_DELAY_ENTRY_POINT
  * TOOLBX_FAIL_ENTRY_POINT

The TOOLBX_DELAY_ENTRY_POINT environment variable can be set to a
positive integer during the 'create' command to add a delay, in terms of
seconds, when the Toolbx container's entry point is started by 'enter'
and 'run'.

Similarly, if the TOOLBX_FAIL_ENTRY_POINT environment variable is set to
a positive integer during the 'create' command, the entry point will
later fail during 'enter' and 'run'.  The error message will have only
one line if its value is one, else it will have two.

https://github.com/containers/toolbox/issues/750
2024-05-30 16:02:31 +02:00
Debarshi Ray 9c629ff46f pkg/podman: Wrap 'podman logs'
The subsequent commit will use this to show the debug logs and errors
from a Toolbx container's entry point as part of the 'enter' and 'run'
commands.

https://github.com/containers/toolbox/issues/750
2024-05-22 15:06:48 +02:00
Debarshi Ray 8563cdfbd0 cmd/utils: Remove redundant code
The default split function for bufio.Scanner is bufio.ScanLines [1].
There's no need to explicitly set it.

Fallout from 6e538284ad

[1] https://pkg.go.dev/bufio#Scanner.Split

https://github.com/containers/toolbox/pull/1494
2024-05-22 13:10:19 +02:00
Debarshi Ray 8c0064a305 cmd/initContainer: Simplify creating a daily ticker
Fallout from e1635c06f3

https://github.com/containers/toolbox/pull/1494
2024-05-22 13:10:19 +02:00
Debarshi Ray d8289fb832 Optimize 'enter' and 'run' for a container getting initialized
Currently, the 'enter' and 'run' commands poll at one second intervals
to check if the Toolbx container's entry point has created the
initialization stamp file to indicate that the container has been
initialized.  This came from the POSIX shell implementation [1], where
it was relatively easier to poll than to use inotify(7) to monitor the
file system.

The problem with polling is that the interval is always going to be
either too short and waste resources or too long and cause delays.  The
current one second interval is sufficiently long to add a noticeable
delay to the 'enter' and 'run' commands.

It will be better to use inotify(7) to monitor the file system, which is
quite easy to do with the Go implementation, so that the commands can
proceed as soon as the initialization stamp file is available, instead
of waiting for the polling interval to pass.

There's a fallback to polling, as before, when the operating system is
suffering from a shortage of resources needed for inotify(7).  This code
path can be forced through the TOOLBX_RUN_USE_POLLING environment
variable for testing.  Setting this environment variable disables some
code to ensure that the polling ticker is actually used, because,
otherwise, the race between the creation and detection of the
initialization stamp file makes it difficult to test the fallback.

[1] Commit d3e0f3df06
    https://github.com/containers/toolbox/commit/d3e0f3df06d3f5ac
    https://github.com/containers/toolbox/pull/305

https://github.com/containers/toolbox/issues/1070
2024-05-22 13:06:16 +02:00
Debarshi Ray c610860db8 cmd/run: Be more portable when constructing paths
There's no immediate desire to make Toolbx work on operating systems
that don't use forward slashes as path separators.  However, there's
also no reason not to use the standard library.

https://github.com/containers/toolbox/pull/1495
2024-05-22 09:33:41 +02:00
Debarshi Ray 74d4fcf00c cmd/run: Optimize 'enter' and 'run' for an already running container
Currently, the 'enter' and 'run' commands always invoke 'podman start'
even if the Toolbx container's entry point is already running.  There's
no need for that.  The commands already invoke 'podman inspect' to find
out if the org.freedesktop.Flatpak.SessionHelper D-Bus service needs to
be started.  Thus, they already have what is needed to find out if the
container is stopped and 'podman start' is necessary before it can be
used with 'podman exec', or if it's already running.

The unconditional 'podman start' invocation was followed by a second
'podman inspect' invocation to find out if the 'podman start' managed to
start the container's entry point.  There's no need for this second
'podman inspect' either, just like the 'podman start', when it's already
known from the first 'podman inspect' that the container is running.

The extra 'podman start' and 'podman inspect' invocations are
sufficiently expensive to add a noticeable overhead to the 'enter' and
'run' commands.  It's common to use a container that's already running,
just like having multiple terminals within the same working directory,
and terminal emulation applications like Ptyxis try to make it easier to
do so [1].  Therefore, it's worth optimizing this code path.

[1] https://gitlab.gnome.org/chergert/ptyxis
    https://flathub.org/apps/app.devsuite.Ptyxis

https://github.com/containers/toolbox/issues/1070
2024-05-19 23:34:53 +02:00
Debarshi Ray d363eb26d1 cmd, pkg/podman: Turn IsToolboxContainer() into Container.IsToolbx()
This makes it possible to confine the details of detecting a Toolbx
container within the podman package, because it was not possible to use
podman.IsToolboxContainer() when listing all the Toolbx containers.

https://github.com/containers/toolbox/pull/1491
2024-05-19 23:34:53 +02:00
Debarshi Ray c1d30f4d4f cmd/create: Style fixes
https://github.com/containers/toolbox/pull/1491
2024-05-19 23:34:53 +02:00
Debarshi Ray af56286ab2 cmd/run, test/system: Fix typo
Fallout from 238f2451e7

https://github.com/containers/toolbox/pull/1493
2024-05-19 22:58:26 +02:00
Debarshi Ray defd838beb test/system: Test that old unsupported containers are correctly detected
https://github.com/containers/toolbox/pull/1493
2024-05-19 22:53:56 +02:00
Debarshi Ray ec7eb59bb0 cmd/run, pkg/podman: Make podman.InspectContainer() return a Container
Unmarshal the JSON from 'podman inspect --format json --type container'
directly inside podman.InspectContainer() to confine the details within
the podman package.

The JSON samples for the unit tests were taken using the default Toolbx
container on versions of Fedora that shipped a specific Podman and
Toolbx version.  This accounts for differences in the JSON caused by
different major versions of Podman and the way different Toolbx versions
set up the containers.

One exception was Fedora 28, which had Podman 1.1.2 and Toolbx 0.0.9,
which was the last Toolbx version before 'toolbox init-container' became
the entry point for all Toolbx containers [1].  However, the default
Toolbx image is no longer available from registry.fedoraproject.org.
Hence, the image for Fedora 29 was used.

The minimum required Podman version is 1.6.4 [2], and the Go
implementation has been encouraging users to create containers with
Toolbx version 0.0.17 or newer [3].  The versions used to collect the
JSON samples for the unit tests were chosen accordingly.  They don't
exhaustively cover all possible supported and unsupported version
combinations, but hopefully enough to be useful.

[1] Commit 8b84b5e460
    https://github.com/containers/toolbox/commit/8b84b5e4604921fa
    https://github.com/debarshiray/toolbox/pull/160

[2] Commit 8e80dd5db1
    https://github.com/containers/toolbox/commit/8e80dd5db1e6f40b
    https://github.com/containers/toolbox/pull/1253

[3] Commit 238f2451e7
    https://github.com/containers/toolbox/commit/238f2451e7d7d54a
    https://github.com/containers/toolbox/pull/318

https://github.com/containers/toolbox/pull/1490
2024-05-16 20:07:01 +02:00
Debarshi Ray e611969726 cmd, pkg/podman: Turn Container into an interface
A subsequent commit will switch to unmarshalling the JSON returned from
'podman inspect --format json --type container' directly inside
podman.InspectContainer() to confine the details within the podman
package and make it easier to write unit tests for it.  eg., it requires
tracking changes to the JSON output across different Podman versions.

Unfortunately, the JSON from 'podman inspect --type container' and
'podman ps --all' are considerably different and it will be awkward to
use the same implementation of the json.Unmarshaler interface [1] for
both.  One option is to have two different concrete types separately
implement json.Unmarshaler to handle the differences in the JSON, and
then hiding these concrete types behind a Container interface that
provides access to the values parsed from the JSON.

[1] https://pkg.go.dev/encoding/json#Unmarshaler

https://github.com/containers/toolbox/pull/1490
2024-05-16 09:08:47 +02:00
Debarshi Ray 598e998a14 pkg/podman: Reorder alphabetically
https://github.com/containers/toolbox/pull/1489
2024-05-14 15:45:29 +02:00
Debarshi Ray 460971774d pkg/utils: Test that the error has the expected concrete type
https://github.com/containers/toolbox/pull/1489
2024-05-14 15:45:23 +02:00
Debarshi Ray 8b4eff2101 cmd/run, pkg/podman: Split Inspect() into two for containers and images
In future, it will be good if podman.Inspect() returned a Container or
Image object instead of a []map[string]interface{} that the caller has
to parse.  This is because parsing the []map[string]interface{} involves
tracking changes in the JSON output by different Podman versions, and
it's better to limit such details to the podman package.

Splitting podman.Inspect() into two separate functions for containers
and images is one way of achieving that.

https://github.com/containers/toolbox/pull/1487
2024-05-10 01:25:14 +02:00
Debarshi Ray eff9a44282 test/system: Ensure that 'create' can use an image without a name
https://github.com/containers/toolbox/pull/1486
2024-05-09 20:44:14 +02:00
Debarshi Ray 8d5bd3de2b cmd/create, pkg/podman: Let 'create' use an image without a name
Currently, it's not possible to create a Toolbx container from an image
without a name:
  $ podman build --squash images/fedora/f39
  STEP 1/21: FROM registry.fedoraproject.org/fedora:39
  STEP 2/21: ARG NAME=fedora-toolbox
  STEP 3/21: ARG VERSION=39
  ...
  --> 2f9bdf11c8d4
  2f9bdf11c8d4d7674dfb17d8edcfd13475d8636077f1a6208ecd616de77d7f80
  $ toolbox create --image 2f9bdf11c8d4
  Error: empty RepoTag for image 2f9bdf11c8d4

The image's fully qualified name is fetched from its RepoTags for purely
cosmetic reasons to show a precise human-readable name in the debug logs
and 'podman inspect --type container'.  Therefore, there's no reason to
fail the creation of a Toolbx container in the absence of it.

Note that an image without a name will have an empty RepoTags array in
the JSON returned by 'podman inspect --format json --type image'.  It's
different from not having a RepoTags array at all in the JSON, which may
or may not be indicative of a more serious problem and will continue to
fail the creation of the Toolbx container as before.

https://github.com/containers/toolbox/pull/1486
2024-05-09 20:40:03 +02:00
Debarshi Ray e10aed174b cmd/create, pkg/podman: Move getFullyQualifiedImageFromRepoTags
It's less of a user-facing operation, and more of a backend one.  A
subsequent commit will improve the error handling when getting the fully
qualified name of an image from its RepoTags to handle cases where the
'create' command is used with an image without a name.

https://github.com/containers/toolbox/pull/1486
2024-05-09 18:34:40 +02:00
Debarshi Ray 595f51df7d test/system: Rely on Bats >= 1.7.0 for simpler line count checks
Commit 55c0e63786 implicitly assumes Bats >= 1.7.0, because it
ignores the bug [1] where, until Bats 1.7.0, 'run --keep-empty-lines'
would report a line count of one due to a stray line feed character even
when a command produced no output.  Fortunately, commit e22a82fec8
already added a dependency on Bats >= 1.7.0.  So, there's nothing to
worry about.

[1] https://github.com/bats-core/bats-core/issues/573

https://github.com/containers/toolbox/pull/1486
2024-05-09 18:32:36 +02:00
Debarshi Ray d0323027e0 cmd/list, pkg/podman: Limit access to the raw 'podman ps' JSON
This builds on top of commit 56fcb0b4d2.

The toolboxContainer type has been renamed to Container and moved into
the podman package.

There is nothing Toolbx specific about the type - it represents any
container returned by 'podman ps'.  The containers are only later
filtered for Toolbx containers.

Secondly, having the Container type inside the podman package makes it
possible to encapsulate the unmarshalling of the JSON within the package
without exposing the raw JSON to outside consumers.  This is desirable
because the unmarshalling involves tracking changes in the JSON output
by different Podman versions, and it's better to limit such details to
the podman package.

https://github.com/containers/toolbox/pull/1485
2024-05-08 08:57:23 +02:00
Debarshi Ray 7c10d65e8a cmd/list: Style fixes
This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1485
2024-05-08 08:26:30 +02:00
Debarshi Ray 587331a092 cmd/list: Rename a variable for ease of grepping
It's better to avoid single letter variables in general, because they
are so hard to grep for.

This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1485
2024-05-08 08:22:04 +02:00
Debarshi Ray d7a95ea659 pkg/utils: Style fix
The convention in Go is to use mixedCaps (ie., camel case) rather than
underscores (ie., snake case) to write multiword names.

Fallout from 25b647d635

[1] https://go.dev/doc/effective_go

https://github.com/containers/toolbox/pull/1485
2024-05-08 08:07:34 +02:00
Debarshi Ray 4c04505881 pkg/utils: Style fix
Fallout from 25b647d635

https://github.com/containers/toolbox/pull/1485
2024-05-08 08:07:28 +02:00
Debarshi Ray 56fcb0b4d2 cmd/list, pkg/podman: Don't unmarshal the 'podman ps' JSON twice
This builds on top of commit e772207831.

Currently, the JSON from 'podman ps --format json' gets unmarshalled
into a []map[string]interface{} in podman.GetContainers, where the maps
in the slice represent containers.  Each map is then marshalled back
into JSON and then again unmarshalled into a toolboxContainer type.

This is wasteful.  The toolboxContainer type already implements the
json.Unmarshaler interface [1], since commit e772207831.  Hence,
the entire JSON from 'podman ps --format json' can be directly
unmarshalled into a slice of toolboxContainers without involving the
[]map[string]interface{}.

A subsequent commit will move the toolboxContainer type into the podman
package to more tightly encapsulate the unmarshalling of the JSON.  So,
as an intermediate step in that direction, the podman.GetContainers
function has been temporarily changed to return the entire JSON.

[1] https://pkg.go.dev/encoding/json#Unmarshaler

https://github.com/containers/toolbox/pull/1485
2024-05-07 22:13:44 +02:00
Debarshi Ray 26640d2f14 test/system: Drop unnecessary port configuration from registry container
The specific port used by the local temporary Docker registry inside the
container doesn't matter.  The container is running only one service and
its users only see the corresponding port on the host operating system.
The default port within the container is 5000 [1] and there's no reason
to change it.

[1] https://github.com/distribution/distribution-library-image

https://github.com/containers/toolbox/pull/1484
2024-05-07 11:11:03 +02:00
Debarshi Ray 70ab04867b test/system: Reorder alphabetically
https://github.com/containers/toolbox/pull/1484
2024-05-07 03:43:42 +02:00
Debarshi Ray 95dd30547c test/system: Use long options, instead of their shorter aliases
The long options are easier to grep(1) for in the sources than their
shorter aliases.

https://github.com/containers/toolbox/pull/1484
2024-05-07 03:40:42 +02:00
Debarshi Ray 9ea89670c6 .zuul: Enable testing on Fedora 40
https://github.com/containers/toolbox/pull/1468
2024-05-02 17:03:52 +02:00
Debarshi Ray b58f9a5108 playbooks, test/system: Work around bug in pasta(1) networks
Podman 5.0 switched to using pasta(1), instead of slirp4netns(1), by
default for rootless containers.  This change has led to a regression
causing 'skopeo copy' to get stuck uploading an OCI image to the local
temporary Docker registry run by the tests as a Podman container [1],
which breaks the test suite on Fedora 40 onwards.

Work around this by forcing the use of slirp4netns(1).

Note that the slirp4nets package needs to be explicitly installed on
Fedora 40 onwards, because the dependency in containers-common-extra
changed from Recommends to Suggests [2].

[1] https://github.com/containers/podman/issues/22575

[2] Fedora containers-common commit 17934d87b2686ab5
    Fedora containers-common commit 13c232f064113860
    https://src.fedoraproject.org/rpms/containers-common/c/17934d87b2686ab5
    https://src.fedoraproject.org/rpms/containers-common/c/13c232f064113860

https://github.com/containers/toolbox/pull/1468
2024-05-02 15:08:37 +02:00
Debarshi Ray 6626b11e15 playbooks: Show the Bats version
Ansible's built-in 'package' module doesn't show any details when
installing the RPMs.  All that can be seen is:
  TASK [Install RPM packages]
  fedora-rawhide | changed

Therefore, there's no way to know what version of the packages got
installed.

In this case, not knowing the Bats version being used by the CI makes it
difficult to know why the tests are generating this spew on Fedora
Rawhide [1]:
  TASK [Run system tests]
  test/system/libs/helpers.bash: line 7: TEMP_BASE_DIR: readonly variable
  test/system/libs/helpers.bash: line 8: TEMP_STORAGE_DIR: readonly variable
  test/system/libs/helpers.bash: line 10: IMAGE_CACHE_DIR: readonly variable
  test/system/libs/helpers.bash: line 11: ROOTLESS_PODMAN_STORE_DIR: readonly variable
  test/system/libs/helpers.bash: line 12: ROOTLESS_PODMAN_RUNROOT_DIR: readonly variable
  test/system/libs/helpers.bash: line 13: PODMAN_STORE_CONFIG_FILE: readonly variable
  test/system/libs/helpers.bash: line 14: DOCKER_REG_ROOT: readonly variable
  test/system/libs/helpers.bash: line 15: DOCKER_REG_CERTS_DIR: readonly variable
  test/system/libs/helpers.bash: line 16: DOCKER_REG_AUTH_DIR: readonly variable
  test/system/libs/helpers.bash: line 17: DOCKER_REG_URI: readonly variable
  test/system/libs/helpers.bash: line 18: DOCKER_REG_NAME: readonly variable
  test/system/libs/helpers.bash: line 21: PODMAN: readonly variable
  test/system/libs/helpers.bash: line 22: TOOLBX: readonly variable
  test/system/libs/helpers.bash: line 23: SKOPEO: readonly variable
  ...
  fedora-rawhide | 1..340

[1] https://github.com/bats-core/bats-core/pull/904

https://github.com/containers/toolbox/pull/1482
2024-04-30 22:24:31 +02:00
Dominique Polek 640ca4cf3d .github/workflows: Bump actions/checkout from v3 to v4
`checkout@v3` makes use of Node 16, which has reached end of life [1].
`checkout@v4` makes use of Node 20 instead [2,3].

[1] https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
[2] https://github.com/actions/checkout/blob/main/CHANGELOG.md#v400
[3] https://github.com/actions/checkout/pull/1436

https://github.com/containers/toolbox/issues/1459

Signed-off-by: Dominique Polek <dominique.polek@mailbox.org>
2024-03-14 11:12:09 +01:00
Debarshi Ray e01c1efce5 README.md: Move the badges to the end
... to prioritise the introductory text.

https://github.com/containers/toolbox/pull/1467
2024-03-06 17:47:38 +01:00
Debarshi Ray cd0dea33f5 README.md: Add a badge for the Ubuntu package
This is a static badge [1], because the dynamic Ubuntu badges show 'not
found' for the podman-toolbox package [2].

[1] https://shields.io/badges

[2] https://shields.io/badges/ubuntu-package-version
    https://shields.io/badges/ubuntu-package-version-for-series
    https://img.shields.io/ubuntu/v/podman-toolbox/noble
    https://img.shields.io/ubuntu/v/podman-toolbox/jammy

https://github.com/containers/toolbox/issues/1451
2024-03-06 17:40:12 +01:00
Debarshi Ray f8ebe70bdf README.md: Add logos to the Arch Linux and Fedora badges
See:
https://shields.io/docs/logos
https://shields.io/badges/arch-linux-package
https://shields.io/badges/fedora-package-with-branch

https://github.com/containers/toolbox/pull/1467
2024-03-06 17:40:07 +01:00
Debarshi Ray 1e5ace4b3c README.md: Update the hyperlinks for Fedora CoreOS and Silverblue
The older https://coreos.fedoraproject.org/ style links now redirect to
the https://fedoraproject.org/coreos/ style ones.

https://github.com/containers/toolbox/pull/1467
2024-03-06 17:39:57 +01:00
Debarshi Ray 818a22bf80 playbooks/system-test: Avoid running out of storage space (part 2)
This should have been part of commit 571dc9780b.

https://github.com/containers/toolbox/pull/1464
2024-03-02 06:08:38 +01:00
Debarshi Ray 11086cc081 .github: Drop one "o" and rename the project as "Toolbx" (part 2)
The environment variable to explicitly set the path to the toolbox(1)
binary was renamed to TOOLBX.

Fallout from c3403dae8c

https://github.com/containers/toolbox/pull/1463
2024-03-01 11:27:56 +01:00
Debarshi Ray 27878880e6 Update copyright notices
https://github.com/containers/toolbox/pull/1462
2024-02-29 23:31:51 +01:00
Debarshi Ray 571dc9780b playbooks/system-test, test/system: Avoid running out of storage space
The system tests download several images when setting up the test suite,
and cache them for later use by the tests [1].  This saves time and
avoids hitting rate limits imposed by OCI registries by not downloading
the same images repeatedly for several tests, but at the cost of
increased use of storage space to cache the images.

The images are cached under BATS_TMPDIR.  It defaults to the TMPDIR
environment variable, and if that's not set then to /tmp [2].  Normally,
TMPDIR isn't set, and the images end up getting cached under /tmp.  Now,
/tmp is typically on tmpfs backed by RAM or swap, which means that it
should be used for smaller size-bounded files only, and /var/tmp should
be used for everything else [3].

The images are big enough that a collection of them can't be described
as smaller and size-bounded, and it led to:
  1..306
  # test suite: Set up
  # test suite: Tear down
  not ok 1 setup_suite
  # (from function `setup_suite' in test file ./setup_suite.bash, line
      55)
  #   `_pull_and_cache_distro_image fedora "$((system_version-1))" ||
      false' failed
  # Failed to cache image registry.fedoraproject.org/fedora-toolbox:40
      to /tmp/bats-run-IPz4Cn/image-cache/fedora-toolbox-40
  # time="2024-02-19T11:41:43Z" level=fatal msg="copying system image
      from manifest list: writing blob: write
      /tmp/bats-run-IPz4Cn/image-cache/fedora-toolbox-40/dir-put-blob607392514:
      no space left on device"
  # bats warning: Executed 1 instead of expected 306 tests

So, change the default location of the BATS_TMPDIR environment variable
to /var/tmp by setting TMPDIR.

[1] Commit 50683c9d9a
    https://github.com/containers/toolbox/commit/50683c9d9a78adc9
    https://github.com/containers/toolbox/pull/375

[2] https://bats-core.readthedocs.io/en/stable/writing-tests.html

[3] https://systemd.io/TEMPORARY_DIRECTORIES/

https://github.com/containers/toolbox/pull/1462
2024-02-29 23:31:23 +01:00
Dominique Polek e270078680 pkg/utils, test/system: Preserve the xterm version
XTerm injects its version into the process running inside it through the
XTERM_VERSION environment variable [1].  This is used by programs like
Neovim to detect the terminal features supported by xterm [2,3,4].

The XTERM_VERSION environment variable is not meant to be set by the
shell's start-up scripts, but directly by xterm, and hence needs to be
preserved across the host operating system and Toolbx container.

[1] https://invisible-island.net/xterm/manpage/xterm.html

[2] Neovim commit 3d8e0594e495c42d
    https://github.com/neovim/neovim/commit/3d8e0594e495c42d

[3] Neovim commit 16300d02c7fbe953
    https://github.com/neovim/neovim/commit/16300d02c7fbe953

[4] Neovim commit ab7da4c53138768f
    https://github.com/neovim/neovim/commit/ab7da4c53138768f
    https://github.com/neovim/neovim/issues/8644

https://github.com/containers/toolbox/issues/1449

Signed-off-by: Dominique Polek <dominique.polek@mailbox.org>
2024-02-27 15:56:09 +01:00
Debarshi Ray 9d3ae61ed8 test/system: Unbreak Podman's downstream Fedora CI (part 2)
The working directory from which bats(1) is invoked might not be part of
the Toolbx container.  eg., Podman's downstream Fedora CI invokes the
tests as:
  $ cd /path/to/toolbox/test/system
  $ bats .

... and it led to [1]:
  not ok 110 run: Smoke test with true(1)
  # (from function `assert_output' in file
      ./libs/bats-assert/src/assert.bash, line 255,
  #  in test file ./104-run.bats, line 38)
  #   `assert_output ""' failed
  #
  # -- output differs --
  # expected (0 lines):
  #
  # actual (3 lines):
  #   Error: crun: chdir to `/usr/share/toolbox/test/system`: No such
      file or directory: OCI runtime attempted to invoke a command that
      was not found
  #   Error: directory /usr/share/toolbox/test/system not found in
      container fedora-toolbox-41
  #   Using /home/testuser instead.
  # --
  #

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2263968

https://github.com/containers/toolbox/pull/1457
2024-02-27 15:14:02 +01:00
Dominique Polek 11f3802f8d pkg/utils, test/system: Preserve the Konsole version
Konsole injects its version into the process running inside it through
the KONSOLE_VERSION environment variable [1].  This is used by programs
like Neovim to detect the terminal features supported by Konsole [2].
This is just like VTE and its VTE_VERSION environment variable.

The KONSOLE_VERSION environment variable is not meant to be set by the
shell's start-up scripts, but directly by Konsole, and hence needs to be
preserved across the host operating system and Toolbx container.

[1] Konsole commit b0d3d83eca4f523a
    https://invent.kde.org/utilities/konsole/-/commit/b0d3d83eca4f523a
    https://phabricator.kde.org/D12621
    https://bugs.kde.org/show_bug.cgi?id=347323

[2] Neovim commit c16529afa5c8eb03
    https://github.com/neovim/neovim/commit/c16529afa5c8eb03
    https://github.com/neovim/neovim/issues/8300

https://github.com/containers/toolbox/issues/1449

Signed-off-by: Dominique Polek <dominique.polek@mailbox.org>
2024-02-27 03:59:01 +01:00
Debarshi Ray 3ca7e869be images/fedora: Add all the iconv converter modules for glibc
Currently, the glibc package mentions glibc-gconv-extra, which contains
the iconv converter modules that are not commonly used, as a weak
dependency [1].  However, the glibc package is part of the fedora base
image, which doesn't include weak dependencies [2], and that leads to
glibc-gconv-extra going missing.

Only the images for currently maintained Fedoras (ie., 38 and 39) were
updated.

[1] Fedora glibc commit 51ca5d3334c3cd35
    https://src.fedoraproject.org/rpms/glibc/c/51ca5d3334c3cd35
    https://src.fedoraproject.org/rpms/glibc/pull-request/36
    https://bugzilla.redhat.com/show_bug.cgi?id=1812191

[2] fedora-kickstarts commit 1c39c0adb0d44866
    https://pagure.io/fedora-kickstarts/c/1c39c0adb0d44866
    https://pagure.io/fedora-kickstarts/pull-request/551
    https://pagure.io/releng/issue/8530

https://github.com/containers/toolbox/pull/1456
2024-02-22 02:39:51 +01:00
Debarshi Ray 0c083fac5c images/fedora: Tweak the 'usage' label for Fedora 38 and 39
https://github.com/containers/toolbox/pull/1456
2024-02-22 02:38:05 +01:00
Debarshi Ray 4d9d5dd4f2 images/fedora: Tweak the 'summary' label for Fedora 38 and 39
The concept of a 'base' image for creating Toolbx containers hasn't
existed since Toolbx 0.0.10, when the Buildah dependency and the
user-specific customized image were dropped [1].  That was a long time
ago.  Toolbx containers created before that were never supported by the
Go implementation [2].

Therefore, it's time to update the terminology.

[1] Commit 8b84b5e460
    https://github.com/containers/toolbox/commit/8b84b5e4604921fa
    https://github.com/containers/toolbox/pull/160

[2] Commit 238f2451e7
    https://github.com/containers/toolbox/commit/238f2451e7d7d54a
    https://github.com/containers/toolbox/pull/318

https://github.com/containers/toolbox/pull/1456
2024-02-22 02:38:05 +01:00
Debarshi Ray 1200ca371c images/fedora: Add translations for gawk to Fedora 38 and 39
Currently, the gawk package mentions gawk-all-langpacks, which contains
the translations, as a weak dependency [1].  However, the gawk package
is part of the fedora base image, which doesn't include weak
dependencies [2], and that leads to gawk-all-langpacks going missing.

[1] Fedora gawk commit ef1d4dbefb5ccbe6
    https://src.fedoraproject.org/rpms/gawk/c/ef1d4dbefb5ccbe6

[2] fedora-kickstarts commit 1c39c0adb0d44866
    https://pagure.io/fedora-kickstarts/c/1c39c0adb0d44866
    https://pagure.io/fedora-kickstarts/pull-request/551
    https://pagure.io/releng/issue/8530

https://github.com/containers/toolbox/pull/1456
2024-02-22 02:33:01 +01:00
Timothée Ravier 616d053193 github/workflows/ubuntu: Unified workflow, use buildah & podman
- Use a unified workflow for both PR & Push jobs
- Build using buildah & push with podman

Signed-off-by: Timothée Ravier <tim@siosm.fr>
2024-02-21 13:12:08 +01:00
Timothée Ravier fe7c4eeb21 github/workflows/arch: Unified workflow, use buildah & podman
- Use a unified workflow for both PR & Push jobs
- Build using buildah & push with podman

Signed-off-by: Timothée Ravier <tim@siosm.fr>
2024-02-21 13:12:08 +01:00
Debarshi Ray 6e66137605 test/system: Limit the scope of temporary files used by a single test
BATS_RUN_TMPDIR is the directory used by Bats for its own internal
temporary files, and BATS_TEST_TMPDIR is for creating files unique to
each test [1].  It's better to limit the scope of the tests' temporary
files as much as possible to avoid unexpected collisions with Bats' own
internal temporary files.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1452
2024-02-20 01:41:19 +01:00
Debarshi Ray 3a549a6252 test/system: Limit the scope of temporary files used by all tests
BATS_RUN_DIR is the directory used by Bats for its own internal
temporary files, and BATS_SUITE_TMPDIR is for creating files common to
all tests in the test suite [1].  It's better to stay away from Bats'
own internal temporary files to avoid unexpected collisions.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1452
2024-02-20 01:09:25 +01:00
Debarshi Ray 6838e93471 test/system: Unbreak Podman's downstream Fedora CI
The paths to bats-assert and bats-support are broken, if bats(1) is
invoked from any other location than the parent directory of the 'tests'
directory.  eg., Podman's downstream Fedora CI invokes the tests as:
  $ cd /path/to/toolbox/test/system
  $ bats .

... and it led to [1]:
  1..306
  # test suite: Set up
  # Missing dependencies
  # Forgot to run 'git submodule init' and 'git submodule update' ?
  # test suite: Tear down
  not ok 1 setup_suite
  # (from function `setup_suite' in test file ./setup_suite.bash, line 33)
  #   `return 1' failed
  # bats warning: Executed 1 instead of expected 306 tests

Fallout from 2c09606603

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2263968

https://github.com/containers/toolbox/pull/1448
2024-02-13 22:08:09 +01:00
Debarshi Ray 641b04aa83 test/system: Ensure that process started by 'podman exec' has all groups
Commit 15173f8c25 exposed a bug in crun(1) [1] where the process
started directly by 'podman exec --user ...' inside the Toolbx container
would not have the supplementary groups attached to the user by the
entry point.

This could be observed by differences in id(1):
  ⬢$ id
  uid=1000(user) gid=1000(user) groups=1000(user)
  ⬢$ id user
  uid=1000(user) gid=1000(user) groups=1000(user),10(wheel)

... and could be worked around by starting a new session with sudo(8).

[1] crun commit 9effaebb429a1aed
    https://github.com/containers/crun/commit/9effaebb429a1aed
    https://github.com/containers/crun/issues/644
    https://github.com/containers/podman/issues/9986

https://github.com/containers/toolbox/issues/608
2024-02-09 11:34:08 +01:00
Debarshi Ray 0669a8594a test/system: Ensure that the user is part of a group with the same name
https://github.com/containers/toolbox/pull/1447
2024-02-08 22:39:45 +01:00
Debarshi Ray c3403dae8c Drop one "o" and rename the project as "Toolbx"
This is meant to make the project more searchable on the Internet.  More
and more people have been pointing out that "toolbox" is terribly
difficult to search for, and it's impossible to find any decent
Internet real estate by that name.

Some exceptions:

  * The code repository is still https://github.com/containers/toolbox.
    It will be renamed after giving a heads-up to other contributors.

  * The name of the binary is still 'toolbox'.  The name is embedded
    into existing Toolbx containers as their entry point, which is bind
    mounted from the host operating system when the containers are
    started.  Trivially renaming the binary will prevent these
    containers from starting.

  * For similar reasons, the TOOLBOX_PATH environment variable is still
    the same.

  * For similar reasons, the profile.d file to be read by the shell on
    start-up is still called toolbox.sh.

  * The label used to identify Toolbx containers and images is still
    called com.github.containers.toolbox.  There are many existing
    Toolbx containers, and many Toolbx images beyond the control of the
    Toolbx project that use this label to identity themselves.  Simply
    renaming the label will prevent these containers and images from
    being recognized.

  * The names of the built-in Toolbx images still retain the word
    'toolbox'.  Images under the new name need to be published on the
    OCI registries and the toolbox(1) binary needs to be taught to
    handle both old and new names, wherever necessary, for backwards
    compatibility.

  * The stamp file used to identify Toolbx containers is still called
    /run/.toolboxenv because it's used by various external programs and
    users to identify Toolbx containers.

  * The OSC 777 escape sequence to track and preserve the user's current
    Toolbx container [1] still emits 'toolbox' as the name of the
    container runtime.  Changing the escape sequence can break terminal
    emulation applications, like Prompt [2], that consume it.  Hence, it
    needs to be done carefully.

  * The runtime directories at /run/toolbox, when used as root, and
    $XDG_RUNTIME_DIR/toolbox, when used rootless, weren't renamed.

    When used as root, /run/toolbox is embedded into existing Toolbx
    containers as a bind mount from the host.  Trivially renaming the
    path will prevent these containers from starting.

    Secondly, both these paths are used to synchronize container
    start-up.  If the paths are trivially renamed, and the toolbox(1)
    binary is updated and used without stopping all existing containers,
    then it won't be able to enter containers that were already started.
    Strictly speaking, this scenario isn't supported, since updates are
    always expected to be "offline" [3].  However, it's worth noting
    because solving the previous problem might also address this.

  * The configuration file for RPM is still called
    /usr/lib/rpm/macros.d/macros.toolbox.

[1] https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/17

[2] https://gitlab.gnome.org/chergert/prompt

[3] https://www.freedesktop.org/software/systemd/man/latest/systemd.offline-updates.html

https://github.com/containers/toolbox/issues/1399
2024-02-06 18:24:26 +01:00
Debarshi Ray da23002c39 cmd/rmi: Fix typo
Fallout from aaf81a56ea

https://github.com/containers/toolbox/pull/1446
2024-02-05 20:40:06 +01:00
Debarshi Ray ce66b0b86b .zuul: Try to prevent the CI from timing out on Fedora 38 and 39
With the recent expansion of the test suite, it's necessary to increase
the timeout for the Fedora 38 and 39 nodes to prevent the CI from timing
out.

https://github.com/containers/toolbox/pull/1445
2024-02-02 19:27:28 +01:00
Debarshi Ray 4ca0123943 images/fedora/f38: Update missing-docs
Otherwise the image fails to build with:
  $ podman build images/fedora/f38
  ...
  Packages with missing files:
  libcomps
  ...

https://github.com/containers/toolbox/issues/1351
2024-02-01 19:50:03 +01:00
Debarshi Ray 7038491a77 images/fedora: Add cracklib-dicts to Fedora 38 and 39
Currently, the libpwquality package mentions cracklib-dicts as a weak
dependency [1,2].  However, the libpwquality package is part of the
fedora base image, which doesn't include weak dependencies [3], and that
leads to cracklib-dicts going missing.

The absence of the cracklib-dicts package causes various operations that
go through libpwquality (eg., pwmake(1)) to fail [1], and sometimes in
confusing ways [4].

[1] Fedora libpwquality commit f84a5e3ba6c166e5
    https://src.fedoraproject.org/rpms/libpwquality/c/f84a5e3ba6c166e5
    https://bugzilla.redhat.com/show_bug.cgi?id=2158891

[2] Fedora libpwquality commit 303154338d6d3650
    https://src.fedoraproject.org/rpms/libpwquality/c/303154338d6d3650
    https://bugzilla.redhat.com/show_bug.cgi?id=2006063

[3] fedora-kickstarts commit 1c39c0adb0d44866
    https://pagure.io/fedora-kickstarts/c/1c39c0adb0d44866
    https://pagure.io/fedora-kickstarts/pull-request/551
    https://pagure.io/releng/issue/8530

[4] https://github.com/libpwquality/libpwquality/pull/85

https://github.com/containers/toolbox/issues/1351
2024-02-01 18:45:15 +01:00
Valentin David 3092ca5f75 build: Do not use use auto dependencies for shell completion scripts
It is difficult for downstream to track dependencies when they are
automatic. This results in shell completion scripts not being
installed in packages because builders do not have the right
dependency. This commit adds meson feature arguments to guard those
dependencies so that downstream distributions can use
`-Dauto_features=enabled`.

For more explanation, see rule #3 of:
https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/

https://github.com/containers/toolbox/pull/1442

Signed-off-by: Valentin David <me@valentindavid.com>
2024-01-25 01:18:28 +01:00
Debarshi Ray 037dc29388 test/system: Remove stray newline
https://github.com/containers/toolbox/pull/1437
2024-01-24 22:45:18 +01:00
Debarshi Ray dcec5680e5 test/system: Replace the RHEL toolbox:8.7 image with toolbox:8.9
Red Hat Enterprise Linux 8.7 reached End of Life on 31st May 2023:
https://access.redhat.com/articles/4038291
https://access.redhat.com/support/policy/updates/errata

Since the tests are intended for Toolbx, not the Red Hat infrastructure,
it will be better to use a newer image, because it will be closer to
what the users are seeing.

https://github.com/containers/toolbox/pull/1437
2024-01-24 22:45:18 +01:00
Robin Candau 7463f4bfbe Fix pacman cache removal in Arch image
Signed-off-by: Robin Candau <robincandau@protonmail.com>
2024-01-22 17:03:38 +01:00
Debarshi Ray 6dfd229429 test/system: Test that the HOSTNAME environment variable is set
Bash automatically sets the HOSTNAME environment variable to the name of
the current host [1] as returned by gethostname(2), which is the same as
hostname(1).

However, on Fedora, from Fedora 33 onwards, /etc/profile sets the
HOSTNAME environment variable to 'hostnamectl --transient' [2], and,
from Fedora 35 onwards, it has a fallback to hostname(1) [3].  These two
approaches return different values when used inside a Toolbx container.
The former picks up the hostname of the host operating system, while the
fallback gets the name that was set when creating the container with
'podman create --hostname toolbox ...'.

Hence, the value of HOSTNAME inside a Toolbx container for Fedora
depends on whether the corresponding version of the fedora-toolbox image
contained hostnamectl(1) or not.

[1] https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html

[2] setup commit eb9cc4dce89be24f
    https://pagure.io/setup/c/eb9cc4dce89be24f
    https://bugzilla.redhat.com/show_bug.cgi?id=1745245

[3] setup commit ddd74b5d971a734c
    https://pagure.io/setup/c/ddd74b5d971a734c
    https://pagure.io/setup/pull-request/28
    https://bugzilla.redhat.com/show_bug.cgi?id=1938223

https://github.com/containers/toolbox/issues/558
2024-01-19 20:37:06 +01:00
Debarshi Ray 8f71655444 test/system: Group by higher-level objective, not distribution
Fallout from 51ffd2793d

https://github.com/containers/toolbox/pull/1436
2024-01-18 19:59:12 +01:00
Debarshi Ray 980eb9ad32 build: Bump github.com/briandowns/spinner to 1.18.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1435
2024-01-17 02:07:18 +01:00
Debarshi Ray b50aff2f8e images: Add toolbox image definitions for RHELs 8.8, 8.9, 9.2 and 9.3
These are the full definitions of the UBI-based toolbox images published
for RHEL >= 8.8/9.2 [1] at registry.access.redhat.com/ubi8/toolbox:8.8
and such.  Note that the Dockerfile used to build this image was already
available to the public [2], but didn't include all the files necessary
to build it.

The FROM line has been changed to registry.access.redhat.com/ubi8:8.8
and such so that it can be built outside Red Hat's build system and
always points to the desired RHEL version.

[1] https://catalog.redhat.com/software/containers/ubi8/toolbox/611bd665bd674341b5c5ed46
    https://catalog.redhat.com/software/containers/ubi9/toolbox/61532d7dd2c7f84a4d2ed86b

[2] https://catalog.redhat.com/software/containers/ubi8/toolbox/611bd665bd674341b5c5ed46?container-tabs=dockerfile
    https://catalog.redhat.com/software/containers/ubi9/toolbox/61532d7dd2c7f84a4d2ed86b?container-tabs=dockerfile

https://github.com/containers/toolbox/pull/1434
2024-01-16 01:00:08 +01:00
Debarshi Ray d2316b2624 .github/CODEOWNERS: Clarify ownership of the CI on Ubuntu
https://github.com/containers/toolbox/pull/1323
2023-12-21 02:32:34 +01:00
Ondřej Míchal 55c0e63786 cmd/create: Require -y to pull an image when not connected to a terminal
It doesn't make sense to show the image download prompt when the
standard input or output stream is redirected to something other than a
terminal device.

During such non-interactive use, there's no way for the user to see the
prompt and the size of the image and then make a decision based on them.
The decision has to be made differently and earlier.  The user will
either never download or always download or will use 'skopeo inspect'
to decide for themself.

Secondly, when the input and output are not connected to a terminal, the
terminal escape sequences and the terminal-specific ioctl(2) requests
used to show the prompt won't work anyway.

Some changes by Debarshi Ray.

https://github.com/containers/toolbox/pull/1428
2023-12-21 00:29:17 +01:00
Debarshi Ray 8caa7cd828 cmd: Let the terminal know the active container on all host OSes
Prompt is a new terminal emulation application [1] designed for a
container-oriented desktop that implements the OSC 777 escape sequence
to track and preserve the user's current Toolbx container [2].  Hence,
Fedora's fork of GNOME Terminal is no longer the only one to offer this.

The implementation in Prompt is already better because it has a
user-visible setting to disable this integration with Toolbx, in case
the user doesn't want it.  Therefore, it's time to let users of all host
operating systems enjoy this feature.

This reverts commits a3e8d8d12b and
3a96feba47.

[1] https://gitlab.gnome.org/chergert/prompt

[2] https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/17

https://github.com/containers/toolbox/issues/218
2023-12-20 19:47:13 +01:00
Ondřej Míchal ecae5d631c cmd/utils: Increase buffer size when discarding input
Without a sufficient buffer size the discard function does not read
fast/efficiently enough causing multiple lines indicating "passed and
discarded input" to show up.

I used an already defined constant[0] for the buffer size to prevent
the use of a yet-another magical constant.

[0] https://pkg.go.dev/bytes#pkg-constants

https://github.com/containers/toolbox/pull/1427
2023-12-19 17:42:32 +01:00
Debarshi Ray ccc3eee727 Prepare 0.0.99.5
https://github.com/containers/toolbox/pull/1426
2023-12-19 01:18:41 +01:00
dependabot[bot] 73b229e543 build: Bump gopkg.in/yaml.v3 to 3.0.0 for CVE-2022-28948
... or GHSA-hp87-p4gw-j4gq.

This is of somewhat academic interest because gopkg.in/yaml.v3 is only
used by the YAMLEq function in github.com/stretchr/testify, which isn't
used anywhere in the code base.

https://github.com/containers/toolbox/pull/1424
https://github.com/containers/toolbox/security/dependabot/15

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 01:11:56 +01:00
dependabot[bot] f9f930cb32 build: Bump golang.org/x/text to 0.3.8 for CVE-2022-32149
... or GHSA-69ch-w2m2-3vjp.

This is of somewhat academic interest because golang.org/x/text is only
used by the NeuterAccents function in github.com/spf13/afero, which
isn't used anywhere in the code base.

https://github.com/containers/toolbox/pull/1423
https://github.com/containers/toolbox/security/dependabot/14

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 01:02:38 +01:00
Debarshi Ray 9289c2d102 Fix DNS queries in images with systemd-resolved on hosts without it
On some Toolbx images with systemd-resolved(8), like the fedora-toolbox
images for Fedora 39 onwards, /etc/resolv.conf can end up being a
symbolic link inside the container that expects the host operating
system to also use systemd-resolved(8):
  $ ls -l /etc/resolv.conf
  lrwxrwxrwx. 1 root root 39 Nov 28 08:50 /etc/resolv.conf ->
    ../run/systemd/resolve/stub-resolv.conf

This happens because systemd-resolved(8) already makes /etc/resolv.conf
a symbolic link inside the image, and, hence, the container's entry
point doesn't change it to point at the host's copy of the file at
/run/host/etc/resolv.conf.  Instead, it's left pointing at the host's
copy of the files maintained by systemd-resolved(8) under
/run/systemd/resolve, which happen to be also available inside the
container [1].

If the host OS doesn't use systemd-resolved(8), like Red Hat Enterprise
Linux 9, then this leads to a dangling symbolic link and breaks DNS
queries.

Note that the presence of systemd-resolved(8) in the recent
fedora-toolbox images is a regression caused by the ToolbxReleaseBlocker
Change [2] for Fedora 39 where the image was rewritten in terms of
fedora-kickstarts and pungi-fedora instead of a Container/Dockerfile.
By mistake, systemd crept in as an RPM needed by the image [3], which
in turn pulled in the systemd-resolved RPM as a weak dependency [4].

Hopefully, that will get fixed.  However, it's also not practical to
keep track of all the Toolbx images out there in the wild, so it's
wise to make toolbox(1) more resilient to such things.

This will have the downside of overwriting some custom user-made
modifications to the container's /etc/resolv.conf.  While that's
unfortunate, it's more important to have Toolbx images produce working
containers on a wide range of host OSes.  It will be better to come up
with a more explicit way to support custom user-made modifications to
the container's configuration.  Perhaps with a persistent stamp file.

[1] Commit af602c7d22
    https://github.com/containers/toolbox/commit/af602c7d227617d2
    https://github.com/containers/toolbox/pull/707

[2] https://fedoraproject.org/wiki/Changes/ToolbxReleaseBlocker

[3] fedora-kickstarts commit 48e2c3b5598de32f
    https://pagure.io/fedora-kickstarts/c/48e2c3b5598de32f

[4] fedora-kickstarts commit 49306cb6eada8777
    https://pagure.io/fedora-kickstarts/c/49306cb6eada8777

https://github.com/containers/toolbox/issues/1410
2023-12-18 14:51:19 +01:00
Debarshi Ray 5784754fd7 cmd/create: Don't block user interaction while fetching the image size
It takes 'skopeo inspect' a few seconds to fetch the image size from the
remote registry, and while that happens the user can't interact with the
image download prompt:
  $ toolbox create
  Image required to create toolbox container.
  <wait for a few seconds>
  Download registry.fedoraproject.org/fedora-toolbox:39 (359.8MB)? [y/N]:

This feels awkward because it's not clear to the user what's going on
during those few seconds.  Moreover, while knowing the image size can be
convenient at times, for example when disk space and network bandwidth
are limited, it's not always important.

It will be better if 'skopeo inspect' ran in the background, while
waiting for the user to respond to the image download prompt, and once
the image size has been fetched, the image download prompt can be
updated to include it.

So, initially:
  $ toolbox create
  Image required to create toolbox container.
  Download registry.fedoraproject.org/fedora-toolbox:39 ( ... MB)? [y/N]:

... and then once the size is available:
  $ toolbox create
  Image required to create toolbox container.
  Download registry.fedoraproject.org/fedora-toolbox:39 (359.8MB)? [y/N]:

If skopeo(1) is missing or too old, then the prompt can continue without
the size, as it did before:
  $ toolbox create
  Image required to create toolbox container.
  Download registry.fedoraproject.org/fedora-toolbox:39 [y/N]:

The placeholder for the missing image size (ie., ' ... MB') was chosen
to have seven characters, so that it matches the most common sizes.  The
human-readable representation of the image size is capped at four valid
numbers [1].  Unless it's a perfect round number like 1KB or 1.2MB, it
will likely use all four numbers and the decimal point, which is five
characters.  Then two more for the unit, because it's very unlikely that
there will be an image that's less than 1KB in size and will be shown in
bytes with a B.  That makes it seven characters in total.

Updating the image download prompt with the results of 'skopeo inspect'
is vulnerable to races.  At the same time as the terminal's cursor is
being moved to the beginning of the current line to overwrite the
earlier prompt with the new one, the user can keep typing and keep
moving the cursor forward.  This competition over the cursor can lead to
awkward outcomes.

For example, the prompt can overwrite the characters typed in by the
user, leaving characters in the terminal's input buffer waiting for the
user to hit ENTER, even though they are not visible on the screen.
Another example is that hitting BACKSPACE can end up deleting parts of
the prompt, instead of stopping at the edge.

This is solved by putting the terminal device into non-canonical mode
input and disabling the echoing of input characters, while the prompt is
being updated.  This prevents input from moving the terminal's cursor
forward, and from accumulating in the terminal's input buffer even if
it might not be visible.  Any input during this interim period is
discarded and replaced by '...', and a fresh new prompt is shown in the
following line.

In practice, this race shouldn't be too common.  It can only happen if
the user is typing right when the prompt is being updated, which is
unlikely because it's only supposed to be a short 'yes' or 'no' input.

The use of the context.Cause and context.WithCancelCause functions [2]
requires Go >= 1.20.  Bumping the Go version in src/go.mod then requires
a 'go mod tidy'.  Otherwise, it leads to:
  $ meson compile -C builddir --verbose
  ...
  /home/rishi/devel/containers/git/toolbox/src/go-build-wrapper
    /home/rishi/devel/containers/git/toolbox/src
    /home/rishi/devel/containers/git/toolbox/builddir src/toolbox
    0.0.99.4 cc /lib64/ld-linux-x86-64.so.2 false
  go: updates to go.mod needed; to update it:
          go mod tidy
  ninja: build stopped: subcommand failed.

[1] https://pkg.go.dev/github.com/docker/go-units#HumanSize

[2] https://pkg.go.dev/context

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 14:21:45 +01:00
Debarshi Ray 5ce96da006 cmd/create, pkg/skopeo: Make the 'skopeo inspect' invocation cancellable
A subsequent commit will use this to ensure that the user can still
interact with the image download prompt while 'skopeo inspect' fetches
the image size from the remote registry.  Initially, the prompt will be
shown without the image size.  If the user responds before the size is
fetched, then the pending 'skopeo inspect' will be cancelled.

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 14:16:47 +01:00
Debarshi Ray 3555580412 pkg/shell: Add cancellable versions of Run and RunWithExitCode
A subsequent commit will use this to ensure that the user can still
interact with the image download prompt while 'skopeo inspect' fetches
the image size from the remote registry.  Initially, the prompt will be
shown without the image size.  If the user responds before the size is
fetched, then the pending 'skopeo inspect' will be cancelled.

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 14:15:06 +01:00
Debarshi Ray aca4e9dd26 pkg/term: Add ways to change the state of a terminal device
A subsequent commit will use this to ensure that the user can still
interact with the image download prompt while 'skopeo inspect' fetches
the image size from the remote registry.  To do this, at some point, the
terminal device will be put into non-canonical mode input and the
echoing of input characters will be disabled to retain full control of
the cursor position.

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 14:14:02 +01:00
Debarshi Ray 3d5499366a Replace golang.org/x/term with golang.org/x/sys/unix
A subsequent commit will use this to ensure that the user can still
interact with the image download prompt while 'skopeo inspect' fetches
the image size from the remote registry.

To do this, at some point, the terminal device will be put into
non-canonical mode input and the echoing of input characters will be
disabled to retain full control of the cursor position.  Unfortunately,
this will require access to the full termios(3) struct that isn't given
by golang.org/x/term, and, hence, the code needs to be written using the
underlying termios(3) API.

This future code will have enough overlap with the IsTerminal API from
golang.org/x/term that it doesn't make sense to use a separate module
(ie., golang.org/x/term) for it.

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 14:12:32 +01:00
Debarshi Ray 29a73bee76 cmd/utils: Add an asynchronous cancellable way to discard input
A subsequent commit will use this to ensure that the user can still
interact with the image download prompt while 'skopeo inspect' fetches
the image size from the remote registry.

Initially, the prompt will be shown without the image size.  Once the
size has been fetched, the older prompt will be cancelled and a new one
will be shown that includes the size.  While the prompt is getting
updated, the terminal device will be put into non-canonical mode input
and the echoing of input characters will be disabled to retain full
control of the cursor position.  Once the new prompt is in place, the
previous state of the terminal will be restored.  However, anything that
was typed in the interim will be discarded to avoid surprising the user
with invisible input.

Even though this code is only expected to be used to read from the
standard input stream when it's connected to a terminal device, the use
of poll(2) here was tested with FIFOs or named pipes and regular files
as well, in case they might be necessary in future.

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 14:02:00 +01:00
Debarshi Ray 2a66fd31de cmd/utils: Rewrite askForConfirmation() using askForConfirmationAsync()
This is meant to avoid duplicating the code that shows the prompt, and
reads and parses the user's input.

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 13:53:43 +01:00
Debarshi Ray 6e538284ad cmd/utils: Add an asynchronous cancellable version of askForConfirmation
A subsequent commit will use this to ensure that the user can still
interact with the image download prompt while 'skopeo inspect' fetches
the image size from the remote registry.  Initially, the prompt will be
shown without the image size.  Once the size has been fetched, the older
prompt will be cancelled and a new one will be shown that includes the
size.

Even though this code is only expected to be used to read from the
standard input stream when it's connected to a terminal device, the use
of poll(2) here was tested with FIFOs or named pipes and regular files
as well, in case they might be necessary in future.

An eventfd(2) file descriptor expects a 8-byte or 64-bit integer value
to be given to write(2) to increase its counter by that amount [1].  In
C, it could be phrased as:
  uint64_t one = 1;
  write (eventfd, &one, sizeof (one));

However, Go's wrapper for write(2) expects a sequence of bytes (ie.,
[]byte), and not an arbitrary memory address [2].  Therefore, the
'encoding/binary' package [3] is used to encode the integer into a byte
sequence as a varint.

Even though a varint-encoded 64-bit integer takes a maximum of 10
bytes, as defined by binary.MaxVarintLen64, 1 byte is enough to encode
the number 1 as an unsigned 64-bit integer [4].  That's enough to fit
into a byte sequence of length 8 to satisfy what an eventfd(2) file
descriptor expects.  Ultimately, it doesn't matter exactly what value
the receiving end assigns to the number given to write(2), as long as
it's not zero.

[1] https://man7.org/linux/man-pages/man2/eventfd.2.html

[2] https://pkg.go.dev/golang.org/x/sys/unix#Write

[3] https://pkg.go.dev/encoding/binary

[4] https://protobuf.dev/programming-guides/encoding/

https://github.com/containers/toolbox/issues/752
https://github.com/containers/toolbox/issues/1263
2023-12-16 13:42:25 +01:00
Debarshi Ray 44664c25a3 cmd/run: Style fixes
This makes it easier to spot the beginning of functions with long lists
of parameters and return values.

https://github.com/containers/toolbox/pull/1415
2023-12-15 13:08:14 +01:00
Debarshi Ray 786723116c cmd/initContainer: Defend against insufficient resources for inotify(7)
Currently, inotify(7) is used to keep /etc/timezone inside the Toolbx
container synchronized with the host operating system's /etc/localtime.
However, /etc/timezone is only there for compatibility with Java.  The
vast majority of non-ancient code bases use /etc/localtime, which does
not need inotify(7) to stay synchronized.

Therefore, it's not worth preventing the container from starting when
the operating system is suffering from a shortage of resources needed
for inotify(7).  Especially because this shortage can be caused by a bug
in another program that's consuming too many inotify(7) instances and
watches.

https://github.com/containers/toolbox/issues/1329
2023-12-15 01:36:52 +01:00
Debarshi Ray 96ca9c6563 README.md, images/fedora: Unbreak OSTree URL
Only the images for currently maintained Fedoras (ie., 38 and 39) were
updated.

https://github.com/containers/toolbox/issues/1417
2023-12-14 17:55:54 +01:00
Debarshi Ray 3dea936fb0 build: Bump github.com/docker/go-units to 0.5.0
... to improve performance by not using regular expressions [1].
However, the potential reduction in binary size is lost because Toolbx
already uses the 'regexp' package to check if a string might be the ID
of an image or a valid container name.

[1] go-units commit 737572633c434ce2
    https://github.com/docker/go-units/commit/737572633c434ce2
    https://github.com/docker/go-units/pull/40

https://github.com/containers/toolbox/pull/1420
2023-12-14 16:28:54 +01:00
Debarshi Ray cfd8ec5450 build: Add the *_test.go files for unit tests to src/meson.build
Fallout from:
  * f8e21a31b3
  * 3cc6ece1f2
  * b27b41eff8

https://github.com/containers/toolbox/pull/1419
2023-12-13 00:02:45 +01:00
Debarshi Ray 9c2b5e9a4b .zuul: Drop testing on Fedora 37
Fedora 37 reached End of Life on 15th November 2023:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1418
2023-12-12 15:36:46 +01:00
Ievgen Popovych e82c32f80c images: ubuntu: Add 23.10, drop 22.10
https://github.com/containers/toolbox/pull/1416

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2023-12-12 15:21:47 +01:00
Penn Bauman 2f3ee0e2e3 test/system: Don't assume that no container will have /etc/kernel
Any image or container that has APT or systemd may have /etc/kernel.
eg., the arch-toolbox and ubuntu-toolbox images.

https://github.com/containers/toolbox/pull/1409

Signed-off-by: Penn Bauman <me@pennbauman.com>
2023-12-07 23:54:08 +01:00
Jens Petersen 25391e75a1 pkg/utils: Update fallback release to 38 for non-fedora hosts
Fedora 37 will reach End of Life on 5th December 2023:
https://docs.fedoraproject.org/en-US/releases/eol/
https://fedorapeople.org/groups/schedule/f-39/f-39-all-tasks.html

https://github.com/containers/toolbox/pull/1403

Signed-off-by: Jens Petersen <petersen@redhat.com>
2023-12-04 20:06:06 +01:00
Debarshi Ray 9ec3f36908 test/system: Tweak the names for consistency
https://github.com/containers/toolbox/pull/1414
2023-12-02 11:13:14 +01:00
Debarshi Ray 5bac0ba4c8 test/system: Test that DNS A and AAAA records can be queried
https://github.com/containers/toolbox/issues/1410
2023-12-02 11:04:02 +01:00
Debarshi Ray a3e8d8d12b cmd: Track the active container on Fedora Linux Asahi Remix
Christian Hergert requested this.  He is working on improving the
integration of Toolbx with the terminal emulation stack in GNOME and
Fedora, and he is using Fedora Linux Asahi Remix for his work.

https://github.com/containers/toolbox/pull/1413
2023-11-30 19:27:18 +01:00
Nieves Montero 1318c9e9c9 test/system: Test that D-Bus works on Arch Linux, RHEL, Ubuntu, etc.
https://github.com/containers/toolbox/issues/1330

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2023-11-30 19:07:23 +01:00
Debarshi Ray bc75133066 test/system: Re-align
The arguments for the D-Bus method are accepted separately by gdbus(1)
without any options.  Therefore, they shouldn't be indented by another
additional level.

https://github.com/containers/toolbox/pull/1412
2023-11-30 17:36:32 +01:00
Debarshi Ray 532e846e84 test/system: Simplify code
There's no need to run these cat(1) and gdbus(1) invocations through a
shell (ie., 'sh -c'), because there's no shell expansion that needs to
be performed.

These are unlike cases where shell expansion does need to be performed.
eg., 'readlink /proc/$$/ns/user', where the $$ needs to be expanded.

Fallout from 58134f8497 and
a0514cba12

https://github.com/containers/toolbox/pull/1412
2023-11-30 17:13:14 +01:00
Debarshi Ray f28ad7749f test/system: Unbreak the manual page checks with GNU roff >= 1.23
GNU roff 1.23 stopped remapping unescaped Hyphen-Minus (ie., - or 0x2D)
characters in the input to Hyphen-Minus in the output.  Instead, it
follows the specified behaviour of converting unescaped Hyphen-Minus
characters in the input to Hyphen (ie., ‐ or 0x2010) in the output.  To
get Hyphen-Minus characters in the output, one needs to escape the
Hyphen-Minus with a backslash (ie., \-) in the input [1].

Therefore, the command line options documented in the manuals are no
longer prefixed with the Hyphen-Minus character that's needed to
ctually use them.  This breaks copying and pasting from the manuals and
searching within them.

Unfortunately, escaping the Hyphen-Minus characters in Markdown doesn't
have the intended effect of having Hyphen-Minus in the generated manual
pages [2].  Therefore, this is worked around by having the tests check
for both Hyphen-Minus and Hyphen.

Note that some operating system distributions, like Debian, have
reverted this change from GNU roff, but others haven't.  So, unless it
can be guaranteed that the manuals will always have Hyphen-Minus
regardless of which GNU roff version or variant is being used, the tests
need to check for both.

[1] https://lwn.net/Articles/947941/
    https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00001.html
    https://git.savannah.gnu.org/cgit/groff.git/tree/PROBLEMS?h=1.23.0#n82

[2] https://github.com/cpuguy83/go-md2man/issues/101

https://github.com/containers/toolbox/pull/1398
2023-11-02 15:57:52 +01:00
Debarshi Ray 651995e8f1 gen-docs-list: Use En Dash for the date range for consistency
https://github.com/containers/toolbox/pull/1398
2023-11-02 15:57:49 +01:00
Debarshi Ray 154156d860 images/fedora: Ensure that documentation and translations are present
This should finally ensure that the fedora-toolbox image doesn't have
any package that had its content, such as documentation or translations,
stripped out by the fedora base image.

Until now, missing-docs had a hand-maintained list of packages that had
their content stripped out by the fedora base image.  These packages are
reinstalled when building the fedora-toolbox image to restore the lost
content.  Unfortunately, this list was incomplete because it was only
updated when someone noticed that something is missing.

Now, the list is generated with:
  $ rpm --all --query --state --queryformat "PACKAGE: %{NAME}\n"

... to ensure that it's always complete.

The existing built-in test to ensure that the desired files are actually
present in the final image was extended to cover some of those that were
absent.  A new built-in test, based on the above rpm(1) command, was
added as a fallback to ensure that the final image doesn't have any
package with missing content.

Only the images for currently maintained Fedoras (ie., 37, 38 and 39)
were updated.

As suggested by Brian Campbell.

https://github.com/containers/toolbox/issues/603
2023-11-01 14:59:04 +01:00
Debarshi Ray 9b5313e5a7 images: Ensure that the useradd(8), etc. manuals are available
The shadow-utils package has always been part of the fedora base image.
It's explicitly listed in extra-packages as a safeguard against losing
useradd(8) and usermod(8) by mistake because they are needed by the
entry point of a Toolbx container [1].  Hence, the need to restore the
shadow-utils documentation that was stripped out in the base image.

Only the images for currently maintained Fedoras (ie., 37, 38 and 39)
were updated.

[1] Commit c6772f0f11
    https://github.com/containers/toolbox/commit/c6772f0f112e8004

https://github.com/containers/toolbox/pull/1394
2023-10-27 20:09:51 +02:00
Debarshi Ray c7665d3476 images: Unbreak the tests for Fedora 37
The Korean translations for the psmisc manuals were only added in psmisc
23.6 [1], while Fedora 37 has psmisc 23.4.  This led to:
  STEP 16/20: RUN rm /extra-packages
  STEP 17/20: COPY ensure-files /
  STEP 18/20: RUN ret_val=0;   while read file; do     if ! compgen ...
  /usr/share/man/ko/man1/pstree.1*: No such file or directory
  Error: building at STEP "RUN ret_val=0;   while read file; do...":
    while running runtime: exit status 1

Fallout from e41d920dd9

[1] psmisc commit 3098e641dc1ddb21
    https://gitlab.com/psmisc/psmisc/-/commit/3098e641dc1ddb21

[2] https://src.fedoraproject.org/rpms/psmisc/tree/f37

https://github.com/containers/toolbox/pull/1394
2023-10-27 20:09:46 +02:00
Debarshi Ray 41aba93e29 images: Update the tests for Fedora 39
The translations for the RPM manuals were removed upstream during the
RPM 4.19 development cycle [1].  So, replace them with rpm2cpio(8),
which is another popular command shipped by the rpm package.

[1] RPM commit 4df74a9644b18136
    https://github.com/rpm-software-management/rpm/commit/4df74a9644b18136
    https://github.com/rpm-software-management/rpm/pull/2245

https://github.com/containers/toolbox/pull/1391
2023-10-25 19:53:02 +02:00
Debarshi Ray e41d920dd9 images: Add psmisc to Fedora 37, 38 and 39
It's currently being pulled in as a dependency of iproute.  However,
since it's explicitly mentioned in the list of default packages on
Fedora Silverblue and Workstation [1], it should be mentioned here too.

The psmisc package marks the translations for its manuals with %lang().
Therefore, it's a very good example for testing that the fedora-toolbox
image is localized just like Fedora Silverblue and Workstation.

This is unlike the xz package, whose translations for manuals were added
to the tests recently [2].  The xz package doesn't mark its translated
manuals with %lang() [3], which means that they are going to get
installed regardless of whether RPM has been configured to not install
localization files or not.  eg., through the %_install_langs macro.  So,
they aren't a good candidate for the tests until this is fixed.

[1] fedora-comps commit e4ed54dfcc497fd0
    https://pagure.io/fedora-comps/c/e4ed54dfcc497fd0
    https://pagure.io/fedora-comps/pull-request/379

[2] Commit 20188a097a
    https://github.com/containers/toolbox/commit/20188a097a1a7a16
    https://github.com/containers/toolbox/pull/1384

[3] https://src.fedoraproject.org/rpms/xz/pull-request/10

https://github.com/containers/toolbox/pull/1390
2023-10-19 18:31:09 +02:00
Debarshi Ray cb4e5dd52d playbooks: Show the go-md2man(1) version
Ansible's built-in 'package' module doesn't show any details when
installing the RPMs.  All that can be seen is:
  TASK [Install RPM packages]
  fedora-rawhide | changed

Therefore, there's no way to know what version of the packages got
installed.

In this case, not knowing the go-md2man(1) version being used by the CI
makes it difficult to know why the tests are failing on Fedora Rawhide
and Fedora 39 with:
  not ok 3 help: Command 'help' in 177ms
  # (from function `assert_line' in file
       test/system/libs/bats-assert/src/assert.bash, line 479,
  #  in test file test/system/002-help.bats, line 48)
  #   `assert_line --index 0 --partial "toolbox(1)"' failed
  # /usr/bin/man
  #
  # -- line does not contain substring --
  # index     : 0
  # substring : toolbox(1)
  # line      : troff:<standard input>:33: warning: cannot select font
                  'C'
  # --
  #

It could be either because the CI is still using an older version of
go-md2man(1) [1,2], or that there's some other problem.

[1] Fedora golang-github-cpuguy83-md2man commit 117806d50e401c19
    https://src.fedoraproject.org/rpms/golang-github-cpuguy83-md2man/c/117806d50e401c19
    https://src.fedoraproject.org/rpms/golang-github-cpuguy83-md2man/pull-request/3

[2] go-md2man commit d85280db9b54b574
    https://github.com/cpuguy83/go-md2man/commit/d85280db9b54b574
    https://github.com/cpuguy83/go-md2man/issues/99

https://github.com/containers/toolbox/pull/1386
2023-10-14 00:20:22 +02:00
Debarshi Ray 9ec02f01b2 test/system: Shorten the names of the tests and use consistent wording
Currently, some of the names of the tests were too long, and had
inconsistent and verbose wording.  This made it difficult to look at
them and get a gist of all the scenarios being tested.  The names are
like headings.  They shouldn't be too long, should capture the primary
objective of the test and be consistent in their wording.

Note that the term 'usage screen' was particularly confusing.  Prior to
commit 3dc106e10a, 'usage screen' in the names of the tests also
referred to the very brief listing of the commands and options that's
shown by 'toolbox help' and 'toolbox --help' in the absence of man(1).
In the context of this change, the term referred to the brief two line
error message that's shown when an unknown command or flag is used.  So,
it will be good to not use it anymore.

https://github.com/containers/toolbox/pull/1386
2023-10-12 15:08:52 +02:00
Debarshi Ray fd5b9b5975 test/system: Use the same checks for the toolbox(1) manual
... for both 'toolbox help' and 'toolbox --help'.

https://github.com/containers/toolbox/pull/1386
2023-10-12 13:38:40 +02:00
Debarshi Ray e7f729fb24 test/system: Check the line count in the standard error & output streams
https://github.com/containers/toolbox/pull/1386
2023-10-12 13:18:34 +02:00
Debarshi Ray d0b9c6ac04 test/system: Ensure that error messages go to the standard error stream
Currently, there's no way to get assert_line to use the stderr_lines
array [1].  This is worked around by assigning stderr_lines to the
'lines' array.

[1] https://github.com/bats-core/bats-assert/issues/42

https://github.com/containers/toolbox/pull/1386
2023-10-12 13:18:34 +02:00
Debarshi Ray 3dc106e10a test/system: Clarify misleading 'toolbox --help' test
Commit 5e63e9ec9b added a 'help' command to show the toolbox(1)
manual or a manual page for a specific command, and made the --help flag
identical to it.  Therefore it's misleading to say that the --help flag
should show the usage screen.  The usage screen is a brief listing of
the commands and options, which isn't the same thing as the more
detailed manuals.

Later, after this test was written, commit 40fc1689a3 added a
fallback for host operating systems without man(1), like Fedora CoreOS,
that would show a very brief usage screen with only the most common
commands.

To make it more confusing, the test was checking for a string that's
common to both the toolbox(1) manual and the fallback brief usage screen
that might be shown by 'toolbox --help'.  This meant that it was neither
able to distinguish between the code paths nor ensure that they were
working as intended.

This was resolved by adapting the existing 'toolbox --help' test to
strictly ensure that it's showing the toolbox(1) manual when man(1) is
present, and by adding a new test to strictly ensure that it's showing
the fallback brief usage screen when man(1) is absent.

Until Bats 1.10.0, 'run --keep-empty-lines' had a bug where it counted
the trailing newline on the last line as a separate line [1].  However,
Bats 1.10.0 is only available in Fedora >= 39 and is absent from Fedoras
37 and 38.

Fallout from b27795a03e

[1] Bats commit 6648e2143bffb933
    https://github.com/bats-core/bats-core/commit/6648e2143bffb933
    https://github.com/bats-core/bats-core/issues/708

https://github.com/containers/toolbox/pull/1386
2023-10-12 13:18:34 +02:00
Debarshi Ray 29ed6f8ef0 test/system: Keep empty lines to prevent missing and spurious newlines
https://github.com/containers/toolbox/pull/1386
2023-10-12 13:18:34 +02:00
Debarshi Ray b8138e0b54 .zuul: Try to prevent the CI from timing out on Fedora
With the recent expansion of the test suite, it's necessary to increase
the timeout for all Fedora nodes to prevent the CI from timing out.

https://github.com/containers/toolbox/pull/1387
2023-10-12 13:18:02 +02:00
Debarshi Ray 7abfa706f3 test/system: Unbreak the line count checks with Bats >= 1.10.0
Until Bats 1.10.0, 'run --keep-empty-lines' had a bug where it counted
the trailing newline on the last line as a separate line [1].  However,
Bats 1.10.0 is only available in Fedora >= 39 and is absent from Fedoras
37 and 38.

[1] Bats commit 6648e2143bffb933
    https://github.com/bats-core/bats-core/commit/6648e2143bffb933
    https://github.com/bats-core/bats-core/issues/708

https://github.com/containers/toolbox/pull/1387
2023-10-12 11:10:54 +02:00
Debarshi Ray 20188a097a images: Ensure that the manuals from extra-packages are available
Until now, only the packages that are present in the fedora base image,
and had their documentation stripped out, were being tested for the
availability of documentation.  There were no tests for the extra
packages that get added to the base image to form the fedora-toolbox
image.

The util-linux and xz packages were picked as examples for these new
tests.  The xz package is a particularly good example because it has
translations for its manuals.  It can help test that the fedora-toolbox
image is localized just like Fedora Silverblue and Workstation.

Only the images for currently maintained Fedoras (ie., 37, 38 and 39)
were updated.

https://github.com/containers/toolbox/pull/1384
2023-10-09 13:12:55 +02:00
Debarshi Ray c98e282db6 images/fedora: Reorder alphabetically
Fallout from 6a3c5ce8d1

https://github.com/containers/toolbox/pull/1384
2023-10-09 13:12:55 +02:00
Debarshi Ray 53a0316472 .zuul: Enable testing on Fedora 39
https://github.com/containers/toolbox/pull/1385
2023-10-06 12:43:44 +02:00
Debarshi Ray 51ffd2793d test/system: Test that environment variables for Bash history are kept
Fedora's /etc/profile overwrites the HISTSIZE environment variable.  It
can't be preserved until this is fixed [1].

Bats 0.8.0 picked up a regression that causes bogus SC2030 and SC2031
instances [2], and must be silenced so that https://www.shellcheck.net/
doesn't complain:
  Line 36:
  HISTFILESIZE=1001
  ^----------^ SC2030 (info): Modification of HISTFILESIZE is local (to
               subshell caused by @bats test).
  Line 91:
  if [ "$HISTFILESIZE" = "" ]; then
        ^-----------^ SC2031 (info): HISTFILESIZE was modified in a
                      subshell. That change might be lost.

See:
https://www.shellcheck.net/wiki/SC2030
https://www.shellcheck.net/wiki/SC2031

[1] https://pagure.io/setup/pull-request/48

[2] https://github.com/koalaman/shellcheck/issues/2431

https://github.com/containers/toolbox/issues/1359
2023-09-30 14:22:31 +02:00
Debarshi Ray 5cdd30efd3 pkg/utils: Preserve environment variables for Bash's history facility
Any system-wide customization to Bash's history facilities done through
a custom /etc/profile.d configuration snippet on the host operating
system gets lost inside the Toolbx container.

This is because Toolbx doesn't know what name to expect for the custom
/etc/profile.d snippet on the host, and, hence, can't give access to it
through a bind mount or symbolic link inside the container.  The user
can definitely set up their own symbolic link inside the container to a
snippet inside /run/host/etc/profile.d.  However, it's tedious to do
that for all containers, and the user may not even know that they are
missing the customization until they notice something wrong with the
history, which is shared across all containers and the host, and at that
point they might have already lost commands that they can't easily
reconstruct.

Therefore, it's worth trying to improve the situation by default.

This tries to preserve the environment variables used to customize
Bash's history facilities [1] across the host operating system and
Toolbx container.  It assumes that the Bash start-up scripts inside the
container won't overwrite any of the propagated variables, which might
not always be the case [2].

[1] https://www.gnu.org/software/bash/manual/html_node/Bash-History-Facilities.html
    https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html

[2] https://pagure.io/setup/pull-request/48

https://github.com/containers/toolbox/issues/1359
2023-09-30 14:22:31 +02:00
Trung Lê 540b13cd0b .github/workflows: Build the Ubuntu images for ppc64le
https://github.com/containers/toolbox/pull/1353

Signed-off-by: Trung Lê <8@tle.id.au>
2023-09-28 08:29:36 +02:00
Debarshi Ray b5aeaa243b doc/toolbox: Add a usage section
... similar to the website:
  https://containertoolbx.org/install/

As suggested by Sumantro Mukherjee.

https://github.com/containers/toolbox/pull/1379
2023-09-25 20:03:32 +02:00
Debarshi Ray 14e66fd5e5 doc/toolbox: Mention Arch Linux and Ubuntu as supported
https://github.com/containers/toolbox/pull/1379
2023-09-25 19:36:08 +02:00
Debarshi Ray 4ebaea6803 build: Enforce shellcheck(1) on all Bats tests
https://github.com/containers/toolbox/pull/1331
2023-09-25 18:17:44 +02:00
Debarshi Ray 4362c39c13 test/system: Silence SC2154
Otherwise https://www.shellcheck.net/ would complain:
  Line 343:
  if [ "$status" -ne 0 ]; then
        ^-----^ SC2154 (warning): status is referenced but not assigned.

See: https://www.shellcheck.net/wiki/SC2154

https://github.com/containers/toolbox/pull/1378
2023-09-25 18:13:58 +02:00
Debarshi Ray 574dbc920c test/system: Specify explit return values
This removes any ambiguities and makes it clear what value is being
returned.

https://github.com/containers/toolbox/pull/1378
2023-09-25 18:13:54 +02:00
Debarshi Ray 0d43d22b5b test/system: Simplify checking if the image exists or not
Bats' 'run' helper is not necessary to merely check if a command
succeeded or not [1].  In this case, it's idiomatic to use the command
as the condition for an 'if' branch.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1378
2023-09-25 18:13:50 +02:00
Debarshi Ray 9f85e13da9 test/system: Use the standard error output for error messages
https://github.com/containers/toolbox/pull/1377
2023-09-25 17:21:52 +02:00
Debarshi Ray 5ac8567bad test/system: Specify an explit return value
This removes any ambiguities and makes it clear what value is being
returned.

https://github.com/containers/toolbox/pull/1377
2023-09-25 16:08:14 +02:00
Debarshi Ray 61e2c970f8 test/system: Make it easier to spot failures to download & cache images
Currently, if 'skopeo copy ...' fails to download and cache an OCI image
during setup_suite(), the test suite doesn't immediately fail, but
continues.  It only fails later when trying to set up the Docker
registry and contains a lot of noise:
  not ok 1 setup_suite
  # (from function `assert_success' in file
       test/system/libs/bats-assert/src/assert.bash, line 114,
  #  from function `_setup_docker_registry' in file
       test/system/libs/helpers.bash, line 211,
  #  from function `setup_suite' in test file
       test/system/setup_suite.bash, line 59)
  #   `_setup_docker_registry' failed
  # Failed to cache image registry.fedoraproject.org/fedora-toolbox:38
      to /tmp/bats-run-GyTP7A/image-cache/fedora-toolbox-38
  #
  # -- command failed --
  # status : 1
  # output : time="2023-09-25T12:19:52+02:00" level=fatal
      msg="initializing source
        docker://registry.fedoraproject.org/fedora-toolbox:38-foo:
        reading manifest 38-foo in
        registry.fedoraproject.org/fedora-toolbox: manifest unknown"
  # --
  #
  # Failed to cache image quay.io/toolbx/arch-toolbox:latest to
      /tmp/bats-run-GyTP7A/image-cache/arch-toolbox-latest
  #
  # -- command failed --
  # status : 1
  # output : time="2023-09-25T12:20:48+02:00" level=fatal
      msg="initializing source
        docker://quay.io/toolbx/arch-toolbox:latest-foo: reading
        manifest latest-foo in quay.io/toolbx/arch-toolbox: manifest
        unknown"
  # --
  #
  # Failed to cache image registry.fedoraproject.org/fedora-toolbox:34
      to /tmp/bats-run-GyTP7A/image-cache/fedora-toolbox-34
  #
  # -- command failed --
  # status : 1
  # output : time="2023-09-25T12:21:42+02:00" level=fatal
      msg="initializing source
        docker://registry.fedoraproject.org/fedora-toolbox:34-foo:
        reading manifest 34-foo in
        registry.fedoraproject.org/fedora-toolbox: manifest unknown"
  # --
  #
  # ...
  #
  # -- command failed --
  # status : 1
  # output : time="2023-09-25T12:26:33+02:00" level=fatal
      msg="determining manifest MIME type for
        dir:/tmp/bats-run-GyTP7A/image-cache/fedora-toolbox-34: open
        /tmp/bats-run-GyTP7A/image-cache/fedora-toolbox-34/manifest.json:
        no such file or directory"
  # --
  #
  # docker-registry
  # 27fa141e291e64e4c7a148c88ddab219ff2bfb5802a2982dc4188dc11f41692d
  # Untagged: quay.io/toolbox_tests/registry:latest
  # Deleted: fea5a12cde107bb407bc44ede6dd9edea1d2b4171cd8e52b0cb330bf45e517e1

It makes it look as if the root cause of the failure is related to
setting up the Docker registry, which it isn't, and all that noise makes
it difficult to spot the actual problem.

Instead, from now on, it will be more obvious:
  not ok 1 setup_suite
  # (from function `setup_suite' in test file
       test/system/setup_suite.bash, line 44)
  #   `_pull_and_cache_distro_image "$system_id" "$system_version" ||
         false' failed
  # Failed to cache image registry.fedoraproject.org/fedora-toolbox:38
      to /tmp/bats-run-62b8CU/image-cache/fedora-toolbox-38
  # time="2023-09-25T13:55:42+02:00" level=fatal msg="initializing
      source docker://registry.fedoraproject.org/fedora-toolbox:38-foo:
      reading manifest 38-foo in
      registry.fedoraproject.org/fedora-toolbox: manifest unknown"

Note that Bats' 'run' helper [1] isn't designed to work inside
setup_suite().  eg., 'run --separate-stderr' doesn't work because
BATS_TEST_TMPDIR isn't defined.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1377
2023-09-25 16:02:25 +02:00
Debarshi Ray 74bf1af983 test/system: Remove stray 'podman ...' error in setup_suite() failures
If setup_suite() fails for some reason, then an unrelated message from
'podman system reset' would show up:
  not ok 1 setup_suite
  # (from function `setup_suite' in test file
       test/system/setup_suite.bash, line 43)
  #   `_pull_and_cache_distro_image foo || false' failed
  # Requested distro (foo) does not have a matching image
  #  A "/home/rishi/.cache/toolbox/system-test-storage/storage.conf"
       config file exists.
  # Remove this file if you did not modify the configuration.

This extra error message from 'podman system reset' serves no purpose
because it's not related to the cause of the setup_suite() failure.
It's just noise and it's better to silence it.

https://github.com/containers/toolbox/pull/1375
2023-09-23 00:29:36 +02:00
Debarshi Ray 9415797e8b test/system: Use long options, instead of their shorter aliases
The long options are easier to grep(1) for in the sources than their
shorter aliases.

https://github.com/containers/toolbox/pull/1375
2023-09-23 00:19:56 +02:00
Debarshi Ray 66a7ad7c97 test/system: Remove stray 'podman stop' error in setup_suite() failures
If setup_suite() fails for some reason, causing the Docker registry to
not be created, then an unrelated message from 'podman stop' would show
up:
  not ok 1 setup_suite
  # (from function `setup_suite' in test file
       test/system/setup_suite.bash, line 43)
  #   `_pull_and_cache_distro_image foo || false' failed
  # Requested distro (foo) does not have a matching image
  # Error: no container with name or ID "docker-registry" found: no such
      container
  # ...
  # ...

This extra error message from 'podman stop' serves no purpose because
it's not related to the cause of the setup_suite() failure.  It's just
noise and it's better to silence it.

https://github.com/containers/toolbox/pull/1375
2023-09-23 00:19:56 +02:00
Debarshi Ray e1745ef9c2 test/system: Ensure failure if an invalid distribution is specified
Contrary to what the documentation might seem to imply [1], Bats' 'fail'
helper only aborts a test case under certain circumstances.  eg., when
called from setup_suite(), but not from within a child function, and a
@test case, but not from within the 'run' helper.

If 'fail' is called from within 'run', then the code after it will
continue to execute.  The test case will only fail if 'run' eventually
catches a non-zero exit code that's caught by 'assert_success' [2].
Similarly, it doesn't abort if called from within a child function in
setup_suite().

Currently, _pull_and_cache_distro_image() is a child function called
from setup_suite().  So 'fail' won't abort if an invalid distribution is
specified.

Fortunately, pull_distro_image() is being called from within @test
cases, but outside 'run'.  So, there's no problem with it now.  However,
some future code changes can unknowingly alter this reality and it too
can run into unexpected behaviour.

Therefore, it's better to be safe, and explicitly specify a non-zero
exit code after 'fail'.  It will ensure that it works as expected under
all circumstances.

[1] https://github.com/bats-core/bats-support

[2] https://github.com/bats-core/bats-assert

https://github.com/containers/toolbox/pull/1375
2023-09-23 00:04:32 +02:00
Debarshi Ray a7feb00996 test/system: Make it easier to debug why a container didn't initialize
Currently, if a Toolbx container's entry point fails to initialize the
container, there's no way to see the debug logs and error messages from
the entry point:
  not ok 106 container: Check container starts without issues
  # (from function `assert_success' in file
       test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/103-container.bats, line 39)
  #   `assert_success' failed
  #
  # -- command failed --
  # status : 1
  # output :
  # --
  #

Instead, from now on, they will be visible:
  not ok 106 container: Check container starts without issues
  # (from function `assert_success' in file
       test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/103-container.bats, line 39)
  #   `assert_success' failed
  #
  # -- command failed --
  # status : 1
  # output (90 lines):
  #   Failed to initialize container fedora-toolbox-38
  #   level=debug msg="Running as real user ID 0"
  #   level=debug msg="Resolved absolute path to the executable as
        /usr/bin/toolbox"
  #   level=debug msg="TOOLBOX_PATH is /opt/bin/toolbox"
  #   level=debug msg="Migrating to newer Podman"
  #   level=debug msg="Migration not needed: running inside a container"
  #   level=debug msg="Setting up configuration"
  #   ...
  # --
  #

https://github.com/containers/toolbox/pull/1374
2023-09-22 18:24:54 +02:00
Debarshi Ray 6e5bffe9a0 test/system: Style fix
https://github.com/containers/toolbox/pull/1374
2023-09-22 18:24:50 +02:00
Debarshi Ray 0146d223d5 test/system: Make it easier to debug 'podman logs' failures
Bats' 'run' helper returns with an exit code of 0 even when the command
that it was given to run failed with a non-zero exit code [1].  This is
to enable making further assertions about the command after 'run' has
finished.  If there's nothing that checks for failures, then it will
continue as if everything is alright.

Therefore, currently, if 'podman logs' fails, there's no indication of
it and the test only fails later because it thinks that the container
failed to initialize:
  not ok 106 container: Check container starts without issues
  # (from function `assert_success' in file
       test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/103-container.bats, line 39)
  #   `assert_success' failed
  #
  # -- command failed --
  # status : 1
  # output :
  # --
  #

Instead, from now on, it will be more obvious:
  not ok 106 container: Check container starts without issues
  # (from function `assert_success' in file
       test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/103-container.bats, line 39)
  #   `assert_success' failed
  #
  # -- command failed --
  # status : 125
  # output (2 lines):
  #   Failed to invoke '/usr/bin/podman logs'
  #   Error: no container with name or ID "foo" found: no such container
  # --
  #

One alternative was to use 'assert_success' [2] to assert that the
command given to 'run' succeeded.  That would show the 'podman logs'
failure as:
  not ok 106 container: Check container starts without issues
  # (from function `assert_success' in file
       test/system/libs/bats-assert/src/assert.bash, line 114,
  #  in test file test/system/103-container.bats, line 39)
  #   `assert_success' failed
  #
  # -- command failed --
  # status : 1
  # output (29 lines):
  #
  #   -- command failed --
  #   status : 125
  #   output : Error: no container with name or ID "foo" found: no such
        container
  #   --
  #
  # ...
  #
  #   -- command failed --
  #   status : 125
  #   output : Error: no container with name or ID "foo" found: no such
        container
  #   --
  # --
  #

However, it's a bit too noisy because of the 'assert_success' not
terminating container_started() and continuing to loop for the remaining
attempts.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

[2] https://github.com/bats-core/bats-assert

https://github.com/containers/toolbox/pull/1372
2023-09-22 18:21:08 +02:00
Debarshi Ray a27b480cef test/system: Rename a variable
A subsequent commit will use this variable to set the return value for a
different condition.  Therefore, the name needs to be changed to suit
the purpose.

https://github.com/containers/toolbox/pull/1372
2023-09-22 18:21:08 +02:00
Debarshi Ray d3161ea60e test/system: Limit the scope of the return value to the function
This should prevent this function from overwriting variables of the
same name beyond the function and causing hard-to-debug problems.

https://github.com/containers/toolbox/pull/1372
2023-09-22 18:20:43 +02:00
Debarshi Ray 12da2b845f test/system: Limit the scope of the loop counters to the functions
This should prevent these functions from overwriting variables of the
same name beyond the function and causing hard-to-debug problems [1].

[1] Bats commit 502dc47dd063c187
    https://github.com/bats-core/bats-core/commit/502dc47dd063c187
    https://github.com/bats-core/bats-core/issues/726

https://github.com/containers/toolbox/pull/1373
2023-09-21 22:14:58 +02:00
Debarshi Ray 8f6e47a191 test/system: Avoid future problems caused by Bat's 'run' overwriting 'i'
Until Bats 1.10.0, 'run' with options had a bug where it would overwrite
the value of the 'i' variable even outside 'run' [1].

In these particular instances, no options are being passed to 'run',
and, hence, currently there's no problem.  However, in case a future
commit adds an option, then it could lead to hard-to-debug problems.
eg., --separate-stderr sets 'i' to 1, --show-output-of-passing-tests
sets it to 2, etc..  Therefore, depending on the flag and the loop, the
loop might get terminated prematurely or run infinitely or something
else.

Moreover, Bats 1.10.0 is only available in Fedora >= 39 and is absent
from Fedoras 37 and 38.  Therefore, it's not possible to consider this
bug fixed.

Hence, it's better to preemptively work around it to avoid any future
issues.

[1] Bats commit 502dc47dd063c187
    https://github.com/bats-core/bats-core/commit/502dc47dd063c187
    https://github.com/bats-core/bats-core/issues/726

https://github.com/containers/toolbox/pull/1373
2023-09-21 19:22:24 +02:00
Debarshi Ray c586cc9278 test/commit: Simplify a 'for' loop
An ascending 'for' loop is more idiomatic than its descending
counterpart.

https://github.com/containers/toolbox/pull/1373
2023-09-21 19:22:17 +02:00
Debarshi Ray 5c0372e959 test/system: Silence SC2034
Otherwise https://www.shellcheck.net/ would complain:
  Line 442:
  for TRIES in 1 2 3 4 5; do
  ^-^ SC2034 (warning): TRIES appears unused. Verify use (or export if
      used externally).

See: https://www.shellcheck.net/wiki/SC2034

This also makes the code consistent with the rest.

https://github.com/containers/toolbox/pull/1371
2023-09-20 15:16:50 +02:00
Debarshi Ray d528301b7f test/system: Silence SC2155
Otherwise https://www.shellcheck.net/ would complain:
  Line 624:
  local system_id="$(get_system_id)"
        ^-------^ SC2155 (warning): Declare and assign separately to
                  avoid masking return values.

See: https://www.shellcheck.net/wiki/SC2155

https://github.com/containers/toolbox/pull/1370
2023-09-20 10:24:29 +02:00
Debarshi Ray 7d24e98070 test/system: Silence SC2154
Otherwise https://www.shellcheck.net/ would complain:
  Line 33:
  assert [ ${#stderr_lines[@]} -eq 0 ]
           ^-----------------^ SC2154 (warning): stderr_lines is
                               referenced but not assigned.

See: https://www.shellcheck.net/wiki/SC2154

https://github.com/containers/toolbox/pull/1369
2023-09-20 01:33:29 +02:00
Debarshi Ray 74d2f2180d test/system: Silence SC1090
Otherwise https://www.shellcheck.net/ would complain:
  Line 505:
  . "$os_release"
    ^-----------^ SC1090 (warning): ShellCheck can't follow non-constant
                  source. Use a directive to specify location.

See: https://www.shellcheck.net/wiki/SC1090

https://github.com/containers/toolbox/pull/1368
2023-09-20 00:04:49 +02:00
Debarshi Ray 363c3f83ca test/system: Style fix
https://github.com/containers/toolbox/pull/1367
2023-09-19 23:40:42 +02:00
Debarshi Ray 5c6b566371 test/system: Use existing wrapper for 'podman start'
https://github.com/containers/toolbox/pull/1367
2023-09-19 23:40:36 +02:00
Debarshi Ray 3d14504e62 test/system: Simplify checking if the container started or not
Bats' 'run' helper is not necessary to merely check if a command
succeeded or not [1].  It also complicates using pipes to feed the
output of 'podman logs' into grep(1) [1].

In this case, it's idiomatic to pipe the 'output' directly to grep(1)
and use it as the condition for an 'if' branch.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1367
2023-09-19 19:46:28 +02:00
Debarshi Ray 6589bdd779 test/system: Silence SC2088
Otherwise https://www.shellcheck.net/ would complain:
  Line 141:
  assert_line --index 0 "~/.bash_profile read"
                        ^------------------^ SC2088 (warning): Tilde
                                             does not expand in quotes.
                                             Use $HOME.

See: https://www.shellcheck.net/wiki/SC2088

This is a false positive.  There's no need for the tilde to be expanded
because it's not being used for any file system operation.  It's merely
a human-readable string.

However, it's easier to change the string to use $HOME than littering
the file with ShellCheck's inline 'disable' directives.

https://github.com/containers/toolbox/pull/1366
2023-09-19 17:01:01 +02:00
Debarshi Ray d6bcbc49dd test/system: Silence SC2046
Otherwise https://www.shellcheck.net/ would complain:
  Line 336:
  pull_distro_image $(get_system_id) $(get_system_version)
                    ^--------------^ SC2046 (warning): Quote this to
                                     prevent word splitting.

See: https://www.shellcheck.net/wiki/SC2046

https://github.com/containers/toolbox/pull/1366
2023-09-19 17:00:53 +02:00
Debarshi Ray 3c2adf57aa test/system: Silence SC2086
Otherwise https://www.shellcheck.net/ would complain:
  Line 28:
  run --separate-stderr $TOOLBOX --version
                        ^------^ SC2086 (info): Double quote to prevent
                                 globbing and word splitting.

See: https://www.shellcheck.net/wiki/SC2086

https://github.com/containers/toolbox/pull/1365
2023-09-19 14:29:17 +02:00
Debarshi Ray fd7ca125fc test/system: Replace the shebangs with 'shell' directives
These files aren't marked as executable, and shouldn't be, because they
aren't meant to be standalone executable scripts.  They're meant to be
part of a test suite driven by Bats.  Therefore, it doesn't make sense
for them to have shebangs, because it gives the opposite impression.

The shebangs were actually being used by external tools like Coverity to
deduce the shell when running shellcheck(1).  Shellcheck's inline
'shell' directive is a more obvious way to achieve that.

https://github.com/containers/toolbox/pull/1363
2023-09-14 15:18:04 +02:00
Debarshi Ray 776562235a test/system: Fix the shebang
The setup_suite.bash file is meant to be written in Bash, and is not
supposed to have any Bats-specific syntax.  That's why it has the *.bash
suffix, not *.bats.  If Bats finds a setup_suite.bash file, when running
the test suite, it uses Bash's source(1) builtin to read the file.

This is a cosmetic change.  The Bats syntax is a superset of the Bash
syntax.  Therefore, it didn't make a difference to external tools like
Coverity that use the shebang to deduce the shell for shellcheck(1).
Secondly setup_suite.bash isn't meant to be an executable script and,
hence, the shebang has no effect on how the file is used.  However, it's
still a commonly used hint about the contents of the file, and it's
better to be accurate than misleading.

A subsequent commit will replace the shebangs in the test suite with
ShellCheck's 'shell' directives.

Fallout from 7a387dcc8b

https://github.com/containers/toolbox/pull/1363
2023-09-14 15:16:35 +02:00
Debarshi Ray b1b1d459ed cmd/initContainer: Simplify removing the user's password
It's one less invocation of an external command, which is good because
spawning a new process is generally expensive.

One positive side-effect of this is that on some Active Directory
set-ups, the entry point no longer fails with:
  Error: failed to remove password for user login@company.com: failed
      to invoke passwd(1)

... because of:
  # passwd --delete login@company.com
  passwd: Libuser error at line: 210 - name contains invalid char `@'.

This is purely an accident, and isn't meant to be an intential change to
support Active Directory.  Tools like useradd(8) and usermod(8) from
Shadow aren't meant to work with Active Directory users, and, hence, it
can still break in other ways.  For that, one option is to expose $USER
from the host operating system to the Toolbx container through a Varlink
interface that can be used by nss-systemd inside the container.

Based on an idea from Si.

https://github.com/containers/toolbox/issues/585
2023-08-24 21:03:52 +02:00
Debarshi Ray 983e07adf6 Revert "playbooks: Add workaround for Fedora Rawhide"
The DNF5 Change [1] was dropped from Fedora 39 (and Rawhide) [2] and
postponed for a later Fedora.  Therefore, there's no need for this
workaround.

This reverts commit 96791726a3.

[1] https://fedoraproject.org/wiki/Changes/ReplaceDnfWithDnf5

[2] https://pagure.io/fesco/issue/3039

https://github.com/containers/toolbox/pull/1344
2023-08-24 16:34:44 +02:00
Debarshi Ray 6bd7c87932 cmd/initContainer: Simplify code by removing a function parameter
Until now, configureUsers() was pushing the burden of deciding whether
to add a new user or modify an existing one on the callers, even though
it can trivially decide itself.  Involving the caller loosens the
encapsulation of the user configuration logic by spreading it across
configureUsers() and it's caller, and adds an extra function parameter
that needs to be carefully set and is vulnerable to programmer errors.

Fallout from 9ea6fe5852

https://github.com/containers/toolbox/pull/1356
2023-08-22 22:47:33 +02:00
Jordan Petridis 219f5b4be4 cmd/initContainer: Be aware of security hardened / or /etc
On new builds of GNOME OS [1], the host's / is mounted with 'nodev,...'
and those flags are also inherited by /etc because it's not a separate
mount point.  This leads to the same problem with /etc/machine-id that
was seen before with /var/lib/flatpak, /var/lib/systemd/coredump and
/var/log/journal [2].

Therefore, use the same approach [2] to handle /etc/machine-id.

[1] https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/718

[2] Commit 1cc9e07b7c
    https://github.com/containers/toolbox/commit/1cc9e07b7c36fe9f
    https://github.com/containers/toolbox/pull/1340

https://github.com/containers/toolbox/issues/911
https://github.com/containers/toolbox/pull/1354

Signed-off-by: Jordan Petridis <jordan@centricular.com>
2023-08-22 22:32:48 +02:00
Nieves Montero a0514cba12 test/system: Test that D-Bus works
https://github.com/containers/toolbox/issues/1330

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2023-08-22 17:11:59 +02:00
Debarshi Ray 58134f8497 test/system: Test that group and user IDs work
These tests assume that the group and user information on the host
operating system can be provided by different plugins for the GNU Name
Service Switch (or NSS) functionality of the GNU C Library.  eg., on
enterprise FreeIPA set-ups.  However, it's expected that everything
inside the Toolbx container will be provided by /etc/group, /etc/passwd,
/etc/shadow, etc..

While /etc/group and /etc/passwd can be read by any user, /etc/shadow
can only be read by root.  However, it's awkward to use sudo(8) in the
test cases involving /etc/shadow, because they ensure that root and
$USER don't need passwords to authenticate inside the container, and
sudo(8) itself depends on that.  If sudo(8) is used, the test suite can
behave unexpectedly if Toolbx didn't set up the container correctly.
eg., it can get blocked waiting for a password.

Hence, 'podman unshare' is used instead to enter the container's initial
user namespace, where $USER from the host appears as root.  This is
sufficient because the test cases only need to read /etc/shadow inside
the Toolbx container.

https://github.com/containers/toolbox/pull/1355
2023-08-22 16:01:08 +02:00
Debarshi Ray 8ef3dd997e .github/workflows: Bump Bats to 1.10.0 for CI on Ubuntu 22.04
https://github.com/containers/toolbox/pull/1352
2023-08-18 07:01:41 +02:00
Debarshi Ray f716b23914 test/system: Unbreak the line count checks with Bats >= 1.10.0
Until Bats 1.10.0, 'run --keep-empty-lines' had a bug where it counted
the trailing newline on the last line as a separate line [1].  However,
Bats 1.10.0 is only available in Fedora >= 39 and is absent from Fedoras
37 and 38.

[1] Bats commit 6648e2143bffb933
    https://github.com/bats-core/bats-core/commit/6648e2143bffb933
    https://github.com/bats-core/bats-core/issues/708

https://github.com/containers/toolbox/pull/1352
2023-08-18 06:21:40 +02:00
Debarshi Ray 1cc9e07b7c cmd/initContainer: Be aware of security hardened mount points
Sometimes locations such as /var/lib/flatpak, /var/lib/systemd/coredump
and /var/log/journal sit on security hardened mount points that are
marked as 'nosuid,nodev,noexec' [1].  In such cases, when Toolbx is used
rootless, an attempt to bind mount these locations read-only at runtime
with mount(8) fails because of permission problems:
  # mount --rbind -o ro <source> <containerPath>
  mount: <containerPath>: filesystem was mounted, but any subsequent
      operation failed: Unknown error 5005.

(Note that the above error message from mount(8) was subsequently
improved to show something more meaningful than 'Unknown error' [2].)

The problem is that 'init-container' is running inside the container's
mount and user namespace, and the source paths were mounted inside the
host's namespace with 'nosuid,nodev,noexec'.  The above mount(8) call
tries to remove the 'nosuid,nodev,noexec' flags from the mount point and
replace them with only 'ro', which is something that can't be done from
a child namespace.

Note that this doesn't fail when Toolbx is running as root.  This is
because the container uses the host's user namespace and is able to
remove the 'nosuid,nodev,noexec' flags from the mount point and replace
them with only 'ro'.  Even though it doesn't fail, the flags shouldn't
get replaced like that inside the container, because it removes the
security hardening of those mount points.

There's actually no benefit in bind mounting these paths as read-only.
It was historically done this way 'just to be safe' because a user isn't
expected to write to these locations from inside a container.  However,
Toolbx doesn't intend to provide any heightened security beyond what's
already available on the host.

Hence, it's better to get out of the way and leave it to the permissions
on the source location from the host operating system to guard the
castle.  This is accomplished by not passing any file system options to
mount(8) [1].

Based on an idea from Si.

[1] https://man7.org/linux/man-pages/man8/mount.8.html

[2] util-linux commit 9420ca34dc8b6f0f
    https://github.com/util-linux/util-linux/commit/9420ca34dc8b6f0f
    https://github.com/util-linux/util-linux/pull/2376

https://github.com/containers/toolbox/issues/911
2023-08-11 17:28:32 +02:00
Debarshi Ray a055e78d42 test/system: Silence SC2004
Otherwise https://www.shellcheck.net/ would complain
  Line 110:
  for ((i = ${num_of_retries}; i > 0; i--)); do
            ^---------------^ SC2004 (style): $/${} is unnecessary on
                              arithmetic variables.

See: https://www.shellcheck.net/wiki/SC2004

https://github.com/containers/toolbox/pull/1347
2023-08-11 17:21:55 +02:00
Debarshi Ray 41349f4ee4 test/system: Silence SC1090
Otherwise https://www.shellcheck.net/ would complain:
  Line 218:
  source <(echo "$output")
         ^---------------^ SC1090 (warning): ShellCheck can't follow
                           non-constant source. Use a directive to
                           specify location.

See: https://www.shellcheck.net/wiki/SC1090

https://github.com/containers/toolbox/pull/1347
2023-08-11 17:20:47 +02:00
Debarshi Ray 341ae55f9d test/system: Avoid conditionals only supported by Bash's built-in 'test'
The '[' and 'test' implementations from GNU coreutils don't support '-v'
as a way to check if a shell variable is set [1].  Only Bash's built-in
implementations do.

This is quite confusing and makes it difficult to find out what '-v'
actually does.  eg., 'man --all test' only shows the manual for the GNU
coreutils version, which doesn't list '-v' [1], and, 'man --all [' only
shows the manual for Bash's built-ins, which also doesn't list '-v'.
One has to go to the bash(1) manual to find it [2].

Elsewhere in the code base [3], the same thing is accomplished with '-z'
and parameter substitution, which are more widely supported and, hence,
easier to find documentation for.

[1] https://manpages.debian.org/testing/coreutils/test.1.en.html

[2] https://linux.die.net/man/1/bash

[3] Commit 84ae385f33
    https://github.com/containers/toolbox/pull/1334

https://github.com/containers/toolbox/pull/1341
2023-07-14 00:17:48 +02:00
Debarshi Ray 21299a3c5b test/system: Fix typos in conditional expressions
'[' is a command that's the same as 'test' and they might be implemented
as standalone executables or shell built-ins.  Therefore, the negation
(ie., '!') has to cover the entire command to operate on its exit code.
Instead, if it's writtten as '[ ! ... ]', then the negation becomes an
argument to '[', which isn't the same thing.

Fallout from 54a2ca1ead

https://github.com/containers/toolbox/pull/1341
2023-07-14 00:17:02 +02:00
Debarshi Ray c846b6d844 test/system: Simplify the check for Fedora Rawhide
First, it's not a good idea to use awk(1) as a grep(1) replacement.
Unless one really needs the AWK programming language, it's better to
stick to grep(1) because it's simpler.

Secondly, it's better to look for a specific os-release(5) field instead
of looking for the occurrence of 'rawhide' anywhere in the file, because
it lowers the possibility of false positives.

https://github.com/containers/toolbox/pull/1336
2023-07-11 20:30:35 +02:00
Daniel Pawlik 96791726a3 playbooks: Add workaround for Fedora Rawhide
The Zuul executor contains Ansible 2.13.7 whose 'dnf' module is not
working as it should with Fedora Rawhide because of the DNF5 Change [1].
Unlike DNF4, DNF5 no longer pulls in the python3-dnf RPM, which causes:
  TASK [Install RPM packages]
  fedora-rawhide | ERROR
  fedora-rawhide | {
  fedora-rawhide |   "msg": "Could not import the dnf python module
      using /usr/bin/python3 (3.12.0b3 (main, Jun 21 2023, 00:00:00)
      [GCC 13.1.1 20230614 (Red Hat 13.1.1-4)]). Please install
      `python3-dnf` or `python2-dnf` package or ensure you have
      specified the correct ansible_python_interpreter. (attempted
      ['/usr/libexec/platform-python', '/usr/bin/python3',
      '/usr/bin/python2', '/usr/bin/python'])",
  fedora-rawhide |   "results": []
  fedora-rawhide | }

This adds a workaround that explicitly installs the python3-dnf RPM
using Ansible's 'command' module.  It should be removed after Zuul
contains a newer release of Ansible.

[1] https://fedoraproject.org/wiki/Changes/ReplaceDnfWithDnf5

https://github.com/containers/toolbox/pull/1338

Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
2023-07-11 19:40:07 +02:00
Debarshi Ray 84ae385f33 test/system: Silence SC2154
Otherwise https://www.shellcheck.net/ would complain:
  Line 202:
  run echo "$name"
            ^---^ SC2154 (warning): name is referenced but not assigned.

See: https://www.shellcheck.net/wiki/SC2154

Note that there's no need to use Bats' 'run' helper to merely check if
the command succeeded or not, because 'set -e' is set for all tests [1].

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1334
2023-07-07 17:36:44 +02:00
Osama Albahrani 7e4e78067b CODE-OF-CONDUCT.md Update URL
https://github.com/containers/common/issues/549
https://github.com/containers/toolbox/pull/1322
2023-07-05 14:32:01 +02:00
Debarshi Ray db9a906b50 test/system: Simplify the check for Fedora Rawhide
First, it's not a good idea to use awk(1) as a grep(1) replacement.
Unless one really needs the AWK programming language, it's better to
stick to grep(1) because it's simpler.

Secondly, it's better to look for a specific os-release(5) field instead
of looking for the occurrence of 'rawhide' anywhere in the file, because
it lowers the possibility of false positives.

https://github.com/containers/toolbox/pull/1332
2023-07-04 18:20:59 +02:00
Debarshi Ray 569b4df24d test/system: Test the resource limits
The following caveats must be noted:

  * Podman sets the Toolbx container's soft limit for the maximum number
    of open file descriptors to the host's hard limit, which is often
    greater than the host's soft limit [1].

  * The ulimit(1) options -P, -T, -b, and -k don't work on Fedora 38
    because the corresponding resource arguments for getrlimit(2) are
    absent from the operating system.  These are RLIMIT_NPTS,
    RLIMIT_PTHREAD, RLIMIT_SBSIZE and RLIMIT_KQUEUES respectively.

[1] https://github.com/containers/podman/issues/17681

https://github.com/containers/toolbox/issues/213
2023-07-04 15:34:21 +02:00
Debarshi Ray ea91335ebb test/system: Limit the scope of temporary files used by a single test
BATS_TMPDIR is the base directory used by Bats for all temporary files
and directories, and BATS_TEST_TMPDIR is unique to each test [1].  It's
better to limit the scope of the tests' temporary files as much as
possible to avoid unexpected collisions with Bats' own internal
temporary files.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1327
2023-06-30 20:45:48 +02:00
Debarshi Ray c43cf5d763 test/system: Test that interprocess communication works
Note that 'run --keep-empty-lines' counts the trailing newline on the
last line as a separate line.

https://github.com/containers/toolbox/pull/1326
2023-06-30 20:30:48 +02:00
Debarshi Ray 41215cf82e test/system: Test that networking works
Note that 'run --keep-empty-lines' counts the trailing newline on the
last line as a separate line.

https://github.com/containers/toolbox/pull/1325
2023-06-30 19:53:31 +02:00
Debarshi Ray d7d2fd90cb test/system: Remove stray newline
https://github.com/containers/toolbox/pull/1325
2023-06-30 14:45:21 +02:00
Debarshi Ray a23b411a1b SECURITY.md: Update URL
https://github.com/containers/common/issues/549
https://github.com/containers/toolbox/pull/1324
2023-06-27 17:20:43 +02:00
Debarshi Ray 8c28dc2660 .github/workflows: Run the CI on Ubuntu 22.04
Now that Toolbx offers built-in support for Ubuntu containers [1],
adding an Ubuntu host to the upstream CI will help ensure that Toolbx
continues to work well on Ubuntu.  Ubuntu 22.04 is the latest long term
support (or LTS) release [2] from Ubuntu, and is the latest Ubuntu
version that GitHub provides runners for [3].

Ubuntu 22.04 only has Bats 1.2.1 [4], while Toolbx requires 1.7.0 [5];
and Shadow 4.8 [6], while Toolbx requires 4.9 because it needs
libsubid.so [7,8].  Hence, newer versions of these dependencies need to
be built to run the tests.  The build flags for Shadow were taken from
the Debian package [9].

A separate sub-directory inside $GITHUB_WORKSPACE [10] is used for
Toolbx itself to prevent codespell from getting triggered by spelling
mistakes in these dependencies themselves [11].

Unfortunately, the SHELL environment variable goes mysteriously missing
from the runtime environment of the GitHub Actions workflow [12].  This
breaks the 'create' and 'enter' commands, and therefore tests involving
them can't be run until this is resolved.  Meanwhile, running the CI on
Ubuntu with a subset of the tests, is still better than not running the
CI on Ubuntu at all.

[1] Commit a84a358b3b
    https://github.com/containers/toolbox/pull/483
    https://github.com/containers/toolbox/pull/1284

[2] https://wiki.ubuntu.com/Releases

[3] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

[4] https://packages.ubuntu.com/jammy/bats

[5] Commit e22a82fec8
    https://github.com/containers/toolbox/pull/1273

[6] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[7] Shadow commit 0a7888b1fad613a0
    https://github.com/shadow-maint/shadow/commit/0a7888b1fad613a0
    https://github.com/shadow-maint/shadow/issues/154

[8] Commit ca8007c192
    https://github.com/containers/toolbox/issues/1074

[9] https://salsa.debian.org/debian/shadow/

[10] https://docs.github.com/en/actions/learn-github-actions/variables

[11] https://github.com/bats-core/bats-core/pull/743

[12] https://github.com/orgs/community/discussions/59413

https://github.com/containers/toolbox/pull/1319
2023-06-27 13:08:05 +02:00
Debarshi Ray 4322824061 test/system: Fix reading the os-release(5) VERSION_ID on Ubuntu
The current approach of extracting the VERSION_ID field from
os-release(5) assumes that the value is not quoted.  There's no
guarantee that this will be the case.  It only happens to be so on
Fedora by chance, and is different on Ubuntu:
  $ cat /etc/os-release
  ...
  VERSION_ID="22.04"
  ...

This means that "22.04", including the double quotes, is read as the
value of VERSION_ID on Ubuntu, not 22.04.  This is wrong because this
value can't be used as is in image and container names.  There's no
image called quay.io/toolbx/ubuntu-toolbox:"22.04" and double quotes are
not allowed in container names.

Instead, use the same approach as profile.d/toolbox.sh and the old POSIX
shell implementation that doesn't rely on the quoting of the
os-release(5) values.

Fallout from b27795a03e

https://github.com/containers/toolbox/pull/1320
2023-06-23 13:58:42 +02:00
Debarshi Ray 62c31ca8ea test/system: Fix reading the os-release(5) ID on Ubuntu
The current approach of selecting all the os-release(5) fields that have
'ID' in their name (eg., ID, VERSION_ID, PLATFORM_ID, VARIANT_ID, etc.)
and then picking the first one, assumes that the ID field will always be
placed above the others in os-release(5).  There's no guarantee that
this will be the case.  It only happens to be so on Fedora by chance,
and is different on Ubuntu:
  $ cat /etc/os-release
  ...
  VERSION_ID="22.04"
  ...
  ID=ubuntu
  ID_LIKE=debian
  ...

This means that "22.04" is read as the value of ID on Ubuntu, which is
clearly wrong.

Instead, use the same approach as profile.d/toolbox.sh and the old POSIX
shell implementation that doesn't rely on the order of the os-release(5)
fields.

Fallout from 54a2ca1ead

https://github.com/containers/toolbox/pull/1320
2023-06-23 13:27:07 +02:00
Debarshi Ray b57dfd8b58 playbooks: Use Ansible's 'command' module, instead of 'shell'
Ansible's 'shell' module is almost exactly like the 'command' module,
except that it runs the command through a command line shell so that
environment variables like HOSTNAME and operations like '*', '<' and '>'
work.  None of those things are necessary are here.  Hence, it's better
to use the 'command' module as elsewhere.

Note that, unlike Ansible's 'shell' module, the 'command' module doesn't
support inline scripts.  So, each command needs to be in its own
separate task.

https://github.com/containers/toolbox/pull/1318
2023-06-22 18:20:49 +02:00
Matthias Clasen 2c09606603 test/system: Clarify the use of Git submodules
We wasted some time trying to get the tests running locally, when all we
were missing were the 'git submodule ...' commands.

Add some more obvious hints about this possible stumbling block.

Note that Bats cautions against printing outside the @test, setup* or
teardown* functions [1].  In this case, doing so leads to the first line
of the error output going missing, when using the pretty formatter for
human consumption:

  $ bats --formatter pretty ./test/system
   ✗ setup_suite
     Forgot to run 'git submodule init' and 'git submodule update' ?
     bats warning: Executed 1 instead of expected 191 tests

  191 tests, 1 failure, 190 not run

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1298

Signed-off-by: Matthias Clasen <mclasen@redhat.com>
2023-06-21 12:34:08 +02:00
Debarshi Ray 7a387dcc8b test/system: Simplify running a subset of the tests with Bats >= 1.7.0
The 000-setup.bats and 999-teardown.bats files were added [1] at a time
when Bats didn't offer any hooks for suite-wide setup and teardown.

That changed in Bats 1.7.0, which introduced the setup_suite and
teardown_suite hooks.  These hooks make it easier to run a subset of the
tests, which is a good thing.

In the past, to run a subset of the tests, one had to do:
  $ bats ./test/system/000-setup.bats ./test/system/002-help.bats \
      ./test/system/999-teardown.bats

Now, one only has to do:
  $ bats ./test/system/002-help.bats

Commit e22a82fec8 already added a dependency on Bats >= 1.7.0.
Therefore, it should be exploited wherever possible to simplify things.

[1] Commit 54a2ca1ead
    https://github.com/containers/toolbox/issues/751

[2] Bats commit fb467ec3f04e322a
    https://github.com/bats-core/bats-core/issues/39
    https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1317
2023-06-21 09:07:29 +02:00
Debarshi Ray c37c5238dd test/system: Re-align
All the other Bats files for the system tests are indented by two
spaces, not four.

This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1317
2023-06-21 09:07:25 +02:00
Avimitin Lu 26bf55ea24 build: Make it build on riscv64
Go 1.14 added experimental support for 64-bit RISC-V on Linux
(GOOS=linux, GOARCH=riscv64) [1], and the path of the dynamic linker
(ie., PT_INTERP) was taken from the ABI specification [2].

Tested in Arch Linux rv64gc qemu user image.

[1] https://tip.golang.org/doc/go1.14#riscv

[2] https://sourceware.org/glibc/wiki/ABIList

https://github.com/containers/toolbox/pull/1159
https://github.com/containers/toolbox/pull/1316

Signed-off-by: Avimitin Lu <avimitin@gmail.com>
2023-06-13 16:04:47 +02:00
Nieves Montero 0a1417799a test/system: Fix warnings by specifying the minimum needed Bats version
Bats 1.7.0 emits a warning if a feature that is only available starting
from a certain version of Bats onwards is used without specifying that
version [1]:
  BW02: Using flags on `run` requires at least BATS_VERSION=1.5.0. Use
    `bats_require_minimum_version 1.5.0` to fix this message.
        (from function `bats_warn_minimum_guaranteed_version' in file
           /usr/lib/bats-core/warnings.bash, line 32,
         from function `run' in file
           /usr/lib/bats-core/test_functions.bash, line 227,
         in test file test/system/001-version.bats, line 27)

Note that bats_require_minimum_version itself is only available from
Bats 1.7.0 [2].  Hence, even though the specific feature here (using
flags on 'run') only requires Bats >= 1.5.0, in practice Bats >= 1.7.0
is needed.  Fortunately, commit e22a82fec8 already added a
dependency on Bats >= 1.7.0.  So, there's nothing to worry about.

[1] Bats commit 82002bb6c1a5c418
    https://github.com/bats-core/bats-core/issues/556
    https://bats-core.readthedocs.io/en/stable/warnings/BW02.html

[2] Bats commit 71d6b71cebc3d32b
    https://github.com/bats-core/bats-core/issues/556
    https://bats-core.readthedocs.io/en/stable/warnings/BW02.html

https://github.com/containers/toolbox/pull/1315
2023-06-13 12:48:11 +02:00
Debarshi Ray bc067f12d6 test/system: Simplify the line count checks by relying on Bats >= 1.7.0
Commit e22a82fec8 already added a dependency on Bats >= 1.7.0,
which is present on Fedora >= 36.  Therefore, it should be exploited
wherever possible to simplify things.

Earlier, when the line counts were checked only with Bats >= 1.7.0,
there was a need to separately check the whole standard error and
output streams with 'assert_output' for the tests to be useful on
Fedora 35, which only had Bats 1.5.0.  Now that the line counts are
being checked unconditionally, there's no need for that anymore.

Note that bats_require_minimum_version itself is only available from
Bats 1.7.0 [1].

[1] Bats commit 71d6b71cebc3d32b
    https://github.com/bats-core/bats-core/issues/556
    https://bats-core.readthedocs.io/en/stable/warnings/BW02.html

https://github.com/containers/toolbox/pull/1314
2023-06-13 12:43:14 +02:00
Debarshi Ray 0676eb98ea .zuul: Drop testing on Fedora 36
Fedora 36 reached End of Life on 16th May 2023:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1313
2023-06-13 10:02:17 +02:00
Debarshi Ray 923fc10bd5 .github/CODEOWNERS: Clarify ownership of Ubuntu image publication
This reflects the value of the 'maintainer' LABELs of the images.

https://github.com/containers/toolbox/pull/1307
2023-06-13 09:49:21 +02:00
Debarshi Ray 2ee82affeb pkg/utils: Offer built-in support for Arch Linux
This allows using the 'distro' option to create and enter Arch Linux
containers.  Due to Arch's rolling-release model, the 'release' option
isn't required.  If 'release' is used, the accepted values are 'latest'
and 'rolling'.

https://github.com/containers/toolbox/pull/1311
2023-06-12 22:26:46 +02:00
Debarshi Ray ed76734eb6 pkg/utils: Support OSes that don't have the concept of a release
Operating system distributions like Arch Linux that follow a
rolling-release model don't have the concept of a release.  The latest
snapshot is the only available release.

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code can no longer assume that every distribution will have a
matching release.

Note that just because an operating system distribution may not have the
concept of a release, it doesn't mean that it will accept an invalid
'release' option.

https://github.com/containers/toolbox/pull/1311
2023-06-12 22:23:14 +02:00
Debarshi Ray 774ce8bd07 pkg/utils: Rename a variable for consistency
Fallout from df7e01df10

https://github.com/containers/toolbox/pull/1303
2023-06-12 17:01:24 +02:00
Debarshi Ray d14fd7bb50 pkg/utils: Support host operating systems without VERSION_ID
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

Note that the arch-toolbox image is tagged with 'latest', in accordance
with OCI conventions, not 'rolling' [2,3], which is the os-release(5)
BUILD_ID.  Therefore, it will be wise to use 'latest' as the default
release on Arch Linux, to simplify how the default release matches with
the default image's tag.  This means that a os-release(5) field can't be
used for the default release on Arch.

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

[2] Commit 2568528cb7
    https://github.com/containers/toolbox/pull/861

[3] Commit a4e5861ae5
    https://github.com/containers/toolbox/pull/1308

https://github.com/containers/toolbox/pull/1303
2023-06-12 16:47:48 +02:00
Debarshi Ray 28913fad1d .github/CODEOWNERS: Clarify ownership of Arch Linux image publication
This reflects the value of the 'maintainer' LABELs of the images.

https://github.com/containers/toolbox/pull/1308
2023-06-09 13:32:28 +02:00
Debarshi Ray 33815da389 .github/workflows: Build the Arch Linux image for pull requests
... when there are changes in the 'images/arch' directory or in the
GitHub workflow itself.

https://github.com/containers/toolbox/pull/1308
2023-06-09 13:32:28 +02:00
Debarshi Ray a4e5861ae5 .github/workflows: Publish the Arch Linux image at quay.io/toolbx/...
Until now, the Arch Linux image was being published at
quay.io/toolbx-images/archlinux-toolbox:latest.  This renames the image
to arch-toolbox [1] to match the os-release(5) ID on Arch, and changes
the location to quay.io/toolbx/arch-toolbox:latest.

Build and push when there are changes in the 'images/arch' directory
or in the GitHub workflow itself, as well as at 00:00 every Monday.

[1] Commit 2568528cb7
    https://github.com/containers/toolbox/pull/861

https://github.com/containers/toolbox/pull/1308
2023-06-09 13:32:28 +02:00
Benjamin Asbach 73663a6f80 README.md: Unbreak Arch Linux package URL
The toolbox(1) binary is now available from Arch Linux's Extra
repository, not Community:
https://archlinux.org/packages/extra/x86_64/toolbox/

https://github.com/containers/toolbox/pull/1300

Signed-off-by: Benjamin Asbach <asbachb.github.toolbox@impl.it>
2023-06-09 11:19:45 +02:00
Jakub Sierżęga 90a03b61f4 profile.d: Show welcome message on Fedora Sericea
Since Sericea is an official variant of Fedora, it should have an
official welcome message like the other ones.

https://github.com/containers/toolbox/pull/1293

Signed-off-by: Jakub Sierżęga <jakub.sierzega@comarch.com>
2023-06-09 10:29:59 +02:00
Debarshi Ray a58d81db4e profile.d: Re-align
This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1293
2023-06-09 10:28:31 +02:00
Debarshi Ray b6ca18ead1 pkg/utils, test/system: Use the Ubuntu images from quay.io/toolbx/...
https://github.com/containers/toolbox/pull/1306
2023-06-08 15:35:44 +02:00
Ievgen Popovych 8dcd5d7cb4 .github/workflows: Publish the Ubuntu images at quay.io/toolbx/...
Until now, the Ubuntu images (versions 16.04, 18.04, 20.04, 22.04 and
22.10) were published at quay.io/toolbx-images/ubuntu-toolbox:22.04,
etc..  This changes the location to quay.io/toolbx/ubuntu-toolbox:22.04
and builds an image for Ubuntu 23.04 that was added recently [1].

Build and push when there are changes in the `images/ubuntu` directory
or in the GitHub workflow itself, as well as every other week (7th and
21st days of a month to be precise).

The toolbox(1) code and the system tests will be switched to the new
location after the first round of images are available.

[1] Commit 3cfb6bf888
    https://github.com/containers/toolbox/pull/1292

https://github.com/containers/toolbox/pull/483

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2023-06-08 14:52:31 +02:00
Debarshi Ray 4a1d9fc037 pkg/utils: Mark a private function as such
Reading the VERSION_ID field from the host operating system's
os-release(5) only needs to happen when initializing this package.

Fallout from 9e2825524a

https://github.com/containers/toolbox/pull/1304
2023-06-07 17:04:06 +02:00
Erazem Kokot 2568528cb7 images: Add arch-toolbox image definitions for Arch Linux
This is the definition of the arch-toolbox image for Arch Linux that
plays well with Toolbx.

Today, it's published at quay.io/toolbx-images/archlinux-toolbox:latest,
but the name of the published image will be changed to arch-toolbox [1]
to match the os-release(5) ID on Arch Linux.  The convention of naming
the Toolbx images according to the os-release(5) ID is deeply ingrained
in the Toolbx code base.  It will be better to keep things simple by
continuing that practice, instead of adding a one-off exception.

Maintenance of this image has been passed to Morten Linderud.

[1] https://github.com/toolbx-images/images/pull/82

https://github.com/containers/toolbox/pull/861
2023-06-06 22:57:22 +02:00
Ievgen Popovych 3cfb6bf888 images: ubuntu: Add 23.04 Lunar image
Signed-off-by: Ievgen Popovych <jmennius@gmail.com>

https://github.com/containers/toolbox/pull/1292
2023-05-03 13:45:04 +02:00
Ievgen Popovych 10b39a6a12 images: ubuntu: Remove APT ESM hook
This was recently introduced with `ubuntu-advantage-tools` and it tries
to poke at some system services introducing annoying delay and messages.

Even if the services are present (on Ubuntu host) and systemd is
accessible (rootful container) - that wouldn't be appropriate still.

https://github.com/containers/toolbox/pull/1291

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2023-05-03 13:41:01 +02:00
Ievgen Popovych 947bb612e1 images: ubuntu: Move flatpak-xdg-utils installation to Containerfile
Since `flatpak-xdg-utils` is essential to the images, not 'extra'.

https://github.com/containers/toolbox/pull/1291

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2023-05-03 13:41:00 +02:00
Debarshi Ray 1b3e557e20 .github/CODEOWNERS: Clarify ownership of the images for Ubuntu
This reflects the value of the 'maintainer' LABELs of the images.

https://github.com/containers/toolbox/pull/483
https://github.com/containers/toolbox/pull/1287
2023-04-06 15:11:41 +02:00
Debarshi Ray d6c64dc042 .github/CODEOWNERS: Clarify ownership of the images for RHEL
This partly reflects the value of the 'maintainer' LABELs of the current
images.  Oliver is the original author, but he has lots of other duties
these days, and wanted me to help him co-maintain the images.

Note that the toolbox image definitions for RHEL do need a maintainer
who is a Red Hat employee.  Otherwise they won't be able to actually
build and publish the images at registry.access.redhat.com.

https://github.com/containers/toolbox/pull/1288
2023-03-31 19:59:37 +02:00
Nils Lindemann add05de27e doc/toolbox-create: Tweak the default container examples for consistency
... with 'enter' and 'run'.

https://github.com/containers/toolbox/pull/1281

Signed-off-by: Nils Lindemann <nilslindemann@tutanota.com>
2023-03-30 21:52:49 +02:00
Nils Lindemann 05191026c9 doc/toolbox-enter, doc/toolbox-run: Fix the default container examples
The phrase 'using a custom image' is awkward because it makes it sound
as if the image plays an important role in 'enter' and 'run'.  That's
not true.

Also, titles are sweeter when they are shorter.

https://github.com/containers/toolbox/pull/1281

Signed-off-by: Nils Lindemann <nilslindemann@tutanota.com>
2023-03-30 21:48:30 +02:00
Nils Lindemann cceea52af6 doc/toolbox-enter, doc/toolbox-run: Fix the custom container examples
When a specific Toolbx container is selected by name for 'enter' and
'run', it's not necessary that the container was created using a custom
image.  The container could have also been created using one of the
built-in images.

Secondly, the phrase 'using a custom image' is awkward because it makes
it sound as if the image plays an important role in 'enter' and 'run'.
That's not true.

Finally, titles are sweeter when they are shorter.

https://github.com/containers/toolbox/pull/1281

Signed-off-by: Nils Lindemann <nilslindemann@tutanota.com>
2023-03-30 21:40:03 +02:00
Debarshi Ray 198107cceb .github/CODEOWNERS: Clarify the location of the data/gfx directory
... to be at the root of the repository.  Without the leading slash, the
documentation suggests that it could be a data/gfx directory anywhere in
the repository [1].

[1] https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

Fallout from 3773ceb0c5

https://github.com/containers/toolbox/pull/1286
2023-03-29 14:50:19 +02:00
Ievgen Popovych a84a358b3b pkg/utils, test/system: Offer built-in support for Ubuntu
This allows using the --distro and --release options to create and enter
Ubuntu containers.

Note that Ubuntu 4.10 was the first ever Ubuntu release [1].  Hence,
values older than that are not permitted for the --release option.

Some changes by Debarshi Ray.

[1] https://wiki.ubuntu.com/Releases

https://github.com/containers/toolbox/pull/483
https://github.com/containers/toolbox/pull/1284

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2023-03-28 00:14:19 +02:00
Ievgen Popovych 8c41d85498 images: Add ubuntu-toolbox image definitions for Ubuntu
These are the definitions of the ubuntu-toolbox images for Ubuntus
16.04, 18.04, 20.04, 22.04 and 22.10 that play well with Toolbx.  Such
as, password-less sudo, able to resolve its own hostname, SELinux is
masked off, etc..  At the moment, these are already published at
quay.io/toolbx-images/ubuntu-toolbox:22.04 and such.

https://github.com/containers/toolbox/pull/483
https://github.com/containers/toolbox/pull/1284

Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
2023-03-28 00:14:06 +02:00
Debarshi Ray ddd1221d44 test/system: Test 'run' with a RHEL Toolbx container
https://github.com/containers/toolbox/pull/1283
2023-03-27 13:44:38 +02:00
Debarshi Ray 7e9d3918f5 test/system: Test 'run' with a Fedora Toolbx container
It's good to ensure that older well-known Toolbx images continue to work
with newer versions of 'run'.

https://github.com/containers/toolbox/pull/1283
2023-03-27 13:41:51 +02:00
Debarshi Ray 7269547af9 cmd/utils: Handle space-separated input when asking for confirmation
fmt.Scanf [1] is fragile when it comes to space-separated input.  It
stores successive space-separated values into successive arguments as
determined by the format string.  This breaks with untrusted input that
can have an unknown number of space-separated values.

Here are some examples:

  $ toolbox create
  Image required to create toolbox container.
  Download registry.fedoraproject.org/fedora-toolbox:39 (294.8MB)?
    [y/N]: no no not at all
  $ no not at all
  bash: no: command not found...

  $ toolbox create
  Image required to create toolbox container.
  Download registry.fedoraproject.org/fedora-toolbox:39 (294.8MB)?
    [y/N]: foo bar
  Download registry.fedoraproject.org/fedora-toolbox:39 (294.8MB)?
    [y/N]: Download registry.fedoraproject.org/fedora-toolbox:39
    (294.8MB)? [y/N]:

Instead this is what should happen:

  $ toolbox create
  Image required to create toolbox container.
  Download registry.fedoraproject.org/fedora-toolbox:39 (294.8MB)?
    [y/N]: no no not at all
  Download registry.fedoraproject.org/fedora-toolbox:39 (294.8MB)?
    [y/N]: foo bar
  Download registry.fedoraproject.org/fedora-toolbox:39 (294.8MB)?
    [y/N]:

Fallout from 936f22ff15

[1] https://pkg.go.dev/fmt#Scanf

https://github.com/containers/toolbox/pull/1279
2023-03-27 09:28:14 +02:00
Debarshi Ray c56b74921a test/system: Test 'create' with a RHEL Toolbx container
https://github.com/containers/toolbox/pull/1282
2023-03-26 10:49:11 +02:00
Debarshi Ray 23e636bb2a test/system: Remove redundant quotes
https://github.com/containers/toolbox/pull/1282
2023-03-26 10:37:10 +02:00
Debarshi Ray 9f4d906e39 test/system: Remove redundant comment
It's quite obvious what the corresponding code is doing, and it isn't
any harder to understand than the rest of the code that's not commented.

https://github.com/containers/toolbox/pull/1282
2023-03-26 10:36:59 +02:00
Debarshi Ray 06245dbf52 test/system: Synchronize with the parseRelease() unit tests
https://github.com/containers/toolbox/pull/1280
2023-03-24 19:57:33 +01:00
Debarshi Ray 26b031f686 test/system: Split the tests for parsing releases
This will make it easier to find out exactly which test failed.

https://github.com/containers/toolbox/pull/1280
2023-03-23 18:09:45 +01:00
Debarshi Ray 44cbdb1f18 test/system: Ensure that both non-Toolbx containers & images are skipped
https://github.com/containers/toolbox/pull/1273
2023-03-22 12:05:06 +01:00
Debarshi Ray 11f5cde45e test/system: Check the number of images after pulling them
This is a quick sanity check with 'podman images' to ensure that all the
images are in place before running 'list'.  Other tests already do this,
so this change makes these two tests consistent with the rest.

https://github.com/containers/toolbox/pull/1273
2023-03-22 10:40:57 +01:00
Debarshi Ray 63aeabe86b test/system: Factor out some repeated code
https://github.com/containers/toolbox/pull/1273
2023-03-22 10:08:47 +01:00
Debarshi Ray 55bf3d06a8 test/system: Use fully qualified image names to check the 'list' output
https://github.com/containers/toolbox/pull/1273
2023-03-22 09:45:23 +01:00
Debarshi Ray 164c9eff36 test/system: Test 'list' with a RHEL Toolbx image
This restores parts of commit e09de9f3e5.

https://github.com/containers/toolbox/pull/1273
2023-03-22 09:18:04 +01:00
Debarshi Ray aa9da193c6 test/system: Test 'list' with an old Fedora Toolbx image
It's good to ensure that older well-known Toolbx images continue to work
with newer versions of 'list'.

https://github.com/containers/toolbox/pull/1278
2023-03-22 09:16:58 +01:00
Debarshi Ray 571cfc1296 test/system: Use the same convenience function as elsewhere
Fallout from b27795a03e

https://github.com/containers/toolbox/pull/1278
2023-03-22 09:16:52 +01:00
Debarshi Ray 96d629c21f test/system: Test 'list' with the default Toolbx image
This is the 'simple' case of having a well-known Toolbx image (ie.,
not a copy, not an image without a name, not a non-Toolbx image).  It's
good to ensure that the default image works as expected with 'list'
before moving on to more complex scenarios.

https://github.com/containers/toolbox/pull/1278
2023-03-22 09:16:44 +01:00
Debarshi Ray 20fa122820 test/system: Test 'list' both with and without --images
https://github.com/containers/toolbox/pull/1278
2023-03-22 09:16:37 +01:00
Debarshi Ray 6890f5dc8d test/system: Rename a 'list' test for clarity
A subsequent commit will add a variant of this test that uses 'list'
without the '--images' option.

https://github.com/containers/toolbox/pull/1278
2023-03-22 09:16:29 +01:00
Debarshi Ray 9cae66ddd8 test/system: Check the standard error & output streams separately
https://github.com/containers/toolbox/pull/1278
2023-03-22 09:16:20 +01:00
Debarshi Ray e22a82fec8 test/system: Simplify the line count checks by relying on Bats >= 1.7.0
Fedora 35 was stuck with Bats 1.5.0.  However, it reached End of Life on
13th December 2022 and was dropped from the CI [1].  Fedora 36 is the
oldest supported Fedora and it has Bats 1.8.2.

Therefore, there's no need to retain compatibility with Bats < 1.7.0.

Note that bats_require_minimum_version itself is only available from
Bats 1.7.0 [2].

[1] Commit 419e4e8cd9
    https://github.com/containers/toolbox/pull/1237

[2] Bats commit 71d6b71cebc3d32b
    https://github.com/bats-core/bats-core/issues/556
    https://bats-core.readthedocs.io/en/stable/warnings/BW02.html

https://github.com/containers/toolbox/pull/1273
2023-03-21 19:20:21 +01:00
Debarshi Ray 08e40e666e test/system: Shorten the names of the tests and use consistent wording
Currently, some of the names of the tests were too long, and had
inconsistent and verbose wording.  This made it difficult to look at
them and get a gist of all the scenarios being tested.  The names are
like headings.  They shouldn't be too long, should capture the primary
objective of the test and be consistent in their wording.

https://github.com/containers/toolbox/pull/1276
2023-03-21 19:11:20 +01:00
Debarshi Ray 5b8a7a00c0 test/system: Use long options, instead of their shorter aliases
The long options are easier to grep(1) for in the sources than their
shorter aliases.

https://github.com/containers/toolbox/pull/1276
2023-03-21 19:11:13 +01:00
Debarshi Ray f364812781 test/system: Shorten the names of the tests and use consistent wording
Currently, some of the names of the tests were too long, and had
inconsistent and verbose wording.  This made it difficult to look at
them and get a gist of all the scenarios being tested.  The names are
like headings.  They shouldn't be too long, should capture the primary
objective of the test and be consistent in their wording.

https://github.com/containers/toolbox/pull/1271
2023-03-20 18:28:10 +01:00
Debarshi Ray edd82d7e6e test/system: Style fixes
Fallout from e5bab51bca

https://github.com/containers/toolbox/pull/1271
2023-03-20 18:28:07 +01:00
Debarshi Ray 3773ceb0c5 .github/CODEOWNERS: Clarify ownership of the Toolbx graphics
https://github.com/containers/toolbox/pull/1270
2023-03-20 15:25:21 +01:00
Debarshi Ray 0200b4e6d9 .github: Add CODEOWNERS
Toolbx was conceived to address the needs of Fedora Linux.  Even though
it works on host operating systems outside the Fedora family, it hasn't
treated them with the same importance as Fedora Linux and derivatives
like Red Hat Enterprise Linux.  Subsequent commits will change that by
adding first-class support for host operating systems beyond the Fedora
universe.  eg., Arch Linux and Ubuntu.

The current Toolbx maintainers, Ondřej Míchal and myself, are Fedora
developers and don't have the bandwidth to drive changes and track down
bugs in OSes outside the Fedora family.  Therefore, maintenance of some
parts of the code base will be delegated to contributors from those
other OS communities.

This is a step in that direction by clearly specifying which part of the
code base is maintained by whom.

https://github.com/containers/toolbox/pull/1268
2023-03-17 19:28:15 +01:00
Debarshi Ray c6760299d2 pkg/utils, test/system: Add some more tests for parsing RHEL releases
https://github.com/containers/toolbox/pull/1262
2023-03-16 22:01:45 +01:00
Debarshi Ray e01927bfdc pkg/utils, test/system: Add some more tests for parsing Fedora releases
https://github.com/containers/toolbox/pull/1262
2023-03-16 22:01:45 +01:00
Debarshi Ray 1c320b0eb0 pkg/utils: Simplify the definition of parseRelease() unit test cases
https://github.com/containers/toolbox/pull/1267
2023-03-16 21:04:24 +01:00
Debarshi Ray 56a64a68bd pkg/utils: Remove unused error
Fallout from b5474bff84

https://github.com/containers/toolbox/pull/1267
2023-03-16 20:53:12 +01:00
Debarshi Ray a4cc791f39 test/system: Synchronize with the parseRelease() unit tests
https://github.com/containers/toolbox/pull/1266
2023-03-16 18:41:24 +01:00
Debarshi Ray 1bd6cf17ce test/system: Split the tests for parsing releases
This will make it easier to find out exactly which test failed.

https://github.com/containers/toolbox/pull/1266
2023-03-16 18:31:12 +01:00
Debarshi Ray 6b6cb1b2f9 .zuul: Enable testing on Fedora 38
https://github.com/containers/toolbox/pull/1265
2023-03-16 17:57:46 +01:00
Debarshi Ray e5bab51bca test/system: Shorten the names of the tests and use consistent wording
Currently, some of the names of the tests were too long, and had
inconsistent and verbose wording.  This made it difficult to look at
them and get a gist of all the scenarios being tested.  The names are
like headings.  They shouldn't be too long, should capture the primary
objective of the test and be consistent in their wording.

https://github.com/containers/toolbox/pull/1265
2023-03-16 17:57:46 +01:00
Debarshi Ray 068d22a199 test/system: Use long options, instead of their shorter aliases
The long options are easier to grep(1) for in the sources than their
shorter aliases.

https://github.com/containers/toolbox/pull/1265
2023-03-16 17:37:16 +01:00
Nieves Montero a1c309541f Report the size of the image that will be downloaded from a registry
This uses 'skopeo inspect' to get the size of the image on the registry,
which is usually less than the size of the image in a local
containers/storage image store after download (eg., 'podman images'),
because they are kept compressed on the registry.  Skopeo >= 1.10.0 is
needed to retrieve the sizes [1].

However, this doesn't add a hard dependency on Skopeo to accommodate
size-constrained operating systems like Fedora CoreOS.  If skopeo(1) is
missing or too old, then the size of the image won't be shown, but
everything else would continue to work as before.

Some changes by Debarshi Ray.

[1] Skopeo commit d9dfc44888ff71a6
    https://github.com/containers/skopeo/commit/d9dfc44888ff71a6
    https://github.com/containers/skopeo/issues/641

https://github.com/containers/toolbox/issues/752

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2023-03-14 01:05:50 +01:00
Debarshi Ray 2129e28fe6 cmd/create, cmd/root, cmd/run: Tweak the debug logs for consistency
Debug logs are sweeter when they are shorter.

https://github.com/containers/toolbox/pull/1258
2023-03-08 00:18:46 +01:00
Debarshi Ray fb15655ace cmd/create: Simplify code
Fallout from 8e80dd5db1

https://github.com/containers/toolbox/pull/1256
2023-03-07 17:23:32 +01:00
Debarshi Ray aeae18920b cmd/initContainer: Bind mount locations regardless of /run/host/etc
Bind mounting the locations at runtime doesn't really have anything to
do with whether /run/host/etc is present inside the Toolbx container.

The only possible exception could have been /etc/machine-id, but it
isn't, because the bind mount is only performed if the source at
/run/host/etc/machine-id is present.

This is a historical mistake that has persisted for a long time, since,
in practice, /run/host/etc will almost always exist inside the Toolbx
container.  It's time to finally correct it.

Fallout from 9436bbece0

https://github.com/containers/toolbox/pull/1255
2023-03-07 16:34:16 +01:00
Debarshi Ray 58638c5940 Deprecate the --monitor-host option of 'init-container'
The --monitor-host option was added to the 'init-container' command in
commit 8b84b5e460 to accommodate Podman versions older than 1.2.0
that didn't have the '--dns none' and '--no-hosts' options for
'podman create'.  These options are necessary to keep the Toolbx
container's /etc/resolv.conf and /etc/hosts files synchronized with
those of the host.

Note that Podman 1.2.0 was already available a few months before
commit 8b84b5e460 introduced the --monitor-host option.  The
chances of someone using an older Podman back then was already on the
decline, and it's very unlikely that a container created with such a
Podman has survived till this date.

Commit b6b484fa79 raised the minimum required Podman version to
1.4.0, and made the '--dns none' and '--no-hosts' options a hard
requirement.  The minimum required Podman version was again raised
recently in commit 8e80dd5db1 to 1.6.4.  Therefore, these days,
there's no need to separately use the --monitor-host option of
'init-container' for newly created containers to indicate that the
Podman version wasn't older than 1.2.0.

Given all this, it's time to stop using the --monitor-host option of
'init-container', and assume that it's always set.  The option is still
accepted to retain compatibility with existing Toolbx containers.

For containers that were created with the --monitor-host option, a
deprecation notice will be shown as:
  $ podman start --attach CONTAINER
  Flag --monitor-host has been deprecated, it does nothing
  ...

https://github.com/containers/toolbox/pull/617
2023-03-07 15:39:57 +01:00
Debarshi Ray 9680e4eeb2 cmd, doc: Style fixes
https://github.com/containers/toolbox/pull/1254
2023-03-07 14:58:11 +01:00
Debarshi Ray 8e80dd5db1 cmd/create, cmd/run: Rely on podman >= 1.6.4 always being present
So far the minimum required Podman version was 1.4.0, based on what used
to be available in RHEL 7.  These days, Podman 1.6.4 is old enough to be
in RHEL 7.9.  Hence it's time to bump the baseline.

https://github.com/containers/toolbox/pull/1253
2023-03-02 18:36:30 +01:00
Debarshi Ray de652f4102 Test that toolbox(1) can be built without podman(1) and subordinate IDs
This is meant to roughly replicate the build environments used by
downstream distributors to build toolbox(1).  These can be restricted in
odd ways compared to a fully featured environment where toolbox(1) is
actually going to be used.  eg., the inability to use podman(1) in the
case of Fedora or not having subordinate user and group ID ranges in the
case of openSUSE.

It's important to ensure that toolbox(1) can be built by downstream
distributors without any unnecessary hassle.

https://github.com/containers/podman/issues/17657
https://github.com/containers/toolbox/issues/1246
2023-03-02 10:25:54 +01:00
Jan Zerebecki f555029304 cmd/root: Don't validate subordinate IDs when generating the completions
Ever since commit bafbbe81c9, the shell completions are generated
while building Toolbx using the 'completion' command.  This involves
running toolbox(1) itself, and hence validating the subordinate user and
group ID ranges.

Unfortunately, some build environments, like openSUSE's, don't have
subordinate ID ranges set up.  Therefore, it's better to not validate
the subordinate ID ranges when generating the shell completions, since
they are generated by Cobra itself and subordinate ID ranges are not
involved at all.

Note that subordinate ID ranges may be needed when the generated shell
completions are actually used in interactive command line environments.
The shell completions invoke the hidden '__complete' command to get the
results that are presented to the user, and, if needed, the subordinate
ID ranges will continue to be used by podman(1) as part of that.

Some changes by Debarshi Ray.

https://github.com/containers/toolbox/issues/1246
https://github.com/containers/toolbox/pull/1249
2023-03-02 10:25:54 +01:00
Debarshi Ray 816a7cab9e cmd/root: Shuffle some code around and sprinkle some debug logs
Having a separate convenience function reduces the indentation levels by
at least one, and sometimes two, and makes it easy to have more detailed
debug logs.

This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/issues/1246
2023-03-02 10:25:54 +01:00
dependabot[bot] 9708cbf269 build: Bump golang.org/x/sys to 0.1.0 for CVE-2022-29526
... or GHSA-p782-xgp4-8hr8.

https://github.com/containers/toolbox/pull/1245
https://github.com/containers/toolbox/security/dependabot/12

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 10:12:03 +01:00
Debarshi Ray cafbca996e cmd/root: Sprinkle a debug log
https://github.com/containers/toolbox/pull/1251
2023-03-01 19:43:09 +01:00
Timothée Ravier 9506173f88 images: Don't leak NAME and VERSION into the Toolbx container
Note that there can be only one ARG per line.  Otherwise, the build may
fail with some build systems.  eg., Fedora's [1], which uses Docker, not
Podman.

Only the images for currently maintained Fedoras (ie., 36, 37, 38 & 39)
were updated.

[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=98150241

https://github.com/containers/toolbox/issues/188
2023-03-01 17:06:58 +01:00
Debarshi Ray fc5f568c5d cmd/root: Don't use podman(1) when generating the completions
Ever since commit bafbbe81c9, the shell completions are generated
while building Toolbx using the 'completion' command.  This involves
running toolbox(1) itself, and hence invoking 'podman version' to decide
if 'podman system migrate' is needed or not.

Unfortunately, some build environments, like Fedora's, are set up inside
a chroot(2) or systemd-nspawn(1) or similar, where 'podman version' may
not work because it does various things with namespaces(7) and clone(2)
that can, under certain circumstances, encounter an EPERM.

Therefore, it's better to avoid using podman(1) when generating the
shell completions, especially, since they are generated by Cobra itself
and podman(1) is not involved at all.

Note that podman(1) is needed when the generated shell completions are
actually used in interactive command line environments.  The shell
completions invoke the hidden '__complete' command to get the results
that are presented to the user, and, if needed, 'podman system migrate'
will continue to be run as part of that.

This partially reverts commit f3e005d014
because podman(1) is now only an optional runtime dependency for the
system tests.

https://github.com/containers/podman/issues/17657
2023-02-28 19:30:29 +01:00
Debarshi Ray f7c4c7dedb Release 0.0.99.4
https://github.com/containers/toolbox/pull/1241
2023-02-20 17:02:55 +01:00
Debarshi Ray 8af015ed37 cmd/create, cmd/run: Style fixes
It's better not to use the global flag variables beyond the top-level
RunE functions, because sometimes the lower-level functions are re-used
from other files within the 'cmd' package.  In this case,
createContainer(), and hence pullImage(), is also used in src/cmd/run.go
to implement the 'run' command.  However, the 'run' command doesn't have
a --authflags option.

Since the default value of the flag is the zero value of the type, which
is a NOP in the code, it's likely that the code was still correct, but
it will be better to maintain some discipline here to highlight the
inputs needed by the lower-level functions.  Otherwise, things can get
tangled up.

Fallout from ecd1ced719

https://github.com/containers/toolbox/pull/1240
2023-02-16 15:14:33 +01:00
Debarshi Ray 48c07b8e5b doc/toolbox-create: Fix typo
The rest of the manual refers to the file passed to the --authfile
option as FILE, not AUTHFILE.

Fallout from ecd1ced719

https://github.com/containers/toolbox/pull/1240
2023-02-16 14:48:32 +01:00
Debarshi Ray 34baa10f41 pkg/utils: Update fallback release to 37 for non-fedora hosts
Fedora 34 reached End of Life on 7th June 2022:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1239
2023-02-16 14:12:05 +01:00
Debarshi Ray 31e01ac46b images: Add fedora-toolbox image definition for Fedora 39
This is untested because the registry.fedoraproject.org/fedora:39 base
image doesn't yet exist:
  $ podman build --squash --tag localhost/fedora-toolbox:39
    images/fedora/f39/
  STEP 1/19: FROM registry.fedoraproject.org/fedora:39
  Trying to pull registry.fedoraproject.org/fedora:39...
  Error: creating build container: initializing source
    docker://registry.fedoraproject.org/fedora:39: reading manifest 39
    in registry.fedoraproject.org/fedora: manifest unknown

https://github.com/containers/toolbox/issues/1233
2023-02-10 22:02:41 +01:00
Debarshi Ray 2a5f20e1b4 doc/toolbox, doc/toolbox-run: Refer to a newer Fedora release
Fedora 35 reached End of Life on 13th December 2022:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1237
2023-02-10 22:00:16 +01:00
Debarshi Ray 419e4e8cd9 .zuul: Drop testing on Fedora 35
Fedora 35 reached End of Life on 13th December 2022:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/1237
2023-02-10 21:54:12 +01:00
Debarshi Ray d0421dcd2b .zuul: Enable testing on Fedora 37
https://github.com/containers/toolbox/pull/1237
2023-02-10 21:46:01 +01:00
Debarshi Ray 8af80292d3 pkg/utils: Preserve the session class
In order to work with systemd-logind, a display manager is expected to
set the session class [1].  Setting the XDG_SESSION_CLASS environment
variable is one way to do that.

It's worth noting that the GNOME Display Manager (or GDM) does set
XDG_SESSION_CLASS [2] even though GNOME Shell uses other means to
differentiate between 'greeter' and 'user' sessions.

[1] https://www.freedesktop.org/wiki/Software/systemd/writing-display-managers/

[2] GDM commit 29ebbbb37bb65fad
    https://gitlab.gnome.org/GNOME/gdm/-/commit/29ebbbb37bb65fad
    https://bugzilla.gnome.org/show_bug.cgi?id=670100

https://github.com/containers/toolbox/issues/992
2023-02-10 20:18:57 +01:00
Debarshi Ray 6fcda6974f cmd/initContainer: Give access to /run/systemd/users from the host
Just like /run/systemd/sessions makes it possible to get the seat for a
session ID, /run/systemd/users can make it possible to get the seat and
the session ID for a user's UID.

The absence of /run/systemd/users inside Toolbx containers isn't
currently causing problems for any use-case, but it seems very close
to the sort of things that were necessary to run a non-nested display
server from within a Toolbx container on a virtual terminal.  It's not
impossible that in future some implementation details of the display
server stack may make /run/systemd/users necessary.

https://github.com/containers/toolbox/issues/992
2023-02-10 19:52:39 +01:00
Sebastian Wick 5de1fae219 cmd/initContainer: Make sd_booted(3) work inside Toolbx containers
Not having sd_booted(3) work inside Toolbx containers isn't currently
causing problems for any use-case.  However, it did come in handy when
investigating how to run a non-nested display server from within a
Toolbx container on a virtual terminal, because it's necessary for
'systemd --user' to realize that the host operating system was booted
with systemd.

https://github.com/containers/toolbox/issues/992

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-02-10 19:38:57 +01:00
Sebastian Wick 9979c275e8 cmd/create: Use the host's cgroup namespace for the Toolbx container
Podman creates a private cgroup namespace for containers on cgroups v2
by default.  The host's cgroupfs is mounted at /sys/fs/cgroup giving an
inconsistent view of the cgroups.  Toolbx doesn't intend to provide a
segregated security domain.  So, there is no need for a cgroup namespace
and Toolbx containers can just use the host's namespace.

Having a private cgroup namespace for containers isn't currently causing
problems for any use-case, but it did come in handy when investigating
how to run a non-nested display server from within a Toolbx container on
a virtual terminal.  Since this requires a change to the 'podman create'
arguments, it's not going to have an effect on existing containers, and
re-creating containers is annoying for users.  So, it might be better to
get ahead of the curve and do it preemptively.

https://github.com/containers/toolbox/issues/992

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-02-10 17:22:06 +01:00
Jonas Ådahl 8bb9fc6bc4 cmd/initContainer: Give access to /run/udev/tags from the host
This is needed by display servers for creating udev device enumerators
that matches against tags.

https://github.com/containers/toolbox/issues/992

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-02-09 17:38:58 +01:00
Jonas Ådahl 850ba73a7c cmd/initContainer: Enable display servers to get the seat for a session
... by giving access to /run/systemd/sessions from the host operating
system.

https://github.com/containers/toolbox/issues/992

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-02-09 17:34:27 +01:00
Debarshi Ray e0cd693893 images: Add toolbox image definitions for RHELs 8.5, 8.6 and 8.7
This is the full definition of the UBI-based toolbox image published for
RHEL 8 >= 8.5 [1] at registry.access.redhat.com/ubi8/toolbox:8.7 and
such. Note that the Dockerfile used to build this image was already
available to the public [2], but didn't include all the files necessary
to build it.

The FROM line has been changed to registry.access.redhat.com/ubi8:8.7
and such so that it can be built outside Red Hat's build system and
always points to the desired RHEL version.

[1] https://catalog.redhat.com/software/containers/ubi8/toolbox/611bd665bd674341b5c5ed46

[2] https://catalog.redhat.com/software/containers/ubi8/toolbox/611bd665bd674341b5c5ed46?container-tabs=dockerfile

https://github.com/containers/toolbox/pull/1232
2023-02-07 22:19:59 +01:00
Debarshi Ray 735eca63b7 images: Add toolbox image definition for RHEL 9.1
This is the full definition of the UBI-based toolbox image published for
RHEL 9.1 [1] at registry.access.redhat.com/ubi9/toolbox:9.1.  Note that
the Dockerfile used to build this image was already available to the
public [2], but didn't include all the files necessary to build it.

However, this has some minor deviations from the published image.  The
FROM line has been changed to registry.access.redhat.com/ubi9:9.1 so
that it can be built outside Red Hat's build system and always points to
the desired RHEL version.  The extra-packages file doesn't have
gnupg2-smime because it doesn't seem to be actually part of the UBI RPM
repositories, and it's not clear how it works inside Red Hat's build
system.  Otherwise, 'podman build' fails with:
  STEP 11/14: RUN dnf -y install $(<extra-packages)
  ...
  Last metadata expiration check: 0:00:23 ago on Tue Feb  7 18:50:13...
  ...
  No match for argument: gnupg2-smime
  ...
  Error: Unable to find a match: gnupg2-smime
  Error: building at STEP "RUN dnf -y install $(<extra-packages)": while
    running runtime: exit status 1

[1] https://catalog.redhat.com/software/containers/ubi9/toolbox/61532d7dd2c7f84a4d2ed86b

[2] https://catalog.redhat.com/software/containers/ubi9/toolbox/61532d7dd2c7f84a4d2ed86b?container-tabs=dockerfile

https://github.com/containers/toolbox/pull/1232
2023-02-07 22:19:54 +01:00
Debarshi Ray 470a15ff71 images: Synchronize README.md
The canonical copy of README.md contains banners and labels in the
header that aren't useful when the file is shipped as part of the
images.  Hence, those were removed.

Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

https://github.com/containers/toolbox/pull/1231
2023-02-07 20:46:38 +01:00
Debarshi Ray 6a3c5ce8d1 images/fedora/f37, images/fedora/f38: Replace jwhois with whois
Since Fedora 37, the whois package has replaced jwhois as the default
whois(1) implementation [1] on Fedora Silverblue and Workstation.

[1] fedora-comps commit e4bf2706306c219a
    https://pagure.io/fedora-comps/c/e4bf2706306c219a
    https://pagure.io/fedora-comps/pull-request/729
    https://fedoraproject.org/wiki/Changes/Replace_jwhois_with_whois_in_Fedora_Workstation

https://github.com/containers/toolbox/pull/1228
2023-02-02 20:15:12 +01:00
Debarshi Ray 707607d839 images: Ensure that the gpg2(1), gnupg2(7), etc. manuals are available
It turns out that at least since Fedora 30 [1], the gnupg2 package has
been part of the fedora base image, because it's required by the dnf
package:
  dnf -> python3-dnf -> python3-libdnf -> libdnf -> gpgme -> gnupg2

Hence, the need to restore the gnupg2 documentation that was stripped
out in the base image.

Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

[1] It's difficult to find out if the gnupg2 package wasn't part of the
    fedora base image before Fedora 30, because those images are no
    longer available from registry.fedoraproject.org.

https://github.com/containers/toolbox/pull/1228
2023-02-02 17:25:31 +01:00
Debarshi Ray d22fa5b731 images: Use the package name instead of a virtual Provides for gnupg2
The package for GnuPG 2.0 has always been called gnupg2 [1], so this
must have been a mistake.

Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

Fallout from 34bfd0317d

[1] https://pagure.io/fedora-comps/blob/main/f/comps-f21.xml.in

https://github.com/containers/toolbox/pull/1228
2023-02-02 16:52:45 +01:00
Debarshi Ray 4f907d32f3 images: Ensure that the kill(1), mount(8), etc. manuals are available
Note that in the past, it was observed that the util-linux package was
no longer part of the fedora base images starting from Fedora 35 [1],
and indeed it wasn't [2].  However, later the util-linux-core subset was
restored from Fedora 36 onwards [3].  Hence, the need to restore the
util-linux-core documentation that was stripped out in the base image.

Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

Original patch from Jens Petersen for Fedora [4].

[1] Commit df05e276b2
    https://github.com/containers/toolbox/issues/929

[2] fedora-kickstarts commit 1f3645b72d46a0a7
    https://pagure.io/fedora-kickstarts/c/1f3645b72d46a0a7
    https://bugzilla.redhat.com/show_bug.cgi?id=1951111

[3] fedora-kickstarts commit 4477181faf75e105
    https://pagure.io/fedora-kickstarts/c/4477181faf75e105

[4] Fedora fedora-toolbox commit 805dc32c280b10f3
    https://src.fedoraproject.org/container/fedora-toolbox/c/805dc32c280b10f3

https://github.com/containers/toolbox/pull/1227
2023-02-01 21:57:01 +01:00
Debarshi Ray a2ef3a292c images: Ensure that the cat(1), cp(1), ls(1), etc. manuals are available
Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

Original patch from Jens Petersen for Fedora [1].

[1] Fedora fedora-toolbox commit 98d9106a1f2f7a30
    https://src.fedoraproject.org/container/fedora-toolbox/c/98d9106a1f2f7a30

https://github.com/containers/toolbox/pull/1226
2023-02-01 19:26:36 +01:00
Debarshi Ray ff1212e103 images: Ensure that the desired manuals are indeed present
Building an OCI image leads to so much spew that it's hard to notice if
something unexpected happened, and as seen in the previous commit [1],
unexpected things do happen.

Therefore, this adds a built-in test to ensure that the desired files
are actually present in the final image.  Right now it only checks the
presence of some representative manuals to ensure that the packages
listed in the 'missing-docs' file really do get reinstalled, and the
documentation that was stripped out in the base image really does get
restored.

Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

[1] Commit 1fc50176c9
    https://github.com/containers/toolbox/pull/1226

https://github.com/containers/toolbox/pull/1226
2023-02-01 19:21:59 +01:00
Debarshi Ray 1fc50176c9 images: Avoid unexpected DNF behaviour when reinstalling or swapping
The RPM packages in the base 'fedora' image can be older than the those
currently available in the DNF 'updates' repository [1], but at the same
time newer than those available in the DNF 'fedora' repository [1].  The
first part happens because the base image isn't updated as often as the
individual packages, so the 'updates' repository can have newer RPMs.
The second part happens because the base image does get updated after a
stable Fedora has been released, and hence can have newer RPMs than the
'fedora' repository.

This is complicated by the fact that packages can get pulled directly
from Fedora's Koji build system into the base 'fedora' image before
they make it to one of the well-known repositories like 'fedora' or
'updates' [1].  These packages are marked as having come from the
koji-override-0 repository.

All that combined can lead to unexpected behaviour when DNF is invoked
to reinstall or swap the RPM packages in the base image.  Some examples
below.

The base fedora:36 image contains glibc-minimal-langpack-2.35-20.fc36
that came from koji-override-0, while 'fedora' and 'updates' have
glibc-all-langpacks-2.35-4.fc36 and glibc-all-langpacks-2.35-22.fc36
respectively.  This leads to:
  STEP 8/15: RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
  Last metadata expiration check: 0:00:03 ago on Wed Feb  1 12:37:04...
  Dependencies resolved.
  ======================================================================
   Package                   Arch      Version          Repository
  ======================================================================
  Installing:
   glibc-all-langpacks       x86_64    2.35-4.fc36      fedora
  Removing:
   glibc-minimal-langpack    x86_64    2.35-20.fc36     @koji-override-0
  Downgrading:
   glibc                     x86_64    2.35-4.fc36      fedora
   glibc-common              x86_64    2.35-4.fc36      fedora

That's unexpected.  Instead of upgrading all the glibc sub-packages to
the latest version from 'updates', it's downgrading them to the older
version from 'fedora'.

Similarly, the base fedora:36 image has bash-5.2.9-2.fc36.x86_64 from
koji-override-0, and there is bash-5.2.15-1.fc36.x86_64 in 'updates'.
This leads to:
  STEP 10/15: RUN dnf -y reinstall $(<missing-docs)
  Last metadata expiration check: 0:00:06 ago on Wed Feb  1 12:37:04...
  Package acl available, but not installed.
  No match for argument: acl
  Installed package bash-5.2.9-2.fc36.x86_64 (from koji-override-0) not
    available.

That's unexpected.  Instead of upgrading bash to the latest version from
'updates', it's simply skipping the 'reinstall', which means that the
documentation that was stripped out in the base image doesn't get
restored.

Updating all the RPM packages in the base 'fedora' image to match the
contents of the 'updates' repository before making any changes to the
image's package set will avoid such unexpected behaviour.

Only the images for currently maintained Fedoras (ie., 36, 37 and 38)
were updated.

[1] https://docs.fedoraproject.org/en-US/quick-docs/repositories/

https://github.com/containers/toolbox/pull/1226
2023-02-01 19:17:14 +01:00
Debarshi Ray 0fa328dec2 images/fedora/f36: Pull in the i18n and l10n fixes from f37 and f38
This is a combination of the following commits:
  * e6a27d7926
  * f5388cfc06
  * 5b4a4449b0
  * 42dbd8e182

https://github.com/containers/toolbox/issues/60
2023-02-01 01:05:26 +01:00
Debarshi Ray 42dbd8e182 images/fedora/f37, images/fedora/f38: Fix typos
Fallout from f5388cfc06

https://github.com/containers/toolbox/issues/60
2023-02-01 01:03:18 +01:00
Debarshi Ray 5b4a4449b0 images/fedora/f37, images/fedora/f38: Configure RPM before using DNF
Changes to the RPM configuration should happen before DNF is used.
Otherwise, those changes won't affect the DNF invocations.

Fallout from f5388cfc06

https://github.com/containers/toolbox/issues/60
2023-02-01 01:02:49 +01:00
Debarshi Ray d932b039c8 cmd/run: Remove unused code
Go's encoding/json package parses all JSON numbers as float64 [1].  This
oddity was noticed when this code was first written [2], and was later
confirmed.

[1] https://pkg.go.dev/encoding/json#Unmarshal

[2] Commit cf5c58ab00
    https://github.com/containers/podman/issues/6105

https://github.com/containers/toolbox/pull/1224
2023-01-31 16:17:49 +01:00
Debarshi Ray 052666840a Fix spelling mistakes
The noun is 'setup' and the verb is 'set up'.  Similarly 'lookup' and
'look up'.

Original patch from Erik Sjölund for Podman [1,2].

[1] Podman commit aa4279ae151fa9df
    https://github.com/containers/podman/commit/aa4279ae151fa9df
    https://github.com/containers/podman/pull/14658

[2] Podman commit 2827140907255ed0
    https://github.com/containers/podman/commit/2827140907255ed0
    https://github.com/containers/podman/pull/14659

https://github.com/containers/toolbox/pull/1223
2023-01-31 15:53:15 +01:00
Debarshi Ray 0a29b374e6 pkg/utils: Support RHEL 9 Toolbx containers
The URLs for the RHEL Toolbx images based on the Red Hat Universal Base
Images (or UBI) are a bit more complicated to construct, in comparison
to the URLs for Fedora's fedora-toolbox images.  It's not enough to just
concatenate the registry, the image's basename and the release.  Some
parts of the URL depend on the release's major number, which requires
custom code.

So far, the release's major number was hard coded to 8 since only RHEL 8
Toolbx containers were supported.

To support other RHEL major releases, it's necessary to have custom code
to construct the URLs for the Toolbx images.

https://github.com/containers/toolbox/issues/1065
2023-01-29 11:33:01 +01:00
Debarshi Ray 262c90e06f pkg/utils: Be more strict about what is acceptable
https://github.com/containers/toolbox/issues/1065
2023-01-29 11:33:01 +01:00
Debarshi Ray 825c7e8594 .github/workflows: Remove golangci-lint
The previous commit broke the golangci-lint test [1] because the GitHub
Action runs on Ubuntu 22.04, which only has Shadow 4.8 [2], whereas
libsubid.so was introduced in Shadow 4.9 [3].

However, that's not a big deal because 'go vet' was earlier added to the
set of tests run by 'meson test' [4], and 'go vet' is one of the linters
run by golangci-lint [5].  So, while it's not a proper replacement, it's
good enough.

[1] Commit ca8007c192
    https://github.com/containers/toolbox/pull/1180

[2] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[3] Shadow commit 0a7888b1fad613a0
    https://github.com/shadow-maint/shadow/commit/0a7888b1fad613a0
    https://github.com/shadow-maint/shadow/issues/154

[4] Commit f695012faf
    https://github.com/containers/toolbox/pull/1186

[5] https://golangci-lint.run/usage/linters/
    https://golangci-lint.run/usage/linters/#govet

This reverts commit 7c86f30b77.

https://github.com/containers/toolbox/pull/1221
2023-01-29 11:32:03 +01:00
Martin Jackson ca8007c192 Support subordinate user and group ID ranges on enterprise set-ups
On enterprise FreeIPA set-ups, the subordinate user and group IDs are
provided by SSSD's sss plugin for the GNU Name Service Switch (or NSS)
functionality of the GNU C Library.  They are not listed in /etc/subuid
and /etc/subgid.  Therefore, its necessary to use libsubid.so to check
the subordinate ID ranges.

The CGO interaction with libsubid.so is loosely based on 'readSubid' in
github.com/containers/storage/pkg/idtools [1].

However, unlike 'readSubid', this code considers the absence of any
range (ie., nRanges == 0) to be an error as well.

More importantly, this code uses dlopen(3) and friends to dynamically
load the symbols from libsubid.so, instead of linking to libsubid.so at
build-time and having the dependency noted in the /usr/bin/toolbox
binary.  This is done because libsubid.so itself depends on several
other shared libraries, and indirect dependencies can't be influenced
by the RUNPATH [2] embedded in the /usr/bin/toolbox binary [3].  Hence,
when the binary is used inside Toolbx containers (eg., as the entry
point), those indirect dependencies won't be picked from the host's
runtime against which the binary was built.  This can render the binary
useless due to ABI compatibility issues.  Using dlopen(3) avoids this
problem, especially because libsubid.so is only used when running on the
host.

Care was taken to not load and link libsubid.so twice to separately
validate the subordinate ID ranges for the user and the group.  Note
that libsubid_init() must be passed a FILE pointer for logging.
Otherwise, it will create it's own for logging, and there's no way to
close it during dlclose(3).

Version 4 of the libsubid.so API/ABI [4] was released in Shadow 4.10,
which is newer than the versions shipped on RHEL 8 and Debian 10 [5],
and even that newer version had some problems [6].  Therefore, support
for older versions, with the relevant workarounds, is necessary.
Fortunately, the oldest that needs to be support is Shadow 4.9 because
that's when libsubid.so was introduced [7].

Note that SUBID_ABI_VERSION was only introduced with version 4 of the
libsubid.so API/ABI released in Shadow 4.10 [8].  The first release of
libsubid.so in Shadow 4.9 already had an ABI version of 3.0.0 [9], since
it was bumped a few times during development, so that's what's assumed
when SUBID_ABI_VERSION is absent.

This code doesn't set the public variables Prog and shadow_logfd that
older Shadow versions used to expect for logging, because from Shadow
4.9 onwards there's a separate function [4,10] to specify these.  This
can be changed if there are libsubid.so versions in the wild that really
do need those public variables to be set.

Finally, ISO C99 is required because of the use of <stdbool.h> in the
libsubid.so API.

Some changes by Debarshi Ray.

[1] https://github.com/containers/storage/blob/main/pkg/idtools/idtools_supported.go

[2] https://man7.org/linux/man-pages/man8/ld.so.8.html

[3] Commit 6063eb27b9
    https://github.com/containers/toolbox/issues/821

[4] Shadow commit 32f641b207f6ddff
    https://github.com/shadow-maint/shadow/commit/32f641b207f6ddff
    https://github.com/shadow-maint/shadow/issues/443

[5] https://packages.debian.org/source/buster/shadow

[6] Shadow commit 79157cbad87f42cd
    https://github.com/shadow-maint/shadow/commit/79157cbad87f42cd
    https://github.com/shadow-maint/shadow/issues/465

[7] Shadow commit 0a7888b1fad613a0
    https://github.com/shadow-maint/shadow/commit/0a7888b1fad613a0
    https://github.com/shadow-maint/shadow/issues/154

[8] Shadow commit 0c9f64140852e8d5
    https://github.com/shadow-maint/shadow/commit/0c9f64140852e8d5
    https://github.com/shadow-maint/shadow/pull/449

[9] Shadow commit 3d670ba7ed58f910
    https://github.com/shadow-maint/shadow/commit/3d670ba7ed58f910
    https://github.com/shadow-maint/shadow/issues/339

[10] Shadow commit 2b22a6909dba60d
     https://github.com/shadow-maint/shadow/commit/2b22a6909dba60d
     https://github.com/shadow-maint/shadow/issues/325

https://github.com/containers/toolbox/issues/1074

Signed-off-by: Martin Jackson <martjack@redhat.com>
2023-01-28 10:49:44 +01:00
Debarshi Ray e3b4b5ec24 playbooks: Require GCC and show its version
Building Toolbx requires a C compiler [1], which defaults to GCC on
Fedora and CentOS Stream.  It's good to explicitly require it, so that
it doesn't go missing from the build.

Showing the version of the C compiler is a big help when debugging weird
build problems involving the toolchain.  A following commit will use CGO
to link to libsubid.so, which will only increase the relevance of the C
compiler.

[1] Commit c8aaed52c5
    https://github.com/containers/toolbox/pull/923

https://github.com/containers/toolbox/pull/1218
2023-01-27 22:02:40 +01:00
Debarshi Ray b368ccf737 build: Fix indentation
Fallout from afbed7a057

https://github.com/containers/toolbox/pull/1217
2023-01-27 20:09:37 +01:00
Debarshi Ray ea62fecefd build: Merge 'completion' into 'src'
Ever since commit bafbbe81c9, the shell completions are generated
using the Toolbx binary, and the 'completion' sub-directory no longer
has any source code, but only the build scripts to invoke the Toolbx
binary to generate them.  This is a good opportunity to simplify the
layout of this Git repository by reducing the number of sub-directories.

The file containing the Bash completions had to be renamed to avoid
colliding with the name of the Toolbx binary, since they are both
generated in the same sub-directory.

https://github.com/containers/toolbox/pull/1216
2023-01-27 01:48:56 +01:00
Debarshi Ray fbf0135a99 build: Simplify by removing extra documentation
The Meson adapter scripts are simple enough that they don't need
detailed descriptions for their command line arguments.  The cost of
formulating succint descriptions doesn't justify the benefits.

https://github.com/containers/toolbox/pull/1216
2023-01-27 01:44:16 +01:00
Debarshi Ray 2159de82e2 build: Rename a script for consistency
Prefixing all the Meson adapter scripts with 'meson_' makes their names
more self-explanatory and helps to locate them.

https://github.com/containers/toolbox/pull/1216
2023-01-27 01:44:13 +01:00
Debarshi Ray e149b89263 cmd/root: Don't leak the subordinate ID file
Fallout from 3f0a135937

https://github.com/containers/toolbox/pull/1202
2023-01-26 15:45:12 +01:00
Debarshi Ray 6b8d5b032e cmd/root: Remove a redundant log message
The callers already provide this context before calling the function,
and then when logging any errors, which they should.

https://github.com/containers/toolbox/pull/1202
2023-01-26 15:45:12 +01:00
Debarshi Ray 21ae296ad0 cmd/root: Let the callers log the errors when replacing them
The errors should be propagated up the call chain either verbatim or by
wrapping them with all relevant context when necessary (as long as they
don't violate the API boundaries).

The errors should be logged only when there's a break in the upward
propagation, either because they need to be reformatted before being
shown to the user or because they would expose implementation details
that aren't part of the API contract.  Not logging the errors in such
cases might make it difficult to debug problems later on.

https://github.com/containers/toolbox/pull/1202
2023-01-26 15:44:49 +01:00
Debarshi Ray 2d1eff8f12 cmd/root: Protect against future programmer errors
https://github.com/containers/toolbox/pull/1202
2023-01-26 15:39:59 +01:00
Debarshi Ray 446d7bfdef .zuul: Try to prevent the CI from timing out on stable Fedoras
Currently, the CI has been timing out on Fedora 36 nodes [1].  It's
possible that this is due to the recent expansion of the test suite,
which already required increasing the timeout for Fedora Rawhide [2].

[1] https://github.com/containers/toolbox/pull/1191
    https://github.com/containers/toolbox/pull/1208

[2] Commit e8f4e9c367
    https://github.com/containers/toolbox/pull/1195

https://github.com/containers/toolbox/pull/1212
2023-01-18 13:21:20 +01:00
Debarshi Ray 936a157117 doc, test/system: Fix the titles of the manuals
Currently, the titles of the manuals are rendered with a pair of empty
parentheses and no section title:
  toolbox(1)()                                              toolbox(1)()

  NAME
         toolbox - Tool for containerized command line environments...

However, they should be:
  toolbox(1)             General Commands Manual              toolbox(1)

  NAME
         toolbox - Tool for containerized command line environments...

This is because the troff generated by go-md2man from Markdown has a
faulty invocation of the .TH macro [1]:
  .nh
  .TH toolbox(1)
  .SH NAME
  .PP
  toolbox - Tool for containerized command line environments on Linux

It should be:
  .nh
  .TH toolbox 1
  .SH NAME
  .PP
  toolbox - Tool for containerized command line environments on Linux

Original patch from Andrew Denton for Podman [2].

[1] https://www.gnu.org/software/groff/manual/groff.html

[2] Podman commit 63c779a857b55b00
    https://github.com/containers/podman/pull/15621

https://github.com/containers/toolbox/pull/1210
2023-01-12 18:45:00 +01:00
Debarshi Ray cac6b25f19 test/system: Tighten the regular expression used to detect the image ID
An OCI image's identifier (or ID) is a SHA-256 hash [1] whose length is
64 hexadecimal digits.  The ID can be abbreviated to a smaller number of
digits but the minimum is 6.  The regular expression being used to parse
the image ID wasn't checking the number of digits, and would even accept
an empty string as a valid ID, which was clearly wrong.

The format of a image reference is defined in:
https://github.com/moby/moby/blob/master/image/spec/v1.1.md
https://github.com/distribution/distribution/blob/main/reference/reference.go
https://github.com/distribution/distribution/blob/main/reference/regexp.go

Fallout from c6c2e426e0

[1] https://en.wikipedia.org/wiki/SHA-2

https://github.com/containers/toolbox/pull/1209
2023-01-12 14:44:05 +01:00
Debarshi Ray 07bc3bb42b Silence SC2317
Otherwise https://www.shellcheck.net/ would complain:
  Line 2479:
  shift
  ^---^ SC2317 (info): Command appears to be unreachable. Check usage
    (or ignore if invoked indirectly).

See: https://www.shellcheck.net/wiki/SC2317

Fedora Rawhide now has ShellCheck-0.9.0, which flags these new problems,
while so far it only had ShellCheck-0.8.0.

ShellCheck is correct that this is unreachable code.  However, given the
lack of built-in command line parsing facilities in POSIX shell, this
code pattern has so far turned out to be quite handy.  It's flexible
enough to be able to handle different combinations of commands and
options, and is easy to read.  Trying to 'fix' the code will likely
cause more problems than it will solve.

Moreover, the POSIX shell implementation has been replaced by the Go
implementation quite a long time ago.  It's no longer maintained and has
been kept only for historical reasons.  Therefore, it's not worth
spending any significant amount of time on it.

https://github.com/containers/toolbox/pull/1211
2023-01-12 14:41:53 +01:00
Debarshi Ray c2f0ebc5bc Silence SC2086
Otherwise https://www.shellcheck.net/ would complain:
  Line 784:
  $podman_command pull $base_toolbox_image_full >/dev/null 2>&3
                       ^----------------------^ SC2086 (info): Double
                                                quote to prevent
                                                globbing and word
                                                splitting.

See: https://www.shellcheck.net/wiki/SC2086

Fedora Rawhide now has ShellCheck-0.9.0, which flags these new problems,
while so far it only had ShellCheck-0.8.0.

https://github.com/containers/toolbox/pull/1211
2023-01-12 14:40:38 +01:00
Debarshi Ray 7e2badc1ec .zuul: Use less cryptic names for the nodes
The name of a node in a nodeset is meant to be a human-readable name.  A
name with an obscure prefix like 'ci-node-' makes it look more profound
than it really is.

https://github.com/containers/toolbox/pull/1206
2022-12-20 09:31:04 +01:00
Debarshi Ray e8bc28ea35 .zuul: Use the latest version of the tools for static analysis
The 'unit tests' are no longer just unit tests.  They also run a bunch
of static analysis tools like ShellCheck, codespell, gofmt and 'go vet'.
Since newer versions of these tools are generally better at catching
problems in the codebase, it will be better to run the 'unit tests' on
Fedora Rawhide with the latest versions than older stable Fedoras.

The timeout for the 'unit tests' need to be increased because Fedora
Rawhide is slower than stable Fedoras.  Currently, the timeout for the
'unit tests' running on Fedora 36 is 10 minutes.  Increasing it to 20
minutes when running on Fedora Rawhide wasn't enough, so maybe 30 will
be sufficient.

Note that this is only feasible because the Fedora Rawhide builds are
now more robust against stale DNF caches [1].  Otherwise, it wouldn't
have been wise to use Fedora Rawhide to test anything which isn't also
being tested elsewhere, because the Fedora Rawhide builds might have
stayed broken for extended periods of time due to reasons completely
unrelated to Toolbx.

[1] Commit 995c6d175e
    https://github.com/containers/toolbox/pull/1201

https://github.com/containers/toolbox/pull/1206
2022-12-20 09:30:32 +01:00
Debarshi Ray 4cd1c798b3 Test -Dmigration_path_for_coreos_toolbox on CentOS Stream 9
The code behind -Dmigration_path_for_coreos_toolbox is meant for Red Hat
Enterprise Linux 8 and 9.  Hence, it makes sense to use CentOS Stream 9
to run the 'unit tests' on the corresponding code path.

Note that, just like Fedora, Podman prefers crun(1) as its OCI runtime
on CentOS Stream 9 [1,2].

[1] Podman commit 060775901de09b27
    https://gitlab.com/redhat/centos-stream/rpms/podman/-/commit/060775901de09b27

[2] Podman commit f327e88a08ca224b
    https://gitlab.com/redhat/centos-stream/rpms/podman/-/commit/f327e88a08ca224b

https://github.com/containers/toolbox/pull/1171
2022-12-14 23:09:55 +01:00
Debarshi Ray ccaa27e034 playbooks: Rename the file with the dependencies
This will be used by the subsequent commit to have a separate set of
dependencies for CentOS Stream 9 builds.  eg., unlike Fedora, CentOS
Stream 9 doesn't have the ShellCheck, bats and fish RPMs.

https://github.com/containers/toolbox/pull/1171
2022-12-14 23:09:55 +01:00
Debarshi Ray bc1781085b playbooks: Reveal the standard error & output streams from 'meson test'
Currently, the standard error and output streams of the child commands
invoked by 'meson test' are redirected to a separate log file.  When the
tests fail, it's difficult, or maybe even impossible, to access this
file from the Zuul CI, and all that can be seen is something like:
  1/7 shellcheck src/go-build-wrapper OK              0.04s
  2/7 shellcheck profile.d/toolbox.sh FAIL            0.06s   exit status 1
  >>> MALLOC_PERTURB_=241 /usr/bin/shellcheck
    --shell=sh
    /home/zuul-worker/src/github.com/containers/toolbox/builddir/../profile.d/toolbox.sh

  3/7 go fmt                          FAIL            0.05s   exit status 1
  >>> MALLOC_PERTURB_=209 /usr/bin/python3
    /home/zuul-worker/src/github.com/containers/toolbox/src/meson_go_fmt.py
    /home/zuul-worker/src/github.com/containers/toolbox/src

  4/7 codespell                       FAIL            0.31s   exit status 65
  >>> MALLOC_PERTURB_=180 /usr/bin/codespell
    --check-filenames
    --check-hidden
    --context 3
    --exclude-file /home/zuul-worker/src/github.com/containers/toolbox/.codespellexcludefile
    --skip /home/zuul-worker/src/github.com/containers/toolbox/builddir
    --skip /home/zuul-worker/src/github.com/containers/toolbox/.git
    --skip /home/zuul-worker/src/github.com/containers/toolbox/test/system/libs/bats-assert
    --skip /home/zuul-worker/src/github.com/containers/toolbox/test/system/libs/bats-support
    /home/zuul-worker/src/github.com/containers/toolbox

  5/7 shellcheck toolbox (deprecated) FAIL            1.09s   exit status 1
  >>> MALLOC_PERTURB_=233 /usr/bin/shellcheck
    /home/zuul-worker/src/github.com/containers/toolbox/builddir/../toolbox

  6/7 go test                         OK              1.89s
  7/7 go vet                          OK             17.60s

This doesn't have enough information to understand what caused the tests
to fail on non-interactive CI environments.

Not redirecting the standard error and output streams of the child
commands invoked by 'meson test' will readily reveal more details about
the test failures and remove the need to find the log file created by
Meson.

https://github.com/containers/toolbox/pull/1171
2022-12-14 23:09:55 +01:00
Debarshi Ray 65194bd45e test/system: Avoid false positives from codespell
Otherwise codespell would complain:
  : @test "create: Try to create a container with invalid custom name...
  >   run $TOOLBOX -y create "ßpeci@l.Nam€"
  :
  ./test/system/101-create.bats:57: Nam ==> Name

CentOS Stream 9 has codespell-2.2.1, while so far the 'unit tests' were
being run on Fedora 36, which only has codespell-2.1.0.

This is a step towards testing on CentOS Stream 9.

https://github.com/containers/toolbox/pull/1200
2022-12-14 23:09:21 +01:00
Debarshi Ray 5f5f7b6aab test/system: Fix spelling mistake using codespell
CentOS Stream 9 has codespell-2.2.1, while so far the 'unit tests' were
being run on Fedora 36, which only has codespell-2.1.0.

This is a step towards testing on CentOS Stream 9.

Fallout from ecd1ced719

https://github.com/containers/toolbox/pull/1200
2022-12-14 23:09:21 +01:00
Debarshi Ray 77be1bbfdd .codespellexcludefile: Silence false positives
Otherwise codespell would complain:
  :    {"/tmp", "/run/host/tmp", "rslave"},
  >    {"/var/lib/flatpak", "/run/host/var/lib/flatpak", "ro"},
  :    {"/var/lib/libvirt", "/run/host/var/lib/libvirt", ""},
./src/cmd/initContainer.go:61: ro ==> to, row, rob, rod, roe, rot

CentOS Stream 9 has codespell-2.2.1, while so far the 'unit tests' were
being run on Fedora 36, which only has codespell-2.1.0.

This is a step towards testing on CentOS Stream 9.

https://github.com/containers/toolbox/pull/1200
2022-12-14 23:09:21 +01:00
Debarshi Ray de1c17804d Silence SC2295
Otherwise https://www.shellcheck.net/ would complain:
  Line 86:
  term_just_first_character="${TERM%$term_without_first_character}"
                                    ^-- SC2295 (info): Expansions inside
                                      ${..} need to be quoted
                                      separately, otherwise they match
                                      as patterns.

See: https://www.shellcheck.net/wiki/SC2295

CentOS Stream 9 has ShellCheck-0.8.0, while so far the 'unit tests' were
being run on Fedora 36, which only has ShellCheck-0.7.2.

This is a step towards testing on CentOS Stream 9.

https://github.com/containers/toolbox/pull/1200
2022-12-14 23:09:21 +01:00
Debarshi Ray 995c6d175e playbooks/dependencies: Avoid stale DNF caches on high-churn RPM repos
Sometimes the RPM dependencies can't be installed because the DNF cache
refers to old packages that have been replaced by newer builds on the
RPM repositories [1].  This often happens on Fedora Rawhide because it
sees a lot more churn than stable Fedoras.

Currently, one has to keep restarting the tests manually by typing
'recheck' until the DNF caches eventually get updated.  This is both
very inefficient because it requires manual intervention; and wasteful
because it can take several attempts and it doesn't just run the failing
Ansible job, but all the other ones too.

It will be good to force the DNF cache to be updated [2] when an Ansible
job is being attempted more than once [3].

[1] https://github.com/containers/toolbox/pull/1171
    https://github.com/containers/toolbox/pull/1200

[2] https://docs.ansible.com/ansible/latest/collections/ansible/builtin/dnf_module.html#parameter-update_cache

[3] https://zuul-ci.org/docs/zuul/latest/job-content.html#var-zuul.attempts

https://github.com/containers/toolbox/pull/1201
2022-12-14 22:38:08 +01:00
Debarshi Ray 42e9501950 cmd/initContainer: Conform to gofmt changes in Go 1.19
CentOS Stream 9 has golang-1.19.2, while so far the 'unit tests' were
being run on Fedora 36, which only has golang-1.18.8.

This is a step towards testing on CentOS Stream 9.

https://github.com/containers/toolbox/pull/1199
2022-12-14 01:04:50 +01:00
Debarshi Ray 0f43be73c6 doc/toolbox.conf: Fix spelling mistake using codespell
CentOS Stream 9 has codespell-2.2.1, while so far the 'unit tests' were
being run on Fedora 36, which only has codespell-2.1.0.

This is a step towards testing on CentOS Stream 9.

Fallout from 708fa593e2

https://github.com/containers/toolbox/pull/1199
2022-12-14 00:35:56 +01:00
Debarshi Ray 35783e0d0c playbooks/dependencies: Show the ShellCheck and codespell versions
Different versions of ShellCheck and codespell may treat the same code
base differently.  eg., these tools are currently being used on Fedora
36 as part of the 'unit tests', but CentOS Stream 9 has newer versions
that are stricter and catch several new problems.

Knowing the versions of the tools used in the tests helps to understand
these differences, and is a step towards testing on CentOS Stream 9.

https://github.com/containers/toolbox/pull/1199
2022-12-14 00:35:43 +01:00
Martin Krajnak 05a062f8c9 test/system: Ensure that copied images are clearly identified
Note that 'run --keep-empty-lines' counts the trailing newline on the
last line as a separate line.

Until Bats 1.7.0, 'run --keep-empty-lines' had a bug where even when a
command produced no output, it would report a line count of one [1] due
to a stray line feed character.  This needs to be conditionalized, since
Fedora 35 has Bats 1.5.0.

[1] https://github.com/bats-core/bats-core/issues/573

https://github.com/containers/toolbox/issues/1043
2022-12-12 21:49:21 +01:00
Debarshi Ray 6aab0a6175 Unbreak sorting and clearly identify copied images in 'list'
Currently, if an image was copied with:
  $ skopeo copy \
      containers-storage:registry.fedoraproject.org/fedora-toolbox:36 \
      containers-storage:localhost/fedora-toolbox:36

... or:
  $ podman tag \
      registry.fedoraproject.org/fedora-toolbox:36 \
      localhost/fedora-toolbox:36

... then it would show up twice in 'list' with the same name, and in the
wrong order.

Either as:
  $ toolbox list --images
  IMAGE ID      IMAGE NAME                                      CREATED
  2110dbbc33d2  localhost/fedora-toolbox:36                     1 day...
  e085805ade4a  registry.access.redhat.com/ubi8/toolbox:latest  1 day...
  2110dbbc33d2  localhost/fedora-toolbox:36                     1 day...
  70cbe2ce60ca  registry.fedoraproject.org/fedora-toolbox:34    1 day...

... or as:
  $ toolbox list --images
  IMAGE ID      IMAGE NAME                                      CREATED
  2110dbbc33d2  registry.fedoraproject.org/fedora-toolbox:36    1 day...
  e085805ade4a  registry.access.redhat.com/ubi8/toolbox:latest  1 day...
  2110dbbc33d2  registry.fedoraproject.org/fedora-toolbox:36    1 day...
  70cbe2ce60ca  registry.fedoraproject.org/fedora-toolbox:34    1 day...

The correct output should be similar to 'podman images', and be sorted
in ascending order of the names:
  $ toolbox list --images
  IMAGE ID      IMAGE NAME                                      CREATED
  2110dbbc33d2  localhost/fedora-toolbox:36                     1 day...
  e085805ade4a  registry.access.redhat.com/ubi8/toolbox:latest  1 day...
  70cbe2ce60ca  registry.fedoraproject.org/fedora-toolbox:34    1 day...
  2110dbbc33d2  registry.fedoraproject.org/fedora-toolbox:36    1 day...

The problem is that, in these situations, 'podman images --format json'
returns separate identical JSON collections for each copy of the image,
and all of those copies have multiple names:
  [
    {
      "Id": "2110dbbc33d2",
      ...
      "Names": [
        "localhost/fedora-toolbox:36",
        "registry.fedoraproject.org/fedora-toolbox:36"
      ],
      ...
    },
    {
      "Id": "e085805ade4a",
      ...
      "Names": [
        "registry.access.redhat.com/ubi8/toolbox:latest"
      ],
      ...
    },
    {
      "Id": "2110dbbc33d2",
      ...
      "Names": [
        "localhost/fedora-toolbox:36",
        "registry.fedoraproject.org/fedora-toolbox:36"
      ],
      ...
    }
    {
      "Id": "70cbe2ce60ca",
      ...
      "Names": [
        "registry.fedoraproject.org/fedora-toolbox:34"
      ],
      ...
    },
  ]

The image objects need to be flattened to have only one unique name per
copy, but with the same ID, and then sorted to ensure the right order.

Note that the ordering was already broken since commit 2369da5d31,
which started using 'podman images --sort repository'.  Podman can sort
by either the image's repository or tag, but not by the unified name,
which is what Toolbx needs.  Therefore, even without copied images,
Toolbx really does need to sort the images itself.

Prior to commit 2369da5d31, the ordering was correct, but copied
images would only show up once.

Fallout from 2369da5d31

This reverts parts of commit 67e210378e.

https://github.com/containers/toolbox/issues/1043
2022-12-12 21:49:21 +01:00
Debarshi Ray 51eccd3da5 test/system: Test 'rmi' with an image
https://github.com/containers/toolbox/pull/1195
2022-12-12 20:59:52 +01:00
Debarshi Ray bbdf4ddb63 test/system: Test 'rmi' with an image and its copy
https://github.com/containers/toolbox/issues/1043
2022-12-12 20:59:52 +01:00
Martin Krajnak d5daa7167e test/system: Add a helper to pull the default image and copy it
This will be used in subsequent commits to test the handling of such
copied images in 'toolbox list' and 'toolbox rmi'.

https://github.com/containers/toolbox/issues/1043
2022-12-12 20:59:47 +01:00
Debarshi Ray a0d4c957b3 test/system: Test 'rmi' with an image without a name
https://github.com/containers/toolbox/pull/1195
2022-12-12 15:13:26 +01:00
Debarshi Ray e25ab310fa test/system: Test 'rmi --all' with an image without a name
https://github.com/containers/toolbox/pull/1195
2022-12-12 15:13:26 +01:00
Debarshi Ray 8a37c08780 test/system: Test 'rmi --all' without any images
https://github.com/containers/toolbox/pull/1195
2022-12-12 15:13:26 +01:00
Debarshi Ray e8f4e9c367 .zuul: Try to prevent the CI from timing out on Fedora Rawhide
With the recent expansion of the test suite, it's necessary to increase
the timeout for Fedora Rawhide nodes to prevent the CI from timing out.

https://github.com/containers/toolbox/pull/1195
2022-12-12 15:13:26 +01:00
Debarshi Ray 210985ecd1 test/system: Ensure that error messages go to the standard error stream
Currently, there's no way to get assert_line to use the stderr_lines
array [1].  This is worked around by assigning stderr_lines to the
'lines' array.

[1] https://github.com/bats-core/bats-assert/issues/42

https://github.com/containers/toolbox/pull/1195
2022-12-12 15:13:26 +01:00
Debarshi Ray 26ed682cd1 test/system: Keep empty lines to prevent missing and spurious newlines
https://github.com/containers/toolbox/pull/1195
2022-12-12 15:13:26 +01:00
Debarshi Ray 303c7ae99a test/system: Don't ignore copies when counting images
If an image was copied with:
  $ skopeo copy \
      containers-storage:registry.fedoraproject.org/fedora-toolbox:36 \
      containers-storage:localhost/fedora-toolbox:36

... or:
  $ podman tag \
      registry.fedoraproject.org/fedora-toolbox:36 \
      localhost/fedora-toolbox:36

... then the image ID is only showed once in 'podman images --quiet',
not twice.

A subsequent commit will use this to write tests to ensure that copied
images are correctly handled.

https://github.com/containers/toolbox/issues/1043
2022-12-12 15:04:42 +01:00
Debarshi Ray 5e8446971c test/system: Use long options, instead of their shorter aliases
The long options are easier to grep(1) for in the sources than their
shorter aliases.

https://github.com/containers/toolbox/pull/1197
2022-12-12 15:00:46 +01:00
Debarshi Ray f17a632f9a test/system: Check the line count in the standard error & output streams
Note that 'run --keep-empty-lines' counts the trailing newline on the
last line as a separate line.

Until Bats 1.7.0, 'run --keep-empty-lines' had a bug where even when a
command produced no output, it would report a line count of one [1] due
to a stray line feed character.  This needs to be conditionalized, since
Fedora 35 has Bats 1.5.0.

[1] https://github.com/bats-core/bats-core/issues/573

https://github.com/containers/toolbox/pull/1192
2022-12-08 23:08:47 +01:00
Debarshi Ray 89385e12b5 test/system: Ensure that non-error messages go to the standard output
https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray 4d1cc5b39b test/system: Test the order in 'list' for images with & without names
Note that 'run --keep-empty-lines' counts the trailing newline on the
last line as a separate line.

Until Bats 1.7.0, 'run --keep-empty-lines' had a bug where even when a
command produced no output, it would report a line count of one [1] due
to a stray line feed character.  This needs to be conditionalized, since
Fedora 35 has Bats 1.5.0.

[1] https://github.com/bats-core/bats-core/issues/573

https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray cc60bc6893 test/system: Split out the code to build an image without a name
This will be used by a subsequent commit to test the order in which
images with and without names are listed.

https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray 54f09ae8a6 test/system: Group the test cases somewhat logically
A subsequent commit will test the order in which images with and without
names are listed.  It's logical for that test to come after the one
about the basic support for images without names.

https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray f0a805af84 test/system: Fix indentation
https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray 0fde202d82 test/system: Keep empty lines to prevent missing and spurious newlines
The tests are intended for Toolbx, not Podman or other commands.  Hence,
it's only necessary to keep the empty lines for Toolbx invocations.
Being too sensitive about the exact output of other commands can lead to
spurious failures [1].

[1] Commit 259afdf815
    https://github.com/containers/toolbox/pull/846

https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray da1724c896 test/system: Test the order in 'list' for images and containers
https://github.com/containers/toolbox/pull/1192
2022-12-08 22:33:35 +01:00
Debarshi Ray ba082abaea build: List out the runtime dependencies for the system tests
Skopeo was already listed, so it didn't make sense to leave out the
others.  It's useful to give the user a heads-up to make it obvious what
the requirements are.

https://github.com/containers/toolbox/pull/1194
2022-12-08 22:25:24 +01:00
Debarshi Ray f3e005d014 build: Add missing mandatory build-time dependency
Commit bafbbe81c9 started generating the shell completions at
build-time using the 'toolbox completion' command, and toolbox(1)
doesn't start without podman(1).

Fallout from bafbbe81c9

https://github.com/containers/toolbox/pull/1194
2022-12-08 22:24:50 +01:00
Debarshi Ray 7375be82d0 test/system: Remove stray (possibly for debugging) 'podman images'
This was making it difficult to read the Bats assertions on test
failures, by polluting it with unexpected and irrelevant output from
'podman images'.  For example [1]:
  not ok 39 list: Images with and without names in 12332ms
  # (from function `assert' in file test/system/libs/bats-assert/src/assert.bash, line 46,
  #  in test file test/system/102-list.bats, line 126)
  #   `assert [ ${#stderr_lines[@]} -eq 0 ]' failed
  # REPOSITORY                                 TAG         IMAGE ID      CREATED      SIZE
  # registry.fedoraproject.org/fedora-toolbox  35          862705390e8b  4 weeks ago  332 MB
  # REPOSITORY                                 TAG         IMAGE ID      CREATED       SIZE
  # registry.fedoraproject.org/fedora-toolbox  35          862705390e8b  4 weeks ago   332 MB
  # registry.fedoraproject.org/fedora-toolbox  34          70cbe2ce60ca  7 months ago  354 MB
  #
  # -- assertion failed --
  # expression : [ 1 -eq 0 ]
  # --
  #

Fallout from 7973181136

[1] https://github.com/containers/toolbox/pull/1192

https://github.com/containers/toolbox/pull/1193
2022-12-08 00:32:12 +01:00
Debarshi Ray 5f324d537e cmd/list, pkg/podman: Limit access to the raw 'podman images' JSON
This builds on top of commit 0465d78fd9034ce9.

The toolboxImage type has been renamed to Image and moved into the
podman package.

There is nothing Toolbx specific about the type - it represents any
image returned by 'podman images'.  The images are only later filtered
for Toolbx images.

Secondly, having the Image type inside the podman package makes it
possible to encapsulate the unmarshalling of the JSON within the package
without exposing the raw JSON to outside consumers.  This is desirable
because the unmarshalling involves tracking changes in the JSON output
by different Podman versions, and it's better to limit such details to
the podman package.

https://github.com/containers/toolbox/pull/1190
2022-12-07 13:06:20 +01:00
Debarshi Ray 5baf3162a9 cmd/list: Style fixes
This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1190
2022-12-07 13:06:20 +01:00
Debarshi Ray e1ead145fc cmd/list: Rename a variable for ease of grepping
It's better to avoid single letter variables in general, because they
are so hard to grep for.

This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1190
2022-12-07 13:06:20 +01:00
Debarshi Ray 2486e25601 cmd/list, pkg/podman: Don't unmarshal the 'podman images' JSON twice
This builds on top of commit e772207831.

Currently, the JSON from 'podman images --format json' gets unmarshalled
into a []map[string]interface{} in podman.GetImages, where the maps in
the slice represent images.  Each map is then marshalled back into JSON
and then again unmarshalled into a toolboxImage type.

This is wasteful.  The toolboxImage type already implements the
json.Unmarshaler interface [1], since commit e772207831.  Hence,
the entire JSON from 'podman images --format json' can be directly
unmarshalled into a slice of toolboxImages without involving the
[]map[string]interface{}.

A subsequent commit will move the toolboxImage type into the podman
package to more tightly encapsulate the unmarshalling of the JSON.  So,
as an intermediate step in that direction, the podman.GetImages function
has been temporarily changed to return the entire JSON.

[1] https://pkg.go.dev/encoding/json#Unmarshaler

https://github.com/containers/toolbox/pull/1190
2022-12-07 13:06:20 +01:00
Debarshi Ray aeb5d8ec1a test/system: Test a container with an old forward incompatible runtime
Commit ae43560d45 had added a test with a similar intention.  When
the test suite is run on a Fedora Rawhide host, it tests whether the
containers for the two previous stable Fedora releases start or not.
Fedora N-2 reaches End of Life 4 weeks after Fedora N is released [1].
So, testing the containers for Fedora Rawhide and the two previous
stable releases on a Fedora Rawhide host is a decent test of general
backwards compatibility.

However, as seen recently [2], this isn't enough to catch some known
ABI compatibility issues [3,4].  These involve toolbox binaries built
on hosts with newer toolchains that aren't meant to be run against
containers with older runtimes.  A targeted test is needed to defend
against these scenarios.

The fedora-toolbox:34 image has glibc-2.33, which is old enough to be
unable to run binaries compiled on Fedora 35 with glibc-2.34 and newer.

[1] https://docs.fedoraproject.org/en-US/releases/

[2] https://github.com/containers/toolbox/pull/1180

[3] Commit 6063eb27b9
    https://github.com/containers/toolbox/issues/821

[4] Commit 6ad9c63180
    https://github.com/containers/toolbox/issues/529

https://github.com/containers/toolbox/pull/1187
2022-12-07 13:03:09 +01:00
Debarshi Ray 7ab2f9b866 test/system: Replace fedora-toolbox:32 with fedora-toolbox:34
Fedora 32 reached End of Life on 25th May 2021:
https://docs.fedoraproject.org/en-US/releases/eol/

That's quite old because right now Fedora 35 is nearing its End of Life.

Since the tests are intended for Toolbx, not the Fedora infrastructure,
it will be better to use a newer image, because images that are too old
can get lost from registry.fedoraproject.org.  The fedora-toolbox:34
image can be a drop-in replacement for the fedora-toolbox:32 image for
the purposes of this test suite, and has the advantage of being newer.

Note that fedora-toolbox:34 is also old enough to test that the toolbox
binary runs against it's build-time ABI from the host, and not the
Toolbx container's ABI, when it's invoked as the entry point of the
container [1,2].  This is important because the subsequent commit will
add a test to ensure that.

[1] Commit 6063eb27b9
    https://github.com/containers/toolbox/issues/821

[2] Commit 6ad9c63180
    https://github.com/containers/toolbox/issues/529

https://github.com/containers/toolbox/pull/1187
2022-12-07 12:56:41 +01:00
Debarshi Ray 67e210378e cmd/list: Simplify code
Fallout from 2369da5d31

https://github.com/containers/toolbox/pull/1189
2022-12-06 00:27:55 +01:00
Debarshi Ray 71f73a4b31 cmd/list: Remove redundant initializations
Fallout from 2369da5d31

https://github.com/containers/toolbox/pull/1188
2022-12-05 22:21:09 +01:00
Debarshi Ray 9e1cc2afaf build: Reduce the verbosity of 'go test'
Otherwise, there's so much spew from 'go test', including the successful
tests, that the actual failures don't stand out.

Note that, the different steps involved in building the code base are a
lot more interdependent on each other.  Hence, some extra verbosity
can help understand what caused a build failure on non-interactive build
environments.  In contrast, the runtime outputs from each test case are
a lot more isolated and independent from one another.  The additional
verbosity from successful tests doesn't really help understand why a
particular test failed.

https://github.com/containers/toolbox/pull/1186
2022-12-02 13:05:29 +01:00
Debarshi Ray f695012faf build: Enforce all the default 'go vet' checks on all Go sources
Currently, only a so-called high-confidence subset of the default checks
in 'go vet' are being run by 'go test' [1].  Since 'go vet' is part of
the core Go tools, it's worth trying to use more of it.  After all,
golangci-lint, which is currently being run through a GitHub Action,
is running the default 'go vet' checks as one of its linters [2].

It's good to have as much of the testing wrapped inside 'meson test', as
possible, because it's easier to run locally and on other non-GitHub CI
environments like those of downstream distributors.

[1] https://pkg.go.dev/cmd/go/internal/test

[2] https://golangci-lint.run/usage/linters/
    https://golangci-lint.run/usage/linters/#govet

https://github.com/containers/toolbox/pull/1186
2022-12-02 11:39:03 +01:00
Debarshi Ray f0425d4240 build: Rename the 'go test' test for consistency
https://github.com/containers/toolbox/pull/1186
2022-12-02 11:12:21 +01:00
Debarshi Ray fa1b7e26a2 cmd/initContainer: Limit the scope of the error
Fallout from d323143c46

https://github.com/containers/toolbox/pull/1185
2022-12-01 18:24:59 +01:00
Debarshi Ray b85ab0a4f1 cmd/initContainer, cmd/run: Restore hints about unreachable code
In the past, before commit d323143c46, there was either had a
dummy 'return' statement or a self-documenting 'panic' that said that
the code should not be reached.  Since neither golangci-lint nor
'go vet' likes those, a comment is the only option left.

Note that the core Go tools like 'go vet' [1], but also 'go lint' [2],
explicitly don't intend to add fine-grained configuration options,
including inline directives or pragmas, to silence specific warnings.
That's something golangci-lint offers [3], to the extent that it's
supported by its linters [4].  However, golangci-lint also uses 'go vet'
as one of those linters, so it's the same problem all over again.

Therefore, between the two extremes of leaving the code difficult to
read and using a very big hammer to disable a needlessly big chuck of
'go vet', a comment is the least worst option.

[1] https://github.com/golang/go/issues/17058
    https://github.com/golang/go/issues/18432

[2] https://github.com/golang/lint/issues/263

[3] https://golangci-lint.run/usage/false-positives/

[4] https://golangci-lint.run/usage/linters/

Fallout from d323143c46

https://github.com/containers/toolbox/pull/1185
2022-12-01 18:24:15 +01:00
Debarshi Ray d0fe8c45f7 README.md: Clarify that Toolbx isn't a security mechanism
Using the word 'containerized' gives the false impression of heightened
security.  As if it's a mechanism to run untrusted software in a
sandboxed environment without access to the user's private data (such as
$HOME), hardware peripherals (such as cameras and microphones), etc..
That's not what Toolbx is for.

Toolbx aims to offer an interactive command line environment for
development and troubleshooting the host operating system, without
having to install software on the host.  That's all.  It makes no
promise about security beyond what's already available in the usual
command line environment on the host that everybody is familiar with.

https://github.com/containers/toolbox/issues/1020
2022-11-29 17:46:34 +01:00
Debarshi Ray f5057d782e README.md: Tweak
Mention that Toolbx is meant for system administrators to troubleshoot
the host operating system.  The word 'debugging' is often used in the
context of software development, and hence most readers might not
interpret it as 'troubleshooting'.

https://github.com/containers/toolbox/pull/1182
2022-11-29 17:46:25 +01:00
Debarshi Ray 11d3c6bda5 README.md: Remove trailing newline
Fallout from bafbbe81c9

https://github.com/containers/toolbox/pull/1182
2022-11-29 17:01:06 +01:00
Debarshi Ray 021053716e test/system: Add copyright and license notices
https://github.com/containers/toolbox/pull/1179
2022-11-29 13:54:13 +01:00
Debarshi Ray ca966e377c .zuul, playbooks: Add copyright and license notices
https://github.com/containers/toolbox/pull/1179
2022-11-28 22:47:15 +01:00
Debarshi Ray 630792e0a1 Update copyright notices
https://github.com/containers/toolbox/pull/1179
2022-11-28 21:01:18 +01:00
Debarshi Ray f392a69a4b profile.d: Restore compatibility with Z shell
Otherwise, every zsh instance on Fedora Kinoite and Silverblue was
running into:
  /etc/profile.d/toolbox.sh:30: bad substitution

... because case modification with "${VARIANT_ID^}" is undefined in
POSIX shell [1], and doesn't work with Z shell.

Fedora Silverblue got its own PRETTY_NAME (and VARIANT and VARIANT_ID)
starting from Fedora 32 [2].  Therefore, it's better to use PRETTY_NAME
and let the downstream distributor of the host operating system decide
how it should be presented to the user, instead of coming up with a
custom string.  eg., PRETTY_NAME isn't the same as "Fedora $VARIANT" on
Fedora Silverblue.

One nice side-effect of this is that while VARIANT and VARIANT_ID are
optional fields, PRETTY_NAME has a well-defined fallback value of
'Linux' [3].  This makes this a little less specific to Fedora Kinoite
and Silverblue.

The rest of the welcome text was reformatted to prevent it from getting
too wide depending on the contents of PRETTY_NAME.

Fallout from 3641a0032f

[1] https://www.shellcheck.net/wiki/SC3059

[2] https://pagure.io/workstation-ostree-config/c/c18ef957d11862d32f362722931dbfdf1f5beb0d

[3] https://www.freedesktop.org/software/systemd/man/os-release.html

https://github.com/containers/toolbox/issues/1017
2022-11-25 18:36:31 +01:00
Debarshi Ray 5249bf229f profile.d: Don't leak ID and VARIANT_ID into the shell
Commit dcdfa3a1f5 ensured that the rest of the os-release(5)
fields don't get injected into the shell as environment variables, but
missed ID and VARIANT_ID.

Fallout from c6e37cdef3

https://github.com/containers/toolbox/pull/1176
2022-11-24 17:26:03 +01:00
Debarshi Ray 76ef9b3abf profile.d: Style fix
Fallout from 88f2916822 and
dcdfa3a1f5

https://github.com/containers/toolbox/pull/1176
2022-11-24 17:25:59 +01:00
Debarshi Ray 2e437d69db playbooks: Remove unnecessary parameter
The documentation for Ansible's built-in 'package' module [1] says this
about the 'use' parameter:
  You should only use this field if the automatic selection is not
  working for some reason.

[1] https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html

https://github.com/containers/toolbox/pull/1173
2022-11-19 15:46:46 +01:00
Nieves Montero 9438db2f79 build, playbooks: Add a test that runs codespell
https://github.com/containers/toolbox/issues/1146

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-11-19 15:32:13 +01:00
Debarshi Ray 9204d90da4 playbooks: Don't worry about runc(8)
... because it was replaced by crun(1) as Podman's default OCI runtime
during the migration to cgroups v2 in Fedora 31 [1].  eg., on Fedora 36:
  # repoquery --whatrequires runc
  ...
  containerd-0:1.6.1-1.fc36.x86_64
  containerd-0:1.6.9-3.fc36.x86_64
  containers-common-4:1-53.fc36.noarch
  containers-common-extra-4:1-62.fc36.noarch
  moby-engine-0:20.10.12-3.fc36.x86_64
  moby-engine-0:20.10.20-1.fc36.x86_64

... and it doesn't get installed on Fedora 35 either:
  TASK [Check versions of crucial packages]
  ci-node-35 | glibc-gconv-extra-2.34-43.fc35.x86_64
  ci-node-35 | glibc-2.34-43.fc35.x86_64
  ci-node-35 | glibc-common-2.34-43.fc35.x86_64
  ci-node-35 | glibc-langpack-en-2.34-43.fc35.x86_64
  ci-node-35 | kernel-core-6.0.5-100.fc35.x86_64
  ci-node-35 | kernel-core-6.0.7-100.fc35.x86_64
  ci-node-35 | kernel-core-6.0.8-100.fc35.x86_64
  ci-node-35 | kernel-headers-6.0.5-100.fc35.x86_64
  ci-node-35 | glibc-headers-x86-2.34-43.fc35.noarch
  ci-node-35 | glibc-devel-2.34-43.fc35.x86_64
  ci-node-35 | kernel-srpm-macros-1.0-6.fc35.noarch
  ci-node-35 | containernetworking-plugins-1.1.0-1.fc35.x86_64
  ci-node-35 | container-selinux-2.189.0-1.fc35.noarch
  ci-node-35 | conmon-2.1.0-2.fc35.x86_64
  ci-node-35 | golang-1.16.15-3.fc35.x86_64
  ci-node-35 | crun-1.6-2.fc35.x86_64
  ci-node-35 | fuse-overlayfs-1.9-1.fc35.x86_64
  ci-node-35 | containers-common-1-45.fc35.noarch
  ci-node-35 | podman-3.4.7-2.fc35.x86_64
  ci-node-35 | flatpak-session-helper-1.12.7-2.fc35.x86_64
  ci-node-35 | ok: Runtime: 0:00:00.139573

[1] https://fedoraproject.org/wiki/Changes/CGroupsV2

https://github.com/containers/toolbox/pull/1170
2022-11-18 19:21:50 +01:00
Debarshi Ray c1ac8bc102 playbooks: Build the shell completions for fish
https://github.com/containers/toolbox/pull/1169
2022-11-18 18:51:52 +01:00
Debarshi Ray 6439b147d3 Revert ".zuul: Run tests only for relevant files"
On a couple of occasions the relevant tests didn't get triggered because
some files weren't listed [1], and on another a commit forgot to update
the list of files [2].

The objective of the CI is to reduce stress for the maintainers, and
make it easy for contributors to find out if their changes work or not.
Missing tests don't help with that, and there's no need to optimize the
tests like this unless there's a real problem to be solved.

[1] Commit deca452b27
    Commit 5c27d73021

[2] Commit b1743c4927

This reverts commit c28d902089.

https://github.com/containers/toolbox/pull/1168
2022-11-18 18:25:45 +01:00
Andre Moreira Magalhaes 34505fd475 profile.d: Give precedence to /etc/os-release over /usr/lib/os-release
Some OSTree based systems, such as Endless OS, don't ship with
/usr/lib/os-release, and the os-release(5) manual says [1]:
  The file /etc/os-release takes precedence over /usr/lib/os-release.
  Applications should check for the former, and exclusively use its data
  if it exists, and only fall back to /usr/lib/os-release if it is
  missing.

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

https://github.com/containers/toolbox/pull/692
2022-11-18 16:41:47 +01:00
Andre Moreira Magalhaes ac46f54357 profile.d: Hide the Fedora-specific welcome on non-Fedora containers
https://github.com/containers/toolbox/pull/692
2022-11-18 16:39:16 +01:00
Debarshi Ray deca452b27 .zuul: Trigger ShellCheck when profile.d/toolbox.sh changes
https://github.com/containers/toolbox/pull/692
2022-11-18 16:39:16 +01:00
Nieves Montero f2b7e440e1 Fix spelling mistakes using codespell
https://github.com/containers/toolbox/pull/1166
https://github.com/containers/toolbox/pull/1149

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-11-17 11:56:58 +01:00
Debarshi Ray ed9f8cd0d9 cmd/completion: Style fixes
https://github.com/containers/toolbox/pull/1165
2022-11-17 11:34:42 +01:00
Debarshi Ray 1b85f711e4 test/system: Test 'completion'
https://github.com/containers/toolbox/pull/1165
2022-11-17 11:34:42 +01:00
Debarshi Ray 685f1f794d test/system: Be more strict when checking the version
https://github.com/containers/toolbox/pull/1165
2022-11-17 11:28:00 +01:00
Ondřej Míchal fe63222916 cmd/completion: Use RunE instead of Run as elsewhere
Fallout from d69ce6794b

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/840
2022-11-17 10:20:01 +01:00
Debarshi Ray 9b7793bd76 cmd/create: Fix typo
Fallout from e935ed893d

https://github.com/containers/toolbox/pull/1164
2022-11-16 23:01:25 +01:00
Debarshi Ray 68d63bf09e test/system: Ensure that the right containers are run
https://github.com/containers/toolbox/pull/1163
2022-11-16 20:46:47 +01:00
Debarshi Ray a61f88d7b2 test/system: Ensure that /run/.containerenv and /run/.toolboxenv exist
This is a precursor to verifying the names of the containers and
ensuring that the right ones are getting used.

https://github.com/containers/toolbox/pull/1163
2022-11-16 20:46:47 +01:00
Debarshi Ray 0000c68ee6 test/system: Ensure that 'toolbox run false' has exit code 1
This is a precursor to checking that higher valued exit codes from the
command running inside the container are retained, and commands like
test(1) can be used with 'toolbox run ...' in subsequent test cases.

https://github.com/containers/toolbox/pull/1163
2022-11-16 20:46:40 +01:00
Debarshi Ray 78683b38ae test/system: Use long options, instead of their shorter aliases
The long options are easier to grep(1) for in the sources than their
shorter aliases.

https://github.com/containers/toolbox/pull/1162
2022-11-16 19:56:24 +01:00
Debarshi Ray 220164b396 test/system: Shorten the names of the tests and use consistent wording
Currently, some of the names of the tests were too long, and had
inconsistent and verbose wording.  This made it difficult to look at
them and get a gist of all the scenarios being tested.  The names are
like headings.  They shouldn't be too long, should capture the primary
objective of the test and be consistent in their wording.

https://github.com/containers/toolbox/pull/1161
2022-11-16 19:49:56 +01:00
Debarshi Ray 8ec03ab85f test/system: Order the tests by increasing order of the exit code
This is another step towards making it easy to look at the file and get
a gist of all the scenarios being tested.

https://github.com/containers/toolbox/pull/1161
2022-11-16 13:41:43 +01:00
Debarshi Ray 485489867b test/system: Simplify the exit code checks by relying on Bats >= 1.5.0
Commit 978bb524e4 already added a dependency on Bats >= 1.5.0,
which is present in Fedora >= 35.  Therefore, it should be exploited
wherever possible to simplify things.

However, bats_require_minimum_version can't be used, because it's
only available from Bats 1.7.0 [1], which is new enough that it's absent
from Fedora 35.

[1] Bats commit 71d6b71cebc3d32b
    https://github.com/bats-core/bats-core/issues/556
    https://bats-core.readthedocs.io/en/stable/warnings/BW02.html

https://github.com/containers/toolbox/pull/1161
2022-11-16 13:41:39 +01:00
Debarshi Ray 80f9ac754d test/system: Remove redundant assertion
Fallout from 978bb524e4

https://github.com/containers/toolbox/pull/1161
2022-11-16 13:40:36 +01:00
Debarshi Ray 04e94868e0 test/system: Check the line count in the standard error & output streams
https://github.com/containers/toolbox/pull/1160
2022-11-16 12:51:35 +01:00
Debarshi Ray e8ad1eaad0 test/system: Ensure that error messages go to the standard error stream
Currently, there's no way to get assert_line to use the stderr_lines
array [1].  This is worked around by assigning stderr_lines to the
'lines' array.

[1] https://github.com/bats-core/bats-assert/issues/42

https://github.com/containers/toolbox/pull/1160
2022-11-16 12:36:46 +01:00
Debarshi Ray 8b7511ab6f playbooks/dependencies: Improve the names of the tasks
https://github.com/containers/toolbox/pull/1158
2022-11-16 11:11:18 +01:00
Debarshi Ray 03922893af playbooks: Highlight failures from 'meson compile' and 'meson install'
Currently, 'meson compile' and 'meson install' were being invoked from
pre-run playbooks.  This meant that a genuine build failure from either
of those commands would be shown as a RETRY_LIMIT failure by the CI.

This was misleading.  It made it look as if the failure was caused by
some transient networking problem or that the CI node was too slow due
to momentary heavy load, whereas the failure was actually due to a
problem in the Toolbx sources.  A genuine problem in the sources should
be reflected as a FAILURE, not RETRY_LIMIT.

However, it's worth noting that 'meson compile' invokes 'go build',
which downloads all the Go modules required by the Toolbx sources.  This
is worth retaining in the pre-run playbooks since it primarily depends
on Internet infrastructure beyond the Toolbx sources.

As a nice side-effect, the CI no longer gets mysteriously stuck like
this while the Go modules are being downloaded:
  TASK [Build Toolbox]
  ci-node-36 | ninja: Entering directory
    `/home/zuul-worker/src/github.com/containers/toolbox/builddir'
  ...
  ci-node-36 | [8/13] Generating doc/toolbox-rmi.1 with a custom command
  ci-node-36 | [9/13] Generating doc/toolbox-run.1 with a custom command
  ci-node-36 | [10/13] Generating doc/toolbox.conf.5 with a custom
    command
  ci-node-36 | [11/13] Generating src/toolbox with a custom command

https://github.com/containers/toolbox/pull/1158
2022-11-16 11:11:01 +01:00
Debarshi Ray 9bf9f97e2c test/system: Ensure that 'toolbox run --preserve-fds ...' works
Note that file descriptors 3 and 4 are reserved by Bats.  The former is
used for adding custom text to the Test Anything Protocol (or TAP)
stream [1] and the latter for tracing [2].

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs
    https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal

[2] Bats commit 635700cd2282b754
    https://github.com/bats-core/bats-core/pull/467
    https://github.com/bats-core/bats-core/pull/488

https://github.com/containers/toolbox/issues/1066
2022-11-14 23:10:29 +01:00
Allison Karlitskaya d4213c2358 Support leaking additional file descriptors to the container
This mirrors the --preserve-fds option of Podman.

Converting an unsigned 'uint', which is what Podman uses for its
--preserve-fds option, to a string is surprisingly annoying.
strconv.Itoa [1] takes a signed 'int', which would require a cast, and
there's no unsigned counterpart.  There's strconv.FormatUint [2] which
takes an unsigned 'uint64', which is better, but would still require a
cast.

So, fmt.Sprint [3] it is, if the cast is to be avoided.  It's more
expensive than the other two functions, but there's no need to worry
unless it's proven to be a performance bottle neck.

Some changes by Debarshi Ray.

[1] https://pkg.go.dev/strconv#Itoa

[2] https://pkg.go.dev/strconv#FormatUint

[3] https://pkg.go.dev/fmt#Sprint

https://github.com/containers/toolbox/issues/1066

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
2022-11-14 22:28:27 +01:00
Debarshi Ray f779c798f0 test/system: Remove workaround for carriage return without a terminal
Commit a22d7821cb ensured that a nested pseudo-terminal device is
only created for the process running inside the container, if the Toolbx
binary's standard input and output streams are connected to a terminal.

Therefore, 'echo ...' no longer ends with an unwanted extra carriage
return when terminal devices are absent - there's only a line feed for
the trailing newline.  Hence, there's no need to use the -n flag to skip
the trailing newline.

This reverts parts of commit 16b0c5d88f.

https://github.com/containers/toolbox/issues/157
2022-11-10 19:28:54 +01:00
Debarshi Ray 190a76ac0a test/system: Group the test cases somewhat logically
It seems that as new test cases got developed they got appended towards
the end of the file.  Now that there are a non-trivial number of test
cases, it's difficult to look at the file and get a gist of all the
scenarios being tested.

It will be better to have some logical grouping -- starting with the
most basic functionality, then moving on to more advanced features,
and then finally the errors.

This is a step towards that.

https://github.com/containers/toolbox/pull/1155
2022-11-10 18:09:19 +01:00
Debarshi Ray 12940e0b45 cmd/run: Suppress errors from Podman when interactive and not verbose
Here's some historical context to understand what's going on.

In the past, before commit a22d7821cb, Podman's standard error
stream was only revealed when --verbose was used.

During that time, the standard error and output streams of the process
running inside the Toolbx container, but not 'podman exec ...' itself,
were merged into the standard output stream read and revealed by the
Toolbx binary.

Then commit a22d7821cb ensured that a nested pseudo-terminal
device is only created for the process running inside the container, if
the Toolbx binary's standard input and output streams are connected to a
terminal.  This meant that the standard error stream of the container
process stayed separate from the standard output stream received by the
Toolbx binary, when terminal devices were absent.  The errors from
'podman exec ...' itself continued to be separate as before.

However, Toolbx only read and revealed the standard error stream of the
spawned 'podman exec ...' process when --verbose was used.  This meant
that all the errors from the container process got lost in the absence
of --verbose.  This was an unintended change in behaviour caused by
commit a22d7821cb that got addressed in the subsequent commit
7cba807e45, but with yet another unintended change in behaviour.

Commit 7cba807e45 started reading and revealing the standard
error stream of the spawned 'podman exec ...' process unconditionally.
This caused the errors from both Podman and the container process to be
revealed unconditionally, which is a problem.

Podman is an implementation detail of Toolbx.  Therefore, Toolbx users
shouldn't be directly exposed to errors from Podman, unless they are
using --verbose to debug a problem.  On the other hand, the container
process is the outcome of a command specified by the user.  So, the user
does expect to see what's going on with it.

That's the unintended change in behaviour this commit tries to fix.

Unfortunately, when Toolbx is being used non-interactively (ie., no
terminal devices), the errors from the process running inside the
Toolbx container and the errors from 'podman exec ...' itself are part
of the same standard error stream received by Toolbx.  It's impossible
to distinguish between the two without deeper changes.

Hence, this commit only focuses on interactive use (ie., terminals are
present), which is where the visual appearance and presentation of error
messages really matter.  Non-interactive use is programmatic use, so the
visuals don't matter so much.

Fallout from 7cba807e45

https://github.com/containers/toolbox/pull/1154
2022-11-10 16:45:43 +01:00
Debarshi Ray 1fc1f08405 cmd/run: Style fixes
In particular, the --env options had gotten shuffled by mistake in
commit 2da4cc4634.
2022-11-10 15:08:32 +01:00
Debarshi Ray 67849e03a4 cmd/run: Don't check the stdin and stdout in a loop in the fallback case
The outcome of checking whether the standard input and output of the
current invocation of toolbox are connected to a terminal device is
going to stay constant for the life cycle of the process.  So, checking
it repeatedly in a loop when falling back to a different command or
working directory is wasteful.

Secondly, it prevents secondary logic like this from intermingling with
the code that actually assembles the list of arguments.  This makes it
easier to get a quick gist of the final command and its structure.

Fallout from a22d7821cb
2022-11-10 15:08:32 +01:00
Debarshi Ray 741603c64e test/system: Ensure that $HOME is used as a fallback working directory
This needs a directory that's going to be present on the host operating
system across various configurations of all supported distributions,
such as the hosts running the CI, but not inside the Toolbx containers.

It looks like /etc/kernel is present on both Debian and Fedora, but
absent from the fedora-toolbox images.  On a Debian 10 server, it's
owned by several packages:
  $ dpkg-query --search /etc/kernel
  dkms, systemd, grub2-common, initramfs-tools, apt: /etc/kernel

... while on Fedora 36 Workstation:
  $ rpm --file --query /etc/kernel
  systemd-udev-250.8-1.fc36.x86_64

Currently, there's no way to get assert_line to use the stderr_lines
array [1].  This is worked around by assigning stderr_lines to the
'lines' array.

[1] https://github.com/bats-core/bats-assert/issues/42

https://github.com/containers/toolbox/pull/1153
2022-11-10 12:28:14 +01:00
Debarshi Ray 3326dda259 test/system: Group the test cases somewhat logically
It seems that as new test cases got developed they got appended towards
the end of the file.  Now that there are a non-trivial number of test
cases, it's difficult to look at the file and get a gist of all the
scenarios being tested.

It will be better to have some logical grouping -- starting with the
most basic functionality, then moving on to more advanced features,
and then finally the errors.

This a step towards that.

https://github.com/containers/toolbox/pull/1152
2022-11-08 20:06:11 +01:00
Debarshi Ray 1ce59a6a2d cmd/run: Ensure that 'run' has the same container environment as 'enter'
Currently, commands invoked using 'toolbox run' have a different
environment than the interactive environment offered by 'toolbox enter'.
This is because 'toolbox run' was invoking the commands using something
like this:
  $ bash -c 'exec "$@"' bash [COMMAND]

... whereas, 'toolbox enter' was using something like this:
  $ bash -c 'exec "$@"' bash bash --login

In the first case, the helper Bash shell is a non-interactive non-login
shell.  This means that it doesn't read any of the usual start-up files,
and, hence, it doesn't pick up anything that's specified in them.  It
runs with the default environment variables set up by Podman and the
Toolbx image, plus the environment variables set by Toolbx itself.

In the second case, even though the helper Bash shell is still the same
as the first, it eventually invokes a login shell, which runs the usual
set of start-up files and picks up everything that's specified in them.

Therefore, to ensure parity, 'toolbox run' should always have a login
shell in the call chain inside the Toolbx container.

The easiest option is to always use a helper shell that's a login shell
with 'toolbox run', but not 'toolbox enter' so as to avoid reading the
same start-up files twice, due to two login shells in the call chain.
It will still end up reading the same start-up files twice, if someone
tried to invoke a login shell through 'toolbox run', which is fine.
It's very difficult to be sure that the user is invoking a login shell
through 'toolbox run', and it's not what most users will be doing.

https://github.com/containers/toolbox/issues/1076
2022-10-25 16:56:20 +02:00
Debarshi Ray fd3bd05b4a cmd/run: Split out the code to construct the arguments to capsh(1)
This will be used by the subsequent commit to conditionally use a login
shell as the helper shell invoked by capsh(1).

https://github.com/containers/toolbox/issues/1076
2022-10-25 16:50:28 +02:00
Debarshi Ray 5284f875d3 cmd/run: Fix the name of the shell for running commands in containers
For the most part, this fixes a minor cosmetic issue for users, but it
does make the code less misleading to read for those hacking on Toolbx.
Further details below.

Commands are invoked inside a Toolbx from a helper shell invoked by
capsh(1).  Unless capsh(1) is built with custom options, the helper
shell is always bash, not /bin/sh:
  $ capsh --caps="" -- -c 'echo "$(readlink /proc/$$/exe)"'
  /usr/bin/bash

( The possibility of capsh(1) using a different shell, other than Bash,
  through a custom build option is ignored for the time being.  If there
  really are downstream distributors who do that, then this can be
  addressed one way or another. )

Secondly, the name assigned to the embedded command string's '$0' should
only be the basename of the helper shell's binary, not the full path, to
match the usual behaviour:
  $ bash -c 'exec foo'
  bash: line 1: exec: foo: not found

With 'toolbox run' it was:
  $ toolbox run foo
  /bin/sh: line 1: exec: foo: not found
  Error: command foo not found in container fedora-toolbox-36

https://github.com/containers/toolbox/pull/1147
2022-10-24 18:04:19 +02:00
Debarshi Ray 8a1d81df28 test/system: Tweak
Using 'true' is likely going to be quicker than launching the entire
shell (ie., /bin/sh).

Note that 'toolbox run' already invokes a wrapper shell via capsh(1)
before invoking the user-specified command.  So, this was the second
instance of a shell.

https://github.com/containers/toolbox/pull/1145
2022-10-23 21:02:11 +02:00
Debarshi Ray a093dc697b cmd/list, cmd/run: Consolidate the dependencies for the IsTerminal() API
It was decided in commit 950f510872 that golang.org/x/* would be
used for the IsTerminal() API, not github.com/mattn/go-isatty.  However,
github.com/mattn/go-isatty had crept in through commits f49df914f4
and a22d7821cb.

The size savings seem to have been lost, because with Go 1.18.6, the
binary size actually grew from 9410616 bytes to 9410912.  However, it
seems better to stick to packages from the golang.org domain, whenever
possible.

https://github.com/containers/toolbox/pull/1144
2022-10-23 20:13:28 +02:00
Debarshi Ray c0f9fcf208 doc/toolbox-run: Tweak the wording for consistency
... with the toolbox-create(1) and toolbox-enter(1) manuals.

Fallout from ffd365342e

https://github.com/containers/toolbox/pull/1143
2022-10-21 21:45:50 +02:00
Debarshi Ray df22010e4f playbooks: Use the same commands as mentioned in the documentation
... at https://containertoolbx.org/install/

There are some minor benefits to always invoking meson(1), as opposed to
directly invoking the underlying build backend, like 'ninja'.

It's one less command to be aware of.  Secondly, in theory, Meson can be
used with backends other than Ninja (see 'meson configure'), even though
Ninja is the most likely option for building Toolbx because it's only
supported on Linux.

https://github.com/containers/toolbox/pull/1142
2022-10-21 20:23:34 +02:00
Debarshi Ray 8b2d25f1e8 build: Replace join_paths with the / operator
Since Meson 0.49.0, the / operator on strings is equivalent to calling
join_paths() [1], and the former is less verbose, and easier to read.

[1] https://mesonbuild.com/Reference-manual_functions.html#join_paths

https://github.com/containers/toolbox/pull/1141
2022-10-21 17:24:03 +02:00
Debarshi Ray fce8a3c058 build: Skip a needless failure when running systemd-tmpfiles as non-root
If 'systemd-tmpfiles --create' is called as a non-root user, then it
causes:
  --- stdout ---
  Calling systemd-tmpfiles --create ...

  --- stderr ---
  Failed to open directory 'cryptsetup': Permission denied
  Failed to open directory 'certs': Permission denied
  Failed to create directory or subvolume "/var/spool/cups/tmp":
    Permission denied
  ...
  ...
  ...
  Traceback (most recent call last):
    File "toolbox/meson_post_install.py", line 26, in <module>
      subprocess.run(['systemd-tmpfiles', '--create'], check=True)
    File "/usr/lib64/python3.10/subprocess.py", line 524, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['systemd-tmpfiles',
      '--create']' returned non-zero exit status 73.

Since, systemd-tmpfiles(8) can't be used like this as a non-root user,
there's no point in calling it and needlessly failing the build.

Unfortunately, Meson doesn't seem to offer a way to get the process'
effective UID inside its scripts.  Therefore, this leaves a spurious
build-time dependency on systemd when building as a non-root user.

https://github.com/containers/toolbox/pull/1140
2022-10-21 16:45:37 +02:00
Debarshi Ray 5d26b9d71d build: Enable changing the completion paths & drop install_completions
The bash-completion and fish dependencies were already optional - the
shell completions for Bash and fish won't be generated and installed if
they are absent; and there's no dependency required for Z shell.  So the
install_completions build option wasn't reducing the dependency burden.

The build option was a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  The only use-case for this is when installing to a
non-system-wide prefix while hacking on Toolbox as a non-root user,
because the locations for the completions advertised by the shells' APIs
might not be accessible.  Being able to disable the completions prevents
the installation from failing.

A different way of ensuring a smooth developer experience for a Toolbx
hacker is to offer a way to change the locations where the shell
completions are installed, which is necessary and beneficial for other
use-cases.

Z shell, unlike Bash's bash-completion.pc and fish's fish.pc, doesn't
offer an API to detect the location for the shell completions.  This
means that Debian and Fedora use different locations [1, 2].  Namely,
/usr/share/zsh/vendor-completions and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build, if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd.pc as a build dependency [3].

Fallout from bafbbe81c9

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

https://github.com/containers/toolbox/pull/1123
https://github.com/containers/toolbox/pull/840
2022-10-21 16:42:29 +02:00
Debarshi Ray bd6e9d66d9 build: Style fixes
https://github.com/containers/toolbox/pull/1123
2022-10-21 16:42:29 +02:00
Nieves Montero f5388cfc06 Add corrections to avoid duplicate packages
The following lines have been added to the fedora 37 and 38 images:
RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
RUN rm /etc/rom/macros.image-language.conf
These two lines avoid redundant packages inside the images.

https://github.com/containers/toolbox/issues/1136
https://github.com/containers/toolbox/issues/1137

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-10-20 07:15:34 -04:00
Debarshi Ray a6d7104840 build: Fix indentation
https://github.com/containers/toolbox/pull/1123
https://github.com/containers/toolbox/pull/1138
2022-10-17 16:47:38 +02:00
Debarshi Ray 8a9920a420 build: Remove unused variables
Fallout from bafbbe81c9

https://github.com/containers/toolbox/pull/1123
https://github.com/containers/toolbox/pull/1138
2022-10-17 16:47:35 +02:00
Debarshi Ray a6fd0db218 build: Rename variables for consistency and ease of grepping
Names like bash_comp_dir and fish_comp_dir get missed when grepping for
'completion'.

Note that the name of the directory is a plural, because it contains
lots of completions for many different programs, just like the name of
the pkgconfig variable.

https://github.com/containers/toolbox/pull/1123
https://github.com/containers/toolbox/pull/1138
2022-10-17 16:47:26 +02:00
Nieves Montero c1e238f689 Add findutils and sudo to missing docs for image f38
Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-10-13 07:18:06 -04:00
Jonathan Lebon 1f7b9d0d75 images: add `findutils` and `sudo` to missing docs for f36+
Noticed today that `man xargs` was returning the POSIX manpage instead
of the one shipped by `findutils`.

Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
2022-10-13 07:18:06 -04:00
Nieves Montero d85c71795d Add new packages to Fedora 38
The following packages have also been added to Fedora 38 image:
mesa-dri-drivers
mesa-vulkan-drivers
vulkan-loader
Fixing up fedora 38 image to match the changes made earlier on fedora 37.

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-09-29 08:09:20 -04:00
Nieves Montero e6a27d7926 Add package glibc-all-langpacks to f37 and f38
This new packet allows the user to set a locale inside the
toolbox and make locale dependent commands work

https://github.com/containers/toolbox/issues/60

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-09-29 08:08:59 -04:00
Ondřej Míchal 8f6deadaef test/system: Drop extra pull when caching images
In 54a2ca1 image caching has been done by first pulling using Podman and
then moving the image from the local container store to a directory. The
pull to the local container store can be skipped and instead we can use
Skopeo to directly save the pulled image into a directory.

On my machine this reduced the time of the system test setup "test" by
about 50 seconds. This speed-up largely depends on the available network
connection, though.
2022-09-21 14:49:21 +02:00
Nieves Montero f10fe7fbb2 Added directory for f38 image
https://github.com/containers/toolbox/issues/1111

Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-09-21 11:41:23 +02:00
Nieves Montero 2f7c8586ef Added new packages to images f36 AND f35
The following packages have also been added to images f36 and f35:
mesa-dri-drivers
mesa-vulkan-drivers
vulkan-loader

https://github.com/containers/toolbox/pull/1124
Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-09-14 07:00:57 -04:00
Nieves Montero a87fd19980 Added new packages
The following packages have been added to the
image to make OpenGL and Vulkan work:
mesa-dri-drivers
mesa-vulkan-drivers
vulkan-loader

https://github.com/containers/toolbox/issues/1110
Signed-off-by: Nieves Montero <nmontero@redhat.com>
2022-09-14 07:00:57 -04:00
Debarshi Ray 01d3510141 build: Remove a redundant message
If systemd-tmpfiles(8) couldn't be spawned, then the attempted command
is already included in the traceback:
  Traceback (most recent call last):
    File "toolbox/meson_post_install.py", line 26, in <module>
      subprocess.run(['systemd-tmpfiles', '--create'], check=True)
    File "/usr/lib64/python3.10/subprocess.py", line 524, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['systemd-tmpfiles',
      '--create']' returned non-zero exit status 73.

https://github.com/containers/toolbox/pull/1122
2022-09-09 18:36:02 +02:00
Debarshi Ray a0569fdc3e build: Don't try to handle exceptions when spawning subprocesses
In short, it's a lot of effort to cover all possible exceptions that can
be thrown, and things work reasonably well even without handling them.
Since this is just part of the build, there's no point in complicating
things for aesthetic reasons.

More details below.

First, not every runtime error leads to a subprocess.CalledProcessError.
It's only thrown if the spawned process returns with a non-zero exit
code.  There can be other problems.  eg., if the gofmt file isn't
executable then a PermissionError is thrown that's currently not
handled, and the wrapper Python script returns with a non-zero exit
code:
  Traceback (most recent call last):
    File "toolbox/src/meson_go_fmt.py", line 28, in <module>
      gofmt = subprocess.run(['gofmt', '-d', source_dir],
          capture_output=True, check=True)
    File "/usr/lib64/python3.10/subprocess.py", line 501, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/usr/lib64/python3.10/subprocess.py", line 969, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "/usr/lib64/python3.10/subprocess.py", line 1845, in
        _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  PermissionError: [Errno 13] Permission denied: 'gofmt'

Second, when a subprocess.CalledProcessError is thrown, the wrapper
Python script will still return with a non-zero exit code with an
understandable error message, even if the exception isn't handled.  eg.,
if 'meson install' is called without the adequate permissions, then
systemd-tmpfiles(8) will return with a non-zero exit code, which shows
up as:
  --- stdout ---
  Calling systemd-tmpfiles --create ...

  --- stderr ---
  Failed to open directory 'cryptsetup': Permission denied
  Failed to open directory 'certs': Permission denied
  Failed to create directory or subvolume "/var/spool/cups/tmp":
    Permission denied
  ...
  ...
  ...
  Traceback (most recent call last):
    File "toolbox/meson_post_install.py", line 26, in <module>
      subprocess.run(['systemd-tmpfiles', '--create'], check=True)
    File "/usr/lib64/python3.10/subprocess.py", line 524, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['systemd-tmpfiles',
      '--create']' returned non-zero exit status 73.

Similarly, if there problems generating the shell completions:
  --- stderr ---
  Error: unknown command "__completion" for "toolbox"
  Run 'toolbox --help' for usage.
  exit status 1
  Traceback (most recent call last):
    File "toolbox/completion/generate_completions.py", line 35, in
        <module>
    output = subprocess.run(['go', 'run', '.', '__completion',
        completion_type], check=True)
    File "/usr/lib64/python3.10/subprocess.py", line 524, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['go', 'run', '.',
      '__completion', 'bash']' returned non-zero exit status 1.

https://github.com/containers/toolbox/pull/1122
2022-09-09 18:35:55 +02:00
Ondřej Míchal 9d1b5887ae Revert "cmd/completion: Add prefix to command to hide it better"
Cobra provides a default command 'completion' that is always visible.
The reverted change caused an additional command 'completion' to show up
in the list because the then called command '__completion' didn't
override the default one. This became apparent due to d69ce6794b
dynamically generating completion arguments for the 'help' command.

This reverts commit 4469774fb1.

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/1121
2022-09-09 17:58:31 +02:00
Debarshi Ray 0212ce0db9 build: Tweak the names of the ShellCheck tests
https://github.com/containers/toolbox/pull/1120
2022-09-09 17:16:25 +02:00
Debarshi Ray e6c0c00d79 build: Disambiguate the 'toolbox' file and target
Fallout from 6c0b045e1a

https://github.com/containers/toolbox/pull/1120
2022-09-09 17:13:31 +02:00
Ondřej Míchal 66d0418595 cmd/completion: Use Cobra's Bash completion v2
Bash completion v2 was introduced in Cobra v1.2.0 and v1 will be
deprecated in the future:
https://github.com/spf13/cobra/releases/tag/v1.2.0

Since Toolbox already requires Cobra >= v1.3.0, it's better to use the
new Bash completion.

Fallout from d69ce6794b

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/1119
2022-09-09 12:10:57 +02:00
Ondřej Míchal 9bdbb55741 build: Fix typo in install dir for Z shell completions
Fallout from bafbbe81c9

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/1118
2022-09-08 23:00:08 +02:00
Debarshi Ray af2c5325ef build: Wire go-build-wrapper's output to Meson's
Note that Meson's '@OUTPUT@' is not just the basename of the output, but
includes the relative path under the project's root directory.

https://github.com/containers/toolbox/pull/1117
2022-09-08 22:01:16 +02:00
Debarshi Ray 14f02b244d build: Remove redundant build_by_default
By default, the value of the 'build_by_default' argument is determined
by the value of the 'install' argument, which was set to 'true' once the
Go implementation was considered stable enough for end users.

Fallout from 0b3c66434e

https://github.com/containers/toolbox/pull/1116
2022-09-08 20:34:37 +02:00
Ondřej Míchal 6c0b045e1a build: Make the completion depend on the Toolbx binary
Fallout from bafbbe81c9

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/1115
2022-09-08 19:59:17 +02:00
Debarshi Ray 284a2bdf39 cmd/completion: Simplify code
Fallout from d69ce6794b

https://github.com/containers/toolbox/pull/1114
2022-09-08 17:53:27 +02:00
Debarshi Ray 7cad4dc60c cmd/completion: Add copyright and license notices
https://github.com/containers/toolbox/pull/1114
2022-09-08 17:53:24 +02:00
Ondřej Míchal d9085dd70c cmd/completion: Remove unneeded documentation
We don't provide completion for PowerShell, we support only Linux and
instructions for loading completion files are redundant in Toolbx.

Fallout from d69ce6794b

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/1113
2022-09-08 16:40:04 +02:00
Ondřej Míchal bcc3dc93f5 cmd: Don't use Logrus to call panic
While the use of Logrus is convenient, it causes unneeded fluff to be
printed during a panic which distracts from finding the cause of the
panic in the first place.

Fallout from d69ce6794b

https://github.com/containers/toolbox/pull/1055
https://github.com/containers/toolbox/pull/1112
2022-09-08 16:18:13 +02:00
Debarshi Ray 32b147b9ff cmd/create: Improve the error messages for mutually exclusive options
https://github.com/containers/toolbox/pull/1109
2022-09-07 19:20:17 +02:00
Debarshi Ray 947e582c0f cmd/create: Improve the error message for the --authfile option
https://github.com/containers/toolbox/pull/1109
2022-09-07 19:20:05 +02:00
Debarshi Ray ac00c06c97 doc/toolbox-create: Mention the file format accepted by --authfile
https://github.com/containers/toolbox/pull/1108
2022-09-07 17:02:56 +02:00
Debarshi Ray 44e9b1473f doc/toolbox-create: Tweak an example for consistency
When describing the --authfile option, the word 'private' is used to
refer to images needing authentication.  Using the same word shortens
the text so that the word 'custom' can be used in the same way as in the
other examples.

https://github.com/containers/toolbox/pull/1107
2022-09-07 16:35:12 +02:00
Debarshi Ray 00def007f5 pkg/utils: Address the confusion around handling errors from Viper
It turns out that Viper's custom error implementations use non-pointer
receivers, whereas often people assume pointer receivers.  This can
cause confusion when trying to use errors.As(...) with those errors [1].

Secondly, Viper may or may not throw ConfigFileNotFoundError depending
on its build tags.

[1] https://github.com/spf13/viper/issues/1139

https://github.com/containers/toolbox/pull/1105
2022-09-02 18:51:32 +02:00
Debarshi Ray 53c5694040 cmd/utils, pkg/utils: Improve an error message for the image option
https://github.com/containers/toolbox/pull/1104
2022-09-02 15:19:00 +02:00
Debarshi Ray 8454b31a82 cmd/utils, pkg/utils: Improve the error messages for the distro option
https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1103
2022-09-02 14:52:44 +02:00
Debarshi Ray 8ca5611942 Increase the validation coverage for the container & release options
Currently, the container name and release are only validated if they
were specified as command line options.  Neither the value of release
in the configuration file nor the container name generated from an
image are validated.

There's also a lot of repeated code in the command front-ends to
validate the container name and release.  This opens the door for
mistakes.  Any adjustment to the code must be repeated elsewhere, and
there are subtle interactions and overlaps between the validation code
and the code to resolve container and image names.

It's worth noting that the container and image name resolution happens
for both the command line and configuration file options, and generates
the container name from the image when necessary.

Therefore, validating everything while resolving cleans up the command
front-ends and increases the coverage of the validation.

This introduces the use of sentinel error values and custom error
implementations to identify the different errors that can occur while
resolving the container and images, so that they can be appropriately
shown to the user.

https://github.com/containers/toolbox/pull/1101
2022-09-02 13:11:32 +02:00
Debarshi Ray b5474bff84 cmd, pkg/utils: Clarify the error message if the release is invalid
Currently, if --release has an invalid argument, the error message
doesn't give any hints as to what's an acceptable value.  This can be
confusing.  eg., is 36 a valid argument for Fedora?  Or is it f36?  Or
is it F36?  Is 'rawhide' accepted?

https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1100
2022-09-01 17:57:39 +02:00
Debarshi Ray aead0023e3 pkg/utils: Rename a variable
This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1100
2022-09-01 17:57:35 +02:00
Debarshi Ray df7e01df10 pkg/utils: Ensure that the distro CLI and config file options are valid
Currently, if an invalid or unsupported string is specified as the
distro on the command line or in the configuration file, then it would
silently fallback to Fedora.  This shouldn't happen.

It should only fallback to Fedora when no distro was specified and
there's no supported Toolbox image matching the host operating system.
If a distro was explicitly specified then it should either be supported
or it should error out.

The test cases were resurrected from commit 8b6418d8aa.

https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1080
2022-09-01 17:43:20 +02:00
Debarshi Ray f5bcd22ade pkg/utils: Clarify the default and fallback values
The terms 'default' and 'fallback' are used to mean very specific
things in this context.

The 'default' values are those that are used when the 'create', 'enter'
and 'run' commands were used without any option.  These values are
picked to match the host operating system.

However, if there's no supported Toolbox image matching the host
operating system, and no options were provided to the 'create', 'enter'
and 'run' commands, then the 'fallback' values are used as a last
resort.

Consistently using this terminology leads to a clear mental model and
makes the code easier to read.

This rough arrangement of the code was already being used for
'release', and has now been been extended to 'container name prefix'
and 'distro'.  The suffix for the 'fallback' values was simplified to
'Fallback', instead of 'DefaultFallback'.

https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1080
2022-09-01 17:43:15 +02:00
Debarshi Ray 344dda6d8d pkg/utils: Re-unify container & image name resolution
The idea of splitting ResolveContainerAndImageNames into two public
functions [1] didn't turn out to be so useful [2].  It pushed the
burden on the callers, who needed to carefully call the split
functions in the right order, because the container, distro, image and
release values are very tightly related.  This opens the door for
mistakes.

A better approach would be to restore ResolveContainerAndImageNames as
the single public API.  If necessary it could be internally split into
smaller private functions.  It would keep things simple for the
callers.

Note that this commit doesn't include the private split.  If necessary,
it can be done in future.

This reverts commit fd756089ef.

[1] Commit fd756089ef
    https://github.com/containers/toolbox/pull/828
    https://github.com/containers/toolbox/pull/838

[2] https://github.com/containers/toolbox/pull/977

https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1080
2022-09-01 17:43:10 +02:00
Debarshi Ray 0e66af91fe Revert "cmd, pkg/utils: Split distro and release parsing and ..."
The idea of splitting ResolveContainerAndImageNames into two public
functions [1] didn't turn out to be so useful [2].  Splitting things
even further might make it worse.  A better approach might be to
(re-)unify the code further.

This is the first step towards that.

This reverts the following commits:
  * 5c8ad7a7ec
  * 02f45fd3f2
  * 8b6418d8aa

... but retains the test cases that were not tied to the changes in
those commits.

[1] Commit fd756089ef
    https://github.com/containers/toolbox/pull/828
    https://github.com/containers/toolbox/pull/838

[2] https://github.com/containers/toolbox/pull/977

https://github.com/containers/toolbox/issues/937
https://github.com/containers/toolbox/pull/1080
2022-09-01 17:43:04 +02:00
Debarshi Ray 4f78c5ef86 cmd/utils, test/system: Tweak an error message for consistency
Barring the first line, all other lines are terminated with a full stop
elsewhere.

https://github.com/containers/toolbox/pull/1099
2022-09-01 13:02:40 +02:00
Debarshi Ray 59f71219b7 pkg/utils: Mark a private function as such
Figuring out the container name prefix for a given image only needs to
happen as part of resolving the final Toolbox container name from the
given command line and configuration options.

Fallout from c990fb43ca

https://github.com/containers/toolbox/pull/1098
2022-08-31 21:06:51 +02:00
Debarshi Ray e6c9c0c925 pkg/utils: Be more strict about what is acceptable
https://github.com/containers/toolbox/pull/1097
2022-08-31 20:26:21 +02:00
Debarshi Ray b864280e42 playbooks: Make all Meson warnings fatal
This should help detect the kind of problem that was fixed in the
previous commit.

https://github.com/containers/toolbox/pull/1096
2022-08-31 19:35:05 +02:00
Debarshi Ray 1567d207c6 build: Silence a WARNING
Otherwise, Meson complains:
  completion/meson.build:4: WARNING: Project targeting '>= 0.58.0' but
    tried to use feature deprecated since '0.56.0':
    dependency.get_pkgconfig_variable. use
    dependency.get_variable(pkgconfig : ...) instead

Fallout from bafbbe81c9

https://github.com/containers/toolbox/pull/1096
2022-08-31 19:35:01 +02:00
Debarshi Ray 4dd73ad160 .zuul, playbooks: Run unit tests on -Dmigration_path_for_coreos_toolbox
The -Dmigration_path_for_coreos_toolbox option enables a different code
path that's currently not tested by the CI at all.  In fact, since it's
a build-time option, the corresponding code path is not even built by
the CI.

To properly support the -Dmigration_path_for_coreos_toolbox option, it
needs to be covered by the CI.  This is a step in that direction by
running the unit tests on it.

https://github.com/containers/toolbox/pull/1095
2022-08-31 13:42:40 +02:00
Debarshi Ray f3a15c60fe playbooks: Split out the post-configuration steps into a separate file
A subsequent commit will introduce builds performed with the
-Dmigration_path_for_coreos_toolbox option to the CI.  It will be good
to avoid duplicating the build and installation steps for builds with
and without the -Dmigration_path_for_coreos_toolbox option.

https://github.com/containers/toolbox/pull/1095
2022-08-31 13:19:33 +02:00
Debarshi Ray e965dac9f6 playbooks: Split out the dependencies into a separate file
A subsequent commit will introduce builds performed with the
-Dmigration_path_for_coreos_toolbox option to the CI.  It will be good
to avoid duplicating the installation of RPM packages, Git submodule
handling, and the listing of various debug and version information for
builds with and without -Dmigration_path_for_coreos_toolbox option.

https://github.com/containers/toolbox/pull/1095
2022-08-31 12:46:44 +02:00
Debarshi Ray 6f4e8b97dd Link to the installation guide from the shell Toolbox
This will provide a path forward to those who stumble across the POSIX
shell implementation and don't know how to use the Go implementation.

https://github.com/containers/toolbox/pull/1094
2022-08-29 22:09:15 +02:00
Debarshi Ray 56a18d2a15 Revert "build: Drop ShellCheck on Shell Toolbox"
The subsequent commit will touch the POSIX shell implementation, and
hence ShellCheck needs to be run on it.

As long as the POSIX shell implementation is part of the Git repository,
ShellCheck needs to keep running on it, unless it causes some serious
problems.  The ShellCheck test is very fast, and the reassurance and
mental peace that it provides is invaluable.

This reverts commit 8c1d441916.

https://github.com/containers/toolbox/pull/1094
2022-08-29 22:09:07 +02:00
Debarshi Ray 486762925d cmd: Refactor common code into a function
https://github.com/containers/toolbox/pull/1093
2022-08-29 17:49:00 +02:00
Debarshi Ray a9a5b96ec6 test/system: Fix typo
This isn't causing any problems at the moment.  However, the test can
break if the order in which the command line arguments are validated
changes.  eg., if the presence of a command is checked before the
release, then the error message will be different.

Fallout from 8b6418d8aa

https://github.com/containers/toolbox/pull/1091
2022-08-26 17:00:56 +02:00
Debarshi Ray afb002c90c .mailmap: Canonicalize my email
From now on, Debarshi Ray <debarshir@gnome.org> will show up as
Debarshi Ray <rishi@fedoraproject.org>.

Toolbox isn't quite a GNOME project (it doesn't use elements from the
GNOME platform, like GLib), even though it's part of the same
ecosystem and many Toolbox contributors are also GNOME contributors.

Toolbox was conceived to improve the developer experience on Fedora
Silverblue, and expanded over time to cover other use-cases (eg.,
troubleshooting the operating system) and Fedora editions (eg., CoreOS
and Workstation).  Even though there's a growing number of users on
other distributions, they are not the primary reason for Toolbox to
exist.

Toolbox heavily depends on Podman, and as a result is more aligned with
the Containers organization on GitHub than anything else, which is
driven, to a large degree, by Fedora contributors.

Hence, my desire to use my Fedora identity.

https://github.com/containers/toolbox/pull/1083
2022-08-01 18:37:43 +02:00
Debarshi Ray 978bb524e4 test/system: Silence warning with Bats >= 1.7.0
Bats 1.7.0 emits a warning if a command passed to 'run' returns with an
exit code of 127 [1]:
  BW01: `run`'s command `/opt/bin/toolbox run non-existent-command`
    exited with code 127, indicating 'Command not found'. Use run's
    return code checks, e.g. `run -127`, to fix this message.
        (from function `run' in file
          /usr/lib/bats-core/test_functions.bash, line 299,
         in test file test/system/104-run.bats, line 148)

This requires Bats >= 1.5.0, which is present in Fedora >=35, and
supports specifying the exit code as an argument to Bats' 'run'
command [2].

However, bats_require_minimum_version can't be used, because it's
only available from Bats 1.7.0, which is new enough that it's absent
from Fedora 35.

[1] Bats commit c6dc2f88361a4f5b
    https://github.com/bats-core/bats-core/issues/547
    https://bats-core.readthedocs.io/en/stable/warnings/BW01.html

[2] https://github.com/bats-core/bats-core/pull/367
    https://github.com/bats-core/bats-core/pull/507
    https://bats-core.readthedocs.io/en/stable/writing-tests.html

[3] Bats commit 71d6b71cebc3d32b
    https://github.com/bats-core/bats-core/issues/556
    https://bats-core.readthedocs.io/en/stable/warnings/BW02.html

https://github.com/containers/toolbox/pull/1081
2022-08-01 10:47:13 +02:00
Debarshi Ray 03daa8603f .zuul: Drop testing on Fedora 34
Fedora 34 reached End of Life on 7th June 2022:
https://docs.fedoraproject.org/en-US/releases/eol/

The subsequent commit will bump the minimum required Bats version to
1.5.0, which is absent from Fedora 34.

https://github.com/containers/toolbox/pull/1081
2022-08-01 10:47:03 +02:00
Ondřej Míchal 4469774fb1 cmd/completion: Add prefix to command to hide it better
https://github.com/containers/toolbox/pull/1051
2022-05-13 16:33:32 +03:00
Timothée Ravier e80cba4d3e Images: Create F37 toolbox image from F36
https://github.com/containers/toolbox/pull/1012
2022-03-21 00:26:10 +02:00
Ondřej Míchal 958a2c91af ci: Enable testing on Fedora 36 2022-03-21 00:06:41 +02:00
Oliver Gutierrez f8e21a31b3 cmd/run, root: Exit with exit code of invoked command
When a command is executed with toolbox run and it returns a non-zero
exit code, it is just ignored if that exit code is not handled. This
prevents users to identify errors when executing commands in toolbox.

With this fix, the exit codes of the invoked command are propagated
and returned by 'toolbox run'. This includes even exit codes returned
by Podman on error.

https://github.com/containers/toolbox/pull/1013

Co-authored-by: Ondřej Míchal <harrymichal@seznam.cz>
2022-03-21 00:05:45 +02:00
Ondřej Míchal 7cba807e45 cmd/run: Launch command with stderr being attached
Without stderr being attached stderr output of the invoked command goes
into stdout.

Behaviour before:
; output="$(toolbox run /etc)"
Error: failed to invoke command /etc in container <name-of-container>
; echo -e "$output"
/bin/sh: line 1: /etc: Is a directory
/bin/sh: line 1: exec: /etc: cannot execute: Is a directory

Behaviour after:
; output="$(toolbox run /etc)"
/bin/sh: line 1: /etc: Is a directory
/bin/sh: line 1: exec: /etc: cannot execute: Is a directory
Error: failed to invoke command /etc in container <name-of-container>
; echo -e "$output"

https://github.com/containers/toolbox/pull/1013
2022-03-21 00:05:45 +02:00
Ondřej Míchal a22d7821cb cmd/run: Don't allocate pseudo-TTY if not connected to terminal
Passing '--tty' to 'podman exec' unconditionally causes Podman to
allocate a pseudo-TTY for the command execution. This causes problems
with piping (values not being piped in and values being piped out with
carriage return at the end of a line). The solution is to track the
presence of a terminal on stdin/stdout and based on its presence use the
'--tty' flag.

Original behaviour:
; echo foo | toolbox run less

; toolbox echo foo | od -c
0000000   f   o   o  \r  \n
0000005

New behaviour:
; echo foo | toolbox run less
foo

; toolbox echo foo | od -c
0000000   f   o   o  \n
0000004

As seen in the 'Piping in' example, the value gets only printed into
stdout. Not ideal from the point of view of using 'less' (or similar
tools) but still a move forward.

Based on a discussion in Podman's bugtracker[0].

Fixes https://github.com/containers/toolbox/issues/157
Fixes https://github.com/containers/toolbox/issues/848

[0] https://github.com/containers/podman/issues/9718

https://github.com/containers/toolbox/pull/1013
2022-03-21 00:05:45 +02:00
Ondřej Míchal 9d3601e0a6 .zuul: Use labels/nodes without the '-small' suffix 2022-03-20 23:40:58 +02:00
Ondřej Míchal 9bffbb7e13 Revert "ci: Build & Publish Fedora Toolbx images with GitHub Packages"
This revert is done based on discussion happening around the PR that
originally added the change[0].

This reverts commit 818748001c.

[0] https://github.com/containers/toolbox/pull/973

https://github.com/containers/toolbox/pull/1028
2022-03-20 21:11:32 +02:00
Ondřej Míchal ecd1ced719 cmd/create: Add option --authfile
The option accepts a path to a file that is passed to an internal call
to 'podman pull' via the '--authfile' option. This will make it easier
to pull images from registries with authentication in-place.

Fixes https://github.com/containers/toolbox/issues/689

https://github.com/containers/toolbox/pull/935
2022-03-20 18:08:42 +02:00
Ondřej Míchal 192b9c8265 test/system: Mention where to find available environmental variables
https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal 0cdc6b8305 test/system: Add a section about test writing guidelines
https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal dfc38b156c test/system: Adjust the return value of container start test
The output of 'podman logs' does not need to be returned as it can already
be seen in the logs when bats is properly configured.

https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal fc71b9de34 test/system: Skip caching of an image if it is already cached
https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal 754c6fb4d1 test/system: Set custom runtime root for rootless Podman
To more completely separate the test environment Podman runtime from the
default system one set also a custom runtime directory.

https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal 813f971181 test/system: Don't cleanup tests by resetting Podman
Calling 'podman system cleanup' causes problems with containers/images
in a separate Podman root. Despite being stored elsewhere, they are
still under Podman's influence and the cleanup removes them. Also,
running containers (outside the scope of the tests) still got affected
by this call and e.g., lost the ability to follow terminal size changes.

Despite the raised concerns, to ensure proper cleanup of any Podman
state, the reset still needs to be done. Thus, do it only once during
the test suite teardown, moving the potential source of problems to a
single position..

https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal 5012cda506 test/system: Minor fixes & renaming
https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal 5c27d73021 .zuul: Run system tests when they are changed
Fallout from c28d902089

https://github.com/containers/toolbox/pull/1024
2022-03-20 17:11:33 +02:00
Ondřej Míchal bafbbe81c9 Generate & install completion scripts in build system
The previous commit added a means to generating the completion scripts
and this one plugs that into the build system.

A new build option 'install_completions' has been introduced. Set to
'True' by default.

Completions for bash and fish use pkg-config for getting the preferred
install locations for the completions. If the packages are not
available, fallbacks are in-place.

The 'completion' subdir has been kept to work around the ideology of
Meson that does not allow creating/outputing files in subdirectories nor
using the output of custom_target() in install_data().

https://github.com/containers/toolbox/pull/840
2022-02-21 15:15:30 +02:00
Oliver Gutierrez d69ce6794b cmd: Add shell completion command & generate completion
Cobra (the CLI library) has an advanced support for generating shell
completion. It support Bash, Zsh, Fish and PowerShell. This offering
covers the majority of use cases with some exceptions, of course.

The generated completion scripts have one behavioral difference when
compared to the existing solution: flags (--xxx) are not shown by
default. User needs to type '-' first to get the completion.

https://github.com/containers/toolbox/pull/840

Co-authored-by: Ondřej Míchal <harrymichal@seznam.cz>
2022-02-21 15:15:30 +02:00
Ondřej Míchal 5c8ad7a7ec pkg/utils: Use global default instead of magic value
Found while working on https://github.com/containers/toolbox/issues/937

https://github.com/containers/toolbox/pull/977
2022-02-21 13:43:24 +02:00
Ondřej Míchal 02f45fd3f2 pkg/utils: Use newly introduced API for resolving default distro
https://github.com/containers/toolbox/pull/977
2022-02-21 13:43:24 +02:00
Ondřej Míchal 8b6418d8aa cmd, pkg/utils: Split distro and release parsing and report better errors
Using a non-supported distribution via `--distro` resulted in a silent
fallback to the Fedora image which confuses users. When a faulty release
format was used with `--release` a message without any hint about the
correct format was shown to the user.

This separates distro and release parsing into two chunks that have
greater control over error reporting and provides more accurate error
reports for the user.

Fixes https://github.com/containers/toolbox/issues/937

https://github.com/containers/toolbox/pull/977
2022-02-21 13:43:24 +02:00
pablomh 2af0b30ed3 test/system: Delete .swp file
Delete .swp file that was inadvertenly introduced in [1].

[1] 7a5f3ba2e2

https://github.com/containers/toolbox/pull/996
2022-02-07 01:10:10 +02:00
Debarshi Ray 656deb3677 Canonicalize Ondra's name
From now on, Harry Míchal <harrymichal@seznam.cz> will show up as
Ondřej Míchal <harrymichal@seznam.cz>.

https://github.com/containers/toolbox/pull/1002
2022-01-26 01:44:31 +01:00
Ondřej Míchal 8ae0f9c5c6 doc/toolbox: Add section about supported distribution images
Having a list of supported distributions in the manual has been long
overdue. Complementing it with the expected formats should make lives
of users a bit easier.

https://github.com/containers/toolbox/pull/977
https://github.com/containers/toolbox/pull/986
2022-01-13 22:20:47 +01:00
Ondřej Míchal ffd365342e doc: Highlight that --distro has to be used with --release
...unless the selected distro matches the host system.

https://github.com/containers/toolbox/pull/977
https://github.com/containers/toolbox/pull/986
2022-01-13 22:20:43 +01:00
Jakub Steiner 4a652d1efd README: Flip the graphic's facing direction for better layout
https://github.com/containers/toolbox/pull/985
2022-01-13 21:22:23 +01:00
Debarshi Ray afbed7a057 build: Enforce gofmt on all Go sources
Gofmt returns with an exit code of 0 even when it's not happy with the
formatting of the source files. The recommendation is to check the
emptyness of the output [1].

[1] https://github.com/golang/go/issues/24230

https://github.com/containers/toolbox/pull/983
2022-01-11 22:33:51 +01:00
Debarshi Ray 3f9ee19a66 build: Add copyright and license notice
Fallout from be2ba6d2e2

https://github.com/containers/toolbox/pull/984
2022-01-11 19:55:22 +01:00
Debarshi Ray b1743c4927 .zuul: Trigger the tests when the post-install script changes
Fallout from be2ba6d2e2

https://github.com/containers/toolbox/pull/984
2022-01-11 19:55:18 +01:00
Debarshi Ray 4459e02e02 .zuul: Re-align
This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/984
2022-01-11 19:55:05 +01:00
Debarshi Ray d2067ea688 build: Tidy up the Go dependencies with 'go mod tidy'
https://github.com/containers/toolbox/pull/982
2022-01-11 01:24:56 +01:00
Debarshi Ray de6d587c8b build: Mark golang.org/x/term as a direct dependency
The deprecated golang.org/x/crypto/ssh/terminal API was replaced with
golang.org/x/term. Now, every invocation of 'go build' insists on
updating src/go.mod to drop the 'indirect' marker from
golang.org/x/term.

Fallout from d323143c46

https://github.com/containers/toolbox/pull/982
2022-01-11 01:23:41 +01:00
Debarshi Ray be2ba6d2e2 build: Call 'systemd-tmpfiles --create' when installing
It's only necessary to call 'systemd-tmpfiles --create' when building
and installing from source on the host operating system.

It's not needed when using a pre-built binary downstream package,
because:

  * When 'meson install' is called as part of building the package,
    that's not when the temporary files need to be created. They need
    to be created when the binary package is later downloaded and
    installed by the user.

  * Downstream tools can sometimes handle it automatically. eg., on
    Fedora, the systemd RPM installs a trigger that tells RPM to call
    'systemd-tmpfiles --create' automatically when a tmpfiles.d snippet
    is installed.

It's also not needed when installing inside a toolbox container because
the files that 'systemd-tmpfiles --create' is supposed to create are
meant to be on the host.

Downstream distributors set the DESTDIR environment variable when
building their packages. Therefore, it's used to detect when a
downstream package is being built.

Unfortunately, environment variables are messy and, generally, Meson
doesn't support accessing them inside its scripts [1]. Therefore, this
adds a spurious build-time dependency on systemd for downstream
distributors. However, that's probably not a big problem because all
supported downstream operating systems are already expected to use
systemd for the tmpfiles.d(5) snippets to work.

[1] https://github.com/mesonbuild/meson/issues/9

https://github.com/containers/toolbox/issues/955
2022-01-10 22:14:01 +01:00
Ondřej Míchal 5d61a74b1a ci: Set full path to Containerfile
The action does not use provided context when looking for a
Containerfile[0].

[0] https://github.com/redhat-actions/buildah-build/issues/44

https://github.com/containers/toolbox/pull/981
2022-01-10 13:40:32 +02:00
Ondřej Míchal 05eef2aaa6 ci: Add manual trigger to image factory pipeline
https://github.com/containers/toolbox/pull/981
2022-01-10 13:40:32 +02:00
Ondřej Míchal 818748001c ci: Build & Publish Fedora Toolbx images with GitHub Packages
For the sake of greater control over the testing of images and for having an
infrustructure for hosting images that are not endorsed by the distirbutions.

The images are to be rebuilt every day at midnight.

https://github.com/containers/toolbox/pull/973
2022-01-09 18:16:47 +01:00
Ondřej Míchal d323143c46 cmd: Fix issues raised by Golangci
Issues included:

- unreachable code
- unneeded type assertions
- unhandled errors
- use of deprecated API
- unused code

https://github.com/containers/toolbox/pull/979
2022-01-09 17:48:47 +01:00
Ondřej Míchal 46ff946190 ci: Remove only-new-issues option from linter run
The option is mutually exclusive with the working-directory option that
we need to use due to Toolbx code residing in a subdirectory. The tool
itself does not work recursively.

Fallout from https://github.com/containers/toolbox/pull/974

https://github.com/containers/toolbox/pull/978
2022-01-09 17:01:40 +01:00
Ondřej Míchal f456c173b6 pkg/utils: Use new UBI toolbox image
Red Hat has published a new UBI image made specificaly for Toolbx.
Make use of it from now on.

Fixes: https://github.com/containers/toolbox/issues/961

https://github.com/containers/toolbox/issues/976
2022-01-09 16:46:37 +01:00
Ondřej Míchal 7c86f30b77 ci: Add golangci linter
Use machines to do (at least some) of the work humans had to do!

https://github.com/containers/toolbox/pull/974
2022-01-09 16:29:32 +01:00
Jakub Steiner 7351313dc8 CONTRIBUTING: Custom graphic
Can't have right aligned images or inline css, better to just have them
on the left.

https://github.com/containers/toolbox/pull/958
2022-01-07 09:34:39 +01:00
Debarshi Ray 4dd3c89721 .zuul: Style fixes
List the jobs in the same order that they are defined.

https://github.com/containers/toolbox/pull/971
2022-01-05 02:18:15 +01:00
Debarshi Ray 12fbb2361e .zuul: Shuffle some code around
Defining the YAML anchor as part of the Rawhide tests, instead of the
Fedora 34 test, will prevent it from getting lost by mistake when
Fedora 34 reaches its End of Life.

https://github.com/containers/toolbox/pull/971
2022-01-05 02:15:38 +01:00
Debarshi Ray 53a7ac0f9e .zuul: Try to prevent the CI from timing out running the unit tests
Currently, the CI has been frequently timing out when running the unit
tests. It's possible that the current 5 minute timeout isn't enough,
because it's significantly lower than the 20 minute timeout on stable
Fedoras for the system tests.

Increase the timeout to 10 minutes to see if that makes the CI more
stable.

https://github.com/containers/toolbox/pull/970
2022-01-05 00:54:25 +01:00
Debarshi Ray bedea6fa09 .zuul: Try to prevent the CI from timing out on Fedora Rawhide
Currently, the CI has been frequently timing out on Fedora Rawhide
nodes, and it's not clear why that is. One possibility is that this is
due to Rawhide using Linux kernels that are built with debugging
enabled, which makes it slower than released Fedoras. So it might be a
matter of just increasing the timeout.

Currently, the timeout for stable Fedoras is 20 minutes, and that for
Rawhide is 22 minutes. An attempt to increase the Rawhide timeout to 30
minutes didn't succeed, so maybe 45 minutes will be sufficient.

https://github.com/containers/toolbox/pull/964
2022-01-04 23:50:58 +01:00
Ondřej Míchal 73c53a347b src: Update dependencies with 'go get -u'
- github.com/acobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249 => v0.1.0
- github.com/briandowns/spinner v1.10.0 => v1.17.0
- github.com/fsnotify/fsnotify v1.4.9 => v1.5.1
- github.com/sirupsen/logrus v1.4.2 => v1.8.1
- github.com/spf13/cobra v0.0.7 => v1.3.0
- github.com/spf13/viper v1.4.0 => v1.10.1
- golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8 => v0.0.0-20211215153901-e495a2d5b3d3
- golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02 => v0.0.0-20211216021012-1d35b9e2eb4e

https://github.com/containers/toolbox/pull/917
2021-12-17 16:26:19 +01:00
Ondřej Míchal e598e21603 cmd/root: Work around Cobra 1.1.2's handling of usage functions
In version 1.1.2 of Cobra has been included a change[0] that changes
how custom usage functions are handled.

Example of the wrong behaviour:
$ toolbox --foo
Error: unknown flag: --foo
Run 'toolbox --help' for usage.Error: Run 'toolbox --help' for usage.

Desired behaviour:
$ toolbox --foo
Error: unknown flag: --foo
Run 'toolbox --help' for usage.

A workaround is to define a template string for the usage instead. The
template uses the templating language of Go[1]. See the default
template string in version 1.2.1[2].

Because the template is set only once, the executableBase needs to be
set before the template is applied. That required the move of
setUpGlobals() into init() of the cmd package. This is a better place
for the function call as init() is called earlier than Execute()[3].

Upstream issue: https://github.com/spf13/cobra/issues/1532

[0] https://github.com/spf13/cobra/pull/1044
[1] https://pkg.go.dev/text/template
[2] https://github.com/spf13/cobra/blob/v1.2.1/command.go#L491
[3] https://golang.org/doc/effective_go#init

https://github.com/containers/toolbox/pull/917
2021-12-17 16:25:46 +01:00
Ondřej Míchal b49149f0c5 src: Update dependencies with 'go get -u=patch'
- github.com/HarryMichal/go-version v1.0.0 => v1.0.1
- github.com/fsnotify/fsnotify v1.4.7 => v1.4.9
- github.com/godbus/dbus/v5 v5.0.3 => v5.0.6
- github.com/mattn/go-isatty v0.0.8 => v0.0.14
- github.com/spf13/cobra v0.0.5 => v0.0.7
- github.com/spf13/viper v1.3.2 => v1.4.0
- golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 => v0.0.0-20211115234514-b4de73f9ece8
- golang.org/x/sys v0.0.0-20190422165155-953cdadca894 => v0.0.0-20211113001501-0c823b97ae02

https://github.com/containers/toolbox/pull/917
2021-12-17 15:19:46 +01:00
Debarshi Ray 708fa593e2 doc: Document the configuration file
https://github.com/containers/toolbox/pull/963
2021-12-17 13:23:37 +01:00
Debarshi Ray 0e78e4a313 build: Don't assume that all the pages are in section 1 of the manual
This will be used by the subsequent commit to add a page to document
the configuration file, which should go into section 5 of the manual.

https://github.com/containers/toolbox/pull/963
2021-12-17 13:23:33 +01:00
Anthony Wang 59d241baa1 cmd/root: Search subordinate ID files for also the UID
... and not just the username.

https://github.com/containers/toolbox/issues/954
2021-12-17 13:14:37 +01:00
Debarshi Ray d96faf0c1e build: Be more strict when looking for a C compiler
In practice, this means that only Clang and GCC are accepted.

https://github.com/containers/toolbox/pull/960
2021-12-17 02:08:51 +01:00
Ondřej Míchal c28d902089 .zuul: Run tests only for relevant files
Not all file are equal when it comes to testing. Unit tests are related
strictly to the source code and documentation changes do not concern it.
System tests have a wider range of influence but documentation and some
other areas also do not concern them.

I'm unsure about the effect of this change on the periodic pipeline
execution.

https://github.com/containers/toolbox/pull/948
2021-12-16 02:46:00 +02:00
Debarshi Ray 52c85b60d9 Prepare 0.0.99.3 2021-12-10 03:40:42 +01:00
Debarshi Ray 20a20bf149 doc: Refer to a newer Fedora release in the examples
Fedora 30 reached End of Life on 26th May 2020:
https://docs.fedoraproject.org/en-US/releases/eol/

https://github.com/containers/toolbox/pull/953
2021-12-10 03:03:54 +01:00
Debarshi Ray 4948106f7d doc/toolbox-create: Say that --distro & --image are mutually exclusive
https://github.com/containers/toolbox/pull/952
2021-12-10 02:49:19 +01:00
Debarshi Ray 2e99b8a57f doc/toolbox-create, doc/toolbox-run: Remove references to base images
As far as Toolbox is concerned, there are no longer base images and
user-specific customized images. They are all just images.

This should have been part of commit 6543ff6a06.

https://github.com/containers/toolbox/pull/952
2021-12-10 02:49:15 +01:00
Debarshi Ray fa685fbdb0 doc/toolbox-create: Fix typo
Fallout from 0b41cc62f4

https://github.com/containers/toolbox/pull/952
2021-12-10 02:49:11 +01:00
Debarshi Ray e58992066f cmd: Suggest a way forward if coreos/toolbox was used
github.com/coreos/toolbox bind mounts the entire /run from the host
operating system into the toolbox container. Due to this, when run
rootful, the /run/.containerenv created by Podman inside the container
is also seen on the host. This confuses Toolbox into thinking that it's
running inside a container, even when it's running on the host.

This is an attempt to differentiate between a toolbox container and
the host by looking at the 'container' environment variable, so that
the user can be presented with a more helpful error message.

https://bugzilla.redhat.com/show_bug.cgi?id=1998191
https://github.com/containers/toolbox/pull/951
2021-12-10 01:48:28 +01:00
Debarshi Ray 411147988b cmd, test/system: Make the behaviour of 'toolbox' conditional
Commit 6c86cabbe5 changed the command line interface to behave
a lot similar to that of github.com/coreos/toolbox, which makes things
easier for those switching over from it. Make it conditional so that
only those OS distributors who truly need it may enable it, and
restore the previous behaviour as the default.

The tests were updated to test the default behaviour that the vast
majority of users would be seeing. Ideally, the test suite would be run
twice with the migration path turned off and on. However, that would
require a more intrusive surgery of the test suite and likely make it
slower. It might not be worth the hassle because of the small number
of users who should be using the migration path.

Note that the copyright and license notices really must use C++-style
// line comments, because build constraints can only be preceded by
blank lines and other line comments. C-style /* */ block comments can't
precede the build constraints.

This reverts commit ca899c8a56 and parts
of commit 3aeb7cf288.

[1] go help buildconstraint
    https://pkg.go.dev/cmd/go#hdr-Build_constraints

https://github.com/containers/toolbox/pull/951
2021-12-10 01:33:24 +01:00
Debarshi Ray 063bdf965f cmd/utils: Split out the code to list the common commands
This will be used by the subsequent commit to highlight some of the
more common commands that new user is likely to be interested in, when
none has been specified.

https://github.com/containers/toolbox/pull/951
2021-12-10 00:57:36 +01:00
Debarshi Ray 04426a04e5 build: Add an option for the migration path for coreos/toolbox users
Commit 6c86cabbe5 changed the command line interface to behave
a lot similar to that of github.com/coreos/toolbox, which makes things
easier for those switching over from it.

However, it makes things confusing for the vast majority of users who
have never used coreos/toolbox. The Toolbox CLI aims to be friendly to
new users by being self-documenting and offering a smooth onboarding
experience. It's jarring to new users when 'toolbox', without any
commands specified, suggests that it needs to perform a big download.

It's difficult to document two different sets of CLIs, and if the
manuals don't mention the second behaviour, then it just leaves the
users even more confused.

Hence, it will be good to keep the migration path for coreos/toolbox
behind a build-time option, so that only those OS distributors who
truly need it may enable it without impacting others. Fortunately,
coreos/toolbox doesn't have any manuals, which means that there's no
need to conditionalize the documentation.

This commit merely adds the build-time option. Subsequent commits will
use this to actually conditionalize the code.

https://github.com/containers/toolbox/pull/951
2021-12-10 00:35:13 +01:00
Debarshi Ray d27cfb4586 build: Style fixes
https://github.com/containers/toolbox/pull/951
2021-12-10 00:34:21 +01:00
Debarshi Ray 8dd7ee47c5 build: Drop the use of patchelf(1)
Some downstream distributors like RHEL don't have patchelf(1). Relying
on patchelf(1) during the build will make it difficult for such
downstreams to distribute Toolbox.

Fortunately, the path of the dynamic linker (ie., PT_INTERP) is
hardcoded in the ABI specification of each architecture [1]. This means
that Toolbox's build system can keep it's own architecture to dynamic
linker mapping, and specify it during the build through the GNU ld
linker's --dynamic-linker flag, as opposed to using a tool like
patchelf(1) to change the path of the dynamic linker in the built
binary to the one inside /run/host. Currently, the list of
architectures covers the ones that Fedora builds for.

[1] https://sourceware.org/glibc/wiki/ABIList

https://github.com/containers/toolbox/pull/942
2021-12-09 13:16:27 +01:00
Debarshi Ray e28a306a7f build: Bump minimum Meson version to 0.56.0
The subsequent commit will further bump the minimum Meson version to
0.58.0. This will make it easier to read.

https://github.com/containers/toolbox/pull/942
2021-12-08 18:01:35 +01:00
Debarshi Ray 677dda64f3 README.md: Link to the website instead of the code repository
Now that there's a website at https://containertoolbx.org/ it makes
more sense to link to it instead of linking back to the same location
where the README.md resides.
2021-12-08 17:19:47 +01:00
Debarshi Ray f0dfb8f3c1 README.md: Shorten it by linking to the website wherever possible
https://github.com/containers/toolbox/pull/949
2021-12-08 16:16:18 +01:00
Ondřej Míchal 582c999ecd cmd/create: Drop redundant label when creating a container
The Toolbox repository was moved to the 'containers' organization some
time ago already[0]. Containers marked with the label:

  com.github.debarshiray.toolbox=true

will remain supported but new containers will not be created with it.

https://github.com/containers/toolbox/pull/510

[0] de5e5df9b7
2021-12-06 19:37:58 +02:00
Ondřej Míchal ae43560d45 test/system: Test startup on Rawhide with supported versions
We need to know if the latest changes in the libc (that is dynamically
linked to the binary) causes problems in containers based on older
releases of Fedora.

The estimate of the version numbers is very crude and does not follow
the upstream schedule. That should not be a problem, though.

A part of an existing test has been reused and made into a helper
function to implement this.

This increases the run time of the test suite on Rawhide which already
takes longer than the same test suite on released versions of Fedora.
Make up for it by increasing the timeout by 2 minutes.

https://github.com/containers/toolbox/pull/899
2021-12-04 17:37:40 +02:00
Ondřej Míchal ae8bd1a9c9 test/system: Properly bail-out if failed to cache images
The 'die' function is a remnant from times before the system tests
rewrite. It served for writing an error message and then failing
the test. Since the rewrite it is no longer present. Instead, simply
use 'false' in case a caching step fails.

Fallout from da6b6a7c5a

https://github.com/containers/toolbox/pull/899
2021-12-04 17:37:40 +02:00
Ondřej Míchal b14d623f21 CONTRIBUTING: Update content
GitHub generates a table of content[0] for markdown documents using the
headings so there's no need to maintain it manually anymore.

There is a new Matrix chat room[1] for getting in touch with the Toolbx
developers. Advertise it instead of the alternatives.

We have new gifs from jimmac, let's use them!

https://github.com/containers/toolbox/pull/939

[0] https://github.blog/changelog/2021-04-13-table-of-contents-support-in-markdown-files
[1] https://matrix.to/#/#toolbx:matrix.org
2021-12-03 18:09:41 +02:00
Ondřej Míchal 6e47e1f4f7 CONTRIBUTING: Fix typos
https://github.com/containers/toolbox/pull/939
2021-12-03 18:09:41 +02:00
Colin Walters 186affcf47 cmd/initContainer: Include execution error in message
This will pair with a future change to `shell.Run()` so that we capture
the child process stderr.

But actually this change on its own is enough since `shell.Run()`
provides an error message when the invoked command was not found or when
some other unknown error has happened.

Before:
  Error: failed to remove password for user walters`
After:
  Error: failed to remove password for user walters: passwd(1) not found`

which helps immediately pinpoint the problem.

I didn't try to go through and change *all* the `shell.Run()`
invocations, but if accepted I may do it (or someone else can).

https://github.com/containers/toolbox/pull/945
2021-12-03 18:01:26 +02:00
Colin Walters d0104d227e pkg/shell: Simplify code flow
We only need to check against `err != nil` once, not twice.

https://github.com/containers/toolbox/pull/943
2021-12-03 17:32:40 +02:00
Timothée Ravier fd6510c940 images: Make locate(1) opt-in by default
Currently, the entry point of a Toolbox container runs updatedb(8) on
start-up, which can be very I/O intensive. This might be a hindrance
when troubleshooting performance problems on a host, or when
re-creating containers somewhat more frequently.

Users can install the mlocate RPM and restart their containers to
enable locate(1).

Only the images for currently maintained Fedoras (ie., 34, 35 and 36)
were updated.

https://github.com/containers/toolbox/pull/938
2021-12-01 16:21:42 +01:00
Debarshi Ray 2d56a8a084 README.md: Say Containerfile, not Dockerfile
Fallout from 66c49e0926

https://github.com/containers/toolbox/pull/940
2021-12-01 01:08:56 +01:00
Debarshi Ray 72cccca59f README.md: Update image requirements
https://github.com/containers/toolbox/issues/885
2021-12-01 01:08:56 +01:00
Debarshi Ray cfffb72fb0 images: Remove misleading and redundant CMD
There's no need to specify a CMD in a Toolbox image because it's
specified by 'toolbox create', through 'podman create', when creating a
container.

A CMD was specified [1] because the Fedora Container Guidelines
requires it [2]. The idea behind the guidelines is that the right
thing should happen when one runs:
  $ podman run <image>

However, that only makes sense for images targeting single service
containers. Toolbox containers and images are different - they are not
meant to be used like that to run a single one-off service.

Conceptually, 'running' a Toolbox container is expected to provide the
user with a reasonable interactive command line experience. Arguably,
that means offering something like /bin/bash, not /bin/sh.

Also, note that when the CMD was introduced [1], Toolbox containers
were actually created, through 'podman create', with /bin/sh as their
entry points. So, it did make some sense. However, things have changed
since then [3]. The entry point is now 'toolbox init-container'. It's
not possible to mention it in the Toolbox image because the
/usr/bin/toolbox binary isn't present in the image, and it's not meant
to be present.

Therefore, today, /bin/sh is simply not the right fit for a Toolbox
image's CMD. A better option would be /bin/bash.

Note that the fedora base images have their CMD set to /bin/bash, which
is inherited by the fedora-toolbox images.

So, there are two options. Either repeat the same CMD in the
fedora-toolbox images and satisfy the guidelines, or take some
liberties and let the CMD be inherited from the fedora base images.

This commit takes the latter option. People tend to use the
fedora-toolbox images as the starting point for other custom Toolbox
images, sometimes for other operating system distributions. It's
better to keep them minimal to avoid implying extra requirements. In
this case, the CMD is an abstract concept, and the actual entry point
is 'toolbox init-container' as specified by 'toolbox create'.
Specifying /bin/bash might discourage people from creating custom
images that are only meant to have /bin/zsh.

Also, note that the current CMD was actually '/bin/sh -c /bin/sh', not
/bin/sh. Unless a CMD is specified as an array of command line
arguments, it's passed as a single argument to '/bin/sh -c' [4]. So,
this:
  CMD foo bar

... is the same as:
  CMD [ "/bin/sh", "-c", "foo bar" ]

Only the images for currently maintained Fedoras (ie., 34 and 35) were
updated.

This reverts commit 5cc2678a36.

[1] Commit 5cc2678a36

[2] https://docs.fedoraproject.org/en-US/containers/guidelines/creation/

[3] Commit 8b84b5e460
    https://github.com/containers/toolbox/pull/160

[4] https://docs.docker.com/engine/reference/builder/#cmd

https://github.com/containers/toolbox/issues/885
2021-12-01 01:08:56 +01:00
Ondřej Míchal fb565af0a0 test/system: Add function for setting up environment
Instead of typing out two function names to set up the test environment,
type out only one. We never know if a new set up function will show up.

https://github.com/containers/toolbox/pull/818
2021-12-01 01:09:34 +02:00
Oliver Gutierrez 7a5f3ba2e2 test/system: Make tests non-destructive
This allows to run the test suite without having to worry about blasting
the whole local state of Podman.

This is done by creating a configuration file with a custom path for the
storage of Podman and specifying the config file using an env var.

The used location for the temporary storage is located either under
XDG_CACHE_HOME and if the one is not defined, $HOME/.cache is used
instead. The data are namespaced. This follows the XDG Base Directory
Specification[0]. Other locations could be /tmp or /run but those
locations usually use tmpfs and that filesystem can not be used by
Podman[1] due to missing features in tmpfs.

https://github.com/containers/toolbox/pull/818

[0] https://specifications.freedesktop.org/basedir-spec/latest/index.html
[1] https://github.com/containers/podman/issues/10693#issuecomment-863007516
2021-12-01 01:09:34 +02:00
Jens Petersen 8a329752e0 .zuul: pump the current fedora releases to 34 & 35
F33 will EOL at the end of this month (Nov 2021)

https://github.com/containers/toolbox/pull/927
2021-12-01 01:01:40 +02:00
Debarshi Ray 61efad34bc profile.d: Fix the PS1 on Z shell
Currently, on Fedora, a nested instance of Z shell inside a Toolbox
container renders the PS1 like this:
\[\]⬢\[\][\u@\h \W]\$

Notice that Z shell doesn't like that the terminal escape sequences
for the foreground colour are wrapped in '\[' and '\]' [1], and doesn't
understand the special characters like '\u' and '\h'.

This is fixed by making the PS1 specific to the shell. The prompt for
Z shell is based on the default prompt used on Fedora, just like the
one for Bash.

Note that this only affects nested instances of Z shell because of the
way the start-up scripts for Z shell are written on Fedora. Toolbox
invokes top-level shell as a login shell, and for those the PS1 set by
profile.d/toolbox.sh is overwritten by the operating system's default
in /etc/zshrc. See:
https://bugzilla.redhat.com/show_bug.cgi?id=2026749

[1] Commit bc1a816ea3
    https://github.com/debarshiray/toolbox/issues/190

https://github.com/containers/toolbox/pull/936
2021-11-25 19:04:20 +01:00
Debarshi Ray 95dbb5ed49 profile.d: Avoid warnings for undefined variables with 'set -u'
See:
https://gitlab.gnome.org/GNOME/vte/-/issues/285
https://gitlab.gnome.org/GNOME/vte/-/commit/e148105691926cbd

https://github.com/containers/toolbox/pull/936
2021-11-25 18:10:43 +01:00
Debarshi Ray 5c51809a35 README.md: Remove stale comment
Fallout from abb2ac6fd4

https://github.com/containers/toolbox/pull/934
2021-11-23 16:16:14 +01:00
Debarshi Ray 80bed47919 README.md: Update image requirements
All these tools were only used by the POSIX shell implementation. The
Go implementation never used them.

Note that the test suite still invokes id(1) inside a container.
However, it's not a user-visible requirement, and hence is not a hard
requirement for Toolbox images.

https://github.com/containers/toolbox/pull/934
2021-11-23 16:16:10 +01:00
Debarshi Ray bcb80cf7c6 README.md: Don't require unlink(1) in images
Fallout from 0cf3c99377

https://github.com/containers/toolbox/pull/934
2021-11-23 16:16:06 +01:00
Debarshi Ray 036a33882f README.md: Require mount(8) in images
Fallout from 819bb46aaa

https://github.com/containers/toolbox/issues/929
2021-11-23 15:52:44 +01:00
Austin C. Minor 2e4e5bc2a8 README.md: Require capsh(1) in images
https://github.com/containers/toolbox/pull/930
2021-11-23 15:43:14 +01:00
Debarshi Ray 8071bb5cb8 images: Add fedora-toolbox image definition for Fedora 36
https://github.com/containers/toolbox/pull/931
2021-11-19 03:27:45 +01:00
Debarshi Ray df05e276b2 images: Avoid losing mount(8) by accident
The util-linux package was added to ensure the presence of the mount(8)
command. Currently the package is already pulled in by various
dependencies. Therefore, it doesn't increase the size of the image, but
serves as a safeguard against any inadvertent changes.

Note that starting from Fedora 35 onwards, the fedora base images no
longer have mount(8), which increases the importance of this change.

Only the images for currently maintained Fedoras (ie., 34 and 35) were
updated.

https://github.com/containers/toolbox/issues/929
2021-11-19 02:46:34 +01:00
Debarshi Ray 5dbcd377c6 images: Ensure that coreutils-single is replaced by coreutils-full
It's true that the fedora base images no longer come with
coreutils-single, but they used to, and the ubi base images still do.
Therefore, it's worth being extra defensive about this.

It's better to make the build system execute one extra redundant
command than expose users to a bug because of a change that snuck in
unnoticed.

Only the images for currently maintained Fedoras (ie., 34 and 35) were
updated.

This reverts commit 033ed71ec1.

https://github.com/containers/toolbox/pull/931
2021-11-19 02:46:30 +01:00
Debarshi Ray 7542f5fc86 cmd/initContainer: Avoid RPM failures due to unexpected file owners
When running rootless, files and directories bind mounted from the
host operating system can have their ownership listed as
nobody:nobody. This is because the UIDs and GIDs that actually own
those locations are not available inside the container.

Some distribution packages are particular about the file ownerships of
some of these locations. eg., Fedora's filesystem, flatpak and
libvirt-libs RPMs. Encountering nobody:nobody as the owner can fail
package management transactions involving such packages leading to
unforeseen consequences.

Therefore, configure RPM to leave these locations alone.

https://github.com/containers/toolbox/pull/640
2021-11-17 02:55:09 +01:00
Debarshi Ray 55f944c1e7 cmd/utils: Add copyright and license notices
https://github.com/containers/toolbox/pull/924
2021-11-16 10:29:37 +02:00
Debarshi Ray c8aaed52c5 build: Don't assume that libc.so is always in /usr/lib or /usr/lib64
The location for public shared libraries can change from one operating
system distribution to another. eg., while Fedora uses /usr/lib and
/usr/lib64, depending on the hardware architecture, Debian uses paths
like /usr/lib/x86_64-linux-gnu. Therefore, it's best not to assume
anything and ask the toolchain.

https://github.com/containers/toolbox/pull/923
2021-11-13 03:18:36 +01:00
Jakub Steiner b80ffecd3d README.md, data: Replace outdated logos with pixels
https://github.com/containers/toolbox/issues/920
2021-11-13 02:17:21 +01:00
Debarshi Ray c9fc47adfd cmd/utils: Style fixes
https://github.com/containers/toolbox/pull/922
2021-11-13 01:21:56 +01:00
Debarshi Ray 01863d8fe0 test/system: Use 'command -v' to detect the presence of man(1)
'command -v' is more obvious when reading and is POSIX compatible [1].
While 'hash' also gets the job done, it's more of a caching mechanism.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html

https://github.com/containers/toolbox/pull/922
2021-11-13 01:21:52 +01:00
kuba3351 3641a0032f profile.d: Show welcome message on Fedora Kinoite
SC3059 shellcheck rule could be disabled,
because we reqiure bash or zsh to run the welcome script,
so case modification will work.

https://github.com/containers/toolbox/pull/881
2021-11-08 18:06:05 +02:00
Anthony Rabbito a9cc052efe src: mount pcsd inside toolbox container
https://github.com/containers/toolbox/pull/907

Signed-off-by: Anthony Rabbito <hello@anthonyrabbito.com>
2021-11-08 10:33:50 +02:00
Ondřej Míchal 07afff0c30 test/system: Adjust help test to work only with man present
Unlike the following test this one tests using the content of the
toolbox(1) manual page in man. man has to be present in PATH for this
test to be relevant.

Also, this changes the text used to test the output. The current text
can be found in the added short help message and that causes the test
to pass even though it should not. Instead, look for the text in the
"header" of the manual page.

https://github.com/containers/toolbox/pull/837
2021-11-08 01:44:15 +02:00
Oliver Gutierrez 40fc1689a3 utils, help: Show basic help when "man" command is not available.
Fedora CoreOS systems do not have the man command installed. Running
toolbox --help on such a system results in a "man(1) not found" error.

As a compromise for systems without man, we added a simple help text
showing the most commonly used toolbox commands and an URL that direct
users to the Toolbox website where they can find the manuals in Markdown
format.

Fixes #713

https://github.com/containers/toolbox/pull/837
2021-11-08 01:44:15 +02:00
Ondřej Míchal be4d3974ef pkg/utils: Move CLI utility functions to cmd
pkg/utils has been in Go Toolbox since its birth. Along the way it
accumulated a number of functions where a few of them are purely CLI
related. Since the majority of functions in the package are related to
some "deeper" functionality in Toolbox, it makes more sense to move the
selected few to package cmd. This will make pkg/utils a bit leaner and
create a dedicated space for cmd utility functions to live in.

In the process the error creation functions no longer require the
executableBase argument to be passed to them.

https://github.com/containers/toolbox/pull/819
2021-11-07 23:18:46 +02:00
Ondřej Míchal 3aeb7cf288 test/system: Add test placeholders for entering containers
These tests need to be implemented in the future but they require some
magic with socat or similar tools as entering a container is creating
a new subshell and that is hard to monitor from a bash script. Better
not to forget then.

https://github.com/containers/toolbox/pull/915
2021-11-07 17:06:53 +02:00
Ondřej Míchal ca899c8a56 test/system: Add tests for failures for 'root'
https://github.com/containers/toolbox/pull/915
2021-11-07 17:06:53 +02:00
Ondřej Míchal a7e7e0ac2b test/system: Add tests for failures for 'enter'
https://github.com/containers/toolbox/pull/915
2021-11-07 17:06:53 +02:00
Ondřej Míchal fc336bd8b0 test/system: Add tests for failures for 'run'
https://github.com/containers/toolbox/pull/915
2021-11-07 17:06:53 +02:00
Ondřej Míchal 02a831466e cmd/enter: Don't use double negation
Double negation is hard to wrap your head around.

https://github.com/containers/toolbox/pull/913
2021-11-07 13:43:27 +02:00
Ron 4d9849c386 Update README.md
Added patchelf under dependencies
2021-11-03 11:21:45 +02:00
Debarshi Ray 112f281fc4 build: Restore backwards compatibility with existing containers
The path of the dynamic linker (ie., PT_INTERP), as specified in an
architecture's ABI, often starts with /lib or /lib64, not /usr/lib or
/usr/lib64. eg., it's /lib/ld-linux-aarch64.so.1 for aarch64 and
/lib64/ld-linux-x86-64.so.2 for x86_64.

Unfortunately, until very recently [1], only the host's /usr was
present inside a toolbox container's /run/host, not /lib or /lib64.
Therefore, simply prepending /run/host to the /usr/bin/toolbox
binary's existing PT_INTERP entry wouldn't locate the host's dynamic
linker inside the toolbox container. This broke backwards compatibility
with every container out there, except the ones created with the
current development version in Git.

To restore backwards compatibility, the /lib and /lib64 symbolic links
must be resolved to their respective locations inside /usr.

The following caveats must be noted:

  * With glibc, even the basename of the path of the dynamic linker as
    specified in an architecture's ABI, is a symbolic link to a file
    named ld-<glibc-version>.so. However, this file can't be used as
    the PT_INTERP entry, because its name will change when glibc is
    updated and the PT_INTERP entry will become invalid until the
    /usr/bin/toolbox binary is rebuilt.

  * On Debian, a path like /lib64/ld-linux-x86-64.so.2 doesn't resolve
    to something inside /usr/lib64. Instead it ends up inside
    /usr/lib/x86_64-linux-gnu through a series of symbolic links:
      - /lib64 -> usr/lib64
      - /usr/lib64/ld-linux-x86-64.so.2
          -> /lib/x86_64-linux-gnu/ld-2.28.so
      - /lib -> usr/lib

  * It's assumed that a symbolic link with the basename specified in
    the ABI lives in the same directory as the actual dynamic linker
    binary named ld-<glibc-version>.so.

Fallout from 6063eb27b9

[1] Commit d03a5fee80
    https://github.com/containers/toolbox/pull/827

https://github.com/containers/toolbox/issues/821
2021-10-25 15:44:51 +02:00
Debarshi Ray 606b37b226 playbooks/setup-env: Restore running ShellCheck in the CI
Fallout from c33075f3e1
2021-10-25 16:12:14 +03:00
Ondřej Míchal 69ffc888ca playbooks: Fix CI for #897
PR #897 made adjustmnets to the Toolbx binary that it requires presence
of /run/host in both the host filesystem and the filesystem in
a container.

The presence of the directory is assured by systemd-tmpfiles by
running it before the binary is started for the first time. For the run
to be effective 'data/tmpfiles.d/toolbox.conf' has to be installed in
a location visible to systemd-tmpfiles. Therefore, the call to
'systemd-tmpfiles --create' had to be placed after the install step.

https://github.com/containers/toolbox/pull/898
2021-10-22 16:43:38 +03:00
Ondřej Míchal c33075f3e1 playbooks: Unify test setup for system & unit tests
There is no significant benefit in keeping this configuration separated.
Now the to-be installed packages are tracked in a single place and the
test playbooks only call the relevant tests.

This was pointed out by in 6063eb27b9

https://github.com/containers/toolbox/pull/898
2021-10-22 16:43:38 +03:00
Debarshi Ray 6063eb27b9 build: Ensure that binaries are run against their build-time ABI
The /usr/bin/toolbox binary is not only used to interact with toolbox
containers and images from the host. It's also used as the entry point
of the containers by bind mounting the binary from the host into the
container. This means that the /usr/bin/toolbox binary on the host must
also work inside the container, even if they have different operating
systems.

In the past, this worked perfectly well with the POSIX shell
implementation because it got intepreted by whichever /bin/sh was
available. However, the Go implementation, can run into ABI
compatibility issues because binaries built on newer toolchains aren't
meant to be run against older runtimes.

The previous approach [1] of restricting the versions of the glibc
symbols that are linked against isn't actually supported by glibc, and
breaks if the early process start-up code changes. This is seen in
glibc-2.34, which is used by Fedora 35 onwards, where a new version of
the __libc_start_main symbol [2] was added as part of some security
hardening:
  $ objdump -T ./usr/bin/toolbox | grep GLIBC_2.34
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    __libc_start_main
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    pthread_detach
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    pthread_create
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    pthread_attr_getstacksize

This means that /usr/bin/toolbox binaries built against glibc-2.34 on
newer Fedoras fail to run against older glibcs in older Fedoras.

Another option is to make the host's runtime available inside the
toolbox container and ensure that the binary always runs against it.

Luckily, almost all supported containers have the host's /usr available
at /run/host/usr. This is exploited by embedding RPATHs or RUNPATHs to
/run/host/usr/lib and /run/host/usr/lib64 in the binary, and changing
the path of the dynamic linker (ie., PT_INTERP) to the one inside
/run/host.

Unfortunately, there can only be one PT_INTERP entry inside the
binary, so there must be a /run/host on the host too. Therefore, a
/run/host symbolic link is created on the host that points to the
host's /.

Based on ideas from Alexander Larsson and Ray Strode.

[1] Commit 6ad9c63180
    https://github.com/containers/toolbox/pull/534

[2] glibc commit 035c012e32c11e84
    https://sourceware.org/git/?p=glibc.git;a=commit;h=035c012e32c11e84
    https://sourceware.org/bugzilla/show_bug.cgi?id=23323

https://github.com/containers/toolbox/issues/821
2021-10-22 01:20:03 +02:00
Debarshi Ray 452dc797f7 tmpfiles.d: Style fix
The subsequent commit will add an entry to create a /run/host symbolic
link on the host that points to /, and it will require explicitly
skipping some of the columns. Doing the same for the existing entry
will make the file more readable.

https://github.com/containers/toolbox/issues/821
2021-10-21 20:29:35 +02:00
Debarshi Ray d6b1fbea4c cmd/run: Unbreak 'enter' if the shell had exited with 127
Currently, 'toolbox enter' can get into a loop if the user tried to
run something inside the shell that didn't exist, and quit immediately
afterwards:
  $ toolbox enter
  ⬢$ foo
  bash: foo: command not found
  ⬢$
  logout
  Error: command /bin/bash not found in container fedora-toolbox-34
  Using /bin/bash instead.
  ⬢$

This is because:

  * The shell forwards the exit code of the last command that was
    invoked as its own exit code. If the last command that was
    attempted was absent then this exit code is 127.

  * 'podman exec' uses 127 as the exit code when it can't invoke the
    command. If it's able to successfully invoke the command, it
    forwards the exit code of the command itself.

Therefore, in the above example 'podman exec' itself returns with an
exit code of 127 even though both the working directory and the command
that were passed to it were present. Hence, it's necessary to
explicitly check if the requested command was really absent before
attempting the fallbacks.

Fallout from 4536e2c8c2

https://github.com/containers/toolbox/pull/872
2021-09-13 13:28:38 +02:00
Debarshi Ray 208d553cec cmd/run: Style fixes
Fallout from 4536e2c8c2

https://github.com/containers/toolbox/pull/872
2021-09-13 13:28:38 +02:00
Alex Jia 26ae0bb896 test/system: fix typo in 102-list.bats
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2021-09-10 10:42:16 +01:00
Oliver Gutierrez 075b9a8d27 tests: Fix tests to setup the XDG_RUNTIME_DIR variable when empty
https://github.com/containers/toolbox/pull/857

When the XDG_RUNTIME_DIR variable is empty toolbox is not able to
initialize the container correctly and fails to run.
2021-08-09 19:57:41 +02:00
Oliver Gutierrez 09fb237727 tests: Changed container image source for busybox
Due to docker rate limiting we can not rely in docker.io for
retrieving the images.

This was detected when executing our tests for podman fedora
gating pipeline. Our busybox image was not downloaded and
one of the list tests was failing.
2021-08-09 17:09:29 +02:00
Ondřej Míchal 04c673dd06 test/system: Test pull failure
Follow-up to https://github.com/containers/toolbox/pull/852

https://github.com/containers/toolbox/pull/854
2021-07-29 10:10:02 +02:00
Ondřej Míchal 9820550c82 test/system: Use BATS_RUN_TMPDIR for image cache
Using the current working directory for cache is not a good solution
since the test files may reside in a location that is unwritable (e.g.,
/usr/share). The `BATS_RUN_TMPDIR` variable should point to a location
that is sure to be writeable from the test suite.

https://github.com/containers/toolbox/pull/850
2021-07-28 09:31:35 +02:00
Debarshi Ray 660b6970e9 cmd/create: Mention that private images require 'podman login'
It's not possible to programmatically detect when an image requires
logging into the registry [1]. Therefore, instead of trying to handle
'podman pull' failures due to lack of authorization, just mention that
private images require 'podman login' and that further details of the
failure can be found by using the --verbose option.

[1] https://github.com/containers/podman/issues/10858

https://github.com/containers/toolbox/issues/754
https://github.com/containers/toolbox/pull/852
2021-07-23 04:00:20 +02:00
Ondřej Míchal 20f4f68c4e cmd/root, pkg/utils: Add support for configuration files
It looks like there are some oddities with Viper [1]. The errors can't
be examined with errors.As [2] and Viper doesn't actually throw
ConfigFileNotFoundError if a configuration file is not found. Secondly,
there's no way to find out if a key was actually specified in a
configuration file. The InConfig API doesn't return 'true' even if a
key was mentioned in a configuration file, and the IsSet API returns
'true' even if the key was only set via SetDefault in the code.

Some changes by Debarshi Ray.

[1] https://pkg.go.dev/github.com/spf13/viper
[2] https://blog.golang.org/go1.13-errors

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:56:03 +02:00
Ondřej Míchal ffdfaa7410 data/config: Add reference configuration file
The file format is TOML[0] but the file extension is .conf to follow the
convention set by Podman.

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:56:03 +02:00
Debarshi Ray 5824f0adcb cmd/create, pkg/utils: Simplify hint after creating a container
A subsequent commit will add support for configuration files, which can
override the default toolbox image. Since this override affects all
commands, it effectively ends up adding a fourth option to the 'enter'
command, other than the existing options to change the distribution,
release and container. This makes it a lot more difficult to reason
when only 'toolbox enter --release N' is enough to enter the created
container.

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:49:08 +02:00
Debarshi Ray 6a37695086 pkg/utils: Mark a private function as such
Figuring out the default toolbox image for a given distribution only
needs to happen as part of resolving the final toolbox image name from
the given command line options.

Fallout from c990fb43ca

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:49:08 +02:00
Ondřej Míchal b0beb68255 test/system: Fix flaky test
This is a naive attempt to solve the flaking. It could be caused by what
is going inside of the run function.
2021-07-22 11:19:02 +02:00
Ondřej Míchal 0ff01977d6 playbooks: Stop cloning bats libraries
The libraries are now provided as submodules. There's no need to clone
them separately.

https://github.com/containers/toolbox/pull/842
2021-07-22 10:23:53 +02:00
Ondřej Míchal 2594199fef test/system: Track bats libs as submodules & install them better
This will make it easier to work with system tests.

https://github.com/containers/toolbox/pull/842
2021-07-22 10:23:53 +02:00
Jens Petersen d9945a6505 utils: bump the fallback Fedora version to 34
https://github.com/containers/toolbox/pull/845
2021-07-21 23:44:20 +02:00
Ondřej Míchal 6c2cd0e929 test/system: Drop hack around unknown dirs in containers
This hack should not be needed since v0.0.99.2[0].

[0] https://github.com/containers/toolbox/releases/tag/0.0.99.2

https://github.com/containers/toolbox/pull/843
2021-07-21 23:43:41 +02:00
Ondřej Míchal 16b0c5d88f test/system: Check whole lines instead of partials
The 'toolbox run' command has one downside: all newlines contain
a carriage return (CR). This is caused by the unconditional use of the
--tty option in `podman exec`[0]. In these particular tests this can be
worked around by not printing a newline at all.

Another quirk around partial is to check the last line of the output.

[0] https://github.com/containers/podman/issues/9718

https://github.com/containers/toolbox/pull/843
2021-07-21 23:43:41 +02:00
Ondřej Míchal d9147fff8c pkg/utils: Streamline functions
https://github.com/containers/toolbox/pull/847
2021-07-21 21:12:09 +02:00
Oliver Gutierrez 1f0c6d5100 tests: Added a verbose test for container starting
https://github.com/containers/toolbox/pull/831
2021-07-21 19:56:07 +02:00
Ondřej Míchal 259afdf815 test/system: Adjust asserts for broken test
The output of `podman build` has changed a bit. Each line of log
describing the build is now in the format of:

- STEP i/n: msg

instead of:

- STEP i: msg

where i is the current step and n the maximum number of steps.

The exact format is not important for the purpose of testing Toolbox, so
we may fallback to partial string testing.

Also the latest step ("COMMIT") seems to no longer be considered a step,
so just check for the word.

https://github.com/containers/toolbox/pull/846
2021-07-21 18:21:14 +02:00
Ondřej Míchal f7617912e5 pkg/utils: Rename parameter in ParseRelease
It was not apparent on first glance that the second parameter
represented a release (resp. tag).

https://github.com/containers/toolbox/pull/835
2021-07-16 18:00:01 +02:00
Ondřej Míchal b0b9b8e960 pkg/utils: Test ParseRelease
https://github.com/containers/toolbox/pull/841
2021-07-16 17:32:09 +02:00
Ondřej Míchal fd756089ef pkg/utils: Separate container & image name resolution
The ResolveContainerAndImageNames() function does too much work. It
makes more sense to have two functions: one for resolving the image
name and another for resolving the container name.

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/838
2021-07-13 13:07:40 +02:00
Ondřej Míchal d03a5fee80 cmd/create: Expose the host's entire / in the container at /run/host
Having the entire host file system hierarchy mounted inside a toolbox
container gives the containers a more complete environment that's
resilient against future changes in the layout of the file system
hierarchy and the need for giving access to new paths to support new
use-cases. Otherwise, one would have to create a new container to get
access to any path that lies outside the /boot, /etc, /run, /tmp, /usr
and /var directories.

As a nice side-effect, this also simplifies the bind mount handling
code.

https://github.com/containers/toolbox/pull/827
2021-07-09 17:32:52 +02:00
Eveline Raine 94917b729e images: Add iproute to Fedoras 33, 34 and 35
https://github.com/containers/toolbox/pull/314
2021-07-08 20:54:20 +02:00
Ondřej Míchal 37291db161 pkg/utils: Drop redundant functions
https://github.com/containers/toolbox/pull/833
2021-07-08 16:46:51 +02:00
Ondřej Míchal 2e5b6aed3f playbooks/setup-env: Show version of glibc
An upgrade of glibc has caused an issue on Fedora Rawhide[0]. We need a
clear indicator that a change in glibc could cause it.

[0] https://github.com/containers/toolbox/issues/821

https://github.com/containers/toolbox/pull/834
2021-07-08 15:15:57 +02:00
Ondřej Míchal b27b41eff8 pkg/utils: Test ImageReferenceCanBeID
https://github.com/containers/toolbox/pull/825
2021-07-07 18:45:48 +02:00
Ondřej Míchal 781c433a8d pkg/utils: Fix regular expression used to find IDs in image references
Turns out the braces do not need to be escaped.

The equivalent code in the POSIX shell implementation was:
  echo "$image" | grep "^[a-f0-9]\{6,64\}$"

There the braces had to be escaped because it was using grep(1) with
basic regular expressions (ie., without the --extended-regexp flag),
where the meta-characters ?, +, {, |, ( and ) lose their special
meaning unless they are escaped.

However, that was grep(1), and this is Go's regexp package.

Fallout from dd947016b3

https://github.com/containers/toolbox/pull/825
2021-07-07 18:45:48 +02:00
Ondřej Míchal b166a1f13f cmd/create: pkg/utils: Fix wrong use of regexp.MatchString return value
The regexp.MatchString [1] API returns an error only when the regular
expression is faulty, and the boolean return value tells if a match was
found. In this case, the regular expression is baked into the code as a
string literal. So, unless there's a programmer error, it should always
be valid.

Fallout dd947016b3

[1] https://golang.org/pkg/regexp/#MatchString

https://github.com/containers/toolbox/pull/825
2021-07-07 18:45:15 +02:00
Ondřej Míchal 210eded9a3 test/system: Update README
https://github.com/containers/toolbox/pull/824
2021-07-07 12:27:41 +02:00
Randall Mason a733357053 build: Allow overriding the path to tmpfilesdir
When installing to a non-system-wide prefix as a non-root user, the
tmpfilesdir path defined by systemd might not be accessible. Overriding
the path helps to prevent the installation from failing.

https://github.com/containers/toolbox/pull/717
2021-07-05 03:46:07 +02:00
Oliver Gutierrez 8b51901eb1 README.md: Update to reflect label deprecation
https://github.com/containers/toolbox/pull/820
2021-07-02 18:21:11 +02:00
Oliver Gutierrez cb2ccbb594 images: Removed deprecated com.github.debarshiray.toolbox tag
https://github.com/containers/toolbox/pull/820
2021-07-02 18:21:04 +02:00
Ondřej Míchal 6c86cabbe5 cmd/root: Make 'toolbox' create or fall back to a container if possible
This makes 'toolbox', without any commands specified, behave a lot like
'toolbox enter'. When there aren't any toolbox containers, it will
offer to create a new container matching the same parameters passed to
the command. If there's just one toolbox container available, then it
will fall back to it.

This makes the command line interface a lot similar to that of
github.com/coreos/toolbox, which makes things easier for those
switching over from it.

Some changes by Debarshi Ray.

https://github.com/containers/toolbox/pull/811
2021-06-29 15:27:56 +02:00
Debarshi Ray 73450bd8ac images: Add bc to Fedora 33, 34 and 35
https://github.com/containers/toolbox/pull/817
2021-06-28 14:40:37 +02:00
Debarshi Ray e55f866c53 images: Add fedora-toolbox image definition for Fedora 35
https://github.com/containers/toolbox/pull/817
2021-06-28 14:40:34 +02:00
Debarshi Ray 0bdfa53bb2 Prepare 0.0.99.2 2021-06-26 19:48:32 +02:00
Debarshi Ray d66c560a04 images: Synchronize README.md
https://github.com/containers/toolbox/pull/815
2021-06-26 19:33:42 +02:00
Debarshi Ray 2b317b94b5 doc/toolbox-init-container: Style fixes
https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray 23256cb443 doc/toolbox-init-container: Avoid mentioning an implementation detail
SELinux is always meant to be disabled. The exact location of the code
is a historical accident and isn't meant to imply that SELinux might
be optionally enabled.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray 963219b2da doc/toolbox-enter: Restore text about the default naming scheme
This reverts parts of commit ea452d7ced.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray a0457c8fdb doc/toolbox-run: Style fix
https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray 52880eefc9 doc/toolbox-init-container: Synchronize with doc/toolbox-create
Avoid phrases like "shortcoming of container configuration", because
it makes one wonder why a known shortcoming is even being used or not
being fixed. Immutability also has its advantages for certain
use-cases, and it's beyond the scope of this manual to have a full
blown discussion about the pros and cons of OCI containers. Interested
readers can research that on their own.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray 637e90c75d README.md, doc/toolbox: Synchronize with doc/toolbox-create
https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray 55952c8605 doc/toolbox-create: Put toolbox set-up before entry point & tweak them
This builds upon commit ea452d7ced.

The configuration of a toolbox container is a higher level topic than
the entry point, and the entry point is mentioned as one part of it.
Therefore, putting the section on toolbox set-up earlier in the text
makes it nicely flow from the DESCRIPTION section into the Entry Point
sub-section.

Emphasize the user-visible features of a toolbox container, and not
the underlying implementation details, and avoid using too much jargon
about container technology.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray 4b70754a24 doc/toolbox-create: Restore the Entry Point sub-section
It was a deliberate decision to have entry point documented in both
toolbox-create(1) and toolbox-init-container(1). For technical
documentation it's sometimes good to repeat the same thing if it's
sufficiently important. Either to refresh the user's memory or to draw
their attention to it. Having to traverse too many references can get
disorienting. eg., parts of README.md are already repeated in
toolbox(1).

In this case, the entry point is very directly related to the create
command because the command sets it up, and unlike HTML documents,
it's awkward to follow links from manuals.

This reverts parts of commit ea452d7ced.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:15:13 +02:00
Debarshi Ray eaa59e9759 doc/toolbox-create: Generalize the text for the --image option
The DESCRIPTION already explains the details of the set-up on Fedora,
so there's no need to be so specific here. Plus, conceptually, it's not
meant to be Fedora-specific. Fedora is just an example and happens to
be the most well-supported one at the moment, but that will change.

https://github.com/containers/toolbox/pull/814
2021-06-26 09:14:49 +02:00
Debarshi Ray 3f14358dc6 doc/toolbox-create: Use singular for consistency
The rest of the DESCRIPTION section refers to toolbox containers in the
singular, not plural.

https://github.com/containers/toolbox/pull/814
2021-06-26 09:01:10 +02:00
Debarshi Ray 596d5c42b3 doc/toolbox-create: Explain host integration & don't mention security
https://github.com/containers/toolbox/pull/814
2021-06-26 08:55:27 +02:00
Debarshi Ray ec1503fe9a doc/toolbox-create: Keep image details in the same paragraph
https://github.com/containers/toolbox/pull/814
2021-06-26 08:49:39 +02:00
Debarshi Ray 78adfe4a8f doc/toolbox-list: Drop a reference to buildah
This is a continuation of commit ea452d7ced, which dropped all
references to buildah.

https://github.com/containers/toolbox/pull/814
2021-06-26 03:49:48 +02:00
Debarshi Ray 4391b5846c doc/toolbox-run: Skip implementation bits, keep user-visible behaviour
This reverts parts of commit ea452d7ced.

https://github.com/containers/toolbox/pull/814
2021-06-26 03:43:43 +02:00
Debarshi Ray 42e17cead2 doc/toolbox: Skip details about the URL of the Fedora image
Some aspects of the Fedora image are described in toolbox-create(1),
but the exact URL of the image is an implementation detail. As Toolbox
grows, it will become unwieldy to describe these details in the
top-level manual.

https://github.com/containers/toolbox/pull/814
2021-06-26 03:19:53 +02:00
Debarshi Ray db937965f7 doc/toolbox: Remove some duplicated text
The manuals for the individual commands were already listed above.

The entry point of toolbox containers is prominently documented in
toolbox-create(1) and toolbox-init-container(1). It's not clear why
someone who has just come across toolbox(1) would want to know about
the entry point. It's, after all, an implementation detail. They
probably don't even know what's an entry point to begin with. The
top-level manual should give the reader an overall view of the tool
from a user's perspective, and let the other manuals draw them into the
finer details of things.

https://github.com/containers/toolbox/pull/814
2021-06-26 02:54:50 +02:00
Debarshi Ray 549e7ab7ca doc/toolbox: Avoid mentioning UBI until the support settles down a bit
https://github.com/containers/toolbox/pull/814
2021-06-26 02:47:04 +02:00
Debarshi Ray ea78b15b09 doc/toolbox: Restore --verbose
It's good to document the --log-level and --log-podman flags because
they can give us some flexibility with the logging in future, but it's
still desirable to keep --verbose (and the -vv trick) in the manual.

Toolbox is still a small enough code base that not too many log levels
are actually needed, yet. The complexity of remembering which log
level reveals which detail soon starts to outweigh the simplicity of
dumping as much as possible, since there aren't that many log messages
to begin with. It's a lot easier to type and remember things like
--verbose, -v and -vv, than their newer counterparts, and they are a
reasonably widely used convention (eg., flatpak, nmap, ssh, etc.).

If some day Toolbox grows to have a significantly larger number of log
messages, then it's possible that --verbose would be of less use, but
that's not the case today.

https://github.com/containers/toolbox/pull/814
2021-06-26 02:43:04 +02:00
Debarshi Ray d98f89aaa2 Update the short description to match the text on the GitHub project
https://github.com/containers/toolbox/pull/814
2021-06-26 02:42:31 +02:00
Debarshi Ray 4536e2c8c2 cmd/run: Optimize 'enter' and 'run' in the non-fallback case
Currently, the 'enter' command involves two extra invocations of
'podman exec' to detect if the user's chosen shell and current working
directory are present inside the toolbox container. Each invocation is
sufficiently expensive to add a noticeable overhead to the 'enter' and
'run' commands. Moreover, file system operations being inherently racy,
it's always better to detect errors and handle them instead of trying
to pre-emptively avoid them.

Therefore, this shuffles the code around to attempt the non-fallback
invocation, and then handle the errors by attempting a series of
fallbacks for the command and the current working directory.

Unfortunately, in case of a missing command, capsh(1) adds an extra
error message that seems difficult to get rid of:
  $ toolbox enter
  /bin/sh: /bin/zsh: No such file or directory
  Error: command /bin/zsh not found in container fedora-toolbox-34
  Using /bin/bash instead.

https://github.com/containers/toolbox/pull/813
2021-06-26 01:09:31 +02:00
Debarshi Ray 323afb9433 cmd/run: Split out the code to construct the arguments to 'podman exec'
This will be used by the subsequent commit to optimize the 'enter' and
'run' commands in the non-fallback case, by attempting the fallback
only if an error was encountered by the main 'podman exec' invocation,
as opposed to pre-emptively setting up the fallback.

https://github.com/containers/toolbox/pull/813
2021-06-25 23:45:11 +02:00
Debarshi Ray 5ac77773af test/system: Test the handling of unknown flags with each command
This is a continuation of commit 9fdf10f2e1, which added a test
for the handling of unknown flags but without specifying any command.

https://github.com/containers/toolbox/pull/812
2021-06-25 19:24:01 +02:00
Debarshi Ray f47be20383 cmd/initContainer: Don't ignore unknown flags, yet
The reason for setting FParseErrWhitelist.UnknownFlags to 'true' was to
prepare for a future when the 'init-container' command would have fewer
options than it does now.

However, there's no need to prepare for it, because the version of
toolbox(1) that's bind mounted into the container is the same as the
one on the host. So, FParseErrWhitelist.UnknownFlags can be set in
future if, or when, the number of flags do get reduced.

This reverts commit 5c2086e9ea.

https://github.com/containers/toolbox/pull/807
2021-06-25 11:32:43 +02:00
Debarshi Ray 55cbccea9d cmd/root: Sprinkle some debug logs
https://github.com/containers/toolbox/pull/809
2021-06-25 11:28:57 +02:00
Debarshi Ray 4a1aa4652e Ensure that all unknown error messages are limited to the debug logs
This builds upon commit eedfdda535, which added more information
to the error messages presented to the user by including the errors
thrown by the lower layers of the code.

However, if the errors are being thrown by external modules, or are
coming from functions that are too many layers below, then it is
difficult to guarantee their contents. They might be duplicating
information added by the upper layers, or in extreme cases might even
contain JSON blobs, simply because it made sense for the API contracts
of the functions generating the errors.

Therefore, it's better to put them in the debug logs to retain control
over what gets displayed to the user under normal (ie., non-debug)
operation.

https://github.com/containers/toolbox/pull/809
2021-06-25 11:28:57 +02:00
Debarshi Ray 00b3741a3e cmd/create: Don't wrap an empty error
Fallout from eedfdda535

https://github.com/containers/toolbox/pull/809
2021-06-25 11:28:57 +02:00
Ondřej Míchal 1e823b74b3 completion/bash: Completely drop flag --very-verbose
Follow up to 7fafcd271e

https://github.com/containers/toolbox/pull/806
2021-06-23 22:53:05 +02:00
Debarshi Ray 9a0e1b201d cmd/create: Style fixes
It's good to avoid subtle variations in the logic for /boot and /usr,
unless actually necessary, because it makes the code easier to read.

Fallout from 7ec26a27df

https://github.com/containers/toolbox/pull/804
2021-06-23 13:35:34 +02:00
Debarshi Ray 9fdf10f2e1 test/system: Test the handling of unknown flags
https://github.com/containers/toolbox/pull/802
2021-06-23 13:13:59 +02:00
Debarshi Ray f2efc0f758 cmd/root: Unbreak handling of unknown flags
Even though SilenceUsage is set to 'true', to have full control over
what gets shown in the case of an error, there is still (at least?)
one occasion in which the usage function set using SetUsageFunc (ie.,
rootUsage) is used - when an unknown flag is used. For example,
'toolbox --foo'. Oddly enough, an unknown command won't lead to
rootUsage. eg., 'toolbox foo'.

Since rootUsage uses executableBase, that variable needs to be set
earlier, which means that setUpGlobals needs to run before rootUsage.
It turns out that the PersistentPreRunE hook (ie., preRun) doesn't get
invoked when an unknown flag is encountered. Therefore, we can't put
setUpGlobals inside preRun.

This reverts commit 6bbbedf675.

https://github.com/containers/toolbox/pull/802
2021-06-23 13:13:59 +02:00
Ondřej Míchal c6c2e426e0 cmd/list: Support images without names
Some people create images manually. If such created images are recognize
as toolbox images (they have the proper labels) but do not have
a name/tag then 'toolbox list' will panic due to index being out of
range.

https://github.com/containers/toolbox/pull/800
2021-06-22 21:58:29 +02:00
Debarshi Ray eaefb3d125 cmd/list: Style fixes
Fallout from 2369da5d31

https://github.com/containers/toolbox/pull/799
2021-06-22 10:52:53 +02:00
Debarshi Ray 712ee66473 cmd/rm, cmd/rmi: Style fixes
Fallout from 06dcdbe2a6

https://github.com/containers/toolbox/pull/798
2021-06-22 03:42:39 +02:00
Debarshi Ray df620b8c89 cmd/root: Style fix
Fallout from 8bc0018eaa

https://github.com/containers/toolbox/pull/797
2021-06-22 02:54:36 +02:00
Debarshi Ray fb411796bf README.md, cmd/initContainer: Don't require /etc/machine-id in images
Since /etc/machine-id is bind mounted into the toolbox container from
the host operating system, it doesn't make sense to make it mandatory
for images to have that file. Apparently, (some?) Arch Linux images
don't have /etc/machine-id.

Since a missing containerPath for a directory is handled the same way,
there's no reason not to do the same for regular files. It will make
life a bit easier for those creating toolbox images for different
distributions.

https://github.com/containers/toolbox/pull/710
2021-06-22 02:31:30 +02:00
Debarshi Ray dd3936c223 cmd/initContainer: Add more information to errors from mountBind
Errors thrown from 'toolbox init-container' are usually not shown to
the user. One has to use 'podman start --attach ...' to see them.
Therefore, it's worth adding the extra bit of information to the error.

https://github.com/containers/toolbox/pull/710
2021-06-22 02:31:30 +02:00
Debarshi Ray 7cbb7f39f5 cmd/initContainer: State that it's a directory in the debug logs
A subsequent commit will handle a missing containerPath when bind
mounting a regular file like /etc/machine-id. Therefore, it's better to
explicitly state that this code is dealing with a directory.

https://github.com/containers/toolbox/pull/710
2021-06-22 02:31:30 +02:00
Ondřej Míchal dd5cd5f25a playbooks/setup-env: Show versions of more packages
https://github.com/containers/toolbox/pull/795
2021-06-22 00:00:57 +02:00
Ondřej Míchal 7d133001f4 test/system: Fix variable dereference
https://github.com/containers/toolbox/pull/793
2021-06-21 18:42:21 +02:00
Debarshi Ray e8512828c1 cmd/list, test/system: Ignore the problem of UBI not being listed
Not having the corresponding image for UBI toolbox containers show up
in 'toolbox list' is a rough edge. However, the whole UBI feature is
a bit experimental. It's about a gratis RHEL environment getting
created in a jiffy on any host, which is something that hasn't been
done before, and those containers also suffer from various shortcomings
because of the limited package set of UBI.

So it's not that big of a problem if it takes a release or two to
hammer out the details. Especially since it's likely that there will
be a special Toolbox-specific image that's created out of the UBI RPM
repositories, which will likely have the com.github.containers.toolbox
label.

There's also the issue that 0.1.0 needs to be finished, and for that
the the churn needs to be kept down. Changing the labels can very
likely lead to compatibility issues in the future, because of which it
either can't be removed for a while or the wrong images start to get
listed. Some of the older labels have finally been removed, so it's
better not to add more to the list.

In short, this problem will likely fix itself in the coming months, so
it's wise not to create complications trying to rush through a fix.

This reverts commits 1df36591d0 and
e09de9f3e5.

https://github.com/containers/toolbox/issues/753
2021-06-19 01:12:08 +02:00
Ondřej Míchal 1df36591d0 list: Fix typo
Fallout from https://github.com/containers/toolbox/pull/776

https://github.com/containers/toolbox/pull/782
2021-06-01 07:40:06 +02:00
Ondřej Míchal e09de9f3e5 list: Recognize UBI8 as Toolbox image & split tracked labels
UBI[0] does not have the recommend Toolbox labels used to track whether
an image/container is truly a toolbox image/container. Thankfully, they
have a number of labels to choose from that we can use to identify the
image. The "com.redhat.component=ubi8-container" seems to be ideal.

The approach of using the UBI8 label introduces one problem though. If
we were to use only one set of labels for both images and containers,
containers created with Podman and not Toolbox from UBI8 would also be
marked as toolbox containers. This is not desired and therefore there
are now two sets of labels. Ones for images where the new label has been
added and other for containers that stays the same.
2021-06-01 01:49:54 +02:00
Ondřej Míchal 54a2ca1ead test/system: Decouple image caching from Zuul
Since the rewrite of the system test suite[0] we've relied on the Zuul
playbooks for taking care of caching images using Skopeo for increasing
the reliability of the tests (in the past the instability of the Fedora
registry caused problems). This state is problematic if we want to use
the tests in other environments than the Zuul CI. This moves the caching
from Zuul into the system tests.

Currently, Bats does not support officially suite-wide setup and
teardown functions. The solution I chose was to add two new test files
that are executed before and after all tests. This may complicate the
execution of cherry-picked tests but that is not a very common use case
anyway.

The tests are now to some extent capable of adjusting to the host
environment. This is meant in the sense of: I'm running on RHEL, the
"default image" is UBI; I'm running on Fedora, the "default image" is
fedora-toolbox. This mechanism relies on os-release, which is the same
as what Toolbox itself uses.

[0] https://github.com/containers/toolbox/pull/517

https://github.com/containers/toolbox/pull/774
2021-06-01 00:41:20 +02:00
Ondřej Míchal a24c2f6dc1 test/system: Bump secondary fedora image from 29 to 32
The fedora-toolbox:32 image is the first of images in the renamed
toolbox image repository[0]. With the change we can drop the
pull_image_old() function because it was kept only for the old image.

Seems like newer version of ShellCheck checks the validity of variable
names (SC2153). This caused a false positive, so I silenced it.

[0] https://github.com/containers/toolbox/pull/615

https://github.com/containers/toolbox/pull/780
2021-05-31 12:28:24 +02:00
Ondřej Míchal d36cf1cf43 ci: Drop testing on Fedora 32
Fedora 32 has reached EOL in 25/05/2021[0]. Bye bye...

[0] https://fedorapeople.org/groups/schedule/f-32/f-32-all-tasks.html

https://github.com/containers/toolbox/pull/779
2021-05-27 00:37:55 +02:00
Ondřej Míchal 871d905ceb test/system: Use env var for invoking Toolbox
The system test refactor[0] replaced the 'run_toolbox' helper function
with 'run toolbox', which is a normal invocation of Toolbox. This makes
it impossible to override Toolbox used during the tests using env var.

[0] https://github.com/containers/toolbox/pull/693
2021-05-26 22:52:40 +02:00
Ondřej Míchal 2369da5d31 cmd/list: Filter images/containers using labels
Instead of executing 'podman ps|images' several times in a row, call
them only once and get output with all images/containers. Then, filter
out the JSON using labels and keep images/containers only with matching
labels.

This simplifies the code significantly and cuts down the execution time
of 'toolbox list'. The speed gain is noticeable:

- the system has 5 images and 10 containers

Before patch: ~1.45s
After patch:  ~0.85s
2021-05-24 17:28:02 +02:00
Ondřej Míchal 49460ebc56 cmd/list: Track labels of images/containers
This will be needed in a following commit.
2021-05-24 17:28:02 +02:00
Ondřej Míchal ea452d7ced doc: Update to match current state & extend docs
- Update "See also" sections

Toolbox does not use Buildah for a considerable time now[0]. We can stop
referencing it in the "See also" sections of the documentation.

In some places mention podman command man pages where they are relevant.

- Add section about toolbox images/containers

Toolbox only supports certain OCI images. These should be documented.
Also, document the change of fedora-toolbox image name.

- Add a section about toolbox container setup

Toolbox containers are specifically configured OCI containers. This
should be documented so that users know what they're using.

- Remove redundant part documentation

The description of what `toolbox init-container` does is already in
toolbox-init-container(1). There's no need to have it in
toolbox-create(1). Instead, replace the text with a hint to visit the
other part of documentation.

- Clarify behaviour of --image option

The fact that Toolbox by default tries to pull from the Fedora
registry[1] should be noted.

- Update synopsis & description of commands

Mention options passed to `podman exec`. Remove redundant paragraph
about container names (is already dealt with in toolbox-create(1)).

There's no need to mention the name of the default container on Fedora
since Toolbox now also supports RHEL.

Mention the default used image on unrecognised systems.

Emphasize the fact that toolboxes are not a fully sandboxed environment.

Update the wording of the description and splits it into a few
subsections.

The description of the --monitor-host was inaccurate and while the
option will go away in the future[2], it is currently in and should be
more documented.

[0] https://github.com/containers/toolbox/pull/160
[1] https://registry.fedoraproject.org
[2] https://github.com/containers/toolbox/pull/617

https://github.com/containers/toolbox/pull/512
2021-05-24 17:15:50 +02:00
Ondřej Míchal 3db59abf2a cmd/run: Use home folder when $PWD is not in toolbox
Since v0.0.91[0] Toolbox throws an error if $PWD is not available in a
toolbox. While this fixes the problem with 'toolbox enter/run' silently
failing to enter/exec in a container, it still requires an action to be
made by the user. I believe it is better to handle such situations more
gracefully by falling back to entering the user's home folder + printing
a warning about doing so.

[0] https://github.com/containers/toolbox/pull/370
2021-05-24 15:31:29 +02:00
Trung Lê 66c49e0926 Rename Dockerfile to Containerfile
https://github.com/containers/toolbox/pull/757
2021-05-24 15:26:35 +02:00
xPMo d1e024f9dd README: /etc/machine-id is required
See discussion on #710.
2021-05-24 12:39:49 +02:00
Ondřej Míchal 7fafcd271e completion/bash: Update completion
Following patches were made:

  - Use toolbox for listing containers/images (assumes the existence of
    cut and tail)
  - Suggest containers for cmd enter
  - Don't suggest --container option
  - Update global options
  - Don't suggest cmd if already specified

The preferred way to provide of a container in commands enter & create
is via an argument.

Since the rewrite in Go, Toolbox provides the --log-level & --log-podman
options. These options deprecate the --verbose & --very-verbose options.

The completion script with this pops already used global options from
the list, handles better cases with different options and suggests log
levels for the --log-level option.

Toolbox can't be used with multiple commands.
2021-05-24 12:35:46 +02:00
Debarshi Ray e935ed893d cmd/create: Unbreak the spinner and the hint about using the container
The spinner needs to be explicitly stopped before showing the example
'enter' command for using the container. Otherwise, it gets misprinted:
  $ toolbox create foo
  Creating container foo: / Created container: foo
  Enter with: toolbox enter foo

A comment was added to highlight this, since it might not be obvious at
first sight.

Due to such potential quirks, it might be better to keep the spinner
somewhat tightly encapsulated with the code that necessitates it, which
in this case is 'podman create'. For instance, we already need to be
careful to avoid enclosing the pullImage function with a spinner
because it carries it's own.

The code lying between the 'podman pull' and the 'podman create' is so
light that a human user isn't able to discern the absence of a
spinner. So, it seems worth leaning towards ease of understanding and
avoiding potential traps.

This reverts commit 3aaa1d30f1.

https://github.com/containers/toolbox/pull/746
2021-04-03 23:21:07 +02:00
Ondřej Míchal 05e6368882 playbooks/system-test: Show test execution time
Execution time of a test can be a very useful tool.

https://github.com/containers/toolbox/pull/725
2021-03-31 16:02:30 +02:00
Debarshi Ray 803063f081 Update references to the default branch name
The default branch was renamed from "master" to "main".

https://github.com/containers/toolbox/issues/740
2021-03-25 23:07:00 +01:00
Jens Petersen 2dc097e9c0 utils: bump Fedora fallback version to 33
see also #546
2021-03-23 21:51:56 +01:00
Ondřej Míchal 2090e51199 cmd/rm,rmi: Properly rename called function
Fallout from: 06dcdbe2a6

https://github.com/containers/toolbox/pull/738
2021-03-22 18:48:17 +01:00
Ondřej Míchal 8bc0018eaa cmd/root: Streamline preRun()
if blocks with long else blocks can be hard to read.
2021-03-22 17:17:34 +01:00
Ondřej Míchal 6bbbedf675 cmd/root: Set up globals during preRun
Don't leave set-ups all over the place. Keep them in a single point.
2021-03-22 17:17:34 +01:00
Ondřej Míchal 06dcdbe2a6 cmd/rm,rmi: Use function for getting list of images/containers
Instead of using own ways of getting all toolbox images/containers (and
thus unnecessary duplication of code) use a dedicated function.
2021-03-22 17:16:53 +01:00
Ondřej Míchal 1e2005a7d0 cmd/list: Rename functions for getting images/containers 2021-03-22 16:23:35 +01:00
Ondřej Míchal eedfdda535 cmd: Properly wrap around errors
While we mostly report an error correctly, we do not include (wrap) the
underlying cause. This can make debugging tricky at times.

https://github.com/containers/toolbox/pull/728
2021-03-22 12:04:24 +01:00
Ondřej Míchal 8c1d441916 build: Drop ShellCheck on Shell Toolbox
Shell Toolbox has been replaced by the Go implementation a quite while
ago. It is kept in the repository but is no longer actively developed.
There is no need to continue checking it with ShellCheck.

https://github.com/containers/toolbox/pull/733
2021-03-22 11:50:02 +01:00
Ondřej Míchal 7e60e89086 meson: Rearrange lines & check for Skopeo
Skopeo is now a dependency for running system tests[0]. It is not a hard
dependency but at least give the user a heads-up.

https://github.com/containers/toolbox/pull/732
2021-03-22 10:47:30 +01:00
Ondřej Míchal 424691b404 playbooks: Properly separate builddir setup & build
Call "meson builddir" makes Meson create a build directory called
"builddir". It does not make it build the project. A subsequent call to
"meson compile" or "ninja" needs to be made. This subtle detail causes
a minor (purely visual) discrepancy in the CI output. Fix this for both
unit-test & system-test job definitions.
2021-03-21 23:15:15 +01:00
Ondřej Míchal b91a93044b Connect Go unit tests to Meson & rename CI job
We now have some Go unit tests[0] and we should use them. By adding a
new test case to Meson, the existing CI job called "shellcheck" has no
longer an accurate name. With this it has been renamed to "unit-test".
Also, the job is now more important and therefore should also be used
for gating.

[0] https://github.com/containers/toolbox/pull/474

https://github.com/containers/toolbox/pull/730
2021-03-21 22:20:59 +01:00
Ondřej Míchal 5c2086e9ea cmd/initContainer: Ignore unknown flags
The init-container command uses several flags. In the future we'd like
to minimize their number. In order to be able to do that without
breaking systems with older versions of Toolbox, the command can't error
out due to usage of unknown flags.

https://github.com/containers/toolbox/pull/724
2021-03-21 22:10:49 +01:00
Ondřej Míchal 1c1808c9d3 pkg/utils: Add missing variable in fmt.Errorf 2021-03-21 21:33:46 +01:00
masch 3cc6ece1f2 pkg/shell: Add unit tests
The used testing framework is testify[0].

[0] https://github.com/stretchr/testify

https://github.com/containers/toolbox/pull/474
2021-03-21 21:13:21 +01:00
Ondřej Míchal cb56f674f6 cmd/create: Cleanup entry-point command assembly
Too many appends. Instead, put the required sequence into a single array
and append only the variable parts.

Instead of calling "init-container" with "--verbose", call it rather
with "--log-level debug".
2021-03-21 16:16:08 +01:00
Ondřej Míchal 3aaa1d30f1 cmd/create: Start spinner earlier
Showing spinner after a lot of work on creating a toolbox is done (even
though not really time consuming) does not make much sense.

When a spinner is started successfully, a stop command is deferred.
There's no need to stop it additionally.
2021-03-21 16:15:16 +01:00
Debarshi Ray a8c6fd19d8 images: Use a regular file, not a symbolic link, for README.md
A while ago, 'podman build' stopped supporting COPY with relative
symbolic links [1]. Therefore, these image definitions can't be used
without first temporarily removing the symbolic links, which is
annoying.

The downside is that the copies of README.md now has to be separately
updated, which isn't that big of a hassle compared to the problem that
it fixes.

[1] https://github.com/containers/buildah/issues/1952

https://github.com/containers/toolbox/pull/723
2021-03-15 16:46:07 +01:00
Michael Lingelbach 31d63e9511 Don't assume that the user's GID is the same as the UID
When taking ownership of the runtime directory or the initialization
stamp file inside it, it was assumed that the user's GID and UID were
the same. However that might not always be the case.

Note that this commit doesn't use the GID passed from the host to the
toolbox container's entry point to configure the user inside the
container. That is actually more difficult than it sounds. The manual
for useradd(8) says that the group specified by the '--gid' flag must
actually exist.

https://github.com/containers/toolbox/issues/664
2021-03-10 16:23:50 +01:00
Ondřej Míchal fbcc519795 .github: Update issue templates
Recently the issue labels were updated. The templates need to be updated
to auto-set labels correctly.

https://github.com/containers/toolbox/pull/711
2021-03-10 13:18:33 +01:00
Otto Urpelainen 889807ad49 Include the nano default editor
Since Fedora 33, `nano` is the default editor[0]. It needs to be
included in the fedora-toolbox image to have the standard Fedora
experience inside the container.

[0] https://fedoraproject.org/wiki/Changes/UseNanoByDefault
2021-03-10 13:06:15 +01:00
Ondřej Míchal 7ec26a27df src/create: Handle read-only /boot
CoreOS recently made /boot read-only[0]. This caused an issue with
starting containers because /boot was mounted only with option rslave
but missed the ro option. This caused a permission issue.

This scenario is very similar to the one with /usr on Fedora Silverblue.
The solution for this is to check mount options of the path and check if
it uses the rw option or ro and then add it to the mount options in the
--volume option in 'podman create'.

Fixes: https://github.com/coreos/fedora-coreos-tracker/issues/734

[0] 1de21ffa98

https://github.com/containers/toolbox/pull/712
2021-03-01 23:30:58 +01:00
Ondřej Míchal 872eba41a9 pkg/utils: Drop length check when getting mount options
On Fedora Silverblue 33 the output of 'findmnt --noheadings --output
OPTIONS /usr' is:

  ro,relatime,seclabel,ssd,space_cache,subvolid=257,subvol=/root

(Fedora uses btrfs as it's default filesystem since version 33[0]). But
when you make the current deployment mutable using 'ostree admin unlock'
the output of the command changes to something like this:

  ro,relatime,seclabel,ssd,space_cache,subvolid=257,subvol=/root
  rw,relatime,seclabel,lowerdir=usr,upperdir=/var/tmp/ostree-unlock-ovl.JLXHQ0/upper,workdir=/var/tmp/ostree-unlock-ovl.JLXHQ0/work

This causes utils.GetMountOptions to error out preventing a successful
creation of a container with 'toolbox create' when the deployment is
unlocked.

For Toolbox the first line is the more relevant because even though /usr
is technically writeable, it will cease to be after reboot. This is the
current behaviour of the utils.GetMountOptions. Thanks to that I think
it's safe to remove the length check that prevents to create a container
when the current deployment is unlocked.

[0] https://fedoraproject.org/wiki/Changes/BtrfsByDefault

https://github.com/containers/toolbox/pull/554
2021-03-01 21:43:05 +01:00
Seppo Yli-Olli af602c7d22 src/cmd/initContainer: Give access to systemd-resolved's Varlink socket
Since systemd >= 247, systemd-resolved offers a Varlink interface over
the socket at /run/systemd/resolve/io.systemd.Resolve.

https://github.com/containers/toolbox/pull/707
2021-02-24 22:26:16 +01:00
Seppo Yli-Olli baac0461bd test/system: Support an optional nano version number
https://github.com/containers/toolbox/pull/709
2021-02-24 22:14:38 +01:00
Debarshi Ray 3801bd6e5a Prepare 0.0.99.1 2021-02-23 19:57:04 +01:00
Michael Lingelbach a65fe31633 cmd/create: Check if /mnt exists before adding it as a volume mount
No /mnt on NixOS.

https://github.com/containers/toolbox/pull/676
2021-02-20 10:22:30 +01:00
Juanje Ojeda 05c9c06ec6 test/system: Add test for the new --distro option
https://github.com/containers/toolbox/pull/517
2021-02-19 20:38:55 +01:00
Juanje Ojeda 55b5018026 test/system: Test that sudo doesn't require a password
https://github.com/containers/toolbox/pull/517
2021-02-19 20:38:27 +01:00
Andrey Bienkowski fca6af7a8b test/system: Update documentation
Co-authored-by: Juanje Ojeda <juanje.ojeda@gmail.com>
Co-authored-by: Ondřej Míchal <harrymichal@seznam.cz>

https://github.com/containers/toolbox/pull/517
2021-02-19 20:37:29 +01:00
Debarshi Ray f1c36b7cc7 test/system/README.md: Add newline at end of file
https://github.com/containers/toolbox/pull/517
2021-02-19 20:34:56 +01:00
Juanje Ojeda 7973181136 playbooks, test/system: Avoid downloading the images multiple times
Since commit b27795a03e, each section of the test suite starts
and ends with a clean Podman state. This includes removing all images
from the local containers storage. Therefore, the images get downloaded
multiple times during the course of the test suite.

This commit restores the earlier behaviour where the images would get
downloaded only once, by copying them to separate directories outside
the local containers storage and then restoring them when the tests
are run.

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/704
2021-02-19 20:18:21 +01:00
Juanje Ojeda 285a54ba5b playbooks: Specify the artifact generated at each step of the build
See:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/703
2021-02-19 19:18:29 +01:00
Juanje Ojeda 0e8cfe95eb playbooks: Specify the precise versions of bats-assert & bats-support
See:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/703
2021-02-19 19:18:25 +01:00
Juanje Ojeda e654f20d58 .zuul, playbooks: Unify the system-test*.yaml for all Fedora versions
The playbooks were too fragmented and were hard to maintain. With this
the number of files is significantly lowered.

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/702
2021-02-19 18:54:33 +01:00
Juanje Ojeda 2a2fd5baa5 .zuul, playbooks: Unify the setup-env.yaml across all Fedora versions
The playbooks were too fragmented and were hard to maintain. With this
the number of files is significantly lowered.

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/701
2021-02-19 18:15:55 +01:00
Ondřej Míchal a0602e4485 Add deprecation notices to the POSIX shell Toolbox
The POSIX shell Toolbox has been replaced by the Go implementation
quite a long time ago. People on several ocassions created PRs that
still update it, or end up using it by mistake when building from
source.

It was not clear that the POSIX shell implementation has been
deprecated and is no longer maintained.

https://github.com/containers/toolbox/pull/698
2021-02-19 15:40:52 +01:00
Ondřej Míchal f5bbe356ad Drop the FGC namespace from the fedora-toolbox images
The FGC namespace used to be required by the Fedora container
guidelines, but not anymore [1].

[1] https://pagure.io/ContainerSIG/container-sig/issue/2

https://github.com/containers/toolbox/pull/615
2021-02-19 14:47:44 +01:00
Ondřej Míchal 9ec6b49c6b test/system/README.md: Update the URLs for bats-assert and bats-support
The repositories under the ztombol namespace have been inactive since
2016. The code is now maintained by the bats-core organization.

https://github.com/containers/toolbox/pull/700
2021-02-19 11:02:13 +01:00
Ondřej Míchal 8b4bf6dbcf Update bug-report.md
A lot of issues are about toolbox containers not starting up. In such
cases the output of `podman start --attach` is required to see what is
going on. It would be easier if users provided this information right
when they are filling the issue.

https://github.com/containers/toolbox/pull/699
2021-02-18 19:10:23 +01:00
Ondřej Míchal 986efd2666 playbooks: Show Podman info necessary for filing issues 2021-02-17 16:21:54 +01:00
Ondřej Míchal b0407a1f6e ci: Fix pulled image name
I made a mistake in previous commit and did not update the pulled image
name.
2021-02-17 16:04:54 +01:00
Ondřej Míchal aa0ec80e07 ci: Enable testing on Fedora 34 2021-02-17 14:07:39 +01:00
Ondřej Míchal a4812f9bca ci: Drop testing on Fedora 31 2021-02-17 14:06:15 +01:00
Andrey Bienkowski 0e9e0794f8 Update README.md 2021-02-12 19:46:21 +01:00
hexagonrecursion c85c81eb8e Document dependencies: go, ninja 2021-02-12 19:46:21 +01:00
hexagonrecursion 713f4b866d Update the build requirements
Without this I get an error:
```
$ meson -Dprofile_dir=/etc/profile.d builddir
The Meson build system
Version: 0.55.3
Source dir: /home/user/toolbox
Build dir: /home/user/toolbox/builddir
Build type: native build
Project name: toolbox
Project version: 0.0.97

meson.build:1:0: ERROR: Unknown compiler(s): ['cc', 'gcc', 'clang', 'pgcc', 'icc']
The follow exceptions were encountered:
Running "cc --version" gave "[Errno 2] No such file or directory: 'cc'"
Running "gcc --version" gave "[Errno 2] No such file or directory: 'gcc'"
Running "clang --version" gave "[Errno 2] No such file or directory: 'clang'"
Running "pgcc --version" gave "[Errno 2] No such file or directory: 'pgcc'"
Running "icc --version" gave "[Errno 2] No such file or directory: 'icc'"

A full log can be found at /home/user/toolbox/builddir/meson-logs/meson-log.txt
```
2021-02-12 19:46:21 +01:00
Juanje Ojeda b27795a03e test/system: Refactor tests using bats-support and bats-assert
The bats-support[0] and bats-assert[1] libraries extend the
capabilities of bats[2]. Mainly, bats-assert is very useful for clean
checking of values/outputs/return codes.

Apart from updating the cases to use the libraries, the test cases have
been restructured in a way that they don't depend on each other anymore.
This required major changes in the helpers.bats file.

Overall, the tests are cleaner to read and easier to extend due to the
test cases being independent.

Some slight changes were made to the test cases themselves. Should not
alter their final behaviour.

There will be a follow up commit that will take care of downloading of
the tested images locally and caching them using Skopeo to speedup the
tests and try to resolve network problems when pulling the images that
we experienced in the past.

[0] https://github.com/bats-core/bats-support
[1] https://github.com/bats-core/bats-assert
[2] https://github.com/bats-core/bats-core
2021-02-12 14:02:08 +01:00
Ondřej Míchal 97daf9f940 Make use of dynamic CI status badge 2021-02-10 14:49:46 +01:00
Debarshi Ray 001390b26d gen-docs-list: Add newline at end of file
https://github.com/containers/toolbox/pull/688
2021-02-08 16:49:58 +01:00
Debarshi Ray c2f8e19e56 Update copyright notices
https://github.com/containers/toolbox/pull/688
2021-02-08 16:49:54 +01:00
Debarshi Ray 6552274ef1 doc/toolbox: Synchronize with README.md
https://github.com/containers/toolbox/pull/686
2021-01-25 22:37:13 +01:00
Debarshi Ray bcc8ffcf3a README.md: Make it easier to read
https://github.com/containers/toolbox/pull/685
2021-01-25 21:55:02 +01:00
Debarshi Ray 538e2dd9c5 GOALS.md: Cosmetics
https://github.com/containers/toolbox/pull/684
2021-01-25 21:13:07 +01:00
Debarshi Ray 20a8a0551a GOALS.md, README.md: Move the Goals and Use Cases to a separate file
... to prevent the README.md file from becoming too long.

https://github.com/containers/toolbox/pull/684
2021-01-25 20:36:34 +01:00
Ondřej Míchal ba1097a6db README.md: Add a section on how to install Toolbox
https://github.com/containers/toolbox/pull/683
2021-01-25 20:21:33 +01:00
Ondřej Míchal 59055cf9eb doc/toolbox-enter: Mention which shell is spawned
https://github.com/containers/toolbox/pull/682
2021-01-25 18:46:56 +01:00
Ondřej Míchal a8caedbb01 doc/toolbox-enter: Update how toolbox containers are named
The Go implementation prefers a newer syntax for assigning a custom
name to a toolbox container. The --container option is still supported
for backwards compatibility, but the manuals should show the new
workflow.

https://github.com/containers/toolbox/pull/681
2021-01-25 18:22:35 +01:00
Debarshi Ray 4b62648736 doc/toolbox-create: Mention the tags in the default toolbox images
https://github.com/containers/toolbox/pull/681
2021-01-25 18:05:51 +01:00
Ondřej Míchal eef0d28320 doc/toolbox-create: Update how toolbox containers are named
The Go implementation prefers a newer syntax for assigning a custom
name to a toolbox container. The --container option is still supported
for backwards compatibility, but the manuals should show the new
workflow.

https://github.com/containers/toolbox/pull/678
2021-01-22 18:28:53 +01:00
Ondřej Míchal 257a1d05e3 doc/toolbox-create: Remove reference to user-specific customized image
This should have been part of commit 6543ff6a06.

https://github.com/containers/toolbox/pull/678
2021-01-22 18:28:49 +01:00
Ondřej Míchal 6543ff6a06 doc/toolbox-create, doc/toolbox-init-container: Mention the entry point
Ever since version 0.0.10, all newly created toolbox containers use a
reflexive entry point [1] and don't need a user-specific customized
image. Older containers that don't use a reflexive entry point were
deprecated in version 0.0.17 [2], and aren't even supported in the Go
implementation.

Therefore, it's time to finally update the manuals to document the
current way of doing things. Since the reflexive entry point is a key
feature of toolbox containers, some text was added to explain why it's
necessary and what it does.

[1] Commit 8b84b5e460
    https://github.com/containers/toolbox/pull/160

[2] Commit 9dc5281430
    https://github.com/containers/toolbox/pull/336

https://github.com/containers/toolbox/pull/677
2021-01-22 17:21:49 +01:00
Debarshi Ray e0267b7315 test/system: Remove unused variables
https://github.com/containers/toolbox/pull/674
2021-01-19 21:50:49 +01:00
Debarshi Ray 16c47c0e82 profile.d: Silence SC2148
While Toolbox's test suite explicitly uses --shell=sh when running
shellcheck(1) on profile.d/toolbox.sh, external tools like Coverity
can't be expected to do the same. So they complain:
  Line 1:
  [ "$BASH_VERSION" != "" ] || [ "$ZSH_VERSION" != "" ] || return 0
  ^-- SC2148: Tips depend on target shell and yours is unknown. Add a
    shebang or a 'shell' directive.

See: https://github.com/koalaman/shellcheck/wiki/SC2148

https://github.com/containers/toolbox/pull/673
2021-01-19 19:01:41 +01:00
Kan Li 69dd701d3a cmd/initContainer: Handle hosts with /etc/localtime as absolute symlink
On Arch Linux and Ubuntu hosts, /etc/localtime is an absolute symbolic
link to /usr/share/zoneinfo/SomeTimeZone. So, inside the container,
/run/host/etc/localtime also has /usr/share/zoneinfo/SomeTimeZone as
its target.

https://github.com/containers/toolbox/issues/622
2021-01-12 21:03:10 +01:00
267 changed files with 24912 additions and 7102 deletions

16
.codespellexcludefile Normal file
View File

@ -0,0 +1,16 @@
usr_mount_destination_flags="ro"
toolbox_profile_bind="--volume /etc/profile.d/toolbox.sh:/etc/profile.d/toolbox.sh:ro"
toolbox_profile_bind="--volume /usr/share/profile.d/toolbox.sh:/etc/profile.d/toolbox.sh:ro"
if echo "$usr_mount_source_flags" | grep --invert-match "ro" >/dev/null 2>&3; then
--volume "$TOOLBOX_PATH":/usr/bin/toolbox:ro \
if ! mount_bind /run/host/etc/machine-id /etc/machine-id ro; then
if ! mount_bind /run/host/var/lib/flatpak /var/lib/flatpak ro; then
if ! mount_bind /run/host/var/log/journal /var/log/journal ro; then
if strings.Contains(command.Name(), "complet") {
toolboxPathMountArg := toolboxPath + ":/usr/bin/toolbox:ro"
toolboxShMountArg := mount.source + ":" + mount.containerPath + ":ro"
{"/etc/machine-id", "/run/host/etc/machine-id", "ro"},
{"/var/lib/flatpak", "/run/host/var/lib/flatpak", "ro"},
{"/var/lib/systemd/coredump", "/run/host/var/lib/systemd/coredump", "ro"},
{"/var/log/journal", "/run/host/var/log/journal", "ro"},
" \"ro\"," +

11
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,11 @@
* @HarryMichal @debarshiray
/.github/workflows/arch-images.yaml @Foxboron
/.github/workflows/arch-images-pr.yaml @Foxboron
/.github/workflows/ubuntu-images.yaml @Jmennius
/.github/workflows/ubuntu-tests.yaml @Jmennius
/data/gfx/*.gif @jimmac
/images/arch @Foxboron
/images/rhel @debarshiray @olivergs
/images/ubuntu @Jmennius
/src/pkg/utils/arch.go @Foxboron
/src/pkg/utils/ubuntu.go @Jmennius

View File

@ -1,8 +1,8 @@
---
name: Bug report
about: Toolbox's bug report template
about: Toolbx's bug report template
title: ''
labels: bug
labels: 1. Bug
assignees: ''
---
@ -28,7 +28,7 @@ If applicable, add screenshots to help explain your problem.
**Output of `toolbox --version` (v0.0.90+)**
e.g., `toolbox version 0.0.90`
**Toolbox package info (`rpm -q toolbox`)**
**Toolbx package info (`rpm -q toolbox`)**
e.g., `toolbox-0.0.18-2.fc32.noarch`
**Output of `podman version`**
@ -49,4 +49,6 @@ e.g., Fedora Silverblue 32
**Additional context**
Add any other context about the problem here.
When did the issue start occurring? After an update (what packages were updated)?
If the issue is about operating with containers/images (creating, using, deleting,..), share here what image you used. If you're unsure, share here the output of `toolbox list -i` (shows all toolbox images on your system).
If the issue is about operating with containers/images (creating, using, deleting,..), share here what image you used. If you're unsure, share here the output of `toolbox list -i` (shows all Toolbx images on your system).
If you see an error message saying: `Error: invalid entry point PID of container <name-of-container>`, add to the ticket output of command `podman start --attach <name-of-container>`.

View File

@ -1,8 +1,8 @@
---
name: Feature request
about: Toolbox's feature request template
about: Toolbx's feature request template
title: ''
labels: feature request
labels: 1. Feature request
assignees: ''
---

64
.github/workflows/arch-images.yaml vendored Normal file
View File

@ -0,0 +1,64 @@
name: "Arch Linux: Build and push arch-toolbox image"
permissions: read-all
on:
pull_request:
branches:
- main
paths:
- images/arch/**
- .github/workflows/arch-images.yaml
push:
branches:
- main
paths:
- images/arch/**
- .github/workflows/arch-images.yaml
schedule:
- cron: '0 0 * * MON'
env:
distro: 'arch'
platforms: 'linux/amd64'
registry: 'quay.io/toolbx'
username: 'toolbx+github'
# Prevent multiple workflow runs from racing to ensure that pushes are made
# sequentially for the main branch. Also cancel in progress workflow runs for
# pull requests only.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-push-images:
name: Build and push the arch-toolbox image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build container image (latest tag)
uses: redhat-actions/buildah-build@v2
if: env.latest_release == matrix.release
with:
platforms: ${{ env.platforms }}
context: images/${{ env.distro }}
image: ${{ env.distro }}-toolbox
tags: latest
containerfiles: images/${{ env.distro }}/Containerfile
layers: false
oci: true
- name: Push to Container Registry (latest tag)
uses: redhat-actions/push-to-registry@v2
id: push-latest
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main'
with:
username: ${{ env.username }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
image: ${{ env.distro }}-toolbox
registry: ${{ env.registry }}
tags: latest

97
.github/workflows/ubuntu-images.yaml vendored Normal file
View File

@ -0,0 +1,97 @@
name: "Ubuntu: Build and push ubuntu-toolbox images"
permissions: read-all
on:
pull_request:
branches:
- main
paths:
- images/ubuntu/**
- .github/workflows/ubuntu-images.yaml
push:
branches:
- main
paths:
- images/ubuntu/**
- .github/workflows/ubuntu-images.yaml
schedule:
- cron: '0 0 * * MON'
env:
distro: 'ubuntu'
latest_release: '24.04'
platforms: 'linux/amd64, linux/arm64'
registry: 'quay.io/toolbx'
username: 'toolbx+github'
# Prevent multiple workflow runs from racing to ensure that pushes are made
# sequentially for the main branch. Also cancel in progress workflow runs for
# pull requests only.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-push-images:
strategy:
matrix:
release: ['18.04', '20.04', '22.04', '24.04', '24.10', '25.04']
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU for multi-arch builds
shell: bash
run: |
sudo apt update
sudo apt install qemu-user-static
- name: Build container image
uses: redhat-actions/buildah-build@v2
if: env.latest_release != matrix.release
with:
platforms: ${{ env.platforms }}
context: images/${{ env.distro }}/${{ matrix.release }}
image: ${{ env.distro }}-toolbox
tags: ${{ matrix.release }}
containerfiles: images/${{ env.distro }}/${{ matrix.release }}/Containerfile
layers: false
oci: true
- name: Build container image (latest tag)
uses: redhat-actions/buildah-build@v2
if: env.latest_release == matrix.release
with:
platforms: ${{ env.platforms }}
context: images/${{ env.distro }}/${{ matrix.release }}
image: ${{ env.distro }}-toolbox
tags: ${{ matrix.release }} latest
containerfiles: images/${{ env.distro }}/${{ matrix.release }}/Containerfile
layers: false
oci: true
- name: Push to Container Registry
uses: redhat-actions/push-to-registry@v2
id: push
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main' && env.latest_release != matrix.release
with:
username: ${{ env.username }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
image: ${{ env.distro }}-toolbox
registry: ${{ env.registry }}
tags: ${{ matrix.release }}
- name: Push to Container Registry (latest tag)
uses: redhat-actions/push-to-registry@v2
id: push-latest
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main' && env.latest_release == matrix.release
with:
username: ${{ env.username }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
image: ${{ env.distro }}-toolbox
registry: ${{ env.registry }}
tags: ${{ matrix.release }} latest

173
.github/workflows/ubuntu-tests.yaml vendored Normal file
View File

@ -0,0 +1,173 @@
#
# Copyright © 2023 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: ubuntu-tests
on:
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * *'
jobs:
ubuntu-jammy-tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: containers/toolbox
submodules: true
- name: Install deb packages
run: |
sudo apt-get update
sudo apt-get install \
apache2-utils \
bash-completion \
codespell \
fish \
flatpak \
gcc \
go-md2man \
golang-1.21 \
meson \
ninja-build \
openssl \
podman \
shellcheck \
skopeo \
systemd \
udisks2
- name: Ensure that 'p11-kit server' is absent
run: sudo rm /usr/libexec/p11-kit/p11-kit-server
- name: Set up PATH for Go 1.21
run: |
echo "PATH=/usr/lib/go-1.21/bin:$PATH" >> "$GITHUB_ENV"
- name: Checkout Bats
uses: actions/checkout@v4
with:
path: bats-core/bats-core
ref: v1.10.0
repository: bats-core/bats-core.git
submodules: true
- name: Install deb packages for Bats
run: |
sudo apt-get update
sudo apt-get install \
bash \
parallel
- name: Install Bats
run: sudo ./install.sh /usr/local
working-directory: bats-core/bats-core
- name: Checkout shadow
uses: actions/checkout@v4
with:
path: shadow-maint/shadow
ref: 4.13
repository: shadow-maint/shadow.git
submodules: true
- name: Install deb packages for shadow
run: |
sudo apt-get update
sudo apt-get install \
autoconf \
autopoint \
gettext \
libaudit-dev \
libcrypt-dev \
libpam0g-dev \
libselinux1-dev \
libsemanage-dev
- name: Set up build directory for shadow
run: |
autoreconf --force --install --verbose
./configure \
--disable-account-tools-setuid \
--disable-silent-rules \
--with-audit \
--with-libpam \
--with-selinux \
--with-yescrypt \
--without-acl \
--without-attr \
--without-su \
--without-tcb \
SHELL=/bin/sh
working-directory: shadow-maint/shadow
- name: Build shadow
run: make
working-directory: shadow-maint/shadow
- name: Install shadow
run: sudo make install
working-directory: shadow-maint/shadow
- name: Download Go modules
run: go mod download -x
working-directory: containers/toolbox/src
- name: Set up build directory
run: meson setup builddir
working-directory: containers/toolbox
- name: Build
run: meson compile -C builddir --verbose
working-directory: containers/toolbox
- name: Install
run: sudo meson install -C builddir
working-directory: containers/toolbox
- name: Unit tests
run: meson test -C builddir --verbose
working-directory: containers/toolbox
- name: System tests
run: |
bats --timing \
test/system/001-version.bats \
test/system/002-help.bats \
test/system/101-create.bats \
test/system/102-list.bats \
test/system/103-container.bats \
test/system/105-enter.bats \
test/system/106-rm.bats \
test/system/107-rmi.bats \
test/system/108-completion.bats \
test/system/201-ipc.bats \
test/system/203-network.bats \
test/system/220-environment-variables.bats \
test/system/250-kerberos.bats \
test/system/270-rpm.bats \
test/system/501-create.bats \
test/system/505-enter.bats
env:
SHELL: /bin/bash
TMPDIR: /var/tmp
TOOLBX: /usr/local/bin/toolbox
working-directory: containers/toolbox

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "test/system/libs/bats-support"]
path = test/system/libs/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "test/system/libs/bats-assert"]
path = test/system/libs/bats-assert
url = https://github.com/bats-core/bats-assert.git

2
.mailmap Normal file
View File

@ -0,0 +1,2 @@
<rishi@fedoraproject.org> <debarshir@gnome.org>
Ondřej Míchal <harrymichal@seznam.cz>

View File

@ -1,75 +1,189 @@
#
# Copyright © 2020 2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
- job:
name: shellcheck
description: Check validity of shell scripts with shellcheck
timeout: 300
name: unit-test
description: Run Toolbx's unit tests declared in Meson
timeout: 1800
nodeset:
nodes:
- name: ci-node-32
label: cloud-fedora-32-small
run: playbooks/shellcheck.yaml
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/unit-test.yaml
- job:
name: system-test-fedora-31
description: Run Toolbox's system tests in Fedora 31
timeout: 1200
name: unit-test-migration-path-for-coreos-toolbox
description: Run Toolbx's unit tests declared in Meson when built with -Dmigration_path_for_coreos_toolbox
timeout: 600
nodeset:
nodes:
- name: ci-node-31
label: cloud-fedora-31-small
pre-run: playbooks/fedora-31/setup-env.yaml
run: playbooks/fedora-31/system-test-fedora-31.yaml
- name: centos-9-stream
label: cloud-centos-9-stream
pre-run: playbooks/setup-env-migration-path-for-coreos-toolbox.yaml
run: playbooks/unit-test.yaml
- job:
name: system-test-fedora-32
description: Run Toolbox's system tests in Fedora 32
timeout: 1200
name: unit-test-restricted
description: Run Toolbx's unit tests declared in Meson in a restricted build environment
timeout: 1800
nodeset:
nodes:
- name: ci-node-32
label: cloud-fedora-32-small
pre-run: playbooks/fedora-32/setup-env.yaml
run: playbooks/fedora-32/system-test-fedora-32.yaml
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env-restricted.yaml
run: playbooks/unit-test.yaml
- job:
name: system-test-fedora-33
description: Run Toolbox's system tests in Fedora 33
timeout: 1200
name: system-test-fedora-rawhide-commands-options
description: Run Toolbx's commands-options system tests in Fedora Rawhide
timeout: 7200
nodeset:
nodes:
- name: ci-node-33
label: cloud-fedora-33-small
pre-run: playbooks/fedora-33/setup-env.yaml
run: playbooks/fedora-33/system-test-fedora-33.yaml
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-commands-options.yaml
- job:
name: system-test-fedora-rawhide
description: Run Toolbox's system tests in Fedora Rawhide
timeout: 1200
name: system-test-fedora-rawhide-runtime-environment-arch-fedora
description: Run Toolbx's (arch-fedora,runtime-environment) system tests in Fedora Rawhide
timeout: 7200
nodeset:
nodes:
- name: ci-node-rawhide
label: cloud-fedora-rawhide-small
pre-run: playbooks/fedora-rawhide/setup-env.yaml
run: playbooks/fedora-rawhide/system-test-fedora-rawhide.yaml
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-arch-fedora.yaml
- job:
name: system-test-fedora-rawhide-runtime-environment-ubuntu
description: Run Toolbx's (runtime-environment,ubuntu) system tests in Fedora Rawhide
timeout: 7200
nodeset:
nodes:
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-ubuntu.yaml
- job:
name: system-test-fedora-42-commands-options
description: Run Toolbx's commands-options system tests in Fedora 42
timeout: 6300
nodeset:
nodes:
- name: fedora-42
label: cloud-fedora-42
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-commands-options.yaml
- job:
name: system-test-fedora-42-runtime-environment-arch-fedora
description: Run Toolbx's (arch-fedora,runtime-environment) system tests in Fedora 42
timeout: 6300
nodeset:
nodes:
- name: fedora-42
label: cloud-fedora-42
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-arch-fedora.yaml
- job:
name: system-test-fedora-42-runtime-environment-ubuntu
description: Run Toolbx's (runtime-environment,ubuntu) system tests in Fedora 42
timeout: 6300
nodeset:
nodes:
- name: fedora-42
label: cloud-fedora-42
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-ubuntu.yaml
- job:
name: system-test-fedora-41-commands-options
description: Run Toolbx's commands-options system tests in Fedora 41
timeout: 6300
nodeset:
nodes:
- name: fedora-41
label: cloud-fedora-41
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-commands-options.yaml
- job:
name: system-test-fedora-41-runtime-environment-arch-fedora
description: Run Toolbx's (arch-fedora,runtime-environment) system tests in Fedora 41
timeout: 6300
nodeset:
nodes:
- name: fedora-41
label: cloud-fedora-41
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-arch-fedora.yaml
- job:
name: system-test-fedora-41-runtime-environment-ubuntu
description: Run Toolbx's (runtime-environment,ubuntu) system tests in Fedora 41
timeout: 6300
nodeset:
nodes:
- name: fedora-41
label: cloud-fedora-41
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-ubuntu.yaml
- project:
periodic:
jobs:
- system-test-fedora-31
- system-test-fedora-32
- system-test-fedora-33
- system-test-fedora-rawhide
- system-test-fedora-rawhide-commands-options
- system-test-fedora-rawhide-runtime-environment-arch-fedora
- system-test-fedora-rawhide-runtime-environment-ubuntu
- system-test-fedora-42-commands-options
- system-test-fedora-42-runtime-environment-arch-fedora
- system-test-fedora-42-runtime-environment-ubuntu
- system-test-fedora-41-commands-options
- system-test-fedora-41-runtime-environment-arch-fedora
- system-test-fedora-41-runtime-environment-ubuntu
check:
jobs:
- shellcheck
- system-test-fedora-31
- system-test-fedora-32
- system-test-fedora-33
- system-test-fedora-rawhide
- unit-test
- unit-test-migration-path-for-coreos-toolbox
- unit-test-restricted
- system-test-fedora-rawhide-commands-options
- system-test-fedora-rawhide-runtime-environment-arch-fedora
- system-test-fedora-rawhide-runtime-environment-ubuntu
- system-test-fedora-42-commands-options
- system-test-fedora-42-runtime-environment-arch-fedora
- system-test-fedora-42-runtime-environment-ubuntu
- system-test-fedora-41-commands-options
- system-test-fedora-41-runtime-environment-arch-fedora
- system-test-fedora-41-runtime-environment-ubuntu
gate:
jobs:
- system-test-fedora-31
- system-test-fedora-32
- system-test-fedora-33
- system-test-fedora-rawhide
- unit-test
- unit-test-migration-path-for-coreos-toolbox
- unit-test-restricted
- system-test-fedora-rawhide-commands-options
- system-test-fedora-rawhide-runtime-environment-arch-fedora
- system-test-fedora-rawhide-runtime-environment-ubuntu
- system-test-fedora-42-commands-options
- system-test-fedora-42-runtime-environment-arch-fedora
- system-test-fedora-42-runtime-environment-ubuntu
- system-test-fedora-41-commands-options
- system-test-fedora-41-runtime-environment-arch-fedora
- system-test-fedora-41-runtime-environment-ubuntu

View File

@ -1,3 +1,3 @@
## The Toolbox Project Community Code of Conduct
## The Toolbx Project Community Code of Conduct
The Toolbox project follows the [Containers Community Code of Conduct](https://github.com/containers/common/blob/master/CODE-OF-CONDUCT.md).
The Toolbx project follows the [Containers Community Code of Conduct](https://github.com/containers/common/blob/main/CODE-OF-CONDUCT.md).

View File

@ -1,44 +1,26 @@
![Toolbox logo](data/logo/toolbox-logo-landscape.svg)
![Contributing](data/gfx/CONTRIBUTING.gif)
# Contributing to Toolbox
# Contributing to Toolbx
Thank you for wanting to contribute to Toolbox! We greatly appreciate your
Thank you for wanting to contribute to Toolbx! We greatly appreciate your
interest!
# Table of contents
- [Contributing to Toolbox](#contributing-to-toolbox)
- [Table of contents](#table-of-contents)
- [Reporting Bugs](#reporting-bugs)
- [Before Submiting a Bug Report](#before-submiting-a-bug-report)
- [Writing a Bug Report](#writing-a-bug-report)
- [Making Suggestions](#making-suggestions)
- [Before Submitting a Suggestion](#before-submitting-a-suggestion)
- [Writing a Suggestion](#writing-a-suggestion)
- [First Contribution](#first-contribution)
- [Pull Requests](#pull-requests)
- [Creating a Pull Request](#creating-a-pull-request)
- [After Creating a Pull Request](#after-creating-a-pull-request)
- [Little Style Guide](#little-style-guide)
# Reporting Bugs
## Before Submiting a Bug Report
## Before Submitting a Bug Report
- Check if your issue is already reported in our [bug tracker](https://github.com/containers/toolbox/issues)
- If the issue is already reported and is marked as **OPEN**, comment on it
and if possible and needed, share info about the issue just as if you were
submiting a new issue
- If the issue is marked as **CLOSED**, check if your version of Toolbox is
submitting a new issue
- If the issue is marked as **CLOSED**, check if your version of Toolbx is
up-to-date or if there are some steps, described in the closed issue, that
you should follow. If you are still experiencing the issue, please file a
new issue
- See our [documentation](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/)
if there are some steps that could help you solve your issue
- Sometimes a bug is not reported in our bug tracker but instead people ask for
help somewhere else: IRC ([Freenode](https://freenode.net) - #silverblue,
#containers, #fedora, #fedora-devel,..), [Fedora forum](https://discussion.fedoraproject.org/tag/toolbox),
or somewhere else. In such cases we'd like you to still report the bug and
help somewhere else (e.g., chat channels). In such cases we'd like you to still report the bug and
share with us any info that could be gathered from those places
## Writing a Bug Report
@ -55,14 +37,14 @@ When writing a bug report:
reproduce it.
- **Describe the behavior you received and what you expected** - Sometimes it
may not be clear what the *right* behavior should look like.
- **Provide info about the version of used software** - What version of Toolbox
- **Provide info about the version of used software** - What version of Toolbx
and Podman do you use?
- **Provide info about your system** - What distribution do you use? Which
desktop environment? Is it a VM or a real machine?
# Making Suggestions
Toolbox is not feature-complete and some of it's functionality is not-there-yet.
Toolbx is not feature-complete and some of it's functionality is not-there-yet.
We are thankful for all suggestions and ideas but be ready that your suggestion
may be rejected.
@ -81,7 +63,7 @@ may be rejected.
When writing a suggestion:
- **Use a clear and descriptive title**
- **Describe the idea** - What parts of Toolbox does it affect? Is it a major
- **Describe the idea** - What parts of Toolbx does it affect? Is it a major
functionality or a minor tweak?
- **Provide step-by-step description of the suggested behavior** so that we
will understand.
@ -90,13 +72,13 @@ When writing a suggestion:
# First Contribution
Toolbox is written in [Go](https://golang.org) and uses [Meson](https://mesonbuild.com)
Toolbx is written in [Go](https://golang.org) and uses [Meson](https://mesonbuild.com)
as it's buildsystem.
Instructions for building Toolbox from source are in our [README](https://github.com/containers/toolbox/blob/master/README.md).
Instructions for building Toolbx from source are in our [README](https://github.com/containers/toolbox/blob/main/README.md).
> You may not need to build the project from source if your contribution is not
> related to the code of Toolbox itself (e.g., documentation, updating CI
> related to the code of Toolbx itself (e.g., documentation, updating CI
> config, playing with image definitions,...).
Here are some ideas of what you could contribute with:
@ -106,18 +88,18 @@ Here are some ideas of what you could contribute with:
- Write tests - Go has [tools](https://golang.org/pkg/testing/) for writing tests.
There are also [some](https://github.com/stretchr/testify) [libraries](https://github.com/onsi/ginkgo)
used for creating even more sophisticated tests.
- Play with custom images - Toolbox currently officially works with Fedora-based
- Play with custom images - Toolbx currently officially works with Fedora-based
images. Ultimately there should be a wide variety of supported distro images.
You can help with testing other people's image definitions or creating your
own. **Beware**, maintainers still don't have a clear idea of how the image
infrustructure should look like.
- Write documentation - Some functions in Toolbox's code don't have comments and
it's not very clear what they do. Toolbox has it's [documentation](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/)
infrastructure should look like.
- Write documentation - Some functions in Toolbx's code don't have comments and
it's not very clear what they do. Toolbx has it's [documentation](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/)
hosted by Fedora. It's not very large and could use some attention.
- Hack on the code and share the result - Seriously! Sometimes random ideas are
the best.
Toolbox currently does not have an infrastructure for translations. You can help
Toolbx currently does not have an infrastructure for translations. You can help
us to set it up!
# Pull Requests
@ -133,9 +115,10 @@ documentation, code comments and much more.
code you're contributing to, consider opening another PR if you want to
implement it yourself or file an issue so that somebody else can pick it up.
- Update documentation to reflect your changes - Manual pages can be found in
directory `doc`. If your changes affect Toolbox's [documentation](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/),
directory `doc`. If your changes affect Toolbx's [documentation](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/),
consider creating a PR there (but to save yourself time, you can do it
after your changes are accepted), too.
- After creating a PR add to the bottom of all your commits a link to the PR. This helps the future maintainers find discussions around the changes.
## After Creating a Pull Request
@ -145,20 +128,19 @@ your efforts! We really appreciate them! Sometimes we may be stuck in different
parts of our lives.
If it takes us a very long time to even respond to your Pull Request, you can
try to @ping us, request a review or try to reach to us on IRC ([Freenode](https://freenode.net/);
#silverblue, #containers, #fedora-devel,..) or [Fedora Forum](https://discussion.fedoraproject.org).
try to @ping us at our communication channels (see section #Communication).
Toolbox has a simple CI (Continuos Integration) setup for running system tests (
can be found under directory `test/system`). Their goal is to check if your
changes don't affect adversely Toolbox's functionality. Sometimes these tests
##
Toolbx has a CI (Continuous Integration) setup for running tests. Their goal is to check if your
changes don't affect adversely Toolbx's functionality. Sometimes these tests
mail fail with a false-positive. If you are not sure about the outcome of the
tests, reach out to the maintainers!
tests, you can try to trigger a new test run by writing a comment with text `recheck` (really just that). If the issue persists, reach out to the maintainers!
Toolbox's CI system is [Zuul](https://zuul-ci.org/) hosted at [softwarefactory](https://softwarefactory-project.io/).
Toolbx's CI system is [Zuul](https://zuul-ci.org/) hosted at [softwarefactory](https://softwarefactory-project.io/). The CI is defined using [Ansible](https://www.ansible.com) playbooks. For more information on writing Zuul jobs see their [documentation](https://zuul-ci.org/docs/zuul/reference/user.html).
# Little Style Guide
Toolbox is written in [Go](https://golang.org) and uses its default set of tools
Toolbx is written in [Go](https://golang.org) and uses its default set of tools
including `gofmt` and `golint`.
Here are some good materials to learn from about the way how to write nice and
@ -175,3 +157,8 @@ If you are using Visual Studio Code, there are [plugins](https://marketplace.vis
that include all this functionality and throw a warning if you're doing
something wrong.
# Communication
The Toolbx team hangs-out at a dedicated Matrix channel: [#toolbx:matrix.org](https://matrix.to/#/#toolbx:matrix.org).
For Fedora-specific discussions you can visit their [wiki](https://docs.fedoraproject.org/en-US/project/join/) to learn about the means to contact the community.

66
GOALS.md Normal file
View File

@ -0,0 +1,66 @@
<img src="data/logo/toolbox-logo-landscape.svg" alt="Toolbox logo landscape" width="800"/>
## Goals
### High Level Goals
- Provide a convenient command line interface to run containers using
[Podman](https://podman.io/)
- Support for development, debugging and system management use cases
- Support for multiple distros
- `toolbox` package in multiple distros
- `toolbox` containers for multiple distros
### Non-goals
- Supporting multiple container runtimes. Toolbx will use Podman exclusively
- Adding significant features on top of Podman
- Significant feature requests should be driven into Podman upstream
- To run containers that aren't tightly integrated with the host
- Extremely sandboxed containers quickly become specific to the user
### Developer Use Cases
- Im a developer hacking on source code and building/testing code
- Most cases: user doesn't need root, rootless containers work fine
- Some cases: user needs root for testing
- Desktop Development:
- Developers need things like D-Bus, display, etc. to be forwarded into the
Toolbx container
- Headless Development:
- Toolbx works properly in headless environments (no display, etc)
- Need development tools like GDB, strace, etc. to work
### Debugging and System Management Use Cases
- Inspecting host processes and the kernel
- Typically need root access
- Need bpftrace, strace on host processes to work
- Ideally even do things like helping get kernel-debuginfo data for the
host kernel
- Managing system services
- `systemctl restart foo.service`
- journalctl
- Managing updates to the host
- rpm-ostree
- dnf/yum (classic systems)
### Specific environments
- Fedora Silverblue
- Silverblue comes with a subset of packages and discourages host software
changes
- Users need a Toolbx container as a working environment
- Future: use Toolbx container by default when a user opens a shell
- Fedora CoreOS
- Similar to Silverblue, but non-graphical and smaller package set
- RHEL CoreOS
- Similar to Fedora CoreOS. Based on RHEL content and the underlying
operating system for OpenShift
- Need to [use default authfile on pull](https://github.com/coreos/toolbox/pull/58/commits/413f83f7240d3c31121b557bfd55e489fad24489)
- Need to ensure compatibility with the rhel7/support-tools container
- Currently not a Toolbx image, opportunity for collaboration
- Alignment with `oc debug node/` (OpenShift)
- `oc debug node` opens a shell on a kubernetes node
- Value in having a consistent environment for both Toolbx's debugging
mode and `oc debug node`

378
NEWS
View File

@ -1,353 +1,71 @@
Overview of changes in 0.0.99
=============================
0.1.2
=====
* Add a --distro option to 'create', 'enter' and 'run'
* Prevent setting VTE-specific PROMPT_COMMAND without VTE
* Remove the --candidate-registry option from Bash completion and the manual
for 'create'
* Remove the deprecated reset command
* Support RHEL hosts by creating containers based on UBI
* Try to avoid 'latest' tags, when looking at RepoTags
* Update the labels used for filtering toolbox containers images
* Update the range of supported Fedora releases
### Security fixes
* Bumped the minimum github.com/briandowns/spinner version to 1.23.2 for
CVE-2022-29526 or GHSA-p782-xgp4-8hr8, and other bug fixes
* Bumped the minimum github.com/NVIDIA/nvidia-container-toolkit version to
1.17.4 for CVE-2024-0134 or GHSA-7jm9-xpwx-v999, CVE-2024-0135 or
GHSA-9v84-cc9j-pxr6, CVE-2024-0136 or GHSA-vcfp-63cx-4h59, CVE-2024-0137 or
GHSA-frhw-w3wm-6cw4, and CVE-2025-23359 or GHSA-4hmh-pm5p-9j7j
Overview of changes in 0.0.98.1
===============================
### Enhancements
* Pass the USER environment variable to the container
* Make /etc/profile.d/toolbox.sh compatible with Z shell again
* Update the manual to mention that the --image and --release options of
'create' can't be used together
* Added ubuntu-toolbox image definitions for Ubuntu 25.04
* Gave access to the CA certificates from the host operating system — requires
new Toolbx images and 'p11-kit server' on the host. Note that the UBI-based
images for RHEL haven't yet been updated, and this feature is currently
disabled for those containers.
### Bug fixes
Overview of changes in 0.0.98
=============================
* Optimized getting the runtime directory
* Replaced links to the code repository with the website
* Updated fallback release to 42 for non-fedora hosts
* Add nss-mdns to the fedora-toolbox images
* Correctly check validity of container name
* Don't leak all the os-release fields into the shell
* Don't rely on XDG_RUNTIME_DIR when running as root
* Give access to Avahi to resolve the .local mDNS domain
* Make coredumpctl(1) 'dump' and 'debug' work inside toolbox containers
* Make options --image and --release for 'create' mutually exclusive
* Notify the terminal about the real UID of 'toolbox enter'
* Remove periods at the end of flag descriptions
* Set XDG_RUNTIME_DIR when creating the toolbox container
* Unbreak 'enter' on hosts without a /etc/localtime
* Unbreak the system tests on Fedora 33
* Use the host's user namespace when running as root
### Dependencies
* Added a new weak dependency on 'p11-kit server'
* Bumped the minimum github.com/NVIDIA/go-nvlib version to 0.7.1
* Bumped the minimum github.com/spf13/viper version to 1.20.1 to reduce the
number of indirect dependencies
* Bumped the minimum github.com/stretchr/testify version to 1.10.0
Overview of changes in 0.0.97
=============================
### Tests
* Allow X11 clients to run as root
* Color the output only when displaying on a terminal
* Don't rely on user D-Bus to track time zone configuration
* Enable running minikube on Silverblue
* Expose the host's /boot inside the container at /run/host
* Fix missing terminfo warning for Ubuntu containers
* Make locate(1) work inside toolbox containers
* Make pseudo-terminal devices be owned by the 'tty' group
* Rework test to check if a toolbox container started successfully
* Run a login shell when falling back to Bash during 'enter'
* Added runtime environment tests for the Kerberos and RPM configuration
* Added unit tests for utils.PathExists()
* Enabled the commands and options tests for 'list' on Arch and Ubuntu 22.04
* Enabled the system tests for 'create' and networking on Arch Linux
* Isolated the storage directory from the host's XDG_CACHE_HOME or HOME —
bumped the minimum Linux kernel version to 6.6
* Made the the commands and options tests for 'create' stricter
* Optimized the runtime environment tests by avoiding a lot of disk I/O
* Restored the generation and installation of the Bash completions on the CI
(regression from Fedora 41)
Overview of changes in 0.0.96
=============================
0.1.1
=====
* Don't break GNU Readline's ctrl-p shortcut
* Enable system tests on Fedora 33
* Fix containers with missing /media possibly due to a failed RPM transaction
* Give access to the udev database
* Unbreak X11 applications with GNOME 3.38
* Update default release to 31 for non-Fedora hosts
### Security fixes
* Bumped the minimum github.com/NVIDIA/nvidia-container-toolkit version to
1.16.2 for CVE-2024-0132 or GHSA-mjjw-553x-87pq, and CVE-2024-0133 or
GHSA-f748-7hpg-88ch
Overview of changes in 0.0.95
=============================
### Bug fixes
* Try to handle configuration files that're absolute symlinks when the entry
point sets up the container
* Unbreak 'enter' on Fedora CoreOS
* Unbreak 'sudo' inside toolbox containers with Podman 2.0.5
* Warn if $TERM has no terminfo entry in the container
Overview of changes in 0.0.94
=============================
* Add contribution guidelines
* Add fedora-toolbox image definition for Fedora 34
* Add more information to errors from creating symbolic links when setting up
the toolbox container in the entry point
* Ensure binaries built on Fedora 33 run on Fedoras 32 & 31
* Install the tests
* Make it more obvious when falling back to /bin/bash
* Document that sudo(8) should work without a password
* Mount a tmpfs at /tmp to match the host
* Update issue templates
Overview of changes in 0.0.93
=============================
* Ensure reproducible builds by using the -trimpath build flag
* Fix the test suite to work with the Go implementation
* Make listing of containers and images more robust against changes in the JSON
returned by Podman
* List out dependencies and installation instructions
* Re-enable highlighting of running containers
* Show the spinner only when connected to a terminal
* Speed things up by caching the Podman version at runtime
* Update hint after creating a container to use the new syntax
* Use the correct verb format for string
Overview of changes in 0.0.92
=============================
* Embed the version from Meson into the binary
* Make it build on aarch64
Overview of changes in 0.0.91
=============================
* Add gvfs-client to the fedora-toolbox images
* Adjust for changes in JSON output from 'podman ps' and 'podman images' in
Podman 2.0
* Lower the Go build requirements to make it easier to build on Fedora
* Show an error if $PWD is missing inside the container
Overview of changes in 0.0.90
=============================
* Rewrite Toolbox in Go
* Remove support for toolbox containers created by Toolbox 0.0.9 and older
* Add option --version to show current Toolbox version
* Add options --log-level and --log-podman as possible future replacements for
--verbose and --very-verbose
* Clean up the spinner when aborted by SIGINT (or ctrl+c) and such
* Fix duplication in the output of the list command
* Mark the reset command as deprecated (replaced by 'podman system reset')
* Support specifying the name of a toolbox container as an argument to the
create and enter commands, in addition to the --container option
Overview of changes in 0.0.18
=============================
* Check /usr/share/profile.d when bind mounting toolbox.sh
* Mount /media only if it is available
* Set up /media and /mnt to match the host
* Unbreak 'enter' when SELinux is disabled
Overview of changes in 0.0.17
=============================
* Add a --very-verbose or -vv option
* Deprecate all toolbox containers that don't use a reflexive entry point
* Ensure that 'run' has at least one argument for the command
* Give access to the host's systemd journal
* Wipe out the container's /sys/fs/selinux to not advertise SELinux
Overview of changes in 0.0.16
=============================
* Add a reset command
* Document requirements for distro support
* Don't use a toolbox container until after it has been configured
* Drop the coloured heading from 'list'
* Miscellaneous fixes to Bash completion
* Remove the hidden --sudo option and the /etc/sudoers.d snippet
* Try to migrate to a supported OCI runtime if 'podman start' suggests so
* Unbreak 'run' if container lacks files that are redirected to the host
Overview of changes in 0.0.15
=============================
* Be forgiving of a missing /etc/profile.d/toolbox.sh in 'run'
* Don't sanity check /etc/subgid and /etc/subuid when running as root
* Install only flatpak-spawn, not the rest of flatpak-xdg-utils, in the images
* Let the terminal know the active container only on some Fedora variants
* Rely on 'podman system migrate' always being present
* Simplify code by dropping compatibility with 'podman create' < 1.4.0
* Switch to using /usr/lib/os-release instead of /etc/os-release
* Unbreak 'create' on Silverblue
* Update default release to 30 when running on non-fedora hosts
Overview of changes in 0.0.14
=============================
* Adjust the grep match pattern to be more specific
* Don't exit with a non-zero code from 'toolbox list -i'
* Expose a few more host locations inside the container under /run/host
* Give access to the system Flatpak directory
* Give access to the system libvirt instance
* Mount /run/media only if it is available
* Preserve the host's ulimits when creating toolbox containers
* Work around 'podman exec' resetting the terminal size to 80x24
Overview of changes in 0.0.13
=============================
* Drop PackageKit-command-not-found from the images
* Improve the help or usage output
* Simplify code by taking advantage of 'podman create --userns=keep-id'
* Simplify code by taking advantage of 'podman exec --workdir ...'
* Tighten the Silverblue check for the welcome message
Overview of changes in 0.0.12
=============================
* Create /run/.toolboxenv inside the toolbox container's entry point too
* Don't use 'podman cp' to copy toolbox.sh to old containers
* Drop the "immutable" term
* Unbreak /etc/localtime & /etc/timezone if /run/host/monitor is absent
Overview of changes in 0.0.11
=============================
* Allow Qt applications to work without QT_X11_NO_MITSHM
* Check if /etc/subgid and /etc/subuid have entries for the user
* Give access to the entire /dev from the host operating system
* Keep /etc/host.conf, /etc/localtime and /etc/timezone synchronized with the
host
* Notify the terminal about the current toolbox container in use
* Prevent Podman from complaining about 'podman cp --pause=true ...'
* Unbreak rendering & wrapping of commands typed at an interactive prompt
* Unbreak setting up /home as a symbolic link
Overview of changes in 0.0.10
=============================
* Add a run command
* Create /run/.toolboxenv in 'toolbox enter' for identification
* Drop the Buildah dependency and the user-specific customized image
* Keep /etc/hosts and /etc/resolv.conf synchronized with the host
* Migrate existing containers when Podman is updated
* Retain the PS1 across su(1) and sudo(8)
* Set the Kerberos credential cache type only if Kerberos is available
* Support column(1) from bsdmainutils
* Support 'sudo' as default sudo(8) group
* Use a magenta hexagon instead of 🔹 in the PS1
Overview of changes in 0.0.9
============================
* Add Bash completion
* Allow connecting to Wayland displays other than "wayland-0"
* Ask for confirmation before downloading the base image
* Improve the onboarding experience
* Make it available inside the toolbox container
* Make 'toolbox enter' create or fall back to a container when possible
* Set TOOLBOX_CONTAINER in the environment to identify as a toolbox
* Set default release to 29 when running on non-fedora hosts
* Show welcome texts on interactive shells
Overview of changes in 0.0.8
============================
* Add label for tagging, not tied to the fedora-toolbox name
* Add short variants for various options in 'create' and 'enter'
* Ensure that names of toolbox containers don't have a colon
* Enable Travis
* Fix miscellaneous issues pointed out by https://www.shellcheck.net/
* Give access to Kerberos if KCM credential caches are being used
* Improve the onboarding experience
* Reduce the sizes of the images by removing temporary files created by DNF
* Use a lighter entry point than /bin/sh
Overview of changes in 0.0.7
============================
* Add fedora-toolbox image definition for Fedora 31
* Add flatpak-xdg-utils to Fedoras 29 and 30
* Add manuals
* Add rm and rmi commands
* Be more informative when creating the working container
* Clarify the error message if the toolbox container is not found
* Don't create volumes in the image for bind mounts from the host
* Fix miscellaneous issues pointed out by https://www.shellcheck.net/
* Give access to /dev/bus for control transfers from USB devices
* Give access to removable devices and other temporary mounts
* Lots of Bash-isms removed for POSIX correctness
* Make the --image flag override the base toolbox image, as documented
* Make the spinner more efficient
* Restore documentation removed from the base Fedora images
Overview of changes in 0.0.6
============================
* Add a list command
* Drop the "fedora" prefix and rename the project as just "toolbox"
* Fix typos pointed out by https://www.shellcheck.net/
* Lots of Bash-isms removed for POSIX correctness
* Make --container and --image command-specific options
* Make it work inside the toolbox container itself
* Shorten the prefix for debug and error messages
* Use the host's PID namespace for the toolbox container
* Use the standard error output for error messages
Overview of changes in 0.0.5
============================
* Give access to mounts under $HOME, and make autofs work
* Show a spinner when creating the toolbox
Overview of changes in 0.0.4
============================
* Avoid spooky root-like behaviour for non-root interactive shells
* Give access to the FUSE kernel module
* Improve the readability of the debug output
* Set up $HOME and /home to match the host
* Try to enter the same directory inside the toolbox
Overview of changes in 0.0.3
============================
* Clean up the Buildah working containers on error
* Unbreak creating the toolbox if the toolbox image already exists
Overview of changes in 0.0.2
============================
* Allow an 'F' or 'f' prefix when specifying the release
* Avoid a Bash-ism (ie. ==) and stick to POSIX (ie. =)
* Fallback to /bin/bash if $SHELL doesn't exist in the toolbox container
* Give access to the system D-Bus instance
* Make shm_open work
Overview of changes in 0.0.1
============================
* First preview release
* Unbroke 'enter' if the NVIDIA Persistence Daemon is used (regression in
0.0.99.6)
* Unbroke 'enter' if the proprietary NVIDIA driver is installed, but not used
(regression in 0.0.99.6)
----
Copyright © 2018 2020 Red Hat, Inc.
Copyright © 2024 Red Hat, Inc.
All rights reserved.
Copying and distribution of this file, with or without modification,

594
NEWS.old Normal file
View File

@ -0,0 +1,594 @@
Overview of changes in 0.1.0
============================
* Add ubuntu-toolbox image definitions for Ubuntu 24.10
* Optimize the CI on stable Fedora nodes
* Stop updating the ubuntu-toolbox images for Ubuntu 16.04 and 18.04
* Stop using slirp4netns(1) in the system tests
* Unbreak the downstream Fedora CI
* Unbreak the ubuntu-toolbox image build for Ubuntu 24.04
* Update fallback release to 40 for non-fedora hosts
Overview of changes in 0.0.99.6
===============================
* Add all the iconv converter modules for glibc to the fedora-toolbox images
* Add an extra space after the ⬢ in the PS1
* Add cracklib-dicts to the fedora-toolbox images
* Add logos to the Arch Linux and Fedora badges, and a badge for the Ubuntu
package
* Add manual pages and pacman progress bars to the arch-toolbox image
* Add toolbox image definitions for RHELs 8.8, 8.9, 9.2 and 9.3
* Add translations for gawk to the fedora-toolbox images
* Add ubuntu-toolbox image definitions for Ubuntu 24.04
* Avoid running out of storage space when running the system tests on the CI
* Bump the minimum github.com/briandowns/spinner version to 1.18.0
* Depend on github.com/go-logfmt/logfmt version 0.5.0
* Depend on github.com/NVIDIA/go-nvlib version 0.6.1
* Depend on github.com/NVIDIA/nvidia-container-toolkit version 1.16.1
* Don't unmarshal the 'podman ps' JSON twice
* Don't use use auto dependencies for shell completion scripts
* Drop one "o" and rename the project as "Toolbx"
* Enable more tests on Ubuntu 22.04 by setting the SHELL environment variable
* Enable the proprietary NVIDIA driver
* Exclude the meson.build files when installing the system tests
* Fix pacman cache removal in the arch-toolbox image
* Let 'create' use an image without a name
* Let the terminal know the active container on all host operating systems,
and not just Fedora Silverblue and Workstation
* Limit the scope of temporary files used by the system tests
* Optimize 'enter' and 'run' for both an already running container and a
container getting initialized
* Optimize the CI on Fedora nodes
* Optimize the resource limits tests
* Preserve the Konsole and xterm versions
* Require --assumeyes to pull an image when not connected to a terminal
* Retain errors from toolbox(1) without --verbose when forwarding to host
* Retain exit codes from toolbox(1) when forwarding to host
* Show the entry point's debug logs & errors in 'enter' and 'run'
* Support 64-bit LoongArch
* Synchronize the documentation with the website
* Unbreak Podman's downstream Fedora CI
* Use Buildah and Podman to build and test the arch-toolbox and ubuntu-toolbox
images
* Use the same linker flags as NVIDIA Container Toolkit, and '-z now' is
unsupported
* Work around bug in pasta(1) networks in the system tests
Overview of changes in 0.0.99.5
===============================
* Add psmisc to the fedora-toolbox images
* Add several new system and unit tests, and make the existing ones stricter
* Add workaround to support configuring the user's password on some Active
Directory set-ups
* Be aware of security hardened mount points marked with 'nosuid,nodev,noexec'
* Bump the minimum Bats version to 1.7.0 to simplify running a subset of the
system tests and fix various warnings
* Bump the minimum Go requirement to 1.20
* Bump the minimum github.com/docker/go-units version to 0.5.0
* Bump the minimum golang.org/x/sys version to 0.1.0 for CVE-2022-29526 or
GHSA-p782-xgp4-8hr8
* Bump the minimum golang.org/x/text version to 0.3.8 for CVE-2022-32149 or
GHSA-69ch-w2m2-3vjp
* Bump the minimum gopkg.in/yaml.v3 version to 3.0.0 for CVE-2022-28948 or
GHSA-hp87-p4gw-j4gq
* Deprecate the --monitor-host option of 'init-container'
* Don't leak the NAME and VERSION environment variables into containers made
from the fedora-toolbox images
* Drop golang.org/x/term as a dependency
* Ensure that Toolbx containers start even if there aren't sufficient resources
for inotify(7)
* Ensure that the fedora-toolbox images retain documentation and translations
* Ensure that toolbox(1) can be built without using podman(1) and validating
subordinate IDs
* Fix DNS queries in Toolbx containers made from images with systemd-resolved,
when running on hosts that don't use it
* Handle space-separated input when asking for confirmation
* Let the terminal know the active container also on Fedora Linux Asahi Remix
* Offer built-in support for Arch Linux
* Offer built-in support for Ubuntu
* Preserve the host's environment variables for Bash's history facility inside
Toolbx containers
* Rely on podman >= 1.6.4 always being present
* Report the size of the image that will be downloaded from a registry
* Show welcome message on Fedora Sericea
* Support 64-bit RISC-V
* Update fallback release to 38 for non-fedora hosts
* Unbreak the line count checks with Bats >= 1.10.0
* Unbreak the manual page checks with GNU roff >= 1.23
* Various updates to the documentation and manuals
Overview of changes in 0.0.99.4
===============================
* Add an --authfile option to 'create'
* Add a --preserve-fds option to 'run'
* Add a test that runs codespell
* Add fedora-toolbox image definition for Fedoras 37, 38 and 39
* Add several new system tests and make the existing ones stricter
* Avoid unexpected DNF behaviour with reinstalling or swapping RPMs when
building the fedora-toolbox images
* Be more strict when looking for a C compiler for building
* Call 'systemd-tmpfiles --create' when installing
* Check if subordinate ID ranges are present for also the UID, and not just
the username
* Document the toolbox.conf configuration file
* Don't create a nested pseudo-terminal device during 'run' if the standard
input and output streams are not connected to a terminal
* Don't leak ID and VARIANT_ID into the shell
* Don't unmarshal the 'podman images' JSON twice
* Enable OpenGL and Vulkan for hardware with free drivers on the
fedora-toolbox images
* Enable running non-nested display servers from a virtual terminal
* Enforce all the default 'go vet' checks on all Go sources
* Enforce gofmt on all Go sources
* Ensure that the 'distro' option is valid, instead of silently falling back
to Fedora
* Ensure that 'run' has the same container environment as 'enter'
* Ensure that the fedora-toolbox images has all the locales known to glibc,
and not just C, POSIX and C.UTF-8
* Exit 'run' with exit code of invoked command
* Fix the titles of the manuals
* Give precedence to /etc/os-release over /usr/lib/os-release in
/etc/profile.d/toolbox.sh
* Hide the Fedora-specific welcome banner on non-Fedora containers
* Improve the error messages if the 'distro' and 'release' options are invalid
* Improve the error messages for mutually exclusive options
* Improve the default image used for RHEL Toolbx containers to offer an
interactive command line experience similar to that on RHEL Workstation
* Make /etc/profile.d/toolbox.sh compatible with Z shell again
* Make sd_booted(3) work inside Toolbx containers
* Preserve the host's XDG_SESSION_CLASS environment variable inside Toolbx
containers
* Replace github.com/mattn/go-isatty and the deprecated
golang.org/x/crypto/ssh/terminal API with golang.org/x/term
* Replace jwhois with whois in the fedora-toolbox images for Fedora >= 37
* Replace the hand-written shell completion for Bash with ones generated by
Cobra that cover fish and Z shell too
* Restore more documentation removed from the base Fedora images
* Run unit tests with -Dmigration_path_for_coreos_toolbox on CentOS Stream 9 as
part of the CI
* Silence warning when running the system tests with Bats >= 1.7.0
* Support RHEL 9 Toolbx containers
* Support subordinate user and group ID ranges on enterprise set-ups
* Unbreak sorting and clearly identify copied images in 'list'
* Update fallback release to 37 for non-fedora hosts
* Update the Go dependencies with 'go get -u'
* Various updates to the documentation and manuals
* Work around Cobra 1.1.2's handling of usage functions
Overview of changes in 0.0.99.3
===============================
* Add bc and iproute to the fedora-toolbox images
* Add fedora-toolbox image definition for Fedoras 35 and 36
* Add support for configuration files
* Add optional migration paths for coreos/toolbox users
* Allow overriding the path to tmpfilesdir
* Avoid RPM failures due to unexpected file owners
* Bump minimum Meson version to 0.58.0
* Ensure that binaries are run against their build-time ABI
* Expose the host's entire / in the container at /run/host
* Fix the PS1 on Z shell
* Fix wrong use of regexp.MatchString
* Give access to PC/SC smart card daemon
* Make locate(1) opt-in by default
* Make the test suite non-destructive
* Mention that private images require 'podman login'
* Remove misleading and redundant CMD from the fedora-toolbox images
* Remove the deprecated com.github.debarshiray.toolbox label from the
fedora-toolbox images, and when creating a new container
* Replace outdated logos with pixels
* Show basic help when man(1) is not available
* Show welcome message on Fedora Kinoite
* Test ImageReferenceCanBeID and ParseRelease
* Unbreak 'enter' if the shell had exited with 127
* Various additions and improvements to the test suite
* Various updates to the documentation and manuals
Overview of changes in 0.0.99.2
===============================
* Add nano-default-editor to the fedora-toolbox images
* Add unit tests for pkg/shell
* Connect Go unit tests to Meson & rename CI job
* Decouple image caching from Zuul for the system tests
* Don't assume that the user's GID is the same as the UID
* Don't require /etc/machine-id in toolbox images
* Drop ShellCheck on Shell Toolbox
* Give access to systemd-resolved's Varlink socket
* Optimize 'enter' and 'run' in the non-fallback case
* Optimize the performance of 'list'
* Properly separate builddir setup & build in the Ansible playbooks
* Rename Dockerfile to Containerfile for the fedora-toolbox images
* Show test execution time for the system tests
* Support listing images without names
* Unbreak 'create' on an unlocked OSTree deployment
* Unbreak 'create' on CoreOS with read-only /boot
* Update default release to 33 for non-Fedora hosts
* Update the GitHub issue templates
* Use a regular file, not a symbolic link, for the README.md in the
fedora-toolbox images
* Fall back to $HOME when using a container if the current working directory
isn't present in it
* Various updates to the Bash completion
* Various updates to the manuals
Overview of changes in 0.0.99.1
===============================
* Add deprecation notices to the POSIX shell implementation
* Add test for the new --distro option
* Drop the FGC namespace from the fedora-toolbox images
* Fix miscellaneous issues pointed out by https://www.shellcheck.net/
* Handle hosts with /etc/localtime as absolute symlink
* Improve README.md
* Improve the Zuul configuration
* Mount /mnt only if it is available
* Refactor the system tests, and use bats-assert and bats-support
* Test that sudo doesn't require a password
* Update the manuals
Overview of changes in 0.0.99
=============================
* Add a --distro option to 'create', 'enter' and 'run'
* Prevent setting VTE-specific PROMPT_COMMAND without VTE
* Remove the --candidate-registry option from Bash completion and the manual
for 'create'
* Remove the deprecated reset command
* Support RHEL hosts by creating containers based on UBI
* Try to avoid 'latest' tags, when looking at RepoTags
* Update the labels used for filtering toolbox containers images
* Update the range of supported Fedora releases
Overview of changes in 0.0.98.1
===============================
* Pass the USER environment variable to the container
* Make /etc/profile.d/toolbox.sh compatible with Z shell again
* Update the manual to mention that the --image and --release options of
'create' can't be used together
Overview of changes in 0.0.98
=============================
* Add nss-mdns to the fedora-toolbox images
* Correctly check validity of container name
* Don't leak all the os-release fields into the shell
* Don't rely on XDG_RUNTIME_DIR when running as root
* Give access to Avahi to resolve the .local mDNS domain
* Make coredumpctl(1) 'dump' and 'debug' work inside toolbox containers
* Make options --image and --release for 'create' mutually exclusive
* Notify the terminal about the real UID of 'toolbox enter'
* Remove periods at the end of flag descriptions
* Set XDG_RUNTIME_DIR when creating the toolbox container
* Unbreak 'enter' on hosts without a /etc/localtime
* Unbreak the system tests on Fedora 33
* Use the host's user namespace when running as root
Overview of changes in 0.0.97
=============================
* Allow X11 clients to run as root
* Color the output only when displaying on a terminal
* Don't rely on user D-Bus to track time zone configuration
* Enable running minikube on Silverblue
* Expose the host's /boot inside the container at /run/host
* Fix missing terminfo warning for Ubuntu containers
* Make locate(1) work inside toolbox containers
* Make pseudo-terminal devices be owned by the 'tty' group
* Rework test to check if a toolbox container started successfully
* Run a login shell when falling back to Bash during 'enter'
Overview of changes in 0.0.96
=============================
* Don't break GNU Readline's ctrl-p shortcut
* Enable system tests on Fedora 33
* Fix containers with missing /media possibly due to a failed RPM transaction
* Give access to the udev database
* Unbreak X11 applications with GNOME 3.38
* Update default release to 31 for non-Fedora hosts
Overview of changes in 0.0.95
=============================
* Try to handle configuration files that're absolute symlinks when the entry
point sets up the container
* Unbreak 'enter' on Fedora CoreOS
* Unbreak 'sudo' inside toolbox containers with Podman 2.0.5
* Warn if $TERM has no terminfo entry in the container
Overview of changes in 0.0.94
=============================
* Add contribution guidelines
* Add fedora-toolbox image definition for Fedora 34
* Add more information to errors from creating symbolic links when setting up
the toolbox container in the entry point
* Ensure binaries built on Fedora 33 run on Fedoras 32 & 31
* Install the tests
* Make it more obvious when falling back to /bin/bash
* Document that sudo(8) should work without a password
* Mount a tmpfs at /tmp to match the host
* Update issue templates
Overview of changes in 0.0.93
=============================
* Ensure reproducible builds by using the -trimpath build flag
* Fix the test suite to work with the Go implementation
* Make listing of containers and images more robust against changes in the JSON
returned by Podman
* List out dependencies and installation instructions
* Re-enable highlighting of running containers
* Show the spinner only when connected to a terminal
* Speed things up by caching the Podman version at runtime
* Update hint after creating a container to use the new syntax
* Use the correct verb format for string
Overview of changes in 0.0.92
=============================
* Embed the version from Meson into the binary
* Make it build on aarch64
Overview of changes in 0.0.91
=============================
* Add gvfs-client to the fedora-toolbox images
* Adjust for changes in JSON output from 'podman ps' and 'podman images' in
Podman 2.0
* Lower the Go build requirements to make it easier to build on Fedora
* Show an error if $PWD is missing inside the container
Overview of changes in 0.0.90
=============================
* Rewrite Toolbox in Go
* Remove support for toolbox containers created by Toolbox 0.0.9 and older
* Add option --version to show current Toolbox version
* Add options --log-level and --log-podman as possible future replacements for
--verbose and --very-verbose
* Clean up the spinner when aborted by SIGINT (or ctrl+c) and such
* Fix duplication in the output of the list command
* Mark the reset command as deprecated (replaced by 'podman system reset')
* Support specifying the name of a toolbox container as an argument to the
create and enter commands, in addition to the --container option
Overview of changes in 0.0.18
=============================
* Check /usr/share/profile.d when bind mounting toolbox.sh
* Mount /media only if it is available
* Set up /media and /mnt to match the host
* Unbreak 'enter' when SELinux is disabled
Overview of changes in 0.0.17
=============================
* Add a --very-verbose or -vv option
* Deprecate all toolbox containers that don't use a reflexive entry point
* Ensure that 'run' has at least one argument for the command
* Give access to the host's systemd journal
* Wipe out the container's /sys/fs/selinux to not advertise SELinux
Overview of changes in 0.0.16
=============================
* Add a reset command
* Document requirements for distro support
* Don't use a toolbox container until after it has been configured
* Drop the coloured heading from 'list'
* Miscellaneous fixes to Bash completion
* Remove the hidden --sudo option and the /etc/sudoers.d snippet
* Try to migrate to a supported OCI runtime if 'podman start' suggests so
* Unbreak 'run' if container lacks files that are redirected to the host
Overview of changes in 0.0.15
=============================
* Be forgiving of a missing /etc/profile.d/toolbox.sh in 'run'
* Don't sanity check /etc/subgid and /etc/subuid when running as root
* Install only flatpak-spawn, not the rest of flatpak-xdg-utils, in the images
* Let the terminal know the active container only on some Fedora variants
* Rely on 'podman system migrate' always being present
* Simplify code by dropping compatibility with 'podman create' < 1.4.0
* Switch to using /usr/lib/os-release instead of /etc/os-release
* Unbreak 'create' on Silverblue
* Update default release to 30 when running on non-fedora hosts
Overview of changes in 0.0.14
=============================
* Adjust the grep match pattern to be more specific
* Don't exit with a non-zero code from 'toolbox list -i'
* Expose a few more host locations inside the container under /run/host
* Give access to the system Flatpak directory
* Give access to the system libvirt instance
* Mount /run/media only if it is available
* Preserve the host's ulimits when creating toolbox containers
* Work around 'podman exec' resetting the terminal size to 80x24
Overview of changes in 0.0.13
=============================
* Drop PackageKit-command-not-found from the images
* Improve the help or usage output
* Simplify code by taking advantage of 'podman create --userns=keep-id'
* Simplify code by taking advantage of 'podman exec --workdir ...'
* Tighten the Silverblue check for the welcome message
Overview of changes in 0.0.12
=============================
* Create /run/.toolboxenv inside the toolbox container's entry point too
* Don't use 'podman cp' to copy toolbox.sh to old containers
* Drop the "immutable" term
* Unbreak /etc/localtime & /etc/timezone if /run/host/monitor is absent
Overview of changes in 0.0.11
=============================
* Allow Qt applications to work without QT_X11_NO_MITSHM
* Check if /etc/subgid and /etc/subuid have entries for the user
* Give access to the entire /dev from the host operating system
* Keep /etc/host.conf, /etc/localtime and /etc/timezone synchronized with the
host
* Notify the terminal about the current toolbox container in use
* Prevent Podman from complaining about 'podman cp --pause=true ...'
* Unbreak rendering & wrapping of commands typed at an interactive prompt
* Unbreak setting up /home as a symbolic link
Overview of changes in 0.0.10
=============================
* Add a run command
* Create /run/.toolboxenv in 'toolbox enter' for identification
* Drop the Buildah dependency and the user-specific customized image
* Keep /etc/hosts and /etc/resolv.conf synchronized with the host
* Migrate existing containers when Podman is updated
* Retain the PS1 across su(1) and sudo(8)
* Set the Kerberos credential cache type only if Kerberos is available
* Support column(1) from bsdmainutils
* Support 'sudo' as default sudo(8) group
* Use a magenta hexagon instead of 🔹 in the PS1
Overview of changes in 0.0.9
============================
* Add Bash completion
* Allow connecting to Wayland displays other than "wayland-0"
* Ask for confirmation before downloading the base image
* Improve the onboarding experience
* Make it available inside the toolbox container
* Make 'toolbox enter' create or fall back to a container when possible
* Set TOOLBOX_CONTAINER in the environment to identify as a toolbox
* Set default release to 29 when running on non-fedora hosts
* Show welcome texts on interactive shells
Overview of changes in 0.0.8
============================
* Add label for tagging, not tied to the fedora-toolbox name
* Add short variants for various options in 'create' and 'enter'
* Ensure that names of toolbox containers don't have a colon
* Enable Travis
* Fix miscellaneous issues pointed out by https://www.shellcheck.net/
* Give access to Kerberos if KCM credential caches are being used
* Improve the onboarding experience
* Reduce the sizes of the images by removing temporary files created by DNF
* Use a lighter entry point than /bin/sh
Overview of changes in 0.0.7
============================
* Add fedora-toolbox image definition for Fedora 31
* Add flatpak-xdg-utils to Fedoras 29 and 30
* Add manuals
* Add rm and rmi commands
* Be more informative when creating the working container
* Clarify the error message if the toolbox container is not found
* Don't create volumes in the image for bind mounts from the host
* Fix miscellaneous issues pointed out by https://www.shellcheck.net/
* Give access to /dev/bus for control transfers from USB devices
* Give access to removable devices and other temporary mounts
* Lots of Bash-isms removed for POSIX correctness
* Make the --image flag override the base toolbox image, as documented
* Make the spinner more efficient
* Restore documentation removed from the base Fedora images
Overview of changes in 0.0.6
============================
* Add a list command
* Drop the "fedora" prefix and rename the project as just "toolbox"
* Fix typos pointed out by https://www.shellcheck.net/
* Lots of Bash-isms removed for POSIX correctness
* Make --container and --image command-specific options
* Make it work inside the toolbox container itself
* Shorten the prefix for debug and error messages
* Use the host's PID namespace for the toolbox container
* Use the standard error output for error messages
Overview of changes in 0.0.5
============================
* Give access to mounts under $HOME, and make autofs work
* Show a spinner when creating the toolbox
Overview of changes in 0.0.4
============================
* Avoid spooky root-like behaviour for non-root interactive shells
* Give access to the FUSE kernel module
* Improve the readability of the debug output
* Set up $HOME and /home to match the host
* Try to enter the same directory inside the toolbox
Overview of changes in 0.0.3
============================
* Clean up the Buildah working containers on error
* Unbreak creating the toolbox if the toolbox image already exists
Overview of changes in 0.0.2
============================
* Allow an 'F' or 'f' prefix when specifying the release
* Avoid a Bash-ism (ie. ==) and stick to POSIX (ie. =)
* Fallback to /bin/bash if $SHELL doesn't exist in the toolbox container
* Give access to the system D-Bus instance
* Make shm_open work
Overview of changes in 0.0.1
============================
* First preview release
----
Copyright © 2018 2024 Red Hat, Inc.
All rights reserved.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

233
README.md
View File

@ -1,210 +1,61 @@
<img src="data/logo/toolbox-logo-landscape.svg" alt="Toolbox logo landscape" width="800"/>
![README](data/gfx/README.gif)
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
[![Daily Pipeline](https://img.shields.io/badge/zuul-periodic-informational)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
[Toolbx](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for software development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
[![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/toolbox)](https://www.archlinux.org/packages/community/x86_64/toolbox/)
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide)](https://src.fedoraproject.org/rpms/toolbox/)
[Toolbox](https://github.com/containers/toolbox) is a tool for Linux operating
systems, which allows the use of containerized command line environments. It is
built on top of [Podman](https://podman.io/) and other standard container
technologies from [OCI](https://opencontainers.org/).
The toolbox container is a fully *mutable* container; when you see
`yum install ansible` for example, that's something you can do inside your
toolbox container, without affecting the base operating system.
Toolbx environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
[OSTree](https://ostreedev.github.io/ostree/) based operating systems like
[Fedora CoreOS](https://fedoraproject.org/coreos/) and
[Silverblue](https://fedoraproject.org/silverblue/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers.
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
However, this tool doesn't *require* using an OSTree based system — it
works equally well if you're running e.g. existing Fedora Workstation or
Server, and that's a useful way to incrementally adopt containerization.
Toolbx solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The Toolbx environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that seamlessly integrates with the rest of the
operating system.
create a Toolbx container that offers the interactive command line
environment.
## Usage
Note that Toolbx makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
### Create your toolbox container:
```console
[user@hostname ~]$ toolbox create
Created container: fedora-toolbox-33
Enter with: toolbox enter
[user@hostname ~]$
```
This will create a container called `fedora-toolbox-<version-id>`.
### Enter the toolbox:
```console
[user@hostname ~]$ toolbox enter
⬢[user@toolbox ~]$
```
## Installation & Use
### Remove a toolbox container:
```console
[user@hostname ~]$ toolbox rm fedora-toolbox-33
[user@hostname ~]$
```
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbx and [Linux distro support](https://containertoolbx.org/distros/).
## Dependencies and Installation
Toolbox requires at least Podman 1.4.0 to work, and uses the Meson build
system.
##
The following dependencies are required to build it:
- meson
- go-md2man
- systemd
[![Star History Chart](https://api.star-history.com/svg?repos=containers/toolbox&type=Date)](https://star-history.com/#containers/toolbox&Date)
The following dependencies enable various optional features:
- bash-completion
It can be built and installed as any other typical Meson-based project:
```console
[user@hostname toolbox]$ meson -Dprofile_dir=/etc/profile.d builddir
[user@hostname toolbox]$ ninja -C builddir
[user@hostname toolbox]$ sudo ninja -C builddir install
```
##
Toolbox is written in Go. Consult the
[src/go.mod](https://github.com/containers/toolbox/blob/master/src/go.mod) file
for a full list of all the Go dependencies.
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
[![Daily Pipeline](https://softwarefactory-project.io/zuul/api/tenant/local/badge?project=containers/toolbox&pipeline=periodic)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
By default, Toolbox uses Go modules and all the required Go packages are
automatically downloaded as part of the build. There's no need to worry about
the Go dependencies, unless the build environment doesn't have network access
or any such peculiarities.
## Goals and Use Cases
### High Level Goals
- Provide a CLI convenience interface to run containers (via `podman`) easily
- Support for Developer and Debugging/Management use cases
- Support for multiple distros
- toolbox package in multiple distros
- toolbox containers for multiple distros
### Non-Goals - Anti Use Cases
- Supporting multiple container runtimes. `toolbox` will use `podman` exclusively
- Adding significant features on top of `podman`
- Significant feature requests should be driven into `podman` upstream
- To run containers that aren't tightly integrated with the host
- i.e. extremely sandboxed containers become specific to the user quickly
### Developer Use Cases
- Im a developer hacking on source code and building/testing code
- Most cases: user doesn't need root, rootless containers work fine
- Some cases: user needs root for testing
- Desktop Development:
- developers need things like dbus, display, etc, to be forwarded into the toolbox
- Headless Development:
- toolbox works properly in headless environments (no display, etc)
- Need development tools like gdb, strace, etc to work
### Debugging/System management Use Cases
- Inspecting Host Processes/Kernel
- Typically need root access
- Need bpftrace, strace on host processes to work
- Ideally even do things like helping get kernel-debuginfo data for the host kernel
- Managing system services
- systemctl restart foo.service
- journalctl
- Managing updates to the host
- rpm-ostree
- dnf/yum (classic systems)
### Specific environments
- Fedora Silverblue
- Silverblue comes with a subset of packages and discourages host software changes
- Users need a toolbox container as a working environment
- Future: use toolbox container by default when a user opens a shell
- Fedora CoreOS
- Similar to silverblue, but non-graphical and smaller package set
- RHEL CoreOS
- Similar to Fedora CoreOS. Based on RHEL content and the underlying OS for OpenShift
- Need to [use default authfile on pull](https://github.com/coreos/toolbox/pull/58/commits/413f83f7240d3c31121b557bfd55e489fad24489)
- Need to ensure compatibility with the rhel7/support-tools container
- currently not a toolbox image, opportunity for collaboration
- Alignment with `oc debug node/` (OpenShift)
- `oc debug node` opens a shell on a kubernetes node
- Value in having a consistent environment for both `toolbox` in debugging mode and `oc debug node`
## Distro support
By default, Toolbox creates the container using an
[OCI](https://www.opencontainers.org/) image called
`<ID>-toolbox:<VERSION-ID>`, where `<ID>` and `<VERSION-ID>` are taken from the
host's `/usr/lib/os-release`. For example, the default image on a Fedora 33
host would be `fedora-toolbox:33`.
This default can be overridden by the `--image` option in `toolbox create`,
but operating system distributors should provide an adequately configured
default image to ensure a smooth user experience.
## Image requirements
Toolbox customizes newly created containers in a certain way. This requires
certain tools and paths to be present and have certain characteristics inside
the OCI image.
Tools:
* `getent(1)`
* `id(1)`
* `ln(1)`
* `mkdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `passwd(1)`
* `readlink(1)`
* `rm(1)`
* `rmdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `sleep(1)`
* `test(1)`
* `touch(1)`
* `unlink(1)`
* `useradd(8)`
* `usermod(8)`
Paths:
* `/etc/host.conf`: optional, if present not a bind mount
* `/etc/hosts`: optional, if present not a bind mount
* `/etc/krb5.conf.d`: directory, not a bind mount
* `/etc/localtime`: optional, if present not a bind mount
* `/etc/resolv.conf`: optional, if present not a bind mount
* `/etc/timezone`: optional, if present not a bind mount
Toolbox enables `sudo(8)` access inside containers. The following is necessary
for that to work:
* The image should have `sudo(8)` enabled for users belonging to either the
`sudo` or `wheel` groups, and the group itself should exist. File an
[issue](https://github.com/containers/toolbox/issues/new) if you really need
support for a different group. However, it's preferable to keep this list as
short as possible.
* The image should allow empty passwords for `sudo(8)`. This can be achieved
by either adding the `nullok` option to the `PAM(8)` configuration, or by
add the `NOPASSWD` tag to the `sudoers(5)` configuration.
Since Toolbox only works with OCI images that fulfill certain requirements,
it will refuse images that aren't tagged with
`com.github.containers.toolbox="true"` and
`com.github.debarshiray.toolbox="true"` labels. These labels are meant to be
used by the maintainer of the image to indicate that they have read this
document and tested that the image works with Toolbox. You can use the
following snippet in a Dockerfile for this:
```Dockerfile
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true"
```
[![Arch Linux package](https://img.shields.io/archlinux/v/extra/x86_64/toolbox?logo=archlinux)](https://www.archlinux.org/packages/extra/x86_64/toolbox/)
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide?logo=fedora)](https://src.fedoraproject.org/rpms/toolbox/)
[![Ubuntu package](https://img.shields.io/badge/ubuntu-0.0.99.3%2Bgit20230118%2B446d7bfdef6a-orange?logo=ubuntu)](https://packages.ubuntu.com/noble/podman-toolbox)

View File

@ -1,5 +1,5 @@
## Security and Disclosure Information Policy for the Toolbox Project
## Security and Disclosure Information Policy for the Toolbx Project
The Toolbox Project follows the
[Security and Disclosure Information Policy](https://github.com/containers/common/blob/master/SECURITY.md)
The Toolbx Project follows the
[Security and Disclosure Information Policy](https://github.com/containers/common/blob/main/SECURITY.md)
for the Containers Projects.

View File

@ -1,85 +0,0 @@
# Check for bash
[ -z "$BASH_VERSION" ] && return
__toolbox_containers() {
podman ps --all --format '{{.Names}}'
}
__toolbox_distros() {
echo "fedora"
echo "rhel"
}
__toolbox_images() {
podman images --format '{{.Repository}}:{{.Tag}}'
}
__toolbox() {
local MIN_VERSION=32
local RAWHIDE_VERSION=34
local commands="create enter help init-container list rm rmi run"
declare -A options
local options=([create]="--container --distro --image --release" \
[enter]="--container --distro --release" \
[help]="$commands" \
[init-container]="--home --home-link --monitor-host --shell --uid --user" \
[list]="--containers --images" \
[rm]="--all --force" \
[rmi]="--all --force" \
[run]="--container --distro --release")
_init_completion -s || return
if [ "${COMP_CWORD}" -eq 1 ]; then
mapfile -t COMPREPLY < <(compgen -W "--assumeyes --help --verbose --very-verbose $commands" -- "$2")
return 0
fi
case "$prev" in
--verbose | -v | --very-verbose | -vv)
mapfile -t COMPREPLY < <(compgen -W "$commands" -- "$2")
return 0
;;
--container | -c)
mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_containers)" -- "$2")
return 0
;;
--distro | -d)
mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_distros)" -- "$2")
return 0
;;
--image | -i)
mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_images)" -- "$2")
return 0
;;
--release | -r)
mapfile -t COMPREPLY < <(compgen -W "$(seq $MIN_VERSION $RAWHIDE_VERSION)" -- "$2")
return 0
;;
esac
local command
if [ "${COMP_WORDS[1]}" = --verbose ] || [ "${COMP_WORDS[1]}" = --very-verbose ]; then
command=${COMP_WORDS[2]}
else
command=${COMP_WORDS[1]}
fi
local extra_comps
case "$command" in
rm)
extra_comps="$(__toolbox_containers)"
;;&
rmi)
extra_comps="$(__toolbox_images)"
;;&
*)
mapfile -t COMPREPLY < <(compgen -W "${options[$command]} $extra_comps" -- "$2")
return 0;
;;
esac
}
complete -F __toolbox toolbox

4
data/config/meson.build Normal file
View File

@ -0,0 +1,4 @@
install_data(
'toolbox.conf',
install_dir: get_option('sysconfdir') / 'containers',
)

17
data/config/toolbox.conf Normal file
View File

@ -0,0 +1,17 @@
[general]
# Create a toolbox container for a different operating system distro than the
# host. Cannot be used with 'image'.
## distro = "fedora"
# Create a toolbox container for a different operating system release than the
# host. Cannot be used with 'image'.
## release = "33"
# Change the name of the image used to create the toolbox container. This is
# useful for creating containers from custom-built images. Cannot be used with
# 'distro' or 'release'.
#
# If the name does not contain a registry, the local image storage will be
# consulted, and if it's not present there then it will be pulled from a
# suitable remote registry.
## image = "registry.fedoraproject.org/fedora-toolbox:34"

BIN
data/gfx/CONTRIBUTING.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
data/gfx/README.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
data/gfx/powerup.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 603 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 603 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 603 KiB

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 601 KiB

View File

@ -1 +1,2 @@
subdir('config')
subdir('tmpfiles.d')

View File

@ -1 +1,2 @@
d /run/media 0755 root root
d /run/media 0755 root root - -
L /run/host - - - - ../

View File

@ -4,28 +4,36 @@ go_md2man_command = [
'-out', '@OUTPUT@',
]
manuals = [
'toolbox.1',
'toolbox-create.1',
'toolbox-enter.1',
'toolbox-init-container.1',
'toolbox-help.1',
'toolbox-list.1',
'toolbox-rm.1',
'toolbox-rmi.1',
'toolbox-run.1',
]
manuals = {
'1': [
'toolbox',
'toolbox-create',
'toolbox-enter',
'toolbox-init-container',
'toolbox-help',
'toolbox-list',
'toolbox-rm',
'toolbox-rmi',
'toolbox-run',
],
'5': [
'toolbox.conf',
]
}
foreach manual: manuals
input = manual + '.md'
output = manual
foreach section, pages: manuals
foreach page: pages
output = page + '.' + section
input = output + '.md'
sectiondir = 'man' + section
custom_target(
output,
command: go_md2man_command,
input: input,
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'),
output: output,
)
custom_target(
output,
command: go_md2man_command,
input: input,
install: true,
install_dir: get_option('mandir') / sectiondir,
output: output,
)
endforeach
endforeach

View File

@ -1,77 +1,141 @@
% toolbox-create(1)
% toolbox-create 1
## NAME
toolbox\-create - Create a new toolbox container
toolbox\-create - Create a new Toolbx container
## SYNOPSIS
**toolbox create** [*--container NAME* | *-c NAME*]
**toolbox create** [*--authfile FILE*]
[*--distro DISTRO* | *-d DISTRO*]
[*--image NAME* | *-i NAME*]
[*--release RELEASE* | *-r RELEASE*]
[*CONTAINER*]
## DESCRIPTION
Creates a new toolbox container. You can then use the `toolbox enter` command
Creates a new Toolbx container. You can then use the `toolbox enter` command
to interact with the container at any point.
A toolbox container is an OCI container created from an OCI image. On Fedora
the base image is known as `fedora-toolbox`. If the image is not present
locally, then it is pulled from a well-known registry like
`registry.fedoraproject.org`. The base image is locally customized for the
current user to create a second image, from which the container is finally
created.
A Toolbx container is an OCI container created from an OCI image. On Fedora,
the default image is known as `fedora-toolbox:N`, where N is the release of
the host. If the image is not present locally, then it is pulled from a
well-known registry like `registry.fedoraproject.org`. Other images may be
used on other host operating systems. If the host is not recognized, then the
Fedora image will be used.
Toolbox containers and images are tagged with the version of the OS that
corresponds to the content inside them. The user-specific images and the
toolbox containers are prefixed with the name of the base image and suffixed
with the current user name.
The container is created with `podman create`, and its entry point is set to
`toolbox init-container`.
By default, a Toolbx container is named after its corresponding image. If the
image had a tag, then the tag is included in the name of the container, but
it's separated by a hyphen, not a colon. A different name can be assigned by
using the CONTAINER argument.
### Container Configuration
A Toolbx container seamlessly integrates with the rest of the operating
system by providing access to the user's home directory, the Wayland and X11
sockets, networking (including Avahi), removable devices (like USB sticks),
systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev database, etc..
The user ID and account details from the host is propagated into the Toolbx
container, SELinux label separation is disabled, and the host file system can
be accessed by the container at /run/host. The container has access to the
host's Kerberos credentials cache if it's configured to use KCM caches.
A Toolbx container can be identified by the `com.github.containers.toolbox`
label or the `/run/.toolboxenv` file.
The entry point of a Toolbx container is the `toolbox init-container` command
which plays a role in setting up the container, along with the options passed
to `podman create`.
### Entry Point
A key feature of Toolbx containers is their entry point, the `toolbox
init-container` command.
OCI containers are inherently immutable. Configuration options passed through
`podman create` are baked into the definition of the OCI container, and can't
be changed later. This means that changes and improvements made in newer
versions of Toolbx can't be applied to pre-existing Toolbx containers
created by older versions of Toolbx. This is avoided by using the entry point
to configure the container at runtime.
The entry point of a Toolbx container customizes the container to fit the
current user by ensuring that it has a user that matches the one on the host,
and grants it `sudo` and `root` access.
Crucial configuration files, such as `/etc/host.conf`, `/etc/hosts`,
`/etc/localtime`, `/etc/resolv.conf` and `/etc/timezone`, inside the container
are kept synchronized with the host. The entry point also bind mounts various
subsets of the host's file system hierarchy to their corresponding locations
inside the container to provide seamless integration with the host. This
includes `/run/libvirt`, `/run/systemd/journal`, `/run/udev/data`,
`/var/lib/libvirt`, `/var/lib/systemd/coredump`, `/var/log/journal` and others.
On some host operating systems, important paths like `/home`, `/media` or
`/mnt` are symbolic links to other locations. The entry point ensures that
paths inside the container match those on the host, to avoid needless
confusion.
## OPTIONS ##
The following options are understood:
**--authfile** FILE
**--container** NAME, **-c** NAME
Path to a FILE with credentials for authenticating to the registry for private
images. The FILE is usually set using `podman login`, and will be used by
`podman pull` to get the image.
Assign a different NAME to the toolbox container. This is useful for creating
multiple toolbox containers from the same base image, or for entirely
customized containers from custom-built base images.
The default location for FILE is `$XDG_RUNTIME_DIR/containers/auth.json` and
its format is specified in `containers-auth.json(5)`.
**--distro** DISTRO, **-d** DISTRO
Create a toolbox container for a different operating system DISTRO than the
host. Cannot be used with `--image`.
Create a Toolbx container for a different operating system DISTRO than the
host. Cannot be used with `--image`. Has to be coupled with `--release` unless
the selected DISTRO matches the host.
**--image** NAME, **-i** NAME
Change the NAME of the base image used to create the toolbox container. This
is useful for creating containers from custom-built base images. Cannot be used
used with `--release`.
Change the NAME of the image used to create the Toolbx container. This is
useful for creating containers from custom-built images. Cannot be used with
`--distro` and `--release`.
If NAME does not contain a registry, the local image storage will be
consulted, and if it's not present there then it will be pulled from a suitable
remote registry.
**--release** RELEASE, **-r** RELEASE
Create a toolbox container for a different operating system RELEASE than the
Create a Toolbx container for a different operating system RELEASE than the
host. Cannot be used with `--image`.
## EXAMPLES
### Create a toolbox container using the default image matching the host OS
### Create the default Toolbx container matching the host OS
```
$ toolbox create
```
### Create a toolbox container using the default image for Fedora 30
### Create the default Toolbx container for Fedora 36
```
$ toolbox create --distro fedora --release f30
$ toolbox create --distro fedora --release f36
```
### Create a custom toolbox container from a custom image
### Create a custom Toolbx container from a custom image
```
$ toolbox create --container foo --image bar
$ toolbox create --image bar foo
```
### Create a custom Toolbx container from a custom image that's private
```
$ toolbox create --authfile ~/auth.json --image registry.example.com/bar
```
## SEE ALSO
`buildah(1)`, `podman(1)`
`toolbox(1)`, `toolbox-init-container(1)`, `podman(1)`, `podman-create(1)`, `podman-login(1)`, `podman-pull(1)`, `containers-auth.json(5)`

View File

@ -1,68 +1,66 @@
% toolbox-enter(1)
% toolbox-enter 1
## NAME
toolbox\-enter - Enter a toolbox container for interactive use
toolbox\-enter - Enter a Toolbx container for interactive use
## SYNOPSIS
**toolbox enter** [*--container NAME* | *-c NAME*]
[*--distro DISTRO* | *-d DISTRO*]
**toolbox enter** [*--distro DISTRO* | *-d DISTRO*]
[*--release RELEASE* | *-r RELEASE*]
[*CONTAINER*]
## DESCRIPTION
Spawns an interactive shell inside a toolbox container. The container should
have been created using the `toolbox create` command. If there aren't any
containers, `toolbox enter` will offer to create one for you. When invoked with
the default parameters, and if there's only one container available, it will
fall back to it, even if it doesn't match the default name.
Spawns an interactive shell inside a Toolbx container that was created using
the `toolbox create` command. It tries to spawn the user's default shell, but
if it's not available inside the container then it falls back to `/bin/bash`.
A toolbox container is an OCI container. Therefore, `toolbox enter` is
When invoked without any options, `toolbox enter` will try to enter the default
Toolbx container for the host, or if there's only one container available then
it will use it. On Fedora, the default container is known as
`fedora-toolbox-N`, where N is the release of the host. If there aren't any
containers, `toolbox enter` will offer to create the default one for you.
A specific container can be selected using the CONTAINER argument.
A Toolbx container is an OCI container. Therefore, `toolbox enter` is
analogous to a `podman start` followed by a `podman exec`.
By default, the toolbox containers are tagged with the version of the OS that
corresponds to the content inside them. Their names are prefixed with the name
of the base image and suffixed with the current user name.
## OPTIONS ##
The following options are understood:
**--container** NAME, **-c** NAME
Enter a toolbox container with the given NAME. This is useful when there are
multiple toolbox containers created from the same base image, or entirely
customized containers created from custom-built base images.
**--distro** DISTRO, **-d** DISTRO
Enter a toolbox container for a different operating system DISTRO than the
Enter a Toolbx container for a different operating system DISTRO than the
host. Has to be coupled with `--release` unless the selected DISTRO matches the
host.
**--release** RELEASE, **-r** RELEASE
Enter a toolbox container for a different operating system RELEASE than the
Enter a Toolbx container for a different operating system RELEASE than the
host.
## EXAMPLES
### Enter a toolbox container using the default image matching the host OS
### Enter the default Toolbx container matching the host OS
```
$ toolbox enter
```
### Enter a toolbox container using the default image for Fedora 30
### Enter the default Toolbx container for Fedora 36
```
$ toolbox enter --distro fedora --release f30
$ toolbox enter --distro fedora --release f36
```
### Enter a custom toolbox container using a custom image
### Enter a Toolbx container with a custom name
```
$ toolbox enter --container foo
$ toolbox enter foo
```
## SEE ALSO
`buildah(1)`, `podman(1)`, `podman-exec(1)`, `podman-start(1)`
`toolbox(1)`, `toolbox-run(1)`, `podman(1)`, `podman-exec(1)`,
`podman-start(1)`

View File

@ -1,7 +1,7 @@
% toolbox-help(1)
% toolbox-help 1
## NAME
toolbox\-help - Display help information about Toolbox
toolbox\-help - Display help information about Toolbx
## SYNOPSIS
**toolbox help** [*COMMAND*]
@ -29,3 +29,7 @@ $ toolbox help
```
$ toolbox help create
```
## SEE ALSO
`toolbox(1)`

View File

@ -1,14 +1,14 @@
% toolbox-init-container(1)
% toolbox-init-container 1
## NAME
toolbox\-init\-container - Initialize a running container
## SYNOPSIS
**toolbox init-container** *--home HOME*
**toolbox init-container** *--gid GID*
*--home HOME*
*--home-link*
*--media-link*
*--mnt-link*
*--monitor-host*
*--shell SHELL*
*--uid UID*
*--user USER*
@ -16,17 +16,50 @@ toolbox\-init\-container - Initialize a running container
## DESCRIPTION
Initializes a newly created container that's running. It is primarily meant to
be used as the entry point for all toolbox containers, and must be run inside
be used as the entry point for all Toolbx containers, and must be run inside
the container that's to be initialized. It is not expected to be directly
invoked by humans, and cannot be used on the host.
A key feature of Toolbx containers is their entry point, the `toolbox
init-container` command.
OCI containers are inherently immutable. Configuration options passed through
`podman create` are baked into the definition of the OCI container, and can't
be changed later. This means that changes and improvements made in newer
versions of Toolbx can't be applied to pre-existing Toolbx containers
created by older versions of Toolbx. This is avoided by using the entry point
to configure the container at runtime.
The entry point of a Toolbx container customizes the container to fit the
current user by ensuring that it has a user that matches the one on the host,
and grants it `sudo` and `root` access.
Crucial configuration files, such as `/etc/host.conf`, `/etc/hosts`,
`/etc/localtime`, `/etc/resolv.conf` and `/etc/timezone`, inside the container
are kept synchronized with the host. The entry point also bind mounts various
subsets of the host's file system hierarchy to their corresponding locations
inside the container to provide seamless integration with the host. This
includes `/run/libvirt`, `/run/systemd/journal`, `/run/udev/data`,
`/var/lib/libvirt`, `/var/lib/systemd/coredump`, `/var/log/journal` and others.
On some host operating systems, important paths like `/home`, `/media` or
`/mnt` are symbolic links to other locations. The entry point ensures that
paths inside the container match those on the host, to avoid needless
confusion.
## OPTIONS ##
The following options are understood:
**--gid** GID
Pass GID as the user's numerical group ID from the host to the Toolbx
container.
**--home** HOME
Create a user inside the toolbox container whose login directory is HOME.
Create a user inside the Toolbx container whose login directory is HOME. This
option is required.
**--home-link**
@ -42,22 +75,28 @@ Make `/mnt` a symbolic link to `/var/mnt`.
**--monitor-host**
Ensure that certain configuration files inside the toolbox container are kept
synchronized with their counterparts on the host. Currently, these files are
`/etc/hosts` and `/etc/resolv.conf`.
Deprecated, does nothing.
Crucial configuration files inside the Toolbx container are always kept
synchronized with their counterparts on the host, and various subsets of the
host's file system hierarchy are always bind mounted to their corresponding
locations inside the Toolbx container.
**--shell** SHELL
Create a user inside the toolbox container whose login shell is SHELL.
Create a user inside the Toolbx container whose login shell is SHELL. This
option is required.
**--uid** UID
Create a user inside the toolbox container whose numerical user ID is UID.
Create a user inside the Toolbx container whose numerical user ID is UID. This
option is required.
**--user** USER
Create a user inside the toolbox container whose login name is LOGIN.
Create a user inside the Toolbx container whose login name is LOGIN. This
option is required.
## SEE ALSO
`podman(1)`, `podman-create(1)`, `podman-start(1)`
`toolbox(1)`, `podman(1)`, `podman-create(1)`, `podman-start(1)`

View File

@ -1,15 +1,15 @@
% toolbox-list(1)
% toolbox-list 1
## NAME
toolbox\-list - List existing toolbox containers and images
toolbox\-list - List existing Toolbx containers and images
## SYNOPSIS
**toolbox list** [*--containers* | *-c*] [*--images* | *-i*]
## DESCRIPTION
Lists existing toolbox containers and images. These are OCI containers and
images, which can be managed directly with tools like `buildah` and `podman`.
Lists existing Toolbx containers and images. These are OCI containers and
images, which can be managed directly with a tool like `podman`.
## OPTIONS ##
@ -17,27 +17,27 @@ The following options are understood:
**--containers, -c**
List only toolbox containers, not images.
List only Toolbx containers, not images.
**--images, -i**
List only toolbox images, not containers.
List only Toolbx images, not containers.
## EXAMPLES
### List all existing toolbox containers and images
### List all existing Toolbx containers and images
```
$ toolbox list
```
### List existing toolbox containers only
### List existing Toolbx containers only
```
$ toolbox list --containers
```
### List existing toolbox images only
### List existing Toolbx images only
```
$ toolbox list --images
@ -45,4 +45,4 @@ $ toolbox list --images
## SEE ALSO
`buildah(1)`, `podman(1)`
`toolbox(1)`, `podman(1)`, `podman-ps(1)`, `podman-images(1)`

View File

@ -1,17 +1,17 @@
% toolbox-rm(1)
% toolbox-rm 1
## NAME
toolbox\-rm - Remove one or more toolbox containers
toolbox\-rm - Remove one or more Toolbx containers
## SYNOPSIS
**toolbox rm** [*--all*] [*--force*] [*CONTAINER*...]
**toolbox rm** [*--all* | *-a*] [*--force* | *-f*] [*CONTAINER*...]
## DESCRIPTION
Removes one or more toolbox containers from the host. The container should
Removes one or more Toolbx containers from the host. The container should
have been created using the `toolbox create` command.
A toolbox container is an OCI container. Therefore, `toolbox rm` can be used
A Toolbx container is an OCI container. Therefore, `toolbox rm` can be used
interchangeably with `podman rm`.
## OPTIONS ##
@ -20,28 +20,28 @@ The following options are understood:
**--all, -a**
Remove all toolbox containers. It can be used in conjuction with `--force` as
Remove all Toolbx containers. It can be used in conjunction with `--force` as
well.
**--force, -f**
Force the removal of running and paused toolbox containers.
Force the removal of running and paused Toolbx containers.
## EXAMPLES
### Remove a toolbox container named `fedora-toolbox-gegl:30`
### Remove a Toolbx container named `fedora-toolbox-gegl:36`
```
$ toolbox rm fedora-toolbox-gegl:30
$ toolbox rm fedora-toolbox-gegl:36
```
### Remove all toolbox containers, but not those that are running or paused
### Remove all Toolbx containers, but not those that are running or paused
```
$ toolbox rm --all
```
### Remove all toolbox containers, including ones that are running or paused
### Remove all Toolbx containers, including ones that are running or paused
```
$ toolbox rm --all --force
@ -49,4 +49,4 @@ $ toolbox rm --all --force
## SEE ALSO
`buildah(1)`, `podman(1)`, `podman-rm(1)`
`toolbox(1)`, `podman(1)`, `podman-rm(1)`

View File

@ -1,17 +1,17 @@
% toolbox-rmi(1)
% toolbox-rmi 1
## NAME
toolbox\-rmi - Remove one or more toolbox images
toolbox\-rmi - Remove one or more Toolbx images
## SYNOPSIS
**toolbox rmi** [*--all*] [*--force*] [*IMAGE*...]
**toolbox rmi** [*--all* | *-a*] [*--force* | *-f*] [*IMAGE*...]
## DESCRIPTION
Removes one or more toolbox images from the host. The image should have been
Removes one or more Toolbx images from the host. The image should have been
created using the `toolbox create` command.
A toolbox image is an OCI image. Therefore, `toolbox rmi` can be used
A Toolbx image is an OCI image. Therefore, `toolbox rmi` can be used
interchangeably with `podman rmi`.
## OPTIONS ##
@ -20,28 +20,28 @@ The following options are understood:
**--all, -a**
Remove all toolbox images. It can be used in conjuction with `--force` as well.
Remove all Toolbx images. It can be used in conjunction with `--force` as well.
**--force, -f**
Force the removal of toolbox images that are used by toolbox containers. The
Force the removal of Toolbx images that are used by Toolbx containers. The
dependent containers will be removed as well.
## EXAMPLES
### Remove a toolbox image named `localhost/fedora-toolbox-gegl:30`
### Remove a Toolbx image named `localhost/fedora-toolbox-gegl:36`
```
$ toolbox rmi localhost/fedora-toolbox-gegl:30
$ toolbox rmi localhost/fedora-toolbox-gegl:36
```
### Remove all toolbox images, but not those that are used by containers
### Remove all Toolbx images, but not those that are used by containers
```
$ toolbox rmi --all
```
### Remove all toolbox images and their dependent containers
### Remove all Toolbx images and their dependent containers
```
$ toolbox rmi --all --force
@ -49,4 +49,4 @@ $ toolbox rmi --all --force
## SEE ALSO
`buildah(1)`, `podman(1)`, `podman-rmi(1)`
`toolbox(1)`, `podman(1)`, `podman-rmi(1)`

View File

@ -1,24 +1,26 @@
% toolbox-run(1)
% toolbox-run 1
## NAME
toolbox\-run - Run a command in an existing toolbox container
toolbox\-run - Run a command in an existing Toolbx container
## SYNOPSIS
**toolbox run** [*--container NAME* | *-c NAME*]
[*--distro DISTRO* | *-d DISTRO*]
[*--release RELEASE* | *-r RELEASE*] [*COMMAND*]
[*--preserve-fds N*]
[*--release RELEASE* | *-r RELEASE*]
[*COMMAND*]
## DESCRIPTION
Runs a command inside an existing toolbox container. The container should have
Runs a command inside an existing Toolbx container. The container should have
been created using the `toolbox create` command.
A toolbox container is an OCI container. Therefore, `toolbox run` is analogous
to a `podman start` followed by a `podman exec`.
On Fedora, the default container is known as `fedora-toolbox-N`, where N is
the release of the host. A specific container can be selected using the
`--container` option.
By default, the toolbox containers are tagged with the version of the OS that
corresponds to the content inside them. Their names are prefixed with the name
of the base image and suffixed with the current user name.
A Toolbx container is an OCI container. Therefore, `toolbox run` is analogous
to a `podman start` followed by a `podman exec`.
## OPTIONS ##
@ -26,35 +28,76 @@ The following options are understood:
**--container** NAME, **-c** NAME
Run command inside a toolbox container with the given NAME. This is useful
when there are multiple toolbox containers created from the same base image,
or entirely customized containers created from custom-built base images.
Run command inside a Toolbx container with the given NAME. This is useful
when there are multiple Toolbx containers created from the same image, or
entirely customized containers created from custom-built images.
**--distro** DISTRO, **-d** DISTRO
Run command inside a toolbox container for a different operating system DISTRO
than the host.
Run command inside a Toolbx container for a different operating system DISTRO
than the host. Has to be coupled with `--release` unless the selected DISTRO
matches the host system.
**--preserve-fds** N
Pass down to command N additional file descriptors (in addition to 0, 1,
2). The total number of file descriptors will be 3+N.
**--release** RELEASE, **-r** RELEASE
Run command inside a toolbox container for a different operating system
Run command inside a Toolbx container for a different operating system
RELEASE than the host.
## EXIT STATUS
The exit code gives information about why the command within the container
failed to run or why it exited.
**1** There was an internal error in Toolbx
**125** There was an internal error in Podman
**126** The run command could not be invoked
```
$ toolbox run /etc; echo $?
/bin/sh: line 1: /etc: Is a directory
/bin/sh: line 1: exec: /etc: cannot execute: Is a directory
Error: failed to invoke command /etc in container fedora-toolbox-36
126
```
**127** The run command cannot be found or the working directory does not exist
```
$ toolbox run foo; echo $?
/bin/sh: line 1: exec: foo: not found
Error: command foo not found in container fedora-toolbox-36
127
```
**Exit code** The run command exit code
```
$ toolbox run false; echo $?
1
```
## EXAMPLES
### Run ls inside a toolbox container using the default image matching the host OS
### Run ls inside the default Toolbx container matching the host OS
```
$ toolbox run ls -la
```
### Run emacs inside a toolbox container using the default image for Fedora 30
### Run emacs inside the default Toolbx container for Fedora 36
```
$ toolbox run --distro fedora --release f30 emacs
$ toolbox run --distro fedora --release f36 emacs
```
### Run uptime inside a custom toolbox container using a custom image
### Run uptime inside a Toolbx container with a custom name
```
$ toolbox run --container foo uptime
@ -62,4 +105,4 @@ $ toolbox run --container foo uptime
## SEE ALSO
`buildah(1)`, `podman(1)`, `podman-exec(1)`, `podman-start(1)`
`toolbox(1)`, `podman(1)`, `podman-exec(1)`, `podman-start(1)`

View File

@ -1,34 +1,104 @@
% toolbox(1)
% toolbox 1
## NAME
toolbox - Unprivileged development environment
toolbox - Tool for interactive command line environments on Linux
## SYNOPSIS
**toolbox** [*--verbose* | *-v*] *COMMAND* [*ARGS*]
**toolbox** [*--assumeyes* | *-y*]
[*--help* | *-h*]
[*--log-level LEVEL*]
[*--log-podman*]
[*--verbose* | *-v*]
*COMMAND* [*ARGS*...]
## DESCRIPTION
Toolbox is a tool that offers a familiar RPM based environment for developing
and debugging software that runs fully unprivileged using Podman.
Toolbx is a tool for Linux, which allows the use of interactive command line
environments for software development and troubleshooting the host operating
system, without having to install software on the host. It is built on top of
Podman and other standard container technologies from OCI.
The toolbox container is a fully *mutable* container; when you see
`yum install ansible` for example, that's something you can do inside your
toolbox container, without affecting the base operating system.
Toolbx environments have seamless access to the users home directory, the
Wayland and X11 sockets, networking (including Avahi), removable devices (like
USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev
database, etc..
This is particularly useful on OSTree based Fedora systems like Silverblue.
The intention of these systems is to discourage installation of software on
the host, and instead install software as (or in) containers.
This is particularly useful on OSTree based operating systems like Fedora
CoreOS and Silverblue. The intention of these systems is to discourage
installation of software on the host, and instead install software as (or in)
containers — they mostly don't even have package managers like DNF or YUM.
This makes it difficult to set up a development environment or troubleshoot
the operating system in the usual way.
However this tool doesn't *require* using an OSTree based system — it works
equally well if you're running e.g. existing Fedora Workstation or Server, and
that's a useful way to incrementally adopt containerization.
Toolbx solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
The toolbox environment is based on an OCI image. On Fedora this is the
`fedora-toolbox` image. This image is then customized for the current user to
create a toolbox container that seamlessly integrates with the rest of the
operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
## OPTIONS ##
The Toolbx environment is based on an OCI image. On Fedora this is the
`fedora-toolbox` image. This image is used to create a Toolbx container that
offers the interactive command line environment.
Note that Toolbx makes no promise about security beyond whats already
available in the usual command line environment on the host that everybody is
familiar with.
## Supported operating system distributions
By default, Toolbx tries to use an image matching the host operating system
distribution for creating containers. If the host is not supported, then it
falls back to a Fedora image. Supported host operating systems are:
* Arch Linux
* Fedora
* Red Hat Enterprise Linux >= 8.5
* Ubuntu
However, it's possible to create containers for a different distribution
through the use of the `--distro` and `--release` options that are accepted by
the relevant commands, or their counterparts in the configuration file. The
`--distro` flag specifies the name of the distribution, and `--release`
specifies its version. Supported combinations are:
Distro |Release
-------|----------
arch |latest or rolling
fedora |\<release\> or f\<release\> eg., 36 or f36
rhel |\<major\>.\<minor\> eg., 8.5
ubuntu |\<YY\>.\<MM\> eg., 22.04
## USAGE
### Create a Toolbx container:
```
[user@hostname ~]$ toolbox create
Image required to create toolbox container.
Download registry.fedoraproject.org/fedora-toolbox:36 (294.1MB)? [y/N]: y
Created container: fedora-toolbox-36
Enter with: toolbox enter
[user@hostname ~]$
```
### Enter the Toolbx container:
```
[user@hostname ~]$ toolbox enter
⬢[user@toolbox ~]$
```
### Remove the Toolbx container:
```
[user@hostname ~]$ toolbox rm fedora-toolbox-36
[user@hostname ~]$
```
## GLOBAL OPTIONS ##
The following options are understood:
@ -40,26 +110,35 @@ Automatically answer yes for all questions.
Print a synopsis of this manual and exit.
**--log-level**=*level*
Log messages above specified level: debug, info, warn, error, fatal or panic
(default: error)
**--log-podman**
Show log messages of invocations of Podman based on the logging level specified
by option **log-level**.
**--verbose, -v**
Print debug information including standard error stream of internal commands.
Use `-vv` for more detail.
Same as `--log-level=debug`. Use `-vv` to include `--log-podman`.
## COMMANDS
Commands for working with toolbox containers and images:
Commands for working with Toolbx containers and images:
**toolbox-create(1)**
Create a new toolbox container.
Create a new Toolbx container.
**toolbox-enter(1)**
Enter a toolbox container for interactive use.
Enter a Toolbx container for interactive use.
**toolbox-help(1)**
Display help information about Toolbox.
Display help information about Toolbx.
**toolbox-init-container(1)**
@ -67,20 +146,26 @@ Initialize a running container.
**toolbox-list(1)**
List existing toolbox containers and images.
List existing Toolbx containers and images.
**toolbox-rm(1)**
Remove one or more toolbox containers.
Remove one or more Toolbx containers.
**toolbox-rmi(1)**
Remove one or more toolbox images.
Remove one or more Toolbx images.
**toolbox-run(1)**
Run a command in an existing toolbox container.
Run a command in an existing Toolbx container.
## FILES ##
**toolbox.conf(5)**
Toolbx configuration file.
## SEE ALSO
`buildah(1)`, `podman(1)`
`podman(1)`, https://github.com/containers/toolbox

67
doc/toolbox.conf.5.md Normal file
View File

@ -0,0 +1,67 @@
% toolbox.conf 5
## NAME
toolbox.conf - Toolbx configuration file
## DESCRIPTION
Persistently overrides the default behaviour of `toolbox(1)`. The syntax is
TOML and the names of the options match their command line counterparts.
Currently, the only supported section is *general*.
## OPTIONS
**distro** = "DISTRO"
Create a Toolbx container for a different operating system DISTRO than the
host. Cannot be used with `image`.
**image** = "NAME"
Change the NAME of the image used to create the Toolbx container. This is
useful for creating containers from custom-built images. Cannot be used with
`distro` and `release`.
If NAME does not contain a registry, the local image storage will be
consulted, and if it's not present there then it will be pulled from a suitable
remote registry.
**release** = "RELEASE"
Create a Toolbx container for a different operating system RELEASE than the
host. Cannot be used with `image`.
## FILES
The following locations are looked up in increasing order of priority:
**/etc/containers/toolbox.conf**
This is meant to be provided by the operating system distributor or the system
administrator, and affects all users on the host.
Fields specified here can be overridden by any of the files below.
**$XDG_CONFIG_HOME/containers/toolbox.conf**
This is meant for user-specific changes. Fields specified here override any of
the files above.
## EXAMPLES
### Override the default operating system distro:
```
[general]
distro = "fedora"
release = "36"
```
### Override the default image:
```
[general]
image = "registry.fedoraproject.org/fedora-toolbox:36"
```
## SEE ALSO
`toolbox(1)`, `toolbox-create(1)`

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright © 2019 - 2020 Red Hat, Inc.
# Copyright © 2019 2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -77,4 +77,4 @@ case $1 in
;;
* )
exit 1
esac
esac

28
images/arch/Containerfile Normal file
View File

@ -0,0 +1,28 @@
FROM docker.io/library/archlinux:base-devel
LABEL com.github.containers.toolbox="true" \
name="arch-toolbox" \
version="base-devel" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Arch Linux Toolbx containers" \
maintainer="Morten Linderud <foxboron@archlinux.org>"
# Install extra packages
COPY extra-packages /
RUN pacman -Syu --needed --noconfirm - < extra-packages
RUN rm /extra-packages
# Enable man pages, enable progress bars
RUN sed -i -e 's/NoProgressBar/#NoProgressBar/' -e 's/NoExtract/#NoExtract/' /etc/pacman.conf
# Force reinstall of packages which have man pages (shouldn't redownload any that were just upgraded)
RUN mkdir -p /usr/share/man && pacman -Qo /usr/share/man | awk '{print $5}' | xargs pacman -S --noconfirm man-db
# Clean up cache
RUN yes | pacman -Scc
# Enable sudo permission for wheel users
RUN echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/toolbox
# Enable the use of p11-kit-client.so to access CA certificates from the host
RUN mkdir --parents /etc/pkcs11/modules

View File

@ -0,0 +1,27 @@
bash-completion
diffutils
flatpak-xdg-utils
git
gnupg
keyutils
libp11-kit
lsof
man-db
man-pages
mlocate
mtr
nss-mdns
openssh
pigz
procps-ng
rsync
tcpdump
time
traceroute
tree
unzip
vte-common
wget
words
xorg-xauth
zip

View File

@ -1,7 +1,7 @@
FROM registry.fedoraproject.org/fedora:28
ENV NAME=fedora-toolbox VERSION=28
LABEL com.github.debarshiray.toolbox="true" \
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
version="$VERSION" \

View File

@ -2,7 +2,6 @@ FROM registry.fedoraproject.org/fedora:29
ENV NAME=fedora-toolbox VERSION=29
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
version="$VERSION" \

View File

@ -2,7 +2,6 @@ FROM registry.fedoraproject.org/fedora:30
ENV NAME=fedora-toolbox VERSION=30
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
version="$VERSION" \

View File

@ -2,7 +2,6 @@ FROM registry.fedoraproject.org/fedora:31
ENV NAME=fedora-toolbox VERSION=31
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
version="$VERSION" \

View File

@ -2,9 +2,8 @@ FROM registry.fedoraproject.org/fedora:32
ENV NAME=fedora-toolbox VERSION=32
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \

View File

@ -1 +0,0 @@
../../../README.md

163
images/fedora/f32/README.md Normal file
View File

@ -0,0 +1,163 @@
<img src="data/logo/toolbox-logo-landscape.svg" alt="Toolbox logo landscape" width="800"/>
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
[![Daily Pipeline](https://softwarefactory-project.io/zuul/api/tenant/local/badge?project=containers/toolbox&pipeline=periodic)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
[![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/toolbox)](https://www.archlinux.org/packages/community/x86_64/toolbox/)
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide)](https://src.fedoraproject.org/rpms/toolbox/)
[Toolbox](https://github.com/containers/toolbox) is a tool for Linux operating
systems, which allows the use of containerized command line environments. It is
built on top of [Podman](https://podman.io/) and other standard container
technologies from [OCI](https://opencontainers.org/).
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or install tools for debugging in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and debugging tools, editors
and SDKs. For example, it's possible to do `yum install ansible` without
affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that seamlessly integrates with the rest of the
operating system by providing access to the user's home directory, the Wayland
and X11 sockets, SSH agent, etc..
## Installation
Toolbox is installed by default on Fedora Silverblue. On other operating
systems it's just a matter of installing the `toolbox` package.
## Usage
### Create your toolbox container:
```console
[user@hostname ~]$ toolbox create
Created container: fedora-toolbox-33
Enter with: toolbox enter
[user@hostname ~]$
```
This will create a container called `fedora-toolbox-<version-id>`.
### Enter the toolbox:
```console
[user@hostname ~]$ toolbox enter
⬢[user@toolbox ~]$
```
### Remove a toolbox container:
```console
[user@hostname ~]$ toolbox rm fedora-toolbox-33
[user@hostname ~]$
```
## Dependencies and Building
Toolbox requires at least Podman 1.4.0 to work, and uses the Meson build
system.
The following dependencies are required to build it:
- meson
- go-md2man
- systemd
- go
- ninja
The following dependencies enable various optional features:
- bash-completion
It can be built and installed as any other typical Meson-based project:
```console
[user@hostname toolbox]$ meson -Dprofile_dir=/etc/profile.d builddir
[user@hostname toolbox]$ ninja -C builddir
[user@hostname toolbox]$ sudo ninja -C builddir install
```
Toolbox is written in Go. Consult the
[src/go.mod](https://github.com/containers/toolbox/blob/main/src/go.mod) file
for a full list of all the Go dependencies.
By default, Toolbox uses Go modules and all the required Go packages are
automatically downloaded as part of the build. There's no need to worry about
the Go dependencies, unless the build environment doesn't have network access
or any such peculiarities.
## Distro support
By default, Toolbox creates the container using an
[OCI](https://www.opencontainers.org/) image called
`<ID>-toolbox:<VERSION-ID>`, where `<ID>` and `<VERSION-ID>` are taken from the
host's `/usr/lib/os-release`. For example, the default image on a Fedora 33
host would be `fedora-toolbox:33`.
This default can be overridden by the `--image` option in `toolbox create`,
but operating system distributors should provide an adequately configured
default image to ensure a smooth user experience.
## Image requirements
Toolbox customizes newly created containers in a certain way. This requires
certain tools and paths to be present and have certain characteristics inside
the OCI image.
Tools:
* `getent(1)`
* `id(1)`
* `ln(1)`
* `mkdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `passwd(1)`
* `readlink(1)`
* `rm(1)`
* `rmdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `sleep(1)`
* `test(1)`
* `touch(1)`
* `unlink(1)`
* `useradd(8)`
* `usermod(8)`
Paths:
* `/etc/host.conf`: optional, if present not a bind mount
* `/etc/hosts`: optional, if present not a bind mount
* `/etc/krb5.conf.d`: directory, not a bind mount
* `/etc/localtime`: optional, if present not a bind mount
* `/etc/resolv.conf`: optional, if present not a bind mount
* `/etc/timezone`: optional, if present not a bind mount
Toolbox enables `sudo(8)` access inside containers. The following is necessary
for that to work:
* The image should have `sudo(8)` enabled for users belonging to either the
`sudo` or `wheel` groups, and the group itself should exist. File an
[issue](https://github.com/containers/toolbox/issues/new) if you really need
support for a different group. However, it's preferable to keep this list as
short as possible.
* The image should allow empty passwords for `sudo(8)`. This can be achieved
by either adding the `nullok` option to the `PAM(8)` configuration, or by
add the `NOPASSWD` tag to the `sudoers(5)` configuration.
Since Toolbox only works with OCI images that fulfill certain requirements,
it will refuse images that aren't tagged with
`com.github.containers.toolbox="true"` and
`com.github.debarshiray.toolbox="true"` labels. These labels are meant to be
used by the maintainer of the image to indicate that they have read this
document and tested that the image works with Toolbox. You can use the
following snippet in a Dockerfile for this:
```Dockerfile
LABEL com.github.containers.toolbox="true"
```
The label `com.github.debarshiray.toolbox="true"` was used in previous versions
of toolbox but is currently deprecated.

View File

@ -2,9 +2,8 @@ FROM registry.fedoraproject.org/fedora:33
ENV NAME=fedora-toolbox VERSION=33
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \

View File

@ -1 +0,0 @@
../../../README.md

167
images/fedora/f33/README.md Normal file
View File

@ -0,0 +1,167 @@
<img src="data/logo/toolbox-logo-landscape.svg" alt="Toolbox logo landscape" width="800"/>
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
[![Daily Pipeline](https://softwarefactory-project.io/zuul/api/tenant/local/badge?project=containers/toolbox&pipeline=periodic)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
[![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/toolbox)](https://www.archlinux.org/packages/community/x86_64/toolbox/)
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide)](https://src.fedoraproject.org/rpms/toolbox/)
[Toolbox](https://github.com/containers/toolbox) is a tool for Linux operating
systems, which allows the use of containerized command line environments. It is
built on top of [Podman](https://podman.io/) and other standard container
technologies from [OCI](https://opencontainers.org/).
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or install tools for debugging in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and debugging tools, editors
and SDKs. For example, it's possible to do `yum install ansible` without
affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that seamlessly integrates with the rest of the
operating system by providing access to the user's home directory, the Wayland
and X11 sockets, networking (including Avahi), removable devices (like USB
sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev
database, etc..
## Installation
Toolbox is installed by default on Fedora Silverblue. On other operating
systems it's just a matter of installing the `toolbox` package.
## Usage
### Create your toolbox container:
```console
[user@hostname ~]$ toolbox create
Created container: fedora-toolbox-33
Enter with: toolbox enter
[user@hostname ~]$
```
This will create a container called `fedora-toolbox-<version-id>`.
### Enter the toolbox:
```console
[user@hostname ~]$ toolbox enter
⬢[user@toolbox ~]$
```
### Remove a toolbox container:
```console
[user@hostname ~]$ toolbox rm fedora-toolbox-33
[user@hostname ~]$
```
## Dependencies and Building
Toolbox requires at least Podman 1.4.0 to work, and uses the Meson build
system.
The following dependencies are required to build it:
- meson
- go-md2man
- systemd
- go
- ninja
The following dependencies enable various optional features:
- bash-completion
It can be built and installed as any other typical Meson-based project:
```console
[user@hostname toolbox]$ meson -Dprofile_dir=/etc/profile.d builddir
[user@hostname toolbox]$ ninja -C builddir
[user@hostname toolbox]$ sudo ninja -C builddir install
```
Toolbox is written in Go. Consult the
[src/go.mod](https://github.com/containers/toolbox/blob/main/src/go.mod) file
for a full list of all the Go dependencies.
By default, Toolbox uses Go modules and all the required Go packages are
automatically downloaded as part of the build. There's no need to worry about
the Go dependencies, unless the build environment doesn't have network access
or any such peculiarities.
## Distro support
By default, Toolbox creates the container using an
[OCI](https://www.opencontainers.org/) image called
`<ID>-toolbox:<VERSION-ID>`, where `<ID>` and `<VERSION-ID>` are taken from the
host's `/usr/lib/os-release`. For example, the default image on a Fedora 33
host would be `fedora-toolbox:33`.
This default can be overridden by the `--image` option in `toolbox create`,
but operating system distributors should provide an adequately configured
default image to ensure a smooth user experience.
## Image requirements
Toolbox customizes newly created containers in a certain way. This requires
certain tools and paths to be present and have certain characteristics inside
the OCI image.
Tools:
* `getent(1)`
* `id(1)`
* `ln(1)`
* `mkdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `passwd(1)`
* `readlink(1)`
* `rm(1)`
* `rmdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `sleep(1)`
* `test(1)`
* `touch(1)`
* `unlink(1)`
* `useradd(8)`
* `usermod(8)`
Paths:
* `/etc/host.conf`: optional, if present not a bind mount
* `/etc/hosts`: optional, if present not a bind mount
* `/etc/krb5.conf.d`: directory, not a bind mount
* `/etc/localtime`: optional, if present not a bind mount
* `/etc/machine-id`: optional, not a bind mount
* `/etc/resolv.conf`: optional, if present not a bind mount
* `/etc/timezone`: optional, if present not a bind mount
Toolbox enables `sudo(8)` access inside containers. The following is necessary
for that to work:
* The image should have `sudo(8)` enabled for users belonging to either the
`sudo` or `wheel` groups, and the group itself should exist. File an
[issue](https://github.com/containers/toolbox/issues/new) if you really need
support for a different group. However, it's preferable to keep this list as
short as possible.
* The image should allow empty passwords for `sudo(8)`. This can be achieved
by either adding the `nullok` option to the `PAM(8)` configuration, or by
add the `NOPASSWD` tag to the `sudoers(5)` configuration.
Since Toolbox only works with OCI images that fulfill certain requirements,
it will refuse images that aren't tagged with
`com.github.containers.toolbox="true"` and
`com.github.debarshiray.toolbox="true"` labels. These labels are meant to be
used by the maintainer of the image to indicate that they have read this
document and tested that the image works with Toolbox. You can use the
following snippet in a Dockerfile for this:
```Dockerfile
LABEL com.github.containers.toolbox="true"
```
The label `com.github.debarshiray.toolbox="true"` was used in previous versions
of toolbox but is currently deprecated.

View File

@ -1,4 +1,5 @@
bash-completion
bc
bzip2
diffutils
dnf-plugins-core
@ -10,6 +11,7 @@ gnupg
gnupg2-smime
gvfs-client
hostname
iproute
iputils
jwhois
keyutils
@ -20,6 +22,7 @@ man-db
man-pages
mlocate
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd

View File

@ -2,9 +2,8 @@ FROM registry.fedoraproject.org/fedora:34
ENV NAME=fedora-toolbox VERSION=34
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
@ -13,6 +12,7 @@ LABEL com.github.containers.toolbox="true" \
COPY README.md /
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y swap coreutils-single coreutils-full
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
@ -23,5 +23,3 @@ RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf clean all
CMD /bin/sh

View File

@ -1 +0,0 @@
../../../README.md

167
images/fedora/f34/README.md Normal file
View File

@ -0,0 +1,167 @@
<img src="data/logo/toolbox-logo-landscape.svg" alt="Toolbox logo landscape" width="800"/>
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
[![Daily Pipeline](https://softwarefactory-project.io/zuul/api/tenant/local/badge?project=containers/toolbox&pipeline=periodic)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
[![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/toolbox)](https://www.archlinux.org/packages/community/x86_64/toolbox/)
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide)](https://src.fedoraproject.org/rpms/toolbox/)
[Toolbox](https://github.com/containers/toolbox) is a tool for Linux operating
systems, which allows the use of containerized command line environments. It is
built on top of [Podman](https://podman.io/) and other standard container
technologies from [OCI](https://opencontainers.org/).
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or install tools for debugging in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and debugging tools, editors
and SDKs. For example, it's possible to do `yum install ansible` without
affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that seamlessly integrates with the rest of the
operating system by providing access to the user's home directory, the Wayland
and X11 sockets, networking (including Avahi), removable devices (like USB
sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev
database, etc..
## Installation
Toolbox is installed by default on Fedora Silverblue. On other operating
systems it's just a matter of installing the `toolbox` package.
## Usage
### Create your toolbox container:
```console
[user@hostname ~]$ toolbox create
Created container: fedora-toolbox-33
Enter with: toolbox enter
[user@hostname ~]$
```
This will create a container called `fedora-toolbox-<version-id>`.
### Enter the toolbox:
```console
[user@hostname ~]$ toolbox enter
⬢[user@toolbox ~]$
```
### Remove a toolbox container:
```console
[user@hostname ~]$ toolbox rm fedora-toolbox-33
[user@hostname ~]$
```
## Dependencies and Building
Toolbox requires at least Podman 1.4.0 to work, and uses the Meson build
system.
The following dependencies are required to build it:
- meson
- go-md2man
- systemd
- go
- ninja
The following dependencies enable various optional features:
- bash-completion
It can be built and installed as any other typical Meson-based project:
```console
[user@hostname toolbox]$ meson -Dprofile_dir=/etc/profile.d builddir
[user@hostname toolbox]$ ninja -C builddir
[user@hostname toolbox]$ sudo ninja -C builddir install
```
Toolbox is written in Go. Consult the
[src/go.mod](https://github.com/containers/toolbox/blob/main/src/go.mod) file
for a full list of all the Go dependencies.
By default, Toolbox uses Go modules and all the required Go packages are
automatically downloaded as part of the build. There's no need to worry about
the Go dependencies, unless the build environment doesn't have network access
or any such peculiarities.
## Distro support
By default, Toolbox creates the container using an
[OCI](https://www.opencontainers.org/) image called
`<ID>-toolbox:<VERSION-ID>`, where `<ID>` and `<VERSION-ID>` are taken from the
host's `/usr/lib/os-release`. For example, the default image on a Fedora 33
host would be `fedora-toolbox:33`.
This default can be overridden by the `--image` option in `toolbox create`,
but operating system distributors should provide an adequately configured
default image to ensure a smooth user experience.
## Image requirements
Toolbox customizes newly created containers in a certain way. This requires
certain tools and paths to be present and have certain characteristics inside
the OCI image.
Tools:
* `getent(1)`
* `id(1)`
* `ln(1)`
* `mkdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `passwd(1)`
* `readlink(1)`
* `rm(1)`
* `rmdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `sleep(1)`
* `test(1)`
* `touch(1)`
* `unlink(1)`
* `useradd(8)`
* `usermod(8)`
Paths:
* `/etc/host.conf`: optional, if present not a bind mount
* `/etc/hosts`: optional, if present not a bind mount
* `/etc/krb5.conf.d`: directory, not a bind mount
* `/etc/localtime`: optional, if present not a bind mount
* `/etc/machine-id`: optional, not a bind mount
* `/etc/resolv.conf`: optional, if present not a bind mount
* `/etc/timezone`: optional, if present not a bind mount
Toolbox enables `sudo(8)` access inside containers. The following is necessary
for that to work:
* The image should have `sudo(8)` enabled for users belonging to either the
`sudo` or `wheel` groups, and the group itself should exist. File an
[issue](https://github.com/containers/toolbox/issues/new) if you really need
support for a different group. However, it's preferable to keep this list as
short as possible.
* The image should allow empty passwords for `sudo(8)`. This can be achieved
by either adding the `nullok` option to the `PAM(8)` configuration, or by
add the `NOPASSWD` tag to the `sudoers(5)` configuration.
Since Toolbox only works with OCI images that fulfill certain requirements,
it will refuse images that aren't tagged with
`com.github.containers.toolbox="true"` and
`com.github.debarshiray.toolbox="true"` labels. These labels are meant to be
used by the maintainer of the image to indicate that they have read this
document and tested that the image works with Toolbox. You can use the
following snippet in a Dockerfile for this:
```Dockerfile
LABEL com.github.containers.toolbox="true"
```
The label `com.github.debarshiray.toolbox="true"` was used in previous versions
of toolbox but is currently deprecated.

View File

@ -1,4 +1,5 @@
bash-completion
bc
bzip2
diffutils
dnf-plugins-core
@ -10,6 +11,7 @@ gnupg
gnupg2-smime
gvfs-client
hostname
iproute
iputils
jwhois
keyutils
@ -18,8 +20,8 @@ less
lsof
man-db
man-pages
mlocate
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
@ -33,6 +35,7 @@ time
traceroute
tree
unzip
util-linux
vte-profile
wget
which

View File

@ -0,0 +1,25 @@
FROM registry.fedoraproject.org/fedora:35
ENV NAME=fedora-toolbox VERSION=35
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
COPY README.md /
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y swap coreutils-single coreutils-full
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf clean all

167
images/fedora/f35/README.md Normal file
View File

@ -0,0 +1,167 @@
<img src="data/logo/toolbox-logo-landscape.svg" alt="Toolbox logo landscape" width="800"/>
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
[![Daily Pipeline](https://softwarefactory-project.io/zuul/api/tenant/local/badge?project=containers/toolbox&pipeline=periodic)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
[![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/toolbox)](https://www.archlinux.org/packages/community/x86_64/toolbox/)
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide)](https://src.fedoraproject.org/rpms/toolbox/)
[Toolbox](https://github.com/containers/toolbox) is a tool for Linux operating
systems, which allows the use of containerized command line environments. It is
built on top of [Podman](https://podman.io/) and other standard container
technologies from [OCI](https://opencontainers.org/).
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or install tools for debugging in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and debugging tools, editors
and SDKs. For example, it's possible to do `yum install ansible` without
affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that seamlessly integrates with the rest of the
operating system by providing access to the user's home directory, the Wayland
and X11 sockets, networking (including Avahi), removable devices (like USB
sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev
database, etc..
## Installation
Toolbox is installed by default on Fedora Silverblue. On other operating
systems it's just a matter of installing the `toolbox` package.
## Usage
### Create your toolbox container:
```console
[user@hostname ~]$ toolbox create
Created container: fedora-toolbox-33
Enter with: toolbox enter
[user@hostname ~]$
```
This will create a container called `fedora-toolbox-<version-id>`.
### Enter the toolbox:
```console
[user@hostname ~]$ toolbox enter
⬢[user@toolbox ~]$
```
### Remove a toolbox container:
```console
[user@hostname ~]$ toolbox rm fedora-toolbox-33
[user@hostname ~]$
```
## Dependencies and Building
Toolbox requires at least Podman 1.4.0 to work, and uses the Meson build
system.
The following dependencies are required to build it:
- meson
- go-md2man
- systemd
- go
- ninja
The following dependencies enable various optional features:
- bash-completion
It can be built and installed as any other typical Meson-based project:
```console
[user@hostname toolbox]$ meson -Dprofile_dir=/etc/profile.d builddir
[user@hostname toolbox]$ ninja -C builddir
[user@hostname toolbox]$ sudo ninja -C builddir install
```
Toolbox is written in Go. Consult the
[src/go.mod](https://github.com/containers/toolbox/blob/main/src/go.mod) file
for a full list of all the Go dependencies.
By default, Toolbox uses Go modules and all the required Go packages are
automatically downloaded as part of the build. There's no need to worry about
the Go dependencies, unless the build environment doesn't have network access
or any such peculiarities.
## Distro support
By default, Toolbox creates the container using an
[OCI](https://www.opencontainers.org/) image called
`<ID>-toolbox:<VERSION-ID>`, where `<ID>` and `<VERSION-ID>` are taken from the
host's `/usr/lib/os-release`. For example, the default image on a Fedora 33
host would be `fedora-toolbox:33`.
This default can be overridden by the `--image` option in `toolbox create`,
but operating system distributors should provide an adequately configured
default image to ensure a smooth user experience.
## Image requirements
Toolbox customizes newly created containers in a certain way. This requires
certain tools and paths to be present and have certain characteristics inside
the OCI image.
Tools:
* `getent(1)`
* `id(1)`
* `ln(1)`
* `mkdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `passwd(1)`
* `readlink(1)`
* `rm(1)`
* `rmdir(1)`: for hosts where `/home` is a symbolic link to `/var/home`
* `sleep(1)`
* `test(1)`
* `touch(1)`
* `unlink(1)`
* `useradd(8)`
* `usermod(8)`
Paths:
* `/etc/host.conf`: optional, if present not a bind mount
* `/etc/hosts`: optional, if present not a bind mount
* `/etc/krb5.conf.d`: directory, not a bind mount
* `/etc/localtime`: optional, if present not a bind mount
* `/etc/machine-id`: optional, not a bind mount
* `/etc/resolv.conf`: optional, if present not a bind mount
* `/etc/timezone`: optional, if present not a bind mount
Toolbox enables `sudo(8)` access inside containers. The following is necessary
for that to work:
* The image should have `sudo(8)` enabled for users belonging to either the
`sudo` or `wheel` groups, and the group itself should exist. File an
[issue](https://github.com/containers/toolbox/issues/new) if you really need
support for a different group. However, it's preferable to keep this list as
short as possible.
* The image should allow empty passwords for `sudo(8)`. This can be achieved
by either adding the `nullok` option to the `PAM(8)` configuration, or by
add the `NOPASSWD` tag to the `sudoers(5)` configuration.
Since Toolbox only works with OCI images that fulfill certain requirements,
it will refuse images that aren't tagged with
`com.github.containers.toolbox="true"` and
`com.github.debarshiray.toolbox="true"` labels. These labels are meant to be
used by the maintainer of the image to indicate that they have read this
document and tested that the image works with Toolbox. You can use the
following snippet in a Dockerfile for this:
```Dockerfile
LABEL com.github.containers.toolbox="true"
```
The label `com.github.debarshiray.toolbox="true"` was used in previous versions
of toolbox but is currently deprecated.

View File

@ -0,0 +1,48 @@
bash-completion
bc
bzip2
diffutils
dnf-plugins-core
findutils
flatpak-spawn
fpaste
git
gnupg
gnupg2-smime
gvfs-client
hostname
iproute
iputils
jwhois
keyutils
krb5-libs
less
lsof
man-db
man-pages
mesa-dri-drivers
mesa-vulkan-drivers
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
pigz
procps-ng
rsync
shadow-utils
sudo
tcpdump
time
traceroute
tree
unzip
util-linux
vte-profile
vulkan-loader
wget
which
words
xorg-x11-xauth
xz
zip

View File

@ -0,0 +1,15 @@
acl
bash
curl
gawk
grep
gzip
libcap
openssl
p11-kit
pam
python3
rpm
sed
systemd
tar

View File

@ -0,0 +1,44 @@
FROM registry.fedoraproject.org/fedora:36
ARG NAME=fedora-toolbox
ARG VERSION=36
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
COPY README.md /
RUN rm /etc/rpm/macros.image-language-conf
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y upgrade
RUN dnf -y swap coreutils-single coreutils-full
RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
echo "$file: No such file or directory" >&2; \
ret_val=1; \
break; \
fi; \
done <ensure-files; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files
RUN dnf clean all

View File

@ -0,0 +1,44 @@
[Toolbox](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbox environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that offers the interactive command line
environment.
Note that Toolbox makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbox and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,17 @@
/usr/share/man/man1/bash.1*
/usr/share/man/man1/cd.1*
/usr/share/man/man1/export.1*
/usr/share/man/man1/cat.1*
/usr/share/man/man1/cp.1*
/usr/share/man/man1/ls.1*
/usr/share/man/man1/gpg2.1*
/usr/share/man/man7/gnupg2.7*
/usr/share/man/fr/man8/rpm.8*
/usr/share/man/ja/man8/rpm.8*
/usr/share/man/man8/rpm.8*
/usr/share/man/man1/kill.1*
/usr/share/man/man8/mount.8*

View File

@ -0,0 +1,48 @@
bash-completion
bc
bzip2
diffutils
dnf-plugins-core
findutils
flatpak-spawn
fpaste
git
gnupg2
gnupg2-smime
gvfs-client
hostname
iproute
iputils
jwhois
keyutils
krb5-libs
less
lsof
man-db
man-pages
mesa-dri-drivers
mesa-vulkan-drivers
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
pigz
procps-ng
rsync
shadow-utils
sudo
tcpdump
time
traceroute
tree
unzip
util-linux
vte-profile
vulkan-loader
wget
which
words
xorg-x11-xauth
xz
zip

View File

@ -0,0 +1,20 @@
acl
bash
coreutils-common
curl
findutils
gawk
gnupg2
grep
gzip
libcap
openssl
p11-kit
pam
python3
rpm
sed
sudo
systemd
tar
util-linux-core

View File

@ -0,0 +1,54 @@
FROM registry.fedoraproject.org/fedora:37
ARG NAME=fedora-toolbox
ARG VERSION=37
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
COPY README.md /
RUN rm /etc/rpm/macros.image-language-conf
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y upgrade
RUN dnf -y swap coreutils-single coreutils-full
RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
echo "$file: No such file or directory" >&2; \
ret_val=1; \
break; \
fi; \
done <ensure-files; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files
RUN broken_packages="$(rpm --all --query --state --queryformat "PACKAGE: %{NAME}\n" \
| sed --quiet --regexp-extended '/PACKAGE: /{s/PACKAGE: // ; h ; b }; /^not installed/ { g; p }' \
| uniq \
| sort)"; \
if [ "$broken_packages" != "" ]; then \
echo "Packages with missing files:" >&2; \
echo "$broken_packages" >&2; \
false; \
fi
RUN dnf clean all

View File

@ -0,0 +1,44 @@
[Toolbox](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbox environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that offers the interactive command line
environment.
Note that Toolbox makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbox and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,46 @@
/usr/share/man/man1/bash.1*
/usr/share/man/man1/cd.1*
/usr/share/man/man1/export.1*
/usr/share/man/man1/cat.1*
/usr/share/man/man1/cp.1*
/usr/share/man/man1/ls.1*
/usr/share/man/man8/dnf.8*
/usr/share/man/man5/dnf.conf.5*
/usr/share/locale/de/LC_MESSAGES/elfutils.mo
/usr/share/locale/ja/LC_MESSAGES/elfutils.mo
/usr/share/man/man1/gpg2.1*
/usr/share/man/man7/gnupg2.7*
/usr/share/info/nettle.info*
/usr/share/locale/fr/LC_MESSAGES/popt.mo
/usr/share/locale/ja/LC_MESSAGES/popt.mo
/usr/share/man/fr/man1/pstree.1*
/usr/share/man/ru/man1/pstree.1*
/usr/share/man/man1/pstree.1*
/usr/share/info/history.info*
/usr/share/man/fr/man8/rpm.8*
/usr/share/man/ja/man8/rpm.8*
/usr/share/man/man8/rpm.8*
/usr/share/man/fr/man8/useradd.8*
/usr/share/man/ja/man8/useradd.8*
/usr/share/man/man8/useradd.8*
/usr/share/man/man1/cal.1.*
/usr/share/man/man1/getopt.1*
/usr/share/man/man1/hexdump.1*
/usr/share/man/man1/kill.1*
/usr/share/man/man8/mount.8*
/usr/share/man/fr/man1/xz.1*
/usr/share/man/ko/man1/xz.1*
/usr/share/man/man1/xz.1*

View File

@ -0,0 +1,49 @@
bash-completion
bc
bzip2
diffutils
dnf-plugins-core
findutils
flatpak-spawn
fpaste
git
gnupg2
gnupg2-smime
gvfs-client
hostname
iproute
iputils
keyutils
krb5-libs
less
lsof
man-db
man-pages
mesa-dri-drivers
mesa-vulkan-drivers
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
pigz
procps-ng
psmisc
rsync
shadow-utils
sudo
tcpdump
time
traceroute
tree
unzip
util-linux
vte-profile
vulkan-loader
wget
which
whois
words
xorg-x11-xauth
xz
zip

View File

@ -0,0 +1,91 @@
acl
alternatives
audit-libs
authselect
authselect-libs
bash
ca-certificates
coreutils-common
cracklib
crypto-policies
curl
cyrus-sasl-lib
dnf
dnf-data
elfutils-libelf
expat
file-libs
filesystem
findutils
gawk
glib2
gmp
gnupg2
gnutls
gpgme
grep
gzip
ima-evm-utils
keyutils-libs
krb5-libs
libarchive
libassuan
libblkid
libcap
libcap-ng
libdb
libdnf
libeconf
libevent
libffi
libgcrypt
libgomp
libgpg-error
libidn2
libksba
libmodulemd
libpwquality
librepo
libsemanage
libsigsegv
libsolv
libssh
libtasn1
libtirpc
libunistring
libverto
libxcrypt
libxml2
libyaml
lz4-libs
mpfr
ncurses-base
nettle
openldap
openssl
p11-kit
pam
pcre
pcre2-syntax
popt
python3
python3-gpg
python3-libs
python3-rpm
readline
rpm
sed
setup
shadow-utils
sqlite-libs
sudo
systemd
systemd-libs
tar
tpm2-tss
tzdata
util-linux-core
vim-minimal
yum
zchunk-libs
zlib

View File

@ -0,0 +1,54 @@
FROM registry.fedoraproject.org/fedora:38
ARG NAME=fedora-toolbox
ARG VERSION=38
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox(1) command" \
summary="Image for creating Fedora Toolbx containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
COPY README.md /
RUN rm /etc/rpm/macros.image-language-conf
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y upgrade
RUN dnf -y swap coreutils-single coreutils-full
RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
echo "$file: No such file or directory" >&2; \
ret_val=1; \
break; \
fi; \
done <ensure-files; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files
RUN broken_packages="$(rpm --all --query --state --queryformat "PACKAGE: %{NAME}\n" \
| sed --quiet --regexp-extended '/PACKAGE: /{s/PACKAGE: // ; h ; b }; /^not installed/ { g; p }' \
| uniq \
| sort)"; \
if [ "$broken_packages" != "" ]; then \
echo "Packages with missing files:" >&2; \
echo "$broken_packages" >&2; \
false; \
fi
RUN dnf clean all

View File

@ -0,0 +1,44 @@
[Toolbx](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbx environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostreedev.github.io/ostree/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbx solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The Toolbx environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a Toolbx container that offers the interactive command line
environment.
Note that Toolbx makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbx and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,52 @@
/usr/share/man/man1/bash.1*
/usr/share/man/man1/cd.1*
/usr/share/man/man1/export.1*
/usr/share/man/man1/cat.1*
/usr/share/man/man1/cp.1*
/usr/share/man/man1/ls.1*
/usr/share/cracklib/cracklib-small.pwd*
/usr/share/cracklib/pw_dict.pwd*
/usr/share/man/man8/dnf.8*
/usr/share/man/man5/dnf.conf.5*
/usr/share/locale/de/LC_MESSAGES/elfutils.mo
/usr/share/locale/ja/LC_MESSAGES/elfutils.mo
/usr/share/locale/fr/LC_MESSAGES/gawk.mo
/usr/share/locale/ko/LC_MESSAGES/gawk.mo
/usr/share/man/man1/gpg2.1*
/usr/share/man/man7/gnupg2.7*
/usr/share/info/nettle.info*
/usr/share/locale/fr/LC_MESSAGES/popt.mo
/usr/share/locale/ja/LC_MESSAGES/popt.mo
/usr/share/man/fr/man1/pstree.1*
/usr/share/man/ko/man1/pstree.1*
/usr/share/man/man1/pstree.1*
/usr/share/info/history.info*
/usr/share/man/fr/man8/rpm.8*
/usr/share/man/ja/man8/rpm.8*
/usr/share/man/man8/rpm.8*
/usr/share/man/fr/man8/useradd.8*
/usr/share/man/ja/man8/useradd.8*
/usr/share/man/man8/useradd.8*
/usr/share/man/man1/cal.1.*
/usr/share/man/man1/getopt.1*
/usr/share/man/man1/hexdump.1*
/usr/share/man/man1/kill.1*
/usr/share/man/man8/mount.8*
/usr/share/man/fr/man1/xz.1*
/usr/share/man/ko/man1/xz.1*
/usr/share/man/man1/xz.1*

View File

@ -0,0 +1,52 @@
bash-completion
bc
bzip2
cracklib-dicts
diffutils
dnf-plugins-core
findutils
flatpak-spawn
fpaste
gawk-all-langpacks
git
glibc-gconv-extra
gnupg2
gnupg2-smime
gvfs-client
hostname
iproute
iputils
keyutils
krb5-libs
less
lsof
man-db
man-pages
mesa-dri-drivers
mesa-vulkan-drivers
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
pigz
procps-ng
psmisc
rsync
shadow-utils
sudo
tcpdump
time
traceroute
tree
unzip
util-linux
vte-profile
vulkan-loader
wget
which
whois
words
xorg-x11-xauth
xz
zip

View File

@ -0,0 +1,92 @@
acl
alternatives
audit-libs
authselect
authselect-libs
bash
ca-certificates
coreutils-common
cracklib
crypto-policies
curl
cyrus-sasl-lib
dnf
dnf-data
elfutils-libelf
expat
file-libs
filesystem
findutils
gawk
glib2
gmp
gnupg2
gnutls
gpgme
grep
gzip
ima-evm-utils
keyutils-libs
krb5-libs
libarchive
libassuan
libblkid
libcap
libcap-ng
libcomps
libdb
libdnf
libeconf
libevent
libffi
libgcrypt
libgomp
libgpg-error
libidn2
libksba
libmodulemd
libpwquality
librepo
libsemanage
libsigsegv
libsolv
libssh
libtasn1
libtirpc
libunistring
libunistring1.0
libverto
libxcrypt
libxml2
libyaml
lz4-libs
mpfr
ncurses-base
nettle
openldap
openssl
p11-kit
pam
pcre2-syntax
popt
python3
python3-libs
python3-rpm
readline
rpm
rpm-sequoia
sed
setup
shadow-utils
sqlite-libs
sudo
systemd
systemd-libs
tar
tpm2-tss
tzdata
util-linux-core
vim-minimal
yum
zchunk-libs
zlib

View File

@ -0,0 +1,54 @@
FROM registry.fedoraproject.org/fedora:39
ARG NAME=fedora-toolbox
ARG VERSION=39
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox(1) command" \
summary="Image for creating Fedora Toolbx containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
COPY README.md /
RUN rm /etc/rpm/macros.image-language-conf
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y upgrade
RUN dnf -y swap coreutils-single coreutils-full
RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
echo "$file: No such file or directory" >&2; \
ret_val=1; \
break; \
fi; \
done <ensure-files; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files
RUN broken_packages="$(rpm --all --query --state --queryformat "PACKAGE: %{NAME}\n" \
| sed --quiet --regexp-extended '/PACKAGE: /{s/PACKAGE: // ; h ; b }; /^not installed/ { g; p }' \
| uniq \
| sort)"; \
if [ "$broken_packages" != "" ]; then \
echo "Packages with missing files:" >&2; \
echo "$broken_packages" >&2; \
false; \
fi
RUN dnf clean all

View File

@ -0,0 +1,44 @@
[Toolbx](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for software development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbx environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostreedev.github.io/ostree/) based operating systems like
[Fedora CoreOS](https://fedoraproject.org/coreos/) and
[Silverblue](https://fedoraproject.org/silverblue/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbx solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The Toolbx environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a Toolbx container that offers the interactive command line
environment.
Note that Toolbx makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbx and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,51 @@
/usr/share/man/man1/bash.1*
/usr/share/man/man1/cd.1*
/usr/share/man/man1/export.1*
/usr/share/man/man1/cat.1*
/usr/share/man/man1/cp.1*
/usr/share/man/man1/ls.1*
/usr/share/cracklib/cracklib-small.pwd*
/usr/share/cracklib/pw_dict.pwd*
/usr/share/man/man8/dnf.8*
/usr/share/man/man5/dnf.conf.5*
/usr/share/locale/de/LC_MESSAGES/elfutils.mo
/usr/share/locale/ja/LC_MESSAGES/elfutils.mo
/usr/share/locale/fr/LC_MESSAGES/gawk.mo
/usr/share/locale/ko/LC_MESSAGES/gawk.mo
/usr/share/man/man1/gpg2.1*
/usr/share/man/man7/gnupg2.7*
/usr/share/info/nettle.info*
/usr/share/locale/fr/LC_MESSAGES/popt.mo
/usr/share/locale/ja/LC_MESSAGES/popt.mo
/usr/share/man/fr/man1/pstree.1*
/usr/share/man/ko/man1/pstree.1*
/usr/share/man/man1/pstree.1*
/usr/share/info/history.info*
/usr/share/man/man8/rpm.8*
/usr/share/man/man8/rpm2cpio.8*
/usr/share/man/fr/man8/useradd.8*
/usr/share/man/ja/man8/useradd.8*
/usr/share/man/man8/useradd.8*
/usr/share/man/man1/cal.1.*
/usr/share/man/man1/getopt.1*
/usr/share/man/man1/hexdump.1*
/usr/share/man/man1/kill.1*
/usr/share/man/man8/mount.8*
/usr/share/man/fr/man1/xz.1*
/usr/share/man/ko/man1/xz.1*
/usr/share/man/man1/xz.1*

View File

@ -0,0 +1,52 @@
bash-completion
bc
bzip2
cracklib-dicts
diffutils
dnf-plugins-core
findutils
flatpak-spawn
fpaste
gawk-all-langpacks
git
glibc-gconv-extra
gnupg2
gnupg2-smime
gvfs-client
hostname
iproute
iputils
keyutils
krb5-libs
less
lsof
man-db
man-pages
mesa-dri-drivers
mesa-vulkan-drivers
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
pigz
procps-ng
psmisc
rsync
shadow-utils
sudo
tcpdump
time
traceroute
tree
unzip
util-linux
vte-profile
vulkan-loader
wget
which
whois
words
xorg-x11-xauth
xz
zip

View File

@ -0,0 +1,90 @@
acl
alternatives
audit-libs
authselect
authselect-libs
bash
ca-certificates
coreutils-common
cracklib
crypto-policies
curl
cyrus-sasl-lib
dnf
dnf-data
elfutils-libelf
expat
file-libs
filesystem
findutils
gawk
glib2
gmp
gnupg2
gnutls
grep
gzip
ima-evm-utils
keyutils-libs
krb5-libs
libarchive
libassuan
libblkid
libcap
libcap-ng
libcomps
libdb
libdnf
libeconf
libevent
libffi
libgcrypt
libgomp
libgpg-error
libidn2
libksba
libmodulemd
libpwquality
librepo
libsemanage
libsigsegv
libsolv
libssh
libtasn1
libtirpc
libunistring
libverto
libxcrypt
libxml2
libyaml
lz4-libs
mpfr
ncurses-base
nettle
openldap
openssl
p11-kit
pam
pcre2-syntax
popt
python3
python3-libs
python3-rpm
readline
rpm
rpm-sequoia
sed
setup
shadow-utils
sqlite-libs
sudo
systemd
systemd-libs
tar
tpm2-tss
tzdata
util-linux-core
vim-minimal
yum
zchunk-libs
zlib

View File

@ -0,0 +1,28 @@
FROM registry.access.redhat.com/ubi8:8.5
ENV NAME=toolbox-container VERSION=8.5
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating UBI toolbox containers" \
maintainer="Oliver Gutiérrez <ogutierrez@redhat.com>"
COPY README.md /
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y swap coreutils-single coreutils-full
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf clean all
CMD /bin/sh

44
images/rhel/8.5/README.md Normal file
View File

@ -0,0 +1,44 @@
[Toolbox](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbox environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that offers the interactive command line
environment.
Note that Toolbox makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbox and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,45 @@
alternatives
avahi-libs
bzip2
coreutils-common
dejavu-sans-fonts
diffutils
dnf-plugins-core
git
glibc-all-langpacks
gnupg2-smime
hostname
iputils
jansson
langpacks-en
less
libevent
libgomp
libICE
libpkgconf
libSM
libX11
libX11-common
libXau
libxcb
libXext
libXmu
libXt
lsof
man-db
openssh-clients
pigz
pkgconf
pkgconf-m4
pkgconf-pkg-config
procps-ng
qrencode-libs
rsync
sudo
systemd-rpm-macros
time
unzip
vte-profile
wget
xz
zip

View File

@ -0,0 +1,14 @@
acl
bash
curl
gawk
grep
gzip
libcap
p11-kit
pam
python3
rpm
sed
systemd
tar

View File

@ -0,0 +1,28 @@
FROM registry.access.redhat.com/ubi8:8.6
ENV NAME=toolbox-container VERSION=8.6
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating UBI toolbox containers" \
maintainer="Oliver Gutiérrez <ogutierrez@redhat.com>"
COPY README.md /
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y swap coreutils-single coreutils-full
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf clean all
CMD /bin/sh

44
images/rhel/8.6/README.md Normal file
View File

@ -0,0 +1,44 @@
[Toolbox](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbox environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that offers the interactive command line
environment.
Note that Toolbox makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbox and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,50 @@
alternatives
bzip2
dejavu-sans-fonts
diffutils
dnf-plugins-core
findutils
flatpak-spawn
git
glibc-all-langpacks
gnupg2-smime
hostname
iproute
iputils
jansson
krb5-libs
langpacks-en
less
libevent
libgomp
libICE
libpkgconf
libSM
libX11
libX11-common
libXau
libxcb
libXext
libXmu
libXt
lsof
man-db
openssh-clients
passwd
pigz
pkgconf
pkgconf-m4
pkgconf-pkg-config
procps-ng
qrencode-libs
rsync
shadow-utils
sudo
time
unzip
util-linux
vte-profile
wget
which
xz
zip

View File

@ -0,0 +1,14 @@
acl
bash
curl
gawk
grep
gzip
libcap
p11-kit
pam
python3
rpm
sed
systemd
tar

View File

@ -0,0 +1,28 @@
FROM registry.access.redhat.com/ubi8:8.7
ENV NAME=toolbox-container VERSION=8.7
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating UBI toolbox containers" \
maintainer="Oliver Gutiérrez <ogutierrez@redhat.com>"
COPY README.md /
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y swap coreutils-single coreutils-full
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf clean all
CMD /bin/sh

44
images/rhel/8.7/README.md Normal file
View File

@ -0,0 +1,44 @@
[Toolbox](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbox environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that offers the interactive command line
environment.
Note that Toolbox makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbox and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,50 @@
alternatives
bzip2
dejavu-sans-fonts
diffutils
dnf-plugins-core
findutils
flatpak-spawn
git
glibc-all-langpacks
gnupg2-smime
hostname
iproute
iputils
jansson
krb5-libs
langpacks-en
less
libevent
libgomp
libICE
libpkgconf
libSM
libX11
libX11-common
libXau
libxcb
libXext
libXmu
libXt
lsof
man-db
openssh-clients
passwd
pigz
pkgconf
pkgconf-m4
pkgconf-pkg-config
procps-ng
qrencode-libs
rsync
shadow-utils
sudo
time
unzip
util-linux
vte-profile
wget
which
xz
zip

View File

@ -0,0 +1,14 @@
acl
bash
curl
gawk
grep
gzip
libcap
p11-kit
pam
python3
rpm
sed
systemd
tar

View File

@ -0,0 +1,28 @@
FROM registry.access.redhat.com/ubi8:8.8
ENV NAME=toolbox-container VERSION=8.8
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating UBI toolbox containers" \
maintainer="Oliver Gutiérrez <ogutierrez@redhat.com>"
COPY README.md /
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y swap coreutils-single coreutils-full
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf clean all
CMD /bin/sh

44
images/rhel/8.8/README.md Normal file
View File

@ -0,0 +1,44 @@
[Toolbox](https://containertoolbx.org/) is a tool for Linux, which allows the
use of interactive command line environments for development and
troubleshooting the host operating system, without having to install software
on the host. It is built on top of [Podman](https://podman.io/) and other
standard container technologies from [OCI](https://opencontainers.org/).
Toolbox environments have seamless access to the user's home directory,
the Wayland and X11 sockets, networking (including Avahi), removable devices
(like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the
udev database, etc..
This is particularly useful on
[OSTree](https://ostreedev.github.io/ostree/) based operating systems like
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
systems is to discourage installation of software on the host, and instead
install software as (or in) containers — they mostly don't even have package
managers like DNF or YUM. This makes it difficult to set up a development
environment or troubleshoot the operating system in the usual way.
Toolbox solves this problem by providing a fully mutable container within
which one can install their favourite development and troubleshooting tools,
editors and SDKs. For example, it's possible to do `yum install ansible`
without affecting the base operating system.
However, this tool doesn't *require* using an OSTree based system. It works
equally well on Fedora Workstation and Server, and that's a useful way to
incrementally adopt containerization.
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
image. On Fedora this is the `fedora-toolbox` image. This image is used to
create a toolbox container that offers the interactive command line
environment.
Note that Toolbox makes no promise about security beyond what's already
available in the usual command line environment on the host that everybody is
familiar with.
## Installation & Use
See our guides on
[installing & getting started](https://containertoolbx.org/install/) with
Toolbox and [Linux distro support](https://containertoolbx.org/distros/).

View File

@ -0,0 +1,50 @@
alternatives
bzip2
dejavu-sans-fonts
diffutils
dnf-plugins-core
findutils
flatpak-spawn
git
glibc-all-langpacks
gnupg2-smime
hostname
iproute
iputils
jansson
krb5-libs
langpacks-en
less
libevent
libgomp
libICE
libpkgconf
libSM
libX11
libX11-common
libXau
libxcb
libXext
libXmu
libXt
lsof
man-db
openssh-clients
passwd
pigz
pkgconf
pkgconf-m4
pkgconf-pkg-config
procps-ng
qrencode-libs
rsync
shadow-utils
sudo
time
unzip
util-linux
vte-profile
wget
which
xz
zip

Some files were not shown because too many files have changed in this diff Show More