Commit Graph

5785 Commits (1f621aba3728a621b83b3b697eae6caadae9d287)

Author SHA1 Message Date
Harald Hoyer 1f621aba37 feat: customize .editorconfig according to shfmt 2021-03-13 20:10:43 +01:00
Harald Hoyer 5d99b4d0eb test: fix test 98 getarg
Fix a mis-replaced comparison.
2021-03-12 09:20:32 +01:00
Harald Hoyer 60a34d8b11 fix(network-legacy): silence getargs 2021-03-10 19:31:19 +01:00
Harald Hoyer 72cba8aecd test: sync and poweroff in create-root.sh 2021-03-10 19:31:19 +01:00
Harald Hoyer 1b61cfdbec fix: use getargs with _cryptgetargsname 2021-03-10 19:31:19 +01:00
Harald Hoyer 455329cf71 test: change the LABEL to include spaces
Test for root device with a LABEL, which includes spaces.
2021-03-10 19:31:19 +01:00
Harald Hoyer b800edd698 fix(base): wait_for_dev quote shell variables 2021-03-10 19:31:19 +01:00
Harald Hoyer d3532978de refactor: factor out label_uuid_to_dev 2021-03-10 19:31:19 +01:00
Harald Hoyer 40fc0ad40d chore: update .gitignore 2021-03-10 19:31:19 +01:00
Harald Hoyer 501d82f796 fix: correctly handle kernel parameters
The kernel has an odd way to handle `"` surrounded parameters.
To handle the parameters as the kernel would do, no simple shell script
suffices, so a new utility `dracut-util` is introduced. Written in "C"
it handles `dracut-getarg` and `dracut-getargs` as the old shell script
functions `_dogetarg` and `_dogetargs` would.
2021-03-10 19:31:19 +01:00
Harald Hoyer d643156d56 fix: remove dracut.pc on `make clean` 2021-03-10 17:58:37 +01:00
Harald Hoyer d8a454a537 fix: honor KVERSION environment in the Makefile 2021-03-10 17:58:08 +01:00
Jonas Jelten b12f8188a4 feat(nbd): support ipv6 link local nbds 2021-03-09 13:58:10 +00:00
Kairui Song 7c0bc0b2fd perf: disable initrd compression when squash module is enabled
With squash module, the initramfs is double compressed, which slow down
the build progress and doesn't shrink the size much.
2021-03-09 13:40:35 +00:00
Kairui Song 5d05ffbd87 feat: squash module follow --compress option
Try to make mksquashfs follow --compress option if squash module is
included, if not specified or invalid, fall back to use mksquashfs's
default compressor.
2021-03-09 13:40:35 +00:00
Kairui Song a9345f6800 refactor: delay compressor detection
No function change, decide which compressor to use right before
compressing the initramfs.

This may delay the print of this message:
"dracut: no compression tool available. Initramfs image is going to be big."
but should be OK, this message is not an error.
2021-03-09 13:40:35 +00:00
Kairui Song 90f269f6af feat(squash): use busybox for early setup if available
Use busybox can help reduce the size of early setup environment.

With this change, everything is packed in the squash image, and
the setup files will be dropped once squash image setup is done,
so initramfs stage memory usage is reduced to the minimun,
and initramfs decompress is also faster.

File layout of a squash initramfs looks like this:

========================================================================
drwxr-xr-x   1 root     root            0 Feb 15 14:07 .
-rwxr-xr-x   1 root     root          946 Feb 15 14:07 init
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 lib -> usr/lib
drwxr-xr-x   1 root     root            0 Feb 15 14:07 squash
-rw-r--r--   1 root     root     91000832 Feb 15 14:07 squash-root.img
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/bin
-rwxr-xr-x   1 root     root      1293688 Jul 27  2020 usr/bin/busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/echo -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/mkdir -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/modprobe -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/mount -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/sh -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/switch_root -> busybox
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/dracut
-rw-r--r--   1 root     root           23 Feb 15 14:07 usr/lib/dracut/build-parameter.txt
-rw-r--r--   1 root     root           31 Feb 15 14:07 usr/lib/dracut/dracut-051-93.git20210215.fc33
-rw-r--r--   1 root     root          358 Feb 15 14:07 usr/lib/dracut/modules.txt
-rw-r--r--   1 root     root            0 Feb 15 14:07 usr/lib/dracut/need-initqueue
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/modules
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/modules/5.10.11-200.fc33.x86_64
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/modules/5.10.11-200.fc33.x86_64/kernel
<... kernel module misc files skipped ... >
========================================================================
2021-03-09 13:40:35 +00:00
Kairui Song 8f7c332e48 refactor(squash): structure in a cleaner way
Simplify the squash mount layout. Instead of overlay on each top
directory (/etc, /usr), just mount and switch_root into the squash
image, with a overlay on top of it.

Also install the binaries and setup scripts separately, so the squash
setup code and the squash image content is independent of each other,
all squash setup script and binaries can be deleted safely upon
switch_root.

With this change, previous squash clean up service and other tricky
implementations are all gone.

