Commit graph

206 commits

Author SHA1 Message Date
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
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
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
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
Debarshi Ray
c2f8e19e56 Update copyright notices
https://github.com/containers/toolbox/pull/688
2021-02-08 16:49:54 +01:00
Kan Li
f850f1efa4 pkg/utils, sh: Pass the USER environment variable to the container
The USER environment variable is set in different ways on different
operating system distributions. It's usually set when logging into a
new user session, but thereafter it may or may not get propagated into
new instances of a shell depending on how it's getting set. eg.,
Fedora sets USER in /etc/profile, but Ubuntu doesn't. This means that
shells running on a Fedora host and a Fedora toolbox container will
automatically have the USER environment variable set. However, it's
only available on Ubuntu hosts, but not on Ubuntu toolbox containers.

Passing the USER environment variable to the container, if it's set on
the host, will avoid such inconsistencies in the environment.

https://github.com/containers/toolbox/pull/609
2021-01-07 15:42:27 +01:00
Kan Li
fca24b213e images, pkg/utils: Allow X11 clients to run as root
It's necessary to propagate the XAUTHORITY environment variable from
the host when an X11 client is run as 'sudo <some-client>'. If an X11
client is started inside a 'su -' session, then xauth(1) needs to be
present so that pam_xauth.so can add a new XAUTHORITY environment
variable to the 'su -' session.

https://github.com/containers/toolbox/pull/572
2020-10-29 16:08:32 +01:00
Martin Pitt
15173f8c25 Unbreak 'enter' on Fedora CoreOS
... and other hybrid set-ups where the host and container OSes aren't
the same.

The entry point of a toolbox container already runs as root:root.
Therefore, there's no need to run it with an additional group.
Interactive shells spawned by 'sudo su -' both inside the container
and on the host don't run with such an additional group either. They
run just as root:root.

This prevented toolbox containers from starting up on Fedora CoreOS
hosts, because CoreOS has both the 'sudo' and 'wheel' groups but the
fedora-toolbox images only have the 'wheel' group. Therefore, it
ended up calling 'podman create --group-add sudo ...', and since the
'sudo' group was missing from the image, the container failed to start.

The --group-add flag was added in commit 4bda42d414 when the
entry point ran as $USER as specified in the user-specific customized
image. The additional group was specified to retain consistency with
interactive shells run as $USER.

Since then, things have changed. There's no longer any user-specific
customized image and commit f74400f450 made the entry point run
as root:root. The --group-add flag should have been removed as part of
those changes.

https://github.com/containers/toolbox/issues/423
2020-08-28 23:38:49 +02:00
Debarshi Ray
80c02344df Silence SC2086
Otherwise https://www.shellcheck.net/ would complain:
  Line 729:
  if $podman_command image exists localhost/$base_toolbox_image
    >/dev/null 2>&3; then
                                            ^-----------------^
    SC2086: Double quote to prevent globbing and word splitting.

See: https://github.com/koalaman/shellcheck/wiki/SC2086

https://github.com/containers/toolbox/pull/537
2020-08-24 19:30:12 +02:00
Jose Miguel Parrella
89ff98d8c3 cmd/run, sh: Show an error if $PWD is missing inside the container
It might happen that the current working directory in the present
environment is missing inside the container that's going to be used.
So far, Toolbox would fail silently, which wasn't very obvious.

Some changes by Debarshi Ray and Harry Míchal.

https://github.com/containers/toolbox/issues/369
2020-06-23 19:26:59 +02:00
Debarshi Ray
14db6622dd Update copyright notices 2020-05-12 16:56:52 +02:00
Debarshi Ray
ecc3ce029b Update URL in /etc/krb5.conf.d/kcm_default_ccache 2020-05-12 16:24:42 +02:00
Harry Míchal
8f4070224f Check /usr/share/profile.d when bind mounting toolbox.sh
/usr/share/profile.d is the default location where toolbox.sh is
installed, even though, in practice, most (all?) distributions use
/etc/profile.d. It's reasonable to at least make the code work with the
default build values.

https://github.com/containers/toolbox/pull/362
2020-01-14 15:19:27 +01:00
Debarshi Ray
cb79382967 Unbreak 'enter' when SELinux is disabled
/sys/fs/selinux is only present when SELinux is 'enforcing' or
'permissive'. When it's disabled, /sys/fs/selinux doesn't exist and
sysfs doesn't let you create it either. Therefore, the attempt to wipe
out the toolbox container's /sys/fs/selinux by bind mounting
/usr/share/empty over it fails, and in turn prevents the container from
starting up.

