Commit graph

62 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Debarshi Ray
6552274ef1 doc/toolbox: Synchronize with README.md
https://github.com/containers/toolbox/pull/686
2021-01-25 22:37:13 +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
120eea449e Remove the deprecated reset command
The Go implementation had deprecated the reset command, right from the
beginning, in favour of 'podman system reset'. It's time to finally
remove it.

https://github.com/containers/toolbox/pull/668
2021-01-12 03:21:35 +01:00
Ondřej Míchal
32d711cc64 Add a --distro option
This is meant to allow the user to create toolbox containers of
operating system distributions that are different from that of the
host and isn't Fedora.

https://github.com/containers/toolbox/pull/667
2021-01-12 02:37:47 +01:00
Ondřej Míchal
af87ede1db completion, doc/toolbox-create: Remove --candidate-registry
The --candidate-registry is a lesser known option only supported by
the POSIX shell implementation. The Go never implementation never
offered it, and nobody has felt its absence so far. So, it's safe to
assume that there's no urgent need to port it to Go, and it's better to
not confuse users by mentioning it.

https://github.com/containers/toolbox/pull/662
2021-01-07 21:11:25 +01:00
Debarshi Ray
0b41cc62f4 doc/toolbox-create: Say that --image & --release are mutually exclusive
https://github.com/containers/toolbox/pull/661
2021-01-07 20:08:01 +01:00
Debarshi Ray
47c32712f4 Set up /mnt to match the host
On Silverblue /mnt is a symbolic link to /var/mnt. Matching what the
host does will reduce weird side-effects.

https://github.com/containers/toolbox/issues/92
2020-01-06 19:16:17 +01:00
Debarshi Ray
65e3eec06e Set up /media to match the host
On Silverblue /media is a symbolic link to /run/media. Matching what
the host does will reduce weird side-effects.

https://github.com/containers/toolbox/issues/330
2019-11-22 16:31:50 +01:00
Harry Míchal
1625ad319f Add a --very-verbose or -vv option
Currently, toolbox(1) offers a --verbose option that only shows debug
information from toolbox(1) itself and the error stream of internal
commands. There's no way to further increase the log level of the
internal commands. It's sometimes very useful to be able to get more
detailed logs from Podman.

This adds a new --very-verbose or -vv option that makes this possible.

This should have been implemented as '--verbose --verbose', which
could be conveniently shortened to '-vv'. This is what flatpak(1)
does. However, due to the lack of built-in command line parsing
facilities in POSIX shell, there's no support for multiple short
options expressed as one single argument. eg., '-vy' doesn't expand to
'-v -y'.

Therefore, a separate --very-verbose or -vv option was added to make
things convenient for the user. It's expected that most people will
refer to this as -vv.

If this option is used, every Podman command in the code is run with
'--log-level debug'. Use wisely, Podman can be 'very verbose'.

https://github.com/containers/toolbox/pull/289
2019-11-19 13:38:41 +01:00
Debarshi Ray
2a099e8049 Add a reset command
The 'reset' command is meant to factory reset the local Podman and
Toolbox installations. Every now and then early adopters and testers of
Toolbox have to do this when their local Podman state has gotten
irrecoverably broken due to some Podman bug.

It's useful to have a command that encapsulates all the steps to do a
factory reset, as opposed to having to spell them out separately. It's
easier to document, helps with user support, and can enable less opaque
error messages that suggest a way forward when nothing is working.

Since this command is meant to be used when the Podman installation is
completely broken, it must avoid using any Podman commands at all
costs. This is why it cannot use 'podman stop' to stop any running
containers, nor can it use 'podman unshare' to delete
~/.local/share/containers when running rootless. Instead, it relies on
the user rebooting the machine for the former, and uses newgidmap(1),
newuidmap(1) and unshare(1) to reimplement 'podman unshare' for the
latter.

Note that when running as root, some care has been taken to avoid
removing directories that might be owned by the operating system. eg.,
on Fedora /var/lib/containers/sigstore is owned by the
containers-common RPM.

https://github.com/containers/toolbox/pull/295
2019-10-21 16:27:41 +02:00
Harry Míchal
5e63e9ec9b Improve the help or usage output
A new help command has been added which either shows the toolbox(1)
manual or a manual page for a specific command. The '--help' flag is
now identical to the help command and can be placed after the COMMAND
segment in the list of command line arguments.

Due to a bizarre quirk in less(1) [1], the default pager used to render
manuals on most systems, the man(1) invocations need the standard error
stream to point to the controlling terminal, if any, to work. This
interferes with the global redirection of standard error to /dev/null
in the absence of the '--verbose' flag, and is worked around by
redirecting to standard output instead.

[1] It turns out that less(1) tries to open the controlling terminal
    device /dev/tty to get to the keyboard for accepting input.
    However, it doesn't have a controlling terminal when invoked via
    D-Bus to render a manual on the host. It then strangely falls back
    to using the standard error stream to get to the keyboard.

https://github.com/debarshiray/toolbox/pull/200
2019-09-04 20:54:13 +02:00
Harry Míchal
6b8593ec1d doc/toolbox: Shorten the description of the --verbose flag
https://github.com/debarshiray/toolbox/pull/200
2019-09-04 13:06:19 +02:00
Casey Jao
c2e41553db Unbreak setting up /home as a symbolic link
The whole idea behind commit 66e982af72 was to set up $HOME and
/home to match the host. Therefore, it's pointless to check if /home
is a symbolic link or not inside the toolbox container. The state of
/home needs to be checked on the host, and then the toolbox container
adjusted accordingly.

One crucial difference is that the toolbox container is created before
its /home can be adjusted. Earlier, there was the user-specific
customized image, whose /home was adjusted first, and then the toolbox
container created from that. This boils down to the following
invocation happening before the symbolic link can be set up:
  podman create --volume "$HOME":$HOME":rslave --workdir "$HOME" ...

As a result, on host operating systems like Fedora 29 where /home is a
symbolic link with $HOME pointing inside it, Podman populates /home
with the user's sub-directory inside the toolbox container. This
prevents the subsequent 'rmdir $HOME' from working, and consequently
kills the container's entry point.

Compare that to Fedora 30 and newer where this problem doesn't occur
because /home is a symbolic link but $HOME points inside the target
/var/home directory.

This is why $HOME is canonicalized before bind mounting it into the
container and the container's working directory is reverted back to the
default (ie. /).

Fallout from 8b84b5e460

https://github.com/debarshiray/toolbox/issues/185
2019-06-17 23:28:34 +02:00
Debarshi Ray
8b84b5e460 Drop the Buildah dependency and the user-specific customized image
This works by configuring the toolbox container after it has been
created, instead of before. The toolbox script itself is mentioned as
the entry point of the container, which does 'exec sleep +Inf' once the
initialization is done.

A new command 'init-container' was added to perform the initialization.
It is primarily meant to be used as the entry point for all toolbox
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.

As a result, the default name for the toolbox containers is now
fedora-toolbox-<version-id>, not fedora-toolbox-<user>-<version-id>.
For backwards compatibility, 'toolbox enter' and 'toolbox run' will
continue to work with containers using the old naming scheme.

https://github.com/debarshiray/toolbox/pull/160
2019-05-16 15:47:33 +02:00