Commit Graph

1086 Commits

Author SHA1 Message Date
Brian C. Lane
d7a845c2d4 mkksiso: Fix check for unsupported arch error
An unsupported arch isn't an error, just skip running MdCdbootImg on
non-s390x systems.
2022-02-04 08:40:19 -08:00
Brian C. Lane
55eee7d22d mkksiso: Improve debug message about unsupported arch 2022-02-03 15:44:44 -08:00
Brian C. Lane
e1092c0ee9 mkksiso: Fix the order of the ppc mkisofs command 2022-02-03 15:43:53 -08:00
Brian C. Lane
eb4866c73d mkksiso: mkfsiso argument order matters
Fix the order on ppc64le so that the iso will boot properly.
2022-02-03 15:43:53 -08:00
Brian C. Lane
6b2c4d1a88 mkksiso: Add kickstart to s390x cdboot.prm
And regenerate the cdboot.img
2022-02-03 15:43:22 -08:00
Brian C. Lane
ab9068c2d0 image-minimizer: Check for missing root directory 2021-12-21 13:17:37 -08:00
Brian C. Lane
f8af828a80 image-minimizer: Fix utf8 error and add docs
rpm returns a header that is a string, no need to call decode() on it.

Also added documentation and a manpage for image-minimizer
2021-12-20 16:33:19 -08:00
Brian C. Lane
a01f62def7 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#2028048
2021-12-09 09:33:24 -08:00
Brian C. Lane
506c9a18ff 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#2028048
2021-12-09 09:33:24 -08:00
Brian C. Lane
f4e0adc090 mkksiso: Add missing implantisomd5 tool requirements
Related: rhbz#2028048
2021-12-07 11:19:48 -08:00
Brian C. Lane
8532b683a4 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#2028048
2021-12-07 10:52:02 -08:00
Brian C. Lane
710e65fa6f mount: Add s390x support to IsoMountopoint
kernel and initrd are under images/ on the iso.

Resolves: rhbz#2028089
2021-12-07 10:33:11 -08:00
Brian C. Lane
223f1755ec mkksiso: Skip mkefiboot for non-UEFI isos
Resolves: rhbz#2028097
2021-12-06 16:13:27 -08:00
Brian C. Lane
b3876337c3 mkksiso: Add -joliet-long
DVD's or user content may use filenames > 64 characters. This increases
the limit to 103.

Resolves: rhbz#2028044
2021-12-06 15:48:37 -08:00
Brian C. Lane
ec0eafacd9 mkksiso: Return 1 on errors
Resolves: rhbz#2028048
2021-12-06 14:57:41 -08:00
Brian C. Lane
6160d340c4 Fix monitor problem with split UTF8 characters
Sometimes, depending on the buffering, or length of data being received,
the end of the data could be the 1st byte or so of a UTF8 character.
This would cause a crash when trying to decode the raw data buffer.

This switches it to only decode once a full line has been found.
It also adds tests for the LogMonitor class.
2021-11-17 15:37:59 -08:00
Brian C. Lane
c4aba2e47f mount: Switch to using pycdio instead of pycdlib
Also add a root only test for IsoMountpoint.
2021-11-09 12:02:54 -08:00
Brian C. Lane
87f9f77e24 Move default releasever into pylorax DEFAULT_RELEASEVER
This makes it easier to update in one place, and hopefully not forget
for new releases.

Also update default platform id to f36.
2021-11-08 14:41:26 -08:00
Brian C. Lane
c811ba98d4 dnfbase: Handle defaults better 2021-10-28 14:19:50 -07:00
Brian C. Lane
1adbeef14c ltmpl: Add version compare support to installpkg
This adds support for enforcing version requirements on installed
packages. See the documentation in ltmpl.installpkg for details.
2021-10-28 14:19:50 -07:00
Brian C. Lane
f783ff77d4 Fix pylint warnings about string formatting
and one about unused exception value.
2021-09-27 09:08:37 -07:00
Brian C. Lane
a3810024ac Add fstrim to disk and filesystem image creation
Tests show that it may reduce disk usage a bit vs. just doing the
fallocate --dig-holes.
2021-09-24 15:11:44 -07:00
Brian C. Lane
5dfa95d769 mkksiso: cmdline should default to empty string 2021-06-24 16:14:19 -07:00
Jiri Kucera
35cb8f71a7 mount.py: Fix docstring 2021-06-15 15:50:38 -07:00
Brian C. Lane
ea72ace122 pylorax: Fix mksparse ftruncate size handling
Make sure that os.ftruncate() is called with an int() size. Before python
3.10 it used to handle this internally, but in 3.9 it was deprecated and
in 3.10 it now raises an error:

    TypeError: 'float' object cannot be interpreted as an integer

This makes sure that the size is truncated to an int(). The value is in
bytes, so truncation does not lose anything.
2021-06-11 09:28:16 -07:00
Brian C. Lane
5c0c1a0b84 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 10:47:45 -07:00
Brian C. Lane
322a810403 Add a context manager for dracut
dracut needs a reasonable chroot environment in order to run correctly.
This adds the DracutChroot context manager that sets up and tears down
mounts inside the root directory tree.

Switch to using it in creator.rebuild_initrds_for_live() and
TreeBuilder.rebuild_initrds()
2021-05-25 09:00:18 -07:00
Brian C. Lane
9cb34c5520 treebuilder: Add branding package to template variables
The branding package name doesn't always match the product name.  This
saves the branding package names as discovered in the enabled repos and
exposes it to the templates as branding.release and branding.logos --
which could potentially be None so the template needs to take that into
account.

