Commit graph

177 commits

Author SHA1 Message Date
Tomas Hozza
b29d64c496 RHEL-90: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
01880a76a2 RHEL(85+): move qemuStageOptions() from distros to osbuild2
De-duplicate the `qemuStageOptions()` implementation from many distro
implementations and move it to the `osbuild2` package as
`NewQEMUStageOptions()`.

Adjust all affected pipeline implementations.

The `NewQEMUStageOptions()` function takes an optional format-specific
options argument, instead of a dedicated format-specific options (the
previously used qcow2 compat version). This is a preparation to produce
VMDK images with a different than default subformat.

Add unit test for `NewQEMUStageOptions()`.
2022-04-07 13:48:54 +02:00
Tomas Hozza
8697713ce8 osbuild2: rename Qcow2Options -> QCOW2Options
Make the format type options structure naming consistent.
2022-04-07 13:48:54 +02:00
Tomas Hozza
0e512e97d2 osbuild2: use aliased type for QEMU format, instead of string
Define a new aliased type `QEMUFormat` for the format type used by the
osbuild2 QEMU stage and define constants for all allowed values.

Use QEMU format type constants in all relevant places, instead of string
literals. Not using string literals minimizes the room for making a
typo.
2022-04-07 13:48:54 +02:00
Achilleas Koutsou
333bec57ef distro: deduplicate userStageOptions() in RHEL pipelines
Use single NewUsersStageOptions() from osbuild1 and osbuild2 instead of
implementing in each distro.
- Followup from ca8b371142, copied to the
  rest of the RHEL distro definitions.
- Added NewUsersStageOptions() to osbuild1 for rhel8 and rhel84.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Tomas Hozza
c9a08da29f Move rpmStageOptions() from stage_options.go to osbuild2
Deduplicate the `rpmStageOptions()` function implemented in every distro
`stage_options.go` to `osbuild2` package.

RHEL-8.4 and code using osbuild v1 manifests are not touched.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-04 13:27:42 +02:00
Tomas Hozza
c6507c21b9 distro: add cloud-init to VMDK image on RHEL-85/86/90
Install `cloud-init` by default on the VMDK image on RHEL-85/86/90 and
as a result also CentOS Stream 8/9.

Regenerate image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>

test cases fixup
2022-04-02 08:47:02 +01:00
Christian Kellner
61c1ccff21 distro/rhel90: ensure grub2.Config.Default is preserved
The `grub2.Config.Default` key is owned by `NewGrub2StageOptionsUnified`
and thus needs to be preserved in case there is a `Grub2Config` setting
present in the image configuration (`ImageConfig`).
2022-03-29 11:43:54 +02:00
Achilleas Koutsou
5825294dad distro/rhel86+90: enable the anaconda user modeule for image-installer
Enable the user module unconditionally for the image-installer:
- If users are specified for the kickstart file, the module is required
  to set up the users.
- If no users are specified, the module can be used at install time to
  create users.

Updated relevant test cases (manifests).
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
ebc3330cbd distro/rhel86+90: don't create users in the payload for image-installer
Users are created at install time now.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
974b0a434b osbuild2: deduplicate anacondaStageOptions()
Use single NewAnacondaStageOptions() from osbuild2 instead of
implementing in each distro.

The new function conditionally adds the user module when there are users
that need to be created at install time (image- and edge-installers).
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
cb186df208 obsuild2: deduplicate *kickstartStageOptions()
Use single NewKickstartStageOptions() and replace image-type-specific
implementations from each distro.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
2eef6e6e2d osbuild2: deduplicate groupStageOptions()
Use single NewGroupsStageOptions() from osbuild2 instead of implementing
in each distro.

The new function does not set the Group.Name field anymore.  The field
does not exist in the osbuild schema and was silently ignored.
The field in the stage has been marked 'omitempty' and the relevant
manifests have been updated.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
ca8b371142 osbuild2: deduplicate userStageOptions()
Use single NewUsersStageOptions() from osbuild2 instead of implementing
in each distro.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
db2910fed9 distro/rhel86+90: common error message for unsupported customizations
Use the same error message for both edge-installer and
edge-simplified-installer when an unsupported customization is added.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
3a1765a5a8 distro/rhel90: allow user and group customizations for edge-installer 2022-03-28 14:08:57 +02:00
Antonio Murdaca
66bc1e8b85 rhel8/9: fix path to fdo diun root certificates
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-24 18:23:39 +01:00
Tomas Hozza
2ec55b4c53 RHEL-90: use XBOOTLDR partition GUID for /boot
Use the Extended Bootloader Partition GUID for `/boot`, instead of the
Linux filesystem data GUID. This is useful for autodetection of a
partition purpose based on its GUID without reading the `/etc/fstab`
first.

Ensure that when creating mountpoints, e.g. when converting the
partitions layout to LVM, the `/boot` partition get the proper GUID
assigned.

