Commit Graph

262 Commits

Author SHA1 Message Date
Brian C. Lane 66ce35d9b8 mkksiso: Fix check for unsupported arch error
An unsupported arch isn't an error, just skip running MdCdbootImg on
non-s390x systems.

Related: rhbz#2049192
2022-02-04 09:31:42 -08:00
Brian C. Lane 4634d16117 mkksiso: Improve debug message about unsupported arch
Related: rhbz#2049192
2022-02-03 16:32:47 -08:00
Brian C. Lane a9327d9f32 mkksiso: Add kickstart to s390x cdboot.prm
And regenerate the cdboot.img

Resolves: rhbz#2049192
2022-02-03 16:32:35 -08:00
Brian C. Lane ba872b915f mkksiso: Check the length of the filenames
With -joliet-long it allows longer filenames, but silently drops the
ones longer than 253 characters. Check for this and raise an error.

Related: rhbz#2028104
2021-12-09 09:38:06 -08:00
Brian C. Lane 1644a5db11 mkksiso: Check the iso's arch against the host's
mkksiso cannot be run on an iso from another arch, some of the files and
tools are arch specific. Catch this problem and tell the user that the
iso doesn't match the host's architecture.

Related: rhbz#2028104
2021-12-09 09:38:06 -08:00
Brian C. Lane fc5efafe18 mkksiso: Add missing implantisomd5 tool requirements
Related: rhbz#2028104
2021-12-07 15:23:40 -08:00
Brian C. Lane deffaeea86 mkksiso: Raise error if no volume id is found
It is possible the source iso doesn't have an id, or there is an errorr
reading it. Raise an error when this happens to make it more clear what
the problem is.

Related: rhbz#2028104
2021-12-07 15:23:33 -08:00
Brian C. Lane c5325eb010 mkksiso: Skip mkefiboot for non-UEFI isos
Related: rhbz#2028104
2021-12-07 15:23:09 -08:00
Brian C. Lane 0fa98f76ff mkksiso: Add -joliet-long
DVD's or user content may use filenames > 64 characters. This increases
the limit to 103.

Related: rhbz#2028104
2021-12-07 15:22:54 -08:00
Brian C. Lane 0ca53768e0 mkksiso: Return 1 on errors
Related: rhbz#2028104
2021-12-07 15:22:43 -08:00
Brian C. Lane f320b3c8f4 livemedia-creator: Change defaults to Red Hat Enterprise Linux 9
This changes the releasever and project defaults to RHEL 9 values.

Resolves: rhbz#2019133
2021-11-02 11:22:02 -07:00
Brian C. Lane 3c9131bb35 Fix pylint warnings about string formatting
and one about unused exception value.

(cherry picked from commit f783ff77d4)

Related: rhbz#2010542
2021-10-05 10:41:07 -07:00
Brian C. Lane d70f0629f9 mkksiso: cmdline should default to empty string
Related: rhbz#1975844
2021-06-25 13:15:15 -07:00
Brian C. Lane 5fa949a423 livemedia-creator: Check for mkfs.hfsplus
mkfs.hfsplus may not be installed so instead of crashing near the end of
the install check for it and print a useful error message.

Resolves: rhbz#1969743
2021-06-10 11:13:48 -07:00
Brian C. Lane b240c9bf1a livemedia-creator: RHEL9 only supports qemu-kvm
Return an error if --arch is passed, and drop the mapping to
qemu-system-<arch> from installer.py and replace it with
/usr/libexec/qemu-kvm

Resolves: rhbz#1955674
2021-05-05 11:26:09 -07:00
Brian C. Lane 4d14c4bed0 lorax: Strip ' from product cmdline argument
Temporary work around pungi issue:
https://pagure.io/pungi/pull-request/1463
2020-12-02 11:11:12 -08:00
Brian C. Lane 7616a10373 Remove lorax-composer, it has been replaced by osbuild-composer
Remove the code, related files, and tests.
2020-09-30 15:42:46 -07:00
Michel Alexandre Salim 0b9841d5f7 Fix EFI booting for ISOs generated by `mkksiso`
If the original ISO contains both `efiboot.img` and `macboot.img`,
the current `xorrisofs` invocation does not configure `efiboot.img`
to be bootable, only `macboot.img`.

