Commit Graph

729 Commits

Author SHA1 Message Date
Brian C. Lane
1c6b083260 Try all packages when installpkg --optional is used.
Also sort the expanded list of packages so that any failures will
be consistent instead of depending on the randomness of a set().
And add better logging when things fail.

The core issue is that repodata may have packages that match globs, but
they cannot actually be installed (eg. sigrok-firmware). This can cause
*some* of the globbed packages to be installed before hitting the
failure package.

With this change it will log the expanded list of packages if a glob is
used. It will skip any packages that fail to install when using
--optional with the glob, and continue to install the rest.

Related: rhbz#1440417
2017-05-30 09:47:37 -07:00
Brian C. Lane
a92aa63491 pylint: Ignore different argument lengths for dnf callback.
It may or may not be used with a newer version of dnf. The callback
doesn't use the argument so just ignore it.
2017-05-24 09:13:42 -07:00
Jaroslav Mracek
10bbeac6d1 Adds additional callbacks keyword for start()
It reflects latest changes in dnf-2.5.0-1
2017-05-24 08:05:15 -07:00
Brian C. Lane
cc56a5b5c9 Add --noverifyssl to lorax (#1430483)
Previously lorax had no way to use repos with self-signed certificates.
This adds the --noverifyssl cmdline option which will ignore certificate
errors.

Resolves: rhbz#1430483
2017-03-08 13:27:22 -08:00
Brian C. Lane
f8c9e8c120 Print the full NEVRA when installing packages.
(cherry picked from commit 92e60d7dd1)
2017-01-30 09:43:31 -08:00
Yuval Turgeman
46277f36db Fixed NameError on result_dir when calling with --image-only
Signed-off-by: Brian C. Lane <bcl@redhat.com>
2017-01-13 13:38:33 -08:00
Colin Walters
3fa3d20489 imgutils: Don't relabel /ostree
OSTree is a deduplicating hardlink store using a new file path
`/ostree`, which SELinux policy doesn't know about.  However, OSTree
has SELinux support built in, and rpm-ostree (for example) uses this
to ensure the attributes on files stored there are simply always
correct.  Relabeling it will corrupt it.

Hence, let's skip it.
2016-11-16 16:39:53 -05:00
Pat Riehecky
7ca356845b Added option to remove packages (parallel to installpkgs) 2016-11-14 09:06:10 -08:00
Colin Walters
5aa6fea8c3 templates: When a subprocess fatally errors, output its stderr directly
Right now we dump all subprocess output to `program.log`.  Unfortunately,
The pungi/koji stack doesn't know how to scrape out the lorax logs.

And even when running interactively, it's annoying that *some* fatal
errors show up on stderr, but if it's from a subprocess, I need to go
over and `tail program.log`.

Let's output the subprocess stderr directly, since the user is
going to want it prominently anyways.
2016-11-14 09:04:08 -08:00
Igor Gnatenko
ef5475e552 adapt to DNF 2.0 API changes
References: https://bugzilla.redhat.com/show_bug.cgi?id=1380566
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-09-30 09:09:41 -07:00
Brian C. Lane
492ab9e4a5 livemedia-creator: Check for packaging failures in the logs (#1374809)
anaconda-26.1 changed how package scriptlet failures are handled. They
are now fatal, and anaconda hangs after logging an Installation failure.

ERR packaging: Installation failed: PayloadInstallError('DNF error:
Non-fatal POSTIN scriptlet failure in rpm package mlocate',)

Catch this (the 'packaging: Installation failed' part) and terminate the
image creation.
2016-09-21 09:00:49 -07:00
Manjunath A Kumatagi
f4a1302358 Add ppc64le kernel path
(cherry picked from commit b76fba85ea)
2016-09-08 12:12:07 -07:00
Brian C. Lane
37d36daa9c lorax: Add --rootfs-size (#1368743)
This controls how big the root filesystem is for the squashfs used in
the boot.iso, the default is 2GiB.

Note that larger rootfs sizes will require more memory and may cause the
build to fail.
2016-08-22 17:20:48 -07:00
Brian C. Lane
442d0a0140 Revert "Use size=10 by default"
This reverts commit e61223d486.

On systems with less RAM (eg. ARM with 4G) this size change causes the
build to get stuck.
2016-08-22 16:17:35 -07:00
Friedrich Schöller
c60338464b Allow supplying a disk image for PXE live systems
Fixes that the combination of command line arguments
"--make-ostree-live" and "--disk-image" lead to a program error.
2016-08-12 13:12:54 -07:00
Colin Walters
e61223d486 Use size=10 by default
I'm working on
https://fedoraproject.org/wiki/Changes/WorkstationOstree and when
using lorax to make an installer ISO with content embedded, I run out
of disk space since the desktop+various apps is large.

Since this ends up being compressed anyways, let's just bump the
currently arbitrary `2` to `10` - the only real cost I can think of is
going to be a few more superblock entries.
2016-08-12 13:05:40 -07:00
Brian C. Lane
658df4f3f9 Fix installpkg error handling
If the query filter doesn't return anything it would just ignore the
install request instead of logging and raising an error when
required=True.

This checks for no packages matching, and if required is True raises an
error after all of the requested packages have been processed, instead
of after the first one to fail.
2016-06-24 13:40:58 -07:00
Brian C. Lane
fe17f970c9 Switch installpkg default to --required
Previous versions of lorax assumed that installpkg was optional, and
would continue on if the PKGGLOB didn't match anything. But the majority
of the packages are required so this allows the boot.iso to be built
with missing packages that are hard to track down.

It makes more sense to make the PKGGLOB required and to flag the
few exceptions to this with --optional.
2016-06-24 13:40:58 -07:00
Brian C. Lane
748259619b Make sure cmdline config file exists (#1348304)
If the --config file doesn't exist lorax will fall back to its defaults,
which are probably not what you want. Now it will exit if it doesn't
exist.
2016-06-20 16:13:45 -07:00
Brian C. Lane
5ef7c093b1 Stop using undocumented DNF logging API
DNF doesn't want users to access base.logging anymore.

Lorax already takes over the "dnf" logger and directs it to ./dnf.log,
so it wasn't really being used.

This raises the debug level to DNF's custom DDEBUG, and sets it up so
that dnf.librepo.log and hawkey.log are next to dnf.log
2016-06-03 16:44:30 -07:00
Brian C. Lane
3485fe462c livemedia-creator: Always copy novirt logs before cleanup
Before attempting to cleanup any dangling anaconda mounts copy the
anaconda logs to their final location.

Also, catch failures to cleanup the mounts, log it, and continue trying
the other mountpoints. A cleanup failure will result in an InstallError
instead of a CalledProcessError.
2016-06-01 11:48:41 -07:00
Brian C. Lane
551b27a8fa Update lmc UEFI support to use the edk2-ovmf package
Fedora now has a edk2 package so use the OVMF code from there. This also
adds using a copy of OVMF_VARS for each boot instead of reusing the one
provided by the package.
2016-05-17 16:44:22 -07:00
Brian C. Lane
2f66212c0f livemedia-creator: Update make-pxe-live to support missing initramfs
In some cases the initramfs may not be present in /boot to save space.
Use it if present, otherwise use the kernel version to recreate the name
of it.

This also fixes problems with dracut running out of space when not using
--live-rootfs-keep-size
2016-05-05 08:22:59 -07:00
Brian C. Lane
50b15d72b5 Rebuild initramfs if it is missing
There's no reason to require the initramfs when we can rebuild it using
the version from the kernel. This adds handling of missing initramfs so
that lmc kickstarts can remove it from the squashfs, saving about 40M on
the iso.
2016-05-05 08:22:52 -07:00
Brian C. Lane
9559acfcb0 Add a new error to the log monitor.
Look for:

The following error occurred while installing.  This is a fatal error
2016-05-04 10:34:57 -07:00
Brian C. Lane
8615d58e80 Fix DataHolder to handle hasattr
It needs to raise an AttributeError if it doesn't have the attribute.
2016-05-04 10:34:02 -07:00
Brian C. Lane
9b151ec2bd Update ostree boot handling
This makes sure the contents of /boot are at the expected locations in
/boot and in sys_root. For partitioned images it mounts the separate
/boot partition on /boot. For both fsimage and partitioned images ir
binf mounts it to sys_root so that the kernel+initrd can be found.

The boot directory isn't always named boot.0, so wildcard it and let the
count check handle failure if there is more than 1.
2016-04-29 16:09:03 -07:00
Brian C. Lane
57a73fe0d4 pylorax: Add delete option to umount
umount tries to delete a mountpoint if it has lorax.imgutils in the
path. This doesn't work right if you try to umount something mounted
deeper on the path.

This adds a delete option, which is True by default, to skip the delete.
2016-04-29 16:09:00 -07:00
Brian C. Lane
6ed2aaed69 Refactor PXE live creation code
This moves the mounting inside make_live_images so that it isn't trying
to copy the fsimage while having it mounted.
2016-04-29 16:08:57 -07:00
Brian C. Lane
efb0cce9b8 Change --make-pxe-live --no-virt use a fsimage
Instead of a partitioned disk image. This will allow a single pass
of lmc to be used to create an ostree live PXE image.
2016-04-29 16:08:54 -07:00
Brian C. Lane
b72b41e690 Allow ostreesetup kickstart
Also make sure that a --make_pxe_live --no-virt doesn't use autopart or
other mountpoints.
2016-04-29 16:08:50 -07:00
Brian C. Lane
607d7c1eeb livemedia-creator: Make sure make-iso kickstart includes dracut-live
iso creation requires the dracut-live package, otherwise rebuilding the
initrd will crash. Since it takes a long time to discover let's fail
early.
2016-04-06 17:10:58 -07:00
Brian C. Lane
bae111d5a3 livemedia-creator: Simplify cleanup for no-virt
If an anaconda no-virt run crashes it can leave things mounted under
/mnt/sysimage. Previously anaconda-cleanup was used to handle this, but
it will also try to cleanup host mountpoints which isn't desired.
2016-04-06 17:04:42 -07:00
Brian C. Lane
701ab02619 Copying same file shouldn't crash (#1269213)
When using the template install command copying the same file to itself
shouldn't crash. Just log the error and continue.

Also copy the s390 configuration files for use with livemedia-creator

Resolves: rhbz#1269213
2016-04-06 16:59:43 -07:00
Brian C. Lane
f753a064b8 livemedia-creator: Use correct suffix on default image names (#1318958)
When an image name hasn't been passed, and the compression type is
something other than xz, the default image name should use the user
specified compression suffix.

Resolves: rhbz#1318958
2016-03-29 09:56:32 -07:00
Brian C. Lane
3740df3756 livemedia-creator: Pass -Xbcj to mksquashfs
Some cases of mksquashfs were not using -Xbcj when it is available for
the arch. This adds a function to return the correct args based on the
arch and the cmdline args.
2016-03-29 09:48:33 -07:00
Brian C. Lane
422a9a5859 ltmpl: Add compressor selection and argument passing to installimg
Allow the template to select a different compression type or arguments
for the installimg command.

On 32bit builds running inside a mock xz sees the full amount of system
memory which can result in xz failing with a memory error. This allows
the template to limit the amount of memory it tries to use.
2016-03-29 09:46:07 -07:00
Brian C. Lane
f616d37f59 image-minimizer: Fix argument parsing
Can't pass metavar to args that are just switches.
2016-03-29 09:44:53 -07:00
Brian C. Lane
b91e79d9bc livemedia-creator: Check selinux state and exit
lmc --no-virt was switching selinux to permissive if it was enforcing
and restore it when done. This works fine when it is the only session
running, but would cause problems if it was run in parallel.

It now only checks the state and exits with an error if it isn't already
disabled or in Permissive mode.

Users will need to run setenforce 0 before running lmc.
2016-03-28 16:40:16 -07:00
Brian C. Lane
a7fb48d0da livemedia-creator: Catch dnf download error
If there isn't enough space for DNF to download packages it will log:

"Not enough disk space to download the packages."

So add this to the messages in monitor that trigger an error.
2016-03-24 09:51:20 -07:00
David Shea
9612f9e16f Add a means of excluding packages from a glob
This makes package selection a little more roundabout, but it allows for
unused packages (and their dependencies) to be removed from globs during
the install phase.

dnf.subject.Subject is the class used by dnf's Base.install to select
packages, so the behavior of installpkg without --except options is the
same as it was before.
2016-03-22 13:25:01 -04:00
Brian C. Lane
0b9077ceaa Move argument parsers into pylorax.cmdline
This will make it possible to use sphinx-argparse to generate all the
documentation and manual pages.
2016-03-21 14:21:55 -07:00
Brian C. Lane
6798f7c5ec livemedia-creator: Fix off by 1024 error
commit 4699c88109 changed how the disk
size is estimated and not all users took into account that the return
value is in MiB.

This would result in qemu based iso installations having a rootfs.img
that was 1024x too large.
2016-03-21 12:14:28 -07:00
Brian C. Lane
8085395678 Change location of basearch to dnf.rpm.basearch (#1312087)
The dnf fix for the busted API change is also busted, so just change it
everywhere.
2016-03-09 16:41:11 -08:00
Brian C. Lane
3e9efdcf48 livemedia-creator: Change fsck.ext4 discard failures to errors
Something is causing problems with the ext4 rootfs.img when running with
no-virt inside koji. This results in a failed image that looks good
until you try to boot it.

make_squashfs will now return False if it fails, and make_live_image
will return None (instead of the result path). lmc will exit with a 1
and log an error.
2016-03-09 16:41:11 -08:00
Brian C. Lane
4fea0ba7f1 pylorax: proc.returncode can be None
So use %s to keep it from generating a Traceback. If a callback is used
and it exits before the process does the returncode can be None.
2016-03-09 16:41:11 -08:00
Brian C. Lane
4699c88109 livemedia-creator: Create runtime using kickstart partition size
When using no-virt the runtime filesystem size comes from the kickstart.
For virt installs lmc was creating a runtime filesystem that was just
slightly larger than the space used by the files installed by anaconda.
This can run into problems with larger filesystem. It is also
inconsistent behavior between virt and no-virt installations.

With this commit the virt runtime filesystem will also come from the
kickstart.
2016-03-09 16:41:11 -08:00
Brian C. Lane
8cf8877e50 pylorax: Fix undefind strings on subprocess crash
Set output_string and err_string to None so that a crash will not crash.
2016-03-09 16:41:11 -08:00
Brian C. Lane
a72e9aed0c livemedia-creator: Bump default releasever to 25 2016-03-04 08:57:55 -08:00
Brian C. Lane
f8316a7b89 livemedia-creator: Use qemu instead of virt-install
Switching to using qemu directly allows lmc to be more flexible. It can
now run from inside a mock chroot for creation of all image types,
inculding disk images, and can take advantage of KVM on the host system
if /dev/kvm device is present inside the mock.

It should also be possible to create cross-arch images, but without kvm
available this is likely to be a very slow option.
2016-03-03 17:22:50 -08:00