Commit Graph

680 Commits

Author SHA1 Message Date
Brian C. Lane 25394eefb7 Convert lorax-composer yum base object to DNF
This no longer uses the enabled configuration setting to select repos to
use. It uses everything in the repo_dir, and if system repos have not
been disabled it copies them into the repo_dir at startup, overwriting
the previous copy.
2018-05-17 10:34:34 -07:00
Brian C. Lane 9bf93d7154 Use 2to3 to convert the python2 lorax-composer code to python3 2018-05-17 10:34:34 -07:00
Brian C. Lane fc56671638 livemedia-creator: Move core functions into pylorax modules
This reduces the amount of code in livemedia-creator to the cmdline
parsing and calling of the installer functions. Moving them into other
modules will allow them to be used by other projects, like the
lorax-composer API server.
2018-05-17 10:34:34 -07:00
Brian C. Lane 3b1933b400 Update default releasever to Fedora 28 2018-03-15 13:52:20 -07:00
Brian C. Lane e1c839de1c Fix _install_branding
filter(provides=...) doesn't work with paths. The release packages
provide system-release so just look for that instead of a file.

Now it finds the release package and selects it along with the
corresponding logos package.

Note, this has been broken since commit 431ca6ce
2018-02-23 12:50:07 -08:00
Yuval Turgeman 68d1f4208d LMC: Make the QEMU RNG device optional
Added a new QEMU argument '--with-rng' to specify a RNG device other
than /dev/random or "none".

Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
2018-01-23 08:22:38 -08:00
Brian C. Lane dc635a97f6 Write the --variant string to .buildstamp as 'Variant=' 2018-01-17 09:38:16 -08:00
Brian C. Lane 629d04dc68 Fix installpkg exclude operation
Commit 8edaefd4d1 added the ability to install specific NVR's of
packages, but it did not adjust the exclude operation to account for
this.