This fix uses `>=` to compare `efimode` against `EFIBOOT`, since
`MACBOOT` implies `EFIBOOT` as well.

This is similar to the logic for `mkisofs`.

Fixes #1046.

Generated image confirmed to work, when comparing the reports:

  `xorriso -indev $PATH_TO_ISO -report_el_torito cmd`

```
❯ diff -u ~/xorriso-report-{orig,new}.log
--- /home/michel/xorriso-report-orig.log        2020-07-15 20:01:01.405289018 -0700
+++ /home/michel/xorriso-report-new.log 2020-07-15 20:01:19.183555423 -0700
@@ -1,6 +1,6 @@
--volid 'Fedora-S-dvd-x86_64-32'
--volume_date uuid '2020042219432600'
--boot_image isolinux system_area=--interval:imported_iso:0s-15s:zero_mbrpt,zero_gpt:'/home/michel/Downloads/Fedora-Server-netinst-x86_64-32-1.6.iso'
+-volid 'Fedora-32-btrfs'
+-volume_date uuid '2020071602410900'
+-boot_image isolinux system_area=--interval:imported_iso:0s-15s:zero_mbrpt,zero_gpt:'/home/michel/src/github/michel-slm/luks-kickstarts/iso/Fedora-32-WS-20200715-3.iso'
 -boot_image any partition_cyl_align=on
 -boot_image any partition_offset=0
 -boot_image any partition_hd_cyl=64
@@ -14,12 +14,6 @@
 -boot_image any load_size=2048
 -boot_image any boot_info_table=on
 -boot_image any next
--boot_image any efi_path='/images/efiboot.img'
--boot_image any platform_id=0xef
--boot_image any emul_type=no_emulation
--boot_image any load_size=11462656
--boot_image isolinux partition_entry=gpt_basdat
--boot_image any next
 -boot_image any efi_path='/images/macboot.img'
 -boot_image any platform_id=0xef
 -boot_image any emul_type=no_emulation
```

```
❯ diff -u ~/xorriso-report-{orig,new5}.log
--- /home/michel/xorriso-report-orig.log        2020-07-15 20:01:01.405289018 -0700
+++ /home/michel/xorriso-report-new5.log        2020-07-15 20:30:27.571644770 -0700
@@ -1,6 +1,6 @@
--volid 'Fedora-S-dvd-x86_64-32'
--volume_date uuid '2020042219432600'
--boot_image isolinux system_area=--interval:imported_iso:0s-15s:zero_mbrpt,zero_gpt:'/home/michel/Downloads/Fedora-Server-netinst-x86_64-32-1.6.iso'
+-volid 'Fedora-32-btrfs'
+-volume_date uuid '2020071603283100'
+-boot_image isolinux system_area=--interval:imported_iso:0s-15s:zero_mbrpt,zero_gpt:'./iso/Fedora-32-WS-20200715-5.iso'
 -boot_image any partition_cyl_align=on
 -boot_image any partition_offset=0
 -boot_image any partition_hd_cyl=64
@@ -17,7 +17,7 @@
 -boot_image any efi_path='/images/efiboot.img'
 -boot_image any platform_id=0xef
 -boot_image any emul_type=no_emulation
--boot_image any load_size=11462656
+-boot_image any load_size=11460608
 -boot_image isolinux partition_entry=gpt_basdat
 -boot_image any next
 -boot_image any efi_path='/images/macboot.img'
```

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
2020-07-16 08:48:58 -07:00
Brian C. Lane c9c1283c56 lorax: Add --skip-branding cmdline argument
Also document how branding currently works. See docs/lorax.rst