Fallout from f9cca5719d

https://github.com/containers/toolbox/issues/344
2020-01-10 18:22:47 +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
3de605aec6 Give access to /var/mnt from the host operating system
On Silverblue, /mnt is a symbolic link to /var/mnt. Matching the
presence of /var/mnt on the host inside the toolbox container would
make things less confusing for users.

https://github.com/containers/toolbox/issues/92
2019-11-22 19:05:35 +01:00
Debarshi Ray
5595cc065f Do recursive bind mounts when binding locations at runtime
A subsequent commit will give access to /var/mnt from the host, if its
present, by bind mounting /run/host/var/mnt at runtime. However, it
turns out that an attempt to non-recursively bind it will error out, if
the host's /var/mnt already contains a mount point.

On the host:
$ sudo mkdir --parents /var/mnt/tmp
$ sudo mount -t tmpfs none /var/mnt/tmp

Inside the container:
$ sudo mkdir --parents /var/mnt
$ sudo mount --bind -o rslave /run/host/var/mnt /var/mnt
mount: /var/mnt: wrong fs type, bad option, bad superblock on
  /run/host/var/mnt, missing codepage or helper, or other error.

https://github.com/containers/toolbox/issues/92
2019-11-22 19:05:31 +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
Debarshi Ray
8bf970776b Check if /media is available
No /media on openSUSE.

https://github.com/containers/toolbox/issues/230
2019-11-21 17:31:03 +01:00
Debarshi Ray
f9cca5719d Wipe out the container's /sys/fs/selinux to not advertise SELinux
This is the second time a Podman regression has caused a selinuxfs
instance to leak into the toolbox container's /sys/fs/selinux,
tricking various components into trying to use SELinux. It might be
better to work this around in Toolbox until the situation in Podman is
figured out.

Based on an idea from Colin Walters.

https://github.com/containers/libpod/issues/4452
2019-11-20 16:35:54 +01:00
Debarshi Ray
9dc5281430 Deprecate all toolbox containers that don't use a reflexive entry point
Toolbox containers created prior to commit 8b84b5e460 didn't use
'toolbox init-container' as their entry points. This prevents them
from being configured at runtime through the entry points.

Being able to configure a toolbox container at runtime through the
entry point is very handy, as compared to doing it statically via
'podman create', because the configuration doesn't get permanently
baked into the container's definition. Instead, it's codified in
toolbox(1), which can be updated over time, and the container
reconfigured everytime it's started.

A deprecation notice is the precursor to actually dropping support for
these old containers in the future.

Preliminary testing suggests that toolbox containers created prior to
commit 8b84b5e460 already don't start on cgroups v2 systems. So,
this is mainly targetted at cgroups v1 users, who are still able to
work with those old containers.

https://github.com/containers/toolbox/pull/336
2019-11-20 16:07:13 +01:00
Akira TAGOH
2d6c59157c Ensure that 'run' has at least one argument for the command
Otherwise, it would lead to:
  $ toolbox run
  /usr/bin/toolbox: line 1287: shift: 4: shift count out of range
  toolbox: command '' not found in container fedora-toolbox-31

Fallout from 2da4cc4634

https://github.com/containers/toolbox/pull/332
2019-11-19 14:59:49 +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
1dca2bea09 Give access to the syslog and systemd journal sockets from the host
This makes the following work from inside a toolbox container:
$ logger "syslog: hello world"
$ python3 <<< "from systemd import journal; \
      journal.send('journal: hello world')"

https://github.com/containers/toolbox/pull/327
2019-11-07 16:24:29 +01:00
Debarshi Ray
ee82b94da4 Give access to the user's systemd journal entries from the host
It's now possible to use journalctl(1) to query the user's systemd
journal entries from the host. However, messages from other users and
the system aren't shown.

https://github.com/containers/toolbox/pull/327
2019-11-07 16:24:25 +01:00
Debarshi Ray
c0879a1691 Give access to /etc/machine-id from the host operating system
The machine ID is necessary to query the host operating system's
systemd journal, and currently toolbox containers have an empty
/etc/machine-id file.

