Commit graph

70 commits

Author SHA1 Message Date
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
Debarshi Ray
51fe2d3607 doc/toolbox: Update 2019-05-16 14:40:17 +02:00
Debarshi Ray
aa0e6222ff doc/toolbox-run: Style fixes 2019-05-14 17:26:02 +02:00
Toni Schmidbauer
2da4cc4634 Add a run command
This makes 'toolbox enter' similar to 'toolbox run $SHELL'.

The 'run' command is meant to spawn arbitrary binaries present inside
the toolbox container. Therefore it doesn't make sense for it to fall
back to /bin/bash, like it does for 'enter' if $SHELL is absent.

It's expected that users might use 'run' to create ad-hoc *.desktop
files. That's why it neither offers to create nor falls back to an
existing container like 'enter' does, because such interactions can't
happen when used in a *.desktop file. It's also a more advanced command
that new users are less likely to be interested in. Hence, this
shouldn't affect usability.

Some changes by Debarshi Ray.

https://github.com/debarshiray/toolbox/pull/76
2019-05-06 15:23:58 +02:00
Debarshi Ray
05da8023b4 doc/toolbox-enter: Mention the 'initial setup' and fallback behaviour
https://github.com/debarshiray/toolbox/issues/128
2019-04-30 12:19:36 +02:00
Debarshi Ray
b718fbdcda Ask for confirmation before downloading the base image
Currently, there's no easy way to get the size of the impending
download. Skopeo doesn't offer the size of the OCI image [1] and it's
debatable whether another 23 MB binary ought to be pulled in as a
dependency just for this.

Given that the default fedora-toolbox images are the only base images
available via a public repository, the size of the download is hard
coded to reflect the approximate size of the fedora-toolbox images.
These images are between 451 MB and 483 MB, so 500 MB should be a
reasonably suggestive approximate that shouldn't negatively surprise
users.

[1] https://github.com/containers/skopeo/issues/641

https://github.com/debarshiray/toolbox/issues/134
2019-04-26 18:41:04 +02:00
Toni Schmidbauer
08d1caf3c1 Add short variants for various options in 'create' and 'enter'
https://github.com/debarshiray/toolbox/pull/75
2019-04-12 16:22:42 +02:00
Debarshi Ray
e71af911f2 doc/toolbox-rmi: Fix typo
Fallout from 7acc9936cf
2019-03-14 14:06:57 +01:00
Debarshi Ray
1cdaf21203 doc: Fix the installation of manuals
The manuals shouldn't be installed in the top-level directory, but in
one of the sub-directories corresponding to the relevant section.

Fallout from 0a972dfccc
2019-03-06 17:08:22 +01:00
Debarshi Ray
c9a061c7b9 doc/toolbox-enter: Mention the underlying podman commands
It's useful to know things like a running toolbox container has to be
stopped before removal or 'rm --force' needs to be used, etc.. This is
implicitly tied to the fact that entering a toolbox container is
equivalent to a 'podman start' followed by a 'podman exec'.
2019-03-05 16:32:53 +01:00
Debarshi Ray
517c77a0d6 doc: Grammar fixes 2019-03-05 16:32:53 +01:00
Ondřej Zoder
7acc9936cf Add rm and rmi commands
https://github.com/debarshiray/toolbox/pull/45
2019-03-05 16:17:46 +01:00
Debarshi Ray
0a972dfccc Add manuals
https://github.com/debarshiray/toolbox/pull/66
2019-03-01 10:27:09 +01:00