1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00
Commit Graph

36 Commits

Author SHA1 Message Date
Colin Walters
f6a4bada34 Rework utils and blockdev crates as -internals in prep for publishing
See https://github.com/coreos/bootupd/pull/963

Basically I just want a way to keep these in sync with bootupd;
we're not attempting to make a truly public library.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-07-01 08:25:26 -04:00
ckyrouac
e0301cd45a reinstall: Only pull the image if it's not already present
This enables using a local image with system-reinstall-bootc. A couple
drive by cleanups to the integration tests are included.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-06-06 11:20:51 -04:00
John Eckersberg
ca7b38f699 Rewrite containers org links to bootc-dev org
Literally just find and replace github.com/containers/bootc with
github.com/bootc-dev/bootc

We have the redirect in place so none of this is really important, but
I figure removing as many instances of the old repo and replacing them
with the current can't hurt for things like search engine
optimization.  Plus some non-zero number of people might assume one is
a fork of the other or something.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-05-22 09:07:36 -04:00
Colin Walters
3d93701f5a Merge pull request #1299 from ckyrouac/reinstall-mount-warning
Reinstall mount warning
2025-05-14 17:47:25 -04:00
ckyrouac
118dcedf22 reinstall: Add warnings about mounts
This uses findmnt to locate filesystem mounts that are on the same
source as the root mount. If any are found, the user is warned these
filesystems will persist unmounted in the bootc system. The user must
hit <enter> to proceed.

This does the same for logical volumes in the same group as root.

It also adds a generic warning to help the user understand what will
happen after rebooting into the bootc system.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-05-14 14:25:06 -04:00
ckyrouac
0ec300ebe1 reinstall: Only add --cleanup when the feature is available in the image
fixes #1312

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-05-12 17:40:31 -04:00
ckyrouac
4ab90d1721 reinstall: Cleaner formatting of podman bootc install message
This makes it easier to copy/paste (and read) the `podman ... bootc
install ...` command from the CLI output.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-05-05 15:09:33 -04:00
ckyrouac
577f29cd43 reinstall: Pass RUST_LOG env var into bootc install container
This enables `RUST_LOG=trace system-reinstall-bootc <image>` to print
trace messages for the bootc install invocation.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-05-05 12:09:54 -04:00
ckyrouac
b6300d858e reinstall: Enable post installation cleanup service
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-05-01 18:28:27 -04:00
ckyrouac
d457c25785 reinstall: Print ssh key clarification message
Trying to make the purpose of selecting a user more clear.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-11 15:28:20 -04:00
ckyrouac
1137169190 reinstall: Print reboot message after install completes
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-11 15:28:20 -04:00
ckyrouac
a1440373e0 reinstall: Use skip-fetch-check
The image is always pulled first, so let's avoid requiring the credentials to be baked
in the image for this check.

fixes #1205

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-04-08 11:03:30 -04:00
Colin Walters
8d97dddb14 Update to rustix 1.0
No major changes required; we get to drop one `unsafe` call
which is nice!

Looks like the ecosystem overall will need a fair bit of porting
before we can drop the 0.38 version though.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-30 16:57:50 +00:00
ckyrouac
3e1b0bf370 reinstall: Prompt before installing podman
Since podman needs to be installed at the start of the flow, let's add a
prompt so the user doesn't get surprised by the podman install
automatically running when simply testing the command.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-03-04 14:11:53 -05:00
ckyrouac
54983631df reinstall: Pull podman image early
This splits the `podman pull <image>` and the
`podman ... bootc install to-existing` command to prepare for
future features that will require inspecting the image before
constructing the bootc install command.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-03-04 14:11:53 -05:00
ckyrouac
8a5f5e24a1 reinstall: Use indoc to format prompts
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-02-27 14:21:53 -05:00
ckyrouac
d1b3ea1a22 reinstall: Use workspace=true for tempfile dep
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-02-27 14:09:22 -05:00
ckyrouac
0dd32de0f3 reinstall: Remove options from ssh keys
These options could contain a command which will cause the new bootc
system to be inaccessible.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-02-27 13:12:57 -05:00
ckyrouac
865cc8468a reinstall: Use openssh-keys crate to parse authorized_keys
This provides stricter parsing (e.g. fails when the authorized_keys file
contains invalid content), and is groundwork for removing the command
field from keys.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-02-27 13:12:43 -05:00
ckyrouac
870da95782 reinstall: Enable ssh keys for all users
Prior to this, the prompt to select users other that root would result
in an error. Now, all ssh keys will be gathered into a single file
and passed to bootc install to-existing-root --root-ssh-authorized-keys.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-02-27 10:54:18 -05:00
ckyrouac
3f5a43b40d reinstall: Parse sshd config into struct
This is prep for running authorizedkeyscommand to collect the user's
authorized keys.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-02-26 14:46:23 -05:00
ckyrouac
0f54ded99e reinstall: Support legacy images in system-reinstall-bootc
Add the "legacy" paramaters to the podman run invocation because there
are existing bootc images that need these parameters when running
install to-existing-root.

fixes #1090