Unlike /etc/resolv.conf, the machine ID is supposed to stay constant
once the host is booted. Therefore, it is safe to bind mount
/etc/machine-id from the host, as opposed to using a symbolic link;
because there's no chance of the file getting atomically updated on
the host and diverging from the bind mount due to being allocated a
new inode. Incidentally, this is also what Flatpak does.

A subsequent commit will use this to enable accessing the host's
systemd journal via journalctl(1) inside toolbox containers.

https://github.com/containers/toolbox/pull/327
2019-11-07 16:24:21 +01:00
Debarshi Ray
929e71b00f Bind mount the system libvirt instance at runtime
For what it's worth, this does alter the mount propagation flags by
adding 'slave'.

Earlier with 'podman create --volume ...' it was:
$ findmnt -o OPTIONS,PROPAGATION /run/libvirt
OPTIONS                           PROPAGATION
rw,nosuid,nodev,seclabel,mode=755 private

Now with 'mount --bind ...' it is:
$ findmnt -o OPTIONS,PROPAGATION /run/libvirt
OPTIONS                           PROPAGATION
ro,relatime,seclabel private,slave

This difference was ignored because it doesn't appear to cause any
real problem.

https://github.com/containers/toolbox/pull/327
2019-11-07 16:24:17 +01:00
Debarshi Ray
9436bbece0 Bind mount the system Flatpak directory at runtime
For what it's worth, this does alter the mount propagation flags by
adding 'slave'.

Earlier with 'podman create --volume ...' it was:
$ findmnt -o OPTIONS,PROPAGATION /var/lib/flatpak
OPTIONS              PROPAGATION
ro,relatime,seclabel private

Now with 'mount --bind -o ro ...' it is:
$ findmnt -o OPTIONS,PROPAGATION /var/lib/flatpak
OPTIONS              PROPAGATION
ro,relatime,seclabel private,slave

This difference was ignored because it doesn't appear to cause any
real problem.

https://github.com/containers/toolbox/pull/327
2019-11-07 16:24:13 +01:00
Debarshi Ray
819bb46aaa Add a helper function to bind mount locations at runtime
Subsequent commits will use this to perform some of the bind mounts in
the toolbox container's entry point, instead of doing them as part of
'podman create ...'.

Anything that's specified during 'podman create ...' gets statically
baked into the container's configuration, and is either difficult or
impossible to change afterwards. This means that toolbox containers
created with older versions of Toolbox keep diverging from those
created with newer versions. Hence making it complicated to keep older
containers working with a newer Toolbox.

In the case of bind mounts, a good chunk of the host's file hierarchy
is already bind mounted by 'podman create ...' under the toolbox
container's /run/host. Therefore, the more granular bind mounts like
$XDG_RUNTIME_DIR and /var/lib/flatpak can be performed by the
container's entry point at runtime using what's already inside
/run/host, and reduce the footprint of the static configuration.

Older containers created with Toolbox 0.0.10 onwards will see two bind
mounts for locations that get moved from 'podman create ...' to the
entry point. The presence of the second mount should be harmless.

Based on an idea from Colin Walters.

https://github.com/containers/toolbox/pull/327
2019-11-07 16:24:06 +01:00
Debarshi Ray
2e7ba83be2 Try to migrate to a supported OCI runtime if 'podman start' suggests so
Toolbox containers using runc as their runtime don't work on host
operating systems using cgroups v2. They need to be migrated to crun.
'podman start' throws a specific error for such containers:
  ERRO[0000]: oci runtime "runc" does not support CGroups V2: use
    system migrate to mitigate
  Error: unable to start container "fedora-toolbox-30": this version
    of runc doesn't work on cgroups v2: OCI runtime error

This error is identified by the phrase "use system migrate to mitigate"
to avoid encoding any assumptions about updating from cgroups v1 to v2
or downgrading in the other direction.

If the migration fails, 'toolbox reset' is suggested as the last hope.

https://github.com/containers/toolbox/pull/309
2019-10-29 14:12:41 +01:00
Debarshi Ray
3496029ed7 Split out the code that calls 'podman start'
A subsequent commit will leverage this to detect 'podman start'
failures caused by attempting to run runc-based toolbox containers on
cgroups v2 sytems, and try to migrate them if possible.

