Link QEMU firmware descriptors to /etc/qemu/firmware, where
systemd-vmspawn and other tools discover firmware for running VMs.
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
Before bcachefs-tools v1.34.0, scrub command was `bcachefs data scrub
…`, then it got `bcachefs scrub …` with the old one still working. The
old one doesn't work anymore.
Fix the command for `services.bcachefs.autoScrub`, including version switch.
The bcachefs-wait-devices@.service unit can be added as a Wants
dependency to a .mount units to wait until every device in the
filesystem is initialized before doing the mount.
A later commit will add the bcachefs-wait-devices@.service unit to
the initrd. Since it references sbin/bcachefs, so we need to add it
to the initrd. Note that sbin/bcachefs is just a symlink to the actual
executable in bin so nothing is duplicated.
This service is essentially a random sleep() call that old software that
is unable to properly handle modern hardware initialisation being
asynchronous can use to *mostly* get by.
Over the years is has caused so many issues in NixOS, like introducing
long delays in the boot process[1], complete deadlocks[2] and even failures
when reloading services or activating a new configuration[3].
systemd has been discouraging its use since 2011 (15 years ago!), then
it officially deprecated it in 2018 and since 2020 it started to show on
every boot a huge wall of text calling out all the offending services
that still use it.
Around 2021 we managed to fix around 15 NixOS modules[4] that were
relying on systemd-udev-settle and practically ZFS[5] was the only
remaining one. However, since then, people have actually started to
bring it back with new services[6][7][8]. This is not acceptable.
So, to prevent any more (lazy) uses of systemd-udev-settle, we stop
providing the systemd-udev-settle.service unit entirely. For existing
modules that unfortunately still need it, we replace it with the command
`udevadm settle --timeout=180`, which is all that the service does.
Hopefully this will also increase the awareness that it's bad and
something to be fixed.
Note: I tested this change using
- `nixosTests.zfs`,
- `nixosTests.ifstate`,
- `nixosTests.misc`,
- `nixosTests.openvswitch`,
- `nixosTests.predictable-interface-names`
- `nixosTests.nvidia-container-toolkit`
and making sure that none of the 165 packages that provide upstream
units (via the `systemd.packages` option) had a dependency on
systemd-udev-settle.service.
[1]: https://github.com/NixOS/nixpkgs/pull/25311
[2]: https://github.com/NixOS/nixpkgs/issues/107341
[3]: https://github.com/NixOS/nixpkgs/pull/113804
[4]: https://github.com/NixOS/nixpkgs/issues/73095
[5]: https://github.com/openzfs/zfs/issues/10891
[6]: https://github.com/NixOS/nixpkgs/pull/257525#discussion_r1442702970
[7]: https://github.com/NixOS/nixpkgs/pull/460075
[8]: https://github.com/NixOS/nixpkgs/pull/284507
This module disables the activation scripts that would normally create
`/usr/bin/env` and `/bin/sh` (and their parent directories). When
systemd is used in the initrd, the absence of these directories causes
2 problems:
- During switch-root, base_filesystem_create_fd() creates an empty /usr
directory. Later at stage2, systemd's initialize_runtime() aborts
booting with "Refusing to run in unsupported environment where /usr/
is not populated."
- Once /usr/bin is restored (by the fix above), base_filesystem_create_fd()
creates a symlink /bin -> /usr/bin. systemd-fstab-generator then
canonicalizes the /bin fstab entry through this symlink, producing a
duplicate usr-bin.mount.
We create both /sysroot/usr/bin and /sysroot/bin via initrd tmpfiles
to prevent both issues.
Resolves NixOS#462556
Co-authored-by: Lin Yinfeng <lin.yinfeng@outlook.com>
Otherwise we crash like:
… while selecting an attribute
at /nix/store/0b202s06rfm1vlyai37gd0zmzxg59qj0-source/nixos/modules/tasks/filesystems/zfs.nix:827:48:
826| lib.mkDefault (
827| config.security.wrapperDir + "/" + config.services.mail.sendmailSetuidWrapper.program
| ^
828| )
error: expected a set but found null: null
Update the name and documentation to make it clear it's a matter of
"when" not "if".
This change was recommended in 2023 but noone followed up:
https://github.com/NixOS/nixpkgs/pull/208037#issuecomment-1688855654
(I never used this and have suffered no dataloss, but might as well make
this small improvement while I notice the currently dire situation.)
As per 12e77fdc3f that set it to true:
> This may currently be necessary, especially if your pools have not
> been correctly imported with a proper host id configuration (which
> is probably true for 99% of current NixOS ZFS users). Once host id
> configuration becomes mandatory when using ZFS in NixOS and we are
> sure that most users have updated their configurations and rebooted
> at least once, we should disable force-import by default. Probably,
> this shouldn't be done before the next stable release.
A couple stable releases have come and gone since 2014!
Let's remove this armed and aimed footgun.
Ideally, the module does not set a non-LTS kernel by default, which we
have been able to do since 6.18 was labeled LTS. This should have been
done before 6.19 became `latest` to avoid having people upgraded to
6.19 and then downgraded to 6.18, but we just missed that. Shouldn't
be a problem if we rectify it quickly.
The canonical names of kernel crypto modules are not stable across
versions. Use the algorithm names from btrfs softdeps instead, which
the kernel will resolve to the appropriate modules.
Previously: xxhash_generic, blake2b_generic, sha256_generic
Now: xxhash64, blake2b-256, sha256
This fixes initrd builds on kernel 6.19+ where blake2b_generic was
renamed to blake2b, and is more resilient to future module renames.
See: https://github.com/torvalds/linux/blob/v6.19-rc1/fs/btrfs/super.c#L2705-L2708
load zfs key from clevis for any dataset that is configured, not just
those needed for boot
also works for dual keys, e.g. those with a clevis key, and a zfs
keylocation of `file:///` (previously it would error if the zfs
keylocation was not `prompt`)
* A dns_resolver entry is needed for a NFSv4 client to
resolve hostnames of NFS referrals and replicas.
* Make request-key.conf customizable, by moving
content from separate file into
`environment.etc."request-key.conf".text`
```
error: A definition for option `boot.initrd.systemd.extraBin.mount' is not of type `absolute path'. Definition values:
- In `/nix/store/h259dzilgbvpfsnlcyims14jrcdnx8fk-source/nixos/modules/tasks/filesystems/zfs.nix':
{
zfs = "/nix/store/hxg3s5l92y9n9m48p872i62dn5ck33hx-zfs-user-2.4.0-rc3/sbin/mount.zfs";
}
```
Fixes https://github.com/NixOS/nixpkgs/pull/414391#issuecomment-3448084329
When you set the bcachefs userspace tools with:
```nix
boot.bcachefs.package = /* custom pacakge */;
```
This now also changes the kernel package. The NixOS module now calls
on the nested `cfg.package.kernelModule` expression with
`kernelPackages.callPackage`. This will enable overriding both
userspace and kernel space from e.g. upstream git.