NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.12k forks source link

MacBookPro12,1 hang on poweroff/reboot when zfs module is added #300080

Open truatpasteurdotfr opened 7 months ago

truatpasteurdotfr commented 7 months ago

Describe the bug

Nixos fails to poweroff/reboot when the following lines are enabled in configuration.nix and rebooted.

# ZFS
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.forceImportRoot = false;
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; 
networking.hostId = "007f0200";

Steps To Reproduce

Steps to reproduce the behavior:

  1. install nixos
  2. verify that everything is fine
  3. enable zfs with the lines above to /etc/nixos/configuration.nix
  4. # nixos-rebuild switch --upgrade and reboot
  5. try to poweroff or reboot

Expected behavior

proper reboot or poweroff is expected.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

It is a multiboot setup (grub) with monteray/debian 12/nixos. The debian 12 with zfs poweroff/reboot without hanging.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.82, NixOS, 23.11 (Tapir), 23.11.5648.44733514b72e`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
# nix-env --list-generations --profile /nix/var/nix/profiles/system
... 
  18   2024-03-29 14:32:54   
  19   2024-03-29 18:36:27   (current)

Version 19 is hanging with zfs Version 18 is fine

# nix --extra-experimental-features nix-command profile diff-closures --profile /nix/var/nix/profiles/system
...
Version 18 -> 19:
  etc-zfs-zed.d-zed.rc: ∅ → ε
  gen: ∅ → ε
  grub: +29510.0 KiB
  hostname-net-tools: ∅ → 2.10
  initrd-linux: 6.1.82 → 6.7.10, +165.4 KiB
  kernel: +7217.9 KiB
  libtirpc: ∅ → 1.3.4, +296.4 KiB
  linux: 6.1.82, 6.1.82-modules → 6.7.10, 6.7.10-modules, +15245.4 KiB
  nfs-utils: ∅ → 2.6.2, +1882.0 KiB
  smartmontools: ∅ → 7.4, +2307.3 KiB
  sysstat: ∅ → 12.7.4, +1736.4 KiB
  system: +55.3 KiB
  unit-zfs-import.target: ∅ → ε
  unit-zfs-mount.service: ∅ → ε
  unit-zfs-share.service: ∅ → ε
  unit-zfs-zed.service: ∅ → ε
  unit-zfs.target: ∅ → ε
  unit-zpool-trim.service: ∅ → ε
  unit-zpool-trim.timer: ∅ → ε
  zfs-kernel: ∅ → 2.2.3-6.7.10, +4617.1 KiB
  zfs-user: ∅ → 2.2.3, +7586.8 KiB
  zpool-sync: ∅ → ε

Version 18:

$ cat /proc/cmdline 
BOOT_IMAGE=(hd7,gpt3)//kernels/5b2inz49ls1vxsyxxpx9lhs19cld13xm-linux-6.1.82-bzImage init=/nix/store/75iih8vg3hprm8j9m903v9jsv5lcypx6-nixos-system-mbp121-23.11.5648.44733514b72e/init loglevel=4

Version 19:

BOOT_IMAGE=(hd7,gpt3)//kernels/0b9yqsl0igscfhzhhgdmr6d8pjq7lfb3-linux-6.7.10-bzImage init=/nix/store/5b5mg7is958q7d3wx187173dkhncmjan-nixos-system-mbp121-23.11.5648.44733514b72e/init nohibernate loglevel=4

Add a :+1: reaction to issues you find important.

truatpasteurdotfr commented 7 months ago

It is possibly a side effect to the kernel version change due to adding zfs support. I have an BUG: kernel NULL pointer dereference, address: 0000000000000020 in dmesg for v19 compared to v18 in dmesg. dmesg.v18.txt dmesg.v19.txt

truatpasteurdotfr commented 7 months ago

v19 "poweroff" last lines read: [ OK ] Reached target System Power Off. but stays there forever.

truatpasteurdotfr commented 7 months ago

I have remove the recommended line from the configuration file: boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;

And the v20 poweroff and reboot without hanging.

Version 19 -> 20:
  initrd-linux: 6.7.10 → 6.1.82, -163.5 KiB
  kernel: -334.5 KiB
  linux: 6.7.10, 6.7.10-modules → 6.1.82, 6.1.82-modules, -15245.4 KiB
  nixos-system-mbp121: 23.11.5648.44733514b72e → 23.11.5742.219951b495fc
  zfs-kernel: 2.2.3-6.7.10 → 2.2.3-6.1.82, -184.1 KiB

dmesg attached is no longer reporting the BUG: kernel NULL pointer dereference error. dmesg.v20.txt

kernel 6.7.10 bug?