Signed-off-by: ckyrouac <chriskyrouac@gmail.com>
2025-02-20 15:58:49 -05:00
Omer Tuchfeld
82de0967b7 Merge pull request #1120 from omertuc/promptt
reinstall: Move the no users prompt
2025-02-18 17:14:53 +01:00
Chris Kyrouac
bdc5bed4ee Merge pull request #1123 from omertuc/reword
reinstall: Reword single-user message
2025-02-18 10:19:00 -05:00
Chris Kyrouac
bdbd9cb613 Merge pull request #1121 from omertuc/podmanmsg
reinstall: Clarify that Podman is being installed automatically
2025-02-18 10:17:18 -05:00
Omer Tuchfeld
4c50ed6811 reinstall: Reword single-user message
I've reworded the multi-user message in the past but the single-user
message still had the older wording. This commit updates the single-user
message to match the multi-user message.

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-18 09:21:01 +01:00
Omer Tuchfeld
976a353473 reinstall: Clarify that Podman is being installed automatically
This warning message is shown when Podman is not found on the system. It
is not clear that the script will attempt to install Podman
automatically if it is not found. This commit changes the message to
make it clear that Podman will be installed automatically.

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-18 09:14:59 +01:00
Omer Tuchfeld
713897584b reinstall: Move the no users prompt
The prompt will now only be shown if there were truly no users found,
and not when the user simply explicitly opted out of including them.

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-17 16:54:23 +01:00
Omer Tuchfeld
bc9f4a20d5 reinstall: Fix the --user option in podman command
The --user option in podman command was not correctly split into two
arguments. This caused the command to fail with the following error:

```
Error: unknown flag: --user root:root
```

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-17 16:21:44 +01:00
German Maglione
5c6b616ace Set the UID/GID of podman-run to root
If the Containerfile has a USER directive, podman-run will execute the
bootc command as that user, making the installation to fail. So, let's
force the root as user/group to overwrite any possible USER directive.

Signed-off-by: German Maglione <gmaglione@redhat.com>
2025-02-14 17:10:46 +01:00
Omer Tuchfeld
d707b57119 reinstall: Ensure podman is installed
Fixes #1104

Make the podman dependency of system-reinstall-bootc optional

* Change the spec file to recommend podman instead of requiring it (this
  will make it more palatable to have this package included in distros
  by default)

* Now that podman is only recommended, the system-reinstall-bootc binary
  must check whether podman is installed and try to install it. This is
  done by launching the install-podman script that is included with the
  system-reinstall-bootc RPM. The exact location where
  system-reinstall-bootc will look for this script is defined in the
  build environment variable `SYSTEM_REINSTALL_BOOTC_INSTALL_PODMAN_PATH`

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-12 13:50:55 +01:00
Omer Tuchfeld
0fc7830916 Merge pull request #1092 from omertuc/warnssh
reinstall: warn if no users with authorized ssh keys are found
2025-02-12 13:17:09 +01:00
Omer Tuchfeld
05da485653 reinstall: warn if no users with authorized ssh keys are found
Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-10 20:01:26 +01:00
Omer Tuchfeld
961c0bf3a3 reinstall: avoid duplicate users in loginctl_users
See https://github.com/containers/bootc/issues/1093

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-10 13:57:22 +01:00
Omer Tuchfeld
ac07fb67de reinstall: handle loginctl compatibility issues
Solves https://github.com/containers/bootc/issues/1089

See diff for details.

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-07 12:52:30 +01:00
Omer Tuchfeld
0460c4df1d cli: add system-reinstall-bootc binary
# Background

The current usage instructions for bootc involve a long podman
invocation.

# Issue

It's hard to remember and type the long podman invocation, making the
usage of bootc difficult for users.

See https://issues.redhat.com/browse/BIFROST-610 and https://issues.redhat.com/browse/BIFROST-611

(Epic https://issues.redhat.com/browse/BIFROST-594)

# Solution

We want to make the usage of bootc easier by providing a new Fedora/RHEL
subpackage that includes a new binary `system-reinstall-bootc`. This binary
will simplify the usage of bootc by providing a simple command line
interface (configured either through CLI flags or a configuration file)
with an interactive prompt that allows users to reinstall the current
system using bootc.

The commandline will handle helping the user choose SSH keys / users,
warn the user about the destructive nature of the operation, and
eventually report issues they might run into in the various clouds (e.g.
missing cloud agent on the target image)

# Implementation

Added new system-reinstall-bootc crate that outputs the new
system-reinstall-bootc binary. This new crate depends on the existing utils crate.

Refactored the tracing initialization from the bootc binary into the
utils crate so that it can be reused by the new crate.

The new CLI can either be configured through commandline flags or
through a configuration file in a path set by the environment variable
`BOOTC_REINSTALL_CONFIG`.

The configuration file is a YAML file.

# Limitations

Only root SSH keys are supported. The multi user selection TUI is
implemented, but if you choose anything other than root you will get an
error.

# TODO

Missing docs, missing functionality. Everything is in alpha stage. User
choice / SSH keys / prompt disabling should also eventually be supported
to be configured through commandline arguments or the configuration
file.

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2025-02-06 01:50:04 +01:00