Resolves: rhbz#1826479
2020-04-21 15:57:54 -07:00
Brian C. Lane a0fce98109 Add --dracut-conf cmdline argument to lorax and livemedia-creator
This adds the ability to use a dracut.conf file instead of passing
--dracut-arg on the cmdline multiple times.
2020-01-16 09:26:27 -08:00
Florian Achleitner e82ae6b82a mkksiso: Add the option to set the ISO volume label
To distinguish from the base images, a different
volume label is useful.
Add a commandline option, pass it to the iso tool,
and replace the occurences of the label in isolinux
and grub config files.

Signed-off-by: Brian C. Lane <bcl@redhat.com>
2019-12-19 11:30:50 -08:00
Brian C. Lane 95fd12e1f0 mkksiso: copy all the directories over to tmpdir
Graft them from tmpdir instead of trying to use the source iso for some,
and tmpdir for the ones needing changes. This will prevent problems with
trying to remove files likes TRANS.TBL from a read-only filesystem.
2019-11-14 11:57:35 -08:00
Brian C. Lane f74a5cc4a6 mkksiso: Add a tool to add a kickstart to an existing boot.iso
This tool will add the kickstart to the boot.iso, edit the kernel boot
arguments so that the kickstart is used when the iso boots, as well as
allow adding extra files and directories to the / of the iso which can
then be used by the kickstart (they are found under /run/install/repo
while Anaconda is running).
2019-11-05 11:09:42 -08:00
Brian C. Lane 1b84f90963 lifted directories should be under share_dir and lib_dir
Otherwise passing --sharedir pointed to some other path will not use the
correct providers.
2019-10-16 09:17:53 -07:00
Evan Goode 2692e8138c Automatically upload composed images to the cloud
Currently, Azure, vSphere, and OpenStack are supported. See
https://github.com/weldr/lorax/pull/826 for more details about this new
feature.

I've called the upload library "lifted" as a reference to Seuss'
The Lorax -- in the book, the Lorax lifts himself up by the seat of his
pants through a hole in the smog clouds, and they start calling him the
"Lifted Lorax."

This adds new features to the /compose route under API v1
2019-10-16 09:17:53 -07:00
Pat Riehecky 2c141950b0 lorax: Add debug log of command line options 2019-07-09 17:22:27 -07:00
Pat Riehecky 1f811523b5 lorax: provide runtime lorax config in debug log 2019-07-09 17:20:39 -07:00
David Shea c941b82b0c Add a new output type, tar-disk.
This option will create an optionally compressed tarball containing a
disk image. This format is used by Google's Compute Engine.

This also adds a new option, tar_disk_name, to set the name of the disk
image that will be wrapped in the final tarball. opts.image_name
continues to be the final output file name.
2019-04-02 10:15:42 -04:00
Brian C. Lane 6c6e4fced1 Switch the --virt-uefi method to use SecureBoot
This updates the qemu arguments so that it will actually work, and
switches to using SecureBoot OVMF firmware.
2019-03-26 13:32:12 -07:00
Chris Lumens 022e9eba3e Run as root/weldr by default.
We need to be root to read the certificates that give access to the
package repos.  Right now, the alternative seems to be changing
permissions on the certs themselves, which seems less good.  We're
running anaconda as root anyway.
2019-02-11 16:20:39 -08:00
Brian C. Lane e4fe1aab32 lorax: Move default tmp dir to /var/tmp/lorax
If systemd's tmpfiles.d timer is executed while lorax is running it will
remove any files and directories older than 30 days. This is what has
been causing the occasional error where /proc/ would seem to vanish
during the install.

Upstream has proposed this solution, https://github.com/systemd/systemd/pull/11482
but until that is released we need a work-around to protect the lorax
files.

This commit does several things:

* Move the default tmpdir from /var/tmp/ to /var/tmp/lorax/
* Add a lorax.conf tmpfiles.d file that prevents systemd-tmpfiles from
  removing anything under /var/tmp/lorax/
* Add an exit handler to lorax so that temporary directories are removed on
  exit or on a python traceback.
* Use flock to lock access to the tempdir while lorax is running.
* Remove any unlocked tempdirs named /var/tmp/lorax/lorax.* at startup