This commit depends on systemd commits from:
https://github.com/systemd/systemd/pull/18124

Previouly systemd doesn't recognize non-ramfs initramfs, now this is
doable with SYSTEMD_IN_INITRD=lenient

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-03-09 13:40:35 +00:00
Kairui Song bdd194bb8c refactor(squash): don't record mount points in text file
The squasn mount points are recorded in text file so later clean up
script can umount them, this is not needed, the mount points are fixed
so just detect the umount by hardcoded pattern.
2021-03-09 13:40:35 +00:00
Kairui Song 5a18b24a8b feat(squash): install and depmod modules seperately
Separately install the modules required for squash image setup.
These modules can be deleted after squash image setup to save
memory.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-03-09 13:40:35 +00:00
Kairui Song f9f4264d03 refactor(squash): move all setup code to init-squash.sh
Seperate of init.sh and setup-squash.sh is pointless, merge them into one.
2021-03-09 13:40:35 +00:00
Kairui Song 8c8aecdc63 fix(squash): post install should be the last step before stripping
Ensure dracut squash module doesn't effect other steps, and stripping
can cover the new binaries installed by it.
2021-03-09 13:40:35 +00:00
Kairui Song 95ea16aa60 refactor(squash): move the post install scripts into the module-setup.sh
No function change, just move the post install code to 99squash to clean
up dracut.sh.
2021-03-09 13:40:35 +00:00
Kairui Song c552c99ef8 fix(squash): this module shouldn't depend on bash
Any other shell should just work.
2021-03-09 13:40:35 +00:00
Jóhann B. Guðmundsson 28545cda45 chore(labeler): remove the needs review label
There is no longer need to have pull requests labeled with the needs
review label since reviews are now mandatory on pull request.
2021-03-03 13:23:15 +00:00
Jóhann B. Guðmundsson 9cf7b1c529 fix: always use mkdir -p
Ensuring that directory creations dont trigger error if directory
previously existed as well as create parent directories if needed.
2021-03-03 13:06:02 +01:00
Daniel Molkentin 92e6a8f879 fix(kernel-modules): optionally add /usr/lib/modules.d to initramfs
On SUSE, there is no /lib/modules.d, only /usr/lib/modules.d.

Upstream-Bug: http://bugzilla.opensuse.org/show_bug.cgi?id=1180822

Reference: bsc#1180822
2021-03-03 11:42:09 +01:00
Lennart Poettering a96900a82c fix(dracut-systemd): don't refuse root=tmpfs when systemd is used
A match for systemd PR#18847
2021-03-02 21:23:03 +00:00
Renaud Métrich d8e47e201a fix(dracut.sh): harden dracut against GZIP environment variable
When a GZIP environment variable is set, this leads to various breakage:

In case 'pigz' is installed and GZIP is defined as a path, e.g.
/usr/local/bin/gzip, then dracut will fail with the following message:

   "
   pigz: abort: cannot provide files in GZIP environment variable
   "

In case 'pigz' isn't installed and regular 'gzip' is used and GZIP is
defined as a path, e.g. /usr/local/bin/gzip, then the path will be
zipped and dracut will fail for no obvious reason.  Trying again, dracut
will then fail with following message:

   "
   gzip: /usr/local/bin/gzip.gz already exists;	not overwritten
   "

In any case, GZIP environment should be unset to avoid breakage or
unwanted behaviour. This variable is anyway obsolescent, from gzip(1)
manpage.

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2021-03-02 11:05:52 +01:00
Harald Hoyer 630334950c feat(skipcpio): speed up and harden skipcpio
Before:
```
Benchmark #1: ./skipcpio/skipcpio test-5.10.15-200.fc33.x86_64.img >/dev/null
  Time (mean ± σ):     125.5 ms ±   0.9 ms    [User: 97.4 ms, System: 27.9 ms]
  Range (min … max):   124.8 ms … 129.4 ms    23 runs
```

After:
```
Benchmark #1: ./skipcpio/skipcpio test-5.10.15-200.fc33.x86_64.img >/dev/null
  Time (mean ± σ):      12.2 ms ±   0.3 ms    [User: 2.7 ms, System: 9.5 ms]
  Range (min … max):    11.7 ms …  13.6 ms    212 runs
```

Besides the speedup, skipcpio now parses the cpio header and is not
falsely ending when the early cpio payload contains `TRAILER!!!`.

Fixes: https://github.com/dracutdevs/dracut/issues/1123
2021-02-25 14:48:22 +01:00
Harald Hoyer c67b624637 docs: update NEWS.md and AUTHORS 2021-02-23 16:11:01 +01:00
Harald Hoyer 62f3a10d5d docs: update RELEASE.md
* clog from last tag
* push commits to kernelorg also
2021-02-23 16:11:01 +01:00
Jóhann B. Guðmundsson 1edf54e275 feat(github): adding packit support for fedora maintenance
Adding initial packit [1] support for fedora maintenance which
should automate the release process from upstream release to fedora.

