Commit Graph

713 Commits

Author SHA1 Message Date
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
Brian C. Lane 7c0a6dffd6 livemedia-creator: Stop passing --repo to anaconda (#1304802)
When running a no-virt installation it was parsing the kickstart url
method and passing it to anaconda using --repo which prevents it from
working with url --mirrorlist method. There is no good reason to do
this, anaconda gets the method directly from the kickstart when it isn't
on the cmdline.
2016-02-12 10:22:52 -08:00
Brian C. Lane c15349c3da livemedia-creator: Add /usr/share/lorax/templates.d/ support 2016-02-11 10:54:54 -08:00
Brian C. Lane c86bd205c3 Add check for templates.d in the sharedir
This allows lorax to support multiple templates.

If there is no templates.d under the sharedir (/usr/share/lorax or the
directory passed by --sharedir) then the templates in that directory
will be used as they were previously.

If there are directories under templates.d the first one will be used,
unless --sharedir points to a specific one.
2016-02-10 17:14:11 -08:00
Brian C. Lane 87d941b81a livemedia-creator: Add kernel-modules and kernel-modules-extra to examples
If you don't do this DNF will add the debug kernel to the package set to
satisfy kmod() requirements.

Also bump the default releasever for lmc to 24.
2016-01-13 14:31:40 -08:00
Brian C. Lane ba4218ea98 livemedia-creator: Make sure the rootfs.img can be compressed
Use 4k blocks for the ext4 filesystem. Run fsck on the filesystem to
make sure deleted blocks are actually zeroed, and pass -Xbcj to
mksquashfs.

4k blocks and -Xbcj decreases the size by 2-6% depending on the
filesystem size. Zeroing the blocks of the ext4 fs improves things
dramatically. The problem is that DNF downloads the rpms before
installing them. In addition to forcing us to use a larger filesystem
than we would like it leaves data that is difficult to compress on the
image. The downloaded files are removed, but need to be zeroed out so
that mksquashfs can compress it.
2016-01-13 08:09:01 -08:00
Brian C. Lane b138b27bd8 Add --iso-name to use with --iso-only
Instead of reusing --image-name add a new argument to name the iso. This
way the disk image can be given a unique name with --image-name and the
iso can be named something different.
2016-01-11 09:54:40 -08:00
Brian C. Lane a39ed39313 Prefix temporary files and directories with lmc-
This makes it easier to spot things leftover from a crash.
2016-01-08 08:53:55 -08:00
Brian C. Lane 059e40a64b Add --iso-only option to --make-iso
This option removes all the extra build artifacts from --make-iso,
leaving only the boot.iso

It also supports naming of the final iso with --image-name
2016-01-08 08:53:55 -08:00
Scott K Logan 33d008d9f2 livemedia-creator: Fix calculation of disk_size in some cases
If the kickstart includes multiple definitions for the same mount point,
the last one defined is used. The current code includes all of them in
size calculation, and the image file that livemedia-creator makes is big
enough to hold all of the partitions, even though the duplicates are
ignored by Anaconda.
2015-12-22 12:44:30 -08:00
Brian C. Lane be685b51ac livemedia-creator: Add --image-type and --qemu-args options
Also alias --qcow2 to --image-type=qcow2

This allows --make-disk to be used to create any disk image that
qemu-img supports, not just raw or qcow2. See qemu-img --help for a list
of the supported image types.
2015-12-21 16:13:08 -08:00
Brian C. Lane 3d343aace8 pylorax: Add mkqemu_img function, alias mkqcow2 to it.
Preserve the API but add a more descriptive name for the function.
2015-12-21 16:13:08 -08:00
Brian C. Lane a3097b3085 Update things to make pylint 1.5.1 happy 2015-12-16 12:59:48 -08:00
Brian C. Lane ceabb7e214 Write a list of debuginfo packages to /root/debug-pkgs.log (#1068675)
Sometimes debugging a boot.iso requires using gdb, and finding the
corresponding debuginfo packages can be difficult. This writes the
matching -debuginfo package names and full ENVR to a file on the iso.
This can then be fed to dnf to install the correct debug packages.
2015-12-16 10:23:23 -08:00
Fabian Deutsch 0d22b72615 livemedia-creator: Raise an error if url is used without networking
Because livemedia-creator is using a media based installation by default,
no networking is brought up automatically. If then the url installation
method is used, it fails with an unclear reason.

This patch adds a check to raise a clear error if the url installation
method is used insisde the kickstart but no networking is configured.

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-12-02 16:31:38 -08:00
Fabian Deutsch 3a8659e4e4 livemedia-creator: Fix a small typo
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-12-02 16:29:31 -08:00
Fabian Deutsch 1a653dad7f livemedia-creator: Use discard during installation
This could help to keep the disk size down during installation,
if the FS within the VM is also supporting TRIM.

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
2015-12-02 16:29:31 -08:00