Note that the exit handler will not remove the tempdir if lorax is
killed with a signal -- those are being caught by dnf and prevent the
exit handler from running.

systemd-tmpfiles cannot clean up the tempdirs at boot time because they
contain files labeled as shadow_t, so we have to remove those when lorax
runs. It uses the flock to prevent removing any directories created by
parallel instances of lorax and only removes ones that are unlocked.
Worst case they will be around until the first run of lorax after a
reboot.

If you want to keep the working directory around for debugging purposes
use --workdir /var/tmp/lorax/my-workdir and it won't be removed by
lorax.
2019-01-29 13:57:12 -08:00
Brian C. Lane fd173f7265 Add timestamps to program.log and dnf.log
In lorax, lorax-composer, and livemedia-creator.
2018-12-19 12:13:24 -08:00
Brian C. Lane 35b8957f12 Remove SELinux Permissive checks
Anaconda, Lorax, lorax-composer, and livemedia-creator can all now run
with SELinux in Enforcing mode. It does not need to be disabled and if
there are denials they should be reported as a bug.

Log the current state of SELinux when starting, update the
documentation.
2018-11-29 11:06:26 -08:00
Brian C. Lane c11bffc357 Add --no-system-repos to lorax-composer
Running lorax-composer --no-system-repos will prevent it from copying
the dnf repositories from /etc/yum.repos.d/ into the lorax-composer repo
directory. It will *only* use repositories setup using the sources api
or written to /var/lib/lorax/composer/repos.d/

If lorax-composer has previously been run without this switch the system
repos will need to be removed from the composer/repos.d/ directory. It
would also be a good idea to remove the cached metadata in
/var/tmp/composer/

Resolves: rhbz#1650363
2018-11-26 17:05:08 -08:00
Brian C. Lane befa3128d7 Move get_dnf_base_object into a module
This allows it to be imported by tests.
2018-10-29 13:49:54 -07:00
Marek Marczykowski-Górecki 27e611629f Add --squashfs-only option to drop inner rootfs.img layer
Make runtime directly into squashfs image. This reduces largely
unreproducible ext4 layer, but requires anaconda's dracut module
modification to properly mount the image.
2018-10-29 13:16:38 -07:00
Brian C. Lane 5409748e75 lorax: Log when SOURCE_DATE_EPOCH is used for the current time 2018-10-19 14:43:29 -07:00
Brian C. Lane d7951e3a10 Fix directory creation for blueprints
Depending on how lorax-composer is run setting up an empty blueprints
directory can fail. So this moves checking/creation until after the
other directories are created and uses make_owned_dir to make sure
ownership is correct.
2018-10-12 11:59:32 -07:00
Brian C. Lane 65b769984b Change make_dnf_dirs to be run as root
It needs to be root in order to set the ownership and permissions on the
directories that are under /var/lib/lorax/composer/

