diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:37 +0000 |
commit | 734d725d62d2cbe4445524448de024e3b9e7f4b3 (patch) | |
tree | 88d8385f24a0efda248b3480fe39037b85e76552 | |
parent | Releasing progress-linux version 060+5-8~progress7.99u1. (diff) | |
download | dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.tar.xz dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.zip |
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
241 files changed, 7550 insertions, 3356 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e4362b2..7fbdd47 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,5 +5,4 @@ # the repo. Unless a later match takes precedence, # @global-owner1 and @global-owner2 will be requested for # review when someone opens a pull request. -* @haraldh @danimo @johannbg - +* @laszlogombos @Conan-Kudo diff --git a/.github/labeler.yml b/.github/labeler.yml index ba47d04..00142bc 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,292 +1,555 @@ repository: - - ./* + - changed-files: + - any-glob-to-any-file: './*' github: - - .github/* - - .github/**/* + - changed-files: + - any-glob-to-any-file: ['.github/*', '.github/**/*'] + +docs: + - changed-files: + - any-glob-to-any-file: 'docs/*' + +man: + - changed-files: + - any-glob-to-any-file: 'man/*' + +kernel-install: + - changed-files: + - any-glob-to-any-file: 'install.d/*' + +shell-completion: + - changed-files: + - any-glob-to-any-file: ['shell-completion/*', 'shell-completion/**/*'] + +dracut-cpio: + - changed-files: + - any-glob-to-any-file: ['src/dracut-cpio/*', 'src/dracut-cpio/**/*'] dracut-install: - - install/* - - install/**/* + - changed-files: + - any-glob-to-any-file: 'src/install/*' + +dracut-util: + - changed-files: + - any-glob-to-any-file: 'src/util/*' + +logtee: + - changed-files: + - any-glob-to-any-file: 'src/logtee/*' -example: - - examples/* - - examples/**/* - - examples/**/**/* +skipcpio: + - changed-files: + - any-glob-to-any-file: 'src/skipcpio/*' modules: - - modules.d/* - - modules.d/**/* + - changed-files: + - any-glob-to-any-file: ['modules.d/*', 'modules.d/**/*'] bash: - - modules.d/00bash/* + - changed-files: + - any-glob-to-any-file: 'modules.d/00bash/*' dash: - - modules.d/00dash/* + - changed-files: + - any-glob-to-any-file: 'modules.d/00dash/*' mksh: - - modules.d/00mksh/* + - changed-files: + - any-glob-to-any-file: 'modules.d/00mksh/*' systemd: - - modules.d/00systemd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/00systemd/*' warpclock: - - modules.d/00warpclock/* + - changed-files: + - any-glob-to-any-file: 'modules.d/00warpclock/*' fips: - - modules.d/01fips/* + - changed-files: + - any-glob-to-any-file: 'modules.d/01fips/*' + +systemd-ac-power: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-ac-power/*' + +systemd-ask-password: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-ask-password/*' + +systemd-bsod: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-bsod/*' + +systemd-coredump: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-coredump/*' + +systemd-creds: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-creds/*' + +systemd-hostnamed: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-hostnamed/*' systemd-initrd: - - modules.d/01systemd-initrd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-initrd/*' -caps: - - modules.d/02caps/* +systemd-integritysetup: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-integritysetup/*' + +systemd-journald: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-journald/*' + +systemd-ldconfig: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-ldconfig/*' + +systemd-modules-load: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-modules-load/*' systemd-networkd: - - modules.d/02systemd-networkd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-networkd/*' + +systemd-network-management: + - changed-files: + - any-glob-to-any-file: 'modules.d/00systemd-network-management/*' + +systemd-pcrphase: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-pcrphase/*' + +systemd-portabled: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-portabled/*' + +systemd-pstore: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-pstore/*' + +systemd-repart: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-repart/*' + +systemd-resolved: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-resolved/*' + +systemd-sysctl: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-sysctl/*' + +systemd-sysext: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-sysext/*' + +systemd-sysusers: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-sysusers/*' + +systemd-timedated: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-timedated/*' + +systemd-timesyncd: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-timesyncd/*' + +systemd-tmpfiles: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-tmpfiles/*' + +systemd-udevd: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-udevd/*' + +systemd-veritysetup: + - changed-files: + - any-glob-to-any-file: 'modules.d/01systemd-veritysetup/*' + +caps: + - changed-files: + - any-glob-to-any-file: 'modules.d/02caps/*' modsign: - - modules.d/03modsign/* + - changed-files: + - any-glob-to-any-file: 'modules.d/03modsign/*' rescue: - - modules.d/03rescue/* + - changed-files: + - any-glob-to-any-file: 'modules.d/03rescue/*' watchdog: - - modules.d/04watchdog/* + - changed-files: + - any-glob-to-any-file: 'modules.d/04watchdog/*' + +watchdog-modules: + - changed-files: + - any-glob-to-any-file: 'modules.d/04watchdog-modules/*' busybox: - - modules.d/05busybox/* + - changed-files: + - any-glob-to-any-file: 'modules.d/05busybox/*' + +dbus-broker: + - changed-files: + - any-glob-to-any-file: 'modules.d/06dbus-broker/*' + +dbus-daemon: + - changed-files: + - any-glob-to-any-file: 'modules.d/06dbus-daemon/*' rngd: - - modules.d/06rngd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/06rngd/*' + +dbus: + - changed-files: + - any-glob-to-any-file: 'modules.d/09dbus/*' i18n: - - modules.d/10i18n/* + - changed-files: + - any-glob-to-any-file: 'modules.d/10i18n/*' convertfs: - - modules.d/30convertfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/30convertfs/*' + +connman: + - changed-files: + - any-glob-to-any-file: 'modules.d/35connman/*' network-legacy: - - modules.d/35network-legacy/* + - changed-files: + - any-glob-to-any-file: 'modules.d/35network-legacy/*' network-manager: - - modules.d/35network-manager/* + - changed-files: + - any-glob-to-any-file: 'modules.d/35network-manager/*' network: - - modules.d/40network/* + - changed-files: + - any-glob-to-any-file: 'modules.d/40network/*' ifcfg: - - modules.d/45ifcfg/* + - changed-files: + - any-glob-to-any-file: 'modules.d/45ifcfg/*' url-lib: - - modules.d/45url-lib/* + - changed-files: + - any-glob-to-any-file: 'modules.d/45url-lib/*' drm: - - modules.d/50drm/* + - changed-files: + - any-glob-to-any-file: 'modules.d/50drm/*' plymouth: - - modules.d/50plymouth/* + - changed-files: + - any-glob-to-any-file: 'modules.d/50plymouth/*' + +bluetooth: + - changed-files: + - any-glob-to-any-file: 'modules.d/62bluetooth/*' cms: - - modules.d/80cms/* + - changed-files: + - any-glob-to-any-file: 'modules.d/80cms/*' lvmmerge: - - modules.d/80lvmmerge/* + - changed-files: + - any-glob-to-any-file: 'modules.d/80lvmmerge/*' + +lvmthinpool-monitor: + - changed-files: + - any-glob-to-any-file: 'modules.d/80lvmthinpool-monitor/*' cio_ignore: - - modules.d/81cio_ignore/* + - changed-files: + - any-glob-to-any-file: 'modules.d/81cio_ignore/*' btrfs: - - modules.d/90btrfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90btrfs/*' crypt: - - modules.d/90crypt/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90crypt/*' dm: - - modules.d/90dm/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90dm/*' dmraid: - - modules.d/90dmraid/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90dmraid/*' dmsquash-live: - - modules.d/90dmsquash-live/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90dmsquash-live/*' + +dmsquash-live-autooverlay: + - changed-files: + - any-glob-to-any-file: 'modules.d/90dmsquash-live-autooverlay/*' dmsquash-live-ntfs: - - modules.d/90dmsquash-live-ntfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90dmsquash-live-ntfs/*' kernel-modules: - - modules.d/90kernel-modules/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90kernel-modules/*' kernel-modules-extra: - - modules.d/90kernel-modules-extra/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90kernel-modules-extra/*' kernel-network-modules: - - modules.d/90kernel-network-modules/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90kernel-network-modules/*' livenet: - - modules.d/90livenet/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90livenet/*' lvm: - - modules.d/90lvm/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90lvm/*' mdraid: - - modules.d/90mdraid/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90mdraid/*' multipath: - - modules.d/90multipath/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90multipath/*' + +numlock: + - changed-files: + - any-glob-to-any-file: 'modules.d/90numlock/*' nvdimm: - - modules.d/90nvdimm/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90nvdimm/*' overlayfs: - - modules.d/90overlayfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90overlayfs/*' ppcmac: - - modules.d/90ppcmac/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90ppcmac/*' qemu: - - modules.d/90qemu/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90qemu/*' qemu-net: - - modules.d/90qemu-net/* + - changed-files: + - any-glob-to-any-file: 'modules.d/90qemu-net/*' + +systemd-cryptsetup: + - changed-files: + - any-glob-to-any-file: 'modules.d/90systemd-cryptsetup/*' crypt-gpg: - - modules.d/91crypt-gpg/* + - changed-files: + - any-glob-to-any-file: 'modules.d/91crypt-gpg/*' crypt-loop: - - modules.d/91crypt-loop/* + - changed-files: + - any-glob-to-any-file: 'modules.d/91crypt-loop/*' + +fido2: + - changed-files: + - any-glob-to-any-file: 'modules.d/91fido2/*' + +pcsc: + - changed-files: + - any-glob-to-any-file: 'modules.d/91pcsc/*' + +pkcs11: + - changed-files: + - any-glob-to-any-file: 'modules.d/91pkcs11/*' + +tpm2-tss: + - changed-files: + - any-glob-to-any-file: 'modules.d/91tpm2-tss/*' zipl: - - modules.d/91zipl/* + - changed-files: + - any-glob-to-any-file: 'modules.d/91zipl/*' cifs: - - modules.d/95cifs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95cifs/*' dasd: - - modules.d/95dasd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95dasd/*' dasd_mod: - - modules.d/95dasd_mod/* - -dasd_rules: - - modules.d/95dasd_rules/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95dasd_mod/*' dcssblk: - - modules.d/95dcssblk/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95dcssblk/*' debug: - - modules.d/95debug/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95debug/*' fcoe: - - modules.d/95fcoe/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95fcoe/*' fcoe-uefi: - - modules.d/95fcoe-uefi/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95fcoe-uefi/*' fstab-sys: - - modules.d/95fstab-sys/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95fstab-sys/*' iscsi: - - modules.d/95iscsi/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95iscsi/*' lunmask: - - modules.d/95lunmask/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95lunmask/*' nbd: - - modules.d/95nbd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95nbd/*' nfs: - - modules.d/95nfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95nfs/*' nvmf: - - modules.d/95nvmf/* - -qeth_rules: - - modules.d/95qeth_rules/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95nvmf/*' resume: - - modules.d/95resume/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95resume/*' rootfs-block: - - modules.d/95rootfs-block/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95rootfs-block/*' ssh-client: - - modules.d/95ssh-client/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95ssh-client/*' terminfo: - - modules.d/95terminfo/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95terminfo/*' udev-rules: - - modules.d/95udev-rules/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95udev-rules/*' virtfs: - - modules.d/95virtfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95virtfs/*' virtiofs: - - modules.d/95virtiofs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95virtiofs/*' zfcp: - - modules.d/95zfcp/* - -zfcp_rules: - - modules.d/95zfcp_rules/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95zfcp/*' znet: - - modules.d/95znet/* + - changed-files: + - any-glob-to-any-file: 'modules.d/95znet/*' securityfs: - - modules.d/96securityfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/96securityfs/*' biosdevname: - - modules.d/97biosdevname/* + - changed-files: + - any-glob-to-any-file: 'modules.d/97biosdevname/*' masterkey: -- modules.d/97masterkey/* + - changed-files: + - any-glob-to-any-file: 'modules.d/97masterkey/*' dracut-systemd: - - modules.d/98dracut-systemd/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98dracut-systemd/*' ecryptfs: - - modules.d/98ecryptfs/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98ecryptfs/*' integrity: - - modules.d/98integrity/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98integrity/*' pollcdrom: - - modules.d/98pollcdrom/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98pollcdrom/*' selinux: - - modules.d/98selinux/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98selinux/*' syslog: - - modules.d/98syslog/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98syslog/*' usrmount: - - modules.d/98usrmount/* + - changed-files: + - any-glob-to-any-file: 'modules.d/98usrmount/*' base: - - modules.d/99base/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99base/*' fs-lib: - - modules.d/99fs-lib/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99fs-lib/*' img-lib: - - modules.d/99img-lib/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99img-lib/*' memstrack: - - modules.d/99memstrack/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99memstrack/*' shutdown: - - modules.d/99shutdown/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99shutdown/*' squash: - - modules.d/99squash/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99squash/*' uefi-lib: - - modules.d/99uefi-lib/* + - changed-files: + - any-glob-to-any-file: 'modules.d/99uefi-lib/*' + +net-lib: + - changed-files: + - any-glob-to-any-file: 'modules.d/45net-lib/*' + +pcmcia: + - changed-files: + - any-glob-to-any-file: 'modules.d/90pcmcia/*' test: - - test/* - - test/**/* - - modules.d/80test* - - modules.d/80test*/* + - changed-files: + - any-glob-to-any-file: ['test/*', 'test/**/*', 'modules.d/80test*', 'modules.d/80test*/*'] diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e6f8e42..9839ad0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -7,10 +7,14 @@ name: "CodeQL" on: push: branches: - - master + - main + paths: + - 'src/**' pull_request: branches: - - master + - main + paths: + - 'src/**' permissions: contents: read @@ -18,7 +22,7 @@ permissions: jobs: analyze: name: Analyze - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ matrix.language }}-${{ github.ref }} cancel-in-progress: true @@ -33,10 +37,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} queries: +security-extended,security-and-quality @@ -47,7 +51,7 @@ jobs: sudo apt -y install asciidoc gcc libkmod-dev libsystemd-dev pkg-config - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index d8c8808..666f887 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -3,12 +3,12 @@ on: schedule: - cron: '30 11 * * *' # every day at 11:30 UTC push: - branches: [ master ] + branches: [ main ] paths: - 'test/container/**' - '.github/workflows/container.yml' pull_request: - branches: [ master ] + branches: [ main ] paths: - 'test/container/**' - '.github/workflows/container.yml' @@ -18,30 +18,68 @@ permissions: contents: read jobs: - push_to_registry: - if: github.repository == 'dracutdevs/dracut' || vars.CONTAINER == 'enabled' - name: Build and push containers image to GitHub Packages + arm64: + if: github.repository == 'dracut-ng/dracut-ng' || vars.CONTAINER == 'enabled' + name: ${{ matrix.config.tag }} on ${{ matrix.config.platform }} runs-on: ubuntu-latest concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }} + group: arm64-${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }} cancel-in-progress: true strategy: fail-fast: false matrix: config: - - { dockerfile: 'Dockerfile-Fedora-latest', tag: 'fedora:latest' } - - { dockerfile: 'Dockerfile-OpenSuse-latest', tag: 'opensuse:latest' } - - { dockerfile: 'Dockerfile-Arch', tag: 'arch:latest' } - - { dockerfile: 'Dockerfile-Debian', tag: 'debian:latest' } - - { dockerfile: 'Dockerfile-Gentoo', tag: 'gentoo:latest' } - - { dockerfile: 'Dockerfile-Ubuntu', tag: 'ubuntu:latest' } + - { dockerfile: 'Dockerfile-Debian', tag: 'debian', platform: 'linux/arm64,linux/amd64' } + - { dockerfile: 'Dockerfile-Fedora-latest', tag: 'fedora', platform: 'linux/arm64,linux/amd64' } + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.config.platform }} + - name: Check out the repo + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up env + run: echo "repository_owner=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV} + - name: Build and Push Container + uses: docker/build-push-action@v5 + with: + file: test/container/${{ matrix.config.dockerfile }} + tags: ghcr.io/${{env.repository_owner}}/${{ matrix.config.tag }}:latest + push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} + platforms: ${{ matrix.config.platform }} + + amd64: + if: github.repository == 'dracut-ng/dracut-ng' || vars.CONTAINER == 'enabled' + name: ${{ matrix.config.tag }} on ${{ matrix.config.platform }} + runs-on: ubuntu-latest + concurrency: + group: amd64-${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }} + cancel-in-progress: true + strategy: + fail-fast: false + matrix: + config: + - { dockerfile: 'Dockerfile-OpenSuse-latest', tag: 'opensuse', platform: 'linux/amd64' } + - { dockerfile: 'Dockerfile-Arch', tag: 'arch', platform: 'linux/amd64' } + - { dockerfile: 'Dockerfile-Gentoo', tag: 'gentoo', platform: 'linux/amd64' } + - { dockerfile: 'Dockerfile-Ubuntu', tag: 'ubuntu', platform: 'linux/amd64' } + - { dockerfile: 'Dockerfile-alpine', tag: 'alpine', platform: 'linux/amd64' } + - { dockerfile: 'Dockerfile-Void', tag: 'void', platform: 'linux/amd64' } steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -49,8 +87,9 @@ jobs: - name: Set up env run: echo "repository_owner=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV} - name: Build and Push Container - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: file: test/container/${{ matrix.config.dockerfile }} - tags: ghcr.io/${{env.repository_owner}}/${{ matrix.config.tag }} + tags: ghcr.io/${{env.repository_owner}}/${{ matrix.config.tag }}:latest push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} + platforms: ${{ matrix.config.platform }} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ab075b0..6e323b7 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -2,30 +2,147 @@ name: Integration Test on: pull_request: - branches: [ master ] + branches: [ main ] env: DEBUGFAIL: "${{ secrets.ACTIONS_STEP_DEBUG && 'rd.debug' }}" jobs: - test: + basic: + name: ${{ matrix.test }} on ${{ matrix.container }} runs-on: ubuntu-latest timeout-minutes: 30 concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} + group: basic-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} cancel-in-progress: true strategy: matrix: container: [ - "arch:latest", - "debian:latest", - "fedora:latest", - "gentoo:latest", - "opensuse:latest", - "ubuntu:latest", + "alpine", + "arch", + "debian", + "fedora", + "gentoo", + "opensuse", + "ubuntu", + "void", ] test: [ "01", + ] + fail-fast: false + container: + image: ghcr.io/dracut-ng/${{ matrix.container }} + options: "--privileged -v /dev:/dev" + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + - name: "${{ matrix.container }} TEST-${{ matrix.test }}" + run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} + network: + name: ${{ matrix.test }} on ${{ matrix.container }} using ${{ matrix.network }} + runs-on: ubuntu-latest + timeout-minutes: 45 + concurrency: + group: network-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}-${{ matrix.network }} + cancel-in-progress: true + strategy: + matrix: + container: [ + "fedora", + ] + network: [ + "network", + ] + test: [ + "20", + "40", + "50", + "60", + ] + fail-fast: false + container: + image: ghcr.io/dracut-ng/${{ matrix.container }} + options: "--privileged -v /dev:/dev" + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + - name: "${{ matrix.container }} TEST-${{ matrix.test }}" + run: USE_NETWORK=${{ matrix.network }} ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} + network-legacy: + name: ${{ matrix.test }} on ${{ matrix.container }} using ${{ matrix.network }} + runs-on: ubuntu-latest + timeout-minutes: 45 + concurrency: + group: network-legacy-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}-${{ matrix.network }} + cancel-in-progress: true + strategy: + matrix: + container: [ + "opensuse", + ] + network: [ + "network-legacy", + ] + test: [ + "20", + "30", + "40", + ] + fail-fast: false + container: + image: ghcr.io/dracut-ng/${{ matrix.container }} + options: "--privileged -v /dev:/dev" + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + - name: "${{ matrix.container }} TEST-${{ matrix.test }}" + run: USE_NETWORK=${{ matrix.network }} ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} + systemd-networkd: + name: ${{ matrix.test }} on ${{ matrix.container }} using ${{ matrix.network }} + runs-on: ubuntu-latest + timeout-minutes: 45 + concurrency: + group: systemd-networkd-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}-${{ matrix.network }} + cancel-in-progress: true + strategy: + matrix: + container: [ + "arch", + ] + network: [ + "systemd-networkd", + ] + test: [ + "35", + "40", + ] + fail-fast: false + container: + image: ghcr.io/dracut-ng/${{ matrix.container }} + options: "--privileged -v /dev:/dev" + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + - name: "${{ matrix.container }} TEST-${{ matrix.test }}" + run: USE_NETWORK=${{ matrix.network }} ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} + extended: + name: ${{ matrix.test }} on ${{ matrix.container }} + runs-on: ubuntu-latest + timeout-minutes: 30 + concurrency: + group: extended-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} + cancel-in-progress: true + strategy: + matrix: + container: [ + "arch", + "debian", + "fedora", + "gentoo", + "ubuntu", + ] + test: [ "02", "03", "04", @@ -43,50 +160,60 @@ jobs: ] fail-fast: false container: - image: ghcr.io/dracutdevs/${{ matrix.container }} + image: ghcr.io/dracut-ng/${{ matrix.container }} options: "--privileged -v /dev:/dev" steps: - name: "Checkout Repository" - uses: actions/checkout@v1 - with: - fetch-depth: 0 - + uses: actions/checkout@v4 - name: "${{ matrix.container }} TEST-${{ matrix.test }}" run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} - network: + dracut-cpio: + name: ${{ matrix.test }} on ${{ matrix.container }} runs-on: ubuntu-latest - timeout-minutes: 45 + timeout-minutes: 30 concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}-${{ matrix.network }} + group: dracut-cpio-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} cancel-in-progress: true strategy: matrix: container: [ - "fedora:latest", - ] - network: [ - "network-manager", - "network-legacy", - #"systemd-networkd", - #"connman", + "opensuse", ] test: [ - "20", - "30", - "35", - "40", - "60", - # "50", # times out + "63", ] fail-fast: false container: - image: ghcr.io/dracutdevs/${{ matrix.container }} + image: ghcr.io/dracut-ng/${{ matrix.container }} options: "--privileged -v /dev:/dev" steps: - name: "Checkout Repository" - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: "${{ matrix.container }} TEST-${{ matrix.test }}" + run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} + arm64: + name: ${{ matrix.test }} on ${{ matrix.container }} on arm64 + runs-on: ubuntu-latest + timeout-minutes: 30 + concurrency: + group: arm64-${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} + cancel-in-progress: true + strategy: + matrix: + container: [ + "debian", + "fedora", + ] + test: [ + "98", + ] + fail-fast: false + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 with: - fetch-depth: 0 - + platforms: 'linux/arm64' + - name: "Checkout Repository" + uses: actions/checkout@v4 - name: "${{ matrix.container }} TEST-${{ matrix.test }}" - run: USE_NETWORK=${{ matrix.network }} ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} + run: docker run --platform linux/arm64 --privileged -v /dev:/dev -v $PWD:/w ghcr.io/dracut-ng/${{ matrix.container }} /w/tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d02b332..16dac6c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,31 +2,53 @@ name: Lint on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: lint-shell: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: shfmt - uses: luizm/action-sh-checker@v0.6.0 + uses: luizm/action-sh-checker@v0.8.0 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SHFMT_OPTS: -s # arguments to shfmt. with: - sh_checker_shellcheck_disable: false - sh_checker_comment: true + sh_checker_shellcheck_disable: true # disable shellcheck in favor of differential-shellcheck + + differential-shellcheck: + runs-on: ubuntu-latest + + permissions: + security-events: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - id: ShellCheck + name: Differential ShellCheck + uses: redhat-plumbers-in-action/differential-shellcheck@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - if: ${{ always() }} + name: Upload artifact with ShellCheck defects in SARIF format + uses: actions/upload-artifact@v4 + with: + name: Differential ShellCheck SARIF + path: ${{ steps.ShellCheck.outputs.sarif }} lint-c: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install tools run: sudo apt-get install astyle diff --git a/.github/workflows/manualtest.yml b/.github/workflows/manualtest.yml index b790dcf..74e5647 100644 --- a/.github/workflows/manualtest.yml +++ b/.github/workflows/manualtest.yml @@ -5,34 +5,70 @@ on: inputs: test: description: "Array of tests to run, such as [11,12]" - default: "['04']" - required: true + default: "[]" container: type: choice description: 'distro' - default: 'fedora' + default: 'all' options: + - "all" + - "alpine" - "fedora" - "arch" - "debian" - "ubuntu" - "opensuse" - "gentoo" + - "void" + env: + description: 'Environment (optional)' + default: '{"DEBUGFAIL": "rd.debug"}' + registry: + description: 'Registry for containers, such as ghcr.io/dracut-ng' + +env: + ${{ fromJSON(inputs.env) }} jobs: + matrix: + runs-on: ubuntu-latest + outputs: + registry: ${{ steps.set-matrix.outputs.registry }} + container: ${{ steps.set-matrix.outputs.container }} + tests: ${{ steps.set-matrix.outputs.tests }} + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - id: set-matrix + name: "Set Matrix" + run: | + [[ "${{ inputs.registry }}" != '' ]] && echo "registry=\"${{ inputs.registry }}\"" >> $GITHUB_OUTPUT \ + || ( echo "registry=\"ghcr.io/${{ github.repository_owner }}\"" >> $GITHUB_OUTPUT ) + [[ "${{ inputs.container }}" != 'all' ]] && echo "container=[\"${{ inputs.container }}\"]" >> $GITHUB_OUTPUT \ + || ( containers=$(find test/container -name "Dockerfile-*" | cut -d\- -f2 | tr '[:upper:]' '[:lower:]' | sed -z 's/\n/","/g'); echo "container=[\"${containers%??}]" >> $GITHUB_OUTPUT ) + [[ "${{ toJson(fromJson(inputs.test)) }}" != '[]' ]] && echo "tests=${{ inputs.test }}" >> $GITHUB_OUTPUT \ + || ( tests=$(find test -type d -a -name "TEST-*" | cut -d\- -f2 | sed -z 's/\n/","/g' ); echo "tests=[\"${tests%??}]" >> $GITHUB_OUTPUT ) test: + needs: matrix runs-on: ubuntu-latest timeout-minutes: 45 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} + cancel-in-progress: true strategy: matrix: - test: ${{ fromJSON(inputs.test) }} + container: ${{ fromJSON(needs.matrix.outputs.container) }} + test: ${{ fromJSON(needs.matrix.outputs.tests) }} + fail-fast: false container: - image: ghcr.io/dracutdevs/${{ inputs.container }} + image: ${{ fromJSON(needs.matrix.outputs.registry) }}/${{ matrix.container }} options: "--privileged -v /dev:/dev" steps: - name: "Checkout Repository" - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: "${{ inputs.container }} ${{ matrix.test }}" + - name: "${{ matrix.container }} ${{ matrix.test }}" run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 60ca1db..1113af0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -9,11 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Check-out the repo under $GITHUB_WORKSPACE - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Commisery - uses: dracutdevs/commisery-action@master + uses: tomtom-international/commisery-action@master with: token: ${{ secrets.GITHUB_TOKEN }} - pull_request: ${{ github.event.number }} - + # don't validate the pull request title + validate-pull-request: false + validate-pull-request-title-bump: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7497d6e..a12126e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,16 +18,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Install dependencies + run: | + sudo apt -y update + sudo apt -y install asciidoc + - name: Build run: bash ${GITHUB_WORKSPACE}/tools/release.sh ${{ inputs.tag }} - name: Release if: ${{ env.new_version }} - uses: softprops/action-gh-release@v0.1.15 + uses: softprops/action-gh-release@v2.0.5 with: tag_name: ${{ env.new_version }} name: dracut-${{ env.new_version }} @@ -4,14 +4,12 @@ /man/dracut.conf.5 /dracut.conf.d/*.conf /man/dracut.cmdline.7 -/dracut.html /man/dracut.kernel.7 /man/dracut.bootup.7 /man/dracut.modules.7 /man/lsinitrd.1 /dracut.pc /dracut-install -/modules.d/99base/switch_root /test/*/test.log /test/*/.testdir test*.img @@ -1,8 +1,8 @@ Harald Hoyer <harald@profian.com> +Laszlo Gombos <laszlo.gombos@gmail.com> Victor Lowther <victor.lowther@gmail.com> -Jóhann B. Guðmundsson <johannbg@gmail.com> Antonio Alvarez Feijoo <antonio.feijoo@suse.com> -Laszlo Gombos <laszlo.gombos@gmail.com> +Jóhann B. Guðmundsson <johannbg@gmail.com> Amadeusz Żołnowski <aidecoe@aidecoe.name> Daniel Molkentin <daniel.molkentin@suse.com> Hannes Reinecke <hare@suse.com> @@ -15,8 +15,8 @@ Martin Wilck <mwilck@suse.de> Jeremy Katz <katzj@redhat.com> Lukas Nykryn <lnykryn@redhat.com> David Dillow <dave@thedillows.org> -Lubomir Rintel <lkundrak@v3.sk> Henrik Gombos <henrik99999@gmail.com> +Lubomir Rintel <lkundrak@v3.sk> Michal Soltys <soltys@ziu.info> Colin Guthrie <colin@mageia.org> Amerigo Wang <amwang@redhat.com> @@ -25,35 +25,37 @@ Frederick Grose <fgrose@sugarlabs.org> Alexander Tsoy <alexander@tsoy.me> Beniamino Galvani <bgalvani@redhat.com> наб <nabijaczleweli@nabijaczleweli.xyz> -WANG Chao <chaowang@redhat.com> +Benjamin Drung <benjamin.drung@canonical.com> Jonathan Lebon <jonathan@jlebon.com> +Steffen Maier <maier@linux.ibm.com> +WANG Chao <chaowang@redhat.com> Yu Watanabe <watanabe.yu+github@gmail.com> Andrey Borzenkov <arvidjaar@gmail.com> David Disseldorp <ddiss@suse.de> David Tardon <dtardon@redhat.com> Frantisek Sumsal <frantisek@sumsal.cz> Peter Robinson <pbrobinson@fedoraproject.org> +Thomas Blume <thomas.blume@suse.com> Hans de Goede <hdegoede@redhat.com> Pavel Valena <pvalena@redhat.com> -Thomas Blume <thomas.blume@suse.com> -Benjamin Drung <benjamin.drung@canonical.com> Peter Jones <pjones@redhat.com> Andreas Thienemann <andreas@bawue.net> Marcos Mello <marcosfrm@gmail.com> Renaud Métrich <rmetrich@redhat.com> Tomasz Paweł Gajc <tpgxyz@gmail.com> +Andrew Ammerlaan <andrewammerlaan@gentoo.org> Brian C. Lane <bcl@redhat.com> Fabian Vogt <fvogt@suse.com> Nicolas Chauvet <kwizart@gmail.com> Zoltán Böszörményi <zboszor@pr.hu> Colin Walters <walters@verbum.org> +Dusty Mabe <dusty@dustymabe.com> John Reiser <jreiser@bitwagon.com> Luca Berra <bluca@vodka.it> Shreenidhi Shedi <sshedi@vmware.com> Xunlei Pang <xlpang@redhat.com> Daniel Drake <drake@endlessm.com> David Teigland <teigland@redhat.com> -Dusty Mabe <dusty@dustymabe.com> Kairui Song <kasong@tencent.com> Angelo "pallotron" Failla <pallotron@fb.com> Dan Horák <dhorak@redhat.com> @@ -75,7 +77,9 @@ Nathan Rini <nate@ucar.edu> Radek Vykydal <rvykydal@redhat.com> Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Đoàn Trần Công Danh <congdanhqx@gmail.com> +Adam Williamson <awilliam@redhat.com> Fabian Deutsch <fabiand@fedoraproject.org> +Jan Macku <jamacku@redhat.com> Kamil Rytarowski <n54@gmx.com> Lidong Zhong <lidong.zhong@suse.com> Marc Grimme <grimme@atix.de> @@ -83,8 +87,6 @@ NeilBrown <neilb@suse.de> Peter Rajnoha <prajnoha@redhat.com> Thorsten Behrens <tbehrens@suse.com> q66 <daniel@octaforge.org> -Adam Williamson <awilliam@redhat.com> -Andrew Ammerlaan <andrewammerlaan@gentoo.org> Chao Wang <chaowang@redhat.com> Frederic Crozat <fcrozat@suse.com> James Lee <jlee@thestaticvoid.com> @@ -120,6 +122,7 @@ Michael Ploujnikov <plouj@somanetworks.com> Michal Koutný <mkoutny@suse.com> Nicolas Porcel <nicolasporcel06@gmail.com> Pratyush Anand <panand@redhat.com> +Sam James <sam@gentoo.org> Silvio Fricke <silvio.fricke@gmail.com> Stefan Berger <stefanb@linux.ibm.com> Steven Brudenell <steven.brudenell@gmail.com> @@ -139,16 +142,20 @@ Andre Russ <andre.russ@sap.com> Andreas Schwab <schwab@suse.de> Ankit Kumar <ankit@linux.vnet.ibm.com> Antony Messerli <amesserl@rackspace.com> +Benjamin Marzinski <bmarzins@redhat.com> Chao Fan <cfan@redhat.com> Coiby Xu <coxu@redhat.com> Cornelius Hoffmann <coding@hoffmn.de> Daniel Cordero <dracut@0xdc.io> Daniel Kahn Gillmor <dkg@fifthhorseman.net> Daniel Schaal <farbing@web.de> +Daniel Winzen <daniel@danwin1210.de> Denis Silakov <dsilakov@virtuozzo.com> Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Erwan Velu <erwan.velu@enovance.com> Evgeny Vereshchagin <evvers@ya.ru> +Federico Vaga <federico.vaga@cern.ch> +Frederick Grose <4335897+FGrose@users.noreply.github.com> German Maglione <gmaglione@redhat.com> Guido Trentalancia <guido@trentalancia.net> Hari Bathini <hbathini@linux.ibm.com> @@ -156,10 +163,10 @@ Hari Bathini <hbathini@linux.vnet.ibm.com> Ian Dall <ian@beware.dropbear.id.au> Imran Haider <imran1008@gmail.com> James Buren <ryuo@frugalware.org> -Jan Macku <jamacku@redhat.com> Joey Boggs <jboggs@redhat.com> José María Fernández <josemariafg@gmail.com> Julian Wolf <juwolf@suse.com> +Kamil Szczęk <kamil@szczek.dev> Koen Kooi <koen@dominion.thruhere.net> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Kyle McMartin <kmcmarti@redhat.com> @@ -167,11 +174,13 @@ Lee Duncan <lduncan@suse.com> LinkTed <link.ted@mailbox.org> Luiz Angelo Daros de Luca <luizluca@gmail.com> Lukas Wunner <lukas@wunner.de> +Manuel Fombuena <mfombuena@innovara.co.uk> Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Marko Myllynen <myllynen@redhat.com> Matthew Thode <mthode@mthode.org> Mike Snitzer <snitzer@redhat.com> Minfei Huang <mhuang@redhat.com> +Neal Gompa <neal@gompa.dev> Nikoli <nikoli@gmx.us> Patrick Talbert <ptalbert@redhat.com> Pedro Monreal <pmgdeb@gmail.com> @@ -183,8 +192,12 @@ Stefan Berger <stefanb@us.ibm.com> Thomas Lange <lange@informatik.uni-koeln.de> Tianhao Chai <cth451@gmail.com> Till Maas <opensource@till.name> +Vitaly Kuznetsov <vkuznets@redhat.com> Vivek Goyal <vgoyal@redhat.com> Vladislav Bogdanov <bubble@hoster-ok.com> +Wenchao Hao <haowenchao@huawei.com> +dalto8 <57767042+dalto8@users.noreply.github.com> +farfalleflickan <6597735+farfalleflickan@users.noreply.github.com> nkraetzschmar <nkraetzschmar@users.noreply.github.com> Érico Rolim <erico.erc@gmail.com> “Masahiro <mmatsuya@redhat.com> @@ -197,12 +210,14 @@ Alexander Sosedkin <asosedkin@redhat.com> Alexander Todorov <atodorov@redhat.com> Alexey Kodanev <alexey.kodanev@oracle.com> Andreas Stieger <astieger@suse.com> +Andrew Gunnerson <accounts+github@chiller3.com> Andrew Halaney <ahalaney@redhat.com> Andrew J. Hesford <ajh@sideband.org> Andrey Sokolov <keremet@altlinux.org> Andy Lutomirski <luto@mit.edu> Anjali Kulkarni <anjali.k.kulkarni@oracle.com> Anssi Hannula <anssi@mageia.org> +Anton Lundin <glance@ac2.se> Antz <antzz@protonmail.ch> Arnaud Rebillout <arnaud.rebillout@collabora.com> Artem Savkov <asavkov@redhat.com> @@ -210,9 +225,11 @@ Attila Bruncsak <bruncsak@users.noreply.github.com> B. Wilson <x@wilsonb.com> Ben Howard <ben.howard@redhat.com> Benjamin Gilbert <bgilbert@redhat.com> -Benjamin Marzinski <bmarzins@redhat.com> +Bernhard M. Wiedemann <bwiedemann@suse.de> +Bernhard Rosenkraenzer <bero@lindev.ch> Brandon Philips <brandon@ifup.co> Brandon Sloane <btsloane@verizon.net> +Brian Harring <ferringb@gmail.com> Bruno E. O. Meneguele <bmeneg@redhat.com> Bryn M. Reeves <bmr@redhat.com> Canek Peláez Valdés <caneko@gmail.com> @@ -226,7 +243,9 @@ Conrad Hoffmann <ch@bitfehler.net> Daan De Meyer <daan.j.demeyer@gmail.com> Dan Fuhry <dfuhry@datto.com> Daniel McIlvaney <damcilva@microsoft.com> +Daniel P. Berrangé <berrange@redhat.com> Dave Jones <davej@redhat.com> +David Cassany <dcassany@suse.com> David Hildenbrand <david@redhat.com> David Michael <david.michael@coreos.com> Denis Volkov <denis@simpletexting.net> @@ -249,7 +268,6 @@ Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com> Florian Gamböck <mail@floga.de> Frank Deng <frank.deng@oracle.com> François Cami <fcami@fedoraproject.org> -Frederick Grose <4335897+FGrose@users.noreply.github.com> Gerd von Egidy <gerd.von.egidy@intra2net.com> Glen Gray <slaine@slaine.org> Glenn Morris <rgm@stanford.edu> @@ -260,7 +278,9 @@ Hermann Gausterer <git-dracut-2012@mrq1.org> Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp> Hongxu Jia <hongxu.jia@windriver.com> Hui Wang <john.wanghui@huawei.com> +Icenowy Zheng <uwu@icenowy.me> Ignaz Forster <iforster@suse.com> +Ihno Krumreich <ihno@suse.com> Jacob Wen <jian.w.wen@oracle.com> James Laska <jlaska@redhat.com> James Morris <morisja@gmail.com> @@ -268,6 +288,7 @@ Jan Stodola <jstodola@redhat.com> Jaroslav Jindrak <dzejrou@gmail.com> Jason Dana <jasondana@quarksecurity.com> Jens Heise <46450477+heisej@users.noreply.github.com> +Jeremy Linton <jeremy.linton@arm.com> Jeremy Linton <jlinton@redhat.com> Jeremy Linton <lintonrjeremy@gmail.com> Jiri Pirko <jiri@resnulli.us> @@ -282,6 +303,7 @@ Kevin Yung <Kevin.Yung@myob.com> Khem Raj <raj.khem@gmail.com> Lars R. Damerow <lars@pixar.com> Lars Wendler <polynomial-c@gentoo.org> +Laszlo <laszlo.gombos@gmail.com> Laura Hild <lsh@jlab.org> Lennart Poettering <lennart@poettering.net> Lennert Buytenhek <buytenh@wantstofly.org> @@ -290,6 +312,7 @@ Lianbo Jiang <lijiang@redhat.com> Luca BRUNO <luca.bruno@coreos.com> Lucas C. Villa Real <lucasvr@gmail.com> Major Hayden <major@mhtx.net> +Manuel Fombuena <fombuena@outlook.com> Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Marian Csontos <mcsontos@redhat.com> @@ -308,7 +331,7 @@ Mike Gorse <mgorse@suse.com> Moritz 'Morty' Strübe <morty@gmx.net> Morten Linderud <morten@linderud.pw> Munehiro Matsuda <haro@kgt.co.jp> -Neal Gompa <neal@gompa.dev> +Nick Rosbrook <enr0n@ubuntu.com> Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Olivier Blin <dev@blino.org> Ondrej Dubaj <odubaj@redhat.com> @@ -326,11 +349,11 @@ Prarit Bhargava <prarit@redhat.com> Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com> Pádraig Brady <P@draigBrady.com> Quentin Armitage <quentin@armitage.org.uk> +Reilly Brogan <reilly@reillybrogan.com> Robert Buchholz <rbu@goodpoint.de> Ruben Kerkhof <ruben@rubenkerkhof.com> Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent> Rusty Bird <rustybird@openmailbox.org> -Sam James <sam@gentoo.org> Savyasachee Jha <genghizkhan91@hawkradius.com> Scott Moser <smoser@brickies.net> Sebastian Mitterle <smitterl@redhat.com> @@ -341,6 +364,7 @@ Shawn W Dunn <sfalken@opensuse.org> Srinivasa T N <seenutn@linux.vnet.ibm.com> Stijn Hoop <stijn@sandcat.nl> Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net> +Thierry Bultel <thierry.bultel@linatsea.fr> Thierry Vignaud <thierry.vignaud@gmail.com> Thilo Bangert <thilo.bangert@gmx.net> Thomas Abraham <tabraham@suse.com> @@ -348,15 +372,15 @@ Thomas Haller <thaller@redhat.com> Tobias Geerinckx <tobias.geerinckx@gmail.com> Tobias Klauser <tklauser@distanz.ch> Tom Gundersen <teg@jklm.no> +Tomas Bzatek <tbzatek@redhat.com> Tomasz Torcz <tomek@pipebreaker.pl> Tong Li <tonli@redhat.com> Vadim Kuznetsov <vadimk@gentoo.org> +Valentin David <valentin.david@canonical.com> Valentin Lefebvre <valentin.lefebvre@suse.com> Vaughan Cao <vaughan.cao@oracle.com> -Vitaly Kuznetsov <vkuznets@redhat.com> Vladius25 <vkorol2509@icloud.com> Vratislav Podzimek <vpodzime@redhat.com> -Wenchao Hao <haowenchao@huawei.com> Yang Liu <50459973+ly4096x@users.noreply.github.com> Yanko Kaneti <yaneti@declera.com> Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com> @@ -364,7 +388,9 @@ Ziyue Yang <ziyang@redhat.com> foopub <45460217+foopub@users.noreply.github.com> gaoyi <ymuemc@163.com> gombi <gombi@> +gregory-lee-bartholomew <gregory.lee.bartholomew@gmail.com> honza801 <honza801@gmail.com> +innovara <fombuena@outlook.com> jbash aka John Bashinski <jbash@velvet.com> jloeser <jloeser@suse.de> joamonwx <unknown> @@ -228,22 +228,11 @@ clean: $(RM) dracut-install src/install/dracut-install $(DRACUT_INSTALL_OBJECTS) $(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS) $(RM) dracut-util util/util $(UTIL_OBJECTS) - $(RM) $(manpages) dracut.html + $(RM) $(manpages) $(RM) dracut.pc $(RM) dracut-cpio src/dracut-cpio/target/release/dracut-cpio* $(MAKE) -C test clean -dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz - -dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck - git archive --format=tar $(DRACUT_MAIN_VERSION) --prefix=dracut-$(DRACUT_MAIN_VERSION)/ > dracut-$(DRACUT_MAIN_VERSION).tar - mkdir -p dracut-$(DRACUT_MAIN_VERSION) - for i in $(manpages) dracut.html; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(DRACUT_MAIN_VERSION)/$${i%/*}"; cp "$$i" "dracut-$(DRACUT_MAIN_VERSION)/$$i"; done - tar --owner=root --group=root -rf dracut-$(DRACUT_MAIN_VERSION).tar $$(find dracut-$(DRACUT_MAIN_VERSION) -type f) - rm -fr -- dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION) - xz -9 dracut-$(DRACUT_MAIN_VERSION).tar - rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar - syncheck: @ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \ [ "$${i##*/}" = "module-setup.sh" ] && continue; \ @@ -264,7 +253,6 @@ endif endif check: all syncheck - @[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } @$(MAKE) -C test check testimage: all @@ -1,4 +1,317 @@ -[Rendered view](https://github.com/dracutdevs/dracut/blob/master/NEWS.md) +[Rendered view](https://github.com/dracut-ng/dracut-ng/blob/master/NEWS.md) + +dracut-ng-102 +============= + +This release includes fixes for compatibility with the latest Linux kernel (v6.9), Linux firmware, and systemd (v256). + +New dracut modules introduced by this release: + - pcmcia: factor out pcmcia support into its own module + - systemd-bsod: display a blue screen which contains a message relating to a boot failure + - numlock: module to turn Num Lock on + - systemd-cryptsetup: factor out systemd-cryptsetup support into its own module + +dracut modules removed by this release: + - dasd_rules: remove dasd handling consolidated in s390-tools + - qeth_rules: remove qeth handling consolidated in 95znet + - zfcp_rules: remove zfcp handling consolidated in s390-tools + +The project builds test containers daily for the following Linux distributions: + - Alpine + - Arch + - Debian (amd64 and arm64) + - Fedora (amd64 and arm64) + - Gentoo + - openSUSE + - Ubuntu + - Void + +These Linux distributions test dracut in various configurations (systemd/OpenRC/runit, glibc/musl, dhclient/NetworkManager/systemd-networkd). + +#### Performance + +* **crypt:** move more rules to systemd-cryptsetup ([6325af42](https://github.com/dracut-ng/dracut-ng/commit/6325af428d1436fff58b4c11a0ec6530df75114a)) +* **dracut-init.sh:** stop parsing args in dracut_instmods if --silent is found ([16863113](https://github.com/dracut-ng/dracut-ng/commit/168631130cfe6b8993272d833f764c96377b526f)) +* **dracut-systemd:** check for systemd binary ([51d0257b](https://github.com/dracut-ng/dracut-ng/commit/51d0257be63269d5018d284208d8148c8c7958dc)) +* **drm:** group dracut_instmods calls ([80f2caf4](https://github.com/dracut-ng/dracut-ng/commit/80f2caf4f5ee47a708b5e4bd65c28e3f8ff1b9c8)) +* **systemd:** + * remove duplicate rules ([d6ba849b](https://github.com/dracut-ng/dracut-ng/commit/d6ba849bb6234ff11fe840ff5c7c327f7c8492f6)) + * remove duplicate rules ([45a65df3](https://github.com/dracut-ng/dracut-ng/commit/45a65df352f5460c74cc3af71562b62b1cb47429)) + * remove duplicate rules ([db20908c](https://github.com/dracut-ng/dracut-ng/commit/db20908cbbcf2779372e05d7d42162e83da86f12)) + * remove duplicate rules ([fb75d4a8](https://github.com/dracut-ng/dracut-ng/commit/fb75d4a862a04c235e46bf9a9d8ce918bcda0a9a)) + * remove duplicate rules ([6c5520df](https://github.com/dracut-ng/dracut-ng/commit/6c5520dff67a63df4ee735ab4f618d3faaf869d9)) +* **systemd-udevd:** remove duplicate rules ([28846382](https://github.com/dracut-ng/dracut-ng/commit/28846382bf7d76b92cf6004345a982b4ae973f8a)) + +#### Bug Fixes + +* /etc/modprobe.d --> /run/modprobe.d ([424717af](https://github.com/dracut-ng/dracut-ng/commit/424717af8e0a86dac7a9898bf161f04e35abd2c2)) +* crypt-gpg-lib.sh ([1ca38f04](https://github.com/dracut-ng/dracut-ng/commit/1ca38f0476a7b0267a51f812b04f52de1453429e)) +* module-setup.sh missing stty ([1af35319](https://github.com/dracut-ng/dracut-ng/commit/1af353193dbc4e5f23dc64746bbde4c0685c98b8)) +* network-manager should include kernel-network-modules ([cabd38d8](https://github.com/dracut-ng/dracut-ng/commit/cabd38d8c375fafe13edc26c5ed908b60b44d8d3)) +* clean Makefile rule ([b89a0fb2](https://github.com/dracut-ng/dracut-ng/commit/b89a0fb2b082b582289a6a8d46b9e0d200924d14)) +* **01systemd-ldconfig:** install ldconfig.real ([125bb0a8](https://github.com/dracut-ng/dracut-ng/commit/125bb0a81e08d28f5c8a516a7e6cc8563de9fabb)) +* **35-network-manager:** let the kernel generate a UUID for /etc/machine-id ([1e2b5c30](https://github.com/dracut-ng/dracut-ng/commit/1e2b5c305e79ac6998d4d59f64c6dee285214057)) +* **90kernel-modules:** add psmouse for some Fujitsu laptops ([343ce3bb](https://github.com/dracut-ng/dracut-ng/commit/343ce3bbb947e4f7bb31542203b8fc68147f5add)) +* **Dockerfile-Gentoo:** + * resolve glibc/libxcrypt conflict ([b6b8cf3e](https://github.com/dracut-ng/dracut-ng/commit/b6b8cf3e1ca6e5964c02910695e22c296bcea458)) + * pull in virtual/pkgconfig ([4d5e9079](https://github.com/dracut-ng/dracut-ng/commit/4d5e90798f1b12343ad884dc53ecec846eaaa956)) + * add --deep, --autounmask-continue, and depclean ([b182af73](https://github.com/dracut-ng/dracut-ng/commit/b182af730c75732ab49aad545e95002ffb19c674)) +* **base:** + * add support for rd.udev.log_level ([a471ca60](https://github.com/dracut-ng/dracut-ng/commit/a471ca601b2ae6d924dab0603dbf275cb360a6ff)) + * install /etc/udev/udev.conf in hostonly mode only ([2ab9ecce](https://github.com/dracut-ng/dracut-ng/commit/2ab9eccee3352e8ce8a94842ff6ab496c6654166)) + * log the full udev database in rdsosreport ([3fc15986](https://github.com/dracut-ng/dracut-ng/commit/3fc15986518aea030a6a850ae779750110320276)) +* **configure:** resolve regression for crosscompiling ([25dabef1](https://github.com/dracut-ng/dracut-ng/commit/25dabef1dab4612e31be84af3e262dc187ec4158)) +* **cpio:** eliminate compile time warning ([18788930](https://github.com/dracut-ng/dracut-ng/commit/1878893054ec175ce2493cecf6ea81727519eceb)) +* **crypt:** + * unlock encrypted devices by default during boot ([2339acfa](https://github.com/dracut-ng/dracut-ng/commit/2339acfaeee60d6bb26a1103db2e53bc8f9cb2d1)) + * add systemd-ask-password dependency if systemd is used ([caafea4e](https://github.com/dracut-ng/dracut-ng/commit/caafea4e80305306d5aa8cd7540698a1932629dc)) +* **dmsquash-live:** + * do not check ISO md5 if image filesystem ([c6906fea](https://github.com/dracut-ng/dracut-ng/commit/c6906fea4df28428aa889c7bb8197689ae8107ee)) + * use load_fstype to load driver for filesystems ([541ae946](https://github.com/dracut-ng/dracut-ng/commit/541ae946b2fb715ed6d88b32dce97bd3ad30c599)) + * update documentation ([d2d41a36](https://github.com/dracut-ng/dracut-ng/commit/d2d41a36d86aca3deb05fe1be41bd06576c13d3f)) +* **dracut:** + * microcode loading ([16573680](https://github.com/dracut-ng/dracut-ng/commit/16573680d1b6cfba2147a41ab9c5309b7d91a71e)) + * bsdcpio compatibility ([572afed1](https://github.com/dracut-ng/dracut-ng/commit/572afed17595f45daab98670975aea78e81ff9b1)) + * add support for RISC-V EFI ([136a9a10](https://github.com/dracut-ng/dracut-ng/commit/136a9a101f142f24567bd345c8d3a388f8a75b32)) + * move hooks directory from /usr/lib to /var/lib ([a45048b8](https://github.com/dracut-ng/dracut-ng/commit/a45048b80c27ee5a45a380052a6d29ab1925f7f9), closes [#2588](https://github.com/dracut-ng/dracut-ng/issues/2588)) +* **dracut-fuctions.sh:** correct wrong regex pattern for LVM dm devices ([4c2f756f](https://github.com/dracut-ng/dracut-ng/commit/4c2f756f8fda68e6a89e47ca187695431d1baee0)) +* **dracut-init.sh:** + * force to perform the actual action ([ffeb32b2](https://github.com/dracut-ng/dracut-ng/commit/ffeb32b2d2caecc2111bfd93b6919dc4f09d3c2d)) + * handle decompress with `--sysroot` ([91cdd57f](https://github.com/dracut-ng/dracut-ng/commit/91cdd57f519f90c5c31741616f90c262cf90700c)) +* **dracut-install:** + * release memory allocated for regular expressions ([d93bac05](https://github.com/dracut-ng/dracut-ng/commit/d93bac05471b82bb38b94af6fa81ef0337e9e2c9)) + * continue parsing if ldd prints "cannot be preloaded" ([ace9e1b5](https://github.com/dracut-ng/dracut-ng/commit/ace9e1b58c09e1e91621ad2219f7a96b7edbbd38)) +* **dracut-lib:** only remove initqueue/finished scripts, not the hook dir ([e8257deb](https://github.com/dracut-ng/dracut-ng/commit/e8257debcd42c7640ad0e3b9ab4c5306794776ec), closes [#2620](https://github.com/dracut-ng/dracut-ng/issues/2620)) +* **dracut-systemd:** + * include systemd-ask-password module ([0bfe0867](https://github.com/dracut-ng/dracut-ng/commit/0bfe0867dae9f60ec316f4b90bd0b3ea9f2a027c)) + * replace `rd.udev.log-priority` with `rd.udev.log_level` ([c1275d87](https://github.com/dracut-ng/dracut-ng/commit/c1275d878cc6f6dac5b59a2024e6b5cc777dd6c7)) +* **dracut.sh:** + * include efi mountpoint for hostonly ([4a6a4ac6](https://github.com/dracut-ng/dracut-ng/commit/4a6a4ac6a92dbbcd6edeb3ca4d9148d90ac3423d)) + * don't unset LD_PRELOAD ([1eff6933](https://github.com/dracut-ng/dracut-ng/commit/1eff6933fb3a38cd03ac64785dc62afbc8e5b480)) + * do not add device if find_block_device fails ([0f6c46aa](https://github.com/dracut-ng/dracut-ng/commit/0f6c46aa66a1dc9582d3ec5e18ed56b55e970ce8)) + * make uki's reproducible ([aabb5a41](https://github.com/dracut-ng/dracut-ng/commit/aabb5a4106295c6d3234215ab30f8dc2fb93eed7)) + * omit compressed kernel modules from find searching exec files ([ad36b61e](https://github.com/dracut-ng/dracut-ng/commit/ad36b61ec1a26714fbe3049435eff7199ffea5e0)) +* **fips:** remove /dev/{random,urandom} pre-creation ([5beda2ea](https://github.com/dracut-ng/dracut-ng/commit/5beda2ea009046c1398ea5af868cc5743beb0f01)) +* **github:** add the recently introduced modules to the labeler ([5957f5c5](https://github.com/dracut-ng/dracut-ng/commit/5957f5c5950fa6415369ce91fdc362710e7689a6)) +* **i18n:** handle keymap includes with `--sysroot` ([5b714d25](https://github.com/dracut-ng/dracut-ng/commit/5b714d25e1750132429005d289c81522aa2ae8d5)) +* **install.d:** + * prevent failure when kernel-install command is not `add` ([6fec7d39](https://github.com/dracut-ng/dracut-ng/commit/6fec7d3936d25bbfb15ee7362fd0a9499644bc32)) + * correctly install pre-genned image and die if no args ([8388ad14](https://github.com/dracut-ng/dracut-ng/commit/8388ad149c698c951089606352fdb0cdcaaf40c9)) + * simplify and use what kernel-install gives us ([d4015538](https://github.com/dracut-ng/dracut-ng/commit/d40155385d060f8d8608fa8a4931e2e42ddc3a8f)) +* **iscsi:** do not add host's runtime iscsi configure files in initrd ([292e79e8](https://github.com/dracut-ng/dracut-ng/commit/292e79e88c6c6a53af33abe840b1571879001ba6)) +* **man:** further clarify live-image overlay types & RAM usage ([5fa405dd](https://github.com/dracut-ng/dracut-ng/commit/5fa405dd1f705f035ba91350a2b0799ddbd87893)) +* **memstrack:** move the console warning to be a comment ([ee1c37e3](https://github.com/dracut-ng/dracut-ng/commit/ee1c37e31e5d14f35cfab3353547ee1177d1c9e0)) +* **multipath:** explicitly check if `hostonly_cmdline` is `yes` ([c262ec6d](https://github.com/dracut-ng/dracut-ng/commit/c262ec6d1c065b3c0b00ce864f2ea7c849d13b9d)) +* **numlock:** + * use the same shebang as other dracut modules ([67987959](https://github.com/dracut-ng/dracut-ng/commit/679879590f4cb428e79c1a28a8b77357dd6bae1a)) + * use the same shebang as other dracut modules ([efa02688](https://github.com/dracut-ng/dracut-ng/commit/efa0268881df36824c72020e6f8b8966cc189375)) +* **nvmf:** move /etc/nvme/host{nqn,id} requirement to hostonly ([54cd6479](https://github.com/dracut-ng/dracut-ng/commit/54cd647932c42e5520a8bcdd3e5882210e4603c5)) +* **release:** dracut --> dracut-ng for NEWS.md ([6fb8fc8b](https://github.com/dracut-ng/dracut-ng/commit/6fb8fc8b70d20b82bfcda99d9da193e16d5f315b)) +* **systemd:** explicitly install some libs that will not be statically included ([04b362d7](https://github.com/dracut-ng/dracut-ng/commit/04b362d713235459cff1f370efb4cd5e36e4a358), closes [#2642](https://github.com/dracut-ng/dracut-ng/issues/2642)) +* **systemd-ask-password:** + * no graphical output in aarch64 ([4cc962aa](https://github.com/dracut-ng/dracut-ng/commit/4cc962aa0989c53822f4bd6c5431488c7707124e)) + * resolve regression ([25c5cfa2](https://github.com/dracut-ng/dracut-ng/commit/25c5cfa2ca70a4b76fafa7a12ebb87b51256adba)) +* **systemd-cryptsetup:** add potentially needed modules to generic initrd ([9179ade8](https://github.com/dracut-ng/dracut-ng/commit/9179ade8a0e33a0c6ef951073f3b89790ee5eda0)) +* **systemd-initrd:** + * systemd based initrd needs journald and tmpfiles ([860b35c3](https://github.com/dracut-ng/dracut-ng/commit/860b35c38ea8764e75aed3d5fca8b811b026f2a6)) + * only included if another module depends on it ([6d3e69ac](https://github.com/dracut-ng/dracut-ng/commit/6d3e69ac40afd2e4b61b2fc244671a417ea8b03d)) + * add systemd-udevd dependency ([8910f8bb](https://github.com/dracut-ng/dracut-ng/commit/8910f8bbeaedf2b55c788490080290be4a122114)) +* **systemd-journald:** add systemd dependency ([06e4a854](https://github.com/dracut-ng/dracut-ng/commit/06e4a854700e6353771aa8c13379f4f541dc53ee)) +* **systemd-networkd:** + * drop networkctl as it has a dependency on dbus ([7a1519bf](https://github.com/dracut-ng/dracut-ng/commit/7a1519bfc6bd96691e7df2c6a655f9fd1a0b5e77)) + * dbus is not a mandatory dependency ([6f764a1d](https://github.com/dracut-ng/dracut-ng/commit/6f764a1db8a40fe484682c38ef649abc333150c5)) +* **systemd-sysext:** handle confexts and correct extensions search path ([30da2173](https://github.com/dracut-ng/dracut-ng/commit/30da2173e25cf445d52e30456f6938230efd97b1)) +* **systemd-udevd:** add systemd-sysctl dependency ([2c866733](https://github.com/dracut-ng/dracut-ng/commit/2c866733bff45c8cba4efdc3fae26eb98ac9f546)) +* **test:** + * add support for thin volumes in the Gentoo container ([6fc87f5c](https://github.com/dracut-ng/dracut-ng/commit/6fc87f5c664788d1715cca49d1b327611625144f)) + * fixup Gentoo CI ([8bcd077d](https://github.com/dracut-ng/dracut-ng/commit/8bcd077d5eb5a811cb34b0d307a5d886ecddca60)) + * remove ib700wdt kernel module from tests ([2526a92e](https://github.com/dracut-ng/dracut-ng/commit/2526a92e9867e1800875b9889de5739c8930381d)) + * do not omit dracut modules for initramfs.testing ([5cb42481](https://github.com/dracut-ng/dracut-ng/commit/5cb42481e8738b6a173e0ecacdf722b772188336)) + * fixup Gentoo CI ([3b9054a4](https://github.com/dracut-ng/dracut-ng/commit/3b9054a404bdf15ab92a35d7b8d58841d31c905e)) +* **znet:** append to udev rules so each rd.znet_ifname is effective ([22f51730](https://github.com/dracut-ng/dracut-ng/commit/22f51730860a1715c9420d066aea691bfa03a81e)) + +#### Features + +* **90dm:** close crypt devices using cryptsetup ([fba8622f](https://github.com/dracut-ng/dracut-ng/commit/fba8622fdd06540bd2a62262e945fe66392a26d3), closes [#204](https://github.com/dracut-ng/dracut-ng/issues/204)) +* **90systemd-cryptsetup:** socket key files ([80480a73](https://github.com/dracut-ng/dracut-ng/commit/80480a731aabec11a1e72f08725a47c63c45632d)) +* **dasd:** minimize dasd handling consolidated in s390-tools ([36e1f884](https://github.com/dracut-ng/dracut-ng/commit/36e1f88417557d5b031a490dfc810a3c9d7d5f64)) +* **dasd_mod:** minimize dasd handling consolidated in s390-tools ([2397c479](https://github.com/dracut-ng/dracut-ng/commit/2397c4797a426b7dd936e6ea1910c647f38461b5)) +* **dasd_rules:** remove dasd handling consolidated in s390-tools ([72c945ca](https://github.com/dracut-ng/dracut-ng/commit/72c945cad0961312cecbba62fcf2df8972909230)) +* **dracut.sh:** make initramfs-${kernel}.img filename configurable ([28820e20](https://github.com/dracut-ng/dracut-ng/commit/28820e20532890b9b0cf816ce1b527c582a1f3b3)) +* **ifcfg:** minimize s390-specific network configuration aspects ([457e66e6](https://github.com/dracut-ng/dracut-ng/commit/457e66e679b780ec4de58b87237f29eeed548e08)) +* **lsinitrd.sh:** + * print stored dracut cmdline ([d10455ad](https://github.com/dracut-ng/dracut-ng/commit/d10455ad1a0d4c3f2c00f5ec7aabace8487aee6d)) + * enable unpacking files from squash-root.img ([9b12ef98](https://github.com/dracut-ng/dracut-ng/commit/9b12ef98a8fdf2b8611fe82f96560c690bb5d2ad)) +* **numlock:** add module to turn Num Lock on ([60b44261](https://github.com/dracut-ng/dracut-ng/commit/60b442614de207bb7107743ec15261b17b550c41)) +* **pcmcia:** factor out pcmcia support into its own module ([4b21d5f7](https://github.com/dracut-ng/dracut-ng/commit/4b21d5f740b9f0ae5c8843713543ae62ec42b225)) +* **qeth_rules:** remove qeth handling consolidated in 95znet ([198a86c2](https://github.com/dracut-ng/dracut-ng/commit/198a86c2c7fdd39446d785afa1917ccb4727809d)) +* **systemd-bsod:** dracut module for systemd-bsod ([d7ab919e](https://github.com/dracut-ng/dracut-ng/commit/d7ab919eaa6d820545ca73549e1ce87f8c00aefb)) +* **systemd-cryptsetup:** new module for systemd-cryptsetup ([649e37bc](https://github.com/dracut-ng/dracut-ng/commit/649e37bcd5ac46d5ac440b80297370c07ee7e1a8)) +* **systemd-pcrphase:** include systemd-pcrphase if dependencies are met ([c5cbdaf3](https://github.com/dracut-ng/dracut-ng/commit/c5cbdaf3050f46c446fe736032ae872376f6d365)) +* **tpm2-tss:** add tpm2.target and systemd-tpm2-generator ([edd870ed](https://github.com/dracut-ng/dracut-ng/commit/edd870eda138bb9fe617f3e71b524dcf7d631e65)) +* **zfcp:** minimize zfcp handling consolidated in s390-tools ([7745a81a](https://github.com/dracut-ng/dracut-ng/commit/7745a81afd85a437d4ec9bf023efa942cd5ca109)) +* **zfcp_rules:** remove zfcp handling consolidated in s390-tools ([b5a35f9d](https://github.com/dracut-ng/dracut-ng/commit/b5a35f9d9bad1958e9c5433d8e2b167d4bb83195)) +* **znet:** use zdev for consolidated device configuration ([658a21ac](https://github.com/dracut-ng/dracut-ng/commit/658a21ac276b8d7aba950c5ad7c3f8132681512b)) + +#### Contributors + +- Laszlo Gombos <laszlo.gombos@gmail.com> +- Steffen Maier <maier@linux.ibm.com> +- Antonio Alvarez Feijoo <antonio.feijoo@suse.com> +- Andrew Ammerlaan <andrewammerlaan@gentoo.org> +- Daniel Winzen <daniel@danwin1210.de> +- Federico Vaga <federico.vaga@cern.ch> +- Kamil Szczęk <kamil@szczek.dev> +- dalto8 <57767042+dalto8@users.noreply.github.com> +- farfalleflickan <6597735+farfalleflickan@users.noreply.github.com> +- Andrew Gunnerson <accounts+github@chiller3.com> +- Anton Lundin <glance@ac2.se> +- Bernhard Rosenkraenzer <bero@lindev.ch> +- Frederick Grose <4335897+FGrose@users.noreply.github.com> +- Manuel Fombuena <fombuena@outlook.com> +- Nick Rosbrook <enr0n@ubuntu.com> +- Reilly Brogan <reilly@reillybrogan.com> +- Thierry Bultel <thierry.bultel@linatsea.fr> +- Tomas Bzatek <tbzatek@redhat.com> +- Tomasz Paweł Gajc <tpgxyz@gmail.com> +- Valentin David <valentin.david@canonical.com> +- Vitaly Kuznetsov <vkuznets@redhat.com> +- Wenchao Hao <haowenchao@huawei.com> + +dracut-ng-101 +============= + +#### Bug Fixes + +Release 101 resolves a regression introduced by release 100 - https://github.com/dracut-ng/dracut-ng/issues/130 . + +* **dracut.sh:** revert: "do not add device if find_block_device returns" ([0885d6b2](https://github.com/dracut-ng/dracut-ng/commit/0885d6b2bb9d449f8a4e4f89ded3b619338df28d)) +* **dmsquash-live:** update documentation ([d2d41a36](https://github.com/dracut-ng/dracut-ng/commit/d2d41a36d86aca3deb05fe1be41bd06576c13d3f)) +* **dracut-install:** continue parsing if ldd prints "cannot be preloaded" ([ace9e1b5](https://github.com/dracut-ng/dracut-ng/commit/ace9e1b58c09e1e91621ad2219f7a96b7edbbd38)) +* **dracut-systemd:** replace `rd.udev.log-priority` with `rd.udev.log_level` ([c1275d87](https://github.com/dracut-ng/dracut-ng/commit/c1275d878cc6f6dac5b59a2024e6b5cc777dd6c7)) +* **dracut.sh:** omit compressed kernel modules from find searching exec files ([ad36b61e](https://github.com/dracut-ng/dracut-ng/commit/ad36b61ec1a26714fbe3049435eff7199ffea5e0)) +* improve Gentoo container ([76963537](https://github.com/dracut-ng/dracut-ng/commit/76963537edcfbad21c5fa096834e982564653808)) + +#### Contributors + +- Antonio Alvarez Feijoo <antonio.feijoo@suse.com> +- Laszlo Gombos <laszlo.gombos@gmail.com> + +dracut-ng-100 +============= + +Release 100 of dracut-ng serves as a drop-in replacement for the original dracut project. +This release marks a significant milestone in our commitment to providing an alternative, community-driven solution for creating an initramfs image. +The original dracut project is no longer actively maintained (its last tagged release dates back to 2022). +Forking allows the community to take ownership of the project and address maintenance issues independently. + +This release includes fixes for compatibility with the latest Linux kernel (v6.8), Linux firmware, and systemd (v255). + +A new dracut module named net-lib has been added to enhance networking support. + +Support for new Linux kernel modules have been added to support new devices, including the Surface Laptop 4 and MacBook Pro. + +The project builds test containers daily for the following Linux distributions: Arch Linux, Debian, Fedora, Gentoo, openSUSE, and Ubuntu, in various configurations (systemd, OpenRC, glibc, musl). +All enabled integration tests have passed at the time of this release. + +#### Bug Fixes + +* wait 12 hours before halt on media check fail ([faa3db78](https://github.com/dracut-ng/dracut-ng/commit/faa3db78b58554710e81ef95cceab68a1d52311e)) +* do not use modprobe --all ([5850486f](https://github.com/dracut-ng/dracut-ng/commit/5850486fbc3e7d6550fadf21d8e060c236214e9f)) +* **45ifcfg:** mark as deprecated and strictly opt-in ([79e1def5](https://github.com/dracut-ng/dracut-ng/commit/79e1def5ab9a19fdb9a5cc33c4893e49a7a10b67)) +* **90kernel-modules:** + * add surface_aggregator_registry for Surface Laptop 4 ([8cc89664](https://github.com/dracut-ng/dracut-ng/commit/8cc8966491830072f75a918c51533bea11211253)) + * add intel_lpss_pci for MacBook Pro 2017 ([f0526fde](https://github.com/dracut-ng/dracut-ng/commit/f0526fdea993d7e1ffa612c93656c77b41eb0509)) +* **90multipath:** drop unneeded dependencies from configure service ([9ac195c1](https://github.com/dracut-ng/dracut-ng/commit/9ac195c11c1f38dc6f0389d99fb3e76509c2e1c4)) +* **Makefile:** release is now just made out of a git sha ([71109aed](https://github.com/dracut-ng/dracut-ng/commit/71109aed43420eaba7e2168ae7b8d48c8a1078de)) +* **TEST-62-SKIPCPIO:** test always skipped due to buggy `test_check` ([5b5d395a](https://github.com/dracut-ng/dracut-ng/commit/5b5d395a6b4d9118c077102b5bbd74748e601a4e)) +* **base:** correct handling of quiet in loginit ([49b9c219](https://github.com/dracut-ng/dracut-ng/commit/49b9c2196a6a282cdb9c24738b2ab27d9a67134c)) +* **caps:** return 1 if binary requirements are not met ([243be951](https://github.com/dracut-ng/dracut-ng/commit/243be951958b9111c50b98eae399f610a5a07a99)) +* **check_live_ram:** increase /run tmpfs size, if needed ([e12ad733](https://github.com/dracut-ng/dracut-ng/commit/e12ad7330f9db547014eeeec37aeab779461bc30)) +* **configure:** misleading error if C compiler is not installed ([4980bad3](https://github.com/dracut-ng/dracut-ng/commit/4980bad34775da715a2639b736cba5e65a8a2604)) +* **dmsquash-live:** + * use the overlay size with thin provisioning ([2e025eb2](https://github.com/dracut-ng/dracut-ng/commit/2e025eb2105d8f8c67b07b0140915566873e12f0)) + * handle relative pathspec ([0c6d257f](https://github.com/dracut-ng/dracut-ng/commit/0c6d257f9c7d62eb449d71789f4f68414ba97aa2)) +* **dracut:** correct regression with multiple `rd.break=` options ([3d727a7d](https://github.com/dracut-ng/dracut-ng/commit/3d727a7d92cc916634369c8fa5fd97b4444d5aa7)) +* **dracut-init.sh:** do not print by default if a modules is not installed ([d73cc24e](https://github.com/dracut-ng/dracut-ng/commit/d73cc24e112c01aa701a96a7b8a58adce78409e7)) +* **dracut-initramfs-restore.sh:** do not set selinux labels if disabled ([4d594210](https://github.com/dracut-ng/dracut-ng/commit/4d594210d6ef4f04a9dbadacea73e9461ded352d)) +* **dracut-install:** file created without restricting permissions ([3439d139](https://github.com/dracut-ng/dracut-ng/commit/3439d139616196f0cd0af2e6244acf6c5f85621f)) +* **dracut-lib:** use poweroff instead of halt ([0ca14da6](https://github.com/dracut-ng/dracut-ng/commit/0ca14da655b688f29e4c05d98d9e2c2f63bdf59b)) +* **dracut-systemd:** use `DRACUT_VERSION` instead of `VERSION` ([a2c64222](https://github.com/dracut-ng/dracut-ng/commit/a2c64222cfba73a36dbb87e970e71e717e7cafb0)) +* **dracut-util:** do not call `strcmp` if the `value` argument is NULL ([b5fb6e04](https://github.com/dracut-ng/dracut-ng/commit/b5fb6e049e1fcb465f9371cefeedcfecce7a8d53)) +* **dracut.sh:** + * recognize kernel file in /boot named vmlinux too ([f2dfc257](https://github.com/dracut-ng/dracut-ng/commit/f2dfc2576dc66ec27ee1b8fde7c129622e8373aa)) + * do not add device if `find_block_device` returns an error ([18abcc53](https://github.com/dracut-ng/dracut-ng/commit/18abcc53df27be26d312cefc416bae9d97c6860a), closes [#2592](https://github.com/dracut-ng/dracut-ng/issues/2592)) + * skip README for AMD microcode generation ([9df35524](https://github.com/dracut-ng/dracut-ng/commit/9df355243c26ec7079e51eef15768fe21a8afdca), closes [#2541](https://github.com/dracut-ng/dracut-ng/issues/2541)) +* **github:** update format of labeler ([de8ac630](https://github.com/dracut-ng/dracut-ng/commit/de8ac6300d115a05d467dbb6b9a7c2599a2d306f)) +* **i18n:** + * silence spurious setfont stderr warning ([27f31c03](https://github.com/dracut-ng/dracut-ng/commit/27f31c037d97433698232976274e2acfac91523e)) + * handle symlinked keymap ([1f73bc8b](https://github.com/dracut-ng/dracut-ng/commit/1f73bc8b5bf4f19a805c2fefecf3e8bd2b59b17d)) +* **install:** handle new -Walloc-size for GCC 14 ([23b9ec22](https://github.com/dracut-ng/dracut-ng/commit/23b9ec22503fee6b3a3590c5753c086e1fb94910)) +* **livenet:** + * split `imgsize` calculation to avoid misleading error message ([4649b4c6](https://github.com/dracut-ng/dracut-ng/commit/4649b4c673cd74258e4ed9a1c3c6c553d9d02e44)) + * check also `content-length` from live image header ([6289d5f4](https://github.com/dracut-ng/dracut-ng/commit/6289d5f4348a291f70d8fc105de2fa2c1b5291f4)) + * propagate error code ([61a00cf8](https://github.com/dracut-ng/dracut-ng/commit/61a00cf8fec39e931a81f6ff0af4dfd62e308646)) +* **man:** rd.break parameter can be specified multiple times ([5a99e671](https://github.com/dracut-ng/dracut-ng/commit/5a99e671f6d81de75bec71f1832444137559957d)) +* **net-lib:** add a new dracut module called net-lib ([5e1fec16](https://github.com/dracut-ng/dracut-ng/commit/5e1fec1688a6b1cbcb4bea27a77710ae60c0d2f1)) +* **overlayfs:** + * to allow overlay on top of network device (nfs) ([bedde0f1](https://github.com/dracut-ng/dracut-ng/commit/bedde0f15708303f9907ed8a0d9e217c98e3bf07)) + * allow hostonly ([929e3160](https://github.com/dracut-ng/dracut-ng/commit/929e3160102761a2e0a471d0a5cf0a0ac7ac663d)) + * split overlayfs mount in two steps ([bddffeda](https://github.com/dracut-ng/dracut-ng/commit/bddffedae038ceca263a904e40513a6e92f1b558)) +* **pcsc:** + * add --disable-polkit to pcscd.service ([2689123c](https://github.com/dracut-ng/dracut-ng/commit/2689123c55bd2b43e7e2dba3e6bb93621a541916)) + * add opensc load module file ([882e9335](https://github.com/dracut-ng/dracut-ng/commit/882e9335934a86f88ba3b0cb7800a0d2c004b6a2)) +* **pkcs11:** delete trailing dot on libcryptsetup-token-systemd-pkcs11.so ([1c762c0d](https://github.com/dracut-ng/dracut-ng/commit/1c762c0da6ed2bb6fa44d5e0968605cc4d45361c)) +* **plymouth:** return 1 if binary requirements are not met ([edb14009](https://github.com/dracut-ng/dracut-ng/commit/edb140094e7144834c9d53652fbacdfb3053ab72)) +* **release:** + * maintain dracut.html in the source tree ([7b05aa8b](https://github.com/dracut-ng/dracut-ng/commit/7b05aa8b9eee5d665bfd010950bf01ee03e0fb12)) + * dracutdevs/dracut --> dracut-ng/dracut-ng ([8906474b](https://github.com/dracut-ng/dracut-ng/commit/8906474b4116190f45b5871079a826934e51f2e6)) +* **resume:** + * include in hostonly mode if resume= on cmdline ([d2ff89e2](https://github.com/dracut-ng/dracut-ng/commit/d2ff89e24479f1b8c2a21613632a4beb58c2a182)) + * add new systemd-hibernate-resume.service ([b73b5e0f](https://github.com/dracut-ng/dracut-ng/commit/b73b5e0fc94355efcff908ac1779fb187216484e), closes [#2513](https://github.com/dracut-ng/dracut-ng/issues/2513)) +* **rootfs-block:** remove support for [no]readonlyroot and fastboot ([469935fc](https://github.com/dracut-ng/dracut-ng/commit/469935fcca330c215009937eedbfb0dc15d533be)) +* **systemd-255:** handle systemd-pcr{phase -> extend} rename ([b63e90ab](https://github.com/dracut-ng/dracut-ng/commit/b63e90ab4e34b35ba0ce009992b0fc019eca3761)) +* **systemd-journald:** add systemd-sysusers dependency ([4971f443](https://github.com/dracut-ng/dracut-ng/commit/4971f443726360216a4ef3ba8baea258a1cd0f3b)) +* **systemd-repart:** correct undefined $libdir ([1586af09](https://github.com/dracut-ng/dracut-ng/commit/1586af098fb17f7565d1699953e4e4b536304089)) +* **test:** running tests no longer requires to be root ([3dad8237](https://github.com/dracut-ng/dracut-ng/commit/3dad82379aaa0afc05dbe717b1ab958ac7e9cf23)) +* **udev-rules:** remove legacy persistent network device name rule ([898ce135](https://github.com/dracut-ng/dracut-ng/commit/898ce1359ccd54fdb366749127f825dc384d9efa)) +* **zfcp_rules:** correct shellcheck regression when parsing ccw args ([5d2bda46](https://github.com/dracut-ng/dracut-ng/commit/5d2bda46f4e75e85445ee4d3bd3f68bf966287b9)) + +#### Features + +* **dracut.sh:** protect `push_host_devs` function ([7b54d2fb](https://github.com/dracut-ng/dracut-ng/commit/7b54d2fbbfb02c0f4e3d27dc76fb6679f6f31cd4)) +* **kernel-modules:** + * Install SPMI modules on ARM/RISC-V ([9491c285](https://github.com/dracut-ng/dracut-ng/commit/9491c2852501fab5d0000a095706ac6469cbfdf1)) + * add Qualcomm IPC router to enable USB ([dd9a4bc1](https://github.com/dracut-ng/dracut-ng/commit/dd9a4bc1b13a0cc8abac980bc3cceffb67111e64)) +* **network:** include 98-default-mac-none.link if it exists ([b7f09500](https://github.com/dracut-ng/dracut-ng/commit/b7f0950097b19092434836ad6708187d5d0351bd)) + +#### Contributors + +- Laszlo Gombos <laszlo.gombos@gmail.com> +- Antonio Alvarez Feijoo <antonio.feijoo@suse.com> +- Benjamin Drung <benjamin.drung@canonical.com> +- Henrik Gombos <henrik99999@gmail.com> +- Jan Macku <jamacku@redhat.com> +- Manuel Fombuena <mfombuena@innovara.co.uk> +- Sam James <sam@gentoo.org> +- Adam Williamson <awilliam@redhat.com> +- Andrew Ammerlaan <andrewammerlaan@gentoo.org> +- Benjamin Marzinski <bmarzins@redhat.com> +- Bernhard M. Wiedemann <bwiedemann@suse.de> +- Brian Harring <ferringb@gmail.com> +- Daniel P. Berrangé <berrange@redhat.com> +- David Cassany <dcassany@suse.com> +- Dusty Mabe <dusty@dustymabe.com> +- Frederick Grose <fgrose@sugarlabs.org> +- Icenowy Zheng <uwu@icenowy.me> +- Ihno Krumreich <ihno@suse.com> +- Jeremy Linton <jeremy.linton@arm.com> +- Jonathan Lebon <jonathan@jlebon.com> +- Lukas Nykryn <lnykryn@redhat.com> +- Neal Gompa <neal@gompa.dev> +- Thomas Blume <thomas.blume@suse.com> +- gregory-lee-bartholomew <gregory.lee.bartholomew@gmail.com> +- innovara <fombuena@outlook.com> dracut-060 ========== @@ -1,11 +1,13 @@ -dracut -==== +dracut-ng +========= -dracut is an event driven initramfs infrastructure. +dracut-ng is an event driven initramfs infrastructure. [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](docs/CODE_OF_CONDUCT.md) +[![Packaging status](https://repology.org/badge/tiny-repos/dracut.svg)](https://repology.org/project/dracut/versions) +[![latest packaged version(s)](https://repology.org/badge/latest-versions/dracut.svg)](https://repology.org/project/dracut/versions) -dracut (the tool) is used to create an initramfs image by copying tools +dracut-ng (the tool) is used to create an initramfs image by copying tools and files from an installed system and combining it with the dracut framework, usually found in /usr/lib/dracut/modules.d. @@ -30,21 +32,20 @@ Documentation: - [Introduction](man/dracut.asc) - [User Manual](man/dracut.usage.asc) -Currently dracut is developed on [github.com](https://github.com/dracutdevs/dracut). +Currently dracut-ng is developed on [github.com](https://github.com/dracut-ng/dracut-ng). -The release tarballs are [here](https://github.com/dracutdevs/dracut/releases). +The release tarballs are [here](https://github.com/dracut-ng/dracut-ng/releases). -Gitter (chat): - - https://gitter.im/dracutdevs/Lobby +Chat (Matrix): + - https://matrix.to/#/#dracut-ng:matrix.org See [News](NEWS.md) for information about changes in the releases and -the [Wiki](https://github.com/dracutdevs/dracut/wiki) to share information. +the [Wiki](https://github.com/dracut-ng/dracut-ng/wiki) to share information. -See the github issue tracker for things which still need to be done and [Hacking](docs/HACKING.md) -for some instructions on how to get started. There is also a mailing list -that is being used for the discussion -- initramfs@vger.kernel.org. -It is a typical vger list, send mail to majordomo@vger.kernel.org with body -of 'subscribe initramfs email@host.com' +See the [GitHub issue tracker](https://github.com/dracut-ng/dracut-ng/issues) for +things which still need to be done. This is also the main place used for +discussions. +See [Hacking](docs/HACKING.md) for some instructions on how to get started. Licensed under the GPLv2 @@ -60,6 +60,11 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then exit 1 fi +if ! ${CC} -c -o /dev/null /dev/null &> /dev/null; then + echo "dracut needs a C compiler (${CC} not found)." >&2 + exit 1 +fi + cat << EOF > conftest.c #include <fts.h> int main() { diff --git a/docs/HACKING.md b/docs/HACKING.md index 6a19434..b6789fe 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -4,9 +4,9 @@ Please make sure to follow our [Contribution Guidelines](../CONTRIBUTING.md). ## git -Currently dracut lives on github.com. +Currently dracut-ng lives on github.com. -* https://github.com/dracutdevs/dracut.git +* https://github.com/dracut-ng/dracut-ng.git Pull requests should be filed preferably on github nowadays. @@ -244,8 +244,8 @@ $ podman run --rm -it \ ``` with `[CONTAINER]` being one of the -[github `dracutdevs` containers](https://github.com/orgs/dracutdevs/packages), -e.g. `ghcr.io/dracutdevs/fedora:latest`. +[github `dracut-ng` containers](https://github.com/orgs/dracut-ng/packages), +e.g. `ghcr.io/dracut-ng/fedora:latest`. ### On bare metal @@ -253,27 +253,27 @@ For the testsuite to pass, you will have to install at least the software packag mentioned in the `test/container` Dockerfiles. ``` -$ sudo make clean check +$ make clean check ``` in verbose mode: ``` -$ sudo make V=1 clean check +$ make V=1 clean check ``` only specific test: ``` -$ sudo make TESTS="01 20 40" clean check +$ make TESTS="01 20 40" clean check ``` only runs the 01, 20 and 40 tests. debug a specific test case: ``` $ cd TEST-01-BASIC -$ sudo make clean setup run +$ make clean setup run ``` ... change some kernel parameters in `test.sh` ... ``` -$ sudo make run +$ make run ``` to run the test without doing the setup. diff --git a/docs/README.generic b/docs/README.generic deleted file mode 100644 index 58889ac..0000000 --- a/docs/README.generic +++ /dev/null @@ -1,13 +0,0 @@ -To build a generic initramfs, you have to install the following software packages: - * device-mapper - * cryptsetup-luks - * rpcbind nfs-utils - * lvm2 - * iscsi-initiator-utils - * nbd - * mdadm - * net-tools iproute - -Generic initramfs'es are huge (usually over 10 megs in size uncompressed), but -should be able to automatically boot any bootable configuration with appropriate -boot flags (root device, network configuration information, etc.)
\ No newline at end of file diff --git a/docs/RELEASE.md b/docs/RELEASE.md index b043484..bdbc60b 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -2,47 +2,9 @@ This documents contains the necessary steps to conduct a successful release. -1. Add all items to `NEWS.md` +1. Run `tools/release.sh` shell script - Get a first template with [`clog`](https://github.com/clog-tool/clog-cli) - ```console - $ clog -F -r https://github.com/dracutdevs/dracut - ``` - -2. Update the contributors list in NEWS.md - - Produce the list with: - ```console - $ make CONTRIBUTORS - ``` - - Append the list to the section in `NEWS.md` - -3. Update AUTHORS - - ```console - $ make AUTHORS - ``` - -4. Check in AUTHORS and NEWS.md - - ```console - $ git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS - $ git push origin master - ``` - -5. Tag the release, validate the tag and push - - ```console - $ git tag -s 060 - $ git tag -v 060 - $ git push --tags - ``` - - Add the section from `NEWS.md` to the git tag message excluding the Rendered - view entry. - -6. Create a new release on github (https://github.com/dracutdevs/dracut/releases/new) +2. Create a new release on github (https://github.com/dracut-ng/dracut-ng/releases/new) - Add the section from `NEWS.md` to the release. -7. Open a new milestone, move all unfinished issue from the previous milestone to the new one and close the released milestone (https://github.com/dracutdevs/dracut/milestones) +3. Open a new milestone, move all unfinished issue from the previous milestone to the new one and close the released milestone (https://github.com/dracut-ng/dracut-ng/milestones) diff --git a/dracut-functions.sh b/dracut-functions.sh index 4535871..f9e5d3b 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -653,6 +653,16 @@ get_blockdev_drv_through_sys() { echo "$_block_mods" } +# get_lvm_dm_dev <maj:min> +# If $1 is an LVM device-mapper device, return the path to its dm directory +get_lvm_dm_dev() { + local _majmin _dm + _majmin="$1" + _dm=/sys/dev/block/$_majmin/dm + [[ ! -f $_dm/uuid || $(< "$_dm"/uuid) != LVM-* ]] && return 1 + printf "%s" "$_dm" +} + # ugly workaround for the lvm design # There is no volume group device, # so, there are no slave devices for volume groups. @@ -660,10 +670,10 @@ get_blockdev_drv_through_sys() { # but you cannot create the logical volume without the volume group. # And the volume group might be bigger than the devices the LV needs. check_vol_slaves() { - local _vg _pv _dm _majmin + local _vg _pv _majmin _dm _majmin="$2" - _dm=/sys/dev/block/$_majmin/dm - [[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1 + _dm=$(get_lvm_dm_dev "$_majmin") + [[ -z $_dm ]] && return 1 # not an LVM device-mapper device _vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")") # strip space _vg="${_vg//[[:space:]]/}" @@ -676,10 +686,10 @@ check_vol_slaves() { } check_vol_slaves_all() { - local _vg _pv _majmin + local _vg _pv _majmin _dm _majmin="$2" - _dm="/sys/dev/block/$_majmin/dm" - [[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1 + _dm=$(get_lvm_dm_dev "$_majmin") + [[ -z $_dm ]] && return 1 # not an LVM device-mapper device _vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")") # strip space _vg="${_vg//[[:space:]]/}" @@ -777,10 +787,12 @@ get_ucode_file() { # Not every device in /dev/mapper should be examined. # If it is an LVM device, touch only devices which have /dev/VG/LV symlink. lvm_internal_dev() { - local dev_dm_dir=/sys/dev/block/$1/dm - [[ ! -f $dev_dm_dir/uuid || $(< "$dev_dm_dir"/uuid) != LVM-* ]] && return 1 # Not an LVM device + local _majmin _dm + _majmin="$1" + _dm=$(get_lvm_dm_dev "$_majmin") + [[ -z $_dm ]] && return 1 # not an LVM device-mapper device local DM_VG_NAME DM_LV_NAME DM_LV_LAYER - eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$(< "$dev_dm_dir"/name)" 2> /dev/null)" + eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$(< "$_dm/name")" 2> /dev/null)" [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this! [[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]] } diff --git a/dracut-init.sh b/dracut-init.sh index 6b81833..863df0c 100755 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -115,7 +115,7 @@ require_binaries() { for cmd in "$@"; do if ! find_binary "$cmd" &> /dev/null; then - dinfo "Module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!" + ddebug "Module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!" ((_ret++)) fi done @@ -313,7 +313,10 @@ dracut_instmods() { local i [[ $no_kernel == yes ]] && return for i in "$@"; do - [[ $i == "--silent" ]] && _silent=1 + if [[ $i == "--silent" ]]; then + _silent=1 + break + fi done if $DRACUT_INSTALL \ @@ -630,7 +633,7 @@ inst_hook() { dfatal "No such hook type $1. Aborting initrd creation." exit 1 fi - hook="/lib/dracut/hooks/${1}/${2}-${3##*/}" + hook="/var/lib/dracut/hooks/${1}/${2}-${3##*/}" inst_simple "$3" "$hook" chmod u+x "$initdir/$hook" } @@ -730,7 +733,7 @@ inst_decompress() { inst_simple "${_src}" # Decompress with chosen tool. We assume that tool changes name e.g. # from 'name.gz' to 'name'. - ${_cmd} "${initdir}${_src}" + ${_cmd} "${initdir}${_src#"$dracutsysrootdir"}" done } diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh index 995e13a..cc561b2 100755 --- a/dracut-initramfs-restore.sh +++ b/dracut-initramfs-restore.sh @@ -46,8 +46,15 @@ elif mountpoint -q /efi; then elif mountpoint -q /boot/efi; then IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd" else - echo "No initramfs image found to restore!" - exit 1 + files=("/boot/initr*${KERNEL_VERSION}*") + if [ "${#files[@]}" -ge 1 ] && [ -e "${files[0]}" ]; then + IMG="${files[0]}" + elif [[ -f /boot/initramfs-linux.img ]]; then + IMG="/boot/initramfs-linux.img" + else + echo "No initramfs image found to restore!" + exit 1 + fi fi cd /run/initramfs diff --git a/dracut-version.sh b/dracut-version.sh index 4a3b3c8..b790a80 100755 --- a/dracut-version.sh +++ b/dracut-version.sh @@ -1,3 +1,3 @@ #!/bin/sh # shellcheck disable=SC2034 -DRACUT_VERSION=060 +DRACUT_VERSION=102 diff --git a/dracut.html b/dracut.html new file mode 100644 index 0000000..7bf14aa --- /dev/null +++ b/dracut.html @@ -0,0 +1,4202 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>dracut 102</title><style type="text/css"> + +body, h1, h2, h3, h4, h5, h6, pre, li, div { + line-height: 1.29em; +} + +body { + background-color: white; + margin:0 auto; + font-family: "liberation sans", "Myriad ", "Bitstream Vera Sans", "Lucida Grande", "Luxi Sans", "Trebuchet MS", helvetica, verdana, arial, sans-serif; + font-size:12px; + max-width:55em; + color:black; +} + +/* desktop styles */ +body.desktop { + margin-left: 26em; +} + +body.desktop .book > .toc { + display:block; + width:24em; + height:99%; + position:fixed; + overflow:auto; + top:0px; + left:0px; + padding-left:1em; + background-color:#EEEEEE; +} + +.toc { + line-height:1.35em; +} + +.toc .glossary, +.toc .chapter, .toc .appendix { + margin-top:1em; +} + +.toc .part { + margin-top:1em; + display:block; +} + +span.glossary, +span.appendix { + display:block; + margin-top:0.5em; +} + +div { + padding-top:0px; +} + +div.section { + padding-top:1em; +} + +p, div.para, div.formalpara { + padding-top:0px; + margin-top:0.3em; + padding-bottom:0px; + margin-bottom:1em; +} + +/*Links*/ +a { + outline: none; +} + +a:link { + text-decoration:none; + border-bottom: 1px dotted ; + color:#3366cc; +} + +a:visited { + text-decoration:none; + border-bottom: 1px dotted ; + color:#003366; +} + +div.longdesc-link { + float:right; + color:#999; +} + +.toc a, .qandaset a { + font-weight:normal; +} + +/*headings*/ +h1, h2, h3, h4, h5, h6 { + color: #336699; + margin-top: 0em; + margin-bottom: 0em; + background-color: transparent; +} + +h1 { + font-size:2.0em; +} + +.titlepage h1.title { + font-size: 3.0em; + padding-top: 1em; + text-align:left; +} + +.book > .titlepage h1.title { + text-align:center; +} + +.article > .titlepage h1.title { + text-align:center; +} + +.set .titlepage > div > div > h1.title { + text-align:center; +} + +.producttitle { + margin-top: 0em; + margin-bottom: 0em; + font-size: 3.0em; + font-weight: bold; + color: white; + text-align: center; + padding: 0.7em; +} + +.titlepage .corpauthor { + margin-top: 1em; + text-align: center; +} + +.section h1.title { + font-size: 1.6em; + padding: 0em; + color: #336699; + text-align: left; + background: white; +} + +h2 { + font-size:1.6em; +} + + +h2.subtitle, h3.subtitle { + margin-top: 1em; + margin-bottom: 1em; + font-size: 1.4em; + text-align: center; +} + +.preface > div > div > div > h2.title { + margin-top: 1em; + font-size: 2.0em; +} + +.appendix h2 { + margin-top: 1em; + font-size: 2.0em; +} + + + +h3 { + font-size:1.3em; + padding-top:0em; + padding-bottom:0em; +} +h4 { + font-size:1.1em; + padding-top:0em; + padding-bottom:0em; +} + +h5 { + font-size:1em; +} + +h6 { + font-size:1em; +} + +h5.formalpara { + font-size:1em; + margin-top:2em; + margin-bottom:.8em; +} + +.abstract h6 { + margin-top:1em; + margin-bottom:.5em; + font-size:2em; +} + +/*element rules*/ +hr { + border-collapse: collapse; + border-style:none; + border-top: 1px dotted #ccc; + width:100%; + margin-top: 3em; +} + +/* web site rules */ +ul.languages, .languages li { + display:inline; + padding:0em; +} + +.languages li a { + padding:0em .5em; + text-decoration: none; +} + +.languages li p, .languages li div.para { + display:inline; +} + +.languages li a:link, .languages li a:visited { + color:#444; +} + +.languages li a:hover, .languages li a:focus, .languages li a:active { + color:black; +} + +ul.languages { + display:block; + background-color:#eee; + padding:.5em; +} + +/*supporting stylesheets*/ + +/*unique to the webpage only*/ +.books { + position:relative; +} + +.versions li { + width:100%; + clear:both; + display:block; +} + +a.version { + font-size:2em; + text-decoration:none; + width:100%; + display:block; + padding:1em 0em .2em 0em; + clear:both; +} + +a.version:before { + content:"Version"; + font-size:smaller; +} + +a.version:visited, a.version:link { + color:#666; +} + +a.version:focus, a.version:hover { + color:black; +} + +.books { + display:block; + position:relative; + clear:both; + width:100%; +} + +.books li { + display:block; + width:200px; + float:left; + position:relative; + clear: none ; +} + +.books .html { + width:170px; + display:block; +} + +.books .pdf { + position:absolute; + left:170px; + top:0px; + font-size:smaller; +} + +.books .pdf:link, .books .pdf:visited { + color:#555; +} + +.books .pdf:hover, .books .pdf:focus { + color:#000; +} + +.books li a { + text-decoration:none; +} + +.books li a:hover { + color:black; +} + +/*products*/ +.products li { + display: block; + width:300px; + float:left; +} + +.products li a { + width:300px; + padding:.5em 0em; +} + +.products ul { + clear:both; +} + +/*revision history*/ +.revhistory { + display:block; +} + +.revhistory table { + background-color:transparent; + border-color:#fff; + padding:0em; + margin: 0; + border-collapse:collapse; + border-style:none; +} + +.revhistory td { + text-align :left; + padding:0em; + border: none; + border-top: 1px solid #fff; + font-weight: bold; +} + +.revhistory .simplelist td { + font-weight: normal; +} + +.revhistory .simplelist { + margin-bottom: 1.5em; + margin-left: 1em; +} + +.revhistory table th { + display: none; +} + + +/*credits*/ +.authorgroup div { + clear:both; + text-align: center; +} + +h3.author { + margin: 0em; + padding: 0em; + padding-top: 1em; +} + +.authorgroup h4 { + padding: 0em; + margin: 0em; + padding-top: 1em; + margin-top: 1em; +} + +.author, +.editor, +.translator, +.othercredit, +.contrib { + display: block; +} + +.revhistory .author { + display: inline; +} + +.othercredit h3 { + padding-top: 1em; +} + + +.othercredit { + margin:0em; + padding:0em; +} + +.releaseinfo { + clear: both; +} + +.copyright { + margin-top: 1em; +} + +/* qanda sets */ +.answer { + margin-bottom:1em; + border-bottom:1px dotted #ccc; +} + +.qandaset .toc { + border-bottom:1px dotted #ccc; +} + +.question { + font-weight:bold; +} + +.answer .data, .question .data { + padding-left: 2.6em; +} + +.answer label, .question label { + float:left; + font-weight:bold; +} + + +/*Lists*/ +ul { + padding-left:1.6em; + list-style-type: circle; +} + +ul ul { + list-style-type: circle; +} + +ol { + list-style-image:none; + list-style-type: decimal; +} + +ol ol { + list-style-type: lower-alpha; +} + +ol.arabic { + list-style-type: decimal; +} + +ol.loweralpha { + list-style-type: lower-alpha; +} + +ol.lowerroman { + list-style-type: lower-roman; +} + +ol.upperalpha { + list-style-type: upper-alpha; +} + +ol.upperroman { + list-style-type: upper-roman; +} + +dt { + font-weight:bold; + margin-bottom:0em; + padding-bottom:0em; +} + +dd { + margin:0em; + margin-left:2em; + padding-top:0em; + padding-bottom: 1em; +} + +li { + padding-top:0px; + margin-top:0em; + padding-bottom:0px; + margin-bottom:0.4em; +} + +li p, li div.para { + padding-top:0px; + margin-top:0em; + padding-bottom:0px; + margin-bottom:0.3em; +} + +/*images*/ +img { + display:block; + margin: 2em 0; +} + +.inlinemediaobject, .inlinemediaobject img { + display:inline; + margin:0em; +} + +.figure img { + display:block; + margin:0; +} + +.figure .title { + margin:0em; + margin-bottom:2em; + padding:0px; +} + +/*document modes*/ +.confidential { + background-color:#900; + color:White; + padding:.5em .5em; + text-transform:uppercase; + text-align:center; +} + +.longdesc-link { + display:none; +} + +.longdesc { + display:none; +} + +.prompt { + padding:0em .3em; +} + +/*user interface styles*/ +.screen .replaceable { +} + +.guibutton, .guilabel { + font-family: "liberation mono", "bitstream vera mono", "dejavu mono", monospace; + font-weight: bold; + white-space: nowrap; +} + +.example { + background-color: #ffffff; + border-left: 3px solid #aaaaaa; + padding-top: 1em; + padding-bottom: 0.1em; +} + +.example h6 { + padding-left: 10px; +} + +.example-contents { + padding-left: 10px; + background-color: #ffffff; +} + +.example-contents .para { +/* padding: 10px;*/ +} + +/*terminal/console text*/ +.computeroutput, +.option { + font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace; + font-weight:bold; +} + +.replaceable { + font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace; + font-style: italic; +} + +.command, .filename, .keycap, .classname, .literal { + font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace; + font-weight:bold; +} + +/* no bold in toc */ +.toc * { + font-weight: inherit; +} + +pre { + font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace; + display:block; + background-color: #f5f5f5; + color: #000000; + border: 1px solid #aaaaaa; + margin-bottom: 0.3em; + padding:.5em 1em; + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + font-size: 0.9em; +} + +pre .replaceable, +pre .keycap { +} + +code { + font-family:"liberation mono", "bitstream vera mono", "dejavu mono", monospace; + white-space: nowrap; + font-weight:bold; +} + +.parameter code { + display: inline; + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + + +div.warning, div.note, div.important { + color: black; + margin: 0em; + padding: 0em; + background: none; + background-color: white; + margin-bottom: 1em; + padding-left: 1em; + border-left: 2px solid #aaaaaa; +} + +div.warning h2, div.note h2,div.important h2 { + margin: 0em; + padding: 0em; + color: #eeeeec; + padding-top: 0px; + padding-bottom: 0px; + height: 1.4em; + line-height: 1.4em; + font-size: 1.4em; + display:inline; +} + +div.admonition_header { + clear: both; + margin: 0em; + padding: 0em; + margin-top: -3.3em; + padding-left: 58px; + line-height: 1.0em; + font-size: 1.0em; +} + + +div.warning p, div.warning div.para, +div.note p, div.note div.para, +div.important p, div.important div.para { + padding: 0em; + margin: 0em; +} + +div.admonition { + border: none; + border-left: 1px solid #aaaaaa; + border-right: 1px solid #aaaaaa; + padding:0em; + margin:0em; + padding-top: 1.5em; + padding-bottom: 1em; + padding-left: 2em; + padding-right: 1em; + background-color: #eeeeec; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; +} + +/*Page Title*/ +#title { + display:block; + height:45px; + padding-bottom:1em; + margin:0em; +} + +#title a.left{ + display:inline; + border:none; +} + +#title a.left img{ + border:none; + float:left; + margin:0em; + margin-top:.7em; +} + +#title a.right { + padding-bottom:1em; +} + +#title a.right img { + border:none; + float:right; + margin:0em; + margin-top:.7em; +} + +/*Table*/ +table { + border:1px solid #6c614b; + width:100%; + border-collapse:collapse; +} + +table.simplelist, .calloutlist table { + border-style: none; +} + +table th { + text-align:left; + background-color:#6699cc; + padding:.3em .5em; + color:white; +} + +table td { + padding:.15em .5em; +} + +table tr.even td { + background-color:#f5f5f5; +} + +table th p:first-child, table td p:first-child, table li p:first-child, +table th div.para:first-child, table td div.para:first-child, table li div.para:first-child { + margin-top:0em; + padding-top:0em; + display:inline; +} + +th, td { + border-style:none; + vertical-align: top; + border: 1px solid #000; +} + +.simplelist th, .simplelist td { + border: none; +} + +table table td { + border-bottom:1px dotted #aaa; + background-color:white; + padding:.6em 0em; +} + +table table { + border:1px solid white; +} + +td.remarkval { + color:#444; +} + +td.fieldval { + font-weight:bold; +} + +.lbname, .lbtype, .lbdescr, .lbdriver, .lbhost { + color:white; + font-weight:bold; + background-color:#999; + width:120px; +} + +td.remarkval { + width:230px; +} + +td.tname { + font-weight:bold; +} + +th.dbfield { + width:120px; +} + +th.dbtype { + width:70px; +} + +th.dbdefault { + width:70px; +} + +th.dbnul { + width:70px; +} + +th.dbkey { + width:70px; +} + +span.book { + margin-top:4em; + display:block; +} + +span.chapter { + display:block; + margin-top:0.5em; +} + +table.simplelist td, .calloutlist table td { + border-style: none; +} + +/*Breadcrumbs*/ +#breadcrumbs ul li.first:before { + content:" "; +} + +#breadcrumbs { + color:#900; + padding:3px; + margin-bottom:25px; +} + +#breadcrumbs ul { + margin-left:0; + padding-left:0; + display:inline; + border:none; +} + +#breadcrumbs ul li { + margin-left:0; + padding-left:2px; + border:none; + list-style:none; + display:inline; +} + +#breadcrumbs ul li:before { + content:"\0020 \0020 \0020 \00BB \0020"; + color:#333; +} + +/*index*/ +.glossary h3, +.index h3 { + font-size: 2em; + color:#aaa; + margin:0em; +} + +.indexdiv { + margin-bottom:1em; +} + +.glossary dt, +.index dt { + color:#444; + padding-top:.5em; +} + +.glossary dl dl dt, +.index dl dl dt { + color:#777; + font-weight:normal; + padding-top:0em; +} + +.index dl dl dt:before { + content:"- "; + color:#ccc; +} + +/*changes*/ +.footnote { + font-size: .7em; + margin:0em; + color:#222; +} + +table .footnote { +} + +sup { + color:#999; + margin:0em; + padding:0em; + line-height: .4em; + font-size: 1em; + padding-left:0em; +} + +.footnote { + position:relative; +} + +.footnote sup { + color:#e3dcc0; + position:absolute; + left: .4em; +} + +.footnote sup a:link, +.footnote sup a:visited { + color:#92917d; + text-decoration:none; +} + +.footnote:hover sup a { + text-decoration:none; +} + +.footnote p,.footnote div.para { + padding-left:2em; +} + +.footnote a:link, +.footnote a:visited { + color:#00537c; +} + +.footnote a:hover { +} + +/**/ +div.chapter { + margin-top:3em; +} + +div.section { + margin-top:1em; +} + +div.note .replaceable, +div.important .replaceable, +div.warning .replaceable, +div.note .keycap, +div.important .keycap, +div.warning .keycap +{ +} + +ul li p:last-child, ul li div.para:last-child { + margin-bottom:0em; + padding-bottom:0em; +} + + +/* Dirty EVIL Mozilla hack for round corners */ +pre { + -moz-border-radius:11px; + -webkit-border-radius:11px; + border-radius: 11px; +} + +.example { + -moz-border-radius:0px; + -webkit-border-radius:0px; + border-radius: 0px; +} + +.package, .citetitle { + font-style: italic; +} + +.titlepage .edition { + color: #336699; + background-color: transparent; + margin-top: 1em; + margin-bottom: 1em; + font-size: 1.4em; + font-weight: bold; + text-align: center; +} + +span.remark { + background-color: #ff00ff; +} + +.foreignphrase { + font-style: inherit; +} + +dt { + clear:both; +} + +dt img { + border-style: none; + max-width: 112px; +} + +dt object { + max-width: 112px; +} + +dt .inlinemediaobject, dt object { + display: inline; + float: left; + margin-bottom: 1em; + padding-right: 1em; + width: 112px; +} + +dl:after { + display: block; + clear: both; + content: ""; +} + +.toc dd { + padding-bottom: 0em; + margin-bottom: 1em; + padding-left: 1.3em; + margin-left: 0em; +} + +div.toc > dl > dt { + padding-bottom: 0em; + margin-bottom: 0em; + margin-top: 1em; +} + + +.strikethrough { + text-decoration: line-through; +} + +.underline { + text-decoration: underline; +} + +.calloutlist img, .callout { + padding: 0em; + margin: 0em; + width: 12pt; + display: inline; + vertical-align: middle; +} + +.stepalternatives { + list-style-image: none; + list-style-type: none; +} + + +a:link { + color:#0066cc; +} + +a:hover, a:active { + color:#003366; +} + +a:visited { + color:#6699cc; +} + + +h1 { + color:#3c6eb4 +} + +.section h1.title { + color:#3c6eb4; +} + + +h2,h3,h4,h5,h6 { + color:#3c6eb4; +} + +table { + border:1px solid #3c6eb4; +} + +table th { + background-color:#3c6eb4; +} + + +table tr.even td { + background-color:#f5f5f5; +} + +.revhistory table th { + color:#3c6eb4; +} + +.titlepage .edition { + color: #3c6eb4; +} + +</style><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /></head><body><div xml:lang="en" class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="idm1"></a>dracut 102</h1></div><div><div class="author"><h3 class="author"><span class="firstname">Harald</span> <span class="surname">Hoyer</span></h3><code class="email"><<a class="email" href="mailto:harald@profian.com">harald@profian.com</a>></code></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="part"><a href="#_introduction">I. Introduction</a></span></dt><dd><dl><dt><span class="chapter"><a href="#_definition">1. Definition</a></span></dt><dt><span class="chapter"><a href="#_rationale">2. Rationale</a></span></dt><dt><span class="chapter"><a href="#_implementation">3. Implementation</a></span></dt><dt><span class="chapter"><a href="#_mount_preparations">4. Mount preparations</a></span></dt><dt><span class="chapter"><a href="#_dracut_on_shutdown">5. Dracut on shutdown</a></span></dt></dl></dd><dt><span class="part"><a href="#_user_manual">II. User Manual</a></span></dt><dd><dl><dt><span class="chapter"><a href="#_dracut_8">6. DRACUT(8)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_usage">USAGE</a></span></dt><dd><dl><dt><span class="section"><a href="#_inspecting_the_contents">Inspecting the Contents</a></span></dt><dt><span class="section"><a href="#_adding_dracut_modules">Adding dracut Modules</a></span></dt><dt><span class="section"><a href="#_omitting_dracut_modules">Omitting dracut Modules</a></span></dt><dt><span class="section"><a href="#_adding_kernel_modules">Adding Kernel Modules</a></span></dt><dt><span class="section"><a href="#_boot_parameters">Boot parameters</a></span></dt><dt><span class="section"><a href="#Injecting">Injecting custom Files</a></span></dt><dt><span class="section"><a href="#NetworkBoot">Network Boot</a></span></dt></dl></dd><dt><span class="section"><a href="#_troubleshooting">Troubleshooting</a></span></dt><dd><dl><dt><span class="section"><a href="#identifying-your-problem-area">Identifying your problem area</a></span></dt><dt><span class="section"><a href="#information-to-include-in-your-report">Information to include in your report</a></span></dt><dt><span class="section"><a href="#debugging-dracut">Debugging dracut</a></span></dt></dl></dd><dt><span class="section"><a href="#_options">OPTIONS</a></span></dt><dt><span class="section"><a href="#_environment">ENVIRONMENT</a></span></dt><dt><span class="section"><a href="#_files">FILES</a></span></dt><dd><dl><dt><span class="section"><a href="#_configuration_in_the_initramfs">Configuration in the initramfs</a></span></dt></dl></dd><dt><span class="section"><a href="#_availability">AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_authors">AUTHORS</a></span></dt><dt><span class="section"><a href="#_see_also">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dracutconf5">7. DRACUT.CONF(5)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_2">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis_2">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description_2">Description</a></span></dt><dt><span class="section"><a href="#_files_2">Files</a></span></dt><dt><span class="section"><a href="#_author">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_2">See Also</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dracutcmdline7">8. DRACUT.CMDLINE(7)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_3">NAME</a></span></dt><dt><span class="section"><a href="#_description_3">DESCRIPTION</a></span></dt><dd><dl><dt><span class="section"><a href="#_standard">Standard</a></span></dt><dt><span class="section"><a href="#_iso_scan_filename">iso-scan/filename</a></span></dt><dt><span class="section"><a href="#_misc">Misc</a></span></dt><dt><span class="section"><a href="#dracutkerneldebug">Debug</a></span></dt><dt><span class="section"><a href="#_i18n">I18N</a></span></dt><dt><span class="section"><a href="#_lvm">LVM</a></span></dt><dt><span class="section"><a href="#_crypto_luks">crypto LUKS</a></span></dt><dt><span class="section"><a href="#_crypto_luks_key_on_removable_device_support">crypto LUKS - key on removable device support</a></span></dt><dt><span class="section"><a href="#_md_raid">MD RAID</a></span></dt><dt><span class="section"><a href="#_dm_raid">DM RAID</a></span></dt><dt><span class="section"><a href="#_multipath">MULTIPATH</a></span></dt><dt><span class="section"><a href="#_fips">FIPS</a></span></dt><dt><span class="section"><a href="#_network">Network</a></span></dt><dt><span class="section"><a href="#_nfs">NFS</a></span></dt><dt><span class="section"><a href="#_cifs">CIFS</a></span></dt><dt><span class="section"><a href="#_iscsi">iSCSI</a></span></dt><dt><span class="section"><a href="#_fcoe">FCoE</a></span></dt><dt><span class="section"><a href="#_nvmf">NVMf</a></span></dt><dt><span class="section"><a href="#_nbd">NBD</a></span></dt><dt><span class="section"><a href="#_virtiofs">VIRTIOFS</a></span></dt><dt><span class="section"><a href="#_dasd">DASD</a></span></dt><dt><span class="section"><a href="#_zfcp">ZFCP</a></span></dt><dt><span class="section"><a href="#_znet">ZNET</a></span></dt><dt><span class="section"><a href="#_booting_live_images">Booting live images</a></span></dt><dt><span class="section"><a href="#_zipl">ZIPL</a></span></dt><dt><span class="section"><a href="#_cio_ignore">CIO_IGNORE</a></span></dt><dt><span class="section"><a href="#_plymouth_boot_splash">Plymouth Boot Splash</a></span></dt><dt><span class="section"><a href="#_kernel_keys">Kernel keys</a></span></dt><dt><span class="section"><a href="#_deprecated_renamed_options">Deprecated, renamed Options</a></span></dt><dt><span class="section"><a href="#_configuration_in_the_initramfs_2">Configuration in the Initramfs</a></span></dt></dl></dd><dt><span class="section"><a href="#_author_2">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_3">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#lsinitrd1">9. LSINITRD(1)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_4">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis_3">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description_4">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_options_2">OPTIONS</a></span></dt><dt><span class="section"><a href="#_availability_2">AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_authors_2">AUTHORS</a></span></dt><dt><span class="section"><a href="#_see_also_4">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#_developer_manual">10. Developer Manual</a></span></dt><dt><span class="chapter"><a href="#dracutmodules7">11. DRACUT.MODULES(7)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_5">NAME</a></span></dt><dt><span class="section"><a href="#_description_5">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#stages">Boot Process Stages</a></span></dt><dd><dl><dt><span class="section"><a href="#_hook_cmdline">Hook: cmdline</a></span></dt><dt><span class="section"><a href="#_hook_pre_udev">Hook: pre-udev</a></span></dt><dt><span class="section"><a href="#_start_udev">Start Udev</a></span></dt><dt><span class="section"><a href="#_hook_pre_trigger">Hook: pre-trigger</a></span></dt><dt><span class="section"><a href="#_trigger_udev">Trigger Udev</a></span></dt><dt><span class="section"><a href="#_main_loop">Main Loop</a></span></dt><dt><span class="section"><a href="#_hook_pre_mount">Hook: pre-mount</a></span></dt><dt><span class="section"><a href="#_hook_mount">Hook: mount</a></span></dt><dt><span class="section"><a href="#_hook_pre_pivot">Hook: pre-pivot</a></span></dt><dt><span class="section"><a href="#_hook_cleanup">Hook: cleanup</a></span></dt><dt><span class="section"><a href="#_cleanup_and_switch_root">Cleanup and switch_root</a></span></dt></dl></dd><dt><span class="section"><a href="#_network_infrastructure">Network Infrastructure</a></span></dt><dt><span class="section"><a href="#_writing_a_module">Writing a Module</a></span></dt><dd><dl><dt><span class="section"><a href="#_module_setup_sh_check">module-setup.sh: check()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_depends">module-setup.sh: depends()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_cmdline">module-setup.sh: cmdline()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_install">module-setup.sh: install()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_installkernel">module-setup.sh: installkernel()</a></span></dt><dt><span class="section"><a href="#_anchor_id_creation_xreflabel_creation_creation_functions">Creation Functions</a></span></dt><dt><span class="section"><a href="#_initramfs_functions">Initramfs Functions</a></span></dt><dt><span class="section"><a href="#_network_modules">Network Modules</a></span></dt></dl></dd><dt><span class="section"><a href="#_author_3">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_5">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dracutbootup7">12. DRACUT.BOOTUP(7)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_6">NAME</a></span></dt><dt><span class="section"><a href="#_description_6">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_author_4">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_6">SEE ALSO</a></span></dt></dl></dd><dt><span class="appendix"><a href="#_license">A. License</a></span></dt></dl></dd></dl></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="_introduction"></a>Part I. Introduction</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#_definition">1. Definition</a></span></dt><dt><span class="chapter"><a href="#_rationale">2. Rationale</a></span></dt><dt><span class="chapter"><a href="#_implementation">3. Implementation</a></span></dt><dt><span class="chapter"><a href="#_mount_preparations">4. Mount preparations</a></span></dt><dt><span class="chapter"><a href="#_dracut_on_shutdown">5. Dracut on shutdown</a></span></dt></dl></div><p>This section is a modified version of +<a class="ulink" href="http://en.wikipedia.org/wiki/Initrd" target="_top">http://en.wikipedia.org/wiki/Initrd</a> which is licensed under the +Creative Commons Attribution/Share-Alike License.</p><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_definition"></a>Chapter 1. Definition</h2></div></div></div><p>An <span class="emphasis"><em>initial ramdisk</em></span> is a temporary file system used in the boot process of the +Linux kernel. <span class="emphasis"><em>initrd</em></span> and <span class="emphasis"><em>initramfs</em></span> refer to slightly different schemes for +loading this file system into memory. Both are commonly used to make +preparations before the real root file system can be mounted.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_rationale"></a>Chapter 2. Rationale</h2></div></div></div><p>Many Linux distributions ship a single, generic kernel image that is intended to +boot as wide a variety of hardware as possible. The device drivers for this +generic kernel image are included as loadable modules, as it is not possible to +statically compile them all into the one kernel without making it too large to +boot from computers with limited memory or from lower-capacity media like floppy +disks.</p><p>This then raises the problem of detecting and loading the modules necessary to +mount the root file system at boot time (or, for that matter, deducing where or +what the root file system is).</p><p>To further complicate matters, the root file system may be on a software RAID +volume, LVM, NFS (on diskless workstations), or on an encrypted partition. All +of these require special preparations to mount.</p><p>Another complication is kernel support for hibernation, which suspends the +computer to disk by dumping an image of the entire system to a swap partition or +a regular file, then powering off. On next boot, this image has to be made +accessible before it can be loaded back into memory.</p><p>To avoid having to hardcode handling for so many special cases into the kernel, +an initial boot stage with a temporary root file system +—now dubbed early user space— is used. This root file system would contain +user-space helpers that would do the hardware detection, module loading and +device discovery necessary to get the real root file system mounted.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_implementation"></a>Chapter 3. Implementation</h2></div></div></div><p>An image of this initial root file system (along with the kernel image) must be +stored somewhere accessible by the Linux bootloader or the boot firmware of the +computer. This can be:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +The root file system itself +</li><li class="listitem"> +A boot image on an optical disc +</li><li class="listitem"> +A small ext2/ext3/ext4 or FAT-formatted partition on a local disk + (a <span class="emphasis"><em>boot partition</em></span>) +</li><li class="listitem"> +A TFTP server (on systems that can boot from Ethernet) +</li></ul></div><p>The bootloader will load the kernel and initial root file system image into +memory and then start the kernel, passing in the memory address of the image.</p><p>Depending on which algorithms were compiled statically into it, the kernel can +currently unpack initrd/initramfs images compressed with gzip, bzip2 and LZMA.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_mount_preparations"></a>Chapter 4. Mount preparations</h2></div></div></div><p>dracut can generate a customized initramfs image which contains only whatever is +necessary to boot some particular computer, such as ATA, SCSI and filesystem +kernel modules (host-only mode).</p><p>dracut can also generate a more generic initramfs image (default mode).</p><p>dracut’s initramfs starts only with the device name of the root file system (or +its UUID) and must discover everything else at boot time. A complex cascade of +tasks must be performed to get the root file system mounted:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +Any hardware drivers that the boot process depends on must be loaded. All +kernel modules for common storage devices are packed onto the initramfs and then +udev pulls in modules matching the computer’s detected hardware. +</li><li class="listitem"> +On systems which display a boot rd.splash screen, the video hardware must be +initialized and a user-space helper started to paint animations onto the display +in lockstep with the boot process. +</li><li class="listitem"><p class="simpara"> +If the root file system is on NFS, dracut does then: +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"> +Bring up the primary network interface. +</li><li class="listitem"> +Invoke a DHCP client, with which it can obtain a DHCP lease. +</li><li class="listitem"> +Extract the name of the NFS share and the address of the NFS server from the +lease. +</li><li class="listitem"> +Mount the NFS share. +</li></ul></div></li><li class="listitem"> +If the root file system appears to be on a software RAID device, there is no +way of knowing which devices the RAID volume spans; the standard MD utilities +must be invoked to scan all available block devices with a raid signature and +bring the required ones online. +</li><li class="listitem"> +If the root file system appears to be on a logical volume, the LVM utilities +must be invoked to scan for and activate the volume group containing it. +</li><li class="listitem"><p class="simpara"> +If the root file system is on an encrypted block device: +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"> +Invoke a helper script to prompt the user to type in a passphrase and/or +insert a hardware token (such as a smart card or a USB security dongle). +</li></ul></div></li><li class="listitem"> +Create a decryption target with the device mapper. +</li></ul></div><p>dracut uses udev, an event-driven hotplug agent, which invokes helper programs +as hardware devices, disk partitions and storage volumes matching certain rules +come online. This allows discovery to run in parallel, and to progressively +cascade into arbitrary nestings of LVM, RAID or encryption to get at the root +file system.</p><p>When the root file system finally becomes visible:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +Any maintenance tasks which cannot run on a mounted root file system +are done. +</li><li class="listitem"> +The root file system is mounted read-only. +</li><li class="listitem"> +Any processes which must continue running (such as the rd.splash screen helper +and its command FIFO) are hoisted into the newly-mounted root file system. +</li></ul></div><p>The final root file system cannot simply be mounted over /, since that would +make the scripts and tools on the initial root file system inaccessible for any +final cleanup tasks. On an initramfs, the initial root file system cannot be +rotated away. Instead, it is simply emptied and the final root file system +mounted over the top.</p><p>If the systemd module is used in the initramfs, the ordering of the services +started looks like <a class="xref" href="#dracutbootup7" title="Chapter 12. DRACUT.BOOTUP(7)">Chapter 12, <em>DRACUT.BOOTUP(7)</em></a>.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_dracut_on_shutdown"></a>Chapter 5. Dracut on shutdown</h2></div></div></div><p>On a systemd driven system, the dracut initramfs is also used for the shutdown +procedure.</p><p>The following steps are executed during a shutdown:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +systemd switches to the shutdown.target +</li><li class="listitem"> +systemd starts + $prefix/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service +</li><li class="listitem"> +dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore + which unpacks the initramfs to /run/initramfs +</li><li class="listitem"> +systemd finishes shutdown.target +</li><li class="listitem"> +systemd kills all processes +</li><li class="listitem"> +systemd tries to unmount everything and mounts the remaining read-only +</li><li class="listitem"> +systemd checks, if there is a /run/initramfs/shutdown executable +</li><li class="listitem"> +if yes, it does a pivot_root to /run/initramfs and executes ./shutdown. + The old root is then mounted on /oldroot. + /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable. +</li><li class="listitem"> +shutdown will try to unmount every /oldroot mount and calls the various + shutdown hooks from the dracut modules +</li></ul></div><p>This ensures, that all devices are disassembled and unmounted cleanly.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="_user_manual"></a>Part II. User Manual</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#_dracut_8">6. DRACUT(8)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_usage">USAGE</a></span></dt><dd><dl><dt><span class="section"><a href="#_inspecting_the_contents">Inspecting the Contents</a></span></dt><dt><span class="section"><a href="#_adding_dracut_modules">Adding dracut Modules</a></span></dt><dt><span class="section"><a href="#_omitting_dracut_modules">Omitting dracut Modules</a></span></dt><dt><span class="section"><a href="#_adding_kernel_modules">Adding Kernel Modules</a></span></dt><dt><span class="section"><a href="#_boot_parameters">Boot parameters</a></span></dt><dt><span class="section"><a href="#Injecting">Injecting custom Files</a></span></dt><dt><span class="section"><a href="#NetworkBoot">Network Boot</a></span></dt></dl></dd><dt><span class="section"><a href="#_troubleshooting">Troubleshooting</a></span></dt><dd><dl><dt><span class="section"><a href="#identifying-your-problem-area">Identifying your problem area</a></span></dt><dt><span class="section"><a href="#information-to-include-in-your-report">Information to include in your report</a></span></dt><dt><span class="section"><a href="#debugging-dracut">Debugging dracut</a></span></dt></dl></dd><dt><span class="section"><a href="#_options">OPTIONS</a></span></dt><dt><span class="section"><a href="#_environment">ENVIRONMENT</a></span></dt><dt><span class="section"><a href="#_files">FILES</a></span></dt><dd><dl><dt><span class="section"><a href="#_configuration_in_the_initramfs">Configuration in the initramfs</a></span></dt></dl></dd><dt><span class="section"><a href="#_availability">AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_authors">AUTHORS</a></span></dt><dt><span class="section"><a href="#_see_also">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dracutconf5">7. DRACUT.CONF(5)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_2">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis_2">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description_2">Description</a></span></dt><dt><span class="section"><a href="#_files_2">Files</a></span></dt><dt><span class="section"><a href="#_author">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_2">See Also</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dracutcmdline7">8. DRACUT.CMDLINE(7)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_3">NAME</a></span></dt><dt><span class="section"><a href="#_description_3">DESCRIPTION</a></span></dt><dd><dl><dt><span class="section"><a href="#_standard">Standard</a></span></dt><dt><span class="section"><a href="#_iso_scan_filename">iso-scan/filename</a></span></dt><dt><span class="section"><a href="#_misc">Misc</a></span></dt><dt><span class="section"><a href="#dracutkerneldebug">Debug</a></span></dt><dt><span class="section"><a href="#_i18n">I18N</a></span></dt><dt><span class="section"><a href="#_lvm">LVM</a></span></dt><dt><span class="section"><a href="#_crypto_luks">crypto LUKS</a></span></dt><dt><span class="section"><a href="#_crypto_luks_key_on_removable_device_support">crypto LUKS - key on removable device support</a></span></dt><dt><span class="section"><a href="#_md_raid">MD RAID</a></span></dt><dt><span class="section"><a href="#_dm_raid">DM RAID</a></span></dt><dt><span class="section"><a href="#_multipath">MULTIPATH</a></span></dt><dt><span class="section"><a href="#_fips">FIPS</a></span></dt><dt><span class="section"><a href="#_network">Network</a></span></dt><dt><span class="section"><a href="#_nfs">NFS</a></span></dt><dt><span class="section"><a href="#_cifs">CIFS</a></span></dt><dt><span class="section"><a href="#_iscsi">iSCSI</a></span></dt><dt><span class="section"><a href="#_fcoe">FCoE</a></span></dt><dt><span class="section"><a href="#_nvmf">NVMf</a></span></dt><dt><span class="section"><a href="#_nbd">NBD</a></span></dt><dt><span class="section"><a href="#_virtiofs">VIRTIOFS</a></span></dt><dt><span class="section"><a href="#_dasd">DASD</a></span></dt><dt><span class="section"><a href="#_zfcp">ZFCP</a></span></dt><dt><span class="section"><a href="#_znet">ZNET</a></span></dt><dt><span class="section"><a href="#_booting_live_images">Booting live images</a></span></dt><dt><span class="section"><a href="#_zipl">ZIPL</a></span></dt><dt><span class="section"><a href="#_cio_ignore">CIO_IGNORE</a></span></dt><dt><span class="section"><a href="#_plymouth_boot_splash">Plymouth Boot Splash</a></span></dt><dt><span class="section"><a href="#_kernel_keys">Kernel keys</a></span></dt><dt><span class="section"><a href="#_deprecated_renamed_options">Deprecated, renamed Options</a></span></dt><dt><span class="section"><a href="#_configuration_in_the_initramfs_2">Configuration in the Initramfs</a></span></dt></dl></dd><dt><span class="section"><a href="#_author_2">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_3">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#lsinitrd1">9. LSINITRD(1)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_4">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis_3">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description_4">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_options_2">OPTIONS</a></span></dt><dt><span class="section"><a href="#_availability_2">AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_authors_2">AUTHORS</a></span></dt><dt><span class="section"><a href="#_see_also_4">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#_developer_manual">10. Developer Manual</a></span></dt><dt><span class="chapter"><a href="#dracutmodules7">11. DRACUT.MODULES(7)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_5">NAME</a></span></dt><dt><span class="section"><a href="#_description_5">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#stages">Boot Process Stages</a></span></dt><dd><dl><dt><span class="section"><a href="#_hook_cmdline">Hook: cmdline</a></span></dt><dt><span class="section"><a href="#_hook_pre_udev">Hook: pre-udev</a></span></dt><dt><span class="section"><a href="#_start_udev">Start Udev</a></span></dt><dt><span class="section"><a href="#_hook_pre_trigger">Hook: pre-trigger</a></span></dt><dt><span class="section"><a href="#_trigger_udev">Trigger Udev</a></span></dt><dt><span class="section"><a href="#_main_loop">Main Loop</a></span></dt><dt><span class="section"><a href="#_hook_pre_mount">Hook: pre-mount</a></span></dt><dt><span class="section"><a href="#_hook_mount">Hook: mount</a></span></dt><dt><span class="section"><a href="#_hook_pre_pivot">Hook: pre-pivot</a></span></dt><dt><span class="section"><a href="#_hook_cleanup">Hook: cleanup</a></span></dt><dt><span class="section"><a href="#_cleanup_and_switch_root">Cleanup and switch_root</a></span></dt></dl></dd><dt><span class="section"><a href="#_network_infrastructure">Network Infrastructure</a></span></dt><dt><span class="section"><a href="#_writing_a_module">Writing a Module</a></span></dt><dd><dl><dt><span class="section"><a href="#_module_setup_sh_check">module-setup.sh: check()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_depends">module-setup.sh: depends()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_cmdline">module-setup.sh: cmdline()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_install">module-setup.sh: install()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_installkernel">module-setup.sh: installkernel()</a></span></dt><dt><span class="section"><a href="#_anchor_id_creation_xreflabel_creation_creation_functions">Creation Functions</a></span></dt><dt><span class="section"><a href="#_initramfs_functions">Initramfs Functions</a></span></dt><dt><span class="section"><a href="#_network_modules">Network Modules</a></span></dt></dl></dd><dt><span class="section"><a href="#_author_3">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_5">SEE ALSO</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dracutbootup7">12. DRACUT.BOOTUP(7)</a></span></dt><dd><dl><dt><span class="section"><a href="#_name_6">NAME</a></span></dt><dt><span class="section"><a href="#_description_6">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_author_4">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_6">SEE ALSO</a></span></dt></dl></dd><dt><span class="appendix"><a href="#_license">A. License</a></span></dt></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_dracut_8"></a>Chapter 6. DRACUT(8)</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_usage">USAGE</a></span></dt><dd><dl><dt><span class="section"><a href="#_inspecting_the_contents">Inspecting the Contents</a></span></dt><dt><span class="section"><a href="#_adding_dracut_modules">Adding dracut Modules</a></span></dt><dt><span class="section"><a href="#_omitting_dracut_modules">Omitting dracut Modules</a></span></dt><dt><span class="section"><a href="#_adding_kernel_modules">Adding Kernel Modules</a></span></dt><dt><span class="section"><a href="#_boot_parameters">Boot parameters</a></span></dt><dt><span class="section"><a href="#Injecting">Injecting custom Files</a></span></dt><dt><span class="section"><a href="#NetworkBoot">Network Boot</a></span></dt></dl></dd><dt><span class="section"><a href="#_troubleshooting">Troubleshooting</a></span></dt><dd><dl><dt><span class="section"><a href="#identifying-your-problem-area">Identifying your problem area</a></span></dt><dt><span class="section"><a href="#information-to-include-in-your-report">Information to include in your report</a></span></dt><dt><span class="section"><a href="#debugging-dracut">Debugging dracut</a></span></dt></dl></dd><dt><span class="section"><a href="#_options">OPTIONS</a></span></dt><dt><span class="section"><a href="#_environment">ENVIRONMENT</a></span></dt><dt><span class="section"><a href="#_files">FILES</a></span></dt><dd><dl><dt><span class="section"><a href="#_configuration_in_the_initramfs">Configuration in the initramfs</a></span></dt></dl></dd><dt><span class="section"><a href="#_availability">AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_authors">AUTHORS</a></span></dt><dt><span class="section"><a href="#_see_also">SEE ALSO</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>NAME</h2></div></div></div><p>dracut - low-level tool for generating an initramfs/initrd image</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_synopsis"></a>SYNOPSIS</h2></div></div></div><p><span class="strong"><strong>dracut</strong></span> [<span class="emphasis"><em>OPTION…</em></span>] [<span class="emphasis"><em><image></em></span> [<span class="emphasis"><em><kernel version></em></span>]]</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description"></a>DESCRIPTION</h2></div></div></div><p>Create an initramfs <image> for the kernel with the version <kernel version>. +If <kernel version> is omitted, then the version of the actual running +kernel is used. If <image> is omitted or empty, the default location will be +determined by the local configuration or Linux distribution policy.</p><p>dracut creates an initial image used by the kernel for preloading the block +device modules (such as IDE, SCSI or RAID) which are needed to access the root +filesystem, mounting the root filesystem and booting into the real system.</p><p>At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it +as initial root file system. All finding of the root device happens in this +early userspace.</p><p>Initramfs images are also called "initrd".</p><p>For a complete list of kernel command line options see <span class="strong"><strong>dracut.cmdline</strong></span>(7).</p><p>If you are dropped to an emergency shell, while booting your initramfs, +the file <span class="emphasis"><em>/run/initramfs/rdsosreport.txt</em></span> is created, which can be saved to a +(to be mounted by hand) partition (usually /boot) or a USB stick. +Additional debugging info can be produced by adding <span class="strong"><strong>rd.debug</strong></span> to the kernel +command line. <span class="emphasis"><em>/run/initramfs/rdsosreport.txt</em></span> contains all logs and the output +of some tools. It should be attached to any report about dracut problems.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_usage"></a>USAGE</h2></div></div></div><p>To create a initramfs image, the most simple command is:</p><pre class="screen"># dracut</pre><p>This will generate a general purpose initramfs image, with all possible +functionality resulting of the combination of the installed dracut modules and +system tools. The image contains the kernel modules of +the currently active kernel with version <span class="emphasis"><em><code class="literal"><kernel-version></code></em></span>. +The default location of the image is determined by the local configuration +or Linux distribution policy.</p><p>If the initramfs image already exists, dracut will display an error message, and +to overwrite the existing image, you have to use the --force option.</p><pre class="screen"># dracut --force</pre><p>If you want to specify another filename for the resulting image you would issue +a command like:</p><pre class="screen"># dracut foobar.img</pre><p>To generate an image for a specific kernel version, the command would be:</p><pre class="screen"># dracut foobar.img 2.6.40-1.rc5.f20</pre><p>A shortcut to generate the image at the default location for a specific kernel +version is:</p><pre class="screen"># dracut --kver 2.6.40-1.rc5.f20</pre><p>If you want to create lighter, smaller initramfs images, you may want to specify +the --hostonly or -H option. Using this option, the resulting image will +contain only those dracut modules, kernel modules and filesystems, which are +needed to boot this specific machine. This has the drawback, that you can’t put +the disk on another controller or machine, and that you can’t switch to another +root filesystem, without recreating the initramfs image. The usage of the +--hostonly option is only for experts and you will have to keep the broken +pieces. At least keep a copy of a general purpose image (and corresponding +kernel) as a fallback to rescue your system.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_inspecting_the_contents"></a>Inspecting the Contents</h3></div></div></div><p>To see the contents of the image created by dracut, you can use the lsinitrd +tool.</p><pre class="screen"># lsinitrd | less</pre><p>To display the contents of a file in the initramfs also use the lsinitrd tool:</p><pre class="screen"># lsinitrd -f /etc/ld.so.conf +include ld.so.conf.d/*.conf</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_adding_dracut_modules"></a>Adding dracut Modules</h3></div></div></div><p>Some dracut modules are turned off by default and have to be activated manually. +You can do this by adding the dracut modules to the configuration file +<span class="emphasis"><em>/etc/dracut.conf</em></span> or <span class="emphasis"><em>/etc/dracut.conf.d/myconf.conf</em></span>. See <span class="strong"><strong>dracut.conf</strong></span>(5). +You can also add dracut modules on the command line +by using the -a or --add option:</p><pre class="screen"># dracut --add module initramfs-module.img</pre><p>To see a list of available dracut modules, use the --list-modules option:</p><pre class="screen"># dracut --list-modules</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_omitting_dracut_modules"></a>Omitting dracut Modules</h3></div></div></div><p>Sometimes you don’t want a dracut module to be included for reasons of speed, +size or functionality. To do this, either specify the omit_dracutmodules +variable in the <span class="emphasis"><em>dracut.conf</em></span> or <span class="emphasis"><em>/etc/dracut.conf.d/myconf.conf</em></span> configuration +file (see <span class="strong"><strong>dracut.conf</strong></span>(5)), or use the -o or --omit option +on the command line:</p><pre class="screen"># dracut -o "multipath lvm" no-multipath-lvm.img</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_adding_kernel_modules"></a>Adding Kernel Modules</h3></div></div></div><p>If you need a special kernel module in the initramfs, which is not +automatically picked up by dracut, you have the use the --add-drivers option +on the command line or the drivers variable in the <span class="emphasis"><em>/etc/dracut.conf</em></span> +or <span class="emphasis"><em>/etc/dracut.conf.d/myconf.conf</em></span> configuration file (see <span class="strong"><strong>dracut.conf</strong></span>(5)):</p><pre class="screen"># dracut --add-drivers mymod initramfs-with-mymod.img</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_boot_parameters"></a>Boot parameters</h3></div></div></div><p>An initramfs generated without the "hostonly" mode, does not contain any system +configuration files (except for some special exceptions), so the configuration +has to be done on the kernel command line. With this flexibility, you can easily +boot from a changed root partition, without the need to recompile the initramfs +image. So, you could completely change your root partition (move it inside a md +raid with encryption and LVM on top), as long as you specify the correct +filesystem LABEL or UUID on the kernel command line for your root device, dracut +will find it and boot from it.</p><p>Generic initrd’s are larger, but should be able to automatically boot any +bootable configuration with appropriate boot flags (root device, network +configuration information, etc.)</p><p>The kernel command line can also be provided by the dhcp server with the +root-path option. See <a class="xref" href="#NetworkBoot" title="Network Boot">the section called “Network Boot”</a>.</p><p>For a full reference of all kernel command line parameters, +see <span class="strong"><strong>dracut.cmdline</strong></span>(7).</p><p>To get a quick start for the suitable kernel command line on your system, +use the <span class="emphasis"><em>--print-cmdline</em></span> option:</p><pre class="screen"># dracut --print-cmdline + root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4</pre><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_specifying_the_root_device"></a>Specifying the root Device</h4></div></div></div><p>This is the only option dracut really needs to boot from your root partition. +Because your root partition can live in various environments, there are a lot of +formats for the root= option. The most basic one is root=<span class="emphasis"><em><code class="literal"><path to device +node></code></em></span>:</p><pre class="screen">root=/dev/sda2</pre><p>Because device node names can change, dependent on the drive ordering, you are +encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL) +to specify your root partition:</p><pre class="screen">root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331</pre><p>or</p><pre class="screen">root=LABEL=myrootpartitionlabel</pre><p>To see all UUIDs or LABELs on your system, do:</p><pre class="screen"># ls -l /dev/disk/by-uuid</pre><p>or</p><pre class="screen"># ls -l /dev/disk/by-label</pre><p>If your root partition is on the network see <a class="xref" href="#NetworkBoot" title="Network Boot">the section called “Network Boot”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_keyboard_settings"></a>Keyboard Settings</h4></div></div></div><p>If you have to input passwords for encrypted disk volumes, you might want to set +the keyboard layout and specify a display font.</p><p>A typical german kernel command line would contain:</p><pre class="screen">rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8</pre><p>Setting these options can override the setting stored on your system, if you use +a modern init system, like systemd.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_blacklisting_kernel_modules"></a>Blacklisting Kernel Modules</h4></div></div></div><p>Sometimes it is required to prevent the automatic kernel module loading of a +specific kernel module. To do this, just add rd.driver.blacklist=<span class="emphasis"><em><code class="literal"><kernel +module name></code></em></span>, with <span class="emphasis"><em><code class="literal"><kernel module name></code></em></span> not containing the <span class="emphasis"><em>.ko</em></span> +suffix, to the kernel command line. For example:</p><pre class="screen">rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau</pre><p>The option can be specified multiple times on the kernel command line.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_speeding_up_the_boot_process"></a>Speeding up the Boot Process</h4></div></div></div><p>If you want to speed up the boot process, you can specify as much information +for dracut on the kernel command as possible. For example, you can tell dracut, +that you root partition is not on a LVM volume or not on a raid partition, or +that it lives inside a specific crypto LUKS encrypted volume. By default, dracut +searches everywhere. A typical dracut kernel command line for a plain primary or +logical partition would contain:</p><pre class="screen">rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0</pre><p>This turns off every automatic assembly of LVM, MD raids, DM raids and +crypto LUKS.</p><p>Of course, you could also omit the dracut modules in the initramfs creation +process, but then you would lose the possibility to turn it on on demand.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Injecting"></a>Injecting custom Files</h3></div></div></div><p>To add your own files to the initramfs image, you have several possibilities.</p><p>The --include option let you specify a source path and a target path. +For example</p><pre class="screen"># dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img</pre><p>will create an initramfs image, where the file cmdline-preset will be copied +inside the initramfs to <span class="emphasis"><em>/etc/cmdline.d/mycmdline.conf</em></span>. --include can only +be specified once.</p><pre class="screen"># mkdir -p rd.live.overlay/etc/cmdline.d +# mkdir -p rd.live.overlay/etc/conf.d +# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf +# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf +# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf +# tree rd.live.overlay/ +rd.live.overlay/ +`-- etc + |-- cmdline.d + | `-- mycmdline.conf + `-- conf.d + `-- testvar.conf + +# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img</pre><p>This will put the contents of the rd.live.overlay directory into the root of the +initramfs image.</p><p>The --install option let you specify several files, which will get installed in +the initramfs image at the same location, as they are present on initramfs +creation time.</p><pre class="screen"># dracut --install 'strace fsck.ext4 ssh' initramfs-dbg.img</pre><p>This will create an initramfs with the strace, fsck.ext4 and ssh executables, +together with the libraries needed to start those. The --install option can be +specified multiple times.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="NetworkBoot"></a>Network Boot</h3></div></div></div><p>If your root partition is on a network drive, you have to have the network +dracut modules installed to create a network aware initramfs image.</p><p>If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp +server about the ip address for the machine. The dhcp server can also serve an +additional root-path, which will set the root device for dracut. With this +mechanism, you have static configuration on your client machine and a +centralized boot configuration on your TFTP/DHCP server. If you can’t pass a +kernel command line, then you can inject <span class="emphasis"><em>/etc/cmdline.d/mycmdline.conf</em></span>, with a +method described in <a class="xref" href="#Injecting" title="Injecting custom Files">the section called “Injecting custom Files”</a>.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_reducing_the_image_size"></a>Reducing the Image Size</h4></div></div></div><p>To reduce the size of the initramfs, you should create it with by omitting all +dracut modules, which you know, you don’t need to boot the machine.</p><p>You can also specify the exact dracut and kernel modules to produce a very tiny +initramfs image.</p><p>For example for a NFS image, you would do:</p><pre class="screen"># dracut -m "nfs network base" initramfs-nfs-only.img</pre><p>Then you would boot from this image with your target machine and reduce the size +once more by creating it on the target machine with the --host-only option:</p><pre class="screen"># dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img</pre><p>This will reduce the size of the initramfs image significantly.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_troubleshooting"></a>Troubleshooting</h2></div></div></div><p>If the boot process does not succeed, you have several options to debug the +situation.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="identifying-your-problem-area"></a>Identifying your problem area</h3></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> +Remove <span class="emphasis"><em>'rhgb</em></span>' and <span class="emphasis"><em>'quiet</em></span>' from the kernel command line +</li><li class="listitem"> +Add <span class="emphasis"><em>'rd.shell</em></span>' to the kernel command line. This will present a shell should +dracut be unable to locate your root device +</li><li class="listitem"> +Add <span class="emphasis"><em>'rd.shell rd.debug log_buf_len=1M</em></span>' to the kernel command line so that +dracut shell commands are printed as they are executed +</li><li class="listitem"> +The file /run/initramfs/rdsosreport.txt is generated, +which contains all the logs and the output of all significant tools, which are +mentioned later. +</li></ol></div><p>If you want to save that output, simply mount /boot by hand or insert an USB +stick and mount that. Then you can store the output for later inspection.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="information-to-include-in-your-report"></a>Information to include in your report</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="all-bug-reports"></a>All bug reports</h4></div></div></div><p>In all cases, the following should be mentioned and attached to your bug report:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +The exact kernel command-line used. Typically from the bootloader +configuration file (e.g. <span class="emphasis"><em>/boot/grub2/grub.cfg</em></span>) or from <span class="emphasis"><em>/proc/cmdline</em></span>. +</li><li class="listitem"> +A copy of your disk partition information from <span class="emphasis"><em>/etc/fstab</em></span>, which might be +obtained booting an old working initramfs or a rescue medium. +</li><li class="listitem"> +Turn on dracut debugging (see <span class="emphasis"><em>the <span class="emphasis"><em>debugging dracut</em></span> section</em></span>), and attach +the file /run/initramfs/rdsosreport.txt. +</li><li class="listitem"> +If you use a dracut configuration file, please include <span class="emphasis"><em>/etc/dracut.conf</em></span> and +all files in <span class="emphasis"><em>/etc/dracut.conf.d/*.conf</em></span> +</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="network-root-device-related-problems"></a>Network root device related problems</h4></div></div></div><p>This section details information to include when experiencing problems on a +system whose root device is located on a network attached volume (e.g. iSCSI, +NFS or NBD). As well as the information from <a class="xref" href="#all-bug-reports" title="All bug reports">the section called “All bug reports”</a>, include the +following information:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara"> +Please include the output of +</p><pre class="screen"># /sbin/ifup <interfacename> +# ip addr show</pre></li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="debugging-dracut"></a>Debugging dracut</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="configure-a-serial-console"></a>Configure a serial console</h4></div></div></div><p>Successfully debugging dracut will require some form of console +logging during the system boot. This section documents configuring a +serial console connection to record boot messages.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> +First, enable serial console output for both the kernel and the bootloader. +</li><li class="listitem"><p class="simpara"> +Open the file <span class="emphasis"><em>/boot/grub2/grub.cfg</em></span> for editing. Below the line <span class="emphasis"><em>'timeout=5</em></span>', add +the following: +</p><pre class="screen">serial --unit=0 --speed=9600 +terminal --timeout=5 serial console</pre></li><li class="listitem"><p class="simpara"> +Also in <span class="emphasis"><em>/boot/grub2/grub.cfg</em></span>, add the following boot arguments to the <span class="emphasis"><em>'kernel</em></span>' +line: +</p><pre class="screen">console=tty0 console=ttyS0,9600</pre></li><li class="listitem"><p class="simpara"> +When finished, the <span class="emphasis"><em>/boot/grub2/grub.cfg</em></span> file should look similar to the example +below. +</p><pre class="screen">default=0 +timeout=5 +serial --unit=0 --speed=9600 +terminal --timeout=5 serial console +title Fedora (2.6.29.5-191.fc11.x86_64) + root (hd0,0) + kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600 + initrd /dracut-2.6.29.5-191.fc11.x86_64.img</pre></li><li class="listitem"> +More detailed information on how to configure the kernel for console output +can be found at +<a class="ulink" href="http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL" target="_top">http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL</a>. +</li><li class="listitem"><p class="simpara"> +Redirecting non-interactive output +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You can redirect all non-interactive output to <span class="emphasis"><em>/dev/kmsg</em></span> and the kernel +will put it out on the console when it reaches the kernel buffer by doing</p></div><pre class="screen"># exec >/dev/kmsg 2>&1 </dev/console</pre></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="using-the-dracut-shell"></a>Using the dracut shell</h4></div></div></div><p>dracut offers a shell for interactive debugging in the event dracut fails to +locate your root filesystem. To enable the shell:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> +Add the boot parameter <span class="emphasis"><em>'rd.shell</em></span>' to your bootloader configuration file +(e.g. <span class="emphasis"><em>/boot/grub2/grub.cfg</em></span>) +</li><li class="listitem"><p class="simpara"> +Remove the boot arguments <span class="emphasis"><em>'rhgb</em></span>' and <span class="emphasis"><em>'quiet</em></span>' +</p><p class="simpara">A sample <span class="emphasis"><em>/boot/grub2/grub.cfg</em></span> bootloader configuration file is listed below.</p><pre class="screen">default=0 +timeout=5 +serial --unit=0 --speed=9600 +terminal --timeout=5 serial console +title Fedora (2.6.29.5-191.fc11.x86_64) + root (hd0,0) + kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell + initrd /dracut-2.6.29.5-191.fc11.x86_64.img</pre></li><li class="listitem"><p class="simpara"> +If system boot fails, you will be dropped into a shell as seen in the example +below. +</p><pre class="screen">No root device found +Dropping to debug shell. + +#</pre></li><li class="listitem"> +Use this shell prompt to gather the information requested above +(see <a class="xref" href="#all-bug-reports" title="All bug reports">the section called “All bug reports”</a>). +</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="accessing-the-root-volume-from-the-dracut-shell"></a>Accessing the root volume from the dracut shell</h4></div></div></div><p>From the dracut debug shell, you can manually perform the task of locating and +preparing your root volume for boot. The required steps will depend on how your +root volume is configured. Common scenarios include:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +A block device (e.g. <span class="emphasis"><em>/dev/sda7</em></span>) +</li><li class="listitem"> +A LVM logical volume (e.g. <span class="emphasis"><em>/dev/VolGroup00/LogVol00</em></span>) +</li><li class="listitem"> +An encrypted device + (e.g. <span class="emphasis"><em>/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83</em></span>) +</li><li class="listitem"> +A network attached device + (e.g. <span class="emphasis"><em>netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all</em></span>) +</li></ul></div><p>The exact method for locating and preparing will vary. However, to continue with +a successful boot, the objective is to locate your root volume and create a +symlink <span class="emphasis"><em>/dev/root</em></span> which points to the file system. For example, the following +example demonstrates accessing and booting a root volume that is an encrypted +LVM Logical volume.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara"> +Inspect your partitions using parted +</p><pre class="screen"># parted /dev/sda -s p +Model: ATA HTS541060G9AT00 (scsi) +Disk /dev/sda: 60.0GB +Sector size (logical/physical): 512B/512B +Partition Table: msdos +Number Start End Size Type File system Flags +1 32.3kB 10.8GB 107MB primary ext4 boot +2 10.8GB 55.6GB 44.7GB logical lvm</pre></li><li class="listitem"><p class="simpara"> +You recall that your root volume was a LVM logical volume. Scan and activate +any logical volumes. +</p><pre class="screen"># lvm vgscan +# lvm vgchange -ay</pre></li><li class="listitem"><p class="simpara"> +You should see any logical volumes now using the command blkid: +</p><pre class="screen"># blkid +/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4" +/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member" +/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS" +/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext4" +/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"</pre></li><li class="listitem"><p class="simpara"> +From the output above, you recall that your root volume exists on an encrypted +block device. Following the guidance disk encryption guidance from the +Installation Guide, you unlock your encrypted root volume. +</p><pre class="screen"># UUID=$(cryptsetup luksUUID /dev/mapper/linux-root) +# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID +Enter passphrase for /dev/mapper/linux-root: +Key slot 0 unlocked.</pre></li><li class="listitem"><p class="simpara"> +Next, make a symbolic link to the unlocked root volume +</p><pre class="screen"># ln -s /dev/mapper/luks-$UUID /dev/root</pre></li><li class="listitem"><p class="simpara"> +With the root volume available, you may continue booting the system by exiting +the dracut shell +</p><pre class="screen"># exit</pre></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="additional-dracut-boot-parameters"></a>Additional dracut boot parameters</h4></div></div></div><p>For more debugging options, see <span class="strong"><strong>dracut.cmdline</strong></span>(7).</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="debugging-dracut-on-shutdown"></a>Debugging dracut on shutdown</h4></div></div></div><p>To debug the shutdown sequence on systemd systems, you can <span class="emphasis"><em>rd.break</em></span> +on <span class="emphasis"><em>pre-shutdown</em></span> or <span class="emphasis"><em>shutdown</em></span>.</p><p>To do this from an already booted system:</p><pre class="screen"># mkdir -p /run/initramfs/etc/cmdline.d +# echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf +# touch /run/initramfs/.need_shutdown</pre><p>This will give you a dracut shell after the system pivot’ed back in the +initramfs.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_options"></a>OPTIONS</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>--kver</strong></span> <span class="emphasis"><em><kernel version></em></span> +</span></dt><dd> + Set the kernel version. This enables to specify the kernel version, without + specifying the location of the initramfs image. For example: +</dd></dl></div><pre class="screen"># dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64</pre><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>-f, --force</strong></span> +</span></dt><dd> + Overwrite existing initramfs file. +</dd><dt><span class="term"> +<span class="emphasis"><em><output file></em></span> <span class="strong"><strong>--rebuild</strong></span> +</span></dt><dd> + Append the current arguments to those with which the input initramfs image + was built. This option helps in incrementally building the initramfs for + testing. If optional <span class="emphasis"><em><output file></em></span> is not provided, the input initramfs + provided to rebuild will be used as output file. +</dd><dt><span class="term"> +<span class="strong"><strong>-a, --add</strong></span> <span class="emphasis"><em><list of dracut modules></em></span> +</span></dt><dd><p class="simpara"> + Add a space-separated list of dracut modules to the default set of modules. + This parameter can be specified multiple times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --add "module1 module2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--force-add</strong></span> <span class="emphasis"><em><list of dracut modules></em></span> +</span></dt><dd><p class="simpara"> + Force to add a space-separated list of dracut modules to the default set of + modules, when -H is specified. This parameter can be specified multiple + times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --force-add "module1 module2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>-o, --omit</strong></span> <span class="emphasis"><em><list of dracut modules></em></span> +</span></dt><dd><p class="simpara"> + Omit a space-separated list of dracut modules. This parameter can be + specified multiple times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --omit "module1 module2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>-m, --modules</strong></span> <span class="emphasis"><em><list of dracut modules></em></span> +</span></dt><dd><p class="simpara"> + Specify a space-separated list of dracut modules to call when building the + initramfs. Modules are located in <span class="emphasis"><em>/usr/lib/dracut/modules.d</em></span>. This + parameter can be specified multiple times. + This option forces dracut to only include the specified dracut modules. + In most cases the "--add" option is what you want to use. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --modules "module1 module2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>-d, --drivers</strong></span> <span class="emphasis"><em><list of kernel modules></em></span> +</span></dt><dd><p class="simpara"> + Specify a space-separated list of kernel modules to exclusively include + in the initramfs. The kernel modules have to be specified without the ".ko" + suffix. This parameter can be specified multiple times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --drivers "kmodule1 kmodule2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--add-drivers</strong></span> <span class="emphasis"><em><list of kernel modules></em></span> +</span></dt><dd><p class="simpara"> + Specify a space-separated list of kernel modules to add to the initramfs. + The kernel modules have to be specified without the ".ko" suffix. This + parameter can be specified multiple times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --add-drivers "kmodule1 kmodule2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--force-drivers</strong></span> <span class="emphasis"><em><list of kernel modules></em></span> +</span></dt><dd><p class="simpara"> + See add-drivers above. But in this case it is ensured that the drivers + are tried to be loaded early via modprobe. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --force-drivers "kmodule1 kmodule2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--omit-drivers</strong></span> <span class="emphasis"><em><list of kernel modules></em></span> +</span></dt><dd><p class="simpara"> + Specify a space-separated list of kernel modules not to add to the + initramfs. + The kernel modules have to be specified without the ".ko" suffix. This + parameter can be specified multiple times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --omit-drivers "kmodule1 kmodule2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--filesystems</strong></span> <span class="emphasis"><em><list of filesystems></em></span> +</span></dt><dd><p class="simpara"> + Specify a space-separated list of kernel filesystem modules to exclusively + include in the generic initramfs. This parameter can be specified multiple + times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --filesystems "filesystem1 filesystem2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>-k, --kmoddir</strong></span> <span class="emphasis"><em><kernel directory></em></span> +</span></dt><dd> + Specify the directory, where to look for kernel modules. +</dd><dt><span class="term"> +<span class="strong"><strong>--fwdir</strong></span> <span class="emphasis"><em><dir>[:<dir>…]++</em></span> +</span></dt><dd> + Specify additional directories, where to look for firmwares. This parameter + can be specified multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>--libdirs</strong></span> <span class="emphasis"><em><list of directories></em></span> +</span></dt><dd><p class="simpara"> + Specify a space-separated list of directories to look for libraries to + include in the generic initramfs. This parameter can be specified multiple + times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --libdirs "dir1 dir2" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--kernel-cmdline <parameters></strong></span> +</span></dt><dd> + Specify default kernel command line parameters. +</dd><dt><span class="term"> +<span class="strong"><strong>--kernel-only</strong></span> +</span></dt><dd> + Only install kernel drivers and firmware files. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-kernel</strong></span> +</span></dt><dd> + Do not install kernel drivers and firmware files. +</dd><dt><span class="term"> +<span class="strong"><strong>--early-microcode</strong></span> +</span></dt><dd> + Combine early microcode with ramdisk. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-early-microcode</strong></span> +</span></dt><dd> + Do not combine early microcode with ramdisk. +</dd><dt><span class="term"> +<span class="strong"><strong>--print-cmdline</strong></span> +</span></dt><dd> + Print the kernel command line for the current disk layout. +</dd><dt><span class="term"> +<span class="strong"><strong>--mdadmconf</strong></span> +</span></dt><dd> + Include local <span class="emphasis"><em>/etc/mdadm.conf</em></span> file. +</dd><dt><span class="term"> +<span class="strong"><strong>--nomdadmconf</strong></span> +</span></dt><dd> + Do not include local <span class="emphasis"><em>/etc/mdadm.conf</em></span> file. +</dd><dt><span class="term"> +<span class="strong"><strong>--lvmconf</strong></span> +</span></dt><dd> + Include local <span class="emphasis"><em>/etc/lvm/lvm.conf</em></span> file. +</dd><dt><span class="term"> +<span class="strong"><strong>--nolvmconf</strong></span> +</span></dt><dd> + Do not include local <span class="emphasis"><em>/etc/lvm/lvm.conf</em></span> file. +</dd><dt><span class="term"> +<span class="strong"><strong>--fscks</strong></span> <span class="emphasis"><em><list of fsck tools></em></span> +</span></dt><dd><p class="simpara"> + Add a space-separated list of fsck tools, in addition to <span class="emphasis"><em>dracut.conf</em></span>'s + specification; the installation is opportunistic (non-existing tools are + ignored). +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --fscks "fsck.foo barfsck" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--nofscks</strong></span> +</span></dt><dd> + Inhibit installation of any fsck tools. +</dd><dt><span class="term"> +<span class="strong"><strong>--strip</strong></span> +</span></dt><dd> + Strip binaries in the initramfs (default). +</dd><dt><span class="term"> +<span class="strong"><strong>--aggressive-strip</strong></span> +</span></dt><dd> + Strip more than just debug symbol and sections, for a smaller initramfs + build. The --strip option must also be specified. +</dd><dt><span class="term"> +<span class="strong"><strong>--nostrip</strong></span> +</span></dt><dd> + Do not strip binaries in the initramfs. +</dd><dt><span class="term"> +<span class="strong"><strong>--hardlink</strong></span> +</span></dt><dd> + Hardlink files in the initramfs (default). +</dd><dt><span class="term"> +<span class="strong"><strong>--nohardlink</strong></span> +</span></dt><dd> + Do not hardlink files in the initramfs. +</dd><dt><span class="term"> +<span class="strong"><strong>--prefix</strong></span> <span class="emphasis"><em><dir></em></span> +</span></dt><dd> + Prefix initramfs files with the specified directory. +</dd><dt><span class="term"> +<span class="strong"><strong>--noprefix</strong></span> +</span></dt><dd> + Do not prefix initramfs files (default). +</dd><dt><span class="term"> +<span class="strong"><strong>-h, --help</strong></span> +</span></dt><dd> + Display help text and exit. +</dd><dt><span class="term"> +<span class="strong"><strong>--debug</strong></span> +</span></dt><dd> + Output debug information of the build process. +</dd><dt><span class="term"> +<span class="strong"><strong>-v, --verbose</strong></span> +</span></dt><dd> + Increase verbosity level (default is info(4)). +</dd><dt><span class="term"> +<span class="strong"><strong>--version</strong></span> +</span></dt><dd> + Display version and exit. +</dd><dt><span class="term"> +<span class="strong"><strong>-q, --quiet</strong></span> +</span></dt><dd> + Decrease verbosity level (default is info(4)). +</dd><dt><span class="term"> +<span class="strong"><strong>-c, --conf</strong></span> <span class="emphasis"><em><dracut configuration file></em></span> +</span></dt><dd><p class="simpara"> + Specify configuration file to use. +</p><p class="simpara">Default: + <span class="emphasis"><em>/etc/dracut.conf</em></span></p></dd><dt><span class="term"> +<span class="strong"><strong>--confdir</strong></span> <span class="emphasis"><em><configuration directory></em></span> +</span></dt><dd><p class="simpara"> + Specify configuration directory to use. +</p><p class="simpara">Default: + <span class="emphasis"><em>/etc/dracut.conf.d</em></span></p></dd><dt><span class="term"> +<span class="strong"><strong>--tmpdir</strong></span> <span class="emphasis"><em><temporary directory></em></span> +</span></dt><dd><p class="simpara"> + Specify temporary directory to use. +</p><p class="simpara">Default: + <span class="emphasis"><em>/var/tmp</em></span></p></dd><dt><span class="term"> +<span class="strong"><strong>-r, --sysroot</strong></span> <span class="emphasis"><em><sysroot directory></em></span> +</span></dt><dd><p class="simpara"> + Specify the sysroot directory to collect files from. + This is useful to create the initramfs image from + a cross-compiled sysroot directory. For the extra helper + variables, see <span class="strong"><strong>ENVIRONMENT</strong></span> below. +</p><p class="simpara">Default: + <span class="emphasis"><em>empty</em></span></p></dd><dt><span class="term"> +<span class="strong"><strong>--sshkey</strong></span> <span class="emphasis"><em><sshkey file></em></span> +</span></dt><dd> + SSH key file used with ssh-client module. +</dd><dt><span class="term"> +<span class="strong"><strong>--logfile</strong></span> <span class="emphasis"><em><logfile></em></span> +</span></dt><dd><p class="simpara"> + Logfile to use; overrides any setting from the configuration files. +</p><p class="simpara">Default: + <span class="emphasis"><em>/var/log/dracut.log</em></span></p></dd><dt><span class="term"> +<span class="strong"><strong>-l, --local</strong></span> +</span></dt><dd> + Activates the local mode. dracut will use modules from the current working + directory instead of the system-wide installed modules in + <span class="emphasis"><em>/usr/lib/dracut/modules.d</em></span>. + This is useful when running dracut from a git checkout. +</dd><dt><span class="term"> +<span class="strong"><strong>-H, --hostonly</strong></span> +</span></dt><dd><p class="simpara"> + Host-only mode: Install only what is needed for booting the local host + instead of a generic host and generate host-specific configuration. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If chrooted to another root other than the real root device, use "--fstab" and +provide a valid <span class="emphasis"><em>/etc/fstab</em></span>.</p></div></dd><dt><span class="term"> +<span class="strong"><strong>-N, --no-hostonly</strong></span> +</span></dt><dd> + Disable host-only mode. +</dd><dt><span class="term"> +<span class="strong"><strong>--hostonly-mode <span class="emphasis"><em><mode></em></span></strong></span> +</span></dt><dd><p class="simpara"> + Specify the host-only mode to use. <span class="emphasis"><em><mode></em></span> could be one of "sloppy" or + "strict". + In "sloppy" host-only mode, extra drivers and modules will be installed, so + minor hardware change won’t make the image unbootable (e.g. changed + keyboard), and the image is still portable among similar hosts. + With "strict" mode enabled, anything not necessary for booting the local + host in its current state will not be included, and modules may do some + extra job to save more space. Minor change of hardware or environment could + make the image unbootable. +</p><p class="simpara">Default: + <span class="emphasis"><em>sloppy</em></span></p></dd><dt><span class="term"> +<span class="strong"><strong>--hostonly-cmdline</strong></span> +</span></dt><dd> + Store kernel command line arguments needed in the initramfs. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-hostonly-cmdline</strong></span> +</span></dt><dd> + Do not store kernel command line arguments needed in the initramfs. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-hostonly-default-device</strong></span> +</span></dt><dd> + Do not generate implicit host devices like root, swap, fstab, etc. + Use "--mount" or "--add-device" to explicitly add devices as needed. +</dd><dt><span class="term"> +<span class="strong"><strong>--hostonly-i18n</strong></span> +</span></dt><dd> + Install only needed keyboard and font files according to the host + configuration (default). +</dd><dt><span class="term"> +<span class="strong"><strong>--no-hostonly-i18n</strong></span> +</span></dt><dd> + Install all keyboard and font files available. +</dd><dt><span class="term"> +<span class="strong"><strong>--hostonly-nics</strong></span> <span class="emphasis"><em><list of nics></em></span> +</span></dt><dd> + Only enable listed NICs in the initramfs. The list can be empty, so other + modules can install only the necessary network drivers. +</dd><dt><span class="term"> +<span class="strong"><strong>--persistent-policy</strong></span> <span class="emphasis"><em><policy></em></span> +</span></dt><dd> + Use <span class="emphasis"><em><policy></em></span> to address disks and partitions. + <span class="emphasis"><em><policy></em></span> can be any directory name found in /dev/disk (e.g. "by-uuid", + "by-label"), or "mapper" to use /dev/mapper device names (default). +</dd><dt><span class="term"> +<span class="strong"><strong>--fstab</strong></span> +</span></dt><dd> + Use <span class="emphasis"><em>/etc/fstab</em></span> instead of <span class="emphasis"><em>/proc/self/mountinfo</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>--add-fstab</strong></span> <span class="emphasis"><em><filename></em></span> +</span></dt><dd> + Add entries of <span class="emphasis"><em><filename></em></span> to the initramfs /etc/fstab. +</dd><dt><span class="term"> +<span class="strong"><strong>--mount</strong></span> "<span class="emphasis"><em><device></em></span> <span class="emphasis"><em><mountpoint></em></span> <span class="emphasis"><em><filesystem type></em></span> [<span class="emphasis"><em><filesystem options></em></span> [<span class="emphasis"><em><dump frequency></em></span> [<span class="emphasis"><em><fsck order></em></span>]]]" +</span></dt><dd> + Mount <span class="emphasis"><em><device></em></span> on <span class="emphasis"><em><mountpoint></em></span> with <span class="emphasis"><em><filesystem type></em></span> in the + initramfs. <span class="emphasis"><em><filesystem options></em></span>, <span class="emphasis"><em><dump options></em></span> and <span class="emphasis"><em><fsck order></em></span> can + be specified, see fstab manpage for the details. + The default <span class="emphasis"><em><filesystem options></em></span> is "defaults". + The default <span class="emphasis"><em><dump frequency></em></span> is "0". + The default <span class="emphasis"><em><fsck order></em></span> is "2". +</dd><dt><span class="term"> +<span class="strong"><strong>--mount</strong></span> "<span class="emphasis"><em><mountpoint></em></span>" +</span></dt><dd> + Like above, but <span class="emphasis"><em><device></em></span>, <span class="emphasis"><em><filesystem type></em></span> and <span class="emphasis"><em><filesystem options></em></span> + are determined by looking at the current mounts. +</dd><dt><span class="term"> +<span class="strong"><strong>--add-device</strong></span> <span class="emphasis"><em><device></em></span> +</span></dt><dd> + Bring up <span class="emphasis"><em><device></em></span> in initramfs, <span class="emphasis"><em><device></em></span> should be the device name. + This can be useful in host-only mode for resume support when your swap is on + LVM or an encrypted partition. + [NB --device can be used for compatibility with earlier releases] +</dd><dt><span class="term"> +<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em><SOURCE></em></span> <span class="emphasis"><em><TARGET></em></span> +</span></dt><dd> + Include the files in the SOURCE directory into the + TARGET directory in the final initramfs. If SOURCE is a file, it will be + installed to TARGET in the final initramfs. This parameter can be specified + multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>-I, --install</strong></span> <span class="emphasis"><em><file list></em></span> +</span></dt><dd><p class="simpara"> + Install the space separated list of files into the initramfs. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the list has multiple arguments, then you have to put these in quotes. For +example:</p><pre class="screen"># dracut --install "/bin/foo /sbin/bar" ...</pre></div></dd><dt><span class="term"> +<span class="strong"><strong>--install-optional</strong></span> <span class="emphasis"><em><file list></em></span> +</span></dt><dd> + Install the space separated list of files into the initramfs, if they exist. +</dd><dt><span class="term"> +<span class="strong"><strong>--gzip</strong></span> +</span></dt><dd> + Compress the generated initramfs using gzip. This will be done by default, + unless another compression option or --no-compress is passed. Equivalent to + "--compress=gzip -9". +</dd><dt><span class="term"> +<span class="strong"><strong>--bzip2</strong></span> +</span></dt><dd><p class="simpara"> + Compress the generated initramfs using bzip2. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Make sure your kernel has bzip2 decompression support compiled in, otherwise you +will not be able to boot. Equivalent to "--compress=bzip2 -9".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>--lzma</strong></span> +</span></dt><dd><p class="simpara"> + Compress the generated initramfs using lzma. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Make sure your kernel has lzma decompression support compiled in, otherwise you +will not be able to boot. Equivalent to "--compress=lzma -9 -T0".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>--xz</strong></span> +</span></dt><dd><p class="simpara"> + Compress the generated initramfs using xz. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Make sure your kernel has xz decompression support compiled in, otherwise you +will not be able to boot. Equivalent to +"--compress=xz --check=crc32 --lzma2=dict=1MiB -T0".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>--lzo</strong></span> +</span></dt><dd><p class="simpara"> + Compress the generated initramfs using lzop. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Make sure your kernel has lzo decompression support compiled in, otherwise you +will not be able to boot. Equivalent to "--compress=lzop -9".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>--lz4</strong></span> +</span></dt><dd><p class="simpara"> + Compress the generated initramfs using lz4. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Make sure your kernel has lz4 decompression support compiled in, otherwise you +will not be able to boot. Equivalent to "--compress=lz4 -l -9".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>--zstd</strong></span> +</span></dt><dd><p class="simpara"> + Compress the generated initramfs using Zstandard. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Make sure your kernel has zstd decompression support compiled in, otherwise you +will not be able to boot. Equivalent to "--compress=zstd -15 -q -T0".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>--compress</strong></span> <span class="emphasis"><em><compressor></em></span> +</span></dt><dd> + Compress the generated initramfs using the passed compression program. If + you pass it just the name of a compression program, it will call that + program with known-working arguments. If you pass a quoted string with + arguments, it will be called with exactly those arguments. Depending on what + you pass, this may result in an initramfs that the kernel cannot decompress. + The default value can also be set via the <span class="emphasis"><em>INITRD_COMPRESS</em></span> environment + variable. +</dd><dt><span class="term"> +<span class="strong"><strong>--squash-compressor</strong></span> <span class="emphasis"><em><compressor></em></span> +</span></dt><dd> + Compress the squashfs image using the passed compressor and compressor + specific options for mksquashfs. You can refer to mksquashfs manual for + supported compressors and compressor specific options. If squash module is + not called when building the initramfs, this option will not take effect. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-compress</strong></span> +</span></dt><dd> + Do not compress the generated initramfs. This will override any other + compression options. +</dd><dt><span class="term"> +<span class="strong"><strong>--reproducible</strong></span> +</span></dt><dd> + Create reproducible images. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-reproducible</strong></span> +</span></dt><dd> + Do not create reproducible images. +</dd><dt><span class="term"> +<span class="strong"><strong>--list-modules</strong></span> +</span></dt><dd> + List all available dracut modules. +</dd><dt><span class="term"> +<span class="strong"><strong>-M, --show-modules</strong></span> +</span></dt><dd> + Print included module’s name to standard output during build. +</dd><dt><span class="term"> +<span class="strong"><strong>--keep</strong></span> +</span></dt><dd> + Keep the initramfs temporary directory for debugging purposes. +</dd><dt><span class="term"> +<span class="strong"><strong>--printsize</strong></span> +</span></dt><dd> + Print out the module install size. +</dd><dt><span class="term"> +<span class="strong"><strong>--profile</strong></span> +</span></dt><dd> + Output profile information of the build process. +</dd><dt><span class="term"> +<span class="strong"><strong>--ro-mnt</strong></span> +</span></dt><dd> + Mount / and /usr read-only by default. +</dd><dt><span class="term"> +<span class="strong"><strong>-L, --stdlog</strong></span> <span class="emphasis"><em><level></em></span> +</span></dt><dd> + [0-6] Specify logging level (to standard error). +</dd></dl></div><pre class="screen"> 0 - suppress any messages + 1 - only fatal errors + 2 - all errors + 3 - warnings + 4 - info + 5 - debug info (here starts lots of output) + 6 - trace info (and even more)</pre><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>--regenerate-all</strong></span> +</span></dt><dd> + Regenerate all initramfs images at the default location with the kernel + versions found on the system. Additional parameters are passed through. +</dd><dt><span class="term"> +<span class="strong"><strong>-p, --parallel</strong></span> +</span></dt><dd> + Try to execute tasks in parallel. Currently only supported with + <span class="strong"><strong>--regenerate-all</strong></span> (build initramfs images for all kernel + versions simultaneously). +</dd><dt><span class="term"> +<span class="strong"><strong>--noimageifnotneeded</strong></span> +</span></dt><dd> + Do not create an image in host-only mode, if no kernel driver is needed +and no /etc/cmdline/*.conf will be generated into the initramfs. +</dd><dt><span class="term"> +<span class="strong"><strong>--loginstall <span class="emphasis"><em><directory></em></span></strong></span> +</span></dt><dd> + Log all files installed from the host to <span class="emphasis"><em><directory></em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>--uefi</strong></span> +</span></dt><dd> + Instead of creating an initramfs image, dracut will create an UEFI + executable, which can be executed by an UEFI BIOS. The default output + filename is <span class="emphasis"><em><EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi</em></span>. + <EFI> might be <span class="emphasis"><em>/efi</em></span>, <span class="emphasis"><em>/boot</em></span> or <span class="emphasis"><em>/boot/efi</em></span> depending on where the ESP + partition is mounted. The <BUILD_ID> is taken from BUILD_ID in + <span class="emphasis"><em>/usr/lib/os-release</em></span> or if it exists <span class="emphasis"><em>/etc/os-release</em></span> and is left out, + if BUILD_ID is non-existent or empty. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-uefi</strong></span> +</span></dt><dd> + Disables UEFI mode. +</dd><dt><span class="term"> +<span class="strong"><strong>--no-machineid</strong></span> +</span></dt><dd> + Affects the default output filename of <span class="strong"><strong>--uefi</strong></span> and will discard the + <MACHINE_ID> part. +</dd><dt><span class="term"> +<span class="strong"><strong>--uefi-stub <span class="emphasis"><em><file></em></span></strong></span> +</span></dt><dd> + Specifies the UEFI stub loader, which will load the attached kernel, + initramfs and kernel command line and boots the kernel. The default is + <span class="emphasis"><em>$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>--uefi-splash-image <span class="emphasis"><em><file></em></span></strong></span> +</span></dt><dd> + Specifies the UEFI stub loader’s splash image. Requires bitmap (<span class="strong"><strong>.bmp</strong></span>) + image format. +</dd><dt><span class="term"> +<span class="strong"><strong>--kernel-image <span class="emphasis"><em><file></em></span></strong></span> +</span></dt><dd> + Specifies the kernel image, which to include in the UEFI executable. The + default is <span class="emphasis"><em>/lib/modules/<KERNEL-VERSION>/vmlinuz</em></span> or + <span class="emphasis"><em>/boot/vmlinuz-<KERNEL-VERSION></em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>--sbat <parameters></strong></span> +</span></dt><dd> + Specifies the SBAT parameters, which to include in the UEFI executable. By default + the default SBAT string added is "sbat,1,SBAT Version,sbat,1, + <a class="ulink" href="https://github.com/rhboot/shim/blob/main/SBAT.md" target="_top">https://github.com/rhboot/shim/blob/main/SBAT.md</a>". +</dd><dt><span class="term"> +<span class="strong"><strong>--enhanced-cpio</strong></span> +</span></dt><dd> + Attempt to use the dracut-cpio binary, which optimizes archive creation for + copy-on-write filesystems by using the copy_file_range(2) syscall via Rust’s + io::copy(). When specified, initramfs archives are also padded to ensure + optimal data alignment for extent sharing. To retain reflink data + deduplication benefits, this should be used alongside the <span class="strong"><strong>--no-compress</strong></span> + and <span class="strong"><strong>--nostrip</strong></span> parameters, with initramfs source files, <span class="strong"><strong>--tmpdir</strong></span> + staging area and destination all on the same copy-on-write capable + filesystem. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_environment"></a>ENVIRONMENT</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="emphasis"><em>INITRD_COMPRESS</em></span> +</span></dt><dd> + sets the default compression program. See <span class="strong"><strong>--compress</strong></span>. +</dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_LDCONFIG</em></span> +</span></dt><dd><p class="simpara"> + sets the <span class="emphasis"><em>ldconfig</em></span> program path and options. Optional. + Used for <span class="strong"><strong>--sysroot</strong></span>. +</p><p class="simpara">Default: + <span class="emphasis"><em>ldconfig</em></span></p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_LDD</em></span> +</span></dt><dd><p class="simpara"> + sets the <span class="emphasis"><em>ldd</em></span> program path and options. Optional. + Used for <span class="strong"><strong>--sysroot</strong></span>. +</p><p class="simpara">Default: + <span class="emphasis"><em>ldd</em></span></p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_TESTBIN</em></span> +</span></dt><dd><p class="simpara"> + sets the initially tested binary for detecting library paths. + Optional. Used for <span class="strong"><strong>--sysroot</strong></span>. In the cross-compiled sysroot, + the default value (<span class="emphasis"><em>/bin/sh</em></span>) is unusable, as it is an absolute + symlink and points outside the sysroot directory. +</p><p class="simpara">Default: + <span class="emphasis"><em>/bin/sh</em></span></p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_INSTALL</em></span> +</span></dt><dd><p class="simpara"> + overrides path and options for executing <span class="emphasis"><em>dracut-install</em></span> internally. + Optional. Can be used to debug <span class="emphasis"><em>dracut-install</em></span> while running the + main dracut script. +</p><p class="simpara">Default: + <span class="emphasis"><em>dracut-install</em></span></p><p class="simpara">Example: + DRACUT_INSTALL="valgrind dracut-install"</p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_BZIP2</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_LBZIP2</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_LZMA</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_XZ</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_GZIP</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_PIGZ</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_LZOP</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_ZSTD</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_LZ4</em></span> +, </span><span class="term"> +<span class="emphasis"><em>DRACUT_COMPRESS_CAT</em></span> +</span></dt><dd><p class="simpara"> + overrides for compression utilities to support using them from + non-standard paths. +</p><p class="simpara">Default values are the default compression utility names to be found in <span class="strong"><strong>PATH</strong></span>.</p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_ARCH</em></span> +</span></dt><dd><p class="simpara"> + overrides the value of <span class="strong"><strong>uname -m</strong></span>. Used for <span class="strong"><strong>--sysroot</strong></span>. +</p><p class="simpara">Default: + <span class="emphasis"><em>empty</em></span> (the value of <span class="strong"><strong>uname -m</strong></span> on the host system)</p></dd><dt><span class="term"> +<span class="emphasis"><em>SYSTEMD_VERSION</em></span> +</span></dt><dd> + overrides systemd version. Used for <span class="strong"><strong>--sysroot</strong></span>. +</dd><dt><span class="term"> +<span class="emphasis"><em>SYSTEMCTL</em></span> +</span></dt><dd> + overrides the systemctl binary. Used for <span class="strong"><strong>--sysroot</strong></span>. +</dd><dt><span class="term"> +<span class="emphasis"><em>NM_VERSION</em></span> +</span></dt><dd> + overrides the NetworkManager version. Used for <span class="strong"><strong>--sysroot</strong></span>. +</dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_INSTALL_PATH</em></span> +</span></dt><dd><p class="simpara"> + overrides <span class="strong"><strong>PATH</strong></span> environment for <span class="strong"><strong>dracut-install</strong></span> to look for + binaries relative to <span class="strong"><strong>--sysroot</strong></span>. In a cross-compiled environment + (e.g. Yocto), PATH points to natively built binaries that are not + in the host’s /bin, /usr/bin, etc. <span class="strong"><strong>dracut-install</strong></span> still needs plain + /bin and /usr/bin that are relative to the cross-compiled sysroot. +</p><p class="simpara">Default: + <span class="emphasis"><em>PATH</em></span></p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_INSTALL_LOG_TARGET</em></span> +</span></dt><dd><p class="simpara"> + overrides <span class="strong"><strong>DRACUT_LOG_TARGET</strong></span> for <span class="strong"><strong>dracut-install</strong></span>. It allows + running <span class="strong"><strong>dracut-install* to run with different log target that + </strong></span>dracut** runs with. +</p><p class="simpara">Default: + <span class="emphasis"><em>DRACUT_LOG_TARGET</em></span></p></dd><dt><span class="term"> +<span class="emphasis"><em>DRACUT_INSTALL_LOG_LEVEL</em></span> +</span></dt><dd><p class="simpara"> + overrides <span class="strong"><strong>DRACUT_LOG_LEVEL</strong></span> for <span class="strong"><strong>dracut-install</strong></span>. It allows + running <span class="strong"><strong>dracut-install* to run with different log level that + </strong></span>dracut** runs with. +</p><p class="simpara">Default: + <span class="emphasis"><em>DRACUT_LOG_LEVEL</em></span></p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_files"></a>FILES</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="emphasis"><em>/var/log/dracut.log</em></span> +</span></dt><dd> + logfile of initramfs image creation +</dd><dt><span class="term"> +<span class="emphasis"><em>/tmp/dracut.log</em></span> +</span></dt><dd> + logfile of initramfs image creation, if <span class="emphasis"><em>/var/log/dracut.log</em></span> is not + writable +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/dracut.conf</em></span> +</span></dt><dd> + see dracut.conf5 +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/dracut.conf.d/*.conf</em></span> +</span></dt><dd> + see dracut.conf5 +</dd><dt><span class="term"> +<span class="emphasis"><em>/usr/lib/dracut/dracut.conf.d/*.conf</em></span> +</span></dt><dd> + see dracut.conf5 +</dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_configuration_in_the_initramfs"></a>Configuration in the initramfs</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="emphasis"><em>/etc/conf.d/</em></span> +</span></dt><dd> + Any files found in <span class="emphasis"><em>/etc/conf.d/</em></span> will be sourced in the initramfs to + set initial values. Command line options will override these values + set in the configuration files. +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/cmdline</em></span> +</span></dt><dd> + Can contain additional command line options. Deprecated, better use + /etc/cmdline.d/*.conf. +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/cmdline.d/*.conf</em></span> +</span></dt><dd> + Can contain additional command line options. +</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_availability"></a>AVAILABILITY</h2></div></div></div><p>The dracut command is part of the dracut package and is available from +<a class="ulink" href="https://github.com/dracut-ng/dracut-ng" target="_top">https://github.com/dracut-ng/dracut-ng</a></p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_authors"></a>AUTHORS</h2></div></div></div><p>Harald Hoyer</p><p>Victor Lowther</p><p>Amadeusz Żołnowski</p><p>Hannes Reinecke</p><p>Daniel Molkentin</p><p>Will Woods</p><p>Philippe Seewer</p><p>Warren Togami</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also"></a>SEE ALSO</h2></div></div></div><p><span class="strong"><strong>dracut.cmdline</strong></span>(7) <span class="strong"><strong>dracut.conf</strong></span>(5) <span class="strong"><strong>lsinitrd</strong></span>(1)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="dracutconf5"></a>Chapter 7. DRACUT.CONF(5)</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name_2">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis_2">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description_2">Description</a></span></dt><dt><span class="section"><a href="#_files_2">Files</a></span></dt><dt><span class="section"><a href="#_author">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_2">See Also</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name_2"></a>NAME</h2></div></div></div><p>dracut.conf - configuration file(s) for dracut</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_synopsis_2"></a>SYNOPSIS</h2></div></div></div><p><span class="emphasis"><em>/etc/dracut.conf</em></span> +<span class="emphasis"><em>/etc/dracut.conf.d/*.conf</em></span> +<span class="emphasis"><em>/usr/lib/dracut/dracut.conf.d/*.conf</em></span></p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description_2"></a>Description</h2></div></div></div><p><span class="emphasis"><em>dracut.conf</em></span> is loaded during the initialisation phase of dracut. Command line +parameter will override any values set here.</p><p><span class="emphasis"><em>*.conf</em></span> files are read from /usr/lib/dracut/dracut.conf.d and +/etc/dracut.conf.d. Files with the same name in /etc/dracut.conf.d will replace +files in /usr/lib/dracut/dracut.conf.d. +The files are then read in alphanumerical order and will override parameters +set in <span class="emphasis"><em>/etc/dracut.conf</em></span>. Each line specifies an attribute and a value. A <span class="emphasis"><em>#</em></span> +indicates the beginning of a comment; following characters, up to the end of the +line are not interpreted.</p><p>dracut command line options will override any values set here.</p><p>Configuration files must have the extension .conf; other extensions are ignored.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>add_dracutmodules+=</strong></span>" <span class="emphasis"><em><dracut modules></em></span> " +</span></dt><dd> + Add a space-separated list of dracut modules to call when building the + initramfs. Modules are located in <span class="emphasis"><em>/usr/lib/dracut/modules.d</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>force_add_dracutmodules+=</strong></span>" <span class="emphasis"><em><dracut modules></em></span> " +</span></dt><dd> + Force to add a space-separated list of dracut modules to the default set of + modules, when host-only mode is specified. This parameter can be specified + multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>omit_dracutmodules+=</strong></span>" <span class="emphasis"><em><dracut modules></em></span> " +</span></dt><dd> + Omit a space-separated list of dracut modules to call when building the + initramfs. Modules are located in <span class="emphasis"><em>/usr/lib/dracut/modules.d</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>dracutmodules+=</strong></span>" <span class="emphasis"><em><dracut modules></em></span> " +</span></dt><dd> + Specify a space-separated list of dracut modules to call when building the + initramfs. Modules are located in <span class="emphasis"><em>/usr/lib/dracut/modules.d</em></span>. + This option forces dracut to only include the specified dracut modules. + In most cases the "add_dracutmodules" option is what you want to use. +</dd><dt><span class="term"> +<span class="strong"><strong>add_drivers+=</strong></span>" <span class="emphasis"><em><kernel modules></em></span> " +</span></dt><dd> + Specify a space-separated list of kernel modules to add to the initramfs. + The kernel modules have to be specified without the ".ko" suffix. +</dd><dt><span class="term"> +<span class="strong"><strong>force_drivers+=</strong></span>" <span class="emphasis"><em><list of kernel modules></em></span> " +</span></dt><dd> + See add_drivers above. But in this case it is ensured that the drivers + are tried to be loaded early via modprobe. +</dd><dt><span class="term"> +<span class="strong"><strong>omit_drivers+=</strong></span>" <span class="emphasis"><em><kernel modules></em></span> " +</span></dt><dd> + Specify a space-separated list of kernel modules not to add to the + initramfs. The kernel modules have to be specified without the ".ko" suffix. +</dd><dt><span class="term"> +<span class="strong"><strong>drivers+=</strong></span>" <span class="emphasis"><em><kernel modules></em></span> " +</span></dt><dd> + Specify a space-separated list of kernel modules to exclusively include in + the initramfs. The kernel modules have to be specified without the ".ko" + suffix. +</dd><dt><span class="term"> +<span class="strong"><strong>filesystems+=</strong></span>" <span class="emphasis"><em><filesystem names></em></span> " +</span></dt><dd> + Specify a space-separated list of kernel filesystem modules to exclusively + include in the generic initramfs. +</dd><dt><span class="term"> +<span class="strong"><strong>drivers_dir=</strong></span>"<span class="emphasis"><em><kernel modules directory></em></span>" +</span></dt><dd> + Specify the directory where to look for kernel modules. +</dd><dt><span class="term"> +<span class="strong"><strong>fw_dir+=</strong></span>" :<span class="emphasis"><em><dir></em></span>[:<span class="emphasis"><em><dir></em></span> …] " +</span></dt><dd> + Specify additional colon-separated list of directories where to look for + firmware files. +</dd><dt><span class="term"> +<span class="strong"><strong>libdirs+=</strong></span>" <span class="emphasis"><em><dir></em></span>[ <span class="emphasis"><em><dir></em></span> …] " +</span></dt><dd> + Specify a space-separated list of directories where to look for libraries. +</dd><dt><span class="term"> +<span class="strong"><strong>install_items+=</strong></span>" <span class="emphasis"><em><file></em></span>[ <span class="emphasis"><em><file></em></span> …] " +</span></dt><dd> + Specify additional files to include in the initramfs, separated by spaces. +</dd><dt><span class="term"> +<span class="strong"><strong>install_optional_items+=</strong></span>" <span class="emphasis"><em><file></em></span>[ <span class="emphasis"><em><file></em></span> …] " +</span></dt><dd> + Specify additional files to include in the initramfs, separated by spaces, + if they exist. +</dd><dt><span class="term"> +<span class="strong"><strong>compress=</strong></span>"<span class="emphasis"><em>{cat|bzip2|lzma|xz|gzip|lzop|lz4|zstd|<compressor [args …]>}</em></span>" +</span></dt><dd> + Compress the generated initramfs using the passed compression program. If + you pass it just the name of a compression program, it will call that + program with known-working arguments. If you pass arguments, it will be + called with exactly those arguments. Depending on what you pass, this may + result in an initramfs that the kernel cannot decompress. + To disable compression, use "cat". +</dd><dt><span class="term"> +<span class="strong"><strong>squash_compress=</strong></span>"<span class="emphasis"><em>{<compressor [args …]>}</em></span>" +</span></dt><dd> + Compress the squashfs image using the passed compressor and compressor + specific options for mksquashfs. You can refer to mksquashfs manual for + supported compressors and compressor specific options. If squash module is + not called when building the initramfs, this option will not take effect. +</dd><dt><span class="term"> +<span class="strong"><strong>do_strip=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Strip binaries in the initramfs (default=yes). +</dd><dt><span class="term"> +<span class="strong"><strong>aggressive_strip=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Strip more than just debug symbol and sections, for a smaller initramfs + build. The "do_strip=yes" option must also be specified (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>do_hardlink=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Hardlink files in the initramfs (default=yes). +</dd><dt><span class="term"> +<span class="strong"><strong>prefix=</strong></span>" <span class="emphasis"><em><directory></em></span> " +</span></dt><dd> + Prefix initramfs files with <span class="emphasis"><em><directory></em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>hostonly=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Host-only mode: Install only what is needed for booting the local host + instead of a generic host and generate host-specific configuration + (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>hostonly_mode=</strong></span>"<span class="emphasis"><em>{sloppy|strict}</em></span>" +</span></dt><dd> + Specify the host-only mode to use (default=sloppy). + In "sloppy" host-only mode, extra drivers and modules will be installed, so + minor hardware change won’t make the image unbootable (e.g. changed + keyboard), and the image is still portable among similar hosts. + With "strict" mode enabled, anything not necessary for booting the local + host in its current state will not be included, and modules may do some + extra job to save more space. Minor change of hardware or environment could + make the image unbootable. +</dd><dt><span class="term"> +<span class="strong"><strong>hostonly_cmdline=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + If set to "yes", store the kernel command line arguments needed in the + initramfs. If <span class="strong"><strong>hostonly="yes"</strong></span> and this option is not configured, it’s + automatically set to "yes". +</dd><dt><span class="term"> +<span class="strong"><strong>hostonly_nics+=</strong></span>" [<span class="emphasis"><em><nic></em></span>[ <span class="emphasis"><em><nic></em></span> …]] " +</span></dt><dd> + Only enable listed NICs in the initramfs. The list can be empty, so other + modules can install only the necessary network drivers. +</dd><dt><span class="term"> +<span class="strong"><strong>persistent_policy=</strong></span>"<span class="emphasis"><em><policy></em></span>" +</span></dt><dd> + Use <span class="emphasis"><em><policy></em></span> to address disks and partitions. + <span class="emphasis"><em><policy></em></span> can be any directory name found in /dev/disk (e.g. "by-uuid", + "by-label"), or "mapper" to use /dev/mapper device names (default=mapper). +</dd><dt><span class="term"> +<span class="strong"><strong>tmpdir=</strong></span>"<span class="emphasis"><em><temporary directory></em></span>" +</span></dt><dd> + Specify temporary directory to use. +</dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If chrooted to another root other than the real root device, use --fstab and +provide a valid <span class="emphasis"><em>/etc/fstab</em></span>.</p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>use_fstab=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Use <span class="emphasis"><em>/etc/fstab</em></span> instead of <span class="emphasis"><em>/proc/self/mountinfo</em></span> (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>add_fstab+=</strong></span>" <span class="emphasis"><em><filename></em></span> " +</span></dt><dd> + Add entries of <span class="emphasis"><em><filename></em></span> to the initramfs /etc/fstab. +</dd><dt><span class="term"> +<span class="strong"><strong>add_device+=</strong></span>" <span class="emphasis"><em><device></em></span> " +</span></dt><dd> + Bring up <span class="emphasis"><em><device></em></span> in initramfs, <span class="emphasis"><em><device></em></span> should be the device name. + This can be useful in host-only mode for resume support when your swap is on + LVM an encrypted partition. +</dd><dt><span class="term"> +<span class="strong"><strong>mdadmconf=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Include local <span class="emphasis"><em>/etc/mdadm.conf</em></span> (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>lvmconf=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Include local <span class="emphasis"><em>/etc/lvm/lvm.conf</em></span> (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>fscks=</strong></span>" <span class="emphasis"><em><fsck tools></em></span> " +</span></dt><dd> + Add a space-separated list of fsck tools. If nothing is specified, the + default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck + jfs_fsck reiserfsck btrfsck". The installation is opportunistic + (non-existing tools are ignored). +</dd><dt><span class="term"> +<span class="strong"><strong>nofscks=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + If specified, inhibit installation of any fsck tools (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>ro_mnt=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Mount <span class="emphasis"><em>/</em></span> and <span class="emphasis"><em>/usr</em></span> read-only by default (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>kernel_cmdline=</strong></span>"<span class="emphasis"><em>parameters</em></span>" +</span></dt><dd> + Specify default kernel command line parameters. +</dd><dt><span class="term"> +<span class="strong"><strong>kernel_only=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Only install kernel drivers and firmware files (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>no_kernel=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Do not install kernel drivers and firmware files (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>acpi_override=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + [WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! + Override BIOS provided ACPI tables. For further documentation read + Documentation/acpi/initrd_table_override.txt in the kernel sources. + Search for ACPI table files (must have .aml suffix) in acpi_table_dir= + directory (see below) and add them to a separate uncompressed cpio + archive. This cpio archive gets glued (concatenated, uncompressed one + must be the first one) to the compressed cpio archive. The first, + uncompressed cpio archive is for data which the kernel must be able + to access very early (and cannot make use of uncompress algorithms yet) + like microcode or ACPI tables (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>acpi_table_dir=</strong></span>"<span class="emphasis"><em><dir></em></span>" +</span></dt><dd> + Directory to search for ACPI tables if acpi_override= is set to yes. +</dd><dt><span class="term"> +<span class="strong"><strong>early_microcode=</strong></span>"{yes|no}" +</span></dt><dd> + Combine early microcode with ramdisk (default=yes). +</dd><dt><span class="term"> +<span class="strong"><strong>stdloglvl</strong></span>="<span class="emphasis"><em>{0-6}</em></span>" +</span></dt><dd> + Specify logging level for standard error (default=4). +</dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Logging levels:</p><pre class="screen"> 0 - suppress any messages + 1 - only fatal errors + 2 - all errors + 3 - warnings + 4 - info + 5 - debug info (here starts lots of output) + 6 - trace info (and even more)</pre></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>sysloglvl</strong></span>="<span class="emphasis"><em>{0-6}</em></span>" +</span></dt><dd> + Specify logging level for syslog (default=0). +</dd><dt><span class="term"> +<span class="strong"><strong>fileloglvl=</strong></span>"<span class="emphasis"><em>{0-6}</em></span>" +</span></dt><dd> + Specify logging level for logfile (default=4). +</dd><dt><span class="term"> +<span class="strong"><strong>logfile=</strong></span>"<span class="emphasis"><em><file></em></span>" +</span></dt><dd> + Path to logfile. +</dd><dt><span class="term"> +<span class="strong"><strong>sshkey=</strong></span>"<span class="emphasis"><em><file></em></span>" +</span></dt><dd> + SSH key file used with ssh-client module. +</dd><dt><span class="term"> +<span class="strong"><strong>show_modules=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Print the name of the included modules to standard output during build + (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>i18n_vars=</strong></span>"<span class="emphasis"><em><variable mapping></em></span>" +</span></dt><dd> + Distribution specific variable mapping. + See dracut/modules.d/10i18n/README for a detailed description. +</dd><dt><span class="term"> +<span class="strong"><strong>i18n_default_font=</strong></span>"<span class="emphasis"><em><fontname></em></span>" +</span></dt><dd> + The font <fontname> to install, if not specified otherwise. + Default is "eurlatgr". +</dd><dt><span class="term"> +<span class="strong"><strong>i18n_install_all=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Install everything regardless of generic or host-only mode (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>reproducible=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Create reproducible images (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>noimageifnotneeded=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Do not create an image in host-only mode, if no kernel driver is needed + and no /etc/cmdline/*.conf will be generated into the initramfs + (default=no). +</dd><dt><span class="term"> +<span class="strong"><strong>loginstall=</strong></span>"<span class="emphasis"><em><directory></em></span>" +</span></dt><dd> + Log all files installed from the host to <span class="emphasis"><em><directory></em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>uefi=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Instead of creating an initramfs image, dracut will create an UEFI + executable, which can be executed by an UEFI BIOS (default=no). + The default output filename is + <span class="emphasis"><em><EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi</em></span>. + <EFI> might be <span class="emphasis"><em>/efi</em></span>, <span class="emphasis"><em>/boot</em></span> or <span class="emphasis"><em>/boot/efi</em></span> depending on where the ESP + partition is mounted. The <BUILD_ID> is taken from BUILD_ID in + <span class="emphasis"><em>/usr/lib/os-release</em></span> or if it exists <span class="emphasis"><em>/etc/os-release</em></span> and is left out, + if BUILD_ID is non-existent or empty. +</dd><dt><span class="term"> +<span class="strong"><strong>machine_id=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Affects the default output filename of the UEFI executable, including the + <MACHINE_ID> part (default=yes). +</dd><dt><span class="term"> +<span class="strong"><strong>uefi_stub=</strong></span>"<span class="emphasis"><em><file></em></span>" +</span></dt><dd> + Specifies the UEFI stub loader, which will load the attached kernel, + initramfs and kernel command line and boots the kernel. The default is + <span class="emphasis"><em>/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>uefi_splash_image=</strong></span>"<span class="emphasis"><em><file></em></span>" +</span></dt><dd> + Specifies the UEFI stub loader’s splash image. Requires bitmap (<span class="strong"><strong>.bmp</strong></span>) + image format. +</dd><dt><span class="term"> +<span class="strong"><strong>uefi_secureboot_cert=</strong></span>"<span class="emphasis"><em><file></em></span>", <span class="strong"><strong>uefi_secureboot_key=</strong></span>"<span class="emphasis"><em><file></em></span>" +</span></dt><dd> + Specifies a certificate and corresponding key, which are used to sign the + created UEFI executable. + Requires both certificate and key need to be specified and <span class="emphasis"><em>sbsign</em></span> to be + installed. +</dd><dt><span class="term"> +<span class="strong"><strong>uefi_secureboot_engine=</strong></span>"<span class="emphasis"><em>parameter</em></span>" +</span></dt><dd> + Specifies an engine to use when signing the created UEFI executable. E.g. "pkcs11" +</dd><dt><span class="term"> +<span class="strong"><strong>kernel_image=</strong></span>"<span class="emphasis"><em><file></em></span>" +</span></dt><dd> + Specifies the kernel image, which to include in the UEFI executable. The + default is <span class="emphasis"><em>/lib/modules/<KERNEL-VERSION>/vmlinuz</em></span> or + <span class="emphasis"><em>/boot/vmlinuz-<KERNEL-VERSION></em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>sbat=</strong></span>"<span class="emphasis"><em>parameters</em></span>" +</span></dt><dd> + Specifies the SBAT parameters, which to include in the UEFI executable. By default + the default SBAT string added is "sbat,1,SBAT Version,sbat,1, + <a class="ulink" href="https://github.com/rhboot/shim/blob/main/SBAT.md" target="_top">https://github.com/rhboot/shim/blob/main/SBAT.md</a>". +</dd><dt><span class="term"> +<span class="strong"><strong>enhanced_cpio=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + Attempt to use the dracut-cpio binary, which optimizes archive creation for + copy-on-write filesystems (default=no). + When specified, initramfs archives are also padded to ensure optimal data + alignment for extent sharing. To retain reflink data deduplication benefits, + this should be used alongside the <span class="strong"><strong>compress="cat"</strong></span> and <span class="strong"><strong>do_strip="no"</strong></span> + parameters, with initramfs source files, <span class="strong"><strong>tmpdir</strong></span> staging area and + destination all on the same copy-on-write capable filesystem. +</dd><dt><span class="term"> +<span class="strong"><strong>parallel=</strong></span>"<span class="emphasis"><em>{yes|no}</em></span>" +</span></dt><dd> + If set to <span class="emphasis"><em>yes</em></span>, try to execute tasks in parallel (currently only supported + for <span class="emphasis"><em>--regenerate-all</em></span>). +</dd><dt><span class="term"> +<span class="strong"><strong>initrdname=</strong></span>"<span class="emphasis"><em><filepattern></em></span>" +</span></dt><dd> + Specifies the file name for the generated initramfs if it is not set otherwise. + file pattern and only one file with this pattern should exists in the +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_files_2"></a>Files</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="emphasis"><em>/etc/dracut.conf</em></span> +</span></dt><dd> + Old configuration file. You better use your own file in + <span class="emphasis"><em>/etc/dracut.conf.d/</em></span>. +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/dracut.conf.d/</em></span> +</span></dt><dd> + Any <span class="emphasis"><em>/etc/dracut.conf.d/*.conf</em></span> file can override the values in + <span class="emphasis"><em>/etc/dracut.conf</em></span>. The configuration files are read in alphanumerical + order. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_author"></a>AUTHOR</h2></div></div></div><p>Harald Hoyer</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also_2"></a>See Also</h2></div></div></div><p><span class="strong"><strong>dracut</strong></span>(8) <span class="strong"><strong>dracut.cmdline</strong></span>(7)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="dracutcmdline7"></a>Chapter 8. DRACUT.CMDLINE(7)</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name_3">NAME</a></span></dt><dt><span class="section"><a href="#_description_3">DESCRIPTION</a></span></dt><dd><dl><dt><span class="section"><a href="#_standard">Standard</a></span></dt><dt><span class="section"><a href="#_iso_scan_filename">iso-scan/filename</a></span></dt><dt><span class="section"><a href="#_misc">Misc</a></span></dt><dt><span class="section"><a href="#dracutkerneldebug">Debug</a></span></dt><dt><span class="section"><a href="#_i18n">I18N</a></span></dt><dt><span class="section"><a href="#_lvm">LVM</a></span></dt><dt><span class="section"><a href="#_crypto_luks">crypto LUKS</a></span></dt><dt><span class="section"><a href="#_crypto_luks_key_on_removable_device_support">crypto LUKS - key on removable device support</a></span></dt><dt><span class="section"><a href="#_md_raid">MD RAID</a></span></dt><dt><span class="section"><a href="#_dm_raid">DM RAID</a></span></dt><dt><span class="section"><a href="#_multipath">MULTIPATH</a></span></dt><dt><span class="section"><a href="#_fips">FIPS</a></span></dt><dt><span class="section"><a href="#_network">Network</a></span></dt><dt><span class="section"><a href="#_nfs">NFS</a></span></dt><dt><span class="section"><a href="#_cifs">CIFS</a></span></dt><dt><span class="section"><a href="#_iscsi">iSCSI</a></span></dt><dt><span class="section"><a href="#_fcoe">FCoE</a></span></dt><dt><span class="section"><a href="#_nvmf">NVMf</a></span></dt><dt><span class="section"><a href="#_nbd">NBD</a></span></dt><dt><span class="section"><a href="#_virtiofs">VIRTIOFS</a></span></dt><dt><span class="section"><a href="#_dasd">DASD</a></span></dt><dt><span class="section"><a href="#_zfcp">ZFCP</a></span></dt><dt><span class="section"><a href="#_znet">ZNET</a></span></dt><dt><span class="section"><a href="#_booting_live_images">Booting live images</a></span></dt><dt><span class="section"><a href="#_zipl">ZIPL</a></span></dt><dt><span class="section"><a href="#_cio_ignore">CIO_IGNORE</a></span></dt><dt><span class="section"><a href="#_plymouth_boot_splash">Plymouth Boot Splash</a></span></dt><dt><span class="section"><a href="#_kernel_keys">Kernel keys</a></span></dt><dt><span class="section"><a href="#_deprecated_renamed_options">Deprecated, renamed Options</a></span></dt><dt><span class="section"><a href="#_configuration_in_the_initramfs_2">Configuration in the Initramfs</a></span></dt></dl></dd><dt><span class="section"><a href="#_author_2">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_3">SEE ALSO</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name_3"></a>NAME</h2></div></div></div><p>dracut.cmdline - dracut kernel command line options</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description_3"></a>DESCRIPTION</h2></div></div></div><p>The root device used by the kernel is specified in the boot configuration +file on the kernel command line, as always.</p><p>The traditional <span class="emphasis"><em>root=/dev/sda1</em></span> style device specification is allowed, but not +encouraged. The root device should better be identified by LABEL or UUID. If a +label is used, as in <span class="emphasis"><em>root=LABEL=<label_of_root></em></span> the initramfs will search all +available devices for a filesystem with the appropriate label, and mount that +device as the root filesystem. <span class="emphasis"><em>root=UUID=<uuidnumber></em></span> will mount the partition +with that UUID as the root filesystem.</p><p>In the following all kernel command line parameters, which are processed by +dracut, are described.</p><p>"rd.*" parameters mentioned without "=" are boolean parameters. They can be +turned on/off by setting them to {0|1}. If the assignment with "=" is missing +"=1" is implied. For example <span class="emphasis"><em>rd.info</em></span> can be turned off with <span class="emphasis"><em>rd.info=0</em></span> or +turned on with <span class="emphasis"><em>rd.info=1</em></span> or <span class="emphasis"><em>rd.info</em></span>. The last value in the kernel command +line is the value, which is honored.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_standard"></a>Standard</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>init=</strong></span><span class="emphasis"><em><path to real init></em></span> +</span></dt><dd> + specify the path to the init program to be started after the initramfs has + finished +</dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span><span class="emphasis"><em><path to blockdevice></em></span> +</span></dt><dd><p class="simpara"> + specify the block device to use as the root filesystem. +</p><p><strong>Example. </strong> +</p><pre class="screen">root=/dev/sda1 +root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 +root=/dev/disk/by-label/Root +root=LABEL=Root +root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7 +root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7 +root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rootfstype=</strong></span><span class="emphasis"><em><filesystem type></em></span> +</span></dt><dd><p class="simpara"> +"auto" if not specified. +</p><p><strong>Example. </strong> +</p><pre class="screen">rootfstype=ext4</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rootflags=</strong></span><span class="emphasis"><em><mount options></em></span> +</span></dt><dd> + specify additional mount options for the root filesystem. If not set, + <span class="emphasis"><em>/etc/fstab</em></span> of the real root will be parsed for special mount options and + mounted accordingly. +</dd><dt><span class="term"> +<span class="strong"><strong>ro</strong></span> +</span></dt><dd> + force mounting <span class="emphasis"><em>/</em></span> and <span class="emphasis"><em>/usr</em></span> (if it is a separate device) read-only. If + none of ro and rw is present, both are mounted according to <span class="emphasis"><em>/etc/fstab</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>rw</strong></span> +</span></dt><dd> + force mounting <span class="emphasis"><em>/</em></span> and <span class="emphasis"><em>/usr</em></span> (if it is a separate device) read-write. + See also ro option. +</dd><dt><span class="term"> +<span class="strong"><strong>rootfallback=</strong></span><span class="emphasis"><em><path to blockdevice></em></span> +</span></dt><dd> + specify the block device to use as the root filesystem, if the normal root + cannot be found. This can only be a simple block device with a simple file + system, for which the filesystem driver is either compiled in, or added + manually to the initramfs. This parameter can be specified multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.auto</strong></span> <span class="strong"><strong>rd.auto=1</strong></span> +</span></dt><dd> + enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or + lvm. Default is off as of dracut version >= 024. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.hostonly=0</strong></span> +</span></dt><dd> + removes all compiled in configuration of the host system the initramfs image + was built on. This helps booting, if any disk layout changed, especially in + combination with rd.auto or other parameters specifying the layout. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.cmdline=ask</strong></span> +</span></dt><dd> + prompts the user for additional kernel command line parameters +</dd><dt><span class="term"> +<span class="strong"><strong>rd.fstab=0</strong></span> +</span></dt><dd> + do not honor special mount options for the root filesystem found in + <span class="emphasis"><em>/etc/fstab</em></span> of the real root. +</dd><dt><span class="term"> +<span class="strong"><strong>resume=</strong></span><span class="emphasis"><em><path to resume partition></em></span> +</span></dt><dd><p class="simpara"> + resume from a swap partition +</p><p><strong>Example. </strong> +</p><pre class="screen">resume=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 +resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7 +resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.skipfsck</strong></span> +</span></dt><dd> + skip fsck for rootfs and <span class="emphasis"><em>/usr</em></span>. If you’re mounting <span class="emphasis"><em>/usr</em></span> read-only and + the init system performs fsck before remount, you might want to use this + option to avoid duplication. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_iso_scan_filename"></a>iso-scan/filename</h3></div></div></div><p>Mount all mountable devices and search for ISO pointed by the argument. When +the ISO is found set it up as a loop device. Device containing this ISO +image will stay mounted at /run/initramfs/isoscandev. +Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work +by copying the original kernel cmdline parameters.</p><p><strong>Example. </strong> +</p><pre class="screen">menuentry 'Live Fedora 20' --class fedora --class gnu-linux --class gnu --class os { + set isolabel=Fedora-Live-LXDE-x86_64-20-1 + set isofile="/boot/iso/Fedora-Live-LXDE-x86_64-20-1.iso" + loopback loop $isofile + linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel ro rd.live.image quiet rhgb + initrd (loop)/isolinux/initrd0.img +}</pre><p> +</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_misc"></a>Misc</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.emergency=</strong></span><span class="emphasis"><em>[reboot|poweroff|halt]</em></span> +</span></dt><dd> + specify, what action to execute in case of a critical failure. rd.shell=0 must also + be specified. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.driver.blacklist=</strong></span><span class="emphasis"><em><drivername></em></span>[,<span class="emphasis"><em><drivername></em></span>,…] +</span></dt><dd> + do not load kernel module <drivername>. This parameter can be specified + multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.driver.pre=</strong></span><span class="emphasis"><em><drivername></em></span>[,<span class="emphasis"><em><drivername></em></span>,…] +</span></dt><dd> + force loading kernel module <drivername>. This parameter can be specified + multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.driver.post=</strong></span><span class="emphasis"><em><drivername></em></span>[,<span class="emphasis"><em><drivername></em></span>,…] +</span></dt><dd> + force loading kernel module <drivername> after all automatic loading modules + have been loaded. This parameter can be specified multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.retry=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + specify how long dracut should retry the initqueue to configure devices. + The default is 180 seconds. After 2/3 of the time, degraded raids are force + started. If you have hardware, which takes a very long time to announce its + drives, you might want to extend this value. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.timeout=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + specify how long dracut should wait for devices to appear. The + default is <span class="emphasis"><em>0</em></span>, which means <span class="emphasis"><em>forever</em></span>. Note that this timeout + should be longer than rd.retry to allow for proper configuration. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.noverifyssl</strong></span> +</span></dt><dd> + accept self-signed certificates for ssl downloads. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.ctty=</strong></span><span class="emphasis"><em><terminal device></em></span> +</span></dt><dd> + specify the controlling terminal for the console. + This is useful, if you have multiple "console=" arguments. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.shutdown.timeout.umount=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + specify how long dracut should wait for an individual umount to finish + during shutdown. This avoids the system from blocking when unmounting a file + system cannot complete and waits indefinitely. Value <span class="emphasis"><em>0</em></span> means to wait + <span class="emphasis"><em>forever</em></span>. The default is 90 seconds. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dracutkerneldebug"></a>Debug</h3></div></div></div><p>If you are dropped to an emergency shell, the file +<span class="emphasis"><em>/run/initramfs/rdsosreport.txt</em></span> is created, which can be saved to a (to be +mounted by hand) partition (usually /boot) or a USB stick. Additional debugging +info can be produced by adding <span class="strong"><strong>rd.debug</strong></span> to the kernel command line. +<span class="emphasis"><em>/run/initramfs/rdsosreport.txt</em></span> contains all logs and the output of some tools. +It should be attached to any report about dracut problems.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.info</strong></span> +</span></dt><dd> + print informational output though "quiet" is set +</dd><dt><span class="term"> +<span class="strong"><strong>rd.shell</strong></span> +</span></dt><dd> + allow dropping to a shell, if root mounting fails +</dd><dt><span class="term"> +<span class="strong"><strong>rd.debug</strong></span> +</span></dt><dd> + set -x for the dracut shell. + If systemd is active in the initramfs, all output is logged to the systemd + journal, which you can inspect with "journalctl -ab". + If systemd is not active, the logs are written to dmesg and + <span class="emphasis"><em>/run/initramfs/init.log</em></span>. + If "quiet" is set, it also logs to the console. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.memdebug=[0-5]</strong></span> +</span></dt><dd><p class="simpara"> + Print memory usage info at various points, set the verbose level from 0 to 5. +</p><pre class="literallayout">Higher level means more debugging output:</pre><pre class="screen"> 0 - no output + 1 - partial /proc/meminfo + 2 - /proc/meminfo + 3 - /proc/meminfo + /proc/slabinfo + 4 - /proc/meminfo + /proc/slabinfo + memstrack summary + NOTE: memstrack is a memory tracing tool that tracks the total memory + consumption, and peak memory consumption of each kernel modules + and userspace progress during the whole initramfs runtime, report + is generated and the end of initramsfs run. + 5 - /proc/meminfo + /proc/slabinfo + memstrack (with top memory stacktrace) + NOTE: memstrack (with top memory stacktrace) will print top memory + allocation stack traces during the whole initramfs runtime.</pre></dd><dt><span class="term"> +<span class="strong"><strong>rd.break</strong></span> +</span></dt><dd> + drop to a shell at the end +</dd><dt><span class="term"> +<span class="strong"><strong>rd.break=</strong></span><span class="emphasis"><em>{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}</em></span> +</span></dt><dd> + drop to a shell before the defined breakpoint starts. + This parameter can be specified multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.udev.log_level=</strong></span><span class="emphasis"><em>{err|info|debug}</em></span> +</span></dt><dd> + set udev log level. The default is <span class="emphasis"><em>err</em></span>. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_i18n"></a>I18N</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.vconsole.keymap=</strong></span><span class="emphasis"><em><keymap base file name></em></span> +</span></dt><dd><p class="simpara"> + keyboard translation table loaded by loadkeys; taken from keymaps directory; + will be written as KEYMAP to <span class="emphasis"><em>/etc/vconsole.conf</em></span> in the initramfs. +</p><p><strong>Example. </strong> +</p><pre class="screen">rd.vconsole.keymap=de-latin1-nodeadkeys</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.vconsole.keymap.ext=</strong></span><span class="emphasis"><em><list of keymap base file names></em></span> +</span></dt><dd> + list of extra keymaps to bo loaded (sep. by space); will be written as + EXT_KEYMAP to <span class="emphasis"><em>/etc/vconsole.conf</em></span> in the initramfs +</dd><dt><span class="term"> +<span class="strong"><strong>rd.vconsole.unicode</strong></span> +</span></dt><dd> + boolean, indicating UTF-8 mode; will be written as UNICODE to + <span class="emphasis"><em>/etc/vconsole.conf</em></span> in the initramfs +</dd><dt><span class="term"> +<span class="strong"><strong>rd.vconsole.font=</strong></span><span class="emphasis"><em><font base file name></em></span> +</span></dt><dd><p class="simpara"> + console font; taken from consolefonts directory; will be written as FONT to + <span class="emphasis"><em>/etc/vconsole.conf</em></span> in the initramfs. +</p><p><strong>Example. </strong> +</p><pre class="screen">rd.vconsole.font=eurlatgr</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.vconsole.font.map=</strong></span><span class="emphasis"><em><console map base file name></em></span> +</span></dt><dd> + see description of <span class="emphasis"><em>-m</em></span> parameter in setfont manual; taken from consoletrans + directory; will be written as FONT_MAP to <span class="emphasis"><em>/etc/vconsole.conf</em></span> in the + initramfs +</dd><dt><span class="term"> +<span class="strong"><strong>rd.vconsole.font.unimap=</strong></span><span class="emphasis"><em><unicode table base file name></em></span> +</span></dt><dd> + see description of <span class="emphasis"><em>-u</em></span> parameter in setfont manual; taken from unimaps + directory; will be written as FONT_UNIMAP to <span class="emphasis"><em>/etc/vconsole.conf</em></span> in the + initramfs +</dd><dt><span class="term"> +<span class="strong"><strong>rd.locale.LANG=</strong></span><span class="emphasis"><em><locale></em></span> +</span></dt><dd><p class="simpara"> + taken from the environment; if no UNICODE is defined we set its value in + basis of LANG value (whether it ends with ".utf8" (or similar) or not); will + be written as LANG to <span class="emphasis"><em>/etc/locale.conf</em></span> in the initramfs. +</p><p><strong>Example. </strong> +</p><pre class="screen">rd.locale.LANG=pl_PL.utf8</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.locale.LC_ALL=</strong></span><span class="emphasis"><em><locale></em></span> +</span></dt><dd> + taken from the environment; will be written as LC_ALL to <span class="emphasis"><em>/etc/locale.conf</em></span> + in the initramfs +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_lvm"></a>LVM</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.lvm=0</strong></span> +</span></dt><dd> + disable LVM detection +</dd><dt><span class="term"> +<span class="strong"><strong>rd.lvm.vg=</strong></span><span class="emphasis"><em><volume group name></em></span> +</span></dt><dd> + only activate all logical volumes in the the volume groups with the given name. + rd.lvm.vg can be specified multiple times on the kernel command line. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.lvm.lv=</strong></span><span class="emphasis"><em><volume group name>/<logical volume name></em></span> +</span></dt><dd> + only activate the logical volumes with the given name. + rd.lvm.lv can be specified multiple times on the kernel command line. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.lvm.conf=0</strong></span> +</span></dt><dd> + remove any <span class="emphasis"><em>/etc/lvm/lvm.conf</em></span>, which may exist in the initramfs +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_crypto_luks"></a>crypto LUKS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.luks=0</strong></span> +</span></dt><dd> + disable crypto LUKS detection +</dd><dt><span class="term"> +<span class="strong"><strong>rd.luks.uuid=</strong></span><span class="emphasis"><em><luks uuid></em></span> +</span></dt><dd> + only activate the LUKS partitions with the given UUID. Any "luks-" of the + LUKS UUID is removed before comparing to <span class="emphasis"><em><luks uuid></em></span>. + The comparisons also matches, if <span class="emphasis"><em><luks uuid></em></span> is only the beginning of the + LUKS UUID, so you don’t have to specify the full UUID. + This parameter can be specified multiple times. + <span class="emphasis"><em><luks uuid></em></span> may be prefixed by the keyword <code class="literal">keysource:</code>, see + <span class="emphasis"><em>rd.luks.key</em></span> below. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.luks.allow-discards=</strong></span><span class="emphasis"><em><luks uuid></em></span> +</span></dt><dd> + Allow using of discards (TRIM) requests for LUKS partitions with the given + UUID. Any "luks-" of the LUKS UUID is removed before comparing to + <span class="emphasis"><em><luks uuid></em></span>. The comparisons also matches, if <span class="emphasis"><em><luks uuid></em></span> is only the + beginning of the LUKS UUID, so you don’t have to specify the full UUID. + This parameter can be specified multiple times. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.luks.allow-discards</strong></span> +</span></dt><dd> + Allow using of discards (TRIM) requests on all LUKS partitions. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.luks.crypttab=0</strong></span> +</span></dt><dd> + do not check, if LUKS partition is in <span class="emphasis"><em>/etc/crypttab</em></span> +</dd><dt><span class="term"> +<span class="strong"><strong>rd.luks.timeout=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + specify how long dracut should wait when waiting for the user to enter the + password. This avoid blocking the boot if no password is entered. It does + not apply to luks key. The default is <span class="emphasis"><em>0</em></span>, which means <span class="emphasis"><em>forever</em></span>. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_crypto_luks_key_on_removable_device_support"></a>crypto LUKS - key on removable device support</h3></div></div></div><p>NB: If systemd is included in the dracut initrd, dracut’s built in +removable device keying support won’t work. systemd will prompt for +a password from the console even if you’ve supplied <span class="strong"><strong>rd.luks.key</strong></span>. +You may be able to use standard systemd <span class="strong"><strong>fstab</strong></span>(5) syntax to +get the same effect. If you do need <span class="strong"><strong>rd.luks.key</strong></span> to work, +you will have to exclude the "systemd" dracut module and any modules +that depend on it. See <span class="strong"><strong>dracut.conf</strong></span>(5) and +<a class="ulink" href="https://bugzilla.redhat.com/show_bug.cgi?id=905683" target="_top">https://bugzilla.redhat.com/show_bug.cgi?id=905683</a> for more +information.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.luks.key=</strong></span><span class="emphasis"><em><keypath>[:<keydev>[:<luksdev>]]</em></span> +</span></dt><dd><p class="simpara"> + <span class="emphasis"><em><keypath></em></span> is the pathname of a key file, relative to the root + of the filesystem on some device. It’s REQUIRED. When + <span class="emphasis"><em><keypath></em></span> ends with <span class="emphasis"><em>.gpg</em></span> it’s considered to be key encrypted + symmetrically with GPG. You will be prompted for the GPG password on + boot. GPG support comes with the <span class="emphasis"><em>crypt-gpg</em></span> module, which needs to be + added explicitly. +</p><p class="simpara"><span class="emphasis"><em><keydev></em></span> identifies the device on which the key file resides. It may +be the kernel name of the device (should start with "/dev/"), a UUID +(prefixed with "UUID=") or a label (prefix with "LABEL="). You don’t +have to specify a full UUID. Just its beginning will suffice, even if +its ambiguous. All matching devices will be probed. This parameter is +recommended, but not required. If it’s not present, all block devices will +be probed, which may significantly increase boot time.</p><p class="simpara">If <span class="emphasis"><em><luksdev></em></span> is given, the specified key will only be used for +the specified LUKS device. Possible values are the same as for +<span class="emphasis"><em><keydev></em></span>. Unless you have several LUKS devices, you don’t have to +specify this parameter. The simplest usage is:</p><p><strong>Example. </strong> +</p><pre class="screen">rd.luks.key=/foo/bar.key</pre><p> +</p><p class="simpara">As you see, you can skip colons in such a case.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Your LUKS partition must match your key file.</p><p>dracut provides keys to cryptsetup with <span class="emphasis"><em>-d</em></span> (an older alias for +<span class="emphasis"><em>--key-file</em></span>). This uses the entire binary +content of the key file as part of the secret. If +you pipe a password into cryptsetup <span class="strong"><strong>without</strong></span> <span class="emphasis"><em>-d</em></span> or <span class="emphasis"><em>--key-file</em></span>, +it will be treated as text user input, and only characters before +the first newline will be used. Therefore, when you’re creating +an encrypted partition for dracut to mount, and you pipe a key into +<span class="emphasis"><em>cryptsetup luksFormat</em></span>,you must use <span class="emphasis"><em>-d -</em></span>.</p><p>Here is an example for a key encrypted with GPG (warning: +<span class="emphasis"><em>--batch-mode</em></span> will overwrite the device without asking for +confirmation):</p><pre class="screen">gpg --quiet --decrypt rootkey.gpg | \ +cryptsetup --batch-mode --key-file - \ + luksFormat /dev/sda47</pre><p>If you use unencrypted key files, just use the key file pathname +instead of the standard input. For a random key with 256 bits of +entropy, you might use:</p><pre class="screen">head -32c /dev/urandom > rootkey.key +cryptsetup --batch-mode --key-file rootkey.key \ + luksFormat /dev/sda47</pre><p>You can also use regular key files on an encrypted <span class="emphasis"><em>keydev</em></span>.</p><p>Compared to using GPG encrypted keyfiles on an unencrypted +device this provides the following advantages:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +you can unlock your disk(s) using multiple passphrases +</li><li class="listitem"> +better security by not losing the key stretching mechanism +</li></ul></div><p>To use an encrypted <span class="emphasis"><em>keydev</em></span> you <span class="strong"><strong>must</strong></span> ensure that it becomes +available by using the keyword <code class="literal">keysource</code>, e.g. +<code class="literal">rd.luks.uuid=keysource:aaaa</code> +<span class="emphasis"><em>aaaa</em></span> being the uuid of the encrypted <span class="emphasis"><em>keydev</em></span>.</p><p>Example:</p><p>Lets assume you have three disks <span class="emphasis"><em>A</em></span>, <span class="emphasis"><em>B</em></span> and <span class="emphasis"><em>C</em></span> with the uuids +<span class="emphasis"><em>aaaa</em></span>, <span class="emphasis"><em>bbbb</em></span> and <span class="emphasis"><em>cccc</em></span>. +You want to unlock <span class="emphasis"><em>A</em></span> and <span class="emphasis"><em>B</em></span> using keyfile <span class="emphasis"><em>keyfile</em></span>. +The unlocked volumes be <span class="emphasis"><em>A'</em></span>, <span class="emphasis"><em>B'</em></span> and <span class="emphasis"><em>C'</em></span> with the uuids +<span class="emphasis"><em>AAAA</em></span>, <span class="emphasis"><em>BBBB</em></span> and <span class="emphasis"><em>CCCC</em></span>. +<span class="emphasis"><em>keyfile</em></span> is saved on <span class="emphasis"><em>C'</em></span> as <span class="emphasis"><em>/keyfile</em></span>.</p><p>One luks keyslot of each <span class="emphasis"><em>A</em></span>, <span class="emphasis"><em>B</em></span> and <span class="emphasis"><em>C</em></span> is setup with a +passphrase. +Another luks keyslot of each <span class="emphasis"><em>A</em></span> and <span class="emphasis"><em>B</em></span> is setup with <span class="emphasis"><em>keyfile</em></span>.</p><p>To boot this configuration you could use:</p><pre class="screen">rd.luks.uuid=aaaa +rd.luks.uuid=bbbb +rd.luks.uuid=keysource:cccc +rd.luks.key=/keyfile:UUID=CCCC</pre><p>Dracut asks for the passphrase for <span class="emphasis"><em>C</em></span> and uses the +keyfile to unlock <span class="emphasis"><em>A</em></span> and <span class="emphasis"><em>B</em></span>. +If getting the passphrase for <span class="emphasis"><em>C</em></span> fails it falls back to +asking for the passphrases for <span class="emphasis"><em>A</em></span> and <span class="emphasis"><em>B</em></span>.</p><p>If you want <span class="emphasis"><em>C'</em></span> to stay unlocked, specify a luks name for +it, e.g. <code class="literal">rd.luks.name=cccc=mykeys</code>, otherwise it gets closed +when not needed anymore.</p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.luks.key.tout=0</strong></span> +</span></dt><dd> + specify how many times dracut will try to read the keys specified in in + rd.luk.key. This gives a chance to the removable device containing the key + to initialise. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_md_raid"></a>MD RAID</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.md=0</strong></span> +</span></dt><dd> + disable MD RAID detection +</dd><dt><span class="term"> +<span class="strong"><strong>rd.md.imsm=0</strong></span> +</span></dt><dd> + disable MD RAID for imsm/isw raids, use DM RAID instead +</dd><dt><span class="term"> +<span class="strong"><strong>rd.md.ddf=0</strong></span> +</span></dt><dd> + disable MD RAID for SNIA ddf raids, use DM RAID instead +</dd><dt><span class="term"> +<span class="strong"><strong>rd.md.conf=0</strong></span> +</span></dt><dd> + ignore mdadm.conf included in initramfs +</dd><dt><span class="term"> +<span class="strong"><strong>rd.md.waitclean=1</strong></span> +</span></dt><dd> + wait for any resync, recovery, or reshape activity to finish before + continuing +</dd><dt><span class="term"> +<span class="strong"><strong>rd.md.uuid=</strong></span><span class="emphasis"><em><md raid uuid></em></span> +</span></dt><dd> + only activate the raid sets with the given UUID. This parameter can be + specified multiple times. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_dm_raid"></a>DM RAID</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.dm=0</strong></span> +</span></dt><dd> + disable DM RAID detection +</dd><dt><span class="term"> +<span class="strong"><strong>rd.dm.uuid=</strong></span><span class="emphasis"><em><dm raid uuid></em></span> +</span></dt><dd> + only activate the raid sets with the given UUID. This parameter can be + specified multiple times. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_multipath"></a>MULTIPATH</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.multipath=0</strong></span> +</span></dt><dd> + disable multipath detection +</dd><dt><span class="term"> +<span class="strong"><strong>rd.multipath=default</strong></span> +</span></dt><dd> + use default multipath settings +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_fips"></a>FIPS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.fips</strong></span> +</span></dt><dd> + enable FIPS +</dd><dt><span class="term"> +<span class="strong"><strong>boot=</strong></span><span class="emphasis"><em><boot device></em></span> +</span></dt><dd><p class="simpara"> + specify the device, where /boot is located. +</p><p><strong>Example. </strong> +</p><pre class="screen">boot=/dev/sda1 +boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 +boot=UUID=<uuid> +boot=LABEL=<label></pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.fips.skipkernel</strong></span> +</span></dt><dd> + skip checksum check of the kernel image. Useful, if the kernel image is not + in a separate boot partition. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_network"></a>Network</h3></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>It is recommended to either bind an interface to a MAC with the <span class="strong"><strong>ifname</strong></span> +argument, or to use the systemd-udevd predictable network interface names.</p><p>Predictable network interface device names based on:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +firmware/bios-provided index numbers for on-board devices +</li><li class="listitem"> +firmware-provided pci-express hotplug slot index number +</li><li class="listitem"> +physical/geographical location of the hardware +</li><li class="listitem"> +the interface’s MAC address +</li></ul></div><p>See: +<a class="ulink" href="http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames" target="_top">http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames</a></p><p>Two character prefixes based on the type of interface:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +en +</span></dt><dd> +ethernet +</dd><dt><span class="term"> +wl +</span></dt><dd> +wlan +</dd><dt><span class="term"> +ww +</span></dt><dd> +wwan +</dd></dl></div><p>Type of names:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +o<index> +</span></dt><dd> +on-board device index number +</dd><dt><span class="term"> +s<slot>[f<function>][d<dev_id>] +</span></dt><dd> +hotplug slot index number +</dd><dt><span class="term"> +x<MAC> +</span></dt><dd> +MAC address +</dd><dt><span class="term"> +[P<domain>]p<bus>s<slot>[f<function>][d<dev_id>] +</span></dt><dd> +PCI geographical location +</dd><dt><span class="term"> +[P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>] +</span></dt><dd> +USB port number chain +</dd></dl></div><p>All multi-function PCI devices will carry the [f<function>] number in the +device name, including the function 0 device.</p><p>When using PCI geography, The PCI domain is only prepended when it is not 0.</p><p>For USB devices the full chain of port numbers of hubs is composed. If the +name gets longer than the maximum number of 15 characters, the name is not +exported. +The usual USB configuration == 1 and interface == 0 values are suppressed.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +PCI ethernet card with firmware index "1" +</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +eno1 +</li></ul></div></dd><dt><span class="term"> +PCI ethernet card in hotplug slot with firmware index number +</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +ens1 +</li></ul></div></dd><dt><span class="term"> +PCI ethernet multi-function card with 2 ports +</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +enp2s0f0 +</li><li class="listitem"> +enp2s0f1 +</li></ul></div></dd><dt><span class="term"> +PCI wlan card +</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +wlp3s0 +</li></ul></div></dd><dt><span class="term"> +USB built-in 3G modem +</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +wwp0s29u1u4i6 +</li></ul></div></dd><dt><span class="term"> +USB Android phone +</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +enp0s29u1u2 +</li></ul></div></dd></dl></div></div><p>The following options are supported by the <span class="emphasis"><em>network-legacy</em></span> dracut +module. Other network modules might support a slightly different set of +options; refer to the documentation of the specific network module in use. For +NetworkManager, see <span class="strong"><strong>nm-initrd-generator</strong></span>(8).</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>ip=</strong></span><span class="emphasis"><em>{dhcp|on|any|dhcp6|auto6|either6|link6|single-dhcp}</em></span> +</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +dhcp|on|any +</span></dt><dd> +get ip from dhcp server from all interfaces. If netroot=dhcp, + loop sequentially through all interfaces (eth0, eth1, …) and use the first + with a valid DHCP root-path. +</dd><dt><span class="term"> +single-dhcp +</span></dt><dd> +Send DHCP on all available interfaces in parallel, as + opposed to one after another. After the first DHCP response is received, + stop DHCP on all other interfaces. This gives the fastest boot time by + using the IP on interface for which DHCP succeeded first during early boot. + Caveat: Does not apply to Network Manager. +</dd><dt><span class="term"> +auto6 +</span></dt><dd> +IPv6 autoconfiguration +</dd><dt><span class="term"> +dhcp6 +</span></dt><dd> +IPv6 DHCP +</dd><dt><span class="term"> +either6 +</span></dt><dd> +if auto6 fails, then dhcp6 +</dd><dt><span class="term"> +link6 +</span></dt><dd> +bring up interface for IPv6 link-local addressing +</dd></dl></div></dd><dt><span class="term"> +<span class="strong"><strong>ip=</strong></span><span class="emphasis"><em><interface></em></span>:<span class="emphasis"><em>{dhcp|on|any|dhcp6|auto6|link6}</em></span>[:[<span class="emphasis"><em><mtu></em></span>][:<span class="emphasis"><em><macaddr></em></span>]] +</span></dt><dd><p class="simpara"> + This parameter can be specified multiple times. +</p><div class="informalexample"><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +dhcp|on|any|dhcp6 +</span></dt><dd> +get ip from dhcp server on a specific interface +</dd><dt><span class="term"> +auto6 +</span></dt><dd> +do IPv6 autoconfiguration +</dd><dt><span class="term"> +link6 +</span></dt><dd> +bring up interface for IPv6 link local address +</dd><dt><span class="term"> +<macaddr> +</span></dt><dd> +optionally <span class="strong"><strong>set</strong></span> <macaddr> on the <interface>. This +cannot be used in conjunction with the <span class="strong"><strong>ifname</strong></span> argument for the +same <interface>. +</dd></dl></div></div></dd><dt><span class="term"> +<span class="strong"><strong>ip=</strong></span><span class="emphasis"><em><client-IP></em></span>:[<span class="emphasis"><em><peer></em></span>]:<span class="emphasis"><em><gateway-IP></em></span>:<span class="emphasis"><em><netmask></em></span>:<span class="emphasis"><em><client_hostname></em></span>:<span class="emphasis"><em><interface></em></span>:<span class="emphasis"><em>{none|off|dhcp|on|any|dhcp6|auto6|ibft}</em></span>[:[<span class="emphasis"><em><mtu></em></span>][:<span class="emphasis"><em><macaddr></em></span>]] +</span></dt><dd><p class="simpara"> + explicit network configuration. If you want do define a IPv6 address, put it + in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple + times. <span class="emphasis"><em><peer></em></span> is optional and is the address of the remote endpoint + for pointopoint interfaces and it may be followed by a slash and a decimal + number, encoding the network prefix length. +</p><div class="informalexample"><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<macaddr> +</span></dt><dd> +optionally <span class="strong"><strong>set</strong></span> <macaddr> on the <interface>. This +cannot be used in conjunction with the <span class="strong"><strong>ifname</strong></span> argument for the +same <interface>. +</dd></dl></div></div></dd><dt><span class="term"> +<span class="strong"><strong>ip=</strong></span><span class="emphasis"><em><client-IP></em></span>:[<span class="emphasis"><em><peer></em></span>]:<span class="emphasis"><em><gateway-IP></em></span>:<span class="emphasis"><em><netmask></em></span>:<span class="emphasis"><em><client_hostname></em></span>:<span class="emphasis"><em><interface></em></span>:<span class="emphasis"><em>{none|off|dhcp|on|any|dhcp6|auto6|ibft}</em></span>[:[<span class="emphasis"><em><dns1></em></span>][:<span class="emphasis"><em><dns2></em></span>]] +</span></dt><dd> + explicit network configuration. If you want do define a IPv6 address, put it + in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple + times. <span class="emphasis"><em><peer></em></span> is optional and is the address of the remote endpoint + for pointopoint interfaces and it may be followed by a slash and a decimal + number, encoding the network prefix length. +</dd><dt><span class="term"> +<span class="strong"><strong>ifname=</strong></span><span class="emphasis"><em><interface></em></span>:<span class="emphasis"><em><MAC></em></span> +</span></dt><dd><p class="simpara"> + Assign network device name <interface> (i.e. "bootnet") to the NIC with + MAC <MAC>. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Do <span class="strong"><strong>not</strong></span> use the default kernel naming scheme for the interface name, +as it can conflict with the kernel names. So, don’t use "eth[0-9]+" for the +interface name. Better name it "bootnet" or "bluesocket".</p></div></dd><dt><span class="term"> +<span class="strong"><strong>rd.route=</strong></span><span class="emphasis"><em><net></em></span>/<span class="emphasis"><em><netmask></em></span>:<span class="emphasis"><em><gateway></em></span>[:<span class="emphasis"><em><interface></em></span>] +</span></dt><dd><p class="simpara"> + Add a static route with route options, which are separated by a colon. + IPv6 addresses have to be put in brackets. +</p><p><strong>Example. </strong> +</p><pre class="screen"> rd.route=192.168.200.0/24:192.168.100.222:ens10 + rd.route=192.168.200.0/24:192.168.100.222 + rd.route=192.168.200.0/24::ens10 + rd.route=[2001:DB8:3::/8]:[2001:DB8:2::1]:ens10</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>bootdev=</strong></span><span class="emphasis"><em><interface></em></span> +</span></dt><dd> + specify network interface to use routing and netroot information from. + Required if multiple ip= lines are used. +</dd><dt><span class="term"> +<span class="strong"><strong>BOOTIF=</strong></span><span class="emphasis"><em><MAC></em></span> +</span></dt><dd> + specify network interface to use routing and netroot information from. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.bootif=0</strong></span> +</span></dt><dd> + Disable BOOTIF parsing, which is provided by PXE +</dd><dt><span class="term"> +<span class="strong"><strong>nameserver=</strong></span><span class="emphasis"><em><IP></em></span> [<span class="strong"><strong>nameserver=</strong></span><span class="emphasis"><em><IP></em></span> …] +</span></dt><dd> + specify nameserver(s) to use +</dd><dt><span class="term"> +<span class="strong"><strong>rd.peerdns=0</strong></span> +</span></dt><dd> + Disable DNS setting of DHCP parameters. +</dd><dt><span class="term"> +<span class="strong"><strong>biosdevname=0</strong></span> +</span></dt><dd> + boolean, turn off biosdevname network interface renaming +</dd><dt><span class="term"> +<span class="strong"><strong>rd.neednet=1</strong></span> +</span></dt><dd> + boolean, bring up network even without netroot set +</dd><dt><span class="term"> +<span class="strong"><strong>vlan=</strong></span><span class="emphasis"><em><vlanname></em></span>:<span class="emphasis"><em><phydevice></em></span> +</span></dt><dd> + Setup vlan device named <vlanname> on <phydevice>. + We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), + VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005), + DEV_PLUS_VID_NO_PAD (eth0.5) +</dd><dt><span class="term"> +<span class="strong"><strong>bond=</strong></span><span class="emphasis"><em><bondname></em></span>[:<span class="emphasis"><em><bondslaves></em></span>:[:<span class="emphasis"><em><options></em></span>[:<mtu>]]] +</span></dt><dd> + Setup bonding device <bondname> on top of <bondslaves>. + <bondslaves> is a comma-separated list of physical (ethernet) interfaces. + <options> is a comma-separated list on bonding options (modinfo bonding for + details) in format compatible with initscripts. If <options> includes + multi-valued arp_ip_target option, then its values should be separated by + semicolon. if the mtu is specified, it will be set on the bond master. + Bond without parameters assumes + bond=bond0:eth0,eth1:mode=balance-rr +</dd><dt><span class="term"> +<span class="strong"><strong>team=</strong></span><span class="emphasis"><em><teammaster></em></span>:<span class="emphasis"><em><teamslaves></em></span>[:<span class="emphasis"><em><teamrunner></em></span>] +</span></dt><dd> + Setup team device <teammaster> on top of <teamslaves>. + <teamslaves> is a comma-separated list of physical (ethernet) interfaces. + <teamrunner> is the runner type to be used (see <span class="strong"><strong>teamd.conf</strong></span>(5)); defaults to + activebackup. + Team without parameters assumes + team=team0:eth0,eth1:activebackup +</dd><dt><span class="term"> +<span class="strong"><strong>bridge=</strong></span><span class="emphasis"><em><bridgename></em></span>:<span class="emphasis"><em><ethnames></em></span> +</span></dt><dd> + Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated + list of physical (ethernet) interfaces. Bridge without parameters assumes + bridge=br0:eth0 +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_nfs"></a>NFS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>[<span class="emphasis"><em><server-ip></em></span>:]<span class="emphasis"><em><root-dir></em></span>[:<span class="emphasis"><em><nfs-options></em></span>] +</span></dt><dd> + mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use + dhcp next_server. If server-ip is an IPv6 address it has to be put in + brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix + ":" or "," and are separated by ",". +</dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>nfs:[<span class="emphasis"><em><server-ip></em></span>:]<span class="emphasis"><em><root-dir></em></span>[:<span class="emphasis"><em><nfs-options></em></span>], <span class="strong"><strong>root=</strong></span>nfs4:[<span class="emphasis"><em><server-ip></em></span>:]<span class="emphasis"><em><root-dir></em></span>[:<span class="emphasis"><em><nfs-options></em></span>], <span class="strong"><strong>root=</strong></span><span class="emphasis"><em>{dhcp|dhcp6}</em></span> +</span></dt><dd><p class="simpara"> + netroot=dhcp alone directs initrd to look at the DHCP root-path where NFS + options can be specified. +</p><p><strong>Example. </strong> +</p><pre class="screen"> root-path=<server-ip>:<root-dir>[,<nfs-options>] + root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>] + root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span><span class="emphasis"><em>/dev/nfs</em></span> nfsroot=[<span class="emphasis"><em><server-ip></em></span>:]<span class="emphasis"><em><root-dir></em></span>[:<span class="emphasis"><em><nfs-options></em></span>] +</span></dt><dd> + <span class="emphasis"><em>Deprecated!</em></span> kernel Documentation_/filesystems/nfsroot.txt_ defines this + method. This is supported by dracut, but not recommended. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.nfs.domain=</strong></span><span class="emphasis"><em><NFSv4 domain name></em></span> +</span></dt><dd> + Set the NFSv4 domain name. Will override the settings in <span class="emphasis"><em>/etc/idmap.conf</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.dhcp.retry=</strong></span><span class="emphasis"><em><cnt></em></span> +</span></dt><dd> + If this option is set, dracut will try to connect via dhcp <cnt> times before failing. + Default is 1. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.dhcp=</strong></span><span class="emphasis"><em><arg></em></span> +</span></dt><dd> + If this option is set, dhclient is called with "--timeout <arg>". +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.iflink=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + Wait <seconds> until link shows up. Default is 60 seconds. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.ifup=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + Wait <seconds> until link has state "UP". Default is 20 seconds. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.route=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + Wait <seconds> until route shows up. Default is 20 seconds. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.ipv6dad=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + Wait <seconds> until IPv6 DAD is finished. Default is 50 seconds. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.ipv6auto=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.net.timeout.carrier=</strong></span><span class="emphasis"><em><seconds></em></span> +</span></dt><dd> + Wait <seconds> until carrier is recognized. Default is 10 seconds. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_cifs"></a>CIFS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>cifs://[<span class="emphasis"><em><username></em></span>[:<span class="emphasis"><em><password></em></span>]@]<span class="emphasis"><em><server-ip></em></span>:<span class="emphasis"><em><root-dir></em></span> +</span></dt><dd><p class="simpara"> + mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use + dhcp next_server. if server-ip is an IPv6 address it has to be put in + brackets, e.g. [2001:DB8::1]. If a username or password are not specified +as part of the root, then they must be passed on the command line through +cifsuser/cifspass. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Passwords specified on the kernel command line are visible for all +users via the file <span class="emphasis"><em>/proc/cmdline</em></span> and via dmesg or can be sniffed on the +network, when using DHCP with DHCP root-path.</p></div></dd><dt><span class="term"> +<span class="strong"><strong>cifsuser</strong></span>=<span class="emphasis"><em><username></em></span> +</span></dt><dd> + Set the cifs username, if not specified as part of the root. +</dd><dt><span class="term"> +<span class="strong"><strong>cifspass</strong></span>=<span class="emphasis"><em><password></em></span> +</span></dt><dd><p class="simpara"> + Set the cifs password, if not specified as part of the root. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Passwords specified on the kernel command line are visible for all +users via the file <span class="emphasis"><em>/proc/cmdline</em></span> and via dmesg or can be sniffed on the +network, when using DHCP with DHCP root-path.</p></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_iscsi"></a>iSCSI</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>iscsi:[<span class="emphasis"><em><username></em></span>:<span class="emphasis"><em><password></em></span>[:<span class="emphasis"><em><reverse></em></span>:<span class="emphasis"><em><password></em></span>]@][<span class="emphasis"><em><servername></em></span>]:[<span class="emphasis"><em><protocol></em></span>]:[<span class="emphasis"><em><port></em></span>][:[<span class="emphasis"><em><iscsi_iface_name></em></span>]:[<span class="emphasis"><em><netdev_name></em></span>]]:[<span class="emphasis"><em><LUN></em></span>]:<span class="emphasis"><em><targetname></em></span> +</span></dt><dd><p class="simpara"> + protocol defaults to "6", LUN defaults to "0". If the "servername" field is + provided by BOOTP or DHCP, then that field is used in conjunction with other + associated fields to contact the boot server in the Boot stage. However, if + the "servername" field is not provided, then the "targetname" field is then + used in the Discovery Service stage in conjunction with other associated + fields. See + <a class="ulink" href="http://tools.ietf.org/html/rfc4173#section-5" target="_top">rfc4173</a>. +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Passwords specified on the kernel command line are visible for all +users via the file <span class="emphasis"><em>/proc/cmdline</em></span> and via dmesg or can be sniffed on the +network, when using DHCP with DHCP root-path.</p></div><p><strong>Example. </strong> +</p><pre class="screen">root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0</pre><p> +</p><p class="simpara">If servername is an IPv6 address, it has to be put in brackets:</p><p><strong>Example. </strong> +</p><pre class="screen">root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span><span class="emphasis"><em>???</em></span> <span class="strong"><strong>netroot=</strong></span>iscsi:[<span class="emphasis"><em><username></em></span>:<span class="emphasis"><em><password></em></span>[:<span class="emphasis"><em><reverse></em></span>:<span class="emphasis"><em><password></em></span>]@][<span class="emphasis"><em><servername></em></span>]:[<span class="emphasis"><em><protocol></em></span>]:[<span class="emphasis"><em><port></em></span>][:[<span class="emphasis"><em><iscsi_iface_name></em></span>]:[<span class="emphasis"><em><netdev_name></em></span>]]:[<span class="emphasis"><em><LUN></em></span>]:<span class="emphasis"><em><targetname></em></span> … +</span></dt><dd><p class="simpara"> + multiple netroot options allow setting up multiple iscsi disks: +</p><p><strong>Example. </strong> +</p><pre class="screen">root=UUID=12424547 +netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 +netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1</pre><p> +</p><p class="simpara">If servername is an IPv6 address, it has to be put in brackets:</p><p><strong>Example. </strong> +</p><pre class="screen">netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0</pre><p> +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Passwords specified on the kernel command line are visible for all +users via the file <span class="emphasis"><em>/proc/cmdline</em></span> and via dmesg or can be sniffed on the +network, when using DHCP with DHCP root-path. +You may want to use rd.iscsi.firmware.</p></div></dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span><span class="emphasis"><em>???</em></span> <span class="strong"><strong>rd.iscsi.initiator=</strong></span><span class="emphasis"><em><initiator></em></span> <span class="strong"><strong>rd.iscsi.target.name=</strong></span><span class="emphasis"><em><target name></em></span> <span class="strong"><strong>rd.iscsi.target.ip=</strong></span><span class="emphasis"><em><target ip></em></span> <span class="strong"><strong>rd.iscsi.target.port=</strong></span><span class="emphasis"><em><target port></em></span> <span class="strong"><strong>rd.iscsi.target.group=</strong></span><span class="emphasis"><em><target group></em></span> <span class="strong"><strong>rd.iscsi.username=</strong></span><span class="emphasis"><em><username></em></span> <span class="strong"><strong>rd.iscsi.password=</strong></span><span class="emphasis"><em><password></em></span> <span class="strong"><strong>rd.iscsi.in.username=</strong></span><span class="emphasis"><em><in username></em></span> <span class="strong"><strong>rd.iscsi.in.password=</strong></span><span class="emphasis"><em><in password></em></span> +</span></dt><dd><p class="simpara"> + manually specify all iscsistart parameter (see <span class="strong"><strong><code class="literal">iscsistart --help</code></strong></span>) +</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Passwords specified on the kernel command line are visible for all +users via the file <span class="emphasis"><em>/proc/cmdline</em></span> and via dmesg or can be sniffed on the +network, when using DHCP with DHCP root-path. +You may want to use rd.iscsi.firmware.</p></div></dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span><span class="emphasis"><em>???</em></span> <span class="strong"><strong>netroot=</strong></span>iscsi <span class="strong"><strong>rd.iscsi.firmware=1</strong></span> +</span></dt><dd> + will read the iscsi parameter from the BIOS firmware +</dd><dt><span class="term"> +<span class="strong"><strong>rd.iscsi.login_retry_max=</strong></span><span class="emphasis"><em><num></em></span> +</span></dt><dd> + maximum number of login retries +</dd><dt><span class="term"> +<span class="strong"><strong>rd.iscsi.param=</strong></span><span class="emphasis"><em><param></em></span> +</span></dt><dd><p class="simpara"> + <param> will be passed as "--param <param>" to iscsistart. + This parameter can be specified multiple times. +</p><p><strong>Example. </strong> +</p><pre class="screen">"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"</pre><p> +</p><p class="simpara">will result in</p><pre class="screen">iscsistart -b --param node.session.timeo.replacement_timeout=30</pre></dd></dl></div><p><span class="strong"><strong>rd.iscsi.ibft</strong></span> <span class="strong"><strong>rd.iscsi.ibft=1</strong></span>: + Turn on iBFT autoconfiguration for the interfaces</p><p><span class="strong"><strong>rd.iscsi.mp</strong></span> <span class="strong"><strong>rd.iscsi.mp=1</strong></span>: + Configure all iBFT interfaces, not only used for booting (multipath)</p><p><span class="strong"><strong>rd.iscsi.waitnet=0</strong></span>: + Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.</p><p><span class="strong"><strong>rd.iscsi.testroute=0</strong></span>: + Turn off checking, if the route to the iSCSI target IP is possible before trying to login.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_fcoe"></a>FCoE</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.fcoe=0</strong></span> +</span></dt><dd> + disable FCoE and lldpad +</dd><dt><span class="term"> +<span class="strong"><strong>fcoe=</strong></span><span class="emphasis"><em><edd|interface|MAC></em></span>:<span class="emphasis"><em>{dcb|nodcb}</em></span>:<span class="emphasis"><em>{fabric|vn2vn}</em></span> +</span></dt><dd><p class="simpara"> + Try to connect to a FCoE SAN through the NIC specified by <span class="emphasis"><em><interface></em></span> or + <span class="emphasis"><em><MAC></em></span> or EDD settings. The second argument specifies if DCB + should be used. The optional third argument specifies whether + fabric or VN2VN mode should be used. + This parameter can be specified multiple times. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>letters in the MAC-address must be lowercase!</p></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_nvmf"></a>NVMf</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.nonvmf</strong></span> +</span></dt><dd> + Disable NVMf +</dd><dt><span class="term"> +<span class="strong"><strong>rd.nvmf.nonbft</strong></span> +</span></dt><dd> + Disable connecting to targets from the NVMe Boot Firmware Table. Without + this parameter, NBFT connections will take precedence over <span class="emphasis"><em>rd.nvmf.discover</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.nvmf.nostatic</strong></span> +</span></dt><dd> + Disable connecting to targets that have been statically configured when + the initramfs was built. Targets specified with rd.nvmf.discover on the + kernel command line will still be tried. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.nvmf.hostnqn=</strong></span><span class="emphasis"><em><hostNQN></em></span> +</span></dt><dd> + NVMe host NQN to use +</dd><dt><span class="term"> +<span class="strong"><strong>rd.nvmf.hostid=</strong></span><span class="emphasis"><em><hostID></em></span> +</span></dt><dd> + NVMe host id to use +</dd><dt><span class="term"> +<span class="strong"><strong>rd.nvmf.discover=</strong></span><span class="emphasis"><em>{rdma|fc|tcp}</em></span>,<span class="emphasis"><em><traddr></em></span>,[<span class="emphasis"><em><host_traddr></em></span>],[<span class="emphasis"><em><trsvcid></em></span>] +</span></dt><dd><p class="simpara"> + Discover and connect to a NVMe-over-Fabric controller specified by + <span class="emphasis"><em><traddr></em></span> and the optionally <span class="emphasis"><em><host_traddr></em></span> or <span class="emphasis"><em><trsvcid></em></span>. + The first argument specifies the transport to use; currently only + <span class="emphasis"><em>rdma</em></span>, <span class="emphasis"><em>fc</em></span>, or <span class="emphasis"><em>tcp</em></span> are supported. + This parameter can be specified multiple times. +</p><p><strong>Examples. </strong> +</p><pre class="screen">rd.nvmf.discover=tcp,192.168.10.10,,4420 +rd.nvmf.discover=fc,nn-0x201700a05634f5bf:pn-0x201900a05634f5bf,nn-0x200000109b579ef3:pn-0x100000109b579ef3</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.nvmf.discover=fc,auto</strong></span> +</span></dt><dd> + This special syntax determines that Fibre Channel autodiscovery + is to be used rather than regular NVMe discovery. It takes precedence + over all other <span class="emphasis"><em>rd.nvmf.discover=</em></span> arguments. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_nbd"></a>NBD</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>??? <span class="strong"><strong>netroot=</strong></span>nbd:<span class="emphasis"><em><server></em></span>:<span class="emphasis"><em><port/exportname></em></span>[:<span class="emphasis"><em><fstype></em></span>[:<span class="emphasis"><em><mountopts></em></span>[:<span class="emphasis"><em><nbdopts></em></span>]]] +</span></dt><dd><p class="simpara"> + mount nbd share from <server>. +</p><p class="simpara">NOTE: + If "exportname" instead of "port" is given the standard port is used. + Newer versions of nbd are only supported with "exportname".</p></dd><dt><span class="term"> +<span class="strong"><strong>root=/dev/root netroot=dhcp</strong></span> with <span class="strong"><strong>dhcp</strong></span> <span class="strong"><strong>root-path=</strong></span>nbd:<span class="emphasis"><em><server></em></span>:<span class="emphasis"><em><port/exportname></em></span>[:<span class="emphasis"><em><fstype></em></span>[:<span class="emphasis"><em><mountopts></em></span>[:<span class="emphasis"><em><nbdopts></em></span>]]] +</span></dt><dd><p class="simpara"> + netroot=dhcp alone directs initrd to look at the DHCP root-path where NBD + options can be specified. This syntax is only usable in cases where you are + directly mounting the volume as the rootfs. +</p><p class="simpara">NOTE: + If "exportname" instead of "port" is given the standard port is used. + Newer versions of nbd are only supported with "exportname".</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_virtiofs"></a>VIRTIOFS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>virtiofs:<span class="emphasis"><em><mount-tag></em></span> +</span></dt><dd> + mount virtiofs share using the tag <mount-tag>. + The tag name is arbitrary and must match the tag given in the qemu <span class="emphasis"><em>-device</em></span> command. +</dd><dt><span class="term"> +<span class="strong"><strong>rootfstype=</strong></span>virtiofs <span class="strong"><strong>root=</strong></span><span class="emphasis"><em><mount-tag></em></span> +</span></dt><dd> + mount virtiofs share using the tag <mount-tag>. + The tag name is arbitrary and must match the tag given in the qemu <span class="emphasis"><em>-device</em></span> command. +</dd></dl></div><p>Both formats are supported by the <span class="emphasis"><em>virtiofs</em></span> dracut module. +See <a class="ulink" href="https://gitlab.com/virtio-fs/virtiofsd" target="_top">https://gitlab.com/virtio-fs/virtiofsd</a> for more information.</p><p><strong>Example. </strong> +</p><pre class="screen">root=virtiofs:host rw</pre><p> +</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_dasd"></a>DASD</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.dasd=</strong></span>…. +</span></dt><dd><p class="simpara"> + same syntax as the kernel module parameter (s390 only). + For more details on the syntax see the IBM book + "Linux on IBM Z and IBM LinuxONE - Device Drivers, Features, and Commands" + <a class="ulink" href="https://www.ibm.com/docs/en/linux-on-systems?topic=overview-device-drivers-features-commands" target="_top">https://www.ibm.com/docs/en/linux-on-systems?topic=overview-device-drivers-features-commands</a>. + This parameter can be specified multiple times. +</p><p class="simpara">NOTE: + This parameter is no longer handled by dracut itself but with the exact + same syntax by + <a class="ulink" href="https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev" target="_top">https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev</a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_zfcp"></a>ZFCP</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.zfcp=</strong></span><span class="emphasis"><em><zfcp adaptor device bus ID></em></span>,<span class="emphasis"><em><WWPN></em></span>,<span class="emphasis"><em><FCPLUN></em></span> +</span></dt><dd><p class="simpara"> + rd.zfcp can be specified multiple times on the kernel command + line. +</p><p class="simpara">NOTE: + This parameter is no longer handled by dracut itself but with the exact + same syntax by + <a class="ulink" href="https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev" target="_top">https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev</a>.</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.zfcp=</strong></span><span class="emphasis"><em><zfcp adaptor device bus ID></em></span> +</span></dt><dd><p class="simpara"> + If NPIV is enabled and the <span class="emphasis"><em>allow_lun_scan</em></span> parameter to the zfcp + module is set to <span class="emphasis"><em>Y</em></span> then the zfcp driver will be initiating a + scan internally and the <WWPN> and <FCPLUN> parameters can be omitted. +</p><p class="simpara">NOTE: + This parameter is no longer handled by dracut itself but with the exact + same syntax by + <a class="ulink" href="https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev" target="_top">https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev</a>.</p><p><strong>Example. </strong> +</p><pre class="screen">rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000 +rd.zfcp=0.0.4000</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.zfcp.conf=0</strong></span> +</span></dt><dd> + ignore zfcp.conf included in the initramfs +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_znet"></a>ZNET</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.znet=</strong></span><span class="emphasis"><em><nettype></em></span>,<span class="emphasis"><em><subchannels></em></span>,<span class="emphasis"><em><options></em></span> +</span></dt><dd> + Activates a channel-attached network interface on s390 architecture. + <nettype> is one of: qeth, lcs, ctc. + <subchannels> is a comma-separated list of ccw device bus-IDs. + The list consists of 3 entries with nettype qeth, and 2 for other nettype. + <options> is a comma-separated list of <name>=<value> pairs, + where <name> refers to a device sysfs attribute to which <value> gets written. + rd.znet can be specified multiple times on the kernel command line. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.znet_ifname=</strong></span><span class="emphasis"><em><ifname></em></span>:<span class="emphasis"><em><subchannels></em></span> +</span></dt><dd><p class="simpara"> + Assign network device name <interface> (i.e. "bootnet") to the NIC + corresponds to the subchannels. This is useful when dracut’s default + "ifname=" doesn’t work due to device having a changing MAC address. +</p><p><strong>Example. </strong> +</p><pre class="screen">rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo +rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar</pre><p> +</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_booting_live_images"></a>Booting live images</h3></div></div></div><p>Dracut offers multiple options for live booted images:</p><div class="informalexample"><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +SquashFS (read-only) base filesystem image +</span></dt><dd><p class="simpara"> +Note — There are 3 separate overlay types available: +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +Device-mapper snapshots (the original offering), +</li><li class="listitem"> +Device-mapper thin provisioning snapshots (see <span class="strong"><strong><span class="emphasis"><em>rd.live.overlay.thin</em></span></strong></span>, +a later offering), and +</li><li class="listitem"> +OverlayFS based overlay mounts (a more recent offering). +</li></ul></div><p class="simpara">Using one of these technologies, the system will provide a writable overlay for +the base, read-only SquashFS root filesystem. These methods enable a relatively +fast boot and lower RAM usage.</p><p class="simpara">With the original Device-mapper snapshot overlay, users <span class="strong"><strong>must be careful</strong></span> to +avoid writing too many blocks to the snapshot device. Once the blocks of the +snapshot overlay are exhausted, the whole root filesystem becomes read-only +leading to application failures. The snapshot overlay device is marked +<span class="emphasis"><em>Overflow</em></span>, and a difficult recovery is required to repair and enlarge the +overlay offline.</p><p class="simpara">When <span class="strong"><strong><span class="emphasis"><em>rd.live.overlay=</em></span></strong></span> is not specified for persistent overlay storage, or +the specified file is not found or writable, a Device-mapper snapshot based +non-persistent or temporary overlay is automatically created as a sparse file +in RAM of the initramfs. This file will only consume content space as required +blocks are allocated. This snapshot based overlay defaults to an apparent size +of 32 GiB in RAM, and can be adjusted with the <span class="strong"><strong><span class="emphasis"><em>rd.live.overlay.size=</em></span></strong></span> kernel +command line option. This file is hidden (and appears deleted) when the boot +process switches out of the initramfs to the main root filesystem but its loop +device remains connected to the Device-mapper snapshot.</p><p class="simpara">Even with large Device-mapper overlay files for write space, the available root +filesystem capacity is limited by the total allocated size of the base root +filesystem, which often provide only a small number of gigabytes of free space.</p><p class="simpara">This shortage could be remedied by building the root filesystem with more +allocated free space, or the OverlayFS based overlay mount method can be used.</p><p class="simpara">When the <span class="strong"><strong><span class="emphasis"><em>rd.live.overlay.overlayfs</em></span></strong></span> option is specified or when +<span class="strong"><strong><span class="emphasis"><em>rd.live.overlay=</em></span></strong></span> points to an appropriate directory with a sister at +<code class="literal">/../ovlwork</code>, then an OverlayFS based overlay mount is employed. Such a +persistent OverlayFS overlay can extend the available root filesystem storage +up to the capacity of the LiveOS disk device.</p><p class="simpara">For non-persistent OverlayFS overlays, the <code class="literal">/run/overlayfs</code> directory in the +<code class="literal">/run</code> tmpfs is used for temporary storage. This filesystem is typically sized +to one half of the RAM total in the system. +The command: <code class="literal">mount -o remount,size=<nbytes> /run</code> will resize this virtual +filesystem after booting.</p><p class="simpara">The internal SquashFS structure is traditionally expected to be:</p><pre class="screen">squashfs.img | SquashFS from LiveCD .iso + !(mount) + /LiveOS + |- rootfs.img | Usually a ext4 filesystem image to mount read-only + !(mount) + /bin | Base Live root filesystem + /boot | + /dev | + ... |</pre><p class="simpara">For OverlayFS mount overlays, the internal SquashFS structure may be a direct +compression of the root filesystem:</p><pre class="screen">squashfs.img | SquashFS from LiveCD .iso + !(mount) + /bin | Base Live root filesystem + /boot | + /dev | + ... |</pre><p class="simpara">Dracut uses one of the overlay methods of live booting by default. No +additional command line options are required other than +<span class="strong"><strong>root=</strong></span>live:<span class="emphasis"><em><path to blockdevice></em></span> or <span class="strong"><strong>root=</strong></span>live:<span class="emphasis"><em><URL></em></span> to specify +the location of your squashed root filesystem.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +The compressed SquashFS image can be copied during boot to RAM at +<code class="literal">/run/initramfs/squashed.img</code> by using the <span class="strong"><strong>rd.live.ram=1</strong></span> option. +</li><li class="listitem"> +A device with a persistent overlay can be booted read-only by using the +<span class="strong"><strong>rd.live.overlay.readonly</strong></span> option on the kernel command line. This will +either cause a temporary, writable overlay to be stacked over a read-only +snapshot of the root filesystem or the OverlayFS mount will use an additional +lower layer with the root filesystem. +</li></ul></div></dd><dt><span class="term"> +Uncompressed live filesystem image +</span></dt><dd><p class="simpara"> +When the live system was installed with the <span class="emphasis"><em>--skipcompress</em></span> option of the +<span class="emphasis"><em>livecd-iso-to-disk</em></span> installation script for Live USB devices, the root +filesystem image, <span class="emphasis"><em>rootfs.img</em></span>, is expanded on installation and no SquashFS +is involved during boot. +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +If <span class="strong"><strong>rd.live.ram=1</strong></span> is used in this situation, the full, uncompressed +root filesystem is copied during boot to <code class="literal">/run/initramfs/rootfs.img</code> in the +<code class="literal">/run</code> tmpfs. +</li><li class="listitem"> +If <span class="strong"><strong>rd.live.overlay=none</strong></span> is provided as a kernel command line option, +a writable, linear Device-mapper target is created on boot with no overlay. +</li></ul></div></dd><dt><span class="term"> +Writable filesystem image +</span></dt><dd><p class="simpara"> +The system will retrieve a compressed filesystem image, extract it to +<code class="literal">/run/initramfs/fsimg/rootfs.img</code>, connect it to a loop device, create a +writable, linear Device-mapper target at <code class="literal">/dev/mapper/live-rw</code>, and mount that +as a writable volume at <code class="literal">/</code>. More RAM is required during boot but the live +filesystem is easier to manage if it becomes full. Users can make a filesystem +image of any size and that size will be maintained when the system boots. There +is no persistence of root filesystem changes between boots with this option. +</p><p class="simpara">The filesystem structure is expected to be:</p><pre class="screen">rootfs.tgz | Compressed tarball containing filesystem image + !(unpack) + /rootfs.img | Filesystem image at /run/initramfs/fsimg/ + !(mount) + /bin | Live filesystem + /boot | + /dev | + ... |</pre><p class="simpara">To use this boot option, ensure that <span class="strong"><strong>rd.writable.fsimg=1</strong></span> is in your kernel +command line and add the <span class="strong"><strong>root=live:<URL></strong></span> to specify the location +of your compressed filesystem image tarball or SquashFS image.</p></dd></dl></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.writable.fsimg=</strong></span>1 +</span></dt><dd><p class="simpara"> +Enables writable filesystem support. The system will boot with a fully +writable (but non-persistent) filesystem without snapshots <span class="emphasis"><em>(see notes above +about available live boot options)</em></span>. You can use the <span class="strong"><strong>rootflags</strong></span> option to +set mount options for the live filesystem as well <span class="emphasis"><em>(see documentation about +rootflags in the <span class="strong"><strong>Standard</strong></span> section above)</em></span>. +This implies that the whole image is copied to RAM before the boot continues. +</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>There must be enough free RAM available to hold the complete image.</p></div><p class="simpara">This method is very suitable for diskless boots.</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.minmem=</strong></span><span class="emphasis"><em><megabyte></em></span> +</span></dt><dd><p class="simpara"> +Specify minimum free RAM in MB after copying a live disk image into memory. +The default is 1024. +</p><p class="simpara">This parameter only applies together with the parameters rd.writable.fsimg +or rd.live.ram.</p></dd><dt><span class="term"> +<span class="strong"><strong>root=</strong></span>live:<span class="emphasis"><em><url></em></span> +</span></dt><dd><p class="simpara"> +Boots a live image retrieved from <span class="emphasis"><em><url></em></span>. Requires the dracut <span class="emphasis"><em>livenet</em></span> +module. Valid handlers: <span class="emphasis"><em>http, https, ftp, torrent, tftp</em></span>. +</p><p><strong>Examples. </strong> +</p><pre class="screen">root=live:http://example.com/liveboot.img +root=live:ftp://ftp.example.com/liveboot.img +root=live:torrent://example.com/liveboot.img.torrent</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.live.debug=</strong></span>1 +</span></dt><dd> +Enables debug output from the live boot process. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.dir=</strong></span><span class="emphasis"><em><path></em></span> +</span></dt><dd> +Specifies the directory within the boot device where the squashfs.img or +rootfs.img can be found. By default, this is <code class="literal">/LiveOS</code>. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.squashimg=</strong></span><span class="emphasis"><em><filename of SquashFS image></em></span> +</span></dt><dd> +Specifies the filename for a SquashFS image of the root filesystem. +By default, this is <span class="emphasis"><em>squashfs.img</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.ram=</strong></span>1 +</span></dt><dd> +Copy the complete image to RAM and use this for booting. This is useful +when the image resides on, e.g., a DVD which needs to be ejected later on. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay={</strong></span><span class="emphasis"><em><devspec></em></span>[:<span class="emphasis"><em>{<pathspec>|auto}</em></span>]|<span class="emphasis"><em>none</em></span>} +</span></dt><dd><p class="simpara"> +Manage the usage of a persistent overlay. +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +<span class="strong"><strong><span class="emphasis"><em><devspec></em></span></strong></span> specifies the path to a device with a mountable filesystem. +</li><li class="listitem"><p class="simpara"> +<span class="strong"><strong><span class="emphasis"><em><pathspec></em></span></strong></span> is a path within the <span class="strong"><strong><span class="emphasis"><em><devspec></em></span></strong></span> filesystem to either +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"> +a file (that is loop mounted for a Device-mapper overlay) or +</li><li class="listitem"> +a directory (that is symbolically linked to <code class="literal">/run/overlayfs</code> for a OverlayFS +mount overlay). (A required sister directory <code class="literal">/<pathspec>/../ovlwork</code> is +automatically made.) +</li></ul></div></li><li class="listitem"> +<span class="strong"><strong><span class="emphasis"><em>none</em></span></strong></span> (the word itself) specifies that no overlay will be used, such as +when an uncompressed, writable live root filesystem is available. +</li></ul></div><p class="simpara">The above method shall be used to persist the changes made to the root +filesystem specified within the +<span class="strong"><strong>root=</strong></span>live:<span class="emphasis"><em><path to blockdevice></em></span> or <span class="strong"><strong>root=</strong></span>live:<span class="emphasis"><em><url></em></span> device.</p><p class="simpara">The default <span class="strong"><strong><span class="emphasis"><em>pathspec</em></span></strong></span>, when <span class="strong"><strong>:auto</strong></span> or +no <span class="strong"><strong>:<span class="emphasis"><em><pathspec></em></span></strong></span> is given, is <code class="literal">/<rd.live.dir>/overlay-<label>-<uuid></code>, +where <span class="emphasis"><em><label></em></span> and <span class="emphasis"><em><uuid></em></span> are the LABEL and UUID of the filesystem specified +by the <span class="strong"><strong>root=</strong></span>live:<span class="emphasis"><em><path|url></em></span> device.</p><p class="simpara">If a persistent overlay <span class="emphasis"><em>is detected</em></span> at the standard LiveOS path, +and <span class="strong"><strong><span class="emphasis"><em>rd.live.overlay.overlayfs</em></span></strong></span> is not set to 1, the overlay type (either +Device-mapper or OverlayFS) will be detected and it will be used.</p><p><strong>Examples. </strong> +</p><pre class="screen">rd.live.overlay=/dev/sdb1:/persistent-overlay.img +rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay.cowfs=</strong></span><span class="emphasis"><em>[btrfs|ext4|xfs]</em></span> +</span></dt><dd> +Specifies the filesystem to use when formatting the overlay partition. +The default is ext4. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay.size=</strong></span><span class="emphasis"><em><size_MiB></em></span> +</span></dt><dd> +Specifies a non-persistent Device-mapper overlay size in MiB. The default is +<span class="emphasis"><em>32768</em></span>. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay.readonly=</strong></span>1 +</span></dt><dd><p class="simpara"> +This is used to boot in a read-only mode with a normally read-write persistent +overlay. With this option, +</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> +Device-mapper overlays will have an additional, non-persistent, writable +snapshot overlay stacked over a read-only snapshot (<code class="literal">/dev/mapper/live‑ro</code>) +of the base root filesystem and the persistent overlay, or +</li><li class="listitem"> +for writable <code class="literal">rootfs.img</code> images, the above over a read-only loop device, or +</li><li class="listitem"> +an OverlayFS mount will link the persistent overlay directory at +<code class="literal">/run/overlayfs‑r</code> as an additional read-only lower layer stacked over the base +root filesystem, and <code class="literal">/run/overlayfs</code> becomes the temporary, writable, upper +directory overlay, to complete the bootable root filesystem. +</li></ul></div></dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay.reset=</strong></span>1 +</span></dt><dd> +Specifies that a persistent overlay should be reset on boot. All previous root +filesystem changes are vacated by this action. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay.thin=</strong></span>1 +</span></dt><dd> +Enables the usage of thin snapshots instead of classic dm snapshots. +The advantage of thin snapshots is that they support discards, and will free +blocks that are not claimed by the filesystem. In this use case, this means +that memory is given back to the kernel when the filesystem does not claim it +anymore. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.live.overlay.overlayfs=</strong></span>1 +</span></dt><dd><p class="simpara"> +Enables the use of the <span class="strong"><strong>OverlayFS</strong></span> kernel module, if available, to provide a +copy-on-write union directory for the root filesystem. OverlayFS overlays are +directories of the files that have changed on the read-only base (lower) +filesystem. The root filesystem is provided through a special overlay type +mount that merges at least two directories, designated the lower and the upper. +If an OverlayFS upper directory is not present on the boot device, a tmpfs +directory will be created at <code class="literal">/run/overlayfs</code> to provide temporary storage. +Persistent storage can be provided on vfat or msdos formatted devices by +supplying the OverlayFS upper directory within an embedded filesystem that +supports the creation of trusted.* extended attributes and provides a valid +d_type in readdir responses, such as with btrfs, ext4, f2fs, & xfs. On +non-vfat-formatted devices, a persistent OverlayFS overlay can extend the +available root filesystem storage up to the capacity of the LiveOS disk device. +</p><p class="simpara">The <span class="strong"><strong>rd.live.overlay.readonly</strong></span> option, which allows a persistent overlayfs to +be mounted read-only through a higher level transient overlay directory, has +been implemented through the multiple lower layers feature of OverlayFS.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_zipl"></a>ZIPL</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.zipl=</strong></span><span class="emphasis"><em><path to blockdevice></em></span> +</span></dt><dd><p class="simpara"> + Update the dracut commandline with the values found in the + <span class="emphasis"><em>dracut-cmdline.conf</em></span> file on the given device. + The values are merged into the existing commandline values + and the udev events are regenerated. +</p><p><strong>Example. </strong> +</p><pre class="screen">rd.zipl=UUID=0fb28157-99e3-4395-adef-da3f7d44835a</pre><p> +</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_cio_ignore"></a>CIO_IGNORE</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>rd.cio_accept=</strong></span><span class="emphasis"><em><device-ids></em></span> +</span></dt><dd><p class="simpara"> + Remove the devices listed in <device-ids> from the default + cio_ignore kernel command-line settings. + <device-ids> is a list of comma-separated CCW device ids. + The default for this value is taken from the + <span class="emphasis"><em>/boot/zipl/active_devices.txt</em></span> file. +</p><p><strong>Example. </strong> +</p><pre class="screen">rd.cio_accept=0.0.0180,0.0.0800,0.0.0801,0.0.0802</pre><p> +</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_plymouth_boot_splash"></a>Plymouth Boot Splash</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>plymouth.enable=0</strong></span> +</span></dt><dd> + disable the plymouth bootsplash completely. +</dd><dt><span class="term"> +<span class="strong"><strong>rd.plymouth=0</strong></span> +</span></dt><dd> + disable the plymouth bootsplash only for the initramfs. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_kernel_keys"></a>Kernel keys</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>masterkey=</strong></span><span class="emphasis"><em><kernel master key path name></em></span> +</span></dt><dd><p class="simpara"> + Set the path name of the kernel master key. +</p><p><strong>Example. </strong> +</p><pre class="screen">masterkey=/etc/keys/kmk-trusted.blob</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>masterkeytype=</strong></span><span class="emphasis"><em><kernel master key type></em></span> +</span></dt><dd><p class="simpara"> + Set the type of the kernel master key. +</p><p><strong>Example. </strong> +</p><pre class="screen">masterkeytype=trusted</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>evmkey=</strong></span><span class="emphasis"><em><EVM HMAC key path name></em></span> +</span></dt><dd><p class="simpara"> + Set the path name of the EVM HMAC key. +</p><p><strong>Example. </strong> +</p><pre class="screen">evmkey=/etc/keys/evm-trusted.blob</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>evmx509=</strong></span><span class="emphasis"><em><EVM X.509 cert path name></em></span> +</span></dt><dd><p class="simpara"> + Set the path name of the EVM X.509 certificate. +</p><p><strong>Example. </strong> +</p><pre class="screen">evmx509=/etc/keys/x509_evm.der</pre><p> +</p></dd><dt><span class="term"> +<span class="strong"><strong>ecryptfskey=</strong></span><span class="emphasis"><em><eCryptfs key path name></em></span> +</span></dt><dd><p class="simpara"> + Set the path name of the eCryptfs key. +</p><p><strong>Example. </strong> +</p><pre class="screen">ecryptfskey=/etc/keys/ecryptfs-trusted.blob</pre><p> +</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_deprecated_renamed_options"></a>Deprecated, renamed Options</h3></div></div></div><p>Here is a list of options and their new replacement.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +rdbreak +</span></dt><dd> +rd.break +</dd><dt><span class="term"> +rd.ccw +</span></dt><dd> +rd.znet +</dd><dt><span class="term"> +rd_CCW +</span></dt><dd> +rd.znet +</dd><dt><span class="term"> +rd_DASD_MOD +</span></dt><dd> +rd.dasd +</dd><dt><span class="term"> +rd_DASD +</span></dt><dd> +rd.dasd +</dd><dt><span class="term"> +rdinitdebug rdnetdebug +</span></dt><dd> +rd.debug +</dd><dt><span class="term"> +rd_NO_DM +</span></dt><dd> +rd.dm=0 +</dd><dt><span class="term"> +rd_DM_UUID +</span></dt><dd> +rd.dm.uuid +</dd><dt><span class="term"> +rdblacklist +</span></dt><dd> +rd.driver.blacklist +</dd><dt><span class="term"> +rdinsmodpost +</span></dt><dd> +rd.driver.post +</dd><dt><span class="term"> +rdloaddriver +</span></dt><dd> +rd.driver.pre +</dd><dt><span class="term"> +rd_NO_FSTAB +</span></dt><dd> +rd.fstab=0 +</dd><dt><span class="term"> +rdinfo +</span></dt><dd> +rd.info +</dd><dt><span class="term"> +check +</span></dt><dd> +rd.live.check +</dd><dt><span class="term"> +rdlivedebug +</span></dt><dd> +rd.live.debug +</dd><dt><span class="term"> +live_dir +</span></dt><dd> +rd.live.dir +</dd><dt><span class="term"> +liveimg +</span></dt><dd> +rd.live.image +</dd><dt><span class="term"> +overlay +</span></dt><dd> +rd.live.overlay +</dd><dt><span class="term"> +readonly_overlay +</span></dt><dd> +rd.live.overlay.readonly +</dd><dt><span class="term"> +reset_overlay +</span></dt><dd> +rd.live.overlay.reset +</dd><dt><span class="term"> +live_ram +</span></dt><dd> +rd.live.ram +</dd><dt><span class="term"> +rd_NO_CRYPTTAB +</span></dt><dd> +rd.luks.crypttab=0 +</dd><dt><span class="term"> +rd_LUKS_KEYDEV_UUID +</span></dt><dd> +rd.luks.keydev.uuid +</dd><dt><span class="term"> +rd_LUKS_KEYPATH +</span></dt><dd> +rd.luks.keypath +</dd><dt><span class="term"> +rd_NO_LUKS +</span></dt><dd> +rd.luks=0 +</dd><dt><span class="term"> +rd_LUKS_UUID +</span></dt><dd> +rd.luks.uuid +</dd><dt><span class="term"> +rd_NO_LVMCONF +</span></dt><dd> +rd.lvm.conf +</dd><dt><span class="term"> +rd_LVM_LV +</span></dt><dd> +rd.lvm.lv +</dd><dt><span class="term"> +rd_NO_LVM +</span></dt><dd> +rd.lvm=0 +</dd><dt><span class="term"> +rd_LVM_VG +</span></dt><dd> +rd.lvm.vg +</dd><dt><span class="term"> +rd_NO_MDADMCONF +</span></dt><dd> +rd.md.conf=0 +</dd><dt><span class="term"> +rd_NO_MDIMSM +</span></dt><dd> +rd.md.imsm=0 +</dd><dt><span class="term"> +rd_NO_MD +</span></dt><dd> +rd.md=0 +</dd><dt><span class="term"> +rd_MD_UUID +</span></dt><dd> +rd.md.uuid +</dd></dl></div><p>rd_NO_MULTIPATH: rd.multipath=0</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +rd_NFS_DOMAIN +</span></dt><dd> +rd.nfs.domain +</dd><dt><span class="term"> +iscsi_initiator +</span></dt><dd> +rd.iscsi.initiator +</dd><dt><span class="term"> +iscsi_target_name +</span></dt><dd> +rd.iscsi.target.name +</dd><dt><span class="term"> +iscsi_target_ip +</span></dt><dd> +rd.iscsi.target.ip +</dd><dt><span class="term"> +iscsi_target_port +</span></dt><dd> +rd.iscsi.target.port +</dd><dt><span class="term"> +iscsi_target_group +</span></dt><dd> +rd.iscsi.target.group +</dd><dt><span class="term"> +iscsi_username +</span></dt><dd> +rd.iscsi.username +</dd><dt><span class="term"> +iscsi_password +</span></dt><dd> +rd.iscsi.password +</dd><dt><span class="term"> +iscsi_in_username +</span></dt><dd> +rd.iscsi.in.username +</dd><dt><span class="term"> +iscsi_in_password +</span></dt><dd> +rd.iscsi.in.password +</dd><dt><span class="term"> +iscsi_firmware +</span></dt><dd> +rd.iscsi.firmware=0 +</dd><dt><span class="term"> +rd_NO_PLYMOUTH +</span></dt><dd> +rd.plymouth=0 +</dd><dt><span class="term"> +rd_retry +</span></dt><dd> +rd.retry +</dd><dt><span class="term"> +rdshell +</span></dt><dd> +rd.shell +</dd><dt><span class="term"> +rd_NO_SPLASH +</span></dt><dd> +rd.splash +</dd><dt><span class="term"> +rdudevdebug +</span></dt><dd> +rd.udev.udev_log=debug +</dd><dt><span class="term"> +rdudevinfo +</span></dt><dd> +rd.udev.udev_log=info +</dd><dt><span class="term"> +rd.udev.debug +</span></dt><dd> +rd.udev.udev_log=debug +</dd><dt><span class="term"> +rd.udev.info +</span></dt><dd> +rd.udev.udev_log=info +</dd><dt><span class="term"> +rd_NO_ZFCPCONF +</span></dt><dd> +rd.zfcp.conf=0 +</dd><dt><span class="term"> +rd_ZFCP +</span></dt><dd> +rd.zfcp +</dd><dt><span class="term"> +rd_ZNET +</span></dt><dd> +rd.znet +</dd><dt><span class="term"> +KEYMAP +</span></dt><dd> +vconsole.keymap +</dd><dt><span class="term"> +KEYTABLE +</span></dt><dd> +vconsole.keymap +</dd><dt><span class="term"> +SYSFONT +</span></dt><dd> +vconsole.font +</dd><dt><span class="term"> +CONTRANS +</span></dt><dd> +vconsole.font.map +</dd><dt><span class="term"> +UNIMAP +</span></dt><dd> +vconsole.font.unimap +</dd><dt><span class="term"> +UNICODE +</span></dt><dd> +vconsole.unicode +</dd><dt><span class="term"> +EXT_KEYMAP +</span></dt><dd> +vconsole.keymap.ext +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_configuration_in_the_initramfs_2"></a>Configuration in the Initramfs</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="emphasis"><em>/etc/conf.d/</em></span> +</span></dt><dd> + Any files found in <span class="emphasis"><em>/etc/conf.d/</em></span> will be sourced in the initramfs to + set initial values. Command line options will override these values + set in the configuration files. +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/cmdline</em></span> +</span></dt><dd> + Can contain additional command line options. Deprecated, better use + /etc/cmdline.d/*.conf. +</dd><dt><span class="term"> +<span class="emphasis"><em>/etc/cmdline.d/*.conf</em></span> +</span></dt><dd> + Can contain additional command line options. +</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_author_2"></a>AUTHOR</h2></div></div></div><p>Harald Hoyer</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also_3"></a>SEE ALSO</h2></div></div></div><p><span class="strong"><strong>dracut</strong></span>(8) <span class="strong"><strong>dracut.conf</strong></span>(5)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="lsinitrd1"></a>Chapter 9. LSINITRD(1)</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name_4">NAME</a></span></dt><dt><span class="section"><a href="#_synopsis_3">SYNOPSIS</a></span></dt><dt><span class="section"><a href="#_description_4">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_options_2">OPTIONS</a></span></dt><dt><span class="section"><a href="#_availability_2">AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_authors_2">AUTHORS</a></span></dt><dt><span class="section"><a href="#_see_also_4">SEE ALSO</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name_4"></a>NAME</h2></div></div></div><p>lsinitrd - tool to show the contents of an initramfs image</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_synopsis_3"></a>SYNOPSIS</h2></div></div></div><p><span class="strong"><strong>lsinitrd</strong></span> [<span class="emphasis"><em>OPTION…</em></span>] [<image> [<filename> [<filename> […] ]]]</p><p><span class="strong"><strong>lsinitrd</strong></span> [<span class="emphasis"><em>OPTION…</em></span>] -k <kernel version></p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description_4"></a>DESCRIPTION</h2></div></div></div><p>lsinitrd shows the contents of an initramfs image. if <image> is omitted, then +lsinitrd determines the default location based on the local configuration +or Linux distribution policy.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_options_2"></a>OPTIONS</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +<span class="strong"><strong>-h, --help</strong></span> +</span></dt><dd> + print a help message and exit. +</dd><dt><span class="term"> +<span class="strong"><strong>-s, --size</strong></span> +</span></dt><dd> + sort the contents of the initramfs by size. +</dd><dt><span class="term"> +<span class="strong"><strong>-f, --file</strong></span> <span class="emphasis"><em><filename></em></span> +</span></dt><dd> + print the contents of <filename>. +</dd><dt><span class="term"> +<span class="strong"><strong>-k, --kver</strong></span> <span class="emphasis"><em><kernel version></em></span> +</span></dt><dd> + inspect the initramfs of <kernel version>. +</dd><dt><span class="term"> +<span class="strong"><strong>-m, --mod</strong></span> +</span></dt><dd> + list dracut modules included of the initramfs image. +</dd><dt><span class="term"> +<span class="strong"><strong>--unpack</strong></span> +</span></dt><dd> + unpack the initramfs to the current directory, instead of displaying the contents. + If optional filenames are given, will only unpack specified files, else the whole image will be unpacked. + Won’t unpack anything from early cpio part. +</dd><dt><span class="term"> +<span class="strong"><strong>--unpackearly</strong></span> +</span></dt><dd> + unpack the early microcode initramfs to the current directory, instead of displaying the contents. + Same as --unpack, but only unpack files from early cpio part. +</dd><dt><span class="term"> +<span class="strong"><strong>-v, --verbose</strong></span> +</span></dt><dd> + unpack verbosely +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_availability_2"></a>AVAILABILITY</h2></div></div></div><p>The lsinitrd command is part of the dracut package and is available from +<a class="ulink" href="https://github.com/dracut-ng/dracut-ng" target="_top">https://github.com/dracut-ng/dracut-ng</a></p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_authors_2"></a>AUTHORS</h2></div></div></div><p>Harald Hoyer</p><p>Amerigo Wang</p><p>Nikoli</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also_4"></a>SEE ALSO</h2></div></div></div><p><span class="strong"><strong>dracut</strong></span>(8)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="_developer_manual"></a>Chapter 10. Developer Manual</h2></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="dracutmodules7"></a>Chapter 11. DRACUT.MODULES(7)</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name_5">NAME</a></span></dt><dt><span class="section"><a href="#_description_5">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#stages">Boot Process Stages</a></span></dt><dd><dl><dt><span class="section"><a href="#_hook_cmdline">Hook: cmdline</a></span></dt><dt><span class="section"><a href="#_hook_pre_udev">Hook: pre-udev</a></span></dt><dt><span class="section"><a href="#_start_udev">Start Udev</a></span></dt><dt><span class="section"><a href="#_hook_pre_trigger">Hook: pre-trigger</a></span></dt><dt><span class="section"><a href="#_trigger_udev">Trigger Udev</a></span></dt><dt><span class="section"><a href="#_main_loop">Main Loop</a></span></dt><dt><span class="section"><a href="#_hook_pre_mount">Hook: pre-mount</a></span></dt><dt><span class="section"><a href="#_hook_mount">Hook: mount</a></span></dt><dt><span class="section"><a href="#_hook_pre_pivot">Hook: pre-pivot</a></span></dt><dt><span class="section"><a href="#_hook_cleanup">Hook: cleanup</a></span></dt><dt><span class="section"><a href="#_cleanup_and_switch_root">Cleanup and switch_root</a></span></dt></dl></dd><dt><span class="section"><a href="#_network_infrastructure">Network Infrastructure</a></span></dt><dt><span class="section"><a href="#_writing_a_module">Writing a Module</a></span></dt><dd><dl><dt><span class="section"><a href="#_module_setup_sh_check">module-setup.sh: check()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_depends">module-setup.sh: depends()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_cmdline">module-setup.sh: cmdline()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_install">module-setup.sh: install()</a></span></dt><dt><span class="section"><a href="#_module_setup_sh_installkernel">module-setup.sh: installkernel()</a></span></dt><dt><span class="section"><a href="#_anchor_id_creation_xreflabel_creation_creation_functions">Creation Functions</a></span></dt><dt><span class="section"><a href="#_initramfs_functions">Initramfs Functions</a></span></dt><dt><span class="section"><a href="#_network_modules">Network Modules</a></span></dt></dl></dd><dt><span class="section"><a href="#_author_3">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_5">SEE ALSO</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name_5"></a>NAME</h2></div></div></div><p>dracut.modules - dracut modules</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description_5"></a>DESCRIPTION</h2></div></div></div><p>dracut uses a modular system to build and extend the initramfs image. All +modules are located in <span class="emphasis"><em>/usr/lib/dracut/modules.d</em></span> or in <span class="emphasis"><em><git-src>/modules.d</em></span>. +The most basic dracut module is <span class="emphasis"><em>99base</em></span>. In <span class="emphasis"><em>99base</em></span> the initial shell script +init is defined, which gets run by the kernel after initramfs loading. Although +you can replace init with your own version of <span class="emphasis"><em>99base</em></span>, this is not encouraged. +Instead you should use, if possible, the hooks of dracut. All hooks, and the +point of time in which they are executed, are described in <a class="xref" href="#stages" title="Boot Process Stages">the section called “Boot Process Stages”</a>.</p><p>The main script, which creates the initramfs is dracut itself. It parses all +arguments and sets up the directory, in which everything is installed. It then +executes all check, install, installkernel scripts found in the modules, which +are to be processed. After everything is installed, the install directory is +archived and compressed to the final initramfs image. All helper functions used +by check, install and installkernel are found in in the file <span class="emphasis"><em>dracut-functions</em></span>. +These shell functions are available to all module installer (install, +installkernel) scripts, without the need to source <span class="emphasis"><em>dracut-functions</em></span>.</p><p>A module can check the preconditions for install and installkernel with the +check script. Also dependencies can be expressed with check. If a module passed +check, install and installkernel will be called to install all of the necessary +files for the module. To split between kernel and non-kernel parts of the +installation, all kernel module related parts have to be in installkernel. All +other files found in a module directory are module specific and mostly are hook +scripts and udev rules.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stages"></a>Boot Process Stages</h2></div></div></div><p>dracut modules can insert custom script at various points, to control the boot +process. +These hooks are plain directories containing shell scripts ending with ".sh", +which are sourced by init. +Common used functions are in <span class="emphasis"><em>dracut-lib.sh</em></span>, which can be sourced by any script.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_cmdline"></a>Hook: cmdline</h3></div></div></div><p>The <span class="emphasis"><em>cmdline</em></span> hook is a place to insert scripts to parse the kernel command line +and prepare the later actions, like setting up udev rules and configuration +files.</p><p>In this hook the most important environment variable is defined: root. The +second one is rootok, which indicates, that a module claimed to be able to parse +the root defined. So for example, <span class="strong"><strong>root=</strong></span><span class="emphasis"><em>iscsi:….</em></span> will be claimed by the +iscsi dracut module, which then sets rootok.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_pre_udev"></a>Hook: pre-udev</h3></div></div></div><p>This hook is executed right after the cmdline hook and a check if root and +rootok were set. Here modules can take action with the final root, and before +udev has been run.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_start_udev"></a>Start Udev</h3></div></div></div><p>Now udev is started and the logging for udev is setup.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_pre_trigger"></a>Hook: pre-trigger</h3></div></div></div><p>In this hook, you can set udev environment variables with <span class="strong"><strong>udevadm control +--property=KEY=<span class="emphasis"><em>value</em></span></strong></span> or control the further execution of udev with +udevadm.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_trigger_udev"></a>Trigger Udev</h3></div></div></div><p>udev is triggered by calling udevadm trigger, which sends add events for all +devices and subsystems.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_main_loop"></a>Main Loop</h3></div></div></div><p>In the main loop of dracut loops until udev has settled and +all scripts in <span class="emphasis"><em>initqueue/finished</em></span> returned true. +In this loop there are three hooks, where scripts can be inserted +by calling /sbin/initqueue.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_initqueue"></a>Initqueue</h4></div></div></div><p>This hook gets executed every time a script is inserted here, regardless of the +udev state.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_initqueue_settled"></a>Initqueue settled</h4></div></div></div><p>This hook (initqueue/settled) gets executed every time udev has settled.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_initqueue_timeout"></a>Initqueue timeout</h4></div></div></div><p>This hook (initqueue/timeout) gets executed, when the main loop counter becomes +half of the rd.retry counter.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_initqueue_online"></a>Initqueue online</h4></div></div></div><p>This hook (initqueue/online) gets executed whenever a network interface comes online +(that is, once it is up and configured by the configured network module).</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_initqueue_finished"></a>Initqueue finished</h4></div></div></div><p>This hook (initqueue/finished) is called after udev has settled and +if all scripts herein return 0 the main loop will be ended. +Arbitrary scripts can be added here, to loop in the +initqueue until something happens, which a dracut module wants to wait for.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_pre_mount"></a>Hook: pre-mount</h3></div></div></div><p>Before the root device is mounted all scripts in the hook pre-mount are +executed. In some cases (e.g. NFS) the real root device is already mounted, +though.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_mount"></a>Hook: mount</h3></div></div></div><p>This hook is mainly to mount the real root device.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_pre_pivot"></a>Hook: pre-pivot</h3></div></div></div><p>This hook is called before cleanup hook, This is a good place for +actions other than cleanups which need to be called before pivot.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_hook_cleanup"></a>Hook: cleanup</h3></div></div></div><p>This hook is the last hook and is called before init finally switches root to +the real root device. This is a good place to clean up and kill processes not +needed anymore.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_cleanup_and_switch_root"></a>Cleanup and switch_root</h3></div></div></div><p>Init (or systemd) kills all udev processes, cleans up the environment, +sets up the arguments for the real init process and finally calls switch_root. +switch_root removes the whole filesystem hierarchy of the initramfs, +chroot()s to the real root device and calls /sbin/init with the specified +arguments.</p><p>To ensure all files in the initramfs hierarchy can be removed, all processes +still running from the initramfs should not have any open file descriptors left.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_network_infrastructure"></a>Network Infrastructure</h2></div></div></div><p>FIXME</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_writing_a_module"></a>Writing a Module</h2></div></div></div><p>A simple example module is <span class="emphasis"><em>90kernel-modules</em></span>, which modprobes a kernel module +after udev has settled and the basic device drivers have been loaded.</p><p>All module installation information is in the file module-setup.sh.</p><p>First we create a check() function, which just exits with 0 indicating that this +module should be included by default.</p><p>check():</p><pre class="screen">return 0</pre><p>Then we create the install() function, which installs a cmdline hook with +priority number 20 called <span class="emphasis"><em>parse-insmodpost.sh</em></span>. It also installs the +<span class="emphasis"><em>insmodpost.sh</em></span> script in <span class="emphasis"><em>/sbin</em></span>.</p><p>install():</p><pre class="screen">inst_hook cmdline 20 "$moddir/parse-insmodpost.sh" +inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh</pre><p>The <span class="emphasis"><em>parse-instmodpost.sh</em></span> parses the kernel command line for a argument +rd.driver.post, blacklists the module from being autoloaded and installs the +hook <span class="emphasis"><em>insmodpost.sh</em></span> in the <span class="emphasis"><em>initqueue/settled</em></span>.</p><p><span class="emphasis"><em>parse-insmodpost.sh</em></span>:</p><pre class="screen">for p in $(getargs rd.driver.post=); do + echo "blacklist $p" >> /run/modprobe.d/initramfsblacklist.conf + _do_insmodpost=1 +done + +[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh +unset _do_insmodpost</pre><p><span class="emphasis"><em>insmodpost.sh</em></span>, which is called in the <span class="emphasis"><em>initqueue/settled</em></span> hook will just +modprobe the kernel modules specified in all rd.driver.post kernel command line +parameters. It runs after udev has settled and is only called once (--onetime).</p><p><span class="emphasis"><em>insmodpost.sh</em></span>:</p><pre class="screen">. /lib/dracut-lib.sh + +for p in $(getargs rd.driver.post=); do + modprobe $p +done</pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_module_setup_sh_check"></a>module-setup.sh: check()</h3></div></div></div><p><span class="emphasis"><em>check()</em></span> is called by dracut to evaluate the inclusion of a dracut module in +the initramfs.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +$hostonly +</span></dt><dd> +If the $hostonly variable is set, then the module check() function +should be in "hostonly" mode, which means, that the check() should only return +0, if the module is really needed to boot this specific host. +</dd></dl></div><p>check() should return with:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"> +0 +</span></dt><dd> +Include the dracut module in the initramfs. +</dd><dt><span class="term"> +1 +</span></dt><dd> +Do not include the dracut module. The requirements are not fulfilled +(missing tools, etc.) +</dd><dt><span class="term"> +255 +</span></dt><dd> +Only include the dracut module, if another module requires it or if +explicitly specified in the config file or on the argument list. +</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_module_setup_sh_depends"></a>module-setup.sh: depends()</h3></div></div></div><p>The function depends() should echo all other dracut module names the module +depends on.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_module_setup_sh_cmdline"></a>module-setup.sh: cmdline()</h3></div></div></div><p>This function should print the kernel command line options needed to boot the +current machine setup. It should start with a space and should not print a +newline.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_module_setup_sh_install"></a>module-setup.sh: install()</h3></div></div></div><p>The install() function is called to install everything non-kernel related. +To install binaries, scripts, and other files, you can use the functions +mentioned in <a class="xref" href="#creation">[creation]</a>.</p><p>To address a file in the current module directory, use the variable "$moddir".</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_module_setup_sh_installkernel"></a>module-setup.sh: installkernel()</h3></div></div></div><p>In installkernel() all kernel related files should be installed. You can use all +of the functions mentioned in <a class="xref" href="#creation">[creation]</a> to install files.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_anchor_id_creation_xreflabel_creation_creation_functions"></a><a id="creation"></a>Creation Functions</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_inst_multiple_o_lt_file_gt_lt_file_gt_8230"></a>inst_multiple [-o] <file> [ <file> …]</h4></div></div></div><p>installs multiple binaries and files. If executables are specified without a +path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the +binary. If the option "-o" is given as the first parameter, a missing file does +not lead to an error.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_inst_lt_src_gt_lt_dst_gt"></a>inst <src> [<dst>]</h4></div></div></div><p>installs <span class="emphasis"><em>one</em></span> file <src> either to the same place in the initramfs or to an +optional <dst>. inst with more than two arguments is treated the same as +inst_multiple, all arguments are treated as files to install and none as +install destinations.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_inst_hook_lt_hookdir_gt_lt_prio_gt_lt_src_gt"></a>inst_hook <hookdir> <prio> <src></h4></div></div></div><p>installs an executable/script <src> in the dracut hook <hookdir> with priority +<prio>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_inst_rules_lt_udevrule_gt_lt_udevrule_gt_8230"></a>inst_rules <udevrule> [ <udevrule> …]</h4></div></div></div><p>installs one or more udev rules. Non-existent udev rules are reported, but do +not let dracut fail.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_instmods_lt_kernelmodule_gt_lt_kernelmodule_gt_8230"></a>instmods <kernelmodule> [ <kernelmodule> … ]</h4></div></div></div><p>instmods should be used only in the installkernel() function.</p><p>instmods installs one or more kernel modules in the initramfs. <kernelmodule> +can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".</p><p>instmods will not install the kernel module, if $hostonly is set and the kernel +module is not currently needed by any /sys/<span class="strong"><strong>…</strong></span>/uevent MODALIAS. +To install a kernel module regardless of the hostonly mode use the form:</p><pre class="screen">hostonly='' instmods <kernelmodule></pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_initramfs_functions"></a>Initramfs Functions</h3></div></div></div><p>FIXME</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_network_modules"></a>Network Modules</h3></div></div></div><p>FIXME</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_author_3"></a>AUTHOR</h2></div></div></div><p>Harald Hoyer</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also_5"></a>SEE ALSO</h2></div></div></div><p><span class="strong"><strong>dracut</strong></span>(8)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="dracutbootup7"></a>Chapter 12. DRACUT.BOOTUP(7)</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name_6">NAME</a></span></dt><dt><span class="section"><a href="#_description_6">DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_author_4">AUTHOR</a></span></dt><dt><span class="section"><a href="#_see_also_6">SEE ALSO</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name_6"></a>NAME</h2></div></div></div><p>dracut.bootup - boot ordering in the initramfs</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description_6"></a>DESCRIPTION</h2></div></div></div><p>This flow chart illustrates the ordering of the services, if systemd is used in +the dracut initramfs.</p><pre class="screen"> systemd-journal.socket + | + v + dracut-cmdline.service + | + v + dracut-pre-udev.service + | + v + systemd-udevd.service + | + v +local-fs-pre.target dracut-pre-trigger.service + | | + v v + (various mounts) (various swap systemd-udev-trigger.service + | devices...) | (various low-level (various low-level + | | | services: seed, API VFS mounts: + v v v tmpfiles, random mqueue, configfs, + local-fs.target swap.target dracut-initqueue.service sysctl, ...) debugfs, ...) + | | | | | + \_______________|____________________ | ___________________|____________________/ + \|/ + v + sysinit.target + | + _________________/|\___________________ + / | \ + | | | + v | v + (various | rescue.service + sockets...) | | + | | v + v | rescue.target + sockets.target | + | | + \_________________ | emergency.service + \| | + v v + basic.target emergency.target + | + ______________________/| + / | + | v + | initrd-root-device.target + | | + | v + | dracut-pre-mount.service + | | + | v + | sysroot.mount + | | + | v + | initrd-root-fs.target + (custom initrd services) | + | v + | dracut-mount.service + | | + | v + | initrd-parse-etc.service + | | + | v + | (sysroot-usr.mount and + | various mounts marked + | with fstab option + | x-initrd.mount) + | | + | v + | initrd-fs.target + \______________________ | + \| + v + initrd.target + | + v + dracut-pre-pivot.service + | + v + initrd-cleanup.service + isolates to + initrd-switch-root.target + | + v + ______________________/| + / | + | initrd-udevadm-cleanup-db.service + | | + (custom initrd services) | + | | + \______________________ | + \| + v + initrd-switch-root.target + | + v + initrd-switch-root.service + | + v + switch-root</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_author_4"></a>AUTHOR</h2></div></div></div><p>Harald Hoyer</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also_6"></a>SEE ALSO</h2></div></div></div><p><span class="strong"><strong>dracut</strong></span>(8) <span class="strong"><strong>bootup</strong></span>(7)</p></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="_license"></a>Appendix A. License</h2></div></div></div><p>This work is licensed under the Creative Commons Attribution/Share-Alike +License. To view a copy of this license, visit +<a class="ulink" href="http://creativecommons.org/licenses/by-sa/3.0/" target="_top">http://creativecommons.org/licenses/by-sa/3.0/</a> or send a letter to Creative +Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.</p></div></div></div></body></html>
\ No newline at end of file @@ -305,6 +305,7 @@ long_version() { push_host_devs() { local _dev for _dev in "$@"; do + [[ -z $_dev ]] && continue [[ " ${host_devs[*]} " == *" $_dev "* ]] && return host_devs+=("$_dev") done @@ -890,8 +891,6 @@ export LC_ALL=C export LANG=C unset LC_MESSAGES unset LC_CTYPE -unset LD_LIBRARY_PATH -unset LD_PRELOAD unset GREP_OPTIONS export DRACUT_LOG_LEVEL=warning @@ -1139,6 +1138,9 @@ if ! [[ $outfile ]]; then mkdir -p "$dracutsysrootdir$efidir/Linux" outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi" else + if ! [[ $initrdname ]]; then + initrdname="initramfs-${kernel}.img" + fi if [[ -d "$dracutsysrootdir"/efi/loader/entries || -L "$dracutsysrootdir"/efi/loader/entries ]] \ && [[ $MACHINE_ID ]] \ && [[ -d "$dracutsysrootdir"/efi/${MACHINE_ID} || -L "$dracutsysrootdir"/efi/${MACHINE_ID} ]]; then @@ -1153,8 +1155,8 @@ if ! [[ $outfile ]]; then outfile="$dracutsysrootdir/boot/efi/${MACHINE_ID}/${kernel}/initrd" elif [[ -f "$dracutsysrootdir"/lib/modules/${kernel}/initrd ]]; then outfile="$dracutsysrootdir/lib/modules/${kernel}/initrd" - elif [[ -e $dracutsysrootdir/boot/vmlinuz-${kernel} ]]; then - outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img" + elif [[ -e $dracutsysrootdir/boot/vmlinuz-${kernel} || -e $dracutsysrootdir/boot/vmlinux-${kernel} ]]; then + outfile="$dracutsysrootdir/boot/$initrdname" elif [[ -z $dracutsysrootdir ]] \ && [[ $MACHINE_ID ]] \ && mountpoint -q /efi; then @@ -1164,7 +1166,7 @@ if ! [[ $outfile ]]; then && mountpoint -q /boot/efi; then outfile="/boot/efi/${MACHINE_ID}/${kernel}/initrd" else - outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img" + outfile="$dracutsysrootdir/boot/$initrdname" fi fi fi @@ -1526,6 +1528,9 @@ if [[ ! $print_cmdline ]]; then aarch64) EFI_MACHINE_TYPE_NAME=aa64 ;; + riscv64) + EFI_MACHINE_TYPE_NAME=riscv64 + ;; *) dfatal "Architecture '${DRACUT_ARCH:-$(uname -m)}' not supported to create a UEFI executable" exit 1 @@ -1663,14 +1668,18 @@ if [[ $hostonly ]] && [[ $hostonly_default_device != "no" ]]; then "/usr/lib64" \ "/boot" \ "/boot/efi" \ - "/boot/zipl"; do + "/boot/zipl" \ + "/efi"; do mp=$(readlink -f "$dracutsysrootdir$mp") mountpoint "$mp" > /dev/null 2>&1 || continue _dev=$(find_block_device "$mp") - _bdev=$(readlink -f "/dev/block/$_dev") - [[ -b $_bdev ]] && _dev=$_bdev - [[ $mp == "/" ]] && root_devs+=("$_dev") - push_host_devs "$_dev" + # shellcheck disable=SC2181 + if [[ $? -eq 0 ]]; then + _bdev=$(readlink -f "/dev/block/$_dev") + [[ -b $_bdev ]] && _dev=$_bdev + [[ $mp == "/" ]] && root_devs+=("$_dev") + push_host_devs "$_dev" + fi if [[ $(find_mp_fstype "$mp") == btrfs ]]; then for i in $(btrfs_devs "$mp"); do [[ $mp == "/" ]] && root_devs+=("$i") @@ -1882,7 +1891,11 @@ mkdir -p "${initdir}"/lib/dracut if [[ $kernel_only != yes ]]; then mkdir -p "${initdir}/etc/cmdline.d" - mkdir -m 0755 "${initdir}"/lib/dracut/hooks + mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks + + # symlink to old hooks location for compatibility + ln_r /var/lib/dracut/hooks /lib/dracut/hooks + for _d in $hookdirs; do # shellcheck disable=SC2174 mkdir -m 0755 -p "${initdir}/lib/dracut/hooks/$_d" @@ -2036,7 +2049,7 @@ if [[ $kernel_only != yes ]]; then if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then dinfo "*** Resolving executable dependencies ***" # shellcheck disable=SC2086 - find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \ + find "$initdir" -type f -perm /0111 -not -path '*.ko*' -print0 \ | xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} -- # shellcheck disable=SC2181 if (($? == 0)); then @@ -2145,6 +2158,7 @@ if [[ $early_microcode == yes ]]; then _src=$(get_ucode_file) [[ $_src ]] || break [[ -r $_fwdir/$_fw/$_src ]] || _src="${_src}.early" + [[ -r $_fwdir/$_fw/$_src ]] || _src="${_src}.initramfs" [[ -r $_fwdir/$_fw/$_src ]] || break fi @@ -2154,6 +2168,8 @@ if [[ $early_microcode == yes ]]; then done for i in $_fwdir/$_fw/$_src; do [[ -e $i ]] || continue + # skip README{.xz,.zst,...} + str_starts "$i" "$_fwdir/$_fw/README" && continue # skip gpg files str_ends "$i" ".asc" && continue cat "$i" >> "$_dest_dir/${ucode_dest[$idx]}" @@ -2252,7 +2268,7 @@ if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then [[ -n $enhanced_cpio ]] && ddebug "strip is enabled alongside cpio reflink" dinfo "*** Stripping files ***" find "$initdir" -type f \ - -executable -not -path '*/lib/modules/*.ko' -print0 \ + -executable -not -path '*/lib/modules/*.ko*' -print0 \ | xargs -r -0 $strip_cmd "${strip_args[@]}" 2> /dev/null # strip kernel modules, but do not touch signed modules @@ -2336,9 +2352,9 @@ if [[ $create_early_cpio == yes ]]; then if ! ( umask 077 cd "$early_cpio_dir/d" - find . -print0 | sort -z \ - | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null \ - ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img" + find . -print0 | sed -e 's,\./,,g' | sort -z \ + | cpio -o ${CPIO_REPRODUCIBLE:+--reproducible} --null \ + ${cpio_owner:+-R "$cpio_owner"} -H newc --quiet > "${DRACUT_TMPDIR}/initramfs.img" ); then dfatal "Creation of $outfile failed" exit 1 @@ -2442,8 +2458,8 @@ else if ! ( umask 077 cd "$initdir" - find . -print0 | sort -z \ - | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet \ + find . -print0 | sed -e 's,\./,,g' | sort -z \ + | cpio -o ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc --quiet \ | $compress >> "${DRACUT_TMPDIR}/initramfs.img" ); then dfatal "Creation of $outfile failed" @@ -2559,6 +2575,7 @@ if [[ $uefi == yes ]]; then objcopy --remove-section .sbat "$tmp_uefi_stub" &> /dev/null if objcopy \ + ${DRACUT_REPRODUCIBLE:+--enable-deterministic-archives --preserve-dates} \ ${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=$(printf 0x%x "$uefi_osrelease_offs")} \ ${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=$(printf 0x%x "$uefi_cmdline_offs")} \ ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=$(printf 0x%x "$uefi_splash_offs")} \ diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install index 441414a..14f8772 100755 --- a/install.d/50-dracut.install +++ b/install.d/50-dracut.install @@ -1,13 +1,13 @@ #!/bin/bash -COMMAND="$1" -KERNEL_VERSION="$2" +COMMAND="${1:?}" +KERNEL_VERSION="${2:?}" +#shellcheck disable=SC2034 BOOT_DIR_ABS="$3" KERNEL_IMAGE="$4" -# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory. -# So, let's skip to create initrd. -if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then +# If the initrd was provided on the kernel command line, we shouldn't generate our own. +if [[ "$COMMAND" != "add" || "$#" -gt 4 ]]; then exit 0 fi @@ -16,102 +16,64 @@ if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then exit 0 fi -# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess. -if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then - BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA" - if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then - # No uki generator preference set or we have been chosen - IMAGE="uki.efi" - UEFI_OPTS="--uefi" - elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then - # We aren't the uki generator, but we have been requested to make the initrd - IMAGE="initrd" - UEFI_OPTS="--no-uefi" - else - exit 0 - fi -elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then - BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA" - if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then - IMAGE="initrd" - UEFI_OPTS="--no-uefi" - else - exit 0 - fi +if [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" = "dracut" ]]; then + # We are the initrd generator + IMAGE="initrd" + UEFI_OPTS="--no-uefi" else - # No layout information, use users --uefi/--no-uefi preference - UEFI_OPTS="" - if [[ -d $BOOT_DIR_ABS ]]; then - IMAGE="initrd" - else - BOOT_DIR_ABS="/boot" - IMAGE="initramfs-${KERNEL_VERSION}.img" - fi + exit 0 fi -ret=0 - -case "$COMMAND" in - add) - if [[ $IMAGE == "uki.efi" ]]; then - IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/uki.efi - else - IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd - fi - if [[ -f ${IMAGE_PREGENERATED} ]]; then - # we found an initrd or uki.efi at the same place as the kernel - # use this and don't generate a new one - [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \ - "There is an ${IMAGE} image at the same place as the kernel, skipping generating a new one" - cp --reflink=auto "$IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$IMAGE" \ - && chown root:root "$BOOT_DIR_ABS/$IMAGE" \ - && chmod 0600 "$BOOT_DIR_ABS/$IMAGE" \ - && exit 0 - fi - - if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then - if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then - read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline" - fi - elif [[ -f /etc/kernel/cmdline ]]; then - read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline - elif [[ -f /usr/lib/kernel/cmdline ]]; then - read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline - else - declare -a BOOT_OPTIONS +if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then + # We are chosen to generate the UKI as well as initrd + IMAGE="uki.efi" + UEFI_OPTS="--uefi" +fi - read -r -d '' -a line < /proc/cmdline - for i in "${line[@]}"; do - [[ ${i#initrd=*} != "$i" ]] && continue - BOOT_OPTIONS+=("$i") - done - fi +if [[ -f ${KERNEL_IMAGE%/*}/$IMAGE ]]; then + # we found an initrd or uki.efi at the same place as the kernel + # use this and don't generate a new one + [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \ + "There is an $IMAGE image at the same place as the kernel, skipping generating a new one" + cp --reflink=auto "${KERNEL_IMAGE%/*}/$IMAGE" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \ + && chown root:root "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \ + && chmod 0600 "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \ + && exit 0 +fi - unset noimageifnotneeded +if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then + if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then + read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline" + fi +elif [[ -f /etc/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline +elif [[ -f /usr/lib/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline +else + declare -a BOOT_OPTIONS - for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do - # shellcheck disable=SC1001 - if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then - noimageifnotneeded="yes" - break - fi - done + read -r -d '' -a line < /proc/cmdline + for i in "${line[@]}"; do + [[ ${i#initrd=*} != "$i" ]] && continue + BOOT_OPTIONS+=("$i") + done +fi - # shellcheck disable=SC2046 - dracut -f \ - ${noimageifnotneeded:+--noimageifnotneeded} \ - $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \ - $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \ - "$UEFI_OPTS" \ - --kver "$KERNEL_VERSION" \ - "$BOOT_DIR_ABS/$IMAGE" - ret=$? - ;; +unset noimageifnotneeded - remove) - rm -f -- "$BOOT_DIR_ABS/$IMAGE" - ret=$? - ;; -esac +for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do + # shellcheck disable=SC1001 + if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then + noimageifnotneeded="yes" + break + fi +done -exit $ret +# shellcheck disable=SC2046 +dracut -f \ + ${noimageifnotneeded:+--noimageifnotneeded} \ + $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \ + $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \ + "$UEFI_OPTS" \ + --kver "$KERNEL_VERSION" \ + "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" || exit 1 diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install index aa0ccdc..25f7555 100755 --- a/install.d/51-dracut-rescue.install +++ b/install.d/51-dracut-rescue.install @@ -2,11 +2,29 @@ export LANG=C -COMMAND="$1" -KERNEL_VERSION="$2" +COMMAND="${1:?}" +KERNEL_VERSION="${2:?}" BOOT_DIR_ABS="${3%/*}/0-rescue" KERNEL_IMAGE="$4" +# If the initrd was provided on the kernel command line, we shouldn't generate our own. +if [[ "$COMMAND" = "add" && "$#" -gt 4 ]]; then + exit 0 +fi + +# Do not attempt to create initramfs if the supplied image is already a UKI +if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then + exit 0 +fi + +if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then + # Rescue images currently not compatible with UKIs + exit 0 +elif [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]]; then + # We are not the initrd generator + exit 0 +fi + dropindirs_sort() { suffix=$1 shift diff --git a/lsinitrd.sh b/lsinitrd.sh index ada6cf5..1329ab7 100755 --- a/lsinitrd.sh +++ b/lsinitrd.sh @@ -173,6 +173,10 @@ dracutlibdirs() { } extract_files() { + SQUASH_IMG="squash-root.img" + SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" + SQUASH_EXTRACT="$TMPDIR/squash-extract" + ((${#filenames[@]} == 1)) && nofileinfo=1 for f in "${!filenames[@]}"; do [[ $nofileinfo ]] || echo "initramfs:/$f" @@ -181,6 +185,16 @@ extract_files() { [[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g') $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null ((ret += $?)) + if [[ -z ${f/#squashfs-root*/} ]]; then + if [[ ! -s $SQUASH_TMPFILE ]]; then + $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ + $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null + fi + unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null 2>&1 + ((ret += $?)) + cat "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null + rm "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null + fi [[ $nofileinfo ]] || echo "========================================================================" [[ $nofileinfo ]] || echo done @@ -214,22 +228,58 @@ list_squash_content() { if [[ -s $SQUASH_TMPFILE ]]; then echo "Squashed content ($SQUASH_IMG):" echo "========================================================================" - unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4 + unsquashfs -d "squashfs-root" -ll "$SQUASH_TMPFILE" | tail -n +4 echo "========================================================================" fi } +list_cmdline() { + # depends on list_squash_content() having run before + SQUASH_IMG="squash-root.img" + SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" + SQUASH_EXTRACT="$TMPDIR/squash-extract" + + echo "dracut cmdline:" + # shellcheck disable=SC2046 + $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \ + etc/cmdline.d/\*.conf 2> /dev/null + ((ret += $?)) + if [[ -s $SQUASH_TMPFILE ]]; then + unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" etc/cmdline.d/\*.conf > /dev/null 2>&1 + ((ret += $?)) + cat "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null + rm "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null + fi +} + unpack_files() { + SQUASH_IMG="squash-root.img" + SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" + if ((${#filenames[@]} > 0)); then for f in "${!filenames[@]}"; do # shellcheck disable=SC2001 [[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g') $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose "$f" ((ret += $?)) + if [[ -z ${f/#squashfs-root*/} ]]; then + if [[ ! -s $SQUASH_TMPFILE ]]; then + $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ + $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null + fi + unsquashfs -force -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null + ((ret += $?)) + fi done else $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose ((ret += $?)) + $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ + $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null + if [[ -s $SQUASH_TMPFILE ]]; then + unsquashfs -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" > /dev/null + ((ret += $?)) + fi fi } @@ -391,6 +441,8 @@ else list_modules list_files list_squash_content + echo + list_cmdline fi fi diff --git a/man/dracut-catimages.8.asc b/man/dracut-catimages.8.asc index 621f8af..8ddc365 100644 --- a/man/dracut-catimages.8.asc +++ b/man/dracut-catimages.8.asc @@ -51,7 +51,7 @@ Harald Hoyer AVAILABILITY ------------ The dracut-catimages command is part of the dracut package and is available from -link:$$https://github.com/dracutdevs/dracut$$[https://github.com/dracutdevs/dracut] +link:$$https://github.com/dracut-ng/dracut-ng$$[https://github.com/dracut-ng/dracut-ng] SEE ALSO -------- diff --git a/man/dracut.8.asc b/man/dracut.8.asc index ae4497e..25f601b 100644 --- a/man/dracut.8.asc +++ b/man/dracut.8.asc @@ -18,13 +18,8 @@ DESCRIPTION Create an initramfs <image> for the kernel with the version <kernel version>. If <kernel version> is omitted, then the version of the actual running -kernel is used. If <image> is omitted or empty, depending on bootloader -specification, the default location can be -_/efi/<machine-id>/<kernel-version>/initrd_, -_/boot/<machine-id>/<kernel-version>/initrd_, -_/boot/efi/<machine-id>/<kernel-version>/initrd_, -_/lib/modules/<kernel-version>/initrd_ or -_/boot/initramfs-<kernel-version>.img_. +kernel is used. If <image> is omitted or empty, the default location will be +determined by the local configuration or Linux distribution policy. dracut creates an initial image used by the kernel for preloading the block device modules (such as IDE, SCSI or RAID) which are needed to access the root @@ -746,7 +741,7 @@ _/etc/cmdline.d/*.conf_:: AVAILABILITY ------------ The dracut command is part of the dracut package and is available from -link:$$https://github.com/dracutdevs/dracut$$[https://github.com/dracutdevs/dracut] +link:$$https://github.com/dracut-ng/dracut-ng$$[https://github.com/dracut-ng/dracut-ng] AUTHORS ------- diff --git a/man/dracut.cmdline.7.asc b/man/dracut.cmdline.7.asc index fefa209..7c0051e 100644 --- a/man/dracut.cmdline.7.asc +++ b/man/dracut.cmdline.7.asc @@ -221,13 +221,11 @@ It should be attached to any report about dracut problems. drop to a shell at the end **rd.break=**__{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}__:: - drop to a shell before the defined breakpoint starts - -**rd.udev.info**:: - set udev to loglevel info + drop to a shell before the defined breakpoint starts. + This parameter can be specified multiple times. -**rd.udev.debug**:: - set udev to loglevel debug +**rd.udev.log_level=**__{err|info|debug}__:: + set udev log level. The default is 'err'. I18N ~~~~ @@ -972,19 +970,38 @@ root=virtiofs:host rw DASD ~~~~ **rd.dasd=**....:: - same syntax as the kernel module parameter (s390 only) + same syntax as the kernel module parameter (s390 only). + For more details on the syntax see the IBM book + "Linux on IBM Z and IBM LinuxONE - Device Drivers, Features, and Commands" + https://www.ibm.com/docs/en/linux-on-systems?topic=overview-device-drivers-features-commands. + This parameter can be specified multiple times. ++ +NOTE: + This parameter is no longer handled by dracut itself but with the exact + same syntax by + https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev. ZFCP ~~~~ **rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__:: rd.zfcp can be specified multiple times on the kernel command line. ++ +NOTE: + This parameter is no longer handled by dracut itself but with the exact + same syntax by + https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev. **rd.zfcp=**__<zfcp adaptor device bus ID>__:: If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp - module is set to 'Y' then the zfcp adaptor will be initiating a + module is set to 'Y' then the zfcp driver will be initiating a scan internally and the <WWPN> and <FCPLUN> parameters can be omitted. + +NOTE: + This parameter is no longer handled by dracut itself but with the exact + same syntax by + https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev. ++ [listing] .Example -- @@ -998,9 +1015,12 @@ rd.zfcp=0.0.4000 ZNET ~~~~ **rd.znet=**__<nettype>__,__<subchannels>__,__<options>__:: - The whole parameter is appended to /etc/ccw.conf, which is used on - RHEL/Fedora with ccw_init, which is called from udev for certain - devices on z-series. + Activates a channel-attached network interface on s390 architecture. + <nettype> is one of: qeth, lcs, ctc. + <subchannels> is a comma-separated list of ccw device bus-IDs. + The list consists of 3 entries with nettype qeth, and 2 for other nettype. + <options> is a comma-separated list of <name>=<value> pairs, + where <name> refers to a device sysfs attribute to which <value> gets written. rd.znet can be specified multiple times on the kernel command line. **rd.znet_ifname=**__<ifname>__:__<subchannels>__:: @@ -1020,51 +1040,88 @@ Booting live images Dracut offers multiple options for live booted images: ===================== -SquashFS with read-only filesystem image::: The system will boot with a -read-only filesystem from the SquashFS and apply a writable Device-mapper -snapshot or an OverlayFS overlay mount for the read-only base filesystem. This -method ensures a relatively fast boot and lower RAM usage. Users **must be -careful** to avoid writing too many blocks to a snapshot volume. Once the -blocks of the snapshot overlay are exhausted, the root filesystem becomes -read-only and may cause application failures. The snapshot overlay file is -marked 'Overflow', and a difficult recovery is required to repair and enlarge -the overlay offline. Non-persistent overlays are sparse files in RAM that only -consume content space as required blocks are allocated. They default to an -apparent size of 32 GiB in RAM. The size can be adjusted with the -**rd.live.overlay.size=** kernel command line option. -+ -The filesystem structure is traditionally expected to be: -+ +SquashFS (read-only) base filesystem image::: +Note -- There are 3 separate overlay types available: +- Device-mapper snapshots (the original offering), +- Device-mapper thin provisioning snapshots (see *_rd.live.overlay.thin_*, +a later offering), and +- OverlayFS based overlay mounts (a more recent offering). + ++ +-- +Using one of these technologies, the system will provide a writable overlay for +the base, read-only SquashFS root filesystem. These methods enable a relatively +fast boot and lower RAM usage. + +With the original Device-mapper snapshot overlay, users **must be careful** to +avoid writing too many blocks to the snapshot device. Once the blocks of the +snapshot overlay are exhausted, the whole root filesystem becomes read-only +leading to application failures. The snapshot overlay device is marked +'Overflow', and a difficult recovery is required to repair and enlarge the +overlay offline. + +When *_rd.live.overlay=_* is not specified for persistent overlay storage, or +the specified file is not found or writable, a Device-mapper snapshot based +non-persistent or temporary overlay is automatically created as a sparse file +in RAM of the initramfs. This file will only consume content space as required +blocks are allocated. This snapshot based overlay defaults to an apparent size +of 32 GiB in RAM, and can be adjusted with the *_rd.live.overlay.size=_* kernel +command line option. This file is hidden (and appears deleted) when the boot +process switches out of the initramfs to the main root filesystem but its loop +device remains connected to the Device-mapper snapshot. + +Even with large Device-mapper overlay files for write space, the available root +filesystem capacity is limited by the total allocated size of the base root +filesystem, which often provide only a small number of gigabytes of free space. + +This shortage could be remedied by building the root filesystem with more +allocated free space, or the OverlayFS based overlay mount method can be used. + +When the *_rd.live.overlay.overlayfs_* option is specified or when +*_rd.live.overlay=_* points to an appropriate directory with a sister at +`/../ovlwork`, then an OverlayFS based overlay mount is employed. Such a +persistent OverlayFS overlay can extend the available root filesystem storage +up to the capacity of the LiveOS disk device. + +For non-persistent OverlayFS overlays, the `/run/overlayfs` directory in the +`/run` tmpfs is used for temporary storage. This filesystem is typically sized +to one half of the RAM total in the system. + +The command: `mount -o remount,size=<nbytes> /run` will resize this virtual +filesystem after booting. + +The internal SquashFS structure is traditionally expected to be: + [listing] --- +---- squashfs.img | SquashFS from LiveCD .iso !(mount) /LiveOS - |- rootfs.img | Filesystem image to mount read-only + |- rootfs.img | Usually a ext4 filesystem image to mount read-only !(mount) - /bin | Live filesystem + /bin | Base Live root filesystem /boot | /dev | ... | --- -+ -For OverlayFS mount overlays, the filesystem structure may also be a direct +---- + +For OverlayFS mount overlays, the internal SquashFS structure may be a direct compression of the root filesystem: -+ + [listing] --- +---- squashfs.img | SquashFS from LiveCD .iso !(mount) - /bin | Live filesystem + /bin | Base Live root filesystem /boot | /dev | ... | --- -+ +---- + Dracut uses one of the overlay methods of live booting by default. No -additional command line options are required other than **root=live:<URL>** to -specify the location of your squashed filesystem. -+ +additional command line options are required other than +**root=**live:__<path to blockdevice>__ or **root=**live:__<URL>__ to specify +the location of your squashed root filesystem. + - The compressed SquashFS image can be copied during boot to RAM at `/run/initramfs/squashed.img` by using the **rd.live.ram=1** option. - A device with a persistent overlay can be booted read-only by using the @@ -1072,7 +1129,8 @@ specify the location of your squashed filesystem. either cause a temporary, writable overlay to be stacked over a read-only snapshot of the root filesystem or the OverlayFS mount will use an additional lower layer with the root filesystem. -+ +-- + Uncompressed live filesystem image::: When the live system was installed with the '--skipcompress' option of the __livecd-iso-to-disk__ installation script for Live USB devices, the root @@ -1161,29 +1219,36 @@ Copy the complete image to RAM and use this for booting. This is useful when the image resides on, e.g., a DVD which needs to be ejected later on. **rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}:: -Manage the usage of a permanent overlay. +Manage the usage of a persistent overlay. + -- -* _<devspec>_ specifies the path to a device with a mountable filesystem. -* _<pathspec>_ is the path to a file within that filesystem, which shall be -used to persist the changes made to the device specified by the -**root=live:__<url>__** option. -+ -The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is -`/<rd.live.dir>/overlay-<label>-<uuid>`, where _<label>_ is the -device LABEL, and _<uuid>_ is the device UUID. -* _none_ (the word itself) specifies that no overlay will be used, such as when -an uncompressed, writable live root filesystem is available. -+ -If a persistent overlay __is detected__ at the standard LiveOS path, the -overlay & overlay type detected, whether Device-mapper or OverlayFS, will be -used. +* *_<devspec>_* specifies the path to a device with a mountable filesystem. +* *_<pathspec>_* is a path within the *_<devspec>_* filesystem to either +** a file (that is loop mounted for a Device-mapper overlay) or +** a directory (that is symbolically linked to `/run/overlayfs` for a OverlayFS +mount overlay). (A required sister directory `/<pathspec>/../ovlwork` is +automatically made.) +* *_none_* (the word itself) specifies that no overlay will be used, such as +when an uncompressed, writable live root filesystem is available. + +The above method shall be used to persist the changes made to the root +filesystem specified within the + +**root=**live:__<path to blockdevice>__ or **root=**live:__<url>__ device. + +The default *_pathspec_*, when *:auto* or +no **:__<pathspec>__** is given, is `/<rd.live.dir>/overlay-<label>-<uuid>`, +where _<label>_ and _<uuid>_ are the LABEL and UUID of the filesystem specified +by the **root=**live:__<path|url>__ device. + +If a persistent overlay __is detected__ at the standard LiveOS path, +and *_rd.live.overlay.overlayfs_* is not set to 1, the overlay type (either +Device-mapper or OverlayFS) will be detected and it will be used. -- + [listing] .Examples -- -rd.live.overlay=/dev/sdb1:persistent-overlay.img +rd.live.overlay=/dev/sdb1:/persistent-overlay.img rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4 -- @@ -1196,15 +1261,16 @@ Specifies a non-persistent Device-mapper overlay size in MiB. The default is _32768_. **rd.live.overlay.readonly=**1:: -This is used to boot with a normally read-write persistent overlay in a -read-only mode. With this option, either an additional, non-persistent, -writable snapshot overlay will be stacked over a read-only snapshot, -`/dev/mapper/live‑ro`, of the base filesystem with the persistent overlay, or a -read-only loop device, in the case of a writable __rootfs.img__, or an OverlayFS -mount will use the persistent overlay directory linked at `/run/overlayfs‑r` as -an additional lower layer along with the base root filesystem and apply a -transient, writable upper directory overlay, in order to complete the booted -root filesystem. +This is used to boot in a read-only mode with a normally read-write persistent +overlay. With this option, +* Device-mapper overlays will have an additional, non-persistent, writable +snapshot overlay stacked over a read-only snapshot (`/dev/mapper/live‑ro`) +of the base root filesystem and the persistent overlay, or +* for writable `rootfs.img` images, the above over a read-only loop device, or +* an OverlayFS mount will link the persistent overlay directory at +`/run/overlayfs‑r` as an additional read-only lower layer stacked over the base +root filesystem, and `/run/overlayfs` becomes the temporary, writable, upper +directory overlay, to complete the bootable root filesystem. **rd.live.overlay.reset=**1:: Specifies that a persistent overlay should be reset on boot. All previous root @@ -1222,18 +1288,15 @@ Enables the use of the *OverlayFS* kernel module, if available, to provide a copy-on-write union directory for the root filesystem. OverlayFS overlays are directories of the files that have changed on the read-only base (lower) filesystem. The root filesystem is provided through a special overlay type -mount that merges the lower and upper directories. If an OverlayFS upper -directory is not present on the boot device, a tmpfs directory will be created -at `/run/overlayfs` to provide temporary storage. Persistent storage can be -provided on vfat or msdos formatted devices by supplying the OverlayFS upper -directory within an embedded filesystem that supports the creation of trusted.* -extended attributes and provides a valid d_type in readdir responses, such as -with ext4 and xfs. On non-vfat-formatted devices, a persistent OverlayFS -overlay can extend the available root filesystem storage up to the capacity of -the LiveOS disk device. -+ -If a persistent overlay is detected at the standard LiveOS path, the overlay & -overlay type detected, whether OverlayFS or Device-mapper, will be used. +mount that merges at least two directories, designated the lower and the upper. +If an OverlayFS upper directory is not present on the boot device, a tmpfs +directory will be created at `/run/overlayfs` to provide temporary storage. +Persistent storage can be provided on vfat or msdos formatted devices by +supplying the OverlayFS upper directory within an embedded filesystem that +supports the creation of trusted.* extended attributes and provides a valid +d_type in readdir responses, such as with btrfs, ext4, f2fs, & xfs. On +non-vfat-formatted devices, a persistent OverlayFS overlay can extend the +available root filesystem storage up to the capacity of the LiveOS disk device. + The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to be mounted read-only through a higher level transient overlay directory, has @@ -1326,8 +1389,7 @@ ecryptfskey=/etc/keys/ecryptfs-trusted.blob Deprecated, renamed Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Here is a list of options, which were used in dracut prior to version 008, and -their new replacement. +Here is a list of options and their new replacement. rdbreak:: rd.break @@ -1428,9 +1490,13 @@ rdshell:: rd.shell rd_NO_SPLASH:: rd.splash -rdudevdebug:: rd.udev.debug +rdudevdebug:: rd.udev.udev_log=debug + +rdudevinfo:: rd.udev.udev_log=info + +rd.udev.debug:: rd.udev.udev_log=debug -rdudevinfo:: rd.udev.info +rd.udev.info:: rd.udev.udev_log=info rd_NO_ZFCPCONF:: rd.zfcp.conf=0 diff --git a/man/dracut.conf.5.asc b/man/dracut.conf.5.asc index f1705ce..dd42891 100644 --- a/man/dracut.conf.5.asc +++ b/man/dracut.conf.5.asc @@ -320,6 +320,12 @@ Logging levels: If set to _yes_, try to execute tasks in parallel (currently only supported for _--regenerate-all_). +*initrdname=*"_<filepattern>_":: + Specifies the file name for the generated initramfs if it is not set otherwise. + The initrdname configuration option is required to match the _initr*${kernel}*_ + file pattern and only one file with this pattern should exists in the + directory where initramfs is loaded from. Defaults to _initramfs-${kernel}.img_. + Files ----- _/etc/dracut.conf_:: diff --git a/man/dracut.modules.7.asc b/man/dracut.modules.7.asc index c1e8624..0f33bd7 100644 --- a/man/dracut.modules.7.asc +++ b/man/dracut.modules.7.asc @@ -181,7 +181,7 @@ hook _insmodpost.sh_ in the _initqueue/settled_. _parse-insmodpost.sh_: ---- for p in $(getargs rd.driver.post=); do - echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf + echo "blacklist $p" >> /run/modprobe.d/initramfsblacklist.conf _do_insmodpost=1 done diff --git a/man/dracut.usage.asc b/man/dracut.usage.asc index b83abf6..3b652d3 100644 --- a/man/dracut.usage.asc +++ b/man/dracut.usage.asc @@ -5,13 +5,10 @@ To create a initramfs image, the most simple command is: This will generate a general purpose initramfs image, with all possible functionality resulting of the combination of the installed dracut modules and -system tools. The image, depending on bootloader specification, can be -_/efi/_++<machine-id>++_/_++<kernel-version>++_/initrd_, -_/boot/_++<machine-id>++_/_++<kernel-version>++_/initrd_, -_/boot/efi/_++<machine-id>++_/_++<kernel-version>++_/initrd_, -_/lib/modules/_++<kernel-version>++_/initrd_ or -_/boot/initramfs-_++<kernel-version>++_.img_ and contains the kernel modules of +system tools. The image contains the kernel modules of the currently active kernel with version _++<kernel-version>++_. +The default location of the image is determined by the local configuration +or Linux distribution policy. If the initramfs image already exists, dracut will display an error message, and to overwrite the existing image, you have to use the --force option. @@ -103,6 +100,10 @@ raid with encryption and LVM on top), as long as you specify the correct filesystem LABEL or UUID on the kernel command line for your root device, dracut will find it and boot from it. +Generic initrd's are larger, but should be able to automatically boot any +bootable configuration with appropriate boot flags (root device, network +configuration information, etc.) + The kernel command line can also be provided by the dhcp server with the root-path option. See <<NetworkBoot>>. diff --git a/man/lsinitrd.1.asc b/man/lsinitrd.1.asc index 05f63e3..64d6f24 100644 --- a/man/lsinitrd.1.asc +++ b/man/lsinitrd.1.asc @@ -18,11 +18,8 @@ SYNOPSIS DESCRIPTION ----------- lsinitrd shows the contents of an initramfs image. if <image> is omitted, then -lsinitrd uses the default image _/efi/<machine-id>/<kernel-version>/initrd_, -_/boot/<machine-id>/<kernel-version>/initrd_, -_/boot/efi/<machine-id>/<kernel-version>/initrd_, -_/lib/modules/<kernel-version>/initrd_ or -_/boot/initramfs-<kernel-version>.img_. +lsinitrd determines the default location based on the local configuration +or Linux distribution policy. OPTIONS ------- @@ -56,7 +53,7 @@ OPTIONS AVAILABILITY ------------ The lsinitrd command is part of the dracut package and is available from -link:$$https://github.com/dracutdevs/dracut$$[https://github.com/dracutdevs/dracut] +link:$$https://github.com/dracut-ng/dracut-ng$$[https://github.com/dracut-ng/dracut-ng] AUTHORS ------- diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh index 9a13a1d..d173c99 100755 --- a/modules.d/00systemd/module-setup.sh +++ b/modules.d/00systemd/module-setup.sh @@ -23,8 +23,6 @@ installkernel() { # called by dracut install() { - local _mods - if [[ $prefix == /run/* ]]; then dfatal 'systemd does not work with a prefix, which contains "/run"!!' exit 1 @@ -38,10 +36,6 @@ install() { "$systemdutildir"/systemd-shutdown \ "$systemdutildir"/systemd-reply-password \ "$systemdutildir"/systemd-fsck \ - "$systemdutildir"/systemd-udevd \ - "$systemdutildir"/systemd-journald \ - "$systemdutildir"/systemd-sysctl \ - "$systemdutildir"/systemd-modules-load \ "$systemdutildir"/systemd-vconsole-setup \ "$systemdutildir"/systemd-volatile-root \ "$systemdutildir"/systemd-sysroot-fstab-check \ @@ -80,111 +74,35 @@ install() { "$systemdsystemunitdir"/paths.target \ "$systemdsystemunitdir"/umount.target \ "$systemdsystemunitdir"/sys-kernel-config.mount \ - "$systemdsystemunitdir"/modprobe@.service \ - "$systemdsystemunitdir"/kmod-static-nodes.service \ - "$systemdsystemunitdir"/systemd-tmpfiles-setup.service \ - "$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \ - "$systemdsystemunitdir"/systemd-tmpfiles-setup-dev-early.service \ - "$systemdsystemunitdir"/systemd-ask-password-console.path \ - "$systemdsystemunitdir"/systemd-udevd-control.socket \ - "$systemdsystemunitdir"/systemd-udevd-kernel.socket \ - "$systemdsystemunitdir"/systemd-ask-password-plymouth.path \ - "$systemdsystemunitdir"/systemd-journald.socket \ - "$systemdsystemunitdir"/systemd-journald-audit.socket \ - "$systemdsystemunitdir"/systemd-ask-password-console.service \ - "$systemdsystemunitdir"/systemd-modules-load.service \ "$systemdsystemunitdir"/systemd-halt.service \ "$systemdsystemunitdir"/systemd-poweroff.service \ "$systemdsystemunitdir"/systemd-reboot.service \ "$systemdsystemunitdir"/systemd-kexec.service \ "$systemdsystemunitdir"/systemd-fsck@.service \ - "$systemdsystemunitdir"/systemd-udevd.service \ - "$systemdsystemunitdir"/systemd-udev-trigger.service \ - "$systemdsystemunitdir"/systemd-udev-settle.service \ - "$systemdsystemunitdir"/systemd-ask-password-plymouth.service \ - "$systemdsystemunitdir"/systemd-journald.service \ "$systemdsystemunitdir"/systemd-vconsole-setup.service \ "$systemdsystemunitdir"/systemd-volatile-root.service \ - "$systemdsystemunitdir"/systemd-sysctl.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \ - "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \ - "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \ - "$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \ - "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \ - "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \ - "$systemdsystemunitdir"/sysinit.target.wants/kmod-static-nodes.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \ "$systemdsystemunitdir"/ctrl-alt-del.target \ - "$systemdsystemunitdir"/reboot.target \ - "$systemdsystemunitdir"/systemd-reboot.service \ "$systemdsystemunitdir"/syslog.socket \ "$systemdsystemunitdir"/slices.target \ "$systemdsystemunitdir"/system.slice \ "$systemdsystemunitdir"/-.slice \ - "$tmpfilesdir"/systemd.conf \ - journalctl systemctl \ + systemctl \ echo swapoff \ - kmod insmod rmmod modprobe modinfo depmod lsmod \ mount umount reboot poweroff \ systemd-run systemd-escape \ - systemd-cgls systemd-tmpfiles \ - systemd-ask-password systemd-tty-ask-password-agent \ - /etc/udev/udev.hwdb - - inst_multiple -o \ - /usr/lib/modules-load.d/*.conf \ - /usr/lib/sysctl.d/*.conf - - modules_load_get() { - local _line i - for i in "$dracutsysrootdir$1"/*.conf; do - [[ -f $i ]] || continue - while read -r _line || [ -n "$_line" ]; do - case $_line in - \#*) ;; - - \;*) ;; - - *) - echo "$_line" - ;; - esac - done < "$i" - done - } - - mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d) - [[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}" + systemd-cgls if [[ $hostonly ]]; then inst_multiple -H -o \ - /etc/systemd/journald.conf \ - /etc/systemd/journald.conf.d/*.conf \ /etc/systemd/system.conf \ /etc/systemd/system.conf.d/*.conf \ - "$systemdsystemconfdir"/modprobe@.service \ - "$systemdsystemconfdir/modprobe@.service.d/*.conf" \ /etc/hosts \ /etc/hostname \ /etc/nsswitch.conf \ /etc/machine-id \ /etc/machine-info \ /etc/vconsole.conf \ - /etc/locale.conf \ - /etc/modules-load.d/*.conf \ - /etc/sysctl.d/*.conf \ - /etc/sysctl.conf \ - /etc/udev/udev.conf - - mapfile -t _mods < <(modules_load_get /etc/modules-load.d) - [[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}" + /etc/locale.conf fi if ! [[ -e "$initdir/etc/machine-id" ]]; then @@ -192,17 +110,14 @@ install() { chmod 444 "$initdir/etc/machine-id" fi - # install adm user/group for journald inst_multiple nologin { - grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2> /dev/null grep '^adm:' "$dracutsysrootdir"/etc/passwd 2> /dev/null # we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null } >> "$initdir/etc/passwd" { - grep '^systemd-journal:' "$dracutsysrootdir"/etc/group 2> /dev/null grep '^wheel:' "$dracutsysrootdir"/etc/group 2> /dev/null grep '^adm:' "$dracutsysrootdir"/etc/group 2> /dev/null grep '^utmp:' "$dracutsysrootdir"/etc/group 2> /dev/null @@ -241,27 +156,19 @@ EOF for i in \ emergency.target \ - rescue.target \ - systemd-ask-password-console.service \ - systemd-ask-password-plymouth.service; do + rescue.target; do [[ -f "$systemdsystemunitdir"/$i ]] || continue $SYSTEMCTL -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service done mkdir -p "$initdir/etc/systemd" - # We must use a volatile journal, and we don't want rate-limiting - { - echo "[Journal]" - echo "Storage=volatile" - echo "RateLimitInterval=0" - echo "RateLimitBurst=0" - } >> "$initdir/etc/systemd/journald.conf" $SYSTEMCTL -q --root "$initdir" set-default multi-user.target # Install library file(s) _arch=${DRACUT_ARCH:-$(uname -m)} inst_libdir_file \ + {"tls/$_arch/",tls/,"$_arch/",}"libgcrypt.so*" \ + {"tls/$_arch/",tls/,"$_arch/",}"libkmod.so*" \ {"tls/$_arch/",tls/,"$_arch/",}"libnss_*" - } diff --git a/modules.d/01fips/fips-boot.sh b/modules.d/01fips/fips-boot.sh index 34760e0..d703a10 100755 --- a/modules.d/01fips/fips-boot.sh +++ b/modules.d/01fips/fips-boot.sh @@ -3,7 +3,7 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then - rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1 + : elif [ -z "$fipsmode" ]; then die "FIPS mode have to be enabled by 'fips=1' not just 'fips'" elif getarg boot= > /dev/null; then diff --git a/modules.d/01fips/fips-load-crypto.sh b/modules.d/01fips/fips-load-crypto.sh index 6ef42b9..d1d90c8 100755 --- a/modules.d/01fips/fips-load-crypto.sh +++ b/modules.d/01fips/fips-load-crypto.sh @@ -3,7 +3,7 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then - rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1 + : elif [ -z "$fipsmode" ]; then die "FIPS mode have to be enabled by 'fips=1' not just 'fips'" else diff --git a/modules.d/01fips/fips-noboot.sh b/modules.d/01fips/fips-noboot.sh index 963a034..319da90 100755 --- a/modules.d/01fips/fips-noboot.sh +++ b/modules.d/01fips/fips-noboot.sh @@ -3,7 +3,7 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then - rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1 + : elif [ -z "$fipsmode" ]; then die "FIPS mode have to be enabled by 'fips=1' not just 'fips'" elif ! [ -f /tmp/fipsdone ]; then diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh index 2e7b7cb..c81c2a6 100755 --- a/modules.d/01fips/fips.sh +++ b/modules.d/01fips/fips.sh @@ -97,7 +97,6 @@ fips_load_crypto() { read -d '' -r FIPSMODULES < /etc/fipsmodules fips_info "Loading and integrity checking all crypto modules" - mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak for _module in $FIPSMODULES; do if [ "$_module" != "tcrypt" ]; then if ! nonfatal_modprobe "${_module}" 2> /tmp/fips.modprobe_err; then @@ -113,7 +112,10 @@ fips_load_crypto() { fi fi done - mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf + if [ -f /etc/fips.conf ]; then + mkdir -p /run/modprobe.d + cp /etc/fips.conf /run/modprobe.d/fips.conf + fi fips_info "Self testing crypto algorithms" modprobe tcrypt || return 1 diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh index 0e47c84..83fcd56 100755 --- a/modules.d/01fips/module-setup.sh +++ b/modules.d/01fips/module-setup.sh @@ -39,13 +39,10 @@ installkernel() { _fipsmodules+="aead cryptomgr tcrypt crypto_user " fi - # shellcheck disable=SC2174 - mkdir -m 0755 -p "${initdir}/etc/modprobe.d" - for _mod in $_fipsmodules; do if hostonly='' instmods -c -s "$_mod"; then echo "$_mod" >> "${initdir}/etc/fipsmodules" - echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf" + echo "blacklist $_mod" >> "${initdir}/etc/fips.conf" fi done @@ -70,16 +67,4 @@ install() { inst_multiple sha512hmac rmmod insmod mount uname umount grep sed cut find sort inst_simple /etc/system-fips - [ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \ - || { - dfatal "Cannot create /dev/random" - dfatal "To create an initramfs with fips support, dracut has to run as root" - return 1 - } - [ -c "${initdir}"/dev/urandom ] || mknod "${initdir}"/dev/urandom c 1 9 \ - || { - dfatal "Cannot create /dev/urandom" - dfatal "To create an initramfs with fips support, dracut has to run as root" - return 1 - } } diff --git a/modules.d/01systemd-ask-password/module-setup.sh b/modules.d/01systemd-ask-password/module-setup.sh index 6e78075..866eb3a 100755 --- a/modules.d/01systemd-ask-password/module-setup.sh +++ b/modules.d/01systemd-ask-password/module-setup.sh @@ -19,6 +19,19 @@ check() { # Module dependency requirements. depends() { + if [[ $hostonly ]]; then + # A password cannot be entered if there is no graphical output during boot, + # as is the case in aarch64, where efifb does not work with qemu-system-aarch64: + # - virtio-gpu-pci does not expose a linear framebuffer + # - virtio-vga is not supported + # - ramfb is not enough + # Therefore, depend on the drm module if virtio_gpu is loaded on the system. + if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]] \ + && grep -r -q "virtio:d00000010v" /sys/bus/virtio/devices/*/modalias 2> /dev/null; then + echo drm + fi + fi + # Return 0 to include the dependent module(s) in the initramfs. return 0 @@ -35,6 +48,10 @@ install() { systemd-ask-password \ systemd-tty-ask-password-agent + if [ -e "$systemdsystemunitdir"/systemd-vconsole-setup.service ]; then + $SYSTEMCTL -q --root "$initdir" add-wants systemd-ask-password-console.service systemd-vconsole-setup.service + fi + # Enable the systemd type service unit for systemd-ask-password. $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-console.service @@ -44,6 +61,10 @@ install() { "$systemdsystemunitdir"/systemd-ask-password-plymouth.path \ "$systemdsystemunitdir"/systemd-ask-password-plymouth.service + if [ -e "$systemdsystemunitdir"/systemd-vconsole-setup.service ]; then + $SYSTEMCTL -q --root "$initdir" add-wants systemd-ask-password-plymouth.service systemd-vconsole-setup.service + fi + $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-plymouth.service fi diff --git a/modules.d/01systemd-bsod/module-setup.sh b/modules.d/01systemd-bsod/module-setup.sh new file mode 100755 index 0000000..91b28d7 --- /dev/null +++ b/modules.d/01systemd-bsod/module-setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# This file is part of dracut. +# SPDX-License-Identifier: GPL-2.0-or-later + +# Prerequisite check(s) for module. +check() { + # If the binary(s) requirements are not fulfilled the module can't be installed + require_binaries "$systemdutildir"/systemd-bsod || return 1 + + # Return 255 to only include the module, if another module requires it. + return 255 +} + +# Module dependency requirements. +depends() { + # This module has external dependency on other module(s). + echo systemd-journald + # Return 0 to include the dependent module(s) in the initramfs. + return 0 +} + +# Install the required file(s) for the module in the initramfs. +install() { + inst_multiple \ + "$systemdsystemunitdir"/systemd-bsod.service \ + "$systemdsystemunitdir"/initrd.target.wants/systemd-bsod.service \ + "$systemdutildir"/systemd-bsod + + inst_libdir_file "libqrencode.so*" +} diff --git a/modules.d/01systemd-coredump/module-setup.sh b/modules.d/01systemd-coredump/module-setup.sh index 69ec966..47666b6 100755 --- a/modules.d/01systemd-coredump/module-setup.sh +++ b/modules.d/01systemd-coredump/module-setup.sh @@ -40,6 +40,13 @@ install() { "$sysusers"/systemd-coredump.conf \ coredumpctl + # Install library file(s) + _arch=${DRACUT_ARCH:-$(uname -m)} + inst_libdir_file \ + {"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \ + {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*" \ + {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" + # Install the hosts local user configurations if enabled. if [[ $hostonly ]]; then inst_multiple -H -o \ diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh index f65041f..957e7be 100755 --- a/modules.d/01systemd-initrd/module-setup.sh +++ b/modules.d/01systemd-initrd/module-setup.sh @@ -4,12 +4,13 @@ check() { [[ $mount_needs ]] && return 1 - return 0 + # Return 255 to only include the module, if another module requires it. + return 255 } # called by dracut depends() { - echo "systemd" + echo systemd-udevd systemd-journald systemd-tmpfiles } installkernel() { diff --git a/modules.d/01systemd-journald/module-setup.sh b/modules.d/01systemd-journald/module-setup.sh index 3cf2a1a..e0944d2 100755 --- a/modules.d/01systemd-journald/module-setup.sh +++ b/modules.d/01systemd-journald/module-setup.sh @@ -20,7 +20,7 @@ check() { depends() { # This module has external dependency on other module(s). - echo systemd-sysusers + echo systemd systemd-sysusers # Return 0 to include the dependent module(s) in the initramfs. return 0 @@ -53,9 +53,10 @@ install() { # Install library file(s) _arch=${DRACUT_ARCH:-$(uname -m)} inst_libdir_file \ + {"tls/$_arch/",tls/,"$_arch/",}"libgcrypt.so*" \ {"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \ - {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" \ - {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*" + {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*" \ + {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" # Install the hosts local user configurations if enabled. if [[ $hostonly ]]; then diff --git a/modules.d/01systemd-ldconfig/module-setup.sh b/modules.d/01systemd-ldconfig/module-setup.sh index 3a5842a..4e65d89 100755 --- a/modules.d/01systemd-ldconfig/module-setup.sh +++ b/modules.d/01systemd-ldconfig/module-setup.sh @@ -33,7 +33,8 @@ install() { "$systemdsystemunitdir"/ldconfig.service \ "$systemdsystemunitdir/ldconfig.service.d/*.conf" \ "$systemdsystemunitdir"/sysinit.target.wants/ldconfig.service \ - ldconfig + ldconfig \ + ldconfig.real # Install required libraries. _arch=${DRACUT_ARCH:-$(uname -m)} diff --git a/modules.d/01systemd-modules-load/module-setup.sh b/modules.d/01systemd-modules-load/module-setup.sh index f9adfea..34778f8 100755 --- a/modules.d/01systemd-modules-load/module-setup.sh +++ b/modules.d/01systemd-modules-load/module-setup.sh @@ -21,14 +21,56 @@ depends() { } +# Install kernel module(s). +installkernel() { + local _mods + + modules_load_get() { + local _line _i + for _i in "$dracutsysrootdir$1"/*.conf; do + [[ -f $_i ]] || continue + while read -r _line || [ -n "$_line" ]; do + case $_line in + \#*) ;; + + \;*) ;; + + *) + echo "$_line" + ;; + esac + done < "$_i" + done + } + + mapfile -t _mods < <(modules_load_get "$modulesload") + if [[ ${#_mods[@]} -gt 0 ]]; then + hostonly='' instmods "${_mods[@]}" + fi + + if [[ $hostonly ]]; then + mapfile -t _mods < <(modules_load_get "$modulesloadconfdir") + if [[ ${#_mods[@]} -gt 0 ]]; then + hostonly='' instmods "${_mods[@]}" + fi + fi + + return 0 +} + # Install the required file(s) and directories for the module in the initramfs. install() { inst_multiple -o \ + /usr/lib/modules-load.d/*.conf \ "$modulesload/*.conf" \ "$systemdutildir"/systemd-modules-load \ "$systemdsystemunitdir"/systemd-modules-load.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service + "$systemdsystemunitdir"/modprobe@.service \ + "$systemdsystemunitdir"/kmod-static-nodes.service \ + "$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service \ + "$systemdsystemunitdir"/sysinit.target.wants/kmod-static-nodes.service \ + kmod insmod rmmod modprobe modinfo depmod lsmod # Enable systemd type unit(s) $SYSTEMCTL -q --root "$initdir" enable systemd-modules-load.service @@ -36,7 +78,10 @@ install() { # Install the hosts local user configurations if enabled. if [[ $hostonly ]]; then inst_multiple -H -o \ + /etc/modules-load.d/*.conf \ "$modulesloadconfdir/*.conf" \ + "$systemdsystemconfdir"/modprobe@.service \ + "$systemdsystemconfdir/modprobe@.service.d/*.conf" \ "$systemdsystemconfdir"/systemd-modules-load.service \ "$systemdsystemconfdir/systemd-modules-load.service.d/*.conf" fi diff --git a/modules.d/01systemd-networkd/module-setup.sh b/modules.d/01systemd-networkd/module-setup.sh index 7bbf83c..3658882 100755 --- a/modules.d/01systemd-networkd/module-setup.sh +++ b/modules.d/01systemd-networkd/module-setup.sh @@ -7,7 +7,7 @@ check() { [[ $mount_needs ]] && return 1 # If the binary(s) requirements are not fulfilled the module can't be installed - require_binaries ip networkctl \ + require_binaries ip \ "$systemdutildir"/systemd-networkd \ "$systemdutildir"/systemd-network-generator \ "$systemdutildir"/systemd-networkd-wait-online \ @@ -22,7 +22,7 @@ check() { depends() { # This module has external dependency on other module(s). - echo dbus kernel-network-modules systemd-sysusers + echo kernel-network-modules systemd-sysusers # Return 0 to include the dependent module(s) in the initramfs. return 0 @@ -47,6 +47,7 @@ install() { "$systemdnetwork"/80-container-vz.network \ "$systemdnetwork"/80-vm-vt.network \ "$systemdnetwork"/80-wifi-adhoc.network \ + "$systemdnetwork"/98-default-mac-none.link \ "$systemdnetwork"/99-default.link \ "$systemdsystemunitdir"/systemd-networkd.service \ "$systemdsystemunitdir"/systemd-networkd.socket \ @@ -55,7 +56,7 @@ install() { "$systemdsystemunitdir"/systemd-networkd-wait-online@.service \ "$systemdsystemunitdir"/systemd-network-generator.service \ "$sysusers"/systemd-network.conf \ - networkctl ip + ip # Enable systemd type units for i in \ diff --git a/modules.d/01systemd-pcrphase/module-setup.sh b/modules.d/01systemd-pcrphase/module-setup.sh index fa960a4..eb85207 100755 --- a/modules.d/01systemd-pcrphase/module-setup.sh +++ b/modules.d/01systemd-pcrphase/module-setup.sh @@ -6,10 +6,13 @@ check() { # If the binary(s) requirements are not fulfilled the module can't be installed. - require_binaries "$systemdutildir"/systemd-pcrphase || return 1 + # systemd-255 renamed the binary, check for old and new location. + if ! require_binaries "$systemdutildir"/systemd-pcrphase \ + && ! require_binaries "$systemdutildir"/systemd-pcrextend; then + return 1 + fi - # Return 255 to only include the module, if another module requires it. - return 255 + return 0 } @@ -28,6 +31,7 @@ install() { inst_multiple -o \ "$systemdutildir"/systemd-pcrphase \ + "$systemdutildir"/systemd-pcrextend \ "$systemdsystemunitdir"/systemd-pcrphase-initrd.service \ "$systemdsystemunitdir/systemd-pcrphase-initrd.service.d/*.conf" \ "$systemdsystemunitdir"/initrd.target.wants/systemd-pcrphase-initrd.service diff --git a/modules.d/01systemd-sysctl/module-setup.sh b/modules.d/01systemd-sysctl/module-setup.sh index d0eb779..64f93f9 100755 --- a/modules.d/01systemd-sysctl/module-setup.sh +++ b/modules.d/01systemd-sysctl/module-setup.sh @@ -10,7 +10,6 @@ check() { # Return 255 to only include the module, if another module requires it. return 255 - } # Module dependency requirements. @@ -20,13 +19,13 @@ depends() { echo systemd-modules-load # Return 0 to include the dependent module(s) in the initramfs. return 0 - } # Install the required file(s) for the module in the initramfs. install() { inst_multiple -o \ + /usr/lib/sysctl.d/*.conf \ "$sysctld/*.conf" \ "$systemdsystemunitdir"/systemd-sysctl.service \ "$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \ @@ -36,6 +35,7 @@ install() { if [[ $hostonly ]]; then inst_multiple -H -o \ /etc/sysctl.conf \ + /etc/sysctl.d/*.conf \ "$sysctlconfdir/*.conf" \ "$systemdsystemconfdir"/systemd-sysctl.service \ "$systemdsystemconfdir/systemd-sysctl.service.d/*.conf" @@ -43,5 +43,4 @@ install() { # Enable the systemd type service unit for sysctl. $SYSTEMCTL -q --root "$initdir" enable systemd-sysctl.service - } diff --git a/modules.d/01systemd-sysext/module-setup.sh b/modules.d/01systemd-sysext/module-setup.sh index b95a480..381e339 100755 --- a/modules.d/01systemd-sysext/module-setup.sh +++ b/modules.d/01systemd-sysext/module-setup.sh @@ -26,20 +26,34 @@ depends() { # Install the required file(s) and directories for the module in the initramfs. install() { + # It's intended to work only with raw binary disk images contained in + # regular files, but not with directory trees. + inst_multiple -o \ - "/usr/lib/extensions/*" \ + "/usr/lib/confexts/*.raw" \ + "/var/lib/confexts/*.raw" \ + "/var/lib/extensions/*.raw" \ + "/etc/extension-release.d/extension-release.*" \ "/usr/lib/extension-release.d/extension-release.*" \ + "$systemdsystemunitdir"/systemd-confext.service \ + "$systemdsystemunitdir/systemd-confext.service.d/*.conf" \ "$systemdsystemunitdir"/systemd-sysext.service \ "$systemdsystemunitdir/systemd-sysext.service.d/*.conf" \ - systemd-sysext + systemd-confext systemd-sysext # Enable systemd type unit(s) - $SYSTEMCTL -q --root "$initdir" enable systemd-sysext.service + for i in \ + systemd-confext.service \ + systemd-sysext.service; do + $SYSTEMCTL -q --root "$initdir" enable "$i" + done # Install the hosts local user configurations if enabled. if [[ $hostonly ]]; then inst_multiple -H -o \ - "/etc/extensions/*" \ + "/etc/extensions/*.raw" \ + "$systemdsystemconfdir"/systemd-confext.service \ + "$systemdsystemconfdir/systemd-confext.service.d/*.conf" \ "$systemdsystemconfdir"/systemd-sysext.service \ "$systemdsystemconfdir/systemd-sysext.service.d/*.conf" fi diff --git a/modules.d/01systemd-udevd/module-setup.sh b/modules.d/01systemd-udevd/module-setup.sh index ce5d2a3..168167f 100755 --- a/modules.d/01systemd-udevd/module-setup.sh +++ b/modules.d/01systemd-udevd/module-setup.sh @@ -20,7 +20,7 @@ check() { depends() { # This module has external dependency on other module(s). - echo systemd + echo udev-rules systemd systemd-sysctl # Return 0 to include the dependent module(s) in the initramfs. return 0 @@ -30,20 +30,14 @@ depends() { install() { inst_multiple -o \ + /etc/udev/udev.hwdb \ "$udevdir"/hwdb.bin \ - "$udevdir"/udev.conf \ - "$udevdir"/ata_id \ - "$udevdir"/cdrom_id \ "$udevdir"/dmi_memory_id \ "$udevdir"/fido_id \ "$udevdir"/mtd_probe \ "$udevdir"/mtp-probe \ - "$udevdir"/scsi_id \ "$udevdir"/v4l_id \ - "$udevrulesdir"/50-udev-default.rules \ "$udevrulesdir"/60-autosuspend.rules \ - "$udevrulesdir"/60-block.rules \ - "$udevrulesdir"/60-cdrom_id.rules \ "$udevrulesdir"/60-drm.rules \ "$udevrulesdir"/60-evdev.rules \ "$udevrulesdir"/60-fido-id.rules \ @@ -51,20 +45,15 @@ install() { "$udevrulesdir"/60-persistent-alsa.rules \ "$udevrulesdir"/60-persistent-input.rules \ "$udevrulesdir"/60-persistent-storage-tape.rules \ - "$udevrulesdir"/60-persistent-storage.rules \ "$udevrulesdir"/60-persistent-v4l.rules \ "$udevrulesdir"/60-sensor.rules \ "$udevrulesdir"/60-serial.rules \ - "$udevrulesdir"/64-btrfs.rules \ "$udevrulesdir"/70-joystick.rules \ "$udevrulesdir"/70-memory.rules \ "$udevrulesdir"/70-mouse.rules \ "$udevrulesdir"/70-touchpad.rules \ - "$udevrulesdir"/75-net-description.rules \ "$udevrulesdir"/75-probe_mtd.rules \ "$udevrulesdir"/78-sound-card.rules \ - "$udevrulesdir"/80-drivers.rules \ - "$udevrulesdir"/80-net-setup-link.rules \ "$udevrulesdir"/81-net-dhcp.rules \ "$udevrulesdir"/99-systemd.rules \ "$systemdutildir"/systemd-udevd \ @@ -79,14 +68,12 @@ install() { "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \ "$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \ "$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \ - "$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \ - udevadm + "$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service # Install the hosts local user configurations if enabled. if [[ $hostonly ]]; then inst_multiple -H -o \ "$udevconfdir"/hwdb.bin \ - "$udevconfdir"/udev.conf \ "$udevrulesconfdir/*.rules" \ "$systemdutilconfdir"/hwdb/hwdb.bin \ "$systemdsystemconfdir"/systemd-udevd.service \ diff --git a/modules.d/02caps/module-setup.sh b/modules.d/02caps/module-setup.sh index 18073e2..9119caf 100755 --- a/modules.d/02caps/module-setup.sh +++ b/modules.d/02caps/module-setup.sh @@ -2,7 +2,7 @@ # called by dracut check() { - require_binaries capsh + require_binaries capsh || return 1 return 255 } diff --git a/modules.d/10i18n/console_init.sh b/modules.d/10i18n/console_init.sh index 3ca0ac1..7349817 100755 --- a/modules.d/10i18n/console_init.sh +++ b/modules.d/10i18n/console_init.sh @@ -49,7 +49,7 @@ set_font() { setfont "${FONT-${DEFAULT_FONT}}" \ -C "${1}" \ ${FONT_MAP:+-m "${FONT_MAP}"} \ - ${FONT_UNIMAP:+-u "${FONT_UNIMAP}"} + ${FONT_UNIMAP:+-u "${FONT_UNIMAP}"} 2> /dev/null } dev_close() { diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh index ac45611..960c41d 100755 --- a/modules.d/10i18n/module-setup.sh +++ b/modules.d/10i18n/module-setup.sh @@ -38,13 +38,13 @@ install() { local CMD local FN - if [[ -f $dracutsysrootdir$1 ]]; then + if [[ -f $1 ]]; then MAPS=("$1") else MAPNAME=${1%.map*} mapfile -t -d '' MAPS < <( - find "${dracutsysrootdir}${kbddir}"/keymaps/ -type f \( -name "${MAPNAME}" -o -name "${MAPNAME}.map*" \) -print0 + find "${dracutsysrootdir}${kbddir}"/keymaps/ -type f,l \( -name "${MAPNAME}" -o -name "${MAPNAME}.map*" \) -print0 ) fi @@ -160,6 +160,7 @@ install() { install_local_i18n() { local map + local maplink # shellcheck disable=SC2086 eval "$(gather_vars ${i18n_vars})" @@ -216,7 +217,19 @@ install() { done for keymap in "${!KEYMAPS[@]}"; do - inst_opt_decompress "${keymap}" + if [[ -L ${keymap} ]]; then + maplink=$(readlink -f "${keymap}") + # skip symlinked directories + [[ -d ${maplink} ]] && continue + + inst_opt_decompress "${maplink}" + # create new symlink to decompressed keymap + maplink=${maplink%.gz} + keymap=${keymap%.gz} + ln -srn "${initdir}${maplink#"$dracutsysrootdir"}" "${initdir}${keymap#"$dracutsysrootdir"}" + else + inst_opt_decompress "${keymap}" + fi done inst_opt_decompress "${kbddir}"/consolefonts/"${DEFAULT_FONT}".* diff --git a/modules.d/35connman/cm-lib.sh b/modules.d/35connman/cm-lib.sh index 69c4fa2..69901f3 100755 --- a/modules.d/35connman/cm-lib.sh +++ b/modules.d/35connman/cm-lib.sh @@ -4,7 +4,6 @@ type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh cm_generate_connections() { if getargbool 0 rd.neednet; then - mkdir -p "$hookdir"/initqueue/finished echo '[ -f /tmp/cm.done ]' > "$hookdir"/initqueue/finished/cm.sh mkdir -p /run/connman/initrd : > /run/connman/initrd/neednet # activate ConnMan services diff --git a/modules.d/35connman/module-setup.sh b/modules.d/35connman/module-setup.sh index 6502d30..5a3b0e1 100755 --- a/modules.d/35connman/module-setup.sh +++ b/modules.d/35connman/module-setup.sh @@ -10,7 +10,7 @@ check() { # called by dracut depends() { - echo dbus systemd bash + echo dbus systemd bash net-lib kernel-network-modules return 0 } @@ -25,7 +25,6 @@ install() { # in an emergency shell. inst_multiple ip sed grep - inst_script "$moddir/netroot.sh" "/sbin/netroot" inst connmand inst connmanctl inst connmand-wait-online diff --git a/modules.d/35network-legacy/module-setup.sh b/modules.d/35network-legacy/module-setup.sh index 868ea8f..42257eb 100755 --- a/modules.d/35network-legacy/module-setup.sh +++ b/modules.d/35network-legacy/module-setup.sh @@ -10,6 +10,7 @@ check() { # called by dracut depends() { + echo net-lib kernel-network-modules return 0 } @@ -23,9 +24,11 @@ installkernel() { install() { local _arch - #Adding default link + # Adding default link and (if exists) 98-default-mac-none.link if dracut_module_included "systemd"; then - inst_multiple -o "${systemdnetwork}/99-default.link" + inst_multiple -o \ + "${systemdnetwork}/99-default.link" \ + "${systemdnetwork}/98-default-mac-none.link" [[ $hostonly ]] && inst_multiple -H -o "${systemdnetworkconfdir}/*.link" fi diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh index d9a244a..67144f3 100755 --- a/modules.d/35network-manager/module-setup.sh +++ b/modules.d/35network-manager/module-setup.sh @@ -10,7 +10,7 @@ check() { # called by dracut depends() { - echo dbus bash + echo dbus bash net-lib kernel-network-modules return 0 } @@ -51,8 +51,10 @@ install() { inst_simple "$moddir"/nm-initrd.service "$systemdsystemunitdir"/nm-initrd.service inst_simple "$moddir"/nm-wait-online-initrd.service "$systemdsystemunitdir"/nm-wait-online-initrd.service - # Adding default link - inst_multiple -o "${systemdnetwork}/99-default.link" + # Adding default link and (if exists) 98-default-mac-none.link + inst_multiple -o \ + "${systemdnetwork}/99-default.link" \ + "${systemdnetwork}/98-default-mac-none.link" [[ $hostonly ]] && inst_multiple -H -o "${systemdnetworkconfdir}/*.link" $SYSTEMCTL -q --root "$initdir" enable nm-initrd.service @@ -70,7 +72,9 @@ install() { elif ! [[ -e "$initdir/etc/machine-id" ]]; then # The internal DHCP client silently fails if we # have no machine-id - systemd-machine-id-setup --root="$initdir" + local UUID + UUID=$(< /proc/sys/kernel/random/uuid) + echo "${UUID//-/}" > "$initdir/etc/machine-id" fi # We don't install the ifcfg files from the host automatically. diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh index 32a288d..f0941de 100755 --- a/modules.d/35network-manager/nm-lib.sh +++ b/modules.d/35network-manager/nm-lib.sh @@ -20,7 +20,6 @@ nm_generate_connections() { /etc/NetworkManager/system-connections/* \ /etc/sysconfig/network-scripts/ifcfg-*; do [ -f "$i" ] || continue - mkdir -p "$hookdir"/initqueue/finished echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh mkdir -p /run/NetworkManager/initrd : > /run/NetworkManager/initrd/neednet # activate NM services diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh index 4c77ff3..970c252 100755 --- a/modules.d/40network/module-setup.sh +++ b/modules.d/40network/module-setup.sh @@ -27,22 +27,6 @@ depends() { network_handler="network-legacy" fi fi - echo "kernel-network-modules $network_handler" + echo "net-lib kernel-network-modules $network_handler" return 0 } - -# called by dracut -installkernel() { - return 0 -} - -# called by dracut -install() { - inst_script "$moddir/netroot.sh" "/sbin/netroot" - inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh" - inst_hook pre-udev 50 "$moddir/ifname-genrules.sh" - inst_hook cmdline 91 "$moddir/dhcp-root.sh" - inst_multiple ip sed awk grep pgrep tr - inst_multiple -o arping arping2 - dracut_need_initqueue -} diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh deleted file mode 100755 index 8f97774..0000000 --- a/modules.d/40network/netroot.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v getarg > /dev/null || . /lib/dracut-lib.sh -command -v setup_net > /dev/null || . /lib/net-lib.sh - -# Huh? Empty $1? -[ -z "$1" ] && exit 1 - -# [ ! -z $2 ] means this is for manually bringing up network -# instead of real netroot; If It's called without $2, then there's -# no sense in doing something if no (net)root info is available -# or root is already there -[ -d "$NEWROOT"/proc ] && exit 0 - -if [ -z "$netroot" ]; then - netroot=$(getarg netroot=) -fi - -[ -z "$netroot" ] && exit 1 - -# Set or override primary interface -netif=$1 -[ -e "/tmp/net.bootdev" ] && read -r netif < /tmp/net.bootdev - -case "$netif" in - ??:??:??:??:??:??) # MAC address - for i in /sys/class/net/*/address; do - read -r mac < "$i" - if [ "$mac" = "$netif" ]; then - i=${i%/address} - netif=${i##*/} - break - fi - done ;; -esac - -# Figure out the handler for root=dhcp by recalling all netroot cmdline -# handlers when this is not called from manually network bringing up. -if [ -z "$2" ]; then - if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then - # Load dhcp options - # shellcheck disable=SC1090 - [ -e /tmp/dhclient."$netif".dhcpopts ] && . /tmp/dhclient."$netif".dhcpopts - - # If we have a specific bootdev with no dhcpoptions or empty root-path, - # we die. Otherwise we just warn - if [ -z "$new_root_path" ]; then - [ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'" - warn "No dhcp root-path received for '$netif' trying other interfaces if available" - exit 1 - fi - - rm -f -- "$hookdir"/initqueue/finished/dhcp.sh - - # Set netroot to new_root_path, so cmdline parsers don't call - netroot=$new_root_path - - # FIXME! - unset rootok - for f in "$hookdir"/cmdline/90*.sh; do - # shellcheck disable=SC1090 - [ -f "$f" ] && . "$f" - done - else - rootok="1" - fi - - # Check: do we really know how to handle (net)root? - if [ -z "$root" ]; then - root=$(getarg root=) - fi - [ -z "$root" ] && die "No or empty root= argument" - [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'" - - handler=${netroot%%:*} - handler=${handler%%4} - handler=$(command -v "${handler}"root) - if [ -z "$netroot" ] || [ ! -e "$handler" ]; then - die "No handler for netroot type '$netroot'" - fi -fi - -# Source netroot hooks before we start the handler -source_hook netroot "$netif" - -# Run the handler; don't store the root, it may change from device to device -# XXX other variables to export? -[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT" -save_netinfo "$netif" - -exit 0 diff --git a/modules.d/45ifcfg/module-setup.sh b/modules.d/45ifcfg/module-setup.sh index b0d4418..cf731be 100755 --- a/modules.d/45ifcfg/module-setup.sh +++ b/modules.d/45ifcfg/module-setup.sh @@ -1,8 +1,11 @@ #!/bin/bash +# This module is deprecated. Modern replacements are NetworkManager keyfiles and +# systemd network files. It must now be explicitly opted in by the user to be +# added to the initrd. + # called by dracut check() { - [[ -d $dracutsysrootdir/etc/sysconfig/network-scripts ]] && return 0 return 255 } diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh index 5550cce..a7804b5 100755 --- a/modules.d/45ifcfg/write-ifcfg.sh +++ b/modules.d/45ifcfg/write-ifcfg.sh @@ -10,68 +10,21 @@ mkdir -m 0755 -p /tmp/ifcfg/ # shellcheck disable=SC2174 mkdir -m 0755 -p /tmp/ifcfg-leases/ -get_config_line_by_subchannel() { - local CHANNELS - local line - - CHANNELS="$1" - while read -r line || [ -n "$line" ]; do - if strstr "$line" "$CHANNELS"; then - echo "$line" - return 0 - fi - done < /etc/ccw.conf - return 1 -} - print_s390() { local _netif local SUBCHANNELS - local OPTIONS - local NETTYPE - local CONFIG_LINE local i - local channel - local OLD_IFS _netif="$1" # if we find ccw channel, then use those, instead of # of the MAC - SUBCHANNELS=$({ - for i in /sys/class/net/"$_netif"/device/cdev[0-9]*; do - [ -e "$i" ] || continue - channel=$(readlink -f "$i") - printf '%s' "${channel##*/}," - done - }) + # [iface_get_subchannels() from /lib/net-lib.sh sourced at top of this file] + SUBCHANNELS=$(iface_get_subchannels "$_netif") [ -n "$SUBCHANNELS" ] || return 1 SUBCHANNELS=${SUBCHANNELS%,} echo "SUBCHANNELS=\"${SUBCHANNELS}\"" - CONFIG_LINE=$(get_config_line_by_subchannel "$SUBCHANNELS") - # shellcheck disable=SC2181 - [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0 - - OLD_IFS=$IFS - IFS="," - # shellcheck disable=SC2086 - set -- $CONFIG_LINE - IFS=$OLD_IFS - NETTYPE=$1 - shift - SUBCHANNELS="$1" - OPTIONS="" - shift - while [ $# -gt 0 ]; do - case $1 in - *=*) OPTIONS="$OPTIONS $1" ;; - esac - shift - done - OPTIONS=${OPTIONS## } - echo "NETTYPE=\"${NETTYPE}\"" - echo "OPTIONS=\"${OPTIONS}\"" return 0 } diff --git a/modules.d/40network/dhcp-root.sh b/modules.d/45net-lib/dhcp-root.sh index 3f11221..3f11221 100755 --- a/modules.d/40network/dhcp-root.sh +++ b/modules.d/45net-lib/dhcp-root.sh diff --git a/modules.d/40network/ifname-genrules.sh b/modules.d/45net-lib/ifname-genrules.sh index b9b95c4..b9b95c4 100755 --- a/modules.d/40network/ifname-genrules.sh +++ b/modules.d/45net-lib/ifname-genrules.sh diff --git a/modules.d/45net-lib/module-setup.sh b/modules.d/45net-lib/module-setup.sh new file mode 100755 index 0000000..8053aa6 --- /dev/null +++ b/modules.d/45net-lib/module-setup.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +check() { + return 255 +} + +depends() { + echo base + return 0 +} + +install() { + inst_script "$moddir/netroot.sh" "/sbin/netroot" + inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh" + inst_hook pre-udev 50 "$moddir/ifname-genrules.sh" + inst_hook cmdline 91 "$moddir/dhcp-root.sh" + inst_multiple ip sed awk grep pgrep tr + inst_multiple -o arping arping2 + dracut_need_initqueue +} diff --git a/modules.d/40network/net-lib.sh b/modules.d/45net-lib/net-lib.sh index 9d88e0d..9d88e0d 100755 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/45net-lib/net-lib.sh diff --git a/modules.d/35connman/netroot.sh b/modules.d/45net-lib/netroot.sh index 8f97774..8f97774 100755 --- a/modules.d/35connman/netroot.sh +++ b/modules.d/45net-lib/netroot.sh diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh index 1fb3867..43a99e8 100755 --- a/modules.d/50drm/module-setup.sh +++ b/modules.d/50drm/module-setup.sh @@ -29,18 +29,22 @@ installkernel() { # as we could e.g. be in the installer; nokmsboot boot parameter will disable # loading of the driver if needed if [[ $hostonly ]]; then + local -a _mods local i modlink modname for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?,vmbus/devices}/*/modalias; do [[ -e $i ]] || continue [[ -n $(< "$i") ]] || continue - # shellcheck disable=SC2046 - if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(< "$i"); then - if strstr "$(modinfo -F filename $(< "$i") 2> /dev/null)" radeon.ko; then + mapfile -t -O "${#_mods[@]}" _mods < "$i" + done + if ((${#_mods[@]})); then + # shellcheck disable=SC2068 + if hostonly="" dracut_instmods --silent -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" ${_mods[@]}; then + if strstr "$(modinfo -F filename "${_mods[@]}" 2> /dev/null)" radeon.ko; then hostonly='' instmods amdkfd fi fi - done + fi # if there is a privacy screen then its driver must be loaded before the # kms driver will bind, otherwise its probe() will return -EPROBE_DEFER # note privacy screens always register, even with e.g. nokmsboot diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh index cc6629b..ba2fbc5 100755 --- a/modules.d/50plymouth/module-setup.sh +++ b/modules.d/50plymouth/module-setup.sh @@ -20,7 +20,9 @@ check() { [[ "$mount_needs" ]] && return 1 [[ $(pkglib_dir) ]] || return 1 - require_binaries plymouthd plymouth plymouth-set-default-theme + require_binaries plymouthd plymouth plymouth-set-default-theme || return 1 + + return 0 } # called by dracut diff --git a/modules.d/80cms/cms-write-ifcfg.sh b/modules.d/80cms/cms-write-ifcfg.sh index ecfd53e..9126309 100755 --- a/modules.d/80cms/cms-write-ifcfg.sh +++ b/modules.d/80cms/cms-write-ifcfg.sh @@ -81,21 +81,8 @@ EOF fi # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf [[ $SEARCHDNS ]] && echo "DOMAIN=\"$SEARCHDNS\"" >> "$IFCFGFILE" - [[ $NETTYPE ]] && echo "NETTYPE=$NETTYPE" >> "$IFCFGFILE" [[ $PEERID ]] && echo "PEERID=$PEERID" >> "$IFCFGFILE" - [[ $PORTNAME ]] && echo "PORTNAME=$PORTNAME" >> "$IFCFGFILE" - [[ $CTCPROT ]] && echo "CTCPROT=$CTCPROT" >> "$IFCFGFILE" [[ $MACADDR ]] && echo "MACADDR=$MACADDR" >> "$IFCFGFILE" - optstr="" - for option in LAYER2 PORTNO; do - [ -z "${!option}" ] && continue - [ -n "$optstr" ] && optstr=${optstr}" " - optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option} - done - # write single quotes since network.py removes double quotes but we need quotes - echo "OPTIONS='$optstr'" >> "$IFCFGFILE" - unset option - unset optstr unset DNS1 unset DNS2 echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh index 68e4563..5e5b926 100755 --- a/modules.d/80cms/cmssetup.sh +++ b/modules.d/80cms/cmssetup.sh @@ -1,35 +1,18 @@ #!/bin/bash type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh - -function sysecho() { - file="$1" - shift - local i=1 - while [ $i -le 10 ]; do - if [ ! -f "$file" ]; then - sleep 1 - i=$((i + 1)) - else - break - fi - done - local status - read -r status < "$file" - if [[ $status != "$*" ]]; then - [ -f "$file" ] && echo "$*" > "$file" - fi -} +type zdev_parse_dasd_list > /dev/null 2>&1 || . /lib/s390-tools/zdev-from-dasd_mod.dasd function dasd_settle() { - local dasd_status=/sys/bus/ccw/devices/$1/status + local dasd_status + dasd_status=$(lszdev dasd "$1" --columns ATTRPATH:status --no-headings --active) if [ ! -f "$dasd_status" ]; then return 1 fi local i=1 while [ $i -le 60 ]; do local status - read -r status < "$dasd_status" + status=$(lszdev dasd "$1" --columns ATTR:status --no-headings --active) case $status in online | unformatted) return 0 @@ -43,77 +26,23 @@ function dasd_settle() { return 1 } -function dasd_settle_all() { - for dasdccw in $(while read -r line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices); do - if ! dasd_settle "$dasdccw"; then - echo $"Could not access DASD $dasdccw in time" - return 1 - fi - done - return 0 -} - -# prints a canonocalized device bus ID for a given devno of any format -function canonicalize_devno() { - case ${#1} in - 3) echo "0.0.0${1}" ;; - 4) echo "0.0.${1}" ;; - *) echo "${1}" ;; - esac - return 0 -} - # read file from CMS and write it to /tmp function readcmsfile() { # $1=dasdport $2=filename local dev - local numcpus local devname local ret=0 if [ $# -ne 2 ]; then return; fi - # precondition: udevd created dasda block device node - if ! dasd_cio_free -d "$1"; then - echo $"DASD $1 could not be cleared from device blacklist" - return 1 - fi - - modprobe dasd_mod dasd="$CMSDASD" - modprobe dasd_eckd_mod - udevadm settle - - # precondition: dasd_eckd_mod driver incl. dependencies loaded, - # dasd_mod must be loaded without setting any DASD online - dev=$(canonicalize_devno "$1") - numcpus=$( - while read -r line || [ -n "$line" ]; do - if strstr "$line" "# processors"; then - echo "${line##*:}" - break - fi - done < /proc/cpuinfo - ) + # precondition: udevd created block device node - if [ "${numcpus}" -eq 1 ]; then - echo 1 > /sys/bus/ccw/devices/"$dev"/online - else - if ! sysecho /sys/bus/ccw/devices/"$dev"/online 1; then - echo $"DASD $dev could not be set online" - return 1 - fi - udevadm settle - if ! dasd_settle "$dev"; then - echo $"Could not access DASD $dev in time" - return 1 - fi + dev="$1" + chzdev --enable --active --yes --quiet --no-root-update --force dasd "$dev" || return 1 + if ! dasd_settle "$dev"; then + echo $"Could not access DASD $dev in time" + return 1 fi - udevadm settle - - devname=$( - cd /sys/bus/ccw/devices/"$dev"/block || exit - set -- * - [ -b /dev/"$1" ] && echo "$1" - ) - devname=${devname:-dasda} + devname=$(lszdev dasd "$dev" --columns NAMES --no-headings --active) + [[ -n $devname ]] || return 1 [[ -d /mnt ]] || mkdir -p /mnt if cmsfs-fuse --to=UTF-8 -a /dev/"$devname" /mnt; then @@ -125,20 +54,22 @@ function readcmsfile() { # $1=dasdport $2=filename ret=1 fi - if ! sysecho /sys/bus/ccw/devices/"$dev"/online 0; then - echo $"DASD $dev could not be set offline again" - #return 1 - fi - udevadm settle + chzdev --disable --active --yes --quiet --no-root-update --force dasd "$dev" # unbind all dasds to unload the dasd modules for a clean start ( cd /sys/bus/ccw/drivers/dasd-eckd || exit - for i in *.*; do echo "$i" > unbind; done + for i in *.*; do echo "$i" > unbind 2> /dev/null; done + ) + ( + cd /sys/bus/ccw/drivers/dasd-fba || exit + for i in *.*; do echo "$i" > unbind 2> /dev/null; done ) udevadm settle modprobe -r dasd_eckd_mod udevadm settle + modprobe -r dasd_fba_mod + udevadm settle modprobe -r dasd_diag_mod udevadm settle modprobe -r dasd_mod @@ -151,13 +82,19 @@ processcmsfile() { SUBCHANNELS="$(echo "$SUBCHANNELS" | sed 'y/ABCDEF/abcdef/')" if [[ $NETTYPE ]]; then - ( - echo -n "$NETTYPE","$SUBCHANNELS" - [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME" - [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2" - [[ $NETTYPE == "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT" - echo - ) >> /etc/ccw.conf + _cms_attrs="" + if [[ $PORTNAME ]]; then + if [[ $NETTYPE == lcs ]]; then + _cms_attrs="$_cms_attrs portno=$PORTNAME" + else + _cms_attrs="$_cms_attrs portname=$PORTNAME" + fi + fi + [[ $LAYER2 ]] && _cms_attrs="$_cms_attrs layer2=$LAYER2" + [[ $CTCPROT ]] && _cms_attrs="$_cms_attrs protocol=$CTCPROT" + # shellcheck disable=SC2086 + chzdev --enable --persistent --yes --no-root-update --force \ + "$NETTYPE" "$SUBCHANNELS" $_cms_attrs 2>&1 | vinfo OLDIFS=$IFS IFS=, @@ -178,16 +115,13 @@ processcmsfile() { [[ -f /etc/udev/rules.d/90-net.rules ]] \ || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$name source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules udevadm control --reload - znet_cio_free fi if [[ $DASD ]] && [[ $DASD != "none" ]]; then - echo "$DASD" | normalize_dasd_arg > /etc/dasd.conf - echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf - dasd_cio_free + echo "$DASD" | zdev_parse_dasd_list globals 2>&1 | vinfo + echo "$DASD" | zdev_parse_dasd_list ranges 2>&1 | vinfo fi - unset _do_zfcp for i in ${!FCP_*}; do echo "${!i}" | while read -r port rest || [ -n "$port" ]; do case $port in @@ -200,12 +134,24 @@ processcmsfile() { port="0.0.$port" ;; esac - echo "$port" "$rest" >> /etc/zfcp.conf + # shellcheck disable=SC2086 + set -- $rest + SAVED_IFS="$IFS" + IFS=":" + # Intentionally do not dynamically activate now, but only generate udev + # rules, which activate the device later during udev coldplug. + if [[ -z $rest ]]; then + chzdev --enable --persistent \ + --no-settle --yes --quiet --no-root-update --force \ + zfcp-host "$port" 2>&1 | vinfo + else + chzdev --enable --persistent \ + --no-settle --yes --quiet --no-root-update --force \ + zfcp-lun "$port:$*" 2>&1 | vinfo + fi + IFS="$SAVED_IFS" done - _do_zfcp=1 done - [[ $_do_zfcp ]] && zfcp_cio_free - unset _do_zfcp } [[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=") diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh index 2b280e0..5b33cd1 100755 --- a/modules.d/80cms/module-setup.sh +++ b/modules.d/80cms/module-setup.sh @@ -4,6 +4,7 @@ check() { arch=${DRACUT_ARCH:-$(uname -m)} [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 + require_binaries chzdev lszdev || return 1 return 255 } @@ -11,13 +12,13 @@ check() { depends() { arch=${DRACUT_ARCH:-$(uname -m)} [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - echo znet zfcp dasd dasd_mod bash + echo znet bash return 0 } # called by dracut installkernel() { - instmods zfcp + instmods zfcp dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod } # called by dracut @@ -27,8 +28,8 @@ install() { inst_script "$moddir/cmsifup.sh" /sbin/cmsifup # shellcheck disable=SC2046 inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ - cmsfs-fuse fusermount bash insmod rmmod cat normalize_dasd_arg sed \ - $(rpm -ql s390utils-base) awk getopt + cmsfs-fuse fusermount bash insmod rmmod cat /lib/s390-tools/zdev-from-dasd_mod.dasd sed \ + awk getopt chzdev lszdev inst_libdir_file "gconv/*" #inst /usr/lib/locale/locale-archive diff --git a/modules.d/80test-makeroot/module-setup.sh b/modules.d/80test-makeroot/module-setup.sh index eb6fb74..f311e4a 100755 --- a/modules.d/80test-makeroot/module-setup.sh +++ b/modules.d/80test-makeroot/module-setup.sh @@ -14,6 +14,13 @@ installkernel() { } install() { - inst_multiple poweroff cp umount sync dd + # do not compress, do not strip + export compress="cat" + export do_strip="no" + export do_hardlink="no" + export early_microcode="no" + export hostonly_cmdline="no" + + inst_multiple poweroff cp umount sync dd mkfs.ext4 inst_hook initqueue/finished 01 "$moddir/finished-false.sh" } diff --git a/modules.d/80test-root/module-setup.sh b/modules.d/80test-root/module-setup.sh index 24605c5..64d618f 100755 --- a/modules.d/80test-root/module-setup.sh +++ b/modules.d/80test-root/module-setup.sh @@ -6,10 +6,17 @@ check() { } depends() { - echo "debug" + echo debug } install() { + # do not compress, do not strip + export compress="cat" + export do_strip="no" + export do_hardlink="no" + export early_microcode="no" + export hostonly_cmdline="no" + inst_simple /etc/os-release inst_multiple mkdir ln dd stty mount poweroff umount setsid sync @@ -23,5 +30,10 @@ install() { ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" + inst_script "${dracutbasedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" + inst_script "${dracutbasedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" + + inst_script "$moddir/test-init.sh" "/sbin/init" + inst_multiple -o plymouth } diff --git a/modules.d/80test-root/test-init.sh b/modules.d/80test-root/test-init.sh new file mode 100755 index 0000000..bd6e485 --- /dev/null +++ b/modules.d/80test-root/test-init.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +export PATH=/usr/sbin:/usr/bin:/sbin:/bin + +[ -e /proc/self/mounts ] \ + || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc) + +grep -q '^sysfs /sys sysfs' /proc/self/mounts \ + || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys) + +grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \ + || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev) + +grep -q '^tmpfs /run tmpfs' /proc/self/mounts \ + || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run) + +: > /dev/watchdog + +exec > /dev/console 2>&1 + +if [ -s /failed ]; then + echo "**************************FAILED**************************" + cat /failed + echo "**************************FAILED**************************" +else + echo "dracut-root-block-success" | dd oflag=direct,dsync status=none of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker + echo "All OK" +fi + +export TERM=linux +export PS1='initramfs-test:\w\$ ' +[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab +[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab +stty sane +echo "made it to the rootfs!" + +. /lib/dracut-lib.sh + +if getargbool 0 rd.shell; then + strstr "$(setsid --help)" "control" && CTTY="-c" + # shellcheck disable=SC2086 + setsid $CTTY sh -i +fi + +echo "Powering down." +mount -n -o remount,ro / +if [ -d /run/initramfs/etc ]; then + echo " rd.debug=0 " >> /run/initramfs/etc/cmdline +fi +poweroff -f diff --git a/modules.d/80test/hard-off.sh b/modules.d/80test/hard-off.sh index 01acb19..cf44fb0 100755 --- a/modules.d/80test/hard-off.sh +++ b/modules.d/80test/hard-off.sh @@ -1,3 +1,3 @@ #!/bin/sh getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f +! getargbool 0 rd.break && getargbool 0 failme && poweroff -f diff --git a/modules.d/80test/module-setup.sh b/modules.d/80test/module-setup.sh index 96041a9..7560e05 100755 --- a/modules.d/80test/module-setup.sh +++ b/modules.d/80test/module-setup.sh @@ -6,10 +6,29 @@ check() { } depends() { - echo "debug" + echo "base debug qemu watchdog" +} + +installkernel() { + instmods \ + ata_piix \ + ext4 \ + i6300esb \ + ide-gd_mod \ + piix \ + sd_mod \ + virtio_pci \ + virtio_scsi } install() { + # do not compress, do not strip + export compress="cat" + export do_strip="no" + export do_hardlink="no" + export early_microcode="no" + export hostonly_cmdline="no" + inst poweroff inst_hook shutdown-emergency 000 "$moddir/hard-off.sh" inst_hook emergency 000 "$moddir/hard-off.sh" diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh index d5ac45b..8d24825 100755 --- a/modules.d/90crypt/module-setup.sh +++ b/modules.d/90crypt/module-setup.sh @@ -18,21 +18,7 @@ check() { # called by dracut depends() { - local deps - deps="dm rootfs-block" - if [[ $hostonly && -f "$dracutsysrootdir"/etc/crypttab ]]; then - if grep -q -e "fido2-device=" -e "fido2-cid=" "$dracutsysrootdir"/etc/crypttab; then - deps+=" fido2" - fi - if grep -q "pkcs11-uri" "$dracutsysrootdir"/etc/crypttab; then - deps+=" pkcs11" - fi - if grep -q "tpm2-device=" "$dracutsysrootdir"/etc/crypttab; then - deps+=" tpm2-tss" - fi - fi - echo "$deps" - return 0 + echo dm rootfs-block } # called by dracut @@ -160,22 +146,6 @@ install() { inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh" inst_script "$moddir/crypt-run-generator.sh" "/sbin/crypt-run-generator" - if dracut_module_included "systemd"; then - # the cryptsetup targets are already pulled in by 00systemd, but not - # the enablement symlinks - inst_multiple -o \ - "$tmpfilesdir"/cryptsetup.conf \ - "$systemdutildir"/system-generators/systemd-cryptsetup-generator \ - "$systemdutildir"/systemd-cryptsetup \ - "$systemdsystemunitdir"/systemd-ask-password-console.path \ - "$systemdsystemunitdir"/systemd-ask-password-console.service \ - "$systemdsystemunitdir"/cryptsetup.target \ - "$systemdsystemunitdir"/sysinit.target.wants/cryptsetup.target \ - "$systemdsystemunitdir"/remote-cryptsetup.target \ - "$systemdsystemunitdir"/initrd-root-device.target.wants/remote-cryptsetup.target \ - systemd-ask-password systemd-tty-ask-password-agent - fi - # Install required libraries. _arch=${DRACUT_ARCH:-$(uname -m)} inst_libdir_file \ diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh index e46e347..39fc6d2 100755 --- a/modules.d/90crypt/parse-crypt.sh +++ b/modules.d/90crypt/parse-crypt.sh @@ -174,7 +174,7 @@ else } >> "$hookdir/emergency/90-crypt.sh" fi done - elif getargbool 0 rd.auto; then + elif getargbool 1 rd.auto; then if [ -z "$DRACUT_SYSTEMD" ]; then { printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)" diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh index bd7134a..93b62bb 100755 --- a/modules.d/90dm/dm-shutdown.sh +++ b/modules.d/90dm/dm-shutdown.sh @@ -2,26 +2,40 @@ _remove_dm() { local dev="$1" + local final="$2" local s local devname for s in /sys/block/"${dev}"/holders/dm-*; do [ -e "${s}" ] || continue - _remove_dm "${s##*/}" + _remove_dm "${s##*/}" "$final" || return $? done - # multipath devices might have MD devices on top, - # which are removed after this script. So do not - # remove those to avoid spurious errors + + read -r devname < /sys/block/"${dev}"/dm/name case $(cat /sys/block/"${dev}"/dm/uuid) in mpath-*) + # multipath devices might have MD devices on top, + # which are removed after this script. So do not + # remove those to avoid spurious errors return 0 ;; - *) - read -r devname < /sys/block/"${dev}"/dm/name - dmsetup -v --noudevsync remove "$devname" || return $? + CRYPT-*) + if command -v systemd-cryptsetup > /dev/null; then + DM_DISABLE_UDEV=true SYSTEMD_LOG_LEVEL=debug systemd-cryptsetup detach "$devname" && return 0 + elif command -v cryptsetup > /dev/null; then + DM_DISABLE_UDEV=true cryptsetup close --debug "$devname" && return 0 + else + dmsetup -v --noudevsync remove "$devname" + return $? + fi + + # try using plain dmsetup if we're on the final attempt. + [ -z "$final" ] && return 1 ;; esac - return 0 + + dmsetup -v --noudevsync remove "$devname" + return $? } _do_dm_shutdown() { @@ -33,9 +47,9 @@ _do_dm_shutdown() { for dev in /sys/block/dm-*; do [ -e "${dev}" ] || continue if [ "x$final" != "x" ]; then - _remove_dm "${dev##*/}" || ret=$? + _remove_dm "${dev##*/}" "$final" || ret=$? else - _remove_dm "${dev##*/}" > /dev/null 2>&1 || ret=$? + _remove_dm "${dev##*/}" "$final" > /dev/null 2>&1 || ret=$? fi done if [ "x$final" != "x" ]; then diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index e808339..4518852 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -59,27 +59,34 @@ get_check_dev() { echo "$_udevinfo" | grep "DEVNAME=" | sed 's/DEVNAME=//' } -# Find the right device to run check on -check_dev=$(get_check_dev "$livedev") -# CD/DVD media check -[ -b "$check_dev" ] && fs=$(det_fs "$check_dev") -if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then - check="yes" -fi -getarg rd.live.check -d check || check="" -if [ -n "$check" ]; then - type plymouth > /dev/null 2>&1 && plymouth --hide-splash - if [ -n "$DRACUT_SYSTEMD" ]; then - p=$(dev_unit_name "$check_dev") - systemctl start checkisomd5@"${p}".service - else - checkisomd5 --verbose "$check_dev" +# Check ISO checksum only if we have a path to a block device (or just its name +# without '/dev'). In other words, in this context, we perform the check only +# if the given $livedev is not a filesystem file image. +if [ ! -f "$livedev" ]; then + # Find the right device to run check on + check_dev=$(get_check_dev "$livedev") + # CD/DVD media check + [ -b "$check_dev" ] && fs=$(det_fs "$check_dev") + if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then + check="yes" fi - if [ $? -eq 1 ]; then - die "CD check failed!" - exit 1 + getarg rd.live.check -d check || check="" + if [ -n "$check" ]; then + type plymouth > /dev/null 2>&1 && plymouth --hide-splash + if [ -n "$DRACUT_SYSTEMD" ]; then + p=$(dev_unit_name "$check_dev") + systemctl start checkisomd5@"${p}".service + else + checkisomd5 --verbose "$check_dev" + fi + if [ $? -eq 1 ]; then + warn "Media check failed! We do not recommend using this medium. System will halt in 12 hours" + sleep 43200 + die "Media check failed!" + exit 1 + fi + type plymouth > /dev/null 2>&1 && plymouth --show-splash fi - type plymouth > /dev/null 2>&1 && plymouth --show-splash fi ln -s "$livedev" /run/initramfs/livedev @@ -109,7 +116,7 @@ if [ -f "$livedev" ]; then auto) die "cannot mount live image (unknown filesystem type)" ;; *) FSIMG=$livedev ;; esac - [ -e /sys/fs/"$fstype" ] || modprobe "$fstype" + load_fstype "$fstype" else livedev_fstype=$(det_fs "$livedev") if [ "$livedev_fstype" = "squashfs" ]; then @@ -143,6 +150,8 @@ do_live_overlay() { if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then pathspec="/${live_dir}/overlay-$l-$u" + elif ! str_starts "$pathspec" "/"; then + pathspec=/"${pathspec}" fi devspec=${overlay%%:*} @@ -296,7 +305,7 @@ do_live_overlay() { dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0" # Create a snapshot of the base image - echo 0 "$sz" thin /dev/mapper/live-overlay-pool 0 "$base" | dmsetup create live-rw + echo 0 "$thin_data_sz" thin /dev/mapper/live-overlay-pool 0 "$base" | dmsetup create live-rw elif [ -z "$overlayfs" ]; then echo 0 "$sz" snapshot "$base" "$over" PO 8 | dmsetup create live-rw fi diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh index e217512..ec60f39 100755 --- a/modules.d/90kernel-modules/module-setup.sh +++ b/modules.d/90kernel-modules/module-setup.sh @@ -55,10 +55,10 @@ installkernel() { "=drivers/watchdog" instmods \ - yenta_socket spi_pxa2xx_platform \ - atkbd i8042 firewire-ohci pcmcia hv-vmbus \ + yenta_socket intel_lpss_pci spi_pxa2xx_platform \ + atkbd i8042 firewire-ohci hv-vmbus \ virtio virtio_ring virtio_pci pci_hyperv \ - "=drivers/pcmcia" + surface_aggregator_registry psmouse if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 || ${DRACUT_ARCH:-$(uname -m)} == riscv* ]]; then # arm/aarch64 specific modules @@ -87,6 +87,7 @@ installkernel() { "=drivers/rtc" \ "=drivers/soc" \ "=drivers/spi" \ + "=drivers/spmi" \ "=drivers/usb/chipidea" \ "=drivers/usb/dwc2" \ "=drivers/usb/dwc3" \ @@ -95,7 +96,8 @@ installkernel() { "=drivers/usb/misc" \ "=drivers/usb/musb" \ "=drivers/usb/phy" \ - "=drivers/scsi/hisi_sas" + "=drivers/scsi/hisi_sas" \ + "=net/qrtr" fi awk -F: '/^\// {print $1}' "$srcmods/modules.dep" 2> /dev/null | instmods diff --git a/modules.d/90kernel-modules/parse-kernel.sh b/modules.d/90kernel-modules/parse-kernel.sh index d14f912..218a3e0 100755 --- a/modules.d/90kernel-modules/parse-kernel.sh +++ b/modules.d/90kernel-modules/parse-kernel.sh @@ -1,11 +1,7 @@ #!/bin/sh -_modprobe_d=/etc/modprobe.d -if [ -d /usr/lib/modprobe.d ]; then - _modprobe_d=/usr/lib/modprobe.d -elif [ -d /lib/modprobe.d ]; then - _modprobe_d=/lib/modprobe.d -elif [ ! -d $_modprobe_d ]; then +_modprobe_d=/run/modprobe.d +if [ ! -d $_modprobe_d ]; then mkdir -p $_modprobe_d fi @@ -18,8 +14,6 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do ) done -[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d - for i in $(getargs rd.driver.blacklist -d rdblacklist=); do ( IFS=, diff --git a/modules.d/90livenet/livenetroot.sh b/modules.d/90livenet/livenetroot.sh index 66dd41b..34f91ff 100755 --- a/modules.d/90livenet/livenetroot.sh +++ b/modules.d/90livenet/livenetroot.sh @@ -17,10 +17,21 @@ liveurl="${netroot#livenet:}" info "fetching $liveurl" if getargbool 0 'rd.writable.fsimg'; then + imgheader=$(curl -sIL "$liveurl") - imgsize=$(($(curl -sIL "$liveurl" | sed -n 's/Content-Length: *\([[:digit:]]*\).*/\1/p') / (1024 * 1024))) - - check_live_ram $imgsize + # shellcheck disable=SC2181 + ret=$? + if [ $ret != 0 ]; then + warn "failed to get live image header: error $ret" + else + imgheaderlen=$(echo "$imgheader" | sed -n 's/[cC]ontent-[lL]ength: *\([[:digit:]]*\).*/\1/p') + if [ -z "$imgheaderlen" ]; then + warn "failed to get 'Content-Length' header from live image" + else + imgsize=$((imgheaderlen / (1024 * 1024))) + check_live_ram $imgsize + fi + fi fi imgfile= @@ -30,8 +41,9 @@ while [ "$i" -le "$RETRIES" ]; do imgfile=$(fetch_url "$liveurl") # shellcheck disable=SC2181 - if [ $? != 0 ]; then - warn "failed to download live image: error $?" + ret=$? + if [ $ret != 0 ]; then + warn "failed to download live image: error $ret" imgfile= fi diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh index 9c3e629..782a880 100755 --- a/modules.d/90multipath/module-setup.sh +++ b/modules.d/90multipath/module-setup.sh @@ -126,7 +126,7 @@ install() { inst_libdir_file "libmultipath*" "multipath/*" inst_libdir_file 'libgcc_s.so*' - if [[ $hostonly_cmdline ]]; then + if [[ $hostonly_cmdline == "yes" ]]; then local _conf _conf=$(cmdline) [[ $_conf ]] && echo "$_conf" >> "${initdir}/etc/cmdline.d/90multipath.conf" diff --git a/modules.d/90multipath/multipathd-configure.service b/modules.d/90multipath/multipathd-configure.service index a2baec7..dba5a68 100644 --- a/modules.d/90multipath/multipathd-configure.service +++ b/modules.d/90multipath/multipathd-configure.service @@ -1,8 +1,8 @@ [Unit] Description=Device-Mapper Multipath Default Configuration -Before=iscsi.service iscsid.service lvm2-activation-early.service -Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target -After=systemd-udev-trigger.service systemd-udev-settle.service +Before=lvm2-activation-early.service +Wants=local-fs-pre.target +After=systemd-journald.socket Before=local-fs-pre.target multipathd.service DefaultDependencies=no Conflicts=shutdown.target diff --git a/modules.d/90numlock/module-setup.sh b/modules.d/90numlock/module-setup.sh new file mode 100755 index 0000000..c4cd2dd --- /dev/null +++ b/modules.d/90numlock/module-setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# This file is part of dracut. +# SPDX-License-Identifier: GPL-2.0-or-later + +# Prerequisite check(s) for module. +check() { + + # If the binary(s) requirements are not fulfilled the module can't be installed. + require_binaries setleds || return 1 + + # Return 255 to only include the module, if another module requires it. + return 255 +} + +# Module dependency requirements. +depends() { + # This module has external dependency on other module(s). + echo base + # Return 0 to include the dependent module(s) in the initramfs. + return 0 +} + +# Install the required file(s) and directories for the module in the initramfs. +install() { + inst_multiple \ + setleds + + inst_hook initqueue/settled 90 "$moddir/numlock.sh" +} diff --git a/modules.d/90numlock/numlock.sh b/modules.d/90numlock/numlock.sh new file mode 100755 index 0000000..48aa39d --- /dev/null +++ b/modules.d/90numlock/numlock.sh @@ -0,0 +1,7 @@ +#!/bin/sh +i=1 +# 6 is the default value of the NAutoVTs option of the systemd login manager +while [ "${i}" -le 6 ]; do + setleds -D +num < /dev/tty"${i}" + i=$((i + 1)) +done diff --git a/modules.d/90overlayfs/module-setup.sh b/modules.d/90overlayfs/module-setup.sh index 893e2dc..dae2009 100755 --- a/modules.d/90overlayfs/module-setup.sh +++ b/modules.d/90overlayfs/module-setup.sh @@ -1,7 +1,7 @@ #!/bin/bash check() { - [[ $hostonly ]] && return 1 + require_kernel_modules overlay || return 1 return 255 } @@ -10,10 +10,11 @@ depends() { } installkernel() { - instmods overlay + hostonly="" instmods overlay } install() { - inst_hook mount 01 "$moddir/mount-overlayfs.sh" inst_hook pre-mount 01 "$moddir/prepare-overlayfs.sh" + inst_hook mount 01 "$moddir/mount-overlayfs.sh" # overlay on top of block device + inst_hook pre-pivot 10 "$moddir/mount-overlayfs.sh" # overlay on top of network device (e.g. nfs) } diff --git a/modules.d/90pcmcia/module-setup.sh b/modules.d/90pcmcia/module-setup.sh new file mode 100755 index 0000000..b11e8f1 --- /dev/null +++ b/modules.d/90pcmcia/module-setup.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# called by dracut +check() { + return 0 +} + +# called by dracut +depends() { + echo udev-rules + return 0 +} + +# called by dracut +installkernel() { + instmods pcmcia \ + "=drivers/pcmcia" +} + +# called by dracut +install() { + inst_rules 60-pcmcia.rules + + inst_multiple -o \ + "${udevdir}"/pcmcia-socket-startup \ + "${udevdir}"/pcmcia-check-broken-cis + + # Install the hosts local user configurations if enabled. + if [[ $hostonly ]]; then + inst_multiple -H -o \ + /etc/pcmcia/config.opts + fi +} diff --git a/modules.d/90systemd-cryptsetup/module-setup.sh b/modules.d/90systemd-cryptsetup/module-setup.sh new file mode 100755 index 0000000..da37bde --- /dev/null +++ b/modules.d/90systemd-cryptsetup/module-setup.sh @@ -0,0 +1,120 @@ +#!/bin/bash + +# called by dracut +check() { + local fs + # if cryptsetup is not installed, then we cannot support encrypted devices. + require_any_binary "$systemdutildir"/systemd-cryptsetup || return 1 + + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in "${host_fs_types[@]}"; do + [[ $fs == "crypto_LUKS" ]] && return 0 + done + return 255 + } + + return 0 +} + +# called by dracut +depends() { + local deps + deps="dm rootfs-block crypt systemd-ask-password" + if [[ $hostonly && -f "$dracutsysrootdir"/etc/crypttab ]]; then + if grep -q -e "fido2-device=" -e "fido2-cid=" "$dracutsysrootdir"/etc/crypttab; then + deps+=" fido2" + fi + if grep -q "pkcs11-uri" "$dracutsysrootdir"/etc/crypttab; then + deps+=" pkcs11" + fi + if grep -q "tpm2-device=" "$dracutsysrootdir"/etc/crypttab; then + deps+=" tpm2-tss" + fi + elif [[ ! $hostonly ]]; then + for module in fido2 pkcs11 tpm2-tss; do + module_check $module > /dev/null 2>&1 + if [[ $? == 255 ]]; then + deps+=" $module" + fi + done + fi + echo "$deps" + return 0 +} + +# called by dracut +install() { + # the cryptsetup targets are already pulled in by 00systemd, but not + # the enablement symlinks + inst_multiple -o \ + "$tmpfilesdir"/cryptsetup.conf \ + "$systemdutildir"/system-generators/systemd-cryptsetup-generator \ + "$systemdutildir"/systemd-cryptsetup \ + "$systemdsystemunitdir"/cryptsetup.target \ + "$systemdsystemunitdir"/sysinit.target.wants/cryptsetup.target \ + "$systemdsystemunitdir"/remote-cryptsetup.target \ + "$systemdsystemunitdir"/initrd-root-device.target.wants/remote-cryptsetup.target + + if [[ $hostonly ]] && [[ -f $initdir/etc/crypttab ]]; then + # for each entry in /etc/crypttab check if the key file is backed by a socket unit and if so, + # include it along with its corresponding service unit. + while read -r _mapper _dev _luksfile _luksoptions || [[ -n $_mapper ]]; do + # ignore paths followed by a device specification + if [[ $_luksfile == *":"* ]]; then + return + fi + + # if no explicit path is provided, try to include units for auto-discoverable keys + if [[ -z $_luksfile ]] || [[ $_luksfile == "-" ]] || [[ $_luksfile == "none" ]]; then + _luksfile="/run/cryptsetup-keys.d/$_mapper.key" + fi + + find "$systemdsystemunitdir" "$systemdsystemconfdir" -type f -name "*.socket" | while read -r socket_unit; do + # systemd-cryptsetup utility only supports SOCK_STREAM (ListenStream) sockets, so we ignore + # other types like SOCK_DGRAM (ListenDatagram), SOCK_SEQPACKET (ListenSequentialPacket), etc. + if ! grep -E -q "^ListenStream\s*=\s*$_luksfile$" "$socket_unit"; then + continue + fi + + service_name=$(grep -E "^Service\s*=\s*" "$socket_unit" | cut -d= -f2) + + if [ -z "$service_name" ]; then + # if no explicit Service= is defined, construct the service name based on the socket unit's name + if grep -P -q "^Accept\s*=\s*(?i)(1|yes|y|true|t|on)$" "$socket_unit"; then + # if Accept is truthy, assemble a service template + service_name=$(basename "$socket_unit" .socket)"@.service" + else + # otherwise, just replace .socket with .service + service_name=$(basename "$socket_unit" .socket)".service" + fi + fi + + # this assumes the service file is in the same directory as the socket file, + # which is a common configuration but not guaranteed. + if ! inst_multiple -H "${socket_unit%/*}/$service_name" "$socket_unit"; then + continue + fi + + # sanity check - all units which use default dependencies will depend on sysinit.target, + # which itself depends on cryptsetup.target. This could lead to either: + # a) systemd-cryptsetup falling back to a passphrase prompt due to a missing socket file + # b) a deadlock caused by a circular dependency (service unit -> sysinit.target -> cryptsetup.target -> service unit) + if ! grep -P -q "^DefaultDependencies\s*=\s*(?i)(0|no|n|false|f|off)" "$socket_unit"; then + dwarning "crypt: $socket_unit: default dependencies are not disabled," \ + "the socket file may not exist by the time systemd-cryptsetup gets executed" + fi + + if ! grep -P -q "^DefaultDependencies\s*=\s*(?i)(0|no|n|false|f|off)" "${socket_unit%/*}/$service_name"; then + dwarning "crypt: ${socket_unit%/*}/$service_name: default dependencies are not disabled," \ + "the service unit may encounter a deadlock due to a circular dependency" + fi + + socket_unit_basename=$(basename "$socket_unit") + inst_multiple -H -o \ + "$systemdsystemunitdir"/sockets.target.wants/"$socket_unit_basename" \ + "$systemdsystemconfdir"/sockets.target.wants/"$socket_unit_basename" + break + done + done < "$initdir"/etc/crypttab + fi +} diff --git a/modules.d/91crypt-gpg/crypt-gpg-lib.sh b/modules.d/91crypt-gpg/crypt-gpg-lib.sh index 538419f..59fb4d3 100755 --- a/modules.d/91crypt-gpg/crypt-gpg-lib.sh +++ b/modules.d/91crypt-gpg/crypt-gpg-lib.sh @@ -41,13 +41,13 @@ gpg_decrypt() { echo "allow-loopback-pinentry" >> "$gpghome/gpg-agent.conf" GNUPGHOME="$gpghome" gpg-agent --quiet --daemon GNUPGHOME="$gpghome" gpg --quiet --no-tty --import < /root/crypt-public-key.gpg + GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null learn /bye local smartcardSerialNumber smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \ | sed -n -r -e 's|Serial number.*: ([0-9]*)|\1|p' | tr -d '\n')" if [ -n "${smartcardSerialNumber}" ]; then inputPrompt="PIN (OpenPGP card ${smartcardSerialNumber})" fi - GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null learn /bye opts="$opts --pinentry-mode=loopback" cmd="GNUPGHOME=$gpghome gpg --card-status --no-tty > /dev/null 2>&1; gpg $opts --decrypt $mntp/$keypath" else diff --git a/modules.d/91crypt-gpg/module-setup.sh b/modules.d/91crypt-gpg/module-setup.sh index 501869a..523cfce 100755 --- a/modules.d/91crypt-gpg/module-setup.sh +++ b/modules.d/91crypt-gpg/module-setup.sh @@ -3,7 +3,7 @@ # GPG support is optional # called by dracut check() { - require_binaries gpg tr || return 1 + require_binaries gpg tr stty || return 1 if sc_requested; then if ! sc_supported; then @@ -23,7 +23,7 @@ depends() { # called by dracut install() { - inst_multiple gpg tr + inst_multiple gpg tr stty inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh" if sc_requested; then diff --git a/modules.d/91pcsc/module-setup.sh b/modules.d/91pcsc/module-setup.sh index 6f8b2c8..26b463d 100755 --- a/modules.d/91pcsc/module-setup.sh +++ b/modules.d/91pcsc/module-setup.sh @@ -29,7 +29,8 @@ install() { inst_simple "$moddir/pcscd.socket" "${systemdsystemunitdir}"/pcscd.socket inst_multiple -o \ - pcscd + pcscd \ + /usr/share/p11-kit/modules/opensc.module # Enable systemd type unit(s) for i in \ diff --git a/modules.d/91pcsc/pcscd.service b/modules.d/91pcsc/pcscd.service index 639decd..7d4e0a2 100644 --- a/modules.d/91pcsc/pcscd.service +++ b/modules.d/91pcsc/pcscd.service @@ -5,7 +5,7 @@ Documentation=man:pcscd(8) Requires=pcscd.socket [Service] -ExecStart=/usr/sbin/pcscd --foreground --auto-exit +ExecStart=/usr/sbin/pcscd --foreground --auto-exit --disable-polkit ExecReload=/usr/sbin/pcscd --hotplug [Install] diff --git a/modules.d/91tpm2-tss/module-setup.sh b/modules.d/91tpm2-tss/module-setup.sh index e145c41..4106e3e 100755 --- a/modules.d/91tpm2-tss/module-setup.sh +++ b/modules.d/91tpm2-tss/module-setup.sh @@ -35,6 +35,8 @@ install() { "$sysusers"/tpm2-tss.conf \ "$tmpfilesdir"/tpm2-tss-fapi.conf \ "$udevrulesdir"/60-tpm-udev.rules \ + "$systemdutildir"/system-generators/systemd-tpm2-generator \ + "$systemdsystemunitdir/tpm2.target" \ tpm2_pcrread tpm2_pcrextend tpm2_createprimary tpm2_createpolicy \ tpm2_create tpm2_load tpm2_unseal tpm2 diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh index 180da14..825f95d 100755 --- a/modules.d/95dasd/module-setup.sh +++ b/modules.d/95dasd/module-setup.sh @@ -4,20 +4,18 @@ check() { local _arch=${DRACUT_ARCH:-$(uname -m)} [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 - require_binaries normalize_dasd_arg || return 1 + require_binaries dasdconf.sh || return 1 return 0 } # called by dracut depends() { - echo "dasd_mod" return 0 } # called by dracut install() { - inst_hook cmdline 30 "$moddir/parse-dasd.sh" - inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg + inst_multiple dasdconf.sh conf=/etc/dasd.conf if [[ $hostonly && -f $conf ]]; then inst -H $conf diff --git a/modules.d/95dasd/parse-dasd.sh b/modules.d/95dasd/parse-dasd.sh deleted file mode 100755 index cda3970..0000000 --- a/modules.d/95dasd/parse-dasd.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do - ( - local OLDIFS="$IFS" - IFS="," - # shellcheck disable=SC2086 - set -- $dasd_arg - IFS="$OLDIFS" - echo "$@" | normalize_dasd_arg >> /etc/dasd.conf - ) -done diff --git a/modules.d/95dasd_mod/module-setup.sh b/modules.d/95dasd_mod/module-setup.sh index c59dd3a..155eaac 100755 --- a/modules.d/95dasd_mod/module-setup.sh +++ b/modules.d/95dasd_mod/module-setup.sh @@ -4,7 +4,6 @@ check() { local _arch=${DRACUT_ARCH:-$(uname -m)} [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 - require_binaries grep sed seq return 0 } @@ -22,6 +21,5 @@ installkernel() { # called by dracut install() { inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" - inst_multiple grep sed seq inst_multiple -o dasd_cio_free } diff --git a/modules.d/95dasd_mod/parse-dasd-mod.sh b/modules.d/95dasd_mod/parse-dasd-mod.sh index 2b86d45..b635ecf 100755 --- a/modules.d/95dasd_mod/parse-dasd-mod.sh +++ b/modules.d/95dasd_mod/parse-dasd-mod.sh @@ -1,18 +1,4 @@ #!/bin/sh -mod_args="" - -for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do - mod_args="$mod_args,$dasd_arg" -done - -mod_args="${mod_args#*,}" - -if [ -x /sbin/dasd_cio_free -a -n "$mod_args" ]; then - [ -d /etc/modprobe.d ] || mkdir -m 0755 -p /etc/modprobe.d - echo "options dasd_mod dasd=$mod_args" >> /etc/modprobe.d/dasd_mod.conf -fi - -unset dasd_arg if [ -x /sbin/dasd_cio_free ]; then dasd_cio_free fi diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh deleted file mode 100755 index 06c57a4..0000000 --- a/modules.d/95dasd_rules/module-setup.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# called by dracut -cmdline() { - is_dasd() { - local _dev=$1 - local _devpath - _devpath=$( - cd -P /sys/dev/block/"$_dev" || exit - echo "$PWD" - ) - - [ "${_devpath#*/dasd}" == "$_devpath" ] && return 1 - _ccw="${_devpath%%/block/*}" - echo "rd.dasd=${_ccw##*/}" - return 0 - } - [[ $hostonly ]] || [[ $mount_needs ]] && { - for_each_host_dev_and_slaves_all is_dasd || return 255 - } | sort | uniq -} - -# called by dracut -check() { - local _arch=${DRACUT_ARCH:-$(uname -m)} - local found=0 - local bdev - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 - - [[ $hostonly ]] || [[ $mount_needs ]] && { - for bdev in /sys/block/*; do - case "${bdev##*/}" in - dasd*) - found=$((found + 1)) - break - ;; - esac - done - [ $found -eq 0 ] && return 255 - } - return 0 -} - -# called by dracut -depends() { - echo 'dasd_mod' bash - return 0 -} - -# called by dracut -install() { - inst_hook cmdline 30 "$moddir/parse-dasd.sh" - if [[ $hostonly_cmdline == "yes" ]]; then - local _dasd - _dasd=$(cmdline) - [[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf" - fi - if [[ $hostonly ]]; then - inst_rules_wildcard "51-dasd-*.rules" - inst_rules_wildcard "41-dasd-*.rules" - mark_hostonly /etc/udev/rules.d/51-dasd-*.rules - mark_hostonly /etc/udev/rules.d/41-dasd-*.rules - fi - inst_rules 59-dasd.rules -} diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh deleted file mode 100755 index 4454aec..0000000 --- a/modules.d/95dasd_rules/parse-dasd.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -allow_device() { - local ccw=$1 - - if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then - cio_ignore -r "$ccw" - fi -} - -if [[ -f /sys/firmware/ipl/ipl_type ]] && [[ $(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then - allow_device "$(< /sys/firmware/ipl/device)" -fi - -for dasd_arg in $(getargs root=) $(getargs resume=); do - [[ $dasd_arg =~ /dev/disk/by-path/ccw-* ]] || continue - - ccw_dev="${dasd_arg##*/ccw-}" - allow_device "${ccw_dev%%-*}" -done - -for dasd_arg in $(getargs rd.dasd=); do - IFS=',' read -r -a devs <<< "$dasd_arg" - declare -p devs - for dev in "${devs[@]}"; do - case "$dev" in - autodetect | probeonly) ;; - - *-*) - IFS="-" read -r start end _ <<< "${dev%(ro)}" - prefix=${start%.*} - start=${start##*.} - for rdev in $(seq $((16#$start)) $((16#$end))); do - allow_device "$(printf "%s.%04x" "$prefix" "$rdev")" - done - ;; - *) - IFS="." read -r sid ssid chan _ <<< "${dev%(ro)}" - allow_device "$(printf "%01x.%01x.%04x" $((16#$sid)) $((16#$ssid)) $((16#$chan)))" - ;; - esac - done -done diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh index bde6b62..a6f284b 100755 --- a/modules.d/95fcoe/parse-fcoe.sh +++ b/modules.d/95fcoe/parse-fcoe.sh @@ -23,7 +23,7 @@ if ! getargbool 1 rd.fcoe -d -n rd.nofcoe; then return 0 fi -if ! [ -e /sys/bus/fcoe/ctlr_create ] && ! modprobe -b -a fcoe && ! modprobe -b -a libfcoe; then +if ! [ -e /sys/bus/fcoe/ctlr_create ] && ! modprobe -b fcoe && ! modprobe -b libfcoe; then die "FCoE requested but kernel/initrd does not support FCoE" fi diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh index 2bea2fc..5eaab4e 100755 --- a/modules.d/95iscsi/module-setup.sh +++ b/modules.d/95iscsi/module-setup.sh @@ -198,14 +198,9 @@ install() { "$systemdsystemunitdir"/sockets.target.wants/iscsid.socket \ "$systemdsystemunitdir"/sockets.target.wants/iscsiuio.socket + inst_simple /etc/iscsi/iscsid.conf if [[ $hostonly ]]; then - local -a _filenames - - inst_dir /etc/iscsi - mapfile -t -d '' _filenames < <(find /etc/iscsi -type f -print0) - inst_multiple "${_filenames[@]}" - else - inst_simple /etc/iscsi/iscsid.conf + inst_simple /etc/iscsi/initiatorname.iscsi fi # Detect iBFT and perform mandatory steps diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh index 7574711..99f25a6 100755 --- a/modules.d/95iscsi/parse-iscsiroot.sh +++ b/modules.d/95iscsi/parse-iscsiroot.sh @@ -95,7 +95,11 @@ if ! [ -e /sys/module/iscsi_tcp ]; then modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi" fi -modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi +modprobe -b -q qla4xxx +modprobe -b -q cxgb3i +modprobe -b -q cxgb4i +modprobe -b -q bnx2i +modprobe -b -q be2iscsi if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then if ! getargbool 1 rd.neednet > /dev/null || ! getarg "ip="; then diff --git a/modules.d/95lunmask/parse-lunmask.sh b/modules.d/95lunmask/parse-lunmask.sh index 5e05e5b..147e3de 100755 --- a/modules.d/95lunmask/parse-lunmask.sh +++ b/modules.d/95lunmask/parse-lunmask.sh @@ -32,8 +32,9 @@ for lunmask_arg in $(getargs rd.lunmask); do IFS="$OLDIFS" if [ -d /sys/module/scsi_mod ]; then printf "manual" > /sys/module/scsi_mod/parameters/scan - elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then - echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf + elif [ ! -f /run/modprobe.d/95lunmask.conf ]; then + mkdir -p /run/modprobe.d + echo "options scsi_mod scan=manual" > /run/modprobe.d/95lunmask.conf fi create_udev_rule "$1" "$2" "$3" ) diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh index 16bafe3..abe1ee5 100755 --- a/modules.d/95nfs/module-setup.sh +++ b/modules.d/95nfs/module-setup.sh @@ -128,11 +128,5 @@ install() { grep -E '^nfsnobody:|^rpc:|^rpcuser:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd" grep -E '^nogroup:|^rpc:|^nobody:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group" - # rpc user needs to be able to write to this directory to save the warmstart - # file - chmod 770 "$initdir/var/lib/rpcbind" - grep -q '^rpc:' "$dracutsysrootdir"/etc/passwd \ - && grep -q '^rpc:' "$dracutsysrootdir"/etc/group - dracut_need_initqueue } diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh index f000671..7896da9 100755 --- a/modules.d/95nfs/nfs-lib.sh +++ b/modules.d/95nfs/nfs-lib.sh @@ -1,7 +1,7 @@ #!/bin/sh type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -. /lib/net-lib.sh +type get_ip > /dev/null 2>&1 || . /lib/net-lib.sh # TODO: make these things not pollute the calling namespace diff --git a/modules.d/95nfs/parse-nfsroot.sh b/modules.d/95nfs/parse-nfsroot.sh index 0c8dbbb..a07c5f4 100755 --- a/modules.d/95nfs/parse-nfsroot.sh +++ b/modules.d/95nfs/parse-nfsroot.sh @@ -123,6 +123,8 @@ root="$fstype" # shellcheck disable=SC2016 echo '[ -e $NEWROOT/proc ]' > "$hookdir"/initqueue/finished/nfsroot.sh +# rpc user needs to be able to write to this directory to save the warmstart +# file mkdir -p /var/lib/rpcbind chown rpc:rpc /var/lib/rpcbind chmod 770 /var/lib/rpcbind diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh index a8f3034..6a1e3f5 100755 --- a/modules.d/95nvmf/module-setup.sh +++ b/modules.d/95nvmf/module-setup.sh @@ -3,8 +3,6 @@ # called by dracut check() { require_binaries nvme jq || return 1 - [ -f /etc/nvme/hostnqn ] || return 255 - [ -f /etc/nvme/hostid ] || return 255 is_nvmf() { local _dev=$1 @@ -36,6 +34,8 @@ check() { } [[ $hostonly ]] || [[ $mount_needs ]] && { + [ -f /etc/nvme/hostnqn ] || return 255 + [ -f /etc/nvme/hostid ] || return 255 pushd . > /dev/null for_each_host_dev_and_slaves is_nvmf local _is_nvmf=$? @@ -130,8 +130,8 @@ install() { _nvmf_args=$(cmdline) [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf" fi - inst_simple "/etc/nvme/hostnqn" - inst_simple "/etc/nvme/hostid" + inst_simple -H "/etc/nvme/hostnqn" + inst_simple -H "/etc/nvme/hostid" inst_multiple ip sed diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh index 6601837..b2a5ae0 100755 --- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh +++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh @@ -236,7 +236,9 @@ if ! getargbool 0 rd.nvmf.nonbft; then done fi -initqueue --onetime modprobe --all -b -q nvme_tcp nvme_core nvme_fabrics +initqueue --onetime modprobe -b -q nvme_tcp +initqueue --onetime modprobe -b -q nvme_core +initqueue --onetime modprobe -b -q nvme_fabrics parse_nvmf_discover() { traddr="none" diff --git a/modules.d/95qeth_rules/module-setup.sh b/modules.d/95qeth_rules/module-setup.sh deleted file mode 100755 index a84ac15..0000000 --- a/modules.d/95qeth_rules/module-setup.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -# called by dracut -check() { - local _arch=${DRACUT_ARCH:-$(uname -m)} - local _online=0 - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 - dracut_module_included network || return 1 - - [[ $hostonly ]] && { - for i in /sys/devices/qeth/*/online; do - [ ! -f "$i" ] && continue - read -r _online < "$i" - [ "$_online" -eq 1 ] && return 0 - done - } - return 255 -} - -# called by dracut -installkernel() { - instmods qeth -} - -# called by dracut -install() { - ccwid() { - qeth_path=$(readlink -e -q "$1"/device) - basename "$qeth_path" - } - - inst_rules_qeth() { - for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do - # prefer chzdev generated 41- rules - if [ -f "$rule" ]; then - inst_rules "$rule" - break - fi - done - } - - has_carrier() { - carrier=0 - # not readable in qeth interfaces - # that have just been assembled, ignore - # read error and assume no carrier - read -r carrier 2> /dev/null < "$1/carrier" - [ "$carrier" -eq 1 ] && return 0 - return 1 - } - - for dev in /sys/class/net/*; do - has_carrier "$dev" || continue - id=$(ccwid "$dev") - [ -n "$id" ] && inst_rules_qeth "$id" - done - -} diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh index d255103..d419566 100755 --- a/modules.d/95resume/module-setup.sh +++ b/modules.d/95resume/module-setup.sh @@ -10,13 +10,31 @@ check() { return 1 } - # Only support resume if hibernation is currently on - # and no swap is mounted on a net device - [[ $hostonly ]] || [[ $mount_needs ]] && { - swap_on_netdevice || [[ -f /sys/power/resume && "$(< /sys/power/resume)" == "0:0" ]] || grep -rq '^\|[[:space:]]resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null && return 255 - } - - return 0 + # If hostonly check if we want to include the resume module + if [[ $hostonly ]] || [[ $mount_needs ]]; then + # Resuming won't work if swap is on a netdevice + swap_on_netdevice && return 255 + if grep -rq 'resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null; then + # hibernation support requested on kernel command line + return 0 + else + # resume= not set on kernel command line + if [[ -f /sys/power/resume ]]; then + if [[ "$(< /sys/power/resume)" == "0:0" ]]; then + # hibernation supported by the kernel, but not enabled + return 255 + else + # hibernation supported by the kernel and enabled + return 0 + fi + else + # resume file doesn't exist, hibernation not supported by kernel + return 255 + fi + fi + else + return 0 + fi } # called by dracut @@ -44,6 +62,7 @@ install() { if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then inst_multiple -o \ "$systemdutildir"/system-generators/systemd-hibernate-resume-generator \ + "$systemdsystemunitdir"/systemd-hibernate-resume.service \ "$systemdsystemunitdir"/systemd-hibernate-resume@.service \ "$systemdutildir"/systemd-hibernate-resume return 0 diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh index c488b11..973069b 100755 --- a/modules.d/95rootfs-block/mount-root.sh +++ b/modules.d/95rootfs-block/mount-root.sh @@ -30,22 +30,13 @@ mount_root() { fsck_ask_err done - READONLY= fsckoptions= if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then # shellcheck disable=SC1090 . "$NEWROOT"/etc/sysconfig/readonly-root fi - if getargbool 0 "readonlyroot=" -y readonlyroot; then - READONLY=yes - fi - - if getarg noreadonlyroot; then - READONLY=no - fi - - if [ -f "$NEWROOT"/fastboot ] || getargbool 0 fastboot; then + if [ -f "$NEWROOT"/fastboot ]; then fastboot=yes fi @@ -106,8 +97,8 @@ mount_root() { # esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g') # printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab - if fsck_able "$rootfs" \ - && [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] \ + if ! getargbool 0 ro && fsck_able "$rootfs" \ + && [ "$rootfsck" != "0" -a -z "$fastboot" ] \ && ! strstr "${rflags}" _netdev \ && ! getargbool 0 rd.skipfsck; then umount "$NEWROOT" diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh index 3ca12ee..e5b7f97 100755 --- a/modules.d/95udev-rules/module-setup.sh +++ b/modules.d/95udev-rules/module-setup.sh @@ -8,8 +8,6 @@ install() { # ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies # of the rules we want so that we just copy those in would be best inst_multiple udevadm cat uname blkid - inst_dir /etc/udev - inst_multiple -o /etc/udev/udev.conf [[ -d ${initdir}/$systemdutildir ]] || mkdir -p "${initdir}/$systemdutildir" for _i in "${systemdutildir}"/systemd-udevd "${udevdir}"/udevd /sbin/udevd; do @@ -33,7 +31,6 @@ install() { 59-scsi-sg3_utils.rules \ 60-block.rules \ 60-cdrom_id.rules \ - 60-pcmcia.rules \ 60-persistent-storage.rules \ 64-btrfs.rules \ 70-uaccess.rules \ @@ -45,9 +42,6 @@ install() { "$moddir/59-persistent-storage.rules" \ "$moddir/61-persistent-storage.rules" - # legacy persistent network device name rules - [[ $hostonly ]] && inst_rules 70-persistent-net.rules - { for i in cdrom tape dialout floppy; do if ! grep -q "^$i:" "$initdir"/etc/group 2> /dev/null; then @@ -72,12 +66,14 @@ install() { "${udevdir}"/path_id \ "${udevdir}"/input_id \ "${udevdir}"/scsi_id \ - "${udevdir}"/usb_id \ - "${udevdir}"/pcmcia-socket-startup \ - "${udevdir}"/pcmcia-check-broken-cis - - inst_multiple -o /etc/pcmcia/config.opts + "${udevdir}"/usb_id inst_libdir_file "libnss_files*" + # Install the hosts local user configurations if enabled. + if [[ $hostonly ]]; then + inst_dir /etc/udev + inst_multiple -H -o \ + /etc/udev/udev.conf + fi } diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh index e1f3aa3..b547f9b 100755 --- a/modules.d/95zfcp/module-setup.sh +++ b/modules.d/95zfcp/module-setup.sh @@ -5,7 +5,7 @@ check() { arch=${DRACUT_ARCH:-$(uname -m)} [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - require_binaries zfcp_cio_free grep sed seq || return 1 + require_binaries zfcp_cio_free sed || return 1 return 0 } @@ -23,7 +23,7 @@ installkernel() { # called by dracut install() { inst_hook cmdline 30 "$moddir/parse-zfcp.sh" - inst_multiple zfcp_cio_free grep sed seq + inst_multiple zfcp_cio_free sed inst_script /sbin/zfcpconf.sh inst_rules 56-zfcp.rules diff --git a/modules.d/95zfcp/parse-zfcp.sh b/modules.d/95zfcp/parse-zfcp.sh index 495aa67..41216dd 100755 --- a/modules.d/95zfcp/parse-zfcp.sh +++ b/modules.d/95zfcp/parse-zfcp.sh @@ -2,15 +2,4 @@ getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf -for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do - echo "$zfcp_arg" | grep '^0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\}\(,0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}\)\?$' > /dev/null - test $? -ne 0 && die "For argument 'rd.zfcp=$zfcp_arg'\nSorry, invalid format." - ( - IFS="," - # shellcheck disable=SC2086 - set $zfcp_arg - echo "$@" >> /etc/zfcp.conf - ) -done - zfcp_cio_free diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh deleted file mode 100755 index dfa7951..0000000 --- a/modules.d/95zfcp_rules/module-setup.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -# called by dracut -cmdline() { - is_zfcp() { - local _dev=$1 - local _devpath - _devpath=$( - cd -P /sys/dev/block/"$_dev" || exit - echo "$PWD" - ) - local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type - local _allow_lun_scan _is_npiv - - read -r _allow_lun_scan < /sys/module/zfcp/parameters/allow_lun_scan - [ "${_devpath#*/sd}" == "$_devpath" ] && return 1 - _sdev="${_devpath%%/block/*}" - [ -e "${_sdev}"/fcp_lun ] || return 1 - _scsiid="${_sdev##*/}" - _hostno="${_scsiid%%:*}" - [ -d /sys/class/fc_host/host"${_hostno}" ] || return 1 - read -r _port_type < /sys/class/fc_host/host"${_hostno}"/port_type - case "$_port_type" in - NPIV*) - _is_npiv=1 - ;; - esac - read -r _ccw < "${_sdev}"/hba_id - if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ]; then - echo "rd.zfcp=${_ccw}" - else - read -r _lun < "${_sdev}"/fcp_lun - read -r _wwpn < "${_sdev}"/wwpn - echo "rd.zfcp=${_ccw},${_wwpn},${_lun}" - fi - return 0 - } - [[ $hostonly ]] || [[ $mount_needs ]] && { - for_each_host_dev_and_slaves_all is_zfcp - } | sort | uniq -} - -# called by dracut -check() { - local _arch=${DRACUT_ARCH:-$(uname -m)} - local _ccw - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 - - [[ $hostonly ]] || [[ $mount_needs ]] && { - found=0 - for _ccw in /sys/bus/ccw/devices/*/host*; do - [ -d "$_ccw" ] || continue - found=$((found + 1)) - done - [ $found -eq 0 ] && return 255 - } - return 0 -} - -# called by dracut -depends() { - echo bash - return 0 -} - -# called by dracut -install() { - inst_hook cmdline 30 "$moddir/parse-zfcp.sh" - if [[ $hostonly_cmdline == "yes" ]]; then - local _zfcp - - for _zfcp in $(cmdline); do - printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf" - done - fi - if [[ $hostonly ]]; then - inst_rules_wildcard "51-zfcp-*.rules" - inst_rules_wildcard "41-zfcp-*.rules" - fi -} diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh deleted file mode 100755 index 5e7d909..0000000 --- a/modules.d/95zfcp_rules/parse-zfcp.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -create_udev_rule() { - local ccw=$1 - local wwpn=$2 - local lun=$3 - local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules - local _cu_type _dev_type - - if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then - cio_ignore -r "$ccw" - fi - - if [ -e /sys/bus/ccw/devices/"${ccw}" ]; then - read -r _cu_type < /sys/bus/ccw/devices/"${ccw}"/cutype - read -r _dev_type < /sys/bus/ccw/devices/"${ccw}"/devtype - fi - if [ "$_cu_type" != "1731/03" ]; then - return 0 - fi - if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ]; then - return 0 - fi - - [ -z "$wwpn" ] || [ -z "$lun" ] && return - m=$(sed -n "/.*${wwpn}.*${lun}.*/p" "$_rule") - if [ -z "$m" ]; then - cat >> "$_rule" << EOF -ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun" -EOF - fi -} - -if [[ -f /sys/firmware/ipl/ipl_type ]] \ - && [[ $(< /sys/firmware/ipl/ipl_type) == "fcp" ]]; then - ( - read -r _wwpn < /sys/firmware/ipl/wwpn - read -r _lun < /sys/firmware/ipl/lun - read -r _ccw < /sys/firmware/ipl/device - - create_udev_rule "$_ccw" "$_wwpn" "$_lun" - ) -fi - -for zfcp_arg in $(getargs rd.zfcp); do - ( - OLDIFS="$IFS" - IFS="," - # shellcheck disable=SC2086 - set $zfcp_arg - IFS="$OLDIFS" - create_udev_rule "$1" "$2" "$3" - ) -done - -for zfcp_arg in $(getargs root=) $(getargs resume=); do - ( - case $zfcp_arg in - /dev/disk/by-path/ccw-*) - ccw_arg=${zfcp_arg##*/} - ;; - esac - if [ -n "$ccw_arg" ]; then - OLDIFS="$IFS" - IFS="-" - set -- "$ccw_arg" - IFS="$OLDIFS" - _wwpn=${4%:*} - _lun=${4#*:} - create_udev_rule "$2" "$wwpn" "$lun" - fi - ) -done diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh index df37c66..95164bb 100755 --- a/modules.d/95znet/module-setup.sh +++ b/modules.d/95znet/module-setup.sh @@ -5,7 +5,7 @@ check() { arch=${DRACUT_ARCH:-$(uname -m)} [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - require_binaries znet_cio_free grep sed seq readlink || return 1 + require_binaries grep sed seq readlink chzdev || return 1 return 0 } @@ -24,6 +24,37 @@ installkernel() { # called by dracut install() { inst_hook cmdline 30 "$moddir/parse-ccw.sh" - inst_rules 81-ccw.rules - inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init + inst_multiple grep sed seq readlink chzdev + if [[ $hostonly ]]; then + local _tempfile + _tempfile=$(mktemp --tmpdir="${DRACUT_TMPDIR}" dracut-zdev.XXXXXX) + { + chzdev qeth --export - --configured --persistent --quiet --type + chzdev lcs --export - --configured --persistent --quiet --type + chzdev ctc --export - --configured --persistent --quiet --type + } 2> /dev/null > "$_tempfile" + ddebug < "$_tempfile" + chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \ + --yes --no-root-update --force 2>&1 | ddebug + lszdev --configured --persistent --info \ + --base "/etc=$initdir/etc" 2>&1 | ddebug + rm -f "$_tempfile" + # these are purely generated udev rules so we have to glob expand + # within $initdir and strip the $initdir prefix for mark_hostonly + local -a _array + # shellcheck disable=SC2155 + local _nullglob=$(shopt -p nullglob) + shopt -u nullglob + # shellcheck disable=SC2086 + readarray -t _array < <( + ls -1 $initdir/etc/udev/rules.d/41-*.rules 2> /dev/null + ) + [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}" + # shellcheck disable=SC2086 + readarray -t _array < <( + ls -1 $initdir/etc/modprobe.d/s390x-*.conf 2> /dev/null + ) + [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}" + $_nullglob + fi } diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh index d895360..ccf05bc 100755 --- a/modules.d/95znet/parse-ccw.sh +++ b/modules.d/95znet/parse-ccw.sh @@ -1,7 +1,50 @@ #!/bin/bash +znet_base_args="--no-settle --yes --no-root-update --force" + +# at this point in time dracut's vinfo() only logs to journal which is hard for +# s390 users to find and access on a line mode console such as 3215 mode +# so use a vinfo alternative that still prints to the console via kmsg +znet_vinfo() { + while read -r _znet_vinfo_line || [ -n "$_znet_vinfo_line" ]; do + # Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6: + # (facility << 3) | level. + echo "<30>dracut: $_znet_vinfo_line" > /dev/kmsg + done +} + for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); do - echo "$ccw_arg" >> /etc/ccw.conf + ( + SAVED_IFS="$IFS" + IFS="," + # shellcheck disable=SC2086 + set -- $ccw_arg + IFS="$SAVED_IFS" + type="$1" + subchannel1="$2" + subchannel2="$3" + subchannel3="$4" + echo "rd.znet ${ccw_arg} :" | znet_vinfo + if [ "$#" -lt 3 ]; then + echo "rd.znet needs at least 3 list items: type,subchannel1,subchannel2" | znet_vinfo + fi + if [ "$1" = "qeth" ]; then + if [ "$#" -lt 4 ]; then + echo "rd.znet for type qeth needs at least 4 list items: qeth,subchannel1,subchannel2,subchannel3" | znet_vinfo + fi + subchannels="$subchannel1:$subchannel2:$subchannel3" + shift 4 + # shellcheck disable=SC2086 + chzdev --enable --persistent $znet_base_args \ + "$type" "$subchannels" "$@" 2>&1 | znet_vinfo + else + subchannels="$subchannel1:$subchannel2" + shift 3 + # shellcheck disable=SC2086 + chzdev --enable --persistent $znet_base_args \ + "$type" "$subchannels" "$@" 2>&1 | znet_vinfo + fi + ) done for ifname in $(getargs rd.znet_ifname); do @@ -10,16 +53,16 @@ for ifname in $(getargs rd.znet_ifname); do warn "Invalid arguments for rd.znet_ifname=" else { - ifname_subchannels=${ifname_subchannels//,/|} + ifname_subchannels="${ifname_subchannels//,/|}" + # sanitize for use in udev label: replace non-word characters by _ + ifname_if_label="${ifname_if//[^[:word:]]/_}" - echo 'ACTION!="add|change", GOTO="ccw_ifname_end"' - echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"' - echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"' + echo "ACTION!=\"add|change\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" + echo "ATTR{type}!=\"1\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" + echo "SUBSYSTEM!=\"net\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\"" - echo 'LABEL="ccw_ifname_end"' + echo "LABEL=\"ccw_ifname_${ifname_if_label}_end\"" - } > /etc/udev/rules.d/81-ccw-ifname.rules + } >> /etc/udev/rules.d/81-ccw-ifname.rules fi done - -znet_cio_free diff --git a/modules.d/98dracut-systemd/dracut-cmdline.sh b/modules.d/98dracut-systemd/dracut-cmdline.sh index 646fead..d2919e1 100755 --- a/modules.d/98dracut-systemd/dracut-cmdline.sh +++ b/modules.d/98dracut-systemd/dracut-cmdline.sh @@ -6,7 +6,7 @@ fi type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh [ -f /usr/lib/initrd-release ] && . /usr/lib/initrd-release -[ -n "$VERSION" ] && info "dracut-$VERSION" +[ -n "$DRACUT_VERSION" ] && info "dracut-$DRACUT_VERSION" if ! getargbool 1 'rd.hostonly'; then [ -f /etc/cmdline.d/99-cmdline-ask.conf ] && mv /etc/cmdline.d/99-cmdline-ask.conf /tmp/99-cmdline-ask.conf @@ -17,8 +17,10 @@ fi info "Using kernel command line parameters:" "$(getcmdline)" -getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf -getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf +getargbool 0 rd.udev.log_level=info -d rd.udev.log-priority=info -d rd.udev.info -d -y rdudevinfo \ + && echo 'udev_log="info"' >> /etc/udev/udev.conf +getargbool 0 rd.udev.log_level=debug -d rd.udev.log-priority=debug -d rd.udev.debug -d -y rdudevdebug \ + && echo 'udev_log="debug"' >> /etc/udev/udev.conf source_conf /etc/conf.d @@ -45,7 +47,7 @@ export fstype make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' # run scriptlets to parse the command line -getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" +getargs 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" source_hook cmdline [ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh diff --git a/modules.d/98dracut-systemd/dracut-emergency.sh b/modules.d/98dracut-systemd/dracut-emergency.sh index c6637a5..bc396fc 100755 --- a/modules.d/98dracut-systemd/dracut-emergency.sh +++ b/modules.d/98dracut-systemd/dracut-emergency.sh @@ -39,20 +39,20 @@ else export hook="shutdown-emergency" warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line." source_hook "$hook" - [ -z "$_emergency_action" ] && _emergency_action=halt + [ -z "$_emergency_action" ] && _emergency_action=poweroff fi /bin/rm -f -- /.console_lock case "$_emergency_action" in reboot) - reboot || exit 1 + reboot -f || exit 1 ;; poweroff) - poweroff || exit 1 + poweroff -f || exit 1 ;; halt) - halt || exit 1 + halt -f || exit 1 ;; esac diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh index ce919ce..b0882db 100755 --- a/modules.d/98dracut-systemd/dracut-initqueue.sh +++ b/modules.d/98dracut-systemd/dracut-initqueue.sh @@ -9,7 +9,7 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh source_conf /etc/conf.d make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue" +getargs 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue" RDRETRY=$(getarg rd.retry -d 'rd_retry=') RDRETRY=${RDRETRY:-180} diff --git a/modules.d/98dracut-systemd/dracut-mount.sh b/modules.d/98dracut-systemd/dracut-mount.sh index 7892941..3e58126 100755 --- a/modules.d/98dracut-systemd/dracut-mount.sh +++ b/modules.d/98dracut-systemd/dracut-mount.sh @@ -9,7 +9,7 @@ source_conf /etc/conf.d make_trace_mem "hook mount" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break before mount" +getargs 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break before mount" # mount scripts actually try to mount the root filesystem, and may # be sourced any number of times. As soon as one succeeds, no more are sourced. i=0 diff --git a/modules.d/98dracut-systemd/dracut-pre-mount.sh b/modules.d/98dracut-systemd/dracut-pre-mount.sh index ee51605..d7482c5 100755 --- a/modules.d/98dracut-systemd/dracut-pre-mount.sh +++ b/modules.d/98dracut-systemd/dracut-pre-mount.sh @@ -11,7 +11,7 @@ source_conf /etc/conf.d make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. -getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break before pre-mount" +getargs 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break before pre-mount" source_hook pre-mount export -p > /dracut-state.sh diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh index 8bf2325..fa81b33 100755 --- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh +++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh @@ -11,11 +11,11 @@ source_conf /etc/conf.d make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. -getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break before pre-pivot" +getargs 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break before pre-pivot" source_hook pre-pivot # pre pivot cleanup scripts are sourced just before we switch over to the new root. -getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break before cleanup" +getargs 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break before cleanup" source_hook cleanup _bv=$(getarg rd.break -d rdbreak) && [ -z "$_bv" ] \ diff --git a/modules.d/98dracut-systemd/dracut-pre-trigger.sh b/modules.d/98dracut-systemd/dracut-pre-trigger.sh index dd0215e..8758ba9 100755 --- a/modules.d/98dracut-systemd/dracut-pre-trigger.sh +++ b/modules.d/98dracut-systemd/dracut-pre-trigger.sh @@ -12,7 +12,7 @@ make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' source_hook pre-trigger -getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" +getargs 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" udevadm control --reload > /dev/null 2>&1 || : diff --git a/modules.d/98dracut-systemd/dracut-pre-udev.sh b/modules.d/98dracut-systemd/dracut-pre-udev.sh index feab32c..9c8ac9d 100755 --- a/modules.d/98dracut-systemd/dracut-pre-udev.sh +++ b/modules.d/98dracut-systemd/dracut-pre-udev.sh @@ -10,15 +10,11 @@ source_conf /etc/conf.d make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab' # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. -getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev" +getargs 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev" source_hook pre-udev -_modprobe_d=/etc/modprobe.d -if [ -d /usr/lib/modprobe.d ]; then - _modprobe_d=/usr/lib/modprobe.d -elif [ -d /lib/modprobe.d ]; then - _modprobe_d=/lib/modprobe.d -elif [ ! -d $_modprobe_d ]; then +_modprobe_d=/run/modprobe.d +if [ ! -d $_modprobe_d ]; then mkdir -p $_modprobe_d fi @@ -31,8 +27,6 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do ) done -[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d - for i in $(getargs rd.driver.blacklist -d rdblacklist=); do ( IFS=, diff --git a/modules.d/98dracut-systemd/module-setup.sh b/modules.d/98dracut-systemd/module-setup.sh index 3195377..0ea26d4 100755 --- a/modules.d/98dracut-systemd/module-setup.sh +++ b/modules.d/98dracut-systemd/module-setup.sh @@ -4,12 +4,15 @@ check() { [[ $mount_needs ]] && return 1 + # If the binary(s) requirements are not fulfilled the module can't be installed + require_binaries "$systemdutildir"/systemd || return 1 + return 0 } # called by dracut depends() { - echo "systemd-initrd" + echo "systemd-initrd systemd-ask-password" return 0 } diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 39609d8..e83ee94 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -451,7 +451,7 @@ die() { fi if [ -n "$DRACUT_SYSTEMD" ]; then - systemctl --no-block --force halt + systemctl --no-block --force poweroff fi exit 1 @@ -973,25 +973,25 @@ emergency_shell() { _emergency_action=$(getarg rd.emergency) [ -z "$_emergency_action" ] \ && [ -e /run/initramfs/.die ] \ - && _emergency_action=halt + && _emergency_action=poweroff if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then _emergency_shell "$_rdshell_name" else source_hook "$hook" warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line." - [ -z "$_emergency_action" ] && _emergency_action=halt + [ -z "$_emergency_action" ] && _emergency_action=poweroff fi case "$_emergency_action" in reboot) - reboot || exit 1 + reboot -f || exit 1 ;; poweroff) - poweroff || exit 1 + poweroff -f || exit 1 ;; halt) - halt || exit 1 + halt -f || exit 1 ;; esac } @@ -1130,8 +1130,20 @@ show_memstats() { esac } +# parameter: <memory_name:> example: MemTotal: +# Check /proc/meminfo +# echo the field value, if present. +check_meminfo() { + local - m sz + set +x + while read -r m sz _ || [ "$m" ]; do + [ "$m" = "$1" ] && echo "$sz" && return 0 + done < /proc/meminfo + return 1 +} + remove_hostonly_files() { - rm -fr /etc/cmdline /etc/cmdline.d/*.conf "$hookdir/initqueue/finished" + rm -fr /etc/cmdline /etc/cmdline.d/*.conf "$hookdir"/initqueue/finished/*.sh if [ -f /lib/dracut/hostonly-files ]; then while read -r line || [ -n "$line" ]; do [ -e "$line" ] || [ -h "$line" ] || continue @@ -1151,28 +1163,3 @@ load_fstype() { done < /proc/filesystems modprobe "$1" } - -# parameter: size of live image -# calls emergency shell if ram size is too small for the image -check_live_ram() { - minmem=$(getarg rd.minmem) - minmem=${minmem:-1024} - imgsize=$1 - memsize=$(($(sed -n 's/MemTotal: *\([[:digit:]]*\).*/\1/p' /proc/meminfo) / 1024)) - - if [ -z "$imgsize" ]; then - warn "Image size could not be determined" - return 0 - fi - - if [ $((memsize - imgsize)) -lt "$minmem" ]; then - sed -i "N;/and attach it to a bug report./s/echo$/echo\n\ - echo \n\ - echo 'Warning!!!'\n\ - echo 'The memory size of your system is too small for this live image.'\n\ - echo 'Expect killed processes due to out of memory conditions.'\n\ - echo \n/" /usr/bin/dracut-emergency - - emergency_shell - fi -} diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index 285059e..727f279 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -123,7 +123,7 @@ fi # run scriptlets to parse the command line make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' -getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" +getargs 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" source_hook cmdline [ -z "$root" ] && die "No or empty root= argument" @@ -133,12 +133,14 @@ export root rflags fstype netroot NEWROOT # pre-udev scripts run before udev starts, and are run only once. make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev" +getargs 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev" source_hook pre-udev UDEV_LOG=err -getargbool 0 rd.udev.info -d -y rdudevinfo && UDEV_LOG=info -getargbool 0 rd.udev.debug -d -y rdudevdebug && UDEV_LOG=debug +getargbool 0 rd.udev.log_level=info -d rd.udev.log-priority=info -d rd.udev.info -d -y rdudevinfo \ + && UDEV_LOG=info +getargbool 0 rd.udev.log_level=debug -d rd.udev.log-priority=debug -d rd.udev.debug -d -y rdudevdebug \ + && UDEV_LOG=debug # start up udev and trigger cold plugs UDEV_LOG=$UDEV_LOG "$systemdutildir"/systemd-udevd --daemon --resolve-names=never @@ -148,7 +150,7 @@ UDEV_QUEUE_EMPTY="udevadm settle --timeout=0" udevproperty "hookdir=$hookdir" make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" +getargs 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" source_hook pre-trigger udevadm control --reload > /dev/null 2>&1 || : @@ -157,7 +159,7 @@ udevadm trigger --type=subsystems --action=add > /dev/null 2>&1 udevadm trigger --type=devices --action=add > /dev/null 2>&1 make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue" +getargs 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue" RDRETRY=$(getarg rd.retry -d 'rd_retry=') RDRETRY=${RDRETRY:-180} @@ -223,10 +225,10 @@ unset RDRETRY # pre-mount happens before we try to mount the root filesystem, # and happens once. make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break before pre-mount" +getargs 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break before pre-mount" source_hook pre-mount -getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break before mount" +getargs 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break before mount" # mount scripts actually try to mount the root filesystem, and may # be sourced any number of times. As soon as one succeeds, no more are sourced. _i_mount=0 @@ -262,12 +264,12 @@ done # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' -getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break before pre-pivot" +getargs 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break before pre-pivot" source_hook pre-pivot make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab' # pre pivot cleanup scripts are sourced just before we switch over to the new root. -getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break before cleanup" +getargs 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break before cleanup" source_hook cleanup # By the time we get here, the root filesystem should be mounted. diff --git a/modules.d/99base/loginit.sh b/modules.d/99base/loginit.sh index cdb305b..7c47a5a 100755 --- a/modules.d/99base/loginit.sh +++ b/modules.d/99base/loginit.sh @@ -18,6 +18,6 @@ while read -r line || [ -n "$line" ]; do fi echo "<31>dracut: $line" >&5 # if "quiet" is specified we output to /dev/console - [ -n "$QUIET" ] || echo "dracut: $line" + [ "$QUIET" = "yes" ] || echo "dracut: $line" echo "$line" >&6 done diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh index 54b0deb..bfdc51d 100755 --- a/modules.d/99base/module-setup.sh +++ b/modules.d/99base/module-setup.sh @@ -45,7 +45,10 @@ install() { [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib mkdir -m 0755 -p "${initdir}"/lib/dracut - mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks + mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks + + # symlink to old hooks location for compatibility + ln_r /var/lib/dracut/hooks /lib/dracut/hooks mkdir -p "${initdir}"/tmp diff --git a/modules.d/99base/rdsosreport.sh b/modules.d/99base/rdsosreport.sh index dadf30b..61ca458 100755 --- a/modules.d/99base/rdsosreport.sh +++ b/modules.d/99base/rdsosreport.sh @@ -28,7 +28,7 @@ cat /proc/self/mountinfo cat /proc/mounts blkid -blkid -o udev +command -v udevadm > /dev/null 2> /dev/null && udevadm info --export-db ls -l /dev/disk/by* diff --git a/modules.d/99img-lib/img-lib.sh b/modules.d/99img-lib/img-lib.sh index 4700832..efc6475 100755 --- a/modules.d/99img-lib/img-lib.sh +++ b/modules.d/99img-lib/img-lib.sh @@ -106,3 +106,37 @@ unpack_img() { } fi } + +# parameter: <size of live image> in MiB +# Call emergency shell if ram size is too small for the image. +# Increase /run tmpfs size, if needed. +check_live_ram() { + local minmem imgsize memsize runsize runavail + minmem=$(getarg rd.minmem) + imgsize=$1 + memsize=$(($(check_meminfo MemTotal:) >> 10)) + # shellcheck disable=SC2046 + set -- $(findmnt -bnro SIZE,AVAIL /run) + # bytes to MiB + runsize=$(($1 >> 20)) + runavail=$(($2 >> 20)) + + [ "$imgsize" ] || { + warn "Image size could not be determined" + return 0 + } + + if [ $((memsize - imgsize)) -lt "${minmem:=1024}" ]; then + sed -i "N;/and attach it to a bug report./s/echo$/echo\n\ + echo \n\ + echo 'Warning!!!'\n\ + echo 'The memory size of your system is too small for this live image.'\n\ + echo 'Expect killed processes due to out of memory conditions.'\n\ + echo \n/" /usr/bin/dracut-emergency + + emergency_shell + elif [ $((runavail - imgsize)) -lt "$minmem" ]; then + # Increase /run tmpfs size, if needed. + mount -o remount,size=$((runsize - runavail + imgsize + minmem))M /run + fi +} diff --git a/modules.d/99memstrack/module-setup.sh b/modules.d/99memstrack/module-setup.sh index 27563eb..b25a966 100755 --- a/modules.d/99memstrack/module-setup.sh +++ b/modules.d/99memstrack/module-setup.sh @@ -1,11 +1,12 @@ #!/bin/bash check() { - if ! require_binaries pgrep pkill memstrack; then - dinfo "memstrack is not available" - dinfo "If you need to use rd.memdebug>=4, please install memstrack and procps-ng" - return 1 - fi + # If you need to use rd.memdebug>=4, please install all the required binary dependencies + require_binaries \ + pgrep \ + pkill \ + memstrack \ + || return 1 return 0 } diff --git a/modules.d/99shutdown/module-setup.sh b/modules.d/99shutdown/module-setup.sh index 2b99902..f53017f 100755 --- a/modules.d/99shutdown/module-setup.sh +++ b/modules.d/99shutdown/module-setup.sh @@ -17,9 +17,11 @@ install() { inst_multiple umount poweroff reboot halt losetup stat sleep timeout inst_multiple -o kexec inst "$moddir/shutdown.sh" "$prefix/shutdown" - [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib - mkdir -m 0755 -p "${initdir}"/lib/dracut - mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks + mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks + + # symlink to old hooks location for compatibility + ln_r /var/lib/dracut/hooks /lib/dracut/hooks + for _d in $hookdirs shutdown shutdown-emergency; do mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks/"$_d" done diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh index d611d44..d48d7d1 100755 --- a/modules.d/99shutdown/shutdown.sh +++ b/modules.d/99shutdown/shutdown.sh @@ -39,7 +39,7 @@ if [ "$ACTION" = "kexec" ] && ! command -v kexec > /dev/null 2>&1; then fi trap "emergency_shell --shutdown shutdown Signal caught!" 0 -getarg 'rd.break=pre-shutdown' && emergency_shell --shutdown pre-shutdown "Break before pre-shutdown" +getargs 'rd.break=pre-shutdown' && emergency_shell --shutdown pre-shutdown "Break before pre-shutdown" source_hook pre-shutdown @@ -155,7 +155,7 @@ elif [ -x /oldroot/bin/plymouth ]; then /oldroot/bin/plymouth --hide-splash fi -getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown" +getargs 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown" case "$ACTION" in reboot | poweroff | halt) diff --git a/src/dracut-cpio/src/main.rs b/src/dracut-cpio/src/main.rs index c3bfe90..89662fe 100644 --- a/src/dracut-cpio/src/main.rs +++ b/src/dracut-cpio/src/main.rs @@ -286,7 +286,7 @@ fn archive_path<W: Seek + Write>( mut writer: W, ) -> std::io::Result<()> { let inpath = path; - let mut outpath = path.clone(); + let mut outpath = path; let mut datalen: u32 = 0; let mut rmajor: u32 = 0; let mut rminor: u32 = 0; diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index 485143a..0c34363 100644 --- a/src/install/dracut-install.c +++ b/src/install/dracut-install.c @@ -608,7 +608,7 @@ static int resolve_deps(const char *src) break; if (strstr(buf, "cannot be preloaded")) - break; + continue; if (strstr(buf, destrootdir)) break; @@ -828,7 +828,7 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir if (ret == 0) { if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { log_debug("'%s' already exists, but checking for any deps", fulldstpath); - ret = resolve_deps(fulldstpath + sysrootdirlen); + ret = resolve_deps(fullsrcpath + sysrootdirlen); } else log_debug("'%s' already exists", fulldstpath); @@ -2275,6 +2275,17 @@ finish2: hashmap_free(modules_suppliers); hashmap_free(processed_suppliers); + if (arg_mod_filter_path) + regfree(&mod_filter_path); + if (arg_mod_filter_nopath) + regfree(&mod_filter_nopath); + if (arg_mod_filter_symbol) + regfree(&mod_filter_symbol); + if (arg_mod_filter_nosymbol) + regfree(&mod_filter_nosymbol); + if (arg_mod_filter_noname) + regfree(&mod_filter_noname); + strv_free(firmwaredirs); strv_free(pathdirs); return r; diff --git a/src/install/util.h b/src/install/util.h index f022f15..358afc8 100644 --- a/src/install/util.h +++ b/src/install/util.h @@ -113,7 +113,7 @@ bool streq_ptr(const char *a, const char *b); #define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n))) -#define malloc0(n) (calloc((n), 1)) +#define malloc0(n) (calloc(1, (n))) static inline const char *yes_no(bool b) { diff --git a/src/util/util.c b/src/util/util.c index b3498df..1d15241 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -273,7 +273,7 @@ static int getargs(int argc, char **argv) cmdline = next_arg(cmdline, &key, &value); if (strcmp(key, search_key) == 0) { if (search_value) { - if (strcmp(value, search_value) == 0) { + if (value && strcmp(value, search_value) == 0) { printf("%s\n", value); found_value = true; } diff --git a/test/Makefile b/test/Makefile index dfaa450..518e7d6 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,7 +1,6 @@ .PHONY: all check clean $(wildcard TEST-??-*) $(wildcard TEST-??-*): - @[ "$(shell id -u)" = 0 ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } @{ \ [ -d $@ ] || exit 0; \ [ -f $@/Makefile ] || exit 0; \ diff --git a/test/TEST-01-BASIC/create-root.sh b/test/TEST-01-BASIC/create-root.sh index 633b11f..0fe0f67 100755 --- a/test/TEST-01-BASIC/create-root.sh +++ b/test/TEST-01-BASIC/create-root.sh @@ -12,11 +12,11 @@ udevadm settle set -ex -mkfs.ext4 -L ' rdinit=/bin/sh' /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L ' rdinit=/bin/sh' /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync status=none of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker poweroff -f diff --git a/test/TEST-01-BASIC/test-init.sh b/test/TEST-01-BASIC/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-01-BASIC/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index b3a8656..252c3f9 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -8,14 +8,13 @@ TEST_DESCRIPTION="root filesystem on a ext4 filesystem" test_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot \"root=LABEL= rdinit=/bin/sh\" rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \ + -append 'rw "root=LABEL= rdinit=/bin/sh" rd.retry=3' \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 @@ -23,12 +22,8 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -36,19 +31,16 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ - -I "mkfs.ext4" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 80 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -59,12 +51,9 @@ test_setup() { rm -- "$TESTDIR"/marker.img # make sure --omit-drivers does not filter out drivers using regexp to test for an earlier regression (assuming there is no one letter linux kernel module needed to run the test) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test watchdog" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod i6300esb ib700wdt" \ + test_dracut \ --omit-drivers 'a b c d e f g h i j k l m n o p q r s t u v w x y z' \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-02-SYSTEMD/create-root.sh b/test/TEST-02-SYSTEMD/create-root.sh index c1fbe76..5f82ac3 100755 --- a/test/TEST-02-SYSTEMD/create-root.sh +++ b/test/TEST-02-SYSTEMD/create-root.sh @@ -11,11 +11,11 @@ udevadm control --reload set -e udevadm settle -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-02-SYSTEMD/test-init.sh b/test/TEST-02-SYSTEMD/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-02-SYSTEMD/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh index 40d1b3e..4d48fd2 100755 --- a/test/TEST-02-SYSTEMD/test.sh +++ b/test/TEST-02-SYSTEMD/test.sh @@ -11,13 +11,13 @@ test_check() { test_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \ + -append "root=LABEL=dracut rw systemd.log_target=console rd.retry=3 init=/sbin/init" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 @@ -25,12 +25,8 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -38,9 +34,8 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ - -I "mkfs.ext4" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ --nomdadmconf \ --no-hostonly-cmdline -N \ @@ -49,8 +44,8 @@ test_setup() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 80 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -62,14 +57,11 @@ test_setup() { # systemd-analyze.sh calls man indirectly # make the man command succeed always - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test systemd" \ - -o "network kernel-network-modules" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + test_dracut \ + -a "systemd" \ -i ./systemd-analyze.sh /lib/dracut/hooks/pre-pivot/00-systemd-analyze.sh \ -i "/bin/true" "/usr/bin/man" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-03-USR-MOUNT/create-root.sh b/test/TEST-03-USR-MOUNT/create-root.sh index 411fa99..734f377 100755 --- a/test/TEST-03-USR-MOUNT/create-root.sh +++ b/test/TEST-03-USR-MOUNT/create-root.sh @@ -12,22 +12,22 @@ set -e udevadm settle modprobe btrfs || : -mkfs.btrfs -L dracut /dev/disk/by-id/ata-disk_root -mkfs.btrfs -L dracutusr /dev/disk/by-id/ata-disk_usr -btrfs device scan /dev/disk/by-id/ata-disk_root -btrfs device scan /dev/disk/by-id/ata-disk_usr +mkfs.btrfs -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +mkfs.btrfs -q -L dracutusr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr mkdir -p /root -mount -t btrfs /dev/disk/by-id/ata-disk_root /root +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root [ -d /root/usr ] || mkdir -p /root/usr -mount -t btrfs /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr btrfs subvolume create /root/usr/usr umount /root/usr -mount -t btrfs -o subvol=usr /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs -o subvol=usr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr cp -a -t /root /source/* mkdir -p /root/run btrfs filesystem sync /root/usr btrfs filesystem sync /root umount /root/usr umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-03-USR-MOUNT/fstab b/test/TEST-03-USR-MOUNT/fstab index feac57a..114f945 100644 --- a/test/TEST-03-USR-MOUNT/fstab +++ b/test/TEST-03-USR-MOUNT/fstab @@ -1,2 +1,2 @@ -/dev/disk/by-id/ata-disk_root / btrfs defaults 0 0 -/dev/disk/by-id/ata-disk_usr /usr btrfs subvol=usr,ro 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root / btrfs defaults 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /usr btrfs subvol=usr,ro 0 0 diff --git a/test/TEST-03-USR-MOUNT/test-init.sh b/test/TEST-03-USR-MOUNT/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-03-USR-MOUNT/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh index 69ffda3..c64a582 100755 --- a/test/TEST-03-USR-MOUNT/test.sh +++ b/test/TEST-03-USR-MOUNT/test.sh @@ -15,15 +15,14 @@ client_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts loglevel=7 rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "root=LABEL=dracut $client_opts rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing || return 1 if ! test_marker_check; then @@ -41,13 +40,9 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ -i ./fstab /etc/fstab \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -55,22 +50,19 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ -I "mkfs.btrfs" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --nomdadmconf \ - --nohardlink \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank file to use as a root filesystem declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root 160 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -83,12 +75,9 @@ test_setup() { return 1 fi - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test watchdog" \ - -o "network kernel-network-modules" \ - -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -d "btrfs" \ + "$TESTDIR"/initramfs.testing rm -rf -- "$TESTDIR"/overlay } diff --git a/test/TEST-04-FULL-SYSTEMD/create-root.sh b/test/TEST-04-FULL-SYSTEMD/create-root.sh index 411fa99..734f377 100755 --- a/test/TEST-04-FULL-SYSTEMD/create-root.sh +++ b/test/TEST-04-FULL-SYSTEMD/create-root.sh @@ -12,22 +12,22 @@ set -e udevadm settle modprobe btrfs || : -mkfs.btrfs -L dracut /dev/disk/by-id/ata-disk_root -mkfs.btrfs -L dracutusr /dev/disk/by-id/ata-disk_usr -btrfs device scan /dev/disk/by-id/ata-disk_root -btrfs device scan /dev/disk/by-id/ata-disk_usr +mkfs.btrfs -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +mkfs.btrfs -q -L dracutusr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root +btrfs device scan /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr mkdir -p /root -mount -t btrfs /dev/disk/by-id/ata-disk_root /root +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root [ -d /root/usr ] || mkdir -p /root/usr -mount -t btrfs /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr btrfs subvolume create /root/usr/usr umount /root/usr -mount -t btrfs -o subvol=usr /dev/disk/by-id/ata-disk_usr /root/usr +mount -t btrfs -o subvol=usr /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /root/usr cp -a -t /root /source/* mkdir -p /root/run btrfs filesystem sync /root/usr btrfs filesystem sync /root umount /root/usr umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-04-FULL-SYSTEMD/fstab b/test/TEST-04-FULL-SYSTEMD/fstab index feac57a..114f945 100644 --- a/test/TEST-04-FULL-SYSTEMD/fstab +++ b/test/TEST-04-FULL-SYSTEMD/fstab @@ -1,2 +1,2 @@ -/dev/disk/by-id/ata-disk_root / btrfs defaults 0 0 -/dev/disk/by-id/ata-disk_usr /usr btrfs subvol=usr,ro 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root / btrfs defaults 0 0 +/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_usr /usr btrfs subvol=usr,ro 0 0 diff --git a/test/TEST-04-FULL-SYSTEMD/test-init.sh b/test/TEST-04-FULL-SYSTEMD/test-init.sh index b7261b5..eeec8a2 100755 --- a/test/TEST-04-FULL-SYSTEMD/test-init.sh +++ b/test/TEST-04-FULL-SYSTEMD/test-init.sh @@ -1,41 +1,21 @@ #!/bin/sh : > /dev/watchdog -. /lib/dracut-lib.sh - export PATH=/usr/sbin:/usr/bin:/sbin:/bin command -v plymouth > /dev/null 2>&1 && plymouth --quit exec > /dev/console 2>&1 systemctl --failed --no-legend --no-pager > /failed +ismounted() { + findmnt "$1" > /dev/null 2>&1 +} + if ! ismounted /usr; then echo "**************************FAILED**************************" echo "/usr not mounted!!" - cat /proc/mounts + cat /proc/mounts >> /failed echo "**************************FAILED**************************" -else - if [ -s /failed ]; then - echo "**************************FAILED**************************" - cat /failed - echo "**************************FAILED**************************" - - else - echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - echo "All OK" - fi fi -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -systemctl --no-block poweroff -exit 0 +. /sbin/test-init.sh diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh index 160104f..afd7645 100755 --- a/test/TEST-04-FULL-SYSTEMD/test.sh +++ b/test/TEST-04-FULL-SYSTEMD/test.sh @@ -20,14 +20,14 @@ client_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "systemd.unit=testsuite.target systemd.mask=systemd-firstboot panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \ + -append "systemd.unit=testsuite.target systemd.mask=systemd-firstboot rd.multipath=0 root=LABEL=dracut $client_opts rd.retry=3 $DEBUGOUT" \ -initrd "$TESTDIR"/initramfs.testing || return 1 if ! test_marker_check; then @@ -51,14 +51,12 @@ test_setup() { shopt -q -s globstar # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ - -m "test-root dbus" \ - -I "ldconfig" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root systemd-ldconfig" \ + -i "${PKGLIBDIR}/modules.d/80test-root/test-init.sh" "/sbin/test-init.sh" \ -i ./test-init.sh /sbin/test-init \ + -I "findmnt" \ -i ./fstab /etc/fstab \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && cp -a "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* && export initdir=$TESTDIR/overlay/source @@ -69,6 +67,8 @@ test_setup() { dpkg -L systemd | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l elif type -P pacman &> /dev/null; then pacman -Q -l systemd | while read -r _ a; do printf -- "%s\0" "$a"; done | xargs -0 -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l + elif type -P equery &> /dev/null; then + equery f 'sys-apps/systemd*' | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l else echo "Can't install systemd base" return 1 @@ -116,13 +116,10 @@ EOF # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot bash btrfs" \ -I "mkfs.btrfs" \ -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --nomdadmconf \ - --nohardlink \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay/* @@ -130,9 +127,9 @@ EOF declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.btrfs root 160 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.btrfs root 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/usr.btrfs usr 160 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -148,13 +145,11 @@ EOF [ -e /etc/machine-id ] && EXTRA_MACHINE="/etc/machine-id" [ -e /etc/machine-info ] && EXTRA_MACHINE+=" /etc/machine-info" - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "test systemd i18n qemu" \ + test_dracut \ + -a "systemd i18n qemu" \ + -d "btrfs" \ ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \ - -o "network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules rngd" \ - -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing rm -rf -- "$TESTDIR"/overlay } diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh index 05dec0f..865bfae 100755 --- a/test/TEST-10-RAID/create-root.sh +++ b/test/TEST-10-RAID/create-root.sh @@ -10,7 +10,7 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle set -ex -mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/ata-disk_raid[123] +mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid[123] # wait for the array to finish initializing, otherwise this sometimes fails # randomly. mdadm -W /dev/md0 || : @@ -22,7 +22,7 @@ lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test lvm vgcreate dracut /dev/mapper/dracut_crypt_test lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -L root /dev/dracut/root +mkfs.ext4 -q -L root /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -42,6 +42,6 @@ eval "$(udevadm info --query=property --name=/dev/md0 | while read -r line || [ echo "dracut-root-block-created" echo MD_UUID="$MD_UUID" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-10-RAID/finished-false.sh b/test/TEST-10-RAID/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-10-RAID/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-10-RAID/hard-off.sh b/test/TEST-10-RAID/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-10-RAID/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-10-RAID/test-init.sh b/test/TEST-10-RAID/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-10-RAID/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh index 15cbf56..0a2d094 100755 --- a/test/TEST-10-RAID/test.sh +++ b/test/TEST-10-RAID/test.sh @@ -7,117 +7,61 @@ TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a RAID-5" #DEBUGFAIL="rd.break rd.shell rd.debug debug" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rd.auto rw" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - inst_multiple grep - inst_multiple -o /lib/systemd/systemd-shutdown - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) - - # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount dd sync grep - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash crypt lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "root=/dev/cannotreach rw rootfstype=ext4 console=ttyS0,115200n81 selinux=0" \ + -append "root=/dev/cannotreach rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.makeroot || return 1 test_marker_check dracut-root-block-created || return 1 eval "$(grep -F -a -m 1 ID_FS_UUID "$TESTDIR"/marker.img)" - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - mkdir -p "$initdir"/etc - echo "testluks UUID=$ID_FS_UUID /etc/key" > "$initdir"/etc/crypttab - #echo "luks-$ID_FS_UUID /dev/md0 none" > $initdir/etc/crypttab - echo -n "test" > "$initdir"/etc/key - ) + echo "testluks UUID=$ID_FS_UUID /etc/key" > /tmp/crypttab + echo -n "test" > /tmp/key - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-11-LVM/create-root.sh b/test/TEST-11-LVM/create-root.sh index 015bfe7..5c0eff1 100755 --- a/test/TEST-11-LVM/create-root.sh +++ b/test/TEST-11-LVM/create-root.sh @@ -11,18 +11,18 @@ udevadm control --reload udevadm settle set -ex -for dev in /dev/disk/by-id/ata-disk_disk[123]; do +for dev in /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123]; do lvm pvcreate -ff -y "$dev" done -lvm vgcreate dracut /dev/disk/by-id/ata-disk_disk[123] +lvm vgcreate dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123] lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 /dev/dracut/root +mkfs.ext4 -q /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-11-LVM/finished-false.sh b/test/TEST-11-LVM/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-11-LVM/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-11-LVM/hard-off.sh b/test/TEST-11-LVM/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-11-LVM/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-11-LVM/test-init.sh b/test/TEST-11-LVM/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-11-LVM/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh index 2782810..fb76ab9 100755 --- a/test/TEST-11-LVM/test.sh +++ b/test/TEST-11-LVM/test.sh @@ -8,76 +8,35 @@ TEST_DESCRIPTION="root filesystem on LVM PV" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto=1 rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - mkdir -p "$initdir"/run - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash lvm mdraid kernel-modules" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay @@ -85,10 +44,10 @@ test_setup() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -96,21 +55,8 @@ test_setup() { -initrd "$TESTDIR"/initramfs.makeroot || return 1 test_marker_check dracut-root-block-created || return 1 - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-12-RAID-DEG/create-root.sh b/test/TEST-12-RAID-DEG/create-root.sh index 05dec0f..865bfae 100755 --- a/test/TEST-12-RAID-DEG/create-root.sh +++ b/test/TEST-12-RAID-DEG/create-root.sh @@ -10,7 +10,7 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle set -ex -mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/ata-disk_raid[123] +mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid[123] # wait for the array to finish initializing, otherwise this sometimes fails # randomly. mdadm -W /dev/md0 || : @@ -22,7 +22,7 @@ lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test lvm vgcreate dracut /dev/mapper/dracut_crypt_test lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -L root /dev/dracut/root +mkfs.ext4 -q -L root /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -42,6 +42,6 @@ eval "$(udevadm info --query=property --name=/dev/md0 | while read -r line || [ echo "dracut-root-block-created" echo MD_UUID="$MD_UUID" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-12-RAID-DEG/finished-false.sh b/test/TEST-12-RAID-DEG/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-12-RAID-DEG/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-12-RAID-DEG/hard-off.sh b/test/TEST-12-RAID-DEG/hard-off.sh deleted file mode 100755 index 8179d57..0000000 --- a/test/TEST-12-RAID-DEG/hard-off.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -sleep 5 -getargbool 0 rd.shell || poweroff -f -! getargbool 0 rd.break && getargbool 0 failme && poweroff -f diff --git a/test/TEST-12-RAID-DEG/test-init.sh b/test/TEST-12-RAID-DEG/test-init.sh deleted file mode 100755 index a5360ef..0000000 --- a/test/TEST-12-RAID-DEG/test-init.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -if [ -d /run/initramfs/etc ]; then - echo " rd.debug=0 " >> /run/initramfs/etc/cmdline -fi -poweroff -f diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh index da5177b..5c1b94e 100755 --- a/test/TEST-12-RAID-DEG/test.sh +++ b/test/TEST-12-RAID-DEG/test.sh @@ -11,18 +11,17 @@ TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a degraded RAID-5" client_run() { echo "CLIENT TEST START: $*" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker # degrade the RAID - # qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 + # qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* systemd.log_target=kmsg root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 log_buf_len=2M selinux=0 rd.shell=0 $DEBUGFAIL " \ + -append "$* systemd.log_target=kmsg root=LABEL=root rw log_buf_len=2M" \ -initrd "$TESTDIR"/initramfs.testing if ! test_marker_check; then @@ -56,69 +55,29 @@ test_run() { } test_setup() { - kernel=$KVERSION - # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$basedir"/dracut.sh -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount dd grep sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash crypt lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -132,28 +91,18 @@ test_setup() { eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)" echo "$MD_UUID" > "$TESTDIR"/mduuid - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - mkdir -p "$initdir"/etc - echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > "$initdir"/etc/mdadm.conf - echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > "$initdir"/etc/crypttab - echo -n test > "$initdir"/etc/key - chmod 0600 "$initdir"/etc/key - ) - - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > /tmp/mdadm.conf + echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > /tmp/crypttab + echo -n test > /tmp/key + chmod 0600 /tmp/key + + test_dracut \ + -m "crypt lvm mdraid" \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "/tmp/mdadm.conf" "/etc/mdadm.conf" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-13-ENC-RAID-LVM/create-root.sh b/test/TEST-13-ENC-RAID-LVM/create-root.sh index b681e6b..c51d027 100755 --- a/test/TEST-13-ENC-RAID-LVM/create-root.sh +++ b/test/TEST-13-ENC-RAID-LVM/create-root.sh @@ -13,12 +13,12 @@ udevadm settle set -ex printf test > keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk1 /keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk2 /keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_disk3 /keyfile -cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk1 dracut_disk1 < /keyfile -cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk2 dracut_disk2 < /keyfile -cryptsetup luksOpen /dev/disk/by-id/ata-disk_disk3 dracut_disk3 < /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk1 /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk2 /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk3 /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk1 dracut_disk1 < /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk2 dracut_disk2 < /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk3 dracut_disk3 < /keyfile mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/mapper/dracut_disk1 /dev/mapper/dracut_disk2 /dev/mapper/dracut_disk3 # wait for the array to finish initializing, otherwise this sometimes fails # randomly. @@ -28,7 +28,7 @@ lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 /dev/dracut/root +mkfs.ext4 -q /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -42,9 +42,9 @@ cryptsetup luksClose /dev/mapper/dracut_disk3 { echo "dracut-root-block-created" - for i in /dev/disk/by-id/ata-disk_disk[123]; do + for i in /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123]; do udevadm info --query=property --name="$i" | grep -F 'ID_FS_UUID=' done -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-13-ENC-RAID-LVM/finished-false.sh b/test/TEST-13-ENC-RAID-LVM/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-13-ENC-RAID-LVM/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-13-ENC-RAID-LVM/hard-off.sh b/test/TEST-13-ENC-RAID-LVM/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-13-ENC-RAID-LVM/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-13-ENC-RAID-LVM/test-init.sh b/test/TEST-13-ENC-RAID-LVM/test-init.sh deleted file mode 100755 index a5360ef..0000000 --- a/test/TEST-13-ENC-RAID-LVM/test-init.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -if [ -d /run/initramfs/etc ]; then - echo " rd.debug=0 " >> /run/initramfs/etc/cmdline -fi -poweroff -f diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh index fe79223..5129bcc 100755 --- a/test/TEST-13-ENC-RAID-LVM/test.sh +++ b/test/TEST-13-ENC-RAID-LVM/test.sh @@ -13,17 +13,16 @@ test_run() { echo "CLIENT TEST START: $LUKSARGS" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto rd.retry=20 rootwait $LUKSARGS" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 echo "CLIENT TEST END: [OK]" @@ -33,7 +32,7 @@ test_run() { echo "CLIENT TEST START: Any LUKS" "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto rd.retry=20" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 echo "CLIENT TEST END: [OK]" @@ -43,7 +42,7 @@ test_run() { echo "CLIENT TEST START: Wrong LUKS UUID" "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \ + -append "root=/dev/dracut/root rw rd.auto rd.luks.uuid=failme" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check && return 1 echo "CLIENT TEST END: [OK]" @@ -52,69 +51,31 @@ test_run() { } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount grep dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash crypt lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 80 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -127,31 +88,20 @@ test_setup() { printf ' rd.luks.uuid=luks-%s ' "$ID_FS_UUID" done > "$TESTDIR"/luks.txt - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - mkdir -p "$initdir"/etc - i=1 - for uuid in $cryptoUUIDS; do - eval "$uuid" - printf 'luks-%s /dev/disk/by-id/ata-disk_disk%s /etc/key timeout=0\n' "$ID_FS_UUID" $i - ((i += 1)) - done > "$initdir"/etc/crypttab - echo -n test > "$initdir"/etc/key - chmod 0600 "$initdir"/etc/key - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + i=1 + for uuid in $cryptoUUIDS; do + eval "$uuid" + printf 'luks-%s /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk%s /etc/key timeout=0\n' "$ID_FS_UUID" $i + ((i += 1)) + done > /tmp/crypttab + echo -n test > /tmp/key + chmod 0600 /tmp/key + + test_dracut \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-14-IMSM/create-root.sh b/test/TEST-14-IMSM/create-root.sh index 97d29d9..5055639 100755 --- a/test/TEST-14-IMSM/create-root.sh +++ b/test/TEST-14-IMSM/create-root.sh @@ -12,7 +12,7 @@ udevadm control --reload udevadm settle # dmraid does not want symlinks in --disk "..." -echo y | dmraid -f isw -C Test0 --type 1 --disk "$(realpath /dev/disk/by-id/ata-disk_disk1) $(realpath /dev/disk/by-id/ata-disk_disk2)" +echo y | dmraid -f isw -C Test0 --type 1 --disk "$(realpath /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk1) $(realpath /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk2)" udevadm settle SETS=$(dmraid -c -s) @@ -29,9 +29,9 @@ udevadm settle sfdisk -g /dev/mapper/isw*Test0 sfdisk --no-reread /dev/mapper/isw*Test0 << EOF ,4M -,28M -,28M -,28M +,56M +,56M +,56M EOF set -x @@ -59,7 +59,7 @@ lvm pvcreate -ff -y /dev/md0 lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -L root /dev/dracut/root +mkfs.ext4 -q -L root /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -72,7 +72,7 @@ echo "MD_UUID=$MD_UUID" { echo "dracut-root-block-created" echo MD_UUID="$MD_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none mdadm --wait-clean /dev/md0 sync poweroff -f diff --git a/test/TEST-14-IMSM/hard-off.sh b/test/TEST-14-IMSM/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-14-IMSM/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-14-IMSM/test-init.sh b/test/TEST-14-IMSM/test-init.sh deleted file mode 100755 index a5360ef..0000000 --- a/test/TEST-14-IMSM/test-init.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -if [ -d /run/initramfs/etc ]; then - echo " rd.debug=0 " >> /run/initramfs/etc/cmdline -fi -poweroff -f diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh index 06959cd..fc3e429 100755 --- a/test/TEST-14-IMSM/test.sh +++ b/test/TEST-14-IMSM/test.sh @@ -10,16 +10,15 @@ client_run() { echo "CLIENT TEST START: $*" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \ + -append "$* root=LABEL=root rw rd.retry=5" \ -initrd "$TESTDIR"/initramfs.testing || return 1 if ! test_marker_check; then @@ -50,68 +49,30 @@ test_run() { } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - inst_simple /etc/os-release - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - mkdir -p "$initdir"/run - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount grep dd sync realpath - inst_hook initqueue 01 ./create-root.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash lvm mdraid dmraid kernel-modules qemu" \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash lvm mdraid dmraid kernel-modules" \ -d "piix ide-gd_mod ata_piix ext4 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \ - --no-hostonly-cmdline -N \ + -I "grep sfdisk realpath" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank files to use as a root filesystem declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 200 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -127,21 +88,9 @@ test_setup() { fi echo "$MD_UUID" > "$TESTDIR"/mduuid - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + + test_dracut \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-15-BTRFSRAID/create-root.sh b/test/TEST-15-BTRFSRAID/create-root.sh index 075deac..f416185 100755 --- a/test/TEST-15-BTRFSRAID/create-root.sh +++ b/test/TEST-15-BTRFSRAID/create-root.sh @@ -12,17 +12,17 @@ udevadm settle set -e -mkfs.btrfs -draid10 -mraid10 -L root /dev/disk/by-id/ata-disk_raid[1234] +mkfs.btrfs -q -draid10 -mraid10 -L root /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid[1234] udevadm settle btrfs device scan udevadm settle mkdir -p /sysroot -mount -t btrfs /dev/disk/by-id/ata-disk_raid4 /sysroot +mount -t btrfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid4 /sysroot cp -a -t /sysroot /source/* umount /sysroot -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-15-BTRFSRAID/finished-false.sh b/test/TEST-15-BTRFSRAID/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-15-BTRFSRAID/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-15-BTRFSRAID/hard-off.sh b/test/TEST-15-BTRFSRAID/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-15-BTRFSRAID/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-15-BTRFSRAID/test-init.sh b/test/TEST-15-BTRFSRAID/test-init.sh deleted file mode 100755 index 068e8f3..0000000 --- a/test/TEST-15-BTRFSRAID/test-init.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / - -poweroff -f diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh index 068146e..2745950 100755 --- a/test/TEST-15-BTRFSRAID/test.sh +++ b/test/TEST-15-BTRFSRAID/test.sh @@ -6,18 +6,17 @@ TEST_DESCRIPTION="root filesystem on multiple device btrfs" #DEBUGFAIL="rd.shell" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-4.img raid4 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-4.img raid4 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ + -append "root=LABEL=root rw rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 } @@ -28,59 +27,21 @@ test_setup() { rm -f -- "$DISKIMAGE" dd if=/dev/zero of="$DISKIMAGE" bs=1M count=1024 - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp sync dd - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst_multiple grep - inst ./test-init.sh /sbin/init - inst_simple /etc/os-release - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.btrfs poweroff cp umount dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash btrfs rootfs-block kernel-modules qemu" \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash btrfs rootfs-block kernel-modules" \ -d "piix ide-gd_mod ata_piix btrfs sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + -I "mkfs.btrfs" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay @@ -89,11 +50,11 @@ test_setup() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1 150 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-2.img raid2 150 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-3.img raid3 150 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-4.img raid4 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-1.img raid1 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-2.img raid2 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-3.img raid3 150 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid-4.img raid4 150 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -102,21 +63,9 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" \ - -d "piix ide-gd_mod ata_piix btrfs sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -d "btrfs" \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-16-DMSQUASH/create-root.sh b/test/TEST-16-DMSQUASH/create-root.sh index f17b22f..b424a1a 100755 --- a/test/TEST-16-DMSQUASH/create-root.sh +++ b/test/TEST-16-DMSQUASH/create-root.sh @@ -13,29 +13,29 @@ set -e udevadm settle # create a single partition using 50% of the capacity of the image file created by test_setup() in test.sh -sfdisk /dev/disk/by-id/ata-disk_root << EOF +sfdisk /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root << EOF 2048,161792 EOF udevadm settle -mkfs.ext4 -q -L dracut /dev/disk/by-id/ata-disk_root-part1 +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root-part1 mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root-part1 /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root-part1 /root mkdir -p /root/run /root/testdir cp -a -t /root /source/* echo "Creating squashfs" mksquashfs /source /root/testdir/rootfs.img -quiet # Copy rootfs.img to the NTFS drive if exists -if [ -e "/dev/disk/by-id/ata-disk_root_ntfs" ]; then - mkfs.ntfs -F -L dracut_ntfs /dev/disk/by-id/ata-disk_root_ntfs +if [ -e "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_ntfs" ]; then + mkfs.ntfs -q -F -L dracut_ntfs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_ntfs mkdir -p /root_ntfs - mount -t ntfs3 /dev/disk/by-id/ata-disk_root_ntfs /root_ntfs + mount -t ntfs3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root_ntfs /root_ntfs mkdir -p /root_ntfs/run /root_ntfs/testdir cp /root/testdir/rootfs.img /root_ntfs/testdir/rootfs.img fi umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-16-DMSQUASH/test-init.sh b/test/TEST-16-DMSQUASH/test-init.sh index 959fa25..2d16b6b 100755 --- a/test/TEST-16-DMSQUASH/test-init.sh +++ b/test/TEST-16-DMSQUASH/test-init.sh @@ -1,13 +1,4 @@ #!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker if grep -qF ' rd.live.overlay=LABEL=persist ' /proc/cmdline; then # Writing to a file in the root filesystem lets test_run() verify that the autooverlay module successfully created @@ -15,17 +6,5 @@ if grep -qF ' rd.live.overlay=LABEL=persist ' /proc/cmdline; then echo "dracut-autooverlay-success" > /overlay-marker fi -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / - -poweroff -f +# call the rest of the init +. /sbin/init diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh index 3fecc92..6087ccd 100755 --- a/test/TEST-16-DMSQUASH/test.sh +++ b/test/TEST-16-DMSQUASH/test.sh @@ -9,19 +9,19 @@ TEST_DESCRIPTION="live root on a squash filesystem" test_run() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root # NTFS drive if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs + qemu_add_drive disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs fi test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-label/dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.overlay.overlayfs=1 root=live:/dev/disk/by-label/dracut" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 @@ -30,7 +30,7 @@ test_run() { "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.image rd.live.overlay.overlayfs=1 root=LABEL=dracut" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 @@ -39,18 +39,18 @@ test_run() { "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 # Run the NTFS test only if mkfs.ntfs is available if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then - dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 + dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 status=none "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut_ntfs console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=testdir root=LABEL=dracut_ntfs quiet rd.info rd.shell=0" \ -initrd "$TESTDIR"/initramfs.testing test_marker_check || return 1 @@ -63,7 +63,7 @@ test_run() { "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ - -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.overlay=LABEL=persist rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -append "init=/sbin/init-persist rd.live.image rd.live.overlay.overlayfs=1 rd.live.overlay=LABEL=persist rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ -initrd "$TESTDIR"/initramfs.testing-autooverlay rootPartitions=$(sfdisk -d "$TESTDIR"/root.img | grep -c 'root\.img[0-9]') @@ -81,12 +81,9 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./test-init.sh /sbin/init \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ - -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \ + -i ./test-init.sh /sbin/init-persist \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* @@ -94,25 +91,24 @@ test_setup() { # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ --modules "test-makeroot" \ - --install "sfdisk mkfs.ext4 mkfs.ntfs mksquashfs" \ + --install "sfdisk mkfs.ntfs mksquashfs" \ --drivers "ntfs3" \ --include ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ - --no-hostonly --no-hostonly-cmdline --no-early-microcode --nofscks --nomdadmconf --nohardlink --nostrip \ --force "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay # Create the blank file to use as a root filesystem declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root 160 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root 160 # NTFS drive if modprobe --dry-run ntfs3 &> /dev/null && command -v mkfs.ntfs &> /dev/null; then dd if=/dev/zero of="$TESTDIR"/root_ntfs.img bs=1MiB count=160 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs + qemu_add_drive disk_index disk_args "$TESTDIR"/root_ntfs.img root_ntfs fi # Invoke KVM and/or QEMU to actually create the target filesystem. @@ -131,22 +127,17 @@ test_setup() { SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3" EOF - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - --modules "test dash dmsquash-live qemu" \ - --omit "rngd" \ - --drivers "ext4 ntfs3 sd_mod" \ + test_dracut \ + --modules "dash dmsquash-live qemu" \ + --drivers "ntfs3" \ --install "mkfs.ext4" \ --include /tmp/ntfs3.rules /lib/udev/rules.d/ntfs3.rules \ - --no-hostonly --no-hostonly-cmdline \ - --force "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - --modules "test dmsquash-live-autooverlay qemu" \ - --omit "rngd" \ - --drivers "ext4 sd_mod" \ + test_dracut \ + --modules "dmsquash-live-autooverlay qemu" \ --install "mkfs.ext4" \ - --no-hostonly --no-hostonly-cmdline \ - --force "$TESTDIR"/initramfs.testing-autooverlay "$KVERSION" || return 1 + "$TESTDIR"/initramfs.testing-autooverlay rm -rf -- "$TESTDIR"/overlay } diff --git a/test/TEST-17-LVM-THIN/create-root.sh b/test/TEST-17-LVM-THIN/create-root.sh index 2547d1c..8c9c298 100755 --- a/test/TEST-17-LVM-THIN/create-root.sh +++ b/test/TEST-17-LVM-THIN/create-root.sh @@ -11,15 +11,16 @@ udevadm control --reload udevadm settle set -ex -for dev in /dev/disk/by-id/ata-disk_disk[123]; do +modprobe dm_thin_pool +for dev in /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123]; do lvm pvcreate -ff -y "$dev" done -lvm vgcreate dracut /dev/disk/by-id/ata-disk_disk[123] +lvm vgcreate dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_disk[123] lvm lvcreate --ignoremonitoring -l 100%FREE -T dracut/mythinpool lvm lvcreate --ignoremonitoring -V100M -T dracut/mythinpool -n root lvm vgchange --ignoremonitoring -ay -mkfs.ext4 /dev/dracut/root +mkfs.ext4 -q /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -27,7 +28,7 @@ umount /sysroot lvm lvchange -a n /dev/dracut/root if ! dmsetup status | grep -q out_of_data_space; then - echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none fi sync diff --git a/test/TEST-17-LVM-THIN/finished-false.sh b/test/TEST-17-LVM-THIN/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-17-LVM-THIN/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-17-LVM-THIN/hard-off.sh b/test/TEST-17-LVM-THIN/hard-off.sh deleted file mode 100755 index f4d19dc..0000000 --- a/test/TEST-17-LVM-THIN/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getarg failme && poweroff -f diff --git a/test/TEST-17-LVM-THIN/test-init.sh b/test/TEST-17-LVM-THIN/test-init.sh deleted file mode 100755 index 108e626..0000000 --- a/test/TEST-17-LVM-THIN/test-init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: > /dev/watchdog - -. /lib/dracut-lib.sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -command -v plymouth > /dev/null 2>&1 && plymouth --quit -exec > /dev/console 2>&1 - -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker - -export TERM=linux -export PS1='initramfs-test:\w\$ ' -[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -stty sane -echo "made it to the rootfs!" -if getargbool 0 rd.shell; then - strstr "$(setsid --help)" "control" && CTTY="-c" - setsid $CTTY sh -i -fi -echo "Powering down." -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh index 5010e48..9326433 100755 --- a/test/TEST-17-LVM-THIN/test.sh +++ b/test/TEST-17-LVM-THIN/test.sh @@ -7,75 +7,37 @@ TEST_DESCRIPTION="root filesystem on LVM PV with thin pool" test_run() { declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "root=/dev/dracut/root rw rd.auto=1 rd.driver.pre=dm_thin_pool rd.retry=3" \ -initrd "$TESTDIR"/initramfs.testing || return 1 test_marker_check || return 1 } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - ) - inst_multiple sh df free ls shutdown poweroff stty cat ps ln \ - mount dmesg mkdir cp dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - inst_multiple grep - inst_simple /etc/os-release - inst ./test-init.sh /sbin/init - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - mkdir -p "$initdir"/run - ldconfig -r "$initdir" - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount grep dmsetup dd sync - inst_hook initqueue 01 ./create-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot bash lvm mdraid kernel-modules" \ + -I "grep" \ + -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay @@ -83,10 +45,10 @@ test_setup() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-1.img disk1 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-2.img disk2 40 + qemu_add_drive disk_index disk_args "$TESTDIR"/disk-3.img disk3 40 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -94,21 +56,9 @@ test_setup() { -initrd "$TESTDIR"/initramfs.makeroot || return 1 test_marker_check dracut-root-block-created || return 1 - ( - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth network kernel-network-modules" \ - -a "debug" -I lvs \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -I lvs \ + "$TESTDIR"/initramfs.testing } # shellcheck disable=SC1090 diff --git a/test/TEST-18-UEFI/test-init.sh b/test/TEST-18-UEFI/test-init.sh deleted file mode 100755 index 03966d2..0000000 --- a/test/TEST-18-UEFI/test-init.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin - -[ -e /proc/self/mounts ] \ - || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc) - -grep -q '^sysfs /sys sysfs' /proc/self/mounts \ - || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys) - -grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \ - || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev) - -grep -q '^tmpfs /run tmpfs' /proc/self/mounts \ - || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run) - -: > /dev/watchdog - -exec > /dev/console 2>&1 - -echo "made it to the rootfs! Powering down." -echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sdb -poweroff -f diff --git a/test/TEST-18-UEFI/test.sh b/test/TEST-18-UEFI/test.sh index 4191fed..769a0e3 100755 --- a/test/TEST-18-UEFI/test.sh +++ b/test/TEST-18-UEFI/test.sh @@ -3,16 +3,10 @@ # shellcheck disable=SC2034 TEST_DESCRIPTION="UEFI boot" -# Linux kernel requirements -# CONFIG_BLK_DEV_INITRD for initramfs -# CONFIG_EFI_HANDOVER_PROTOCOL for ovmf (Open Virtual Machine Firmware) -# CONFIG_SATA_AHCI for ahci.ko -# CONFIG_BLK_DEV_SD for sd_mod.ko -# CONFIG_SQUASHFS_ZLIB for squashfs.ko - ovmf_code() { for path in \ "/usr/share/OVMF/OVMF_CODE.fd" \ + "/usr/share/OVMF/OVMF_CODE_4M.fd" \ "/usr/share/edk2/x64/OVMF_CODE.fd" \ "/usr/share/edk2-ovmf/OVMF_CODE.fd" \ "/usr/share/qemu/ovmf-x86_64-4m.bin"; do @@ -24,33 +18,11 @@ test_check() { [[ -n "$(ovmf_code)" ]] } -KVERSION="${KVERSION-$(uname -r)}" - -test_marker_reset() { - dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 -} - -test_marker_check() { - grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/marker.img - return $? -} - -test_dracut() { - TEST_DRACUT_ARGS+=" --local --no-hostonly --no-early-microcode --add test --kver $KVERSION" - - # shellcheck disable=SC2162 - IFS=' ' read -a TEST_DRACUT_ARGS_ARRAY <<< "$TEST_DRACUT_ARGS" - - "$DRACUT" "$@" \ - --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \ - "${TEST_DRACUT_ARGS_ARRAY[@]}" || return 1 -} - test_run() { declare -a disk_args=() declare -i disk_index=1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker - qemu_add_drive_args disk_index disk_args "$TESTDIR"/squashfs.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/squashfs.img root test_marker_reset "$testdir"/run-qemu "${disk_args[@]}" -net none \ @@ -62,8 +34,8 @@ test_run() { test_setup() { # Create what will eventually be our root filesystem - "$DRACUT" --local --no-hostonly --no-early-microcode --nofscks \ - --tmpdir "$TESTDIR" --keep --modules "test-root" --include ./test-init.sh /sbin/init \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ "$TESTDIR"/tmp-initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/dracut.*/initramfs/proc @@ -71,15 +43,18 @@ test_setup() { mkdir -p "$TESTDIR"/ESP/EFI/BOOT - if [ -f "/usr/lib/gummiboot/linuxx64.efi.stub" ]; then - TEST_DRACUT_ARGS+=" --uefi-stub /usr/lib/gummiboot/linuxx64.efi.stub " - fi + test_dracut \ + --modules 'rootfs-block' \ + --kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \ + --drivers 'squashfs' \ + --uefi \ + "$TESTDIR"/ESP/EFI/BOOT/BOOTX64.efi - mkdir -p "$TESTDIR"/ESP/EFI/BOOT test_dracut \ - --modules 'rootfs-block test' \ - --kernel-cmdline 'root=/dev/sdc ro rd.skipfsck rootfstype=squashfs' \ - --drivers 'ahci sd_mod squashfs' \ + --hostonly \ + --modules 'rootfs-block' \ + --kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \ + --drivers 'squashfs' \ --uefi \ "$TESTDIR"/ESP/EFI/BOOT/BOOTX64.efi } diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh index 061a2b1..04fb6a7 100755 --- a/test/TEST-20-NFS/client-init.sh +++ b/test/TEST-20-NFS/client-init.sh @@ -20,10 +20,17 @@ echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "nfs" -a "$fstype" != "nfs4" ] && continue - echo "nfs-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "nfs-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts +# fail the test of rd.live.overlay did not worked as expected +if grep -qF 'rd.live.overlay' /proc/cmdline; then + if ! strstr "$(cat /proc/mounts)" LiveOS_rootfs; then + echo "nfs-FAIL" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none + fi +fi + if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then serverip=${dev%:*} @@ -36,11 +43,11 @@ if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then echo test:nfs_fetch_url nfs::"${serverip}":"${path}"/root/fetchfile if nfs_fetch_url nfs::"${serverip}":"${path}"/root/fetchfile /run/nfsfetch.out; then echo nfsfetch-OK - echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker2 + echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker2 status=none fi else echo nfsfetch-BYPASS fstype="${fstype}" - echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker2 + echo "nfsfetch-OK" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker2 status=none fi : > /dev/watchdog diff --git a/test/TEST-20-NFS/create-root.sh b/test/TEST-20-NFS/create-root.sh index 8060b00..0518937 100755 --- a/test/TEST-20-NFS/create-root.sh +++ b/test/TEST-20-NFS/create-root.sh @@ -12,12 +12,12 @@ udevadm settle set -ex -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh index b7cca75..1be5a73 100755 --- a/test/TEST-20-NFS/test.sh +++ b/test/TEST-20-NFS/test.sh @@ -3,9 +3,13 @@ # shellcheck disable=SC2034 TEST_DESCRIPTION="root filesystem on NFS with $USE_NETWORK" +test_check() { + command -v exportfs &> /dev/null +} + # Uncomment this to debug failures #DEBUGFAIL="rd.debug loglevel=7 rd.break=initqueue rd.shell" -SERVER_DEBUG="rd.debug loglevel=7" +#SERVER_DEBUG="rd.debug loglevel=7" #SERIAL="unix:/tmp/server.sock" run_server() { @@ -14,14 +18,13 @@ run_server() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 0 1 "$testdir"/run-qemu \ "${disk_args[@]}" \ -net socket,listen=127.0.0.1:12320 \ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ - -device i6300esb -watchdog-action poweroff \ -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 @@ -55,16 +58,15 @@ client_test() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker2.img marker2 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker2.img marker2 1 cmdline="$cmdline rd.net.timeout.dhcp=30" "$testdir"/run-qemu \ "${disk_args[@]}" \ -net nic,macaddr="$mac",model=e1000 \ -net socket,connect=127.0.0.1:12320 \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=10 quiet ro console=ttyS0,115200n81 selinux=0" \ + -append "$cmdline ro" \ -initrd "$TESTDIR"/initramfs.testing # shellcheck disable=SC2181 @@ -213,8 +215,9 @@ test_run() { return 1 fi - test_nfsv3 \ - && test_nfsv4 + # focus on NFSv4 testing, disable NFSv3 tests + #test_nfsv3 + test_nfsv4 ret=$? @@ -247,7 +250,7 @@ test_setup() { ) inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping exportfs \ + dmesg mkdir cp exportfs \ modprobe rpc.nfsd rpc.mountd showmount tcpdump \ sleep mount chmod rm for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -307,7 +310,7 @@ test_setup() { ) inst_multiple sh shutdown poweroff stty cat ps ln ip dd \ - mount dmesg mkdir cp ping grep setsid ls vi less cat sync + mount dmesg mkdir cp grep setsid ls vi less cat sync for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do if [ -f "${_terminfodir}"/l/linux ]; then inst_multiple -o "${_terminfodir}"/l/linux @@ -318,7 +321,7 @@ test_setup() { inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" inst_simple "${PKGLIBDIR}/modules.d/45url-lib/url-lib.sh" "/lib/url-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/40network/net-lib.sh" "/lib/net-lib.sh" + inst_simple "${PKGLIBDIR}/modules.d/45net-lib/net-lib.sh" "/lib/net-lib.sh" inst_simple "${PKGLIBDIR}/modules.d/95nfs/nfs-lib.sh" "/lib/nfs-lib.sh" inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" @@ -354,7 +357,7 @@ test_setup() { export initdir=$TESTDIR/server/overlay # shellcheck disable=SC1090 . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd + inst_multiple mkfs.ext4 poweroff cp umount sync dd inst_hook initqueue 01 ./create-root.sh inst_hook initqueue/finished 01 ./finished-false.sh ) @@ -373,8 +376,8 @@ test_setup() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 80 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 160 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -398,11 +401,9 @@ test_setup() { ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth" \ - -a "dmsquash-live debug watchdog ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -a "dmsquash-live ${USE_NETWORK}" \ + "$TESTDIR"/initramfs.testing ( # shellcheck disable=SC2031 @@ -415,7 +416,7 @@ test_setup() { ) # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash rootfs-block debug kernel-modules watchdog qemu network network-legacy" \ + -m "bash rootfs-block debug kernel-modules watchdog qemu network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 i6300esb" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh index 46a5e3f..d7f1370 100755 --- a/test/TEST-30-ISCSI/client-init.sh +++ b/test/TEST-30-ISCSI/client-init.sh @@ -11,7 +11,7 @@ stty sane echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "ext4" ] && continue - echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts diff --git a/test/TEST-30-ISCSI/create-client-root.sh b/test/TEST-30-ISCSI/create-client-root.sh index 267c93a..6c6bc9a 100755 --- a/test/TEST-30-ISCSI/create-client-root.sh +++ b/test/TEST-30-ISCSI/create-client-root.sh @@ -12,22 +12,22 @@ udevadm settle set -ex -mkfs.ext4 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot +mkfs.ext4 -q -j -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot mkdir -p /sysroot -mount -t ext4 /dev/disk/by-id/ata-disk_singleroot /sysroot +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot cp -a -t /sysroot /source/* umount /sysroot -mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2 +mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 mdadm -W /dev/md0 || : lvm pvcreate -ff -y /dev/md0 lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -j -L sysroot /dev/dracut/root +mkfs.ext4 -q -j -L sysroot /dev/dracut/root mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-30-ISCSI/create-server-root.sh b/test/TEST-30-ISCSI/create-server-root.sh index 2dbc2da..004e79b 100755 --- a/test/TEST-30-ISCSI/create-server-root.sh +++ b/test/TEST-30-ISCSI/create-server-root.sh @@ -10,11 +10,11 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-30-ISCSI/server-init.sh b/test/TEST-30-ISCSI/server-init.sh index a1c3b7e..f89464e 100755 --- a/test/TEST-30-ISCSI/server-init.sh +++ b/test/TEST-30-ISCSI/server-init.sh @@ -69,9 +69,9 @@ tgtd tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0 tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1 tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2 -tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/ata-disk_singleroot -tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1 -tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2 +tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot +tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 +tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101 diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh index ac9f096..f4bf33e 100755 --- a/test/TEST-30-ISCSI/test.sh +++ b/test/TEST-30-ISCSI/test.sh @@ -13,10 +13,10 @@ run_server() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -24,7 +24,7 @@ run_server() { -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ -net socket,listen=127.0.0.1:12330 \ - -append "panic=1 oops=panic softlockup_panic=1 quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 quiet root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -53,7 +53,7 @@ run_client() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ @@ -126,28 +126,31 @@ test_check() { echo "Need tgtd and tgtadm from scsi-target-utils" return 1 fi + if ! [ -f /lib/systemd/system/iscsiuio.socket ]; then + echo "Need iscsiuio.socket to run this test" + return 1 + fi } test_setup() { # Create what will eventually be the client root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ -m "test-root" \ - -i ./client-init.sh /sbin/init \ - -I "ip ping grep setsid" \ + -I "ip grep setsid" \ -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - --no-hostonly --no-hostonly-cmdline --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ -m "test-makeroot crypt lvm mdraid" \ - -I "mkfs.ext4 setsid blockdev" \ + -I "setsid blockdev" \ -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 @@ -155,10 +158,10 @@ test_setup() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot 200 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -169,40 +172,36 @@ test_setup() { rm -- "$TESTDIR"/marker.img # Create what will eventually be the server root filesystem onto an overlay - "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ - -m "test-root network network-legacy" \ + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy" \ -d "iscsi_tcp crc32c ipv6" \ - -i ./server-init.sh /sbin/init \ -i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ -i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ - -I "modprobe chmod ip ping tcpdump setsid pidof tgtd tgtadm /etc/passwd" \ + -I "modprobe chmod ip tcpdump setsid pidof tgtd tgtadm /etc/passwd" \ --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ -i "./hosts" "/etc/hosts" \ -i "./dhcpd.conf" "/etc/dhcpd.conf" \ - --no-hostonly --no-hostonly-cmdline --nohardlink \ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* mkdir -p "$TESTDIR"/overlay/source/var/lib/dhcpd + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ -m "test-makeroot" \ - -I "mkfs.ext4" \ -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 240 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -214,8 +213,8 @@ test_setup() { # Make server's dracut image "$DRACUT" -l \ - -a "dash rootfs-block test kernel-modules network network-legacy" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ + -a "dash rootfs-block test kernel-modules network-legacy" \ + -d "piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg virtio_pci virtio_scsi" \ -i "./server.link" "/etc/systemd/network/01-server.link" \ -i ./wait-if-server.sh /lib/dracut/hooks/pre-mount/99-wait-if-server.sh \ --no-hostonly-cmdline -N \ diff --git a/test/TEST-35-ISCSI-MULTI/client-init.sh b/test/TEST-35-ISCSI-MULTI/client-init.sh index 46a5e3f..d7f1370 100755 --- a/test/TEST-35-ISCSI-MULTI/client-init.sh +++ b/test/TEST-35-ISCSI-MULTI/client-init.sh @@ -11,7 +11,7 @@ stty sane echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "ext4" ] && continue - echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts diff --git a/test/TEST-35-ISCSI-MULTI/create-client-root.sh b/test/TEST-35-ISCSI-MULTI/create-client-root.sh index 267c93a..6c6bc9a 100755 --- a/test/TEST-35-ISCSI-MULTI/create-client-root.sh +++ b/test/TEST-35-ISCSI-MULTI/create-client-root.sh @@ -12,22 +12,22 @@ udevadm settle set -ex -mkfs.ext4 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot +mkfs.ext4 -q -j -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot mkdir -p /sysroot -mount -t ext4 /dev/disk/by-id/ata-disk_singleroot /sysroot +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot cp -a -t /sysroot /source/* umount /sysroot -mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2 +mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 mdadm -W /dev/md0 || : lvm pvcreate -ff -y /dev/md0 lvm vgcreate dracut /dev/md0 lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay -mkfs.ext4 -j -L sysroot /dev/dracut/root +mkfs.ext4 -q -j -L sysroot /dev/dracut/root mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/create-server-root.sh b/test/TEST-35-ISCSI-MULTI/create-server-root.sh index 2dbc2da..004e79b 100755 --- a/test/TEST-35-ISCSI-MULTI/create-server-root.sh +++ b/test/TEST-35-ISCSI-MULTI/create-server-root.sh @@ -10,11 +10,11 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/finished-false.sh b/test/TEST-35-ISCSI-MULTI/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-35-ISCSI-MULTI/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-35-ISCSI-MULTI/hard-off.sh b/test/TEST-35-ISCSI-MULTI/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-35-ISCSI-MULTI/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/server-init.sh b/test/TEST-35-ISCSI-MULTI/server-init.sh index a1c3b7e..f89464e 100755 --- a/test/TEST-35-ISCSI-MULTI/server-init.sh +++ b/test/TEST-35-ISCSI-MULTI/server-init.sh @@ -69,9 +69,9 @@ tgtd tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0 tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1 tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2 -tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/ata-disk_singleroot -tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1 -tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2 +tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot +tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 +tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101 diff --git a/test/TEST-35-ISCSI-MULTI/test.sh b/test/TEST-35-ISCSI-MULTI/test.sh index 3e649a8..f807798 100755 --- a/test/TEST-35-ISCSI-MULTI/test.sh +++ b/test/TEST-35-ISCSI-MULTI/test.sh @@ -13,10 +13,10 @@ run_server() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -24,7 +24,7 @@ run_server() { -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ -net socket,listen=127.0.0.1:12331 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -52,7 +52,7 @@ run_client() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ @@ -60,7 +60,7 @@ run_client() { -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ -net socket,connect=127.0.0.1:12331 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ + -append "rw rd.auto rd.retry=50 $*" \ -initrd "$TESTDIR"/initramfs.testing if ! test_marker_check iscsi-OK; then echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" @@ -138,70 +138,44 @@ test_check() { echo "Need tgtd and tgtadm from scsi-target-utils" return 1 fi + if ! [ -f /lib/systemd/system/iscsiuio.socket ]; then + echo "Need iscsiuio.socket to run this test" + return 1 + fi } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay rm -rf -- "$TESTDIR"/overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - mkdir -p -- var/lib/nfs/rpc_pipefs - ) - inst_multiple sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep setsid dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - inst_simple /etc/os-release - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip grep setsid" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount setsid dd sync blockdev - inst_hook initqueue 01 ./create-client-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot crypt lvm mdraid" \ + -I "setsid blockdev" \ + -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot 200 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot 400 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 200 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -211,82 +185,37 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 rm -- "$TESTDIR"/marker.img - # shellcheck disable=SC2031 - export kernel=$KVERSION rm -rf -- "$TESTDIR"/overlay - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi - ) - inst /etc/passwd /etc/passwd - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping modprobe tcpdump setsid \ - sleep mount chmod pidof - inst_multiple tgtd tgtadm - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - instmods iscsi_tcp crc32c ipv6 af_packet - [ -f /etc/netconfig ] && inst_multiple /etc/netconfig - type -P dhcpd > /dev/null && inst_multiple dhcpd - inst ./server-init.sh /sbin/init - inst ./hosts /etc/hosts - inst ./dhcpd.conf /etc/dhcpd.conf - inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \ - {,/usr}/etc/protocols {,/usr}/etc/services \ - /etc/group /etc/os-release - - _nsslibs=$( - cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \ - | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|' - ) - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - dracut_kernel_post - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy iscsi" \ + -d "iscsi_tcp crc32c ipv6 af_packet" \ + -I "ip grep sleep setsid chmod modprobe pidof tgtd tgtadm" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ + -i /tmp/config /etc/nbd-server/config \ + -i "./hosts" "/etc/hosts" \ + -i "./dhcpd.conf" "/etc/dhcpd.conf" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/iscsi + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd - inst_hook initqueue 01 ./create-server-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot" \ + -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 60 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -296,38 +225,18 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 rm -- "$TESTDIR"/marker.img - # Make an overlay with needed tools for the test harness - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst_simple ./client.link /etc/systemd/network/01-client.link - ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth dmraid nfs" \ - -a "debug ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 - - ( - # shellcheck disable=SC2031 - export initdir="$TESTDIR"/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - rm "$initdir"/etc/systemd/network/01-client.link - inst_simple ./server.link /etc/systemd/network/01-server.link - inst_hook pre-mount 99 ./wait-if-server.sh - ) + test_dracut \ + --add "$USE_NETWORK" \ + -i "./client.link" "/etc/systemd/network/01-client.link" \ + "$TESTDIR"/initramfs.testing + # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "dash rootfs-block debug kernel-modules network network-legacy" \ + -a "test dash rootfs-block debug kernel-modules network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ + -i "./server.link" "/etc/systemd/network/01-server.link" \ + -i "./wait-if-server.sh" "/lib/dracut/hooks/pre-mount/99-wait-if-server.sh" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 diff --git a/test/TEST-40-NBD/client-init.sh b/test/TEST-40-NBD/client-init.sh index c5c57a2..9de7436 100755 --- a/test/TEST-40-NBD/client-init.sh +++ b/test/TEST-40-NBD/client-init.sh @@ -9,7 +9,7 @@ exec > /dev/console 2>&1 while read -r dev fs fstype opts rest || [ -n "$dev" ]; do [ "$dev" = "rootfs" ] && continue [ "$fs" != "/" ] && continue - echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none echo "nbd-OK $fstype $opts" break done < /proc/mounts diff --git a/test/TEST-40-NBD/create-client-root.sh b/test/TEST-40-NBD/create-client-root.sh index a214f38..a2114a8 100755 --- a/test/TEST-40-NBD/create-client-root.sh +++ b/test/TEST-40-NBD/create-client-root.sh @@ -11,14 +11,14 @@ udevadm control --reload set -e udevadm settle -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root { echo "dracut-root-block-created" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-40-NBD/create-encrypted-root.sh b/test/TEST-40-NBD/create-encrypted-root.sh index 0ea90e3..c4b12c2 100755 --- a/test/TEST-40-NBD/create-encrypted-root.sh +++ b/test/TEST-40-NBD/create-encrypted-root.sh @@ -13,15 +13,15 @@ udevadm settle set -ex printf test > keyfile -cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_root /keyfile +cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /keyfile echo "The passphrase is test" -cryptsetup luksOpen /dev/disk/by-id/ata-disk_root dracut_crypt_test < /keyfile +cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root dracut_crypt_test < /keyfile lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test lvm vgcreate dracut /dev/mapper/dracut_crypt_test lvm lvcreate -l 100%FREE -n root dracut lvm vgchange -ay udevadm settle -mkfs.ext4 -L dracut -j /dev/dracut/root +mkfs.ext4 -q -L dracut -j /dev/dracut/root mkdir -p /sysroot mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* @@ -32,10 +32,10 @@ udevadm settle cryptsetup luksClose /dev/mapper/dracut_crypt_test udevadm settle sleep 1 -eval "$(udevadm info --query=property --name=/dev/disk/by-id/ata-disk_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)" +eval "$(udevadm info --query=property --name=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)" { echo "dracut-root-block-created" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-40-NBD/create-server-root.sh b/test/TEST-40-NBD/create-server-root.sh index de4d670..d0c5c30 100755 --- a/test/TEST-40-NBD/create-server-root.sh +++ b/test/TEST-40-NBD/create-server-root.sh @@ -12,15 +12,15 @@ udevadm settle set -e udevadm settle -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root { echo "dracut-root-block-created" echo "ID_FS_UUID=$ID_FS_UUID" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-40-NBD/finished-false.sh b/test/TEST-40-NBD/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-40-NBD/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-40-NBD/hard-off.sh b/test/TEST-40-NBD/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-40-NBD/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh index 7fd1efc..e935f53 100755 --- a/test/TEST-40-NBD/test.sh +++ b/test/TEST-40-NBD/test.sh @@ -27,18 +27,17 @@ run_server() { echo "NBD TEST SETUP: Starting DHCP/NBD server" declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted - qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img encrypted - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot + qemu_add_drive disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted + qemu_add_drive disk_index disk_args "$TESTDIR"/encrypted.img encrypted + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot "$testdir"/run-qemu \ "${disk_args[@]}" \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -net socket,listen=127.0.0.1:12340 \ - -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -74,14 +73,14 @@ client_test() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ "${disk_args[@]}" \ -net nic,macaddr="$mac",model=e1000 \ -net socket,connect=127.0.0.1:12340 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \ + -append "$cmdline rd.auto ro" \ -initrd "$TESTDIR"/initramfs.testing # shellcheck disable=SC2181 @@ -165,7 +164,7 @@ client_run() { # Encrypted root handling via LVM/LUKS over NBD - # shellcheck disable=SC1090 + # shellcheck source=$TESTDIR/luks.uuid . "$TESTDIR"/luks.uuid client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \ @@ -188,73 +187,32 @@ client_run() { make_encrypted_root() { rm -fr "$TESTDIR"/overlay - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - mkdir -p "$initdir" - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc run var/run tmp - ) - - inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping dd sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - inst_simple /etc/os-release - find_binary plymouth > /dev/null && inst_multiple plymouth - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip grep" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc tmp var run root - ln -s ../run var/run - ) - inst_multiple mkfs.ext4 poweroff cp umount dd sync - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst_hook initqueue 01 ./create-encrypted-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot crypt lvm mdraid" \ + -i ./create-encrypted-root.sh /lib/dracut/hooks/initqueue/01-create-encrypted-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/encrypted.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -267,72 +225,31 @@ make_encrypted_root() { make_client_root() { rm -fr "$TESTDIR"/overlay - kernel=$KVERSION - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - mkdir -p "$initdir" - ( - cd "$initdir" || exit - mkdir -p dev sys proc etc run var/run tmp - ) - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping dd mount sync - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - inst_simple /etc/os-release - inst_multiple -o {,/usr}/etc/nsswitch.conf - inst /etc/passwd /etc/passwd - inst /etc/group /etc/group - for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do - [ -e "$i" ] || continue - inst "$i" - done - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd - inst_hook initqueue 01 ./create-client-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot" \ + -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --nomdadmconf \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/unencrypted.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -345,90 +262,51 @@ make_client_root() { make_server_root() { rm -fr "$TESTDIR"/overlay - # shellcheck disable=SC2031 - export kernel=$KVERSION - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - mkdir -p "$initdir" - ( - cd "$initdir" || exit - mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server - ln -s ../run var/run - ) - cat > "$initdir/etc/nbd-server/config" << EOF + + cat > /tmp/config << EOF [generic] [raw] -exportname = /dev/disk/by-id/ata-disk_unencrypted +exportname = /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_unencrypted port = 2000 bs = 4096 [encrypted] -exportname = /dev/disk/by-id/ata-disk_encrypted +exportname = /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_encrypted port = 2001 bs = 4096 EOF - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping grep \ - sleep nbd-server chmod modprobe vi pidof - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f ${_terminfodir}/l/linux ] && break - done - inst_multiple -o ${_terminfodir}/l/linux - instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan - type -P dhcpd > /dev/null && inst_multiple dhcpd - inst ./server-init.sh /sbin/init - inst_simple /etc/os-release - inst ./hosts /etc/hosts - inst ./dhcpd.conf /etc/dhcpd.conf - inst_multiple -o {,/usr}/etc/nsswitch.conf - inst /etc/passwd /etc/passwd - inst /etc/group /etc/group - _nsslibs=$( - cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \ - | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|' - ) - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - dracut_kernel_post - ) - # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2030 - # shellcheck disable=SC2031 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd sync - inst_hook initqueue 01 ./create-server-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy" \ + -d "nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan" \ + -I "ip grep sleep nbd-server chmod modprobe vi pidof" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ + -i /tmp/config /etc/nbd-server/config \ + -i "./hosts" "/etc/hosts" \ + -i "./dhcpd.conf" "/etc/dhcpd.conf" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/nbd-server + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init + # second, install the files needed to make the root filesystem # create an initramfs that will create the target root filesystem. # We do it this way so that we do not risk trashing the host mdraid # devices, volume groups, encrypted partitions, etc. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot" \ + -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ --nomdadmconf \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -446,47 +324,26 @@ test_setup() { rm -fr "$TESTDIR"/overlay # Make the test image - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown dd - inst_hook shutdown-emergency 000 ./hard-off.sh - inst ./cryptroot-ask.sh /sbin/cryptroot-ask - - # inst ./debug-shell.service /lib/systemd/system/debug-shell.service - # mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants" - # ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service" - - # shellcheck disable=SC1090 - . "$TESTDIR"/luks.uuid - mkdir -p "$initdir"/etc - echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > "$initdir"/etc/crypttab - echo -n test > "$initdir"/etc/key - inst_simple ./client.link /etc/systemd/network/01-client.link - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth iscsi nfs" \ - -a "debug watchdog ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 - - ( - # shellcheck disable=SC2031 - export initdir="$TESTDIR"/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - rm "$initdir"/etc/systemd/network/01-client.link - inst_simple ./server.link /etc/systemd/network/01-server.link - inst_hook pre-mount 99 ./wait-if-server.sh - ) - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "rootfs-block debug kernel-modules network network-legacy" \ + # shellcheck source=$TESTDIR/luks.uuid + . "$TESTDIR"/luks.uuid + + echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > /tmp/crypttab + echo -n test > /tmp/key + + test_dracut \ + -a "${USE_NETWORK}" \ + -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \ + -i "./client.link" "/etc/systemd/network/01-client.link" \ + -i "/tmp/crypttab" "/etc/crypttab" \ + -i "/tmp/key" "/etc/key" \ + "$TESTDIR"/initramfs.testing + + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -a "test rootfs-block debug kernel-modules network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ - --no-hostonly-cmdline -N \ + -i "./server.link" "/etc/systemd/network/01-server.link" \ + -i "./wait-if-server.sh" "/lib/dracut/hooks/pre-mount/99-wait-if-server.sh" \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh index 4c51e27..8495913 100755 --- a/test/TEST-50-MULTINIC/client-init.sh +++ b/test/TEST-50-MULTINIC/client-init.sh @@ -32,7 +32,7 @@ done { echo "OK" echo "$IFACES" -} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none getargbool 0 rd.shell && sh -i diff --git a/test/TEST-50-MULTINIC/create-root.sh b/test/TEST-50-MULTINIC/create-root.sh index 8060b00..0518937 100755 --- a/test/TEST-50-MULTINIC/create-root.sh +++ b/test/TEST-50-MULTINIC/create-root.sh @@ -12,12 +12,12 @@ udevadm settle set -ex -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh index 4f81235..e2aa5a3 100755 --- a/test/TEST-50-MULTINIC/test.sh +++ b/test/TEST-50-MULTINIC/test.sh @@ -7,6 +7,11 @@ TEST_DESCRIPTION="root filesystem on NFS with multiple nics with $USE_NETWORK" #DEBUGFAIL="loglevel=7 rd.shell rd.break" #SERIAL="tcp:127.0.0.1:9999" +# skip the test if ifcfg dracut module can not be installed +test_check() { + test -d /etc/sysconfig/network-scripts +} + run_server() { # Start server first echo "MULTINIC TEST SETUP: Starting DHCP/NFS server" @@ -14,14 +19,13 @@ run_server() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root "$testdir"/run-qemu \ "${disk_args[@]}" \ -net socket,listen=127.0.0.1:12350 \ -net nic,macaddr=52:54:01:12:34:56,model=e1000 \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ - -device i6300esb -watchdog-action poweroff \ -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 @@ -57,7 +61,7 @@ client_test() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker cmdline="$cmdline rd.net.timeout.dhcp=30" # Invoke KVM and/or QEMU to actually create the target filesystem. @@ -72,8 +76,7 @@ client_test() { -netdev hubport,id=n2,hubid=2 \ -device e1000,netdev=n1,mac=52:54:00:12:34:98 \ -device e1000,netdev=n2,mac=52:54:00:12:34:99 \ - -device i6300esb -watchdog-action poweroff \ - -append "quiet panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console" \ + -append "$cmdline rd.retry=5 ro init=/sbin/init systemd.log_target=console" \ -initrd "$TESTDIR"/initramfs.testing || return 1 { @@ -189,7 +192,7 @@ test_setup() { ) inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping exportfs \ + dmesg mkdir cp exportfs \ modprobe rpc.nfsd rpc.mountd showmount tcpdump \ sleep mount chmod rm for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do @@ -247,7 +250,7 @@ test_setup() { ) inst_multiple sh shutdown poweroff stty cat ps ln ip dd \ - mount dmesg mkdir cp ping grep setsid ls vi less cat sync + mount dmesg mkdir cp grep setsid ls vi less cat sync for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do if [ -f "${_terminfodir}"/l/linux ]; then inst_multiple -o "${_terminfodir}"/l/linux @@ -291,7 +294,7 @@ test_setup() { export initdir=$TESTDIR/overlay # shellcheck disable=SC1090 . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd + inst_multiple mkfs.ext4 poweroff cp umount sync dd inst_hook initqueue 01 ./create-root.sh inst_hook initqueue/finished 01 ./finished-false.sh ) @@ -310,8 +313,8 @@ test_setup() { declare -a disk_args=() # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -337,11 +340,9 @@ test_setup() { inst_hook pre-pivot 85 "$PKGLIBDIR/modules.d/45ifcfg/write-ifcfg.sh" ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "ifcfg plymouth" \ - -a "debug watchdog ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -a "${USE_NETWORK}" \ + "$TESTDIR"/initramfs.testing ( # shellcheck disable=SC2031 @@ -354,8 +355,8 @@ test_setup() { ) # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "bash rootfs-block debug kernel-modules watchdog qemu network network-legacy" \ - -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \ + -m "bash rootfs-block debug kernel-modules watchdog qemu network-legacy" \ + -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 diff --git a/test/TEST-60-BONDBRIDGEVLAN/create-root.sh b/test/TEST-60-BONDBRIDGEVLAN/create-root.sh index fe7b515..9164628 100755 --- a/test/TEST-60-BONDBRIDGEVLAN/create-root.sh +++ b/test/TEST-60-BONDBRIDGEVLAN/create-root.sh @@ -11,12 +11,12 @@ udevadm control --reload udevadm settle set -e -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-60-BONDBRIDGEVLAN/server-init.sh b/test/TEST-60-BONDBRIDGEVLAN/server-init.sh index 3b0f55e..e4ddf3f 100755 --- a/test/TEST-60-BONDBRIDGEVLAN/server-init.sh +++ b/test/TEST-60-BONDBRIDGEVLAN/server-init.sh @@ -64,7 +64,7 @@ ip link set dev enx525401123457 name net2 ip link set dev enx525401123458 name net3 ip link set dev enx525401123459 name net4 -modprobe --all -b -q 8021q bonding +modprobe -b -q 8021q && modprobe -b -q bonding : > /dev/watchdog ip addr add 127.0.0.1/8 dev lo diff --git a/test/TEST-60-BONDBRIDGEVLAN/test.sh b/test/TEST-60-BONDBRIDGEVLAN/test.sh index 5110ddb..be4cb6d 100755 --- a/test/TEST-60-BONDBRIDGEVLAN/test.sh +++ b/test/TEST-60-BONDBRIDGEVLAN/test.sh @@ -9,6 +9,11 @@ TEST_DESCRIPTION="root filesystem on NFS with bridging/bonding/vlan with $USE_NE #DEBUGFAIL="rd.shell rd.break" #SERIAL="tcp:127.0.0.1:9999" +# skip the test if ifcfg dracut module can not be installed +test_check() { + test -d /etc/sysconfig/network-scripts +} + # Network topology: # # .---------------------. .---------------. @@ -44,8 +49,7 @@ run_server() { -device virtio-net-pci,netdev=n3,mac=52:54:01:12:34:59 \ -hda "$TESTDIR"/server.ext4 \ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \ - -device i6300esb -watchdog-action poweroff \ - -append "panic=1 oops=panic softlockup_panic=1 loglevel=7 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 rd.debug" \ + -append "panic=1 oops=panic softlockup_panic=1 root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 -- "$TESTDIR"/server.pid || return 1 @@ -87,16 +91,14 @@ client_test() { -netdev socket,connect=127.0.0.1:12373,id=n4 -device virtio-net-pci,mac=52:54:00:12:34:04,netdev=n4 \ -netdev hubport,id=n5,hubid=1 -device virtio-net-pci,mac=52:54:00:12:34:05,netdev=n5 \ -hda "$TESTDIR"/client.img \ - -device i6300esb -watchdog-action poweroff \ -append " - panic=1 oops=panic softlockup_panic=1 ifname=net1:52:54:00:12:34:01 ifname=net2:52:54:00:12:34:02 ifname=net3:52:54:00:12:34:03 ifname=net4:52:54:00:12:34:04 ifname=net5:52:54:00:12:34:05 - $cmdline rd.net.timeout.dhcp=30 systemd.crash_reboot - $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ + $cmdline rd.net.timeout.dhcp=30 + rd.retry=5 rw init=/sbin/init" \ -initrd "$TESTDIR"/initramfs.testing || return 1 { @@ -323,7 +325,7 @@ test_setup() { export initdir=$TESTDIR/overlay # shellcheck disable=SC1090 . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd + inst_multiple mkfs.ext4 poweroff cp umount sync dd inst_hook initqueue 01 ./create-root.sh inst_hook initqueue/finished 01 ./finished-false.sh ) @@ -340,8 +342,8 @@ test_setup() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.ext4 root 120 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.ext4 root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -364,12 +366,9 @@ test_setup() { inst_simple ./client.link /etc/systemd/network/01-client.link ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - --no-early-microcode \ - -o "plymouth" \ - -a "debug ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 + test_dracut \ + -a "debug ${USE_NETWORK} ifcfg" \ + "$TESTDIR"/initramfs.testing ( # shellcheck disable=SC2031 @@ -384,7 +383,7 @@ test_setup() { "$DRACUT" -l -i "$TESTDIR"/overlay / \ --no-early-microcode \ -m "rootfs-block debug kernel-modules watchdog qemu network network-legacy" \ - -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd virtio-net i6300esb ib700wdt" \ + -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd virtio-net i6300esb" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 } diff --git a/test/TEST-62-SKIPCPIO/test.sh b/test/TEST-62-SKIPCPIO/test.sh index 2311da3..ba20a42 100755 --- a/test/TEST-62-SKIPCPIO/test.sh +++ b/test/TEST-62-SKIPCPIO/test.sh @@ -6,7 +6,7 @@ TEST_DESCRIPTION="test skipcpio" test_check() { - cpio dd truncate find sort diff &> /dev/null + (command -v cpio && command -v find && command -v diff) &> /dev/null } skipcpio_simple() { diff --git a/test/TEST-63-DRACUT-CPIO/test.sh b/test/TEST-63-DRACUT-CPIO/test.sh index f9dff10..5bde7b0 100755 --- a/test/TEST-63-DRACUT-CPIO/test.sh +++ b/test/TEST-63-DRACUT-CPIO/test.sh @@ -21,28 +21,23 @@ test_dracut_cpio() { mkdir -p "$tdir" - # VM script to print sentinel on boot - # write to kmsg so that sysrq messages don't race with console output cat > "$tdir/init.sh" << EOF -echo "Image with ${dracut_cpio_params[*]} booted successfully" > /dev/kmsg -echo 1 > /proc/sys/kernel/sysrq -echo o > /proc/sysrq-trigger -sleep 20 +echo "Image with ${dracut_cpio_params[*]} booted successfully" +poweroff -f EOF - "$DRACUT" -l --drivers "" \ + test_dracut \ + --no-kernel --drivers "" \ + --modules "test" \ "${dracut_cpio_params[@]}" \ - --modules "bash base" \ --include "$tdir/init.sh" /lib/dracut/hooks/emergency/00-init.sh \ - --no-hostonly --no-hostonly-cmdline \ - "$tdir/initramfs" \ - || return 1 + --install "poweroff" \ + "$tdir/initramfs" "$testdir"/run-qemu \ - -device i6300esb -watchdog-action poweroff \ -daemonize -pidfile "$tdir/vm.pid" \ -serial "file:$tdir/console.out" \ - -append "panic=1 oops=panic softlockup_panic=1 loglevel=7 console=ttyS0 rd.shell=1" \ + -append "panic=1 oops=panic softlockup_panic=1 console=ttyS0 rd.shell=1" \ -initrd "$tdir/initramfs" || return 1 timeout=120 diff --git a/test/container/Dockerfile-Arch b/test/container/Dockerfile-Arch index f05ce8f..2af810a 100644 --- a/test/container/Dockerfile-Arch +++ b/test/container/Dockerfile-Arch @@ -1,17 +1,52 @@ FROM docker.io/archlinux -MAINTAINER https://github.com/dracutdevs/dracut - -# Install needed packages for the dracut CI container RUN pacman --noconfirm -Syu \ - linux dash strace dhclient asciidoc cpio pigz squashfs-tools \ - qemu btrfs-progs mdadm dmraid nfs-utils nfsidmap lvm2 nbd \ - dhcp networkmanager multipath-tools vi tcpdump open-iscsi connman \ - git shfmt shellcheck astyle which base-devel glibc parted ntfs-3g && yes | pacman -Scc - -RUN useradd -m build -RUN su build -c 'cd && git clone https://aur.archlinux.org/perl-config-general.git && cd perl-config-general && makepkg -s --noconfirm' -RUN pacman -U --noconfirm ~build/perl-config-general/*.pkg.tar.* -RUN su build -c 'cd && git clone https://aur.archlinux.org/tgt.git && cd tgt && makepkg -s --noconfirm' -RUN pacman -U --noconfirm ~build/tgt/*.pkg.tar.* -RUN rm -fr ~build + asciidoc \ + astyle \ + base-devel \ + bluez \ + btrfs-progs \ + busybox \ + cargo \ + cifs-utils \ + connman \ + cpio \ + dash \ + dhclient \ + dhcp \ + dmraid \ + elfutils \ + f2fs-tools \ + git \ + glibc \ + jq \ + linux \ + lvm2 \ + lzop \ + mdadm \ + multipath-tools \ + nbd \ + networkmanager \ + nfsidmap \ + nfs-utils \ + ntfs-3g \ + nvme-cli \ + open-iscsi \ + openssh \ + parted \ + pigz \ + plymouth \ + qemu \ + qrencode \ + rng-tools \ + sbsigntools \ + shellcheck \ + shfmt \ + squashfs-tools \ + strace \ + systemd-ukify \ + tcpdump \ + tgt \ + tpm2-tools \ + vi \ + && yes | pacman -Scc diff --git a/test/container/Dockerfile-Debian b/test/container/Dockerfile-Debian index 9ba3a1f..7e7e6d4 100644 --- a/test/container/Dockerfile-Debian +++ b/test/container/Dockerfile-Debian @@ -1,7 +1,5 @@ FROM docker.io/debian:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container # Install dracut as a linux-initramfs-tool provider so that the default initramfs-tool package does not get installed # Uninstall initramfs-tools-core as a workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=994492 @@ -9,17 +7,16 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq -- DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -o Dpkg::Use-Pty=0 \ asciidoc \ astyle \ + bluez \ btrfs-progs \ busybox-static \ bzip2 \ ca-certificates \ + cargo \ console-setup \ cpio \ cryptsetup \ curl \ - dash \ - debhelper \ - debhelper-compat \ dmraid \ docbook \ docbook-xml \ @@ -32,6 +29,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq -- iputils-ping \ isc-dhcp-client \ isc-dhcp-server \ + iscsiuio \ kmod \ less \ libdmraid-dev \ @@ -52,16 +50,17 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && apt-get install -y -qq -- pigz \ pkg-config \ procps \ - qemu-system-x86 \ - quilt \ + qemu-kvm \ + rng-tools5 \ shellcheck \ + sbsigntool \ squashfs-tools \ strace \ - sudo \ systemd-boot-efi \ tcpdump \ tgt \ thin-provisioning-tools \ + tpm2-tools \ vim \ wget \ && apt-get clean && dpkg -P --force-depends dracut dracut-core initramfs-tools-core diff --git a/test/container/Dockerfile-Fedora-latest b/test/container/Dockerfile-Fedora-latest index 2ce3975..106af17 100644 --- a/test/container/Dockerfile-Fedora-latest +++ b/test/container/Dockerfile-Fedora-latest @@ -1,16 +1,15 @@ FROM registry.fedoraproject.org/fedora:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container RUN dnf -y install --setopt=install_weak_deps=False \ asciidoc \ + astyle \ bash-completion \ - biosdevname \ bluez \ btrfs-progs \ busybox \ bzip2 \ + cargo \ cifs-utils \ cryptsetup \ dash \ @@ -28,6 +27,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ iproute \ iputils \ iscsi-initiator-utils \ + jq \ kbd \ kernel \ kmod-devel \ @@ -49,7 +49,8 @@ RUN dnf -y install --setopt=install_weak_deps=False \ parted \ pcsc-lite \ pigz \ - qemu-system-x86-core \ + qemu \ + qrencode \ rng-tools \ rpm-build \ sbsigntools \ @@ -58,14 +59,13 @@ RUN dnf -y install --setopt=install_weak_deps=False \ shfmt \ squashfs-tools \ strace \ - sudo \ systemd-boot-unsigned \ systemd-networkd \ systemd-resolved \ + systemd-ukify \ tar \ tcpdump \ tpm2-tools \ wget \ - which \ xz \ && dnf -y remove dracut --noautoremove && dnf -y update && dnf clean all diff --git a/test/container/Dockerfile-Gentoo b/test/container/Dockerfile-Gentoo index f2bb555..7b4eb2a 100644 --- a/test/container/Dockerfile-Gentoo +++ b/test/container/Dockerfile-Gentoo @@ -1,57 +1,59 @@ -ARG TAG=musl FROM docker.io/gentoo/portage:latest as portage -# uefi stub in a separate builder -FROM docker.io/gentoo/stage3 as efistub +FROM docker.io/gentoo/stage3:systemd COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo -# systemd-boot -RUN echo 'sys-apps/systemd-utils boot' > /etc/portage/package.use/systemd-utils && \ - emerge -qv sys-apps/systemd-utils +# Speed-up using binpkgs +RUN echo "MAKEOPTS=\"-j$(nproc) -l$(nproc)\"" >> /etc/portage/make.conf +RUN echo "EMERGE_DEFAULT_OPTS=\"-j$(nproc) -l$(nproc)\"" >> /etc/portage/make.conf +RUN echo "FEATURES=\"getbinpkg binpkg-ignore-signature parallel-fetch parallel-install pkgdir-index-trusted\"" >> /etc/portage/make.conf -# kernel and its dependencies in a separate builder -FROM docker.io/gentoo/stage3:$TAG as kernel -COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo -# disable initramfs generation, only need the kernel image itself -RUN echo 'sys-kernel/gentoo-kernel-bin -initramfs' > /etc/portage/package.use/kernel -RUN emerge -qv sys-kernel/gentoo-kernel-bin - -FROM docker.io/gentoo/stage3:$TAG -COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo -COPY --from=kernel /boot /boot -COPY --from=kernel /lib/modules /lib/modules -COPY --from=efistub /usr/lib/systemd/boot/efi /usr/lib/systemd/boot/efi -ARG TAG +# systemd-boot, no need to install intramfs with kernel +RUN echo "USE=\"boot kernel-install -initramfs\"" >> /etc/portage/make.conf -MAINTAINER https://github.com/dracutdevs/dracut +# Use debian's installkernel +RUN echo 'sys-kernel/installkernel -systemd' >> /etc/portage/package.use/kernel -# required by sys-fs/dmraid -RUN echo 'sys-fs/lvm2 lvm thin' > /etc/portage/package.use/lvm2 +# Enable ukify and cryptsetup tools (includes unit generator for crypttab) +RUN echo 'sys-apps/systemd ukify cryptsetup' >> /etc/portage/package.use/systemd -# workaround for https://bugs.gentoo.org/734022 whereby Gentoo does not support NFS4 with musl -RUN if [[ "$TAG" == 'musl' ]]; then echo 'net-fs/nfs-utils -nfsv4' > /etc/portage/package.use/nfs-utils ; fi +# Support thin volumes and build all of LVM2 including daemons and tools like lvchange +RUN echo 'sys-fs/lvm2 thin lvm' >> /etc/portage/package.use/lvm2 -# workaround for packages do not compile on musl -# https://bugs.gentoo.org/713490 for tgt -# https://bugs.gentoo.org/908587 for open-iscsi -RUN if [[ "$TAG" != 'musl' ]]; then emerge -qv sys-block/tgt sys-block/open-iscsi ; fi - -# Install needed packages for the dracut CI container -RUN emerge -qv \ +RUN emerge --quiet --deep --autounmask-continue=y --with-bdeps=n \ + app-admin/rsyslog \ app-arch/cpio \ + app-crypt/tpm2-tools \ + app-crypt/sbsigntools \ app-emulation/qemu \ + app-misc/jq \ + app-portage/gentoolkit \ app-shells/dash \ + dev-lang/rust-bin \ + net-fs/cifs-utils \ net-fs/nfs-utils \ net-misc/dhcp \ + net-wireless/bluez \ + sys-apps/biosdevname \ sys-apps/busybox \ + sys-apps/nvme-cli \ + sys-apps/rng-tools \ + sys-apps/systemd \ sys-block/nbd \ + sys-block/open-iscsi \ sys-block/parted \ + sys-block/tgt \ sys-fs/btrfs-progs \ sys-fs/cryptsetup \ sys-fs/dmraid \ - sys-fs/lvm2 \ sys-fs/mdadm \ sys-fs/multipath-tools \ sys-fs/ntfs3g \ sys-fs/squashfs-tools \ + sys-kernel/gentoo-kernel-bin \ + sys-libs/libxcrypt \ + sys-libs/glibc \ + virtual/pkgconfig \ && rm -rf /var/cache/* /usr/share/doc/* /usr/share/man/* + +RUN emerge --depclean --with-bdeps=n diff --git a/test/container/Dockerfile-OpenSuse-latest b/test/container/Dockerfile-OpenSuse-latest index 3e7cefc..a5fb7de 100644 --- a/test/container/Dockerfile-OpenSuse-latest +++ b/test/container/Dockerfile-OpenSuse-latest @@ -1,13 +1,52 @@ FROM registry.opensuse.org/opensuse/tumbleweed-dnf:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container RUN dnf -y install --setopt=install_weak_deps=False \ - dash asciidoc mdadm lvm2 dmraid cryptsetup nfs-utils nbd dhcp-server \ - strace libkmod-devel gcc bzip2 xz tar wget rpm-build make git bash-completion \ - sudo kernel dhcp-client qemu-kvm /usr/bin/qemu-system-$(uname -m) e2fsprogs \ - tcpdump iproute iputils kbd NetworkManager btrfsprogs tgt dbus-broker \ - iscsiuio open-iscsi which ShellCheck shfmt procps pigz parted squashfs ntfsprogs \ - multipath-tools util-linux-systemd systemd-boot \ - && dnf -y remove dracut && dnf -y update && dnf clean all + asciidoc \ + bash-completion \ + btrfsprogs \ + bzip2 \ + cargo \ + cryptsetup \ + dash \ + dbus-broker \ + dhcp-client \ + dhcp-server \ + dmraid \ + e2fsprogs \ + gcc \ + git \ + iproute \ + iputils \ + iscsiuio \ + kbd \ + kernel \ + libkmod-devel \ + lvm2 \ + make \ + mdadm \ + nbd \ + NetworkManager \ + nfs-utils \ + open-iscsi \ + parted \ + pigz \ + procps \ + qemu-kvm \ + rng-tools \ + rpm-build \ + sbsigntools \ + ShellCheck \ + shfmt \ + squashfs \ + strace \ + systemd-boot \ + tar \ + tcpdump \ + tgt \ + tpm2.0-tools \ + /usr/bin/qemu-system-$(uname -m) \ + util-linux-systemd \ + wget \ + xz \ + && rpm -e --nodeps dracut && dnf -y update && dnf clean all diff --git a/test/container/Dockerfile-Ubuntu b/test/container/Dockerfile-Ubuntu index 0fb7f20..ef15a67 100644 --- a/test/container/Dockerfile-Ubuntu +++ b/test/container/Dockerfile-Ubuntu @@ -1,17 +1,17 @@ FROM docker.io/ubuntu:latest -MAINTAINER https://github.com/dracutdevs/dracut - # Install needed packages for the dracut CI container # The Linux kernel is only readable by root. See https://launchpad.net/bugs/759725 RUN apt-get update -y -qq && apt-get upgrade -y -qq && \ DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -o Dpkg::Use-Pty=0 \ asciidoc \ astyle \ + bluez \ btrfs-progs \ busybox-static \ bzip2 \ ca-certificates \ + cargo \ console-setup \ cpio \ cryptsetup \ @@ -28,6 +28,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && \ iputils-ping \ isc-dhcp-client \ isc-dhcp-server \ + iscsiuio \ kmod \ less \ libdmraid-dev \ @@ -49,14 +50,17 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && \ pkg-config \ procps \ qemu-kvm \ + rng-tools5 \ + sbsigntool \ shellcheck \ squashfs-tools \ strace \ - sudo \ - systemd \ + systemd-boot-efi \ + systemd-ukify \ tcpdump \ tgt \ thin-provisioning-tools \ + tpm2-tools \ vim \ wget \ && apt-get clean \ diff --git a/test/container/Dockerfile-Void b/test/container/Dockerfile-Void new file mode 100644 index 0000000..99044c3 --- /dev/null +++ b/test/container/Dockerfile-Void @@ -0,0 +1,64 @@ +FROM ghcr.io/void-linux/void-glibc-full + +RUN xbps-install -Syu xbps && xbps-install -yu \ + asciidoc \ + astyle \ + base-devel \ + bash \ + binutils \ + bluez \ + btrfs-progs \ + busybox \ + cargo \ + cifs-utils \ + connman \ + cpio \ + cryptsetup \ + curl \ + dash \ + dhclient \ + dhcp \ + dmraid \ + dosfstools \ + e2fsprogs \ + edk2-ovmf \ + elfutils \ + eudev \ + f2fs-tools \ + git \ + glibc \ + gnupg \ + iputils \ + jq \ + kbd \ + libkmod-devel \ + linux \ + lvm2 \ + lzop \ + make \ + mdadm \ + mtools \ + nbd \ + NetworkManager \ + nfs-utils \ + ntfs-3g \ + nvme-cli \ + open-iscsi \ + openssh \ + parted \ + pigz \ + plymouth \ + qemu \ + rng-tools \ + sbsigntool \ + shellcheck \ + shfmt \ + squashfs-tools \ + strace \ + systemd-boot-efistub \ + tcpdump \ + tgt \ + tpm2-tools \ + ukify \ + xz \ + && rm -rf /var/cache/xbps diff --git a/test/container/Dockerfile-alpine b/test/container/Dockerfile-alpine new file mode 100644 index 0000000..4f28c95 --- /dev/null +++ b/test/container/Dockerfile-alpine @@ -0,0 +1,62 @@ +FROM docker.io/alpine:latest + +RUN apk add --no-cache \ + alpine-sdk \ + asciidoc \ + bash \ + binutils \ + blkid \ + btrfs-progs \ + busybox \ + bzip2 \ + cargo \ + coreutils \ + cpio \ + cryptsetup \ + curl \ + dash \ + dhclient \ + dmraid \ + dosfstools \ + e2fsprogs \ + eudev \ + findmnt \ + gawk \ + git \ + gpg \ + grep \ + iputils \ + kbd \ + kmod-dev \ + linux-virt \ + losetup \ + lvm2 \ + make \ + mdadm \ + mtools \ + multipath-tools \ + musl-fts-dev \ + nbd \ + ntfs-3g-progs \ + open-iscsi \ + openssh \ + parted \ + partx \ + pigz \ + procps \ + qemu-img \ + qemu-system-x86_64 \ + rng-tools \ + sed \ + sfdisk \ + squashfs-tools \ + sudo \ + util-linux-misc \ + xz + +RUN \ + cp /usr/lib/udev/rules.d/* /lib/udev/rules.d/ && \ + ln -sf /sbin/poweroff /sbin/shutdown && \ + ln -sf /usr/bin/dash /bin/dash && \ + ln -sf /bin/sh /usr/bin/sh && \ + ln -sf /boot/vmlinuz-virt /boot/vmlinuz-$(cd /lib/modules; ls -1 | tail -1) diff --git a/test/run-qemu b/test/run-qemu index 41d458a..149a407 100755 --- a/test/run-qemu +++ b/test/run-qemu @@ -4,6 +4,13 @@ export PATH=/usr/sbin:/usr/bin:/sbin:/bin ARCH="${ARCH-$(uname -m)}" + +case "$ARCH" in + amd64 | i?86 | x86_64) + QEMU_CPU="IvyBridge-v2" + ;; +esac + QEMU_CPU="${QEMU_CPU:-max}" [[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=(-cpu "$QEMU_CPU") @@ -36,7 +43,7 @@ case "$ARCH" in esac # Provide rng device sourcing the hosts /dev/urandom and other standard parameters -ARGS+=(-smp 2 -m 1024 -nodefaults -vga none -display none -no-reboot -device virtio-rng-pci) +ARGS+=(-smp 2 -m 1024 -nodefaults -vga none -display none -no-reboot -device i6300esb -watchdog-action poweroff -device virtio-rng-pci) if ! [[ $* == *-daemonize* ]] && ! [[ $* == *-daemonize* ]]; then ARGS+=(-serial stdio) @@ -58,6 +65,8 @@ if ! [ -f "$VMLINUZ" ]; then VMLINUZ="/boot/vmlinuz-${KVERSION}" elif [ -f "/boot/vmlinux-${KVERSION}" ]; then VMLINUZ="/boot/vmlinux-${KVERSION}" + elif [ -f "/boot/kernel-${KVERSION}" ]; then + VMLINUZ="/boot/kernel-${KVERSION}" else echo "Could not find a Linux kernel version $KVERSION to test with!" >&2 echo "Please install linux." >&2 diff --git a/test/test-functions b/test/test-functions index f76d930..b664fb0 100644 --- a/test/test-functions +++ b/test/test-functions @@ -20,14 +20,20 @@ DRACUT=${DRACUT-${basedir}/dracut.sh} PKGLIBDIR=${PKGLIBDIR-$basedir} test_dracut() { - TEST_DRACUT_ARGS+=" --local --no-hostonly --no-early-microcode --add test --kver $KVERSION" + TEST_DRACUT_ARGS+=" --local --no-hostonly --no-hostonly-cmdline --no-early-microcode --add test --force --kver $KVERSION" + + # include $TESTDIR"/overlay if exists + if [ -d "$TESTDIR"/overlay ]; then + TEST_DRACUT_ARGS+=" --include $TESTDIR/overlay /" + fi # shellcheck disable=SC2162 IFS=' ' read -a TEST_DRACUT_ARGS_ARRAY <<< "$TEST_DRACUT_ARGS" - "$DRACUT" "$@" \ - --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \ - "${TEST_DRACUT_ARGS_ARRAY[@]}" || return 1 + "$DRACUT" \ + --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot quiet rd.retry=10 rd.info rd.shell=0 selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \ + "${TEST_DRACUT_ARGS_ARRAY[@]}" \ + "$@" || return 1 } command -v test_check &> /dev/null || test_check() { @@ -52,23 +58,14 @@ COLOR_FAILURE='\033[0;31m' COLOR_WARNING='\033[0;33m' COLOR_NORMAL='\033[0;39m' -check_root() { - if ((EUID != 0)); then - SETCOLOR_FAILURE - echo "Tests must be run as root! Please use 'sudo'." - SETCOLOR_NORMAL - exit 1 - fi -} - # generate qemu arguments for named raw disks # -# qemu_add_drive_args <index> <args> <filename> <id-name> [<bootindex>] +# qemu_add_drive <index> <args> <filename> <id-name> [<bootindex>] # # index: name of the index variable (set to 0 at start) # args: name of the argument array variable (set to () at start) # filename: filename of the raw disk image -# id-name: name of the disk in /dev/disk/by-id -> /dev/disk/by-id/ata-disk_$name +# id-name: name of the disk in /dev/disk/by-id -> /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_$name # size: optional file size in MiB (0 implies size is not set) # bootindex: optional bootindex number # @@ -81,13 +78,13 @@ check_root() { # ``` # declare -a disk_args=() # declare -i disk_index=0 -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.ext3 root 0 1 -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/client.img client -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/iscsidisk2.img iscsidisk2 -# qemu_add_drive_args disk_index disk_args "$TESTDIR"/iscsidisk3.img iscsidisk3 +# qemu_add_drive disk_index disk_args "$TESTDIR"/root.ext3 root 0 1 +# qemu_add_drive disk_index disk_args "$TESTDIR"/client.img client +# qemu_add_drive disk_index disk_args "$TESTDIR"/iscsidisk2.img iscsidisk2 +# qemu_add_drive disk_index disk_args "$TESTDIR"/iscsidisk3.img iscsidisk3 # qemu "${disk_args[@]}" # ``` -qemu_add_drive_args() { +qemu_add_drive() { local index=${!1} local file=$3 local name=${4:-$index} @@ -95,12 +92,13 @@ qemu_add_drive_args() { local bootindex=$6 if [ "${size}" -ne 0 ]; then - dd if=/dev/zero of="${file}" bs=1MiB count="${size}" + dd if=/dev/zero of="${file}" bs=1MiB count="${size}" status=none fi eval "${2}"'+=(' \ - -drive "if=none,format=raw,file=${file},id=drive-sata${index}" \ - -device "ide-hd,bus=ide.${index},drive=drive-sata${index},id=sata${index},${bootindex:+bootindex=$bootindex,}model=disk,serial=${name}" \ + -device "virtio-scsi-pci,id=scsi${index}" \ + -drive "if=none,format=raw,file=${file},id=drive-data${index}" \ + -device "scsi-hd,bus=scsi${index}.0,drive=drive-data${index},id=data${index},${bootindex:+bootindex=$bootindex,}serial=${name}" \ ')' # shellcheck disable=SC2219 @@ -108,7 +106,7 @@ qemu_add_drive_args() { } test_marker_reset() { - dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 + dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1 status=none } test_marker_check() { @@ -122,13 +120,11 @@ test_marker_check() { while (($# > 0)); do case $1 in --run) - check_root echo "TEST RUN: $TEST_DESCRIPTION" test_check && test_run exit $? ;; --setup) - check_root echo "TEST SETUP: $TEST_DESCRIPTION" test_check && test_setup exit $? @@ -141,7 +137,6 @@ while (($# > 0)); do exit $? ;; --all) - check_root if ! test_check 2 &> test${TEST_RUN_ID:+-$TEST_RUN_ID}.log; then echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_WARNING" "[SKIPPED]" "$COLOR_NORMAL" exit 0 diff --git a/tools/release.sh b/tools/release.sh index b6f7826..bc3a523 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -18,39 +18,67 @@ else NEW_VERSION="$1" fi +# change current branch to release +git branch -m release + printf "#### Contributors\n\n" > CONTRIBUTORS.md cat _CONTRIBUTORS >> CONTRIBUTORS.md # Update AUTHORS make AUTHORS -# Update NEWS.md +# Update the contributors list in NEWS.md cargo install clog-cli head -2 NEWS.md > NEWS_header.md tail +2 NEWS.md > NEWS_body.md -printf "dracut-%s\n==========\n" "$NEW_VERSION" > NEWS_header_new.md +printf "dracut-ng-%s\n=============\n" "$NEW_VERSION" > NEWS_header_new.md + +# Append the list to the section in `NEWS.md` cat CONTRIBUTORS.md NEWS_body.md > NEWS_body_with_conttributors.md +# Get a template with [`clog`](https://github.com/clog-tool/clog-cli) # clog will always output both the new release and old release information together -clog -F --infile NEWS_body_with_conttributors.md -r https://github.com/dracutdevs/dracut | sed '1,2d' > NEWS_body_full.md +clog -F --infile NEWS_body_with_conttributors.md -r https://github.com/dracut-ng/dracut-ng | sed '1,2d' > NEWS_body_full.md # Use diff to separate new release information and remove repeated empty lines diff NEWS_body_with_conttributors.md NEWS_body_full.md | grep -e ^\>\ | sed s/^\>\ // | cat -s > NEWS_body_new.md cat NEWS_header.md NEWS_header_new.md NEWS_body_new.md NEWS_body_with_conttributors.md > NEWS.md -# message for https://github.com/dracutdevs/dracut/releases/tag +# message for https://github.com/dracut-ng/dracut-ng/releases/tag cat -s NEWS_body_new.md CONTRIBUTORS.md > release.md # dracut-version.sh printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$NEW_VERSION" > dracut-version.sh +DRACUT_FULL_VERSION=$NEW_VERSION DRACUT_MAIN_VERSION=$NEW_VERSION make dracut.html + +if [ -z "$(git config --get user.name)" ]; then + git config user.name "dracutng[bot]" +fi + +if [ -z "$(git config --get user.email)" ]; then + git config user.email "<dracutng@gombos.dev>" +fi + # Check in AUTHORS and NEWS.md -git config user.name "Dracut Release Bot" -git config user.email "<>" -git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS dracut-version.sh -git push origin master -git tag "$NEW_VERSION" -m "$NEW_VERSION" -git push --tags +git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS dracut-version.sh dracut.html + +# git push can fail due to insufficient permissions +if ! git push -u origin release; then + exit $? +fi + +# Tag the release, validate the tag and push +KEYS=$(gpg --list-secret-keys --keyid-format=long 2> /dev/null) + +if [ -z "$KEYS" ]; then + echo "Could not find gpg or gpg secrets, not signing the git tag." + git tag "$NEW_VERSION" -m "$NEW_VERSION" +else + git tag -s "$NEW_VERSION" -m "$NEW_VERSION" + git tag -v "$NEW_VERSION" +fi # export new version to Github Action -echo "new_version=${NEW_VERSION,,}" >> "${GITHUB_ENV}" +# release will not be generated if pushing the tag failed +git push --tags && echo "new_version=${NEW_VERSION,,}" >> "${GITHUB_ENV}" diff --git a/tools/test-github.sh b/tools/test-github.sh index 4fed092..4a8d318 100755 --- a/tools/test-github.sh +++ b/tools/test-github.sh @@ -7,21 +7,17 @@ set -ex RUN_ID="$1" TESTS=$2 -./configure +# if is cargo installed, let's build and test dracut-cpio +if command -v cargo > /dev/null; then + ./configure --enable-dracut-cpio +else + ./configure +fi NCPU=$(getconf _NPROCESSORS_ONLN) if ! [[ $TESTS ]]; then - # GitHub workflows fetch a clone of the dracut repository which doesn't - # contain git tags, thus "breaking" the RPM build in certain situations - # i.e.: - # DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`, - # which in full git clone returns a tag with a numeric version. However, - # without tags it returns SHA of the last commit, which later propagates into - # `Provides:` attribute of the built RPM and can break dependency tree when - # installed - [[ -d .git ]] && git fetch --tags && git describe --tags - make -j "$NCPU" all syncheck rpm logtee + make -j "$NCPU" all syncheck logtee else make -j "$NCPU" enable_documentation=no all logtee @@ -34,7 +30,6 @@ else cd /lib/modules ls -1 | tail -1 )" \ - QEMU_CPU="IvyBridge-v2" \ DRACUT_NO_XATTR=1 \ TEST_RUN_ID="$RUN_ID" \ ${TESTS:+TESTS="$TESTS"} \ |