[
    {
        "role": "user",
        "content": "I%20have%20a%20gentoo%20system%20and%20when%20I%20run%20dracut%20I%20get%20the%20following%20error%2011systemd-pcrextend%3A%20Could%20not%20find%20any%20command%20of%20%27%2Fusr%2Flib%2Fsystemd%2Fsystemd-pcrextend%20%2Fusr%2Flib%2Fsystemd%2Fsystemd-pcrphase"
    },
    {
        "role": "assistant",
        "content": "Here\u2019s a breakdown of what\u2019s happening, why you're seeing that error about **systemd-pcrextend / systemd-pcrphase**, and how you can fix or work around it on Gentoo.\n\n---\n\n## What the error means\n\nWhen you run `dracut`, it supports modules\u2014optional features that get included in the initramfs only if their dependencies (binaries, libraries, other packages) are present. Two dracut modules related to TPM (Trusted Platform Module) / system integrity are:\n\n- **systemd-pcrphase**\n- **systemd-pcrextend**\n\nThe message:\n\n```\nModule 'systemd-pcrphase' will not be installed, because command '/usr/lib/systemd/systemd-pcrextend' could not be found!\n```\n\nindicates dracut wants to include the `systemd-pcrphase` module, but the required binary (`systemd-pcrextend` or sometimes `systemd-pcrphase`) is missing. Since that binary is missing, the module is skipped. ([forums.gentoo.org](https://forums.gentoo.org/viewtopic-t-1172220-start-0.html?utm_source=openai))\n\n---\n\n## Why it\u2019s happening\n\nA few possible reasons:\n\n1. **Missing systemd build options (USE flags)**  \n   The Gentoo `dracut` package has a USE flag called `systemd-pcrphase` \u27f6 this enables TPM-related support (including that binary). It depends on systemd plus other TPM tools. If you didn\u2019t enable that flag, the binary `systemd-pcrextend` likely wasn\u2019t built/installled. ([emirror.d0a.io](https://emirror.d0a.io/wiki/wiki.gentoo.org/wiki/Dracut.html?utm_source=openai))\n\n2. **Missing TPM2 tools / dependencies**  \n   The module depends on `tpm2-tss` (and possibly `tpm2-tools`) being installed. If those are missing, dracut cannot install the module. ([github.com](https://github.com/dracut-ng/dracut/issues/329?utm_source=openai))\n\n3. **Rename / upstream changes**  \n   Upstream, a binary rename took place: the older `systemd-pcrphase` name was replaced (or augmented) by `systemd-pcrextend` in some versions of systemd. Gentoo\u2019s dracut module setup scripts are updated accordingly to check for both names. If your system has an older (or newer) systemd that only installs one of them, mismatches may occur. ([mail-archive.com](https://www.mail-archive.com/gentoo-commits%40lists.gentoo.org/msg1130364.html?utm_source=openai))\n\n---\n\n## How to fix\n\nHere are steps you can take to resolve the error depending on what you want (i.e. keep the `systemd-pcrphase` module, or drop it entirely).\n\n### If you *want* `systemd-pcrphase` module included\n\n1. **Enable the right USE flags**\n\n   Edit your `/etc/portage/package.use` (or global `/etc/portage/make.conf`) to include:\n\n   ```\n   sys-kernel/dracut systemd-pcrphase\n   sys-apps/systemd tpm\n   tpm2-tss tpm2-tss  # ensure tpm2 runtime is enabled\n   tpm2-tools        # optional, if needed\n   ```\n\n   This ensures dracut is built with support for that module, and that systemd includes the required binary.\n\n2. **Ensure systemd version is new enough**\n\n   You\u2019ll want a systemd version that includes `systemd-pcrextend` (or `systemd-pcrphase`, depending on version). Use `emerge -pv systemd` or `equery files systemd` to check if the binary exists in `/usr/lib/systemd/`. If it doesn\u2019t, you may need to upgrade systemd. Gentoo\u2019s commits show patches related to this rename. ([mail-archive.com](https://www.mail-archive.com/gentoo-commits%40lists.gentoo.org/msg1130364.html?utm_source=openai))\n\n3. **Install TPM2 stack**\n\n   Make sure that `tpm2-tss` is installed and usable. On Gentoo:\n\n   ```\n   emerge --ask tpm2-tss tpm2-tools\n   ```\n\n   Also ensure that the necessary support is enabled in kernel config (if applicable). dracut will skip the module if `tpm2-tss` is not installable. ([github.com](https://github.com/dracut-ng/dracut/issues/329?utm_source=openai))\n\n4. **Rebuild dracut / regenerate initramfs**\n\n   ```\n   emerge --ask --changed-use sys-kernel/dracut\n   dracut --force\n   ```\n\n   That should pull in the binary and include the module (if all deps are met).\n\n---\n\n### If you *don\u2019t want* `systemd-pcrphase`\n\nIf you don\u2019t need TPM measurements or that module, you can just prevent dracut from trying to include it, which avoids the error and simplifies your initramfs.\n\n- Add to your `dracut.conf` (usually `/etc/dracut.conf` or drop-in `/etc/dracut.conf.d/disable-pcrphase.conf`):\n\n  ```\n  omit_dracutmodules+=\" systemd-pcrphase systemd-pcrextend \"\n  ```\n\n- Or disable the `systemd-pcrphase` USE flag for dracut:\n\n  ```\n  sys-kernel/dracut -systemd-pcrphase\n  ```\n\n  (And rebuild dracut after changing USE flags.)\n\n---\n\n## Example: what to check on your system\n\nHere\u2019s a checklist you can run through:\n\n- `ls /usr/lib/systemd/` and see if `systemd-pcrextend` or `systemd-pcrphase` binary exists.\n- `ls /usr/lib/systemd/system-pcrphase*` for the service units. If binary is missing, units won\u2019t help.\n- `emerge -pv sys-kernel/dracut` \u2192 check whether `systemd-pcrphase` is shown as enabled in USE flags.\n- `emerge --depclean` if you upgraded systemd and old binaries removed; make sure all relevant files are present.\n\n---\n\nIf you like, I can help you with **exact USE flags** you should set for your hardware and kernel version, or check whether your installed `systemd` already includes the `systemd-pcrextend` binary. Do you want me to check for *your specific Gentoo setup*?"
    }
]