https://github.com/containers/toolbox/pull/309
2019-10-29 13:45:32 +01:00
Debarshi Ray
359fae59be Tweak the debug output
https://github.com/containers/toolbox/pull/309
2019-10-29 13:44:45 +01:00
Debarshi Ray
c7d2eb7a99 Log the Podman version into the debug output
Asking for the Podman version is one of the most common support
questions. So it can't hurt to have it in the debug output, especially
when the version is already being read to decide if migration is
necessary or not.

https://github.com/containers/toolbox/pull/309
2019-10-29 13:40:07 +01:00
Debarshi Ray
2142cdd612 Log the cgroups version into the debug output
The migration to cgroups v2 in Fedora 31 [1] has proved a bit stormy.
This is meant to help users self-diagnose whether their problems might
be originating from the use of cgroups v2.

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

https://github.com/containers/toolbox/pull/309
2019-10-29 13:34:33 +01:00
Harry Míchal
d3e0f3df06 Don't use a toolbox container until after it has been configured
It was possible to have 'podman exec' invoked against a toolbox
container before the entry point had finished initializing it. This
could lead to situations where '$USER' didn't yet exist inside the
container when 'podman exec' attempted running a binary as that user,
which would end up failing 'toolbox enter'.

There are a number of corner cases that need to be kept in mind while
implementing any kind of synchronization.

First, older containers don't use 'toolbox init-container' as their
entry point. This might mean that their start-up can't be synchronized
but they should still be kept working in their current state.

Second, once a container has been started, subsequent 'podman start'
invocations are NOPs. They won't lead to newer instances of the entry
point process being launched.

Third, the entry point process can crash or get killed due to an
out-of-band 'podman stop'. In such cases, 'toolbox enter' should not
get confused or deadlocked. It should give a meaningful error message
to the user.

Fourth, it would be nice to not have to touch the 'create' command so
that toolbox containers created with Toolbox 0.0.10 onwards can have
their start-up synchronized. This means that the host can't add any
new environment variable or bind mount to the container to agree upon
a path that's keyed by the container's identity and shared with the
host.

Given all these considerations, a timed busy loop that looks for the
presence of a stamp file, keyed by the entry point's PID, is the most
robust solution that can be verified as correct. Anything involving
file locks becomes increasingly complicated and hard to verify.

Under normal circumstances, the loop isn't expected to last more than
a few iterations. In case the entry point dies, the loop will time out
after approximately 25 seconds, the same interval as the default for
D-Bus method calls.

Some changes by Debarshi Ray based on an idea from Jan Hlaváč.

https://github.com/containers/toolbox/pull/305
2019-10-23 02:19:25 +02:00
Debarshi Ray
08fa8f5440 Quote a few variables to avoid triggering SC2086 in future
See: https://github.com/koalaman/shellcheck/wiki/SC2086

https://github.com/containers/toolbox/pull/305
2019-10-23 02:18:07 +02:00
Debarshi Ray
7d6ad61f32 Log the GID map of the user namespace in 'reset' into the debug output
https://github.com/containers/toolbox/pull/305
2019-10-23 02:18:03 +02:00
Debarshi Ray
1736e7037a Tweak the debug output
https://github.com/containers/toolbox/pull/305
2019-10-23 02:17:58 +02:00
Debarshi Ray
01cecdd1c2 Re-use a lower numbered file descriptor in 'reset'
POSIX only supports single digit file descriptors. Therefore, there's
value in being frugal about how we allocate them throughout the code.

The 'reset' command is very standalone and isolated from the other
code paths, because it's meant to be a last-ditch attempt to unbreak a
broken Podman installation. This can be exploited to re-use one of the
file descriptors that's used elsewhere in the code. In this case, file
descriptor number 4 is also used to control the spinner.

https://github.com/containers/toolbox/pull/305
2019-10-23 02:17:53 +02: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
Seppo Yli-Olli
0cf3c99377 Unbreak 'run' if container lacks files that are redirected to the host
There's no reason to fail the toolbox container's entry point, if the
container doesn't have its own copies of configuration files that are
ultimately going to be replaced with symbolic links to their host
counterparts.

https://github.com/containers/toolbox/pull/294
2019-10-18 19:15:59 +02:00
Debarshi Ray
de5e5df9b7 Update the label for tagging to reflect the project's new home
The older com.github.debarshiray.toolbox label is still used in most
places as an alias for the new name for the sake of simplicity and
compatibility; except in 'create', where the new label is explicitly
specified in addition to the older one to help popularize it via newly
created toolbox containers.