Related: rhbz#1956205
2021-05-05 11:16:31 -07:00
Brian C. Lane
79a1fd9c46 livemedia-creator: Use inst.ks on cmdline for virt 2021-05-04 15:17:55 -07:00
Brian C. Lane
b75b692607 composer-cli: Remove all traces of composer-cli
weldr-client has replaced composer-cli so remove all of the code and
tests, adjust various things so they don't expect it to be available,
and rename some things like test/composertest.py to reflect its
exclusive use by lorax.
2021-04-26 15:59:35 -07:00
Brian C. Lane
730621808c composer-cli: Add support for start-ostree --url URL
Some ostree builds, like edge, require passing a url to it along with
the ref and parent arguments. This adds an optional --url argument to
the 'composer-cli compose start-ostree' command.

Resolves: rhbz#1929381
2021-03-03 16:24:07 -08:00
Brian C. Lane
b0318efead Remove LD_PRELOAD libgomp.so.1 from lmc --no-virt
The libgomp bug rhbz#1722181 has been closed since August.
2020-12-15 15:01:24 -08:00
Brian C. Lane
a33efe7c51 Add POSTIN scriptlet error to the log monitor list
This will cause livemedia-creator to terminate anaconda and exit when an
install hits an error that often causes anaconda to get stuck and not
exit.

Resolves: rhbz#1900596
2020-12-15 15:01:24 -08:00
Brian C. Lane
6400515880 Improve lmc no-virt error handling
When monitoring log output in livemedia-creator --no-virt it could get
stuck if the output from anaconda stops for some reason.

This changes execReadlines so that it will only read output when it is
available, will monitor the process state, and continue to call the
callback function.

It also adds a final timeout on proc.communicate() so that if Anaconda
becomes stuck and won't exit livemedia-creator will eventually exit.

When the no-virt callback terminates anaconda on an error it now sends a
TERM signal to all of the unshare process' children because just sending
it to unshare doesn't cause anaconda to exit.
2020-12-15 15:01:24 -08:00
Vojtech Trefny
78eec89cda Do not use '--loglevel' option when running Anaconda
This option has been removed, see https://github.com/rhinstaller/anaconda/pull/2864
2020-11-18 11:18:06 -08:00
Brian C. Lane
cd77f6d4d5 Update the default release version to 34 2020-11-02 13:13:36 -08:00
Brian C. Lane
ee2496d672 Switch to using upstream mk-s390image for s390 cdboot.img creation
mk-s390-cdboot has stopped working because the kernel outgrew the
hard-coded offset it used when creating cdboot.img. IBM now has a script
in s390utils that can do the same thing so use the upstream script
instead.

This drops mk-s390-cdboot script, switches the s390 templates to use
mk-s390image from s390utils.

It adds @ROOT@ to cdboot.prm, and sets inst.stage2 so that the installer
image will be found when booting the iso.

Resolves: rhbz#1891778
2020-11-02 11:46:02 -08:00
Brian C. Lane
46ab9e55f5 composer: Fix open file warnings 2020-10-07 10:51:41 -07:00
Brian C. Lane
abbd86a2f6 ltmpl: Fix deprecated escape in docstring 2020-10-07 10:51:41 -07:00
Brian C. Lane
c3c3605b70 Cleanup imgutil open files and processes
Because of the way that compress pipes things between processes it would
leave open file descriptors, and running processes around for a bit.
This waits for them to exit and closes the fds before returning.
2020-10-07 10:51:41 -07:00
Brian C. Lane
9d6211f1b3 Fix unclosed files
Python will eventually close open files, but it is recommended to
explicitly close them instead of waiting for the gc or program exit.

This fixes all the uses of open...read/write in the codebase, mostly in
tests.
2020-10-07 10:51:41 -07:00
Brian C. Lane
e3e8ff884b doc: Add Blueprint documentation and example to composer-cli.rst 2020-10-01 15:06:14 -07: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
Brian C. Lane
b7e69596e3 composer-cli: Make start-ostree parent and ref optional
This changes the start-ostree command to:

compose start-ostree [--size XXXX] [--parent PARENT] [--ref REF] <BLUEPRINT> <TYPE> [<IMAGE-NAME> <PROFILE.TOML>]

Both of them are optional, and if missing a "" is passed to
osbuild-composer. Also adds more tests for all the various possible
options and removes the provider and profile arguments.
2020-07-23 10:35:10 -07:00
Brian C. Lane
d830829929 composer-cli: Add a get_arg function
This is in preperation for adding more optional arguments. Adds a
generic get_arg function, tests for it, and converts get_size to use it.
2020-07-23 10:35:10 -07:00
Brian C. Lane
be2c9333fc Add log entry about dracut and /proc 2020-07-17 09:38:13 -07:00
Brian C. Lane
68c26bf87b Skip creating empty /proc/modules for dracut
Creating /proc/modules just quiets one dracut warning, it doesn't
actually effect the initrd that is created.

Now that mock is being run with netsharedpath set to exclude /proc is
causes problems for running lorax inside a mock, so just remove this to
prevent a crash when it doesn't exist.

Related: rhbz#1848201
2020-07-17 09:38:13 -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
03ff3bb53a composer-cli: Disable retry counter on connection timeout
urllib3 has a retry system that send the request again when the
connection fails, times out, is redircted, etc. This turns off retries,
which aren't very useful anyway.
2020-06-17 09:52:49 -07:00
Brian C. Lane
65d7397cf2 composer-cli: Change timeout to 5 minutes
In some cases osbuild-composer with an empty cache can take longer than
a minute to depsolve and start a compose.
2020-06-16 16:36:42 -07:00