nixos/swraid: only warn if swraid was explicitly enabled (#255426)

The default just recently changed in 23.11. Users that had
swraid enabled implicitly by NixOS in previous releases got surprised
by warnings even though they do not actually use software RAID.

Fixes #254807
This commit is contained in:
Christian Theune 2023-09-16 12:19:19 +02:00 committed by GitHub
parent 5dd9b36eac
commit 697312fb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -173,7 +173,7 @@
- The Caddy module gained a new option named `services.caddy.enableReload` which is enabled by default. It allows reloading the service instead of restarting it, if only a config file has changed. This option must be disabled if you have turned off the [Caddy admin API](https://caddyserver.com/docs/caddyfile/options#admin). If you keep this option enabled, you should consider setting [`grace_period`](https://caddyserver.com/docs/caddyfile/options#grace-period) to a non-infinite value to prevent Caddy from delaying the reload indefinitely.
- mdraid support is now optional. This reduces initramfs size and prevents the potentially undesired automatic detection and activation of software RAID pools. It is disabled by default in new configurations (determined by `stateVersion`), but the appropriate settings will be generated by `nixos-generate-config` when installing to a software RAID device, so the standard installation procedure should be unaffected. If you have custom configs relying on mdraid, ensure that you use `stateVersion` correctly or set `boot.swraid.enable` manually.
- mdraid support is now optional. This reduces initramfs size and prevents the potentially undesired automatic detection and activation of software RAID pools. It is disabled by default in new configurations (determined by `stateVersion`), but the appropriate settings will be generated by `nixos-generate-config` when installing to a software RAID device, so the standard installation procedure should be unaffected. If you have custom configs relying on mdraid, ensure that you use `stateVersion` correctly or set `boot.swraid.enable` manually. On systems with an updated `stateVersion` we now also emit warnings if `mdadm.conf` does not contain the minimum required configuration necessary to run the dynamically enabled monitoring daemons.
- The `go-ethereum` package has been updated to v1.12.0. This drops support for proof-of-work. Its GraphQL API now encodes all numeric values as hex strings and the GraphQL UI is updated to version 2.0. The default database has changed from `leveldb` to `pebble` but `leveldb` can be forced with the --db.engine=leveldb flag. The `checkpoint-admin` command was [removed along with trusted checkpoints](https://github.com/ethereum/go-ethereum/pull/27147).

View File

@ -4,6 +4,11 @@
mdadm_conf = config.environment.etc."mdadm.conf";
enable_implicitly_for_old_state_versions = lib.versionOlder config.system.stateVersion "23.11";
minimum_config_is_set = config_text:
(builtins.match ".*(MAILADDR|PROGRAM).*" mdadm_conf.text) != null;
in {
imports = [
(lib.mkRenamedOptionModule [ "boot" "initrd" "services" "swraid" "enable" ] [ "boot" "swraid" "enable" ])
@ -26,7 +31,7 @@ in {
should detect it correctly in the standard installation
procedure.
'';
default = lib.versionOlder config.system.stateVersion "23.11";
default = enable_implicitly_for_old_state_versions;
defaultText = lib.mdDoc "`true` if stateVersion is older than 23.11";
};
@ -39,7 +44,7 @@ in {
config = lib.mkIf cfg.enable {
warnings = lib.mkIf
((builtins.match ".*(MAILADDR|PROGRAM).*" mdadm_conf.text) == null)
( !enable_implicitly_for_old_state_versions && !minimum_config_is_set mdadm_conf)
[ "mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash." ];
environment.systemPackages = [ pkgs.mdadm ];