The older com.github.debarshiray.toolbox label should eventually be
dropped, but before that, the even older use of com.redhat.component
for tagging needs to be phased out. The com.github.debarshiray.toolbox
label was introduced in commit 0ab6eb7401, as part of Toolbox
0.0.8, right before the release of Fedora 30 [1]. Therefore,
com.redhat.component needs to stay at least until Fedora 29 is
supported.

[1] https://fedoraproject.org/wiki/Releases/30/Schedule

https://github.com/containers/toolbox/pull/293
2019-10-14 12:36:17 +02:00
Debarshi Ray
9474bf3548 Remove the hidden --sudo option and the /etc/sudoers.d snippet
A year ago, when rootless Podman was in its infancy, it was often
necessary to run rootful to test and shake out bugs in Podman. Things
are lot more mature now and this hasn't been necessary in the past few
months. Therefore, it's time to sunset this option.

Removing the --sudo option doesn't break backwards compatibility
because it was neither documented nor advertised to the user in any
way. It was a hidden option only meant to be used by those hacking on
Toolbox itself.

Note that this is different from running 'sudo toolbox ...', which is a
different use-case and uses separate code paths. This is about running
the rest of toolbox(1) as non-root and only invoking the container
tools like Podman as root.

This reverts commit 66ab4da724.

https://github.com/debarshiray/toolbox/pull/285
2019-10-04 15:50:52 +02:00
Debarshi Ray
13a5d15d2f Drop the coloured heading from 'list'
It seems cleaner to limit the use of colour to only marking running
containers. It's redundant to mention that the containers and images
were created by Toolbox because they are being shown by 'toolbox list'
anyway; and there's a second uncoloured heading in a different case,
that differentiates containers from images.

https://github.com/debarshiray/toolbox/pull/284
2019-10-04 14:50:16 +02:00
Debarshi Ray
88dc6bb0a9 Tweak the debug output and error messages
This should make it more obvious which part of the two-step process of
copying /etc/profile.d/toolbox.sh into a container the strings are
coming from.

https://github.com/debarshiray/toolbox/pull/279
2019-09-27 18:36:17 +02:00
Debarshi Ray
f647639b8a Be forgiving of a missing /etc/profile.d/toolbox.sh in 'run'
It's common for people to run the toolbox script straight out of the
source tree without installing it system-wide. In such cases, it's
likely that /etc/profile.d/toolbox.sh would be absent on the host, and
as a result also absent from the toolbox container.

The welcome messages and the primary shell prompt (or PS1) are set
through /etc/profile.d/toolbox.sh, so not having it does degrade the
user experience, but it's probably not severe enough to fail the 'run'
command.

This should have been part of commit 0db54946b4 which split the
copying of /etc/profile.d/toolbox.sh into a container into two steps to
avoid using 'podman cp'. It already tried to handle the missing file
in the first step, but not in the second step.

It's also nice to at least make the user aware of the situation by
printing an error message.

https://github.com/debarshiray/toolbox/pull/278
2019-09-27 18:20:57 +02:00
Jens Petersen
d517dc8b01 Update default release to 30 when running on non-fedora hosts
https://github.com/debarshiray/toolbox/pull/205
2019-09-27 17:13:39 +02:00
Debarshi Ray
32bd215f30 Unbreak 'create' on Silverblue
Podman defaults to bind-mounting locations as read-write when neither
'rw' nor 'ro' is explicitly specified.

On Silverblue /usr is mounted read-only on the host. Therefore, it's
not possible to bind-mount it as read-write inside the toolbox
container.

It turns out that Podman doesn't downgrade the default mount flag to
read-only when the source location is such, and this breaks creating
new toolbox containers on Silverblue. See:
https://github.com/containers/libpod/issues/4061

Fallout from d63b0a9c0f

https://github.com/debarshiray/toolbox/pull/276
2019-09-26 20:22:15 +02:00
Debarshi Ray
9145ae7690 Don't sanity check /etc/subgid and /etc/subuid when running as root
The /etc/subgid and /etc/subuid files are only meant to be used when
running rootless, and hence don't have an entry for root.

https://github.com/debarshiray/toolbox/issues/267
2019-09-23 18:23:33 +02:00