Refactor the directory creation into a utility function, and use a umask
of 0o006 to ensure that the parent directories created do not have o+rw
set on them (makedirs behavior is different between Python 3.6 and 3.7
so umask of 0 doesn't work consistently).
2018-10-12 11:59:32 -07:00
Adam Williamson 37f264c010 Don't try to append to DNF config value that can't take it
See https://bugzilla.redhat.com/show_bug.cgi?id=1595917 and
https://github.com/rpm-software-management/dnf/pull/1200 for
more on this. Briefly, DNF before 3.0 presented this config
value as a list...and mutating it worked. DNF from 3.0 until
3.6 presented it as a list...mutating it didn't work, but also
didn't *fail*, so this has actually not been doing anything on
DNF 3.x but we haven't noticed.

In DNF 3.6 values like this are presented as tuples instead of
lists, to try and catch usages like this, and it worked! We
need to change this one.

There is an additional weirdness here. tsflags is actually, in
libdnf terms, an OptionStringListAppend option: that means that
when something tries to *set* its value, the new value is just
appended to the existing list of values. This is very weird
behaviour when you're interacting with it like this, but
happens to be quite useful, as we can just 'set' the value to
a list like this and it will actually get appended (which is
what we want), and this one syntax happens to work correctly in
DNF 2.x, 3.0 through 3.5.1, and 3.6.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-10-02 14:07:06 -07:00
Brian C. Lane 51c73f7570 Always update repo metadata when building an image
When the kickstart is handed off to Anaconda for building it will
download its own copy of the metadata and re-run the depsolve. So if the
dnf cache isn't current there will be a mismatch and the build will
fail to find some of the versions in final-kickstart.ks

This adds a new context to DNFLock, .lock_check, that will force a check
of the metadata. It also implements its own timeout and forces a
refresh of the metadata when that expires because the dnf expiration
doesn't always work as expected.

Resolves: rhbz#1631561
2018-10-02 13:59:42 -07:00
Adam Williamson 5c0dfb74e6 Ditch all use of pyanaconda's simpleconfig
lorax uses pyanaconda's SimpleConfigParser in three different
places (twice with a copy that's been dumped into pylorax, once
by importing it), just to do a fairly simple job: read some
values out of /etc/os-release. The only value SimpleConfigParser
is adding over Python's own ConfigParser here is to read a file
with no section headers, and to unquote the values. The cost is
either a dependency on pyanaconda, or needing to copy the whole
of simpleparser plus some other utility bits from pyanaconda
into lorax. This seems like a bad trade-off.

This changes the approach: we copy one very simple utility
function from pyanaconda (`unquote`), and do some very simple
wrapping of ConfigParser to handle reading a file without any
section headers, and returning unquoted values. This way we can
read what we need out of os-release without needing a dep on
pyanaconda or to copy lots of things from it into pylorax.

Resolves: #449
Resolves: #450

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-08-30 16:21:09 -07:00
Brian C. Lane 4d9ef60460 Add support for DNF 3.2 module_platform_id config value
This borrows simpleconfig.py from Anaconda to make parsing os-release
easier.

It defaults to platform:el8
2018-08-29 11:04:50 -07:00
Lars Karlitski be5d50e6f3 Set TCP listen backlog for API socket to SOMAXCONN
A value of 1 is too low for heavy users of the API, such as the weldr-web
interface.

This is also systemd's default for sockets it opens. Using lorax-composer with
socket activation already results in a backlog of SOMAXCONN connections.
2018-08-20 14:54:07 -07:00
Brian C. Lane b1dd22afa6 Log and exit on metadata update errors at startup
A bad system repo can cause lorax-composer to fail to start. Instead of
a traceback log the error and exit.

(note that the exit still results in an OSError traceback due to part of
it running as root, this needs to be addressed in another commit).
2018-07-18 16:09:03 -07:00
Brian C. Lane 460a277d4e Check the compose templates at startup
Depsolve the packages included in the templates and report any errors
using the /api/status 'msgs' field. This should help narrow down
problems with package sources not being setup correctly.
2018-07-13 10:18:07 -07:00
Brian C. Lane 56926baaec Add the ability to enable DNF plugins for lorax
Pass --dnfplugin='*' to enable all of them.
Pass --dnfplugin='plugin-name' to enable one fo them. You can use it
multiple times to enable multiple plugins. Globs work as well.
2018-06-22 09:07:01 -07:00
Brian C. Lane d8ce013a2b Add --dracut-arg support to lorax
Use it to override the default dracut arguments (displayed as part of
the --help output). If you want to extend the default arguments they
all need to be passed in on the cmdline as well. eg.

--dracut-arg='--xz' --dracut-arg='--install /.buildstamp' ...

Resolves: rhbz#1452220
2018-06-06 17:10:35 -07:00
Brian C. Lane c9ca451568 gevent has deprecated .wsgi, should use .pywsgi instead
https://github.com/gevent/gevent/blob/master/doc/api/gevent.wsgi.rst
2018-06-05 14:57:21 -07:00
Brian C. Lane 48e318b391 Add support for systemd socket activation
Instead of enabling lorax-composer.service enable lorax-composer.socket
and it will start lorax-composer on first access to
/run/weldr/api.socket
2018-05-14 13:57:44 -07:00