Regenerate RHEL-90 and centos-9 image test cases.

Related to https://bugzilla.redhat.com/show_bug.cgi?id=2057231
2022-03-24 15:40:10 +01:00
Antonio Murdaca
5f2ad326a6 internal/distro/rhel{86,90}: drop console kargs from raw image deployment
Using the simplified installer we were experiencing slow system boots.
Turns out we're incurring into https://bugzilla.redhat.com/show_bug.cgi?id=1839923
This patch just drops the console kargs - to be aligned with the
anaconda installer that doesn't experience this slow down.
The slow down doesn't happen on virtual machines as there's always a
ttyS0 there

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-14 17:31:40 +01:00
Christian Kellner
dbd6f1f48c distro: add GPGKeyFiles option to ImageConfig
Add a new option `GPGKeyFiles` to ImageConfig that indicates which files
containing GPG keys should be imported into rpm. For now it will be used
by the osPipeline in rhel{86,90} to set the corresponding option in the
`org.osbuild.rpm` stage.
2022-03-05 21:04:24 +01:00
Antonio Murdaca
c1a896dd1d rhel{86,90}: define simplified installer build packages set
The edge installer and edge simplified installer build roots have
diverged, i.e. the latter need clevis/luks, so define a new pkg
set for the simplified installer extending the edge installer one.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-28 23:05:45 +00:00
Tom Gundersen
973b5141b3 ditro/rhel86: set volid like in rhel9.0
This is only required in RHEL9.0, but best practice is to always pin these things
down. Also increases uniformity between distros.

Simplify a bit the volid generator by making it require `rand.Rand` rather than
`io.Reader`, and hence eliminating the need for error handling.
2022-02-28 23:05:45 +00:00
Antonio Murdaca
3be67ad965 Simplified installer: add support for encrypted raw images
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-28 23:05:45 +00:00
Christian Kellner
19e7890f63 rhel90: automatically convert to LVM on fs customizations
Whenever we create a new mountpoint due to a user customization,
ensure the layout uses LVM, i.e. convert plain layouts to it, if
needed. This does not apply to rpm-ostree based systems, e.g. the
simplified installer since they will be using LUKS in 9.0.
Add "lvm2" to the build pipeline and thus generate new manifests
and image infos.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-28 17:09:30 +01:00
Christian Kellner
375c3c5cff rhel90: specify a minimum root size in the partition table
Specify a size for the root filesystem in the partition table,
which basically equates to a minimum size. In reality all image
types specify a lager image size and thus we enlarge the root
file system to more than the specified size for plain layouts.
But if we auto-convert an partiton layout to LVM we need a size
for the root partition.
Does not change any existing manifests.
This does not apply for ostree based systems like the simplified
installer.
2022-02-28 17:09:30 +01:00
Christian Kellner
e57cccc3fe disk: NewPartitionTable can wrap plain partitions in LVM
Add a new parameter `lvmify` to `NewPartitionTable` that, if set to
`true`, will cause the root partition to be wrapped in LVM in case
it is not in a LVM volume group. Set this to `false` for now so no
actual change should happen anywhere. Layouts where the root is
directly on a LUKS container are not yet supported.
Add tests for this.
2022-02-28 17:09:30 +01:00
Christian Kellner
69ac301af8 distro: add Grub2Config to ImageConfig
Add it to all distros (8.6, 9.0) that support using ImageConfig
2022-02-27 22:03:36 +01:00
Christian Kellner
f7fb727847 distro: add WAAgentConf to ImageConfig
Add it to all distros (8.6, 9.0) that support using ImageConfig
2022-02-27 22:03:36 +01:00
Christian Kellner
8f746698f0 distro: add PwQuality to ImageConfig
Add it to all distros (8.6, 9.0) that support using ImageConfig
2022-02-27 22:03:36 +01:00
Christian Kellner
adfdb2cd39 distro: add Authconfig to ImageConfig
Add it to all distros (8.6, 9.0) that support using ImageConfig.
2022-02-27 22:03:36 +01:00
Achilleas Koutsou
a7fbe916b7 distro/rhel86+90: set selinux in permissive mode in installers
SELinux in the installer environment is in permissive mode in regular
installation ISOs
2022-02-26 15:55:56 +00:00
Tomas Hozza
ccd0be8c34 RHEL-90: use C.UTF-8 for images that only have glibc-minimal-langpack
Change the default locale to `C.UTF-8` for RHEL-9.0.
For all the images which install `langpack-en`, keep using the
`en_US.UTF-8` locale. `C.UTF-8` is used as the default for:
 - edge-commit
 - edge-container
 - image-installer
 - qcow2
 - tar

Also change the default locale for the edge-simplified-installer
installer-tree pipeline, since its package set contains only
`glibc-minimal-langpack`.