1. https://packit.dev
2021-02-23 16:04:23 +01:00
Harald Hoyer c8ebb80590 fix(dracut.sh): remove unneeded variables
There is no `fstab_lines_l` variable used before.

The `--include` option was turned into `++include` and therefore the
switch option is not reachable anymore.
2021-02-23 16:03:44 +01:00
Sergei Iudin d87ae13721 fix(dracut.sh): unfreeze /boot on exit
If SIGWHATEVER will be processed after fsfreeze -f, but before fsfreeze
-u we will end up with /boot/ never unfrozen, let's try to minimize risk of this.
2021-02-23 09:25:08 +01:00
Evgeni Golov c3f241849d fix: skip empty modalias files in drm module setup
on my system (ThinkPad X201s) I have several modalias entries that are
empty:

    /sys/bus/platform/devices/dock.0/modalias
    /sys/bus/platform/devices/dock.1/modalias
    /sys/bus/platform/devices/dock.2/modalias

executing the drm module setup thus results in the following errors

    dracut-install: No SOURCE argument given

when calling dracut_instmods and hostonly mode is enabled.

Skip those entries, as there are no modules to load in this case
anyways.

Note: it is not sufficient to use [['s -s test (file size is greater
than zero), as all those files are 4096B if you stat them.
2021-02-22 14:55:44 +01:00
Lukas Nykryn c17c5b7604 fix(network-manager): run as a service if systemd module is present
In the current state, services that depend on network need to
use dracut hooks, since nothing with pull in the network
targets into the transaction.

In the future, it would be nice to provide developers on systemd-only
systems the possibility to not use dracut hooks at all, but simply put
normal systemd services into the initrd.

Also, some modules even right now depend on systemd ordering, like
cryptsetup, so let's make sure, that the ordering inside systemd work
properly as well.
2021-02-19 11:20:59 +01:00
Lukas Nykryn 34c73b339b fix(network-manager): rework how NM is started in debug mode
Instead of running directly NM with --debug, create a drop-in in
nm-config.sh. This will make sure, that we can get the debug output
regardless the way how NM will be started.
2021-02-19 11:20:59 +01:00
Lukas Nykryn 6f7823bce6 fix(fcoe): rename rd.nofcoe to rd.fcoe
The current name of this bool is kinda stupid. Based on the manpage
setting it to 0 turns off fcoe, which means that nofcoe=1 should mean
that it is on.

Let's just do the same thing as with rd.lvm=0, rd.luks=0,....
2021-02-19 09:28:57 +00:00
Lukas Nykryn 805b46c2a8 fix(fcoe): rd.nofcoe=0 should disable fcoe
8446c8f9 Changed the default behavior, but also flipped meaning of 0/1.
Right now rd.nofcoe=0 enables fcoe, which is the opposite what manpage
says.
2021-02-19 09:28:57 +00:00
Andrew J. Hesford d437970c01 fix: proper return code for inst_multiple in dracut-init.sh
A test of the form

    if ! command; then
        _ret=$?
        ...
        return _ret
    fi

does not capture the return code of `command`, but the negation of the
return code, leaving _ret == 0. The test of this form in inst_multiple
has been refactored to capture and return the right value.
2021-02-19 09:03:53 +01:00
Tomasz Paweł Gajc f8b38ecd7c chore: update authors in .mailmap 2021-02-18 14:10:23 +00:00
Harald Hoyer 5387ed24c8 fix(i18n): get rid of `eval` calls
By changing KBDSUBDIRS to a bash array, all kinds of `eval` quirks are
avoided.
2021-02-16 15:49:02 +01:00
Harald Hoyer 9e1c7f3dea fix(i18n): create the keyboard symlinks again
Invalid space broke the creation of the keyboard subdirectories,
leading to a symbolic link

usr/share/consolefonts,consoletrans,keymaps,unimaps ->
/usr/lib/kbd/consolefonts,consoletrans,keymaps,unimaps

in the created initramfs.

With this fix the correct symlinks are created again:

usr/share/consolefonts -> /usr/lib/kbd/consolefonts
usr/share/consoletrans -> /usr/lib/kbd/consoletrans
usr/share/keymaps -> /usr/lib/kbd/keymaps
usr/share/unimaps -> /usr/lib/kbd/unimaps
2021-02-16 15:49:02 +01:00
Jóhann B. Guðmundsson 2c9debec02 fix(github): exempt issues with the label bug
Let's exempt issues with the label bugs being processed by stalebot.
2021-02-16 10:16:10 +01:00
Harald Hoyer 895c2f65d4 docs: update docs/RELEASE.md 2021-02-16 10:15:39 +01:00
Harald Hoyer 3fce68bd1d docs: update NEWS.md and AUTHORS 2021-02-15 17:30:54 +01:00
Harald Hoyer 1a604e2a4a chore: add `CONTRIBUTORS` target to Makefile 2021-02-15 16:54:44 +01:00
Harald Hoyer 0b86c0607f docs: update docs/RELEASE.md 2021-02-15 16:53:51 +01:00
Harald Hoyer 095b77bee8 docs: move NEWS to NEWS.md 2021-02-15 15:33:41 +01:00