This patch fixes that, applying the exclude only to the name part of the
package NVR, and changes some variable names to pkgnvr/pkgnvrs to make
it more clear that the content has changed to <name>-<version>-<release>
2018-01-15 08:38:43 -08:00
Brian C. Lane 73628a6e07 Log a more descriptive error when setfiles fails (#1499771)
Some lorax users run it from inside mock, which isn't able to detect
whether the host is in Permissive mode. This can lead to confusing
error messages, so this points them in the right direction.
2017-11-27 12:03:45 -08:00
Claudio Zumbo 8edaefd4d1 Allow installpkgs to do version pinning through globbing 2017-11-10 09:56:27 -08:00
Alexander Todorov fdb7593cb0 Rename parameters to match names that dnf uses
avoids 'Parameters differ from overridden method' warnings
2017-10-09 13:38:56 -07:00
Alexander Todorov ac1623d9cd Don't override 'line' from outer scope 2017-10-09 13:38:56 -07:00
Brian C. Lane 3382a24498 Fix systemctl command (#1478247)
When multiple units are passed to systemctl and one fails it doesn't
finish the others. Change the template command to call systemctl for
each unit individually.

This also removes the lvm2-activation-generator in runtime-cleanup.tmpl
2017-08-14 14:29:47 -07:00
Brian C. Lane e3dcb1e329 Add version output (#1335456)
Add -V to livemedia-creator, and log the running version when lorax or
lmc is started.
2017-08-14 13:54:02 -07:00
Brian C. Lane 8154b3f7a3 Include the dracut fips module in the initrd (#1341280)
This will allow anaconda to fetch kickstarts using https when installing
with fips=1

Leave vmlinuz and .vmlinuz.hmac in /boot

dracut-fips module needs the vmlinuz.hmac file in order to boot.
2017-08-14 13:20:27 -07:00
Brian C. Lane 7bc818507c Make sure loop device is setup (#1462150)
It seems that on rare occasions losetup can return before the /dev/loopX
is ready for use, causing problems with mkfs. This tries to make sure
that the loop device really is associated with the backing file before
continuing.

NOTE that using losetup --list -O to return the backing store
associated with the loop device can fail due to losetup truncating
the output filename if sysfs isn't setup. Instead of printing the full
path it will truncate it to 64 characters with a * at the end.

See util-linux lib/loopdev.c for the code that does this.

Use the existing get_loop_name function, which uses losetup -j, to lookup
the loop device associated with the backing store which should work the
same, just in the opposite direction.
2017-08-14 09:20:42 -07:00
Stephen Gallagher 2c3007beb8 Use anaconda-core to detect buildarch
For historical reasons, lorax used the 'anaconda' package as a
touchstone to determine the architecture for the build. At some
point, this package became a metapackage that pulls in both the
GUI and headless installers.

In the modular world, it's possible that only the core and TUI bits
may be available for use. The only subpackage of anaconda that is
guaranteed to be on any viable system is anaconda-core, so let's
switch to using that for the touchstone instead of the metapackage.

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2017-05-31 10:07:41 -07:00
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
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
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
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 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 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 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 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 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 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 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 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 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 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 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
Brian C. Lane e728e9ccee Include qemu modules in the initrd
This includes, among other things, virtio-rng. Without it the initrd may
take longer to initialize the random non-blocking pool on KVM
installations.
2015-11-23 09:33:42 -08:00
Brian C. Lane 9ba304d74b Add selinux switch to mktar
Sometimes you don't want to include the selinux xattrs in the tar (eg.
bsdtar has problems extracting them). They are still included by
default, but pass selinux=False to remove '--selinux --acls --xattrs'
from the tar cmdline.
2015-10-20 17:45:53 -07:00
Brian C. Lane b96fd98af3 Add submount directory to PartitionMount class
This allows the partition to be mounted on a directory underneath the
temporary directory, eg. /rootfs/, to help support creating other image
types without needed to move the files around.
2015-10-19 15:33:30 -07:00
David Shea f276f0f825 Fix the concatenation of error output.
The "x or y" construct does not have the precedence it looks like it
has.
2015-10-06 17:23:35 -04:00
David Shea 21b7654659 Look for crashes from the anaconda signal handler. 2015-09-24 16:53:02 -04:00
Brian C. Lane b3bf61bfdd Drop multiprocessing for do_transaction (#1208296)
When running the transaction in a separate process it crashes if you use
a https repo source. There's really no need for threads or processes in
lorax so drop it.

Also switched to using the DNF TransactionProgress API for progress
reporting.
2015-09-09 15:58:57 -07:00
Brian C. Lane bf255a41a5 Don't include early microcode in initramfs (#1258498)
The system the image boots on will likely not match the host where lorax
was run, and in some cases this can cause systems to hang.

Resolves: rhbz#1258498
2015-09-01 09:51:47 -07:00
Will Woods a3e1a275ff don't build upgrade.img anymore
fedup is deprecated and abandoned. Let's save time and disk by not
building `upgrade.img` when nothing is going to use it anymore.

For the record, performing upgrades using an initramfs from the new
system turns out to be fragile and hard to support:

* dracut initramfs isn't generic enough to handle booting all systems
  (e.g. missing vconsole.conf means you get keymaps wrong, so users
  can't unlock encrypted disks)

* The ABI differences between the two versions of plymouth, systemd,
  etc. requires nasty workarounds at best and causes nightmarish
  systemd crashes at worst

This patch removes all the code that built and installed `upgrade.img`.

For backwards compatibility, the API retains the `doupgrade` keyword
argument, and the `--noupgrade` flag is still accepted.
2015-08-31 16:24:39 -07:00
Brian C. Lane 522ec34360 Return the output from failed commands in CalledProcessError
Some callers expect CalledProcessError.output to have the output, so
pass up the stdout + stderr output.

This means failed runcmd template commands will log to program.log and
lorax.log
2015-08-04 10:50:37 -07:00
Brian C. Lane cfe4777042 Add execReadlines to executils.
Returns output in realtime instead of buffering it.
2015-07-30 09:02:48 -07:00
Brian C. Lane 11b8eb8b97 Add reset_lang argument to everything in executils.
Running anaconda from lmc needs to override the language reset,
otherwise libuser crashes because it cannot support "C".
2015-07-27 11:27:43 -07:00
David Shea 04d170bb09 Add a verification step to Lorax.run.
After the cleanup step, check that everything in /usr/bin and /usr/sbin
can still run. Currently, this just checks that ELF files have
everything they need to link, and scripts have an interpreter.

Verifying is on by default but can be skipped with --noverify
2015-07-20 16:18:20 -04:00
Brian C. Lane 8a8b4e1a45 Add a bit more overhead to the root filesystem size
When this is too small the rootfs can run into problems when used with a
live system. Doubling it leaves enough space for the system to run
properly during the installation and since it's all compresses it
doesn't make the image noticeably bigger.
2015-07-01 08:32:33 -07:00
Chris Lumens ffa25dd609 Move IsoMountpoint into its own module. 2015-06-01 14:27:32 -04:00
Chris Lumens d23605d3cc Move setup_logging into pylorax/__init__.py. 2015-06-01 14:27:29 -04:00
Chris Lumens 893791cf7d Break all the log monitoring stuff from LMC out into its own module. 2015-05-29 13:53:07 -04:00
Brian C. Lane 7cd329a065 Fix bug with product DataHolder overwriting product string. 2015-05-18 08:24:23 -07:00
Brian C. Lane 3560d12608 Update execWith* docstrings 2015-05-15 17:11:21 -07:00
Brian C. Lane 1a92b1b05e Convert to using pocketlint for pylint rules
Also cleanup some warnings.
2015-05-15 17:11:20 -07:00
Brian C. Lane eb22c69f29 Additional python3 changes
Add a 'lower' filter to the templates to replace string.lower which no
longer exists. Fix udev_escape, the strings are already unicode, and
drop --chdir from runcmd. It wasn't ever used, and passing cwd to the
new runcmd isn't supported.
2015-05-15 17:11:20 -07:00
Brian C. Lane e1a05d962c Use the execWith* methods from Anaconda
The previous ones were a bit of a kludge, the Anaconda ones have had a
lot of work put into them so let's just use them with slight modifications.
2015-05-15 17:11:20 -07:00
Brian C. Lane de0e662f51 Convert pylorax to python3
Fix up 2to3 complaints. I've decided to do with wrapping list
comprehension inside list() to get the generators to run in several
places instead of list(map( or list(filter( which seem less readable to
me.
2015-05-15 17:11:20 -07:00
Brian C. Lane a6e469e0e6 Clean up some pylint warnings
Mostly logging, using .format() on the strings.
2015-05-15 17:11:20 -07:00
Brian C. Lane 80ed5006d4 Add some more details about template rendering errors 2015-04-10 11:01:59 -07:00
Vratislav Podzimek d2c64b1b26 Check that the transaction process is still alive
If it terminates really badly (e.g. with SIGSEGV), it doesn't report any error,
just doesn't put anything to the queue. So instead of just blindly waiting on
the queue forever, check that the process is still alive if we don't get any
message in long time interval.
2015-03-25 16:59:02 +01:00
Colin Walters 67217f5642 Add ability for external templates to graft content into boot.iso
I originally added --add-template to support doing something similar
to pungi, which injects content into the system to be used by default.
However, this causes the content to be part of the squashfs, which
means PXE installations have to download significantly more data that
they may not need (if they actually want to pull the tree data from
the network, which is not an unusual case).

What I actually need is to be able to modify *both* the runtime image
and the arch-specific content.  For the runtime, I need to change
/usr/share/anaconda/interactive-defaults.ks to point to the new
content.  (Although, potentially we could patch Anaconda itself to
auto-detect an ostree repository configured in disk image, similar to
what it does for yum repositories)

For the arch-specfic image, I want to drop my content into the ISO
root.

So this patch adds --add-arch-template and --add-arch-template-var
in order to do the latter, while preserving the --add-template
to affect the runtime image.

Further, the templates will automatically graft in a directory named
"iso-graft/" from the working directory (if it exists).

(I suggest that external templates create a subdirectory named
 "content" to avoid clashes with any future lorax work)

Thus, this will be used by the Atomic Host lorax templates to inject
content/repo, but could be used by e.g. pungi to add content/rpms as
well.

I tried to avoid code deduplication by creating a new template for the
product.img bits and this, but that broke because the parent boot.iso
code needs access to the `${imggraft}` variable.  I think a real fix
here would involve turning the product.img, content/, *and* boot.iso
into a new template.
2015-03-19 16:48:16 -04:00
Brian C. Lane 11c9e0e8ee Add removekmod template command
removekmod GLOB [GLOB...] --allbut KEEPGLOB [KEEPGLOB...]

This can be used to remove kernel modules from under
/lib/modules/*/kernel/ while keeping specific items. This should be
easier than constructing find arguments to select the right things to
save.
2015-03-06 11:26:14 -08:00
Brian C. Lane 13de711548 Drop the dnf Base object deletion code and use reset
It appears that reset+fill_sack will now do the right thing and load the
state of the installed packages. Drop the hack with deleting the object.

Also add a double-check to make sure there really is a list of files
for anaconda-core before we run off and make an image without removing
anything.
2015-02-16 08:47:30 -08:00
Brian C. Lane 9ff5897eee Get the log directory from the configfile
In the lorax script create it if missing and override it with the
path of --logfile
2015-02-16 08:47:30 -08:00
Brian C. Lane 345cc89ee0 dnf: remove files from installed packages
This is a workaround for a current dnf bug, it doesn't update the state
of the packages after they are installed so we tear down the base dnf
object and create a new one pointing to the installroot.

There is an additional issue with the list of files returned, hawkey and
dnf don't appear to make a distinction between files, dirs and ghosted
dirs like yum did, this can result in too much being removed (eg. all of
/etc/selinux/) so we only remove files not directories.
2015-02-16 08:47:30 -08:00
Brian C. Lane 431ca6cea4 Switch lorax to use dnf instead of yum
pylorax users will need to change to using dnf and pass a dnf.Base()
object as the dbo argument instead of a yum object as the yum or ybo
argument. See the lorax script for an example of how to do this.

The lorax cmdline argument --excludepkgs has been removed since dnf
doesn't appear to have any way to support it and packages should be
controlled using templates anyway.
2015-02-16 08:47:30 -08:00
Radek Vykydal d16bdcaf6d Add --live-rootfs-size option. 2015-01-16 10:01:41 +01:00
Radek Vykydal a19c509430 Add --make-pxe-live and --make-ostree-live (for Atomic) targets.
--make-pxe-live target generate live squashfs and initrd for pxe boot.
Also generates pxe config template.

--make-ostree-live is used for installations of Atomic Host. Additionally to
--make-pxe-live it ensures using deployment root instead of physical root of
installed disk image where needed. Atomic installation needs to be virt
installation with /boot on separate partition (the only way supported by
Anaconda currently). Content of boot partition is added to live root fs so that
ostree can find deployment by boot configuration.
2015-01-13 12:45:06 +01:00
Brian C. Lane d96ed99621 Add log monitoring to lmc --no-virt installation
Previously if there was an error during a novirt installation that
didn't exit the process there was no way to detect it. This uses the new
--remotelog option for anaconda to monitor the logs for errors using the
same criteria as it does when monitoring a virt install. If there is an
error the anaconda process will be terminated and the logs will be
gathered up into ./anaconda/
2015-01-09 15:05:12 -08:00
Colin Walters 52d962d613 Add --includepkg argument
Recently, Fedora has been trying to do a 3 product split.  As part of
that, lorax was changed to do "installpkg lorax-product-*" via
provides.

I think that approach is awkward; a much simpler approach is to simply
specify the product package as input to lorax on the command line, via
external rel-eng scripts.

This patch therefore adds --includepkg (and we should probably add an
option to remove the implicit lorax-product-* glob).
2014-12-05 15:58:58 -08:00
Brian C. Lane b064ae6166 Add installimg command for use in the templates
installimg SRCDIR DESTFILE
  Create a compressed cpio archive of the contents of SRCDIR and place
  it in DESTFILE.

  If SRCDIR doesn't exist or is empty nothing is created.

Examples:
  installimg ${LORAXDIR}/product/ images/product.img
2014-11-05 09:58:51 -08:00
Brian C. Lane 018c9911a1 livemedia-creator: Add --no-recursion to mktar (#1144140)
tar recurses into directories by default, but find is feeding it all the
files and directories so the tar it produces is considerably larger than
it needs to be due to duplicate files. Add --no-recursion flag so that
tar will only add the specific files and directories piped to it by find.

Related: rhbz#1144140
(cherry picked from commit a8681aca4e)
2014-09-23 11:48:26 -07:00
David Shea 25b4d539ac Let the plymouth dracut module back into the ppc64 upgrade.img
The 32MiB size limit does not apply to upgrade.img since it's installed
to /boot by redhat-upgrade-tool instead of downloaded through TFTP. The
warning in rebuild_initrds will still be triggered by an upgrade.img
over the limit, but this doesn't halt the compose and it's probably not
a bad thing to know about.
2014-09-15 11:27:58 -04:00
Brian C. Lane 364ce363f7 Add ppc64le arch (#1136490)
basearch is ppc64le so we needs to check for that in addition to ppc64.

Resolves:rhbz#1136490
2014-09-03 10:41:42 -07:00
Peter Jones c789f20b66 Don't emit media labels with spaces in them.
Spaces cause various bugs like #923374 and #855849 , and it would be
better if we just didn't use them.

Note that there's a corresponding pungi change to go with this.

Signed-off-by: Peter Jones <pjones@redhat.com>
2014-07-01 11:59:19 -04:00
Colin Walters 66359415be Add --add-template{,-var}
What I need is to make something like the traditional DVD which also
includes packages.  At present this is apparently handled by the
entirely separate pungi tool.

At the moment for me, it's the least bad option to modify lorax to
inject data from an external source than to create a new tool, or
attempt to also modify pungi to do this.

This would also allow pungi's DVD creation to eventually be a set of
external templates for Lorax.
2014-05-12 16:04:28 -07:00
Brian C. Lane d25c0b0594 Update copyright statements 2014-05-09 15:13:39 -07:00
Brian C. Lane 6d47689a33 Cleanup pylorax pylint warnings 2014-05-09 08:10:41 -07:00
Brian C. Lane 9e15705bb9 Clean up download and install output
Commit d2ae92b4b3 patched up the download counter and progress
display. Yum no longer provides the needed information so now we get the
total number of packages from the start of the transaction.

This also turns off colors when stdout is not a tty, and only prints the
install progress once so that piping to a logfile isn't flooded with
useless characters.
2014-04-25 06:55:56 -07:00
Brian C. Lane d04a99e8f4 livemedia-creator: Add support for making tarfiles
This adds the --make-tar option which will produce a xz compressed tar
of the root filesystem. This works with either virt-install or no-virt
modes. Use --image-name to set the output filename.

--compression is used to set the compression type to use, which defaults
to xz. Supported types are xz, lzma, gzip and bzip2.

--compress-arg is used to pass arguments to the compression utility.
2014-04-07 10:58:32 -07:00
Mark Hamzy cc2f98bfc5 support ppc64le in lorax
Add support for the ppc64le architecture in lorax.

Signed-off-by: Brian C. Lane <bcl@redhat.com>
2014-03-27 10:06:41 -07:00
Brian C. Lane 07d5cb176d Add support for creating qcow2 images 2014-03-13 09:10:24 -07:00
Brian C. Lane c95cb07bc3 utf-8 encode yum actions before displaying them (#1072362)
Otherwise running lorax in other locales will crash.

Resolves: rhbz#1072362
2014-03-05 07:40:14 -08:00
Brian C. Lane d89f01af21 Check initrd size on ppc64 and warn (#1060691)
ppc64 initrd cannot be larger than 32MiB, so log a warning if it is too
large.

Related: rhbz#1060691
2014-02-13 13:20:16 -08:00
Brian C. Lane 03217e4eee Remove drivers and modules on ppc64 (#1060691)
Remove more drivers and remove plymouth and drm dracut modules. Only on
PPC64 initrd, all other arches have the full set of drivers and modules.

Resolves: rhbz#1060691
2014-02-13 13:20:16 -08:00
Brian C. Lane 9c1372564c Remove floppy and scsi_debug from initrd (#1060691)
ppc64 can't PXE boot a initrd that is > 32M. This removes 2 drivers from
initrd creation to reduce the size.

Resolves: rhbz#1060691
2014-02-05 12:46:41 -08:00
Brian C. Lane 1f8aa84c5f flush data to disk after mkfsimage (#1052175)
Make sure the data is written before we do anything else with the disk
image. This shouldn't be needed, umount should take care of it, but it
also can't hurt.

Resolves: rhbz#1052175
2014-01-17 09:56:56 -08:00
d.marlin f0d1c76ea4 Add initial 64-bit ARM (aarch64) support (#1034432)
Signed-off-by: Brian C. Lane <bcl@redhat.com>

Resolves: rhbz#1034432
2013-12-17 10:07:32 -08:00
Brian C. Lane 9e979f760b lorax: pass size from Lorax.run to create_runtime (#903385)
This allows Lorax class users to specify the image size when calling
run()
2013-11-19 10:23:12 -08:00
Vratislav Podzimek 1d7eb09a53 Run compressions in multiple threads
This speeds up compression a lot on multicore systems.
2013-11-14 08:46:01 +01:00
Dennis Gilmore 8d84e9d25a ARM: Don't install or deal with in templates, no longer existing kernels
remove no longer used kernel variants from templates
dont try to install no longer existing kernel-tegra variant
2013-10-16 18:06:20 -05:00
Dennis Gilmore 7d3fafedf3 kernel changed seperator for flavours from . to + update regular expression 2013-10-16 18:05:56 -05:00
Brian C. Lane abf27add37 Bump image size up to 2G (#967556) 2013-05-28 16:29:48 -07:00
Dennis Gilmore d751ac82db remove no longer supported arm kernel variants add the new lpae one 2013-04-17 16:21:23 -07:00
Mark Hamzy 52070f045c fix version query and add one to the log file
Fix "lorax -V" and add a "version is ???" to the log file so we can easily know
what version of lorax is used to build an iso.
Changed to try/import for versioning because the version file is autogenerated.
2013-04-03 15:43:09 -07:00
Will Woods 26c77b4fba Print & log messages on scriptlet/transaction errors
We should probably let the user know if something goes wrong with the
transaction or if a scriptlet fails. So: log the messages so we can find
(and, one hopes, fix) them later.
2013-03-19 15:03:49 -07:00
Will Woods 3a1e176cbb sysutils: add -x to cp in linktree
Since you can't make cross-device links, you'd think that cp -l (make
links) would imply -x (don't cross devices).

You'd be wrong.
2013-03-19 00:47:58 -04:00
Will Woods ad3d1e6278 treebuilder: fix "Can't stat exclude path "/selinux"..." message
/selinux has been gone for *years*. Drop the exclude.
2013-03-19 00:47:58 -04:00
Brian C. Lane 93c4a8b830 Raise an error when there are no initrds 2013-03-12 15:39:25 -07:00
Dennis Gilmore a4cf3c3c7c remove sparc support
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
2013-03-04 14:18:45 +01:00
Brian C. Lane bcdd43997b Remove some env variables (#907692)
Some package scripts may call utilities using dbus. Since this is just a
chroot that will fail. This unsets DESKTOP and DBUS_SESSION_BUS_ADDRESS
to keep them from crashing.
2013-02-15 05:47:11 -08:00
Brian C. Lane d2ae92b4b3 yum changed the callback info
It used to give us (x/y) packagename, but now it only sends package
name. This was changed in yum commit 7e8c76173. For now default to
showing the zeros along with the package name so that it doesn't look
like an error.
2013-01-31 10:06:14 -08:00
Martin Gracik 62920272c7 Fix rexists 2012-12-19 12:39:39 +01:00
Martin Gracik a0791d3074 Only run installupgradeinitrd if upgrade 2012-12-18 14:31:45 +01:00
Martin Gracik 263618e12a Add --noupgrade option 2012-12-18 12:04:03 +01:00
Brian C. Lane 665ee8be7e imgutils: use -s for kpartx, wait for device creation
kpartx can return before the devices are created. Use -s to wait.
Also remove -p p and let kpartx handle adding pX if needed, we use
whatever it outputs so there is no need to force a name.
2012-12-14 13:56:36 -08:00
Dennis Gilmore 78e3d0f115 add installupgradeinitrd function and use it to install the upgrade initrds 2012-11-30 13:28:38 -06:00
Will Woods ff42fbd57e Add the 'fedup' plymouth theme if available 2012-11-30 13:28:38 -06:00
Will Woods b5eb38ae97 build fedup upgrade.img
Use rebuild_initrds() with prefix='upgrade' to build upgrade.img with
the fedup "system-upgrade" module(s) inside.
2012-11-30 13:28:38 -06:00
Will Woods 1c91eab12b treebuilder: improve findkernels() initrd search
This makes findkernels() look for any image named something like:

  $PREFIX-$KERNELVER.img

and adds a corresponding entry to its returned data like:

  kernel.$PREFIX.path = [path]

As a special backwards-compatibility case we use 'initrd' for the
attribute name if $PREFIX is 'initramfs'.

This gives us any extra initramfs images that may have been built using
the 'prefix' argument to rebuild_initrds().
2012-11-30 13:28:38 -06:00
Will Woods 5b48574d5e treebuilder: add 'prefix' to rebuild_initrds()
If 'prefix' is passed to rebuild_initrds(), it will build a *new*
initramfs with a name like $PREFIX-$KERNELVER.img, rather than
overwriting the existing initramfs.
2012-11-30 13:28:38 -06:00
Martin Gracik 91afe5883f Set permissions on the initrd (#863018)
Dracut now makes the initrd with 600 permissions
for security reasons. These reasons do not apply
to install images, and we want the other tools
that use lorax to be able to read the initrd file.
2012-10-11 10:24:11 +02:00
Brian C. Lane 2b8075af3a use /var/tmp instead of /tmp
Also add a --tmp option so users can specify a top level tmp dir.
2012-10-02 11:35:16 -07:00
Brian C. Lane a83c8c1df0 remove rv from unmount error log
You obviously cannot reference it when it hasn't been set.
2012-09-21 09:19:09 -07:00
Martin Gracik fb69670ea8 There's no lang-table in anaconda anymore (#857925) 2012-09-17 11:41:39 -07:00
Brian C. Lane 43bd549480 add convienience functions for running commands
Adds runcmd() and runcmd_output() which set raise_err=True
2012-09-17 11:26:53 -07:00
Brian C. Lane 12ad7d0d99 restore CalledProcessError handling
When I switched execution over to execWith* functions I failed to
account for the use of CalledProcessError in various places. This
patch restores that behavior. All places that used check_call or
check_output now pass raise_err=True to the execWith* call.
2012-09-17 11:26:50 -07:00
Brian C. Lane 381c4276ba add CalledProcessError to execWith* functions
This adds a raise_err argument that when set to True will raise a
CalledProcessError if the process's returncode is not 0
2012-09-17 11:26:41 -07:00
Brian C. Lane 340349b763 imgutils: fix umount retry handling
When umount fails it doesn't throw an error, so retry when the rv is
non-zero instead.
2012-08-21 07:12:23 -07:00
Brian C. Lane 134eec24d5 clean up command execution
Switch to using execWith* so that the command and its output can be
logged. To capture the output setup a logger named "program"

livemedia-creator captures all of this into program.log
2012-07-30 09:22:10 -07:00
d.marlin f170b6dc49 Add 'mvebu' to list of recognized ARM kernels.
Signed-off-by: David A. Marlin <dmarlin@redhat.com>
2012-07-25 12:43:23 +02:00
Will Woods 90ab7bfcfd Actually add plymouth to the initramfs
One more piece to get plymouth in place - we have to stop omitting it
from the initramfs so it's available at boot.
2012-07-06 00:19:48 -04:00
Will Woods 8e71bb045a don't use --prefix with dracut anymore
systemd in F18 doesn't work with --prefix anymore, so drop it.

(patch from haraldh - thanks Harald!)
2012-07-06 00:19:48 -04:00
Martin Gracik 30cb18a9ec Add initial support for ARM based systems (dmarlin) 2012-06-21 09:33:53 +02:00
Will Woods 3a75b2e07d add 'systemctl' command and use it in postinstall
The 'systemctl' command can be used to enable, disable, or mask systemd
units inside the runtime being modified. Modify runtime-postinstall.tmpl
to use the 'systemctl' command.

We also no longer remove quota*.service or kexec*.service, since
these aren't enabled by default. And systemd-remount-api-vfs.service
should work correctly now, so we can leave it alone as well.
2012-06-19 20:00:00 -04:00
Will Woods 3fda56b499 Add some documentation to LoraxTemplateRunner 2012-06-19 19:59:59 -04:00
Will Woods daacb4465d fix '-runcmd' and improve logging
The '-cmd' functionality depends on the individual lorax template
commands raising errors, so they shouldn't do sys.exit().

Also, capture stderr along with stdout, and put both in the log.
2012-06-19 19:59:59 -04:00
Will Woods 1c2c8ec4a8 pylorax.imgutils: add retry loop and "lazy" to umount()
There's something strange going on where unmounting a hfsplus volume
immediately after mounting it will fail with EBUSY.

This makes the umount fail, which makes the rmdir fail, which causes a
traceback, which breaks mkefiboot --apple.

It works fine if you wait a second and retry.. so do that.

Also, add the "lazy" argument so you can do lazy unmounts if you like.
2012-06-19 19:59:59 -04:00
Will Woods 2aae30e691 pylorax.imgutils: add debug logging
Add some useful debug logging info to various functions in
pylorax.imgutils.
2012-06-19 19:59:59 -04:00
Will Woods 329432b58e pylorax: set up logging as recommended by logging module
Generally it's not a good idea for python libraries to set up loggers in
the body of the library.

Set up a NullHandler by default (as the logging module suggests), and
add a function to do the current logging setup during run().
2012-06-19 19:59:59 -04:00
Brian C. Lane c143d5b72d Add pollcdrom module to dracut
From Harald Hoyer <harald@redhat.com>:

pollcdrom is used to poll for the install medium. A lot of CDROM drives
are not polled by the kernel correctly, so we have to actively poll for
the medium.
2012-06-11 10:31:57 -07:00
Martin Gracik 0123377d9b Check if selinux is enabled before getting the mode 2012-06-06 10:48:29 +02:00
Martin Gracik 2e907c072c Comment on why selinux needs to be in permissive or disabled 2012-06-04 16:14:38 +02:00