Regenerate RHEL-90 and c9s image tests.

Fix #2206

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-26 11:29:35 +01:00
Ondřej Budai
d8d161480e rhel86/90: change isolevel of image-installer to 3
So it can contain payload bigger than 4GiB.

Related: rhbz#2056451
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-02-24 17:56:22 +00:00
Antonio Murdaca
522ef73f4c internal/{8,9}: add clevis deps to simplified installer
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-24 17:07:34 +01:00
Antonio Murdaca
74540bcee7 distro/rhel90: add fido dracut module and enable customizing onboarding
FDO secure device onboarding support for RHEL90.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-24 17:07:34 +01:00
Achilleas Koutsou
c4d6fcbe5b distro/rhel90: add lldpad and fcoe-utils to anaconda packages
Required by dracut modules.
2022-02-24 16:30:04 +01:00
Achilleas Koutsou
1762336891 distro/rhel86+90: add imageInstaller to aarch64 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
07705aea7a distro/rhel90: split out arch-specific packages for anaconda 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
82bec696b2 distro/rhel86+90: pipeline function rename 2022-02-24 16:30:04 +01:00
Achilleas Koutsou
9a8271a524 distro/rhel86+90: variable rename
Reflect the external name of the image type for clarity.
2022-02-24 16:30:04 +01:00
Gianluca Zuccarelli
62c44e86f9 disk: ensure minimum size for filesystems
This commit fixes #2347 by ensuring that a minimum
size of 1GB is set for all file systems. The only
exception to this is the `/usr` which is set to 2GB,
since this was the only mountpoint that was previously
being checked.
2022-02-24 11:00:35 +01:00
Gianluca Zuccarelli
4d83ae9878 distro/rhel86,rhel90: add /tmp mountpoint
The `/tmp` mountpoint was mistakenly left out
of the allowlist for previous distros. This
commit enables the ability to create the
`/tmp` filesystem for the rhel86 & rhel90
distros.
2022-02-24 11:00:35 +01:00
Achilleas Koutsou
91d9417f5a distro/rhel90: use new unified grub2 stage options
With the new grub2 stage options we have the following changes to the
grub2 stage:
- Set the WriteCmdLine flag to false to not write kernel command line
  options to grubenv.
- Don't set the kernel command line options in the stage options.

The kernel command line options are now only specified in the Kernel
command line stage (org.osbuild.kernel-cmdline) so we add all options
there:
- Image type options
- Blueprint options
- Partition-table-specific options

Updated manifests and image info.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-23 22:42:59 +01:00
Achilleas Koutsou
129536dad0 distro/rhel86,rhel90: don't write keys for ostree commits in user stage
Writing the key to the user home directory has no effect for ostree
commits.  Instead we write them using a fist-boot service.
In certain situations (e.g., when building an upgrade commit against an
existing parent), the user's home directory might not exist during the
build and the user key creation fails in the users stage, so let's
remove it entirely to avoid the issue.
2022-02-23 11:08:24 +01:00
Christian Kellner
34924c7af4 distro: use new GenImageKernelOptions in ostreeDeployPipeline
The new `GenImageKernelOptions` will retrun all needed kernel options
that are derived from the partition table. The only case - for now -
is if the partition table contains a LUKS decice, where the uuid of it
needs to be passed to the on the kernel command line so that it will
get unlocked.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
54a4616a7d distro: remove unused sfdiskStageOptions
This was replaced by the previous switch to `GenImage*Stages`.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
4a8cf5e4c4 distro: switch liveImagePipelines to use GenImage*Stages
Use the new `GenImage{Prepare,Finish}Stages` in all liveImagePipelines
methods. This should allow us to handle partition tables with LUKS2 and
LVM2 transparently. Since none of the existing layouts contain any of
those, nothing should currently change.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
d48d6f22e1 osbuild2: GenCopyFSTreeOptions takes filename not device
The only thing we needed from the passed in device was the filename,
so just pass in that directly.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
bd5b673a99 distro: use FindMountable() to get root filesystem
The `PartitionTable.FindMountable` method is the more generic version of
`PartitionTable.RootFilesystem` which returns a `Mountable` interface,
instead of a specific `Filesystem` object. This commit thus prepares for
the more generic case, like when root is a Btrfs sub-volume.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Christian Kellner
a95d7de9d9 distro: replace CreatePartitionTable() with NewPartitionTable()
Replace the old CreateParittionTable() function with the new one called
NewPartitionTable() which works with the new interface types and
supports container-type setups (LUKS, LVM ,and Btrfs).

Changed usage in distro packages to take and carry around a pointer to
the new PartitionTable rather than a concrete type.  The
NewPartitionTable() function returns a deep clone of the base
PartitionTable so the new pointer type can be moved and (if necessary)
modified freely without affecting the distro base PT.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00