Skip to content

vmWithDisko is unable to mount bcachefs volume #1216

@nikolai-in

Description

@nikolai-in

When using bcachefs as the root filesystem in a disko configuration, the interactive VM (vmWithDisko) fails to boot with the error:

mount: /tmp/tmp.QuzLxZxace: unknown filesystem type 'bcachefs'
loading kernel modules...
mounting Nix store...
mounting host's temporary directory...
starting stage 2 (/nix/store/5cqacs2w30rd86fb6vg3a2afj71dg1nn-vm-run-stage2)
+++ echo 'running udev...'
running udev...
+++ ln -sfn /proc/self/fd /dev/fd
+++ ln -sfn /proc/self/fd/0 /dev/stdin
+++ ln -sfn /proc/self/fd/1 /dev/stdout
+++ ln -sfn /proc/self/fd/2 /dev/stderr
+++ mkdir -p /etc/udev
+++ mount -t efivarfs none /sys/firmware/efi/efivars
+++ ln -sfn /nix/store/k8gimq3n74b9cyqyxn8pnqjay7qb1fz6-etc/etc/udev/rules.d /etc/udev/rules.d
+++ mkdir -p /dev/.mdadm
+++ /nix/store/kna7cma80icar3xwbznwp63fx4602fqq-systemd-minimal-258.3/lib/systemd/systemd-udevd --daemon
Starting systemd-udevd version 258.3
+++ partprobe
+++ udevadm trigger --action=add
+++ udevadm settle --timeout=120
[    2.855799] Error: Driver 'pcspkr' is already registered, aborting...
+++ export IN_DISKO_TEST=1
+++ IN_DISKO_TEST=1
+++ /nix/store/yvpjza29mqf41mrxhckcl044fjq7gxbr-disko-destroy-format-mount/bin/disko-destroy-format-mount --yes-wipe-all-disks
umount: /mnt: not found
++ realpath /dev/vda
+ disk=/dev/vda
+ lsblk -a -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
fd0
vda
+ lsblk --output-all --json
+ bash -x
++ dirname /nix/store/fpwn44vygjj6bfn8s1jj9p8yh6jhfxni-disk-deactivate/disk-deactivate
+ jq -r -f /nix/store/fpwn44vygjj6bfn8s1jj9p8yh6jhfxni-disk-deactivate/zfs-swap-deactivate.jq
+ lsblk --output-all --json
+ bash -x
++ dirname /nix/store/fpwn44vygjj6bfn8s1jj9p8yh6jhfxni-disk-deactivate/disk-deactivate
+ jq -r --arg disk_to_clear /dev/vda -f /nix/store/fpwn44vygjj6bfn8s1jj9p8yh6jhfxni-disk-deactivate/disk-deactivate.jq
+ set -fu
++ type zdb
++ zdb -l /dev/vda
++ sed -nr 's/ +name: '\''(.*)'\''/\1/p'
+ zpool=
+ [[ -n '' ]]
+ unset zpool
++ lsblk /dev/vda -l -p -o type,name
++ awk 'match($1,"raid.*") {print $2}'
+ md_dev=
+ [[ -n '' ]]
+ wipefs --all -f /dev/vda
+ dd if=/dev/zero of=/dev/vda bs=440 count=1
1+0 records in
1+0 records out
440 bytes copied, 0.000312807 s, 1.4 MB/s
+ lsblk -a -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
fd0
vda
++ mktemp -d
+ disko_devices_dir=/tmp/tmp.on6Tu3NuPA
+ trap 'rm -rf "$disko_devices_dir"' EXIT
+ mkdir -p /tmp/tmp.on6Tu3NuPA
+ destroy=1
+ device=/dev/vda
+ imageName=disk1
+ imageSize=2G
+ name=disk1
+ type=disk
+ device=/dev/vda
+ efiGptPartitionFirst=1
+ type=gpt
+ blkid /dev/vda
+ sgdisk --clear /dev/vda
Creating new GPT entries in memory.
The operation has completed successfully.
+ sgdisk --align-end --new=1:0:+1M --partition-guid=1:R --change-name=1:disk-disk1-boot --typecode=1:EF02 --attributes=1:=:0 /dev/vda
The operation has completed successfully.
+ partprobe /dev/vda
+ udevadm trigger --subsystem-match=block
+ udevadm settle --timeout 120
+ sgdisk --align-end --new=2:0:+500M --partition-guid=2:R --change-name=2:disk-disk1-ESP --typecode=2:EF00 --attributes=2:=:0 /dev/vda
The operation has completed successfully.
+ partprobe /dev/vda
+ udevadm trigger --subsystem-match=block
+ udevadm settle --timeout 120
+ sgdisk --align-end --new=3:0:-0 --partition-guid=3:R --change-name=3:disk-disk1-bcachefs --typecode=3:8300 --attributes=3:=:0 /dev/vda
The operation has completed successfully.
+ partprobe /dev/vda
+ udevadm trigger --subsystem-match=block
+ udevadm settle --timeout 120
+ device=/dev/disk/by-partlabel/disk-disk1-ESP
+ extraArgs=()
+ declare -a extraArgs
+ format=vfat
+ mountOptions=('umask=0077')
+ declare -a mountOptions
+ mountpoint=/boot
+ type=filesystem
+ blkid /dev/disk/by-partlabel/disk-disk1-ESP
+ grep -q TYPE=
+ mkfs.vfat /dev/disk/by-partlabel/disk-disk1-ESP
mkfs.fat 4.2 (2021-01-31)
+ device=/dev/disk/by-partlabel/disk-disk1-bcachefs
+ extraFormatArgs=('--discard' '--compression=zstd:6')
+ declare -a extraFormatArgs
+ filesystem=bcachefs_desktop
+ label=bcachefs_desktop
+ type=bcachefs
+ printf '%s\n' --label=bcachefs_desktop
+ printf '%s\n' --discard
+ printf '%s\n' --compression=zstd:6
+ printf '%s\n' /dev/disk/by-partlabel/disk-disk1-bcachefs
+ extraFormatArgs=()
+ declare -a extraFormatArgs
+ mountOptions=('X-mount.mkdir')
+ declare -a mountOptions
+ mountpoint=
+ name=bcachefs_desktop
+ passwordFile=
+ type=bcachefs_filesystem
+ uuid=057886fd-6985-12ce-5ce4-4798889d19fa
+ test -s /tmp/tmp.on6Tu3NuPA/bcachefs-bcachefs_desktop
+ set --
+ IFS=
+ read -r line
+ set -- --label=bcachefs_desktop
+ IFS=
+ read -r line
+ set -- --label=bcachefs_desktop --discard
+ IFS=
+ read -r line
+ set -- --label=bcachefs_desktop --discard --compression=zstd:6
+ IFS=
+ read -r line
+ set -- --label=bcachefs_desktop --discard --compression=zstd:6 /dev/disk/by-partlabel/disk-disk1-bcachefs
+ IFS=
+ read -r line
+ grep -q TYPE=bcachefs
++ blkid -lU 057886fd-6985-12ce-5ce4-4798889d19fa
[    9.449380] I/O error, dev fd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
[    9.492289] I/O error, dev fd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
+ blkid -o export ''
+ bcachefs format --label=bcachefs_desktop --discard --compression=zstd:6 /dev/disk/by-partlabel/disk-disk1-bcachefs --uuid=057886fd-6985-12ce-5ce4-4798889d19fa
External UUID:                             057886fd-6985-12ce-5ce4-4798889d19fa
Internal UUID:                             a0221e82-60f1-46f3-917b-b025401fd991
Magic number:                              c68573f6-66ce-90a9-d96a-60cf803df7ef
Device index:                              0
Label:                                     (none)
Version:                                   no_sb_user_data_replicas (1.36)
Incompatible features allowed:             no_sb_user_data_replicas (1.36)
Incompatible features in use:              (unknown version) (0.0)
Version upgrade complete:                  (unknown version) (0.0)
Oldest version on disk:                    no_sb_user_data_replicas (1.36)
Created:                                   Fri Feb 20 12:48:19 2026
Sequence number:                           0
Time of last write:                        Thu Jan  1 00:00:00 1970
Superblock size:                           1.08k/1.00M
Clean:                                     0
Devices:                                   1
Sections:                                  members_v1,disk_groups,members_v2
Features:                                  new_siphash,new_extent_overwrite,btree_ptr_v2,extents_above_btree_updates,btree_updates_journalled,new_varint,journal_no_flush,alloc_v2,extents_across_btree_nodes,incompat_version_field
Compat features:

Options:
  block_size:                              512
  btree_node_size:                         256k
  errors:                                  continue [fix_safe] panic ro
  write_error_timeout:                     30
  metadata_replicas:                       1
  data_replicas:                           1
  encoded_extent_max:                      256k
  metadata_checksum:                       none [crc32c] crc64 xxhash
  data_checksum:                           none [crc32c] crc64 xxhash
  checksum_err_retry_nr:                   3
  compression:                             zstd:6
  background_compression:                  none
  str_hash:                                crc32c crc64 [siphash]
  metadata_target:                         none
  foreground_target:                       none
  background_target:                       none
  promote_target:                          none
  erasure_code:                            0
  casefold:                                0
  inodes_32bit:                            0
  shard_inode_numbers_bits:                0
  gc_reserve_percent:                      8
  gc_reserve_bytes:                        0
  root_reserve_percent:                    0
  wide_macs:                               0
  promote_whole_extents:                   1
  acl:                                     1
  usrquota:                                0
  grpquota:                                0
  prjquota:                                0
  degraded:                                [ask] yes very no
  journal_flush_delay:                     1000
  journal_flush_disabled:                  0
  journal_reclaim_delay:                   100
  writeback_timeout:                       0
  journal_transaction_names:               1
  allocator_stuck_timeout:                 30
  version_upgrade:                         [compatible] incompatible none
  nocow:                                   0
  reconcile_on_ac_only:                    0
Device 0:                                  /dev/vda3    (unknown model)
  Label:                                   bcachefs_desktop
  UUID:                                    3e761256-bbdc-437e-93d4-a611cdfb3c85
  Size:                                    1.50G
  read errors:                             0
  write errors:                            0
  checksum errors:                         0
  seqread iops:                            0
  seqwrite iops:                           0
  randread iops:                           0
  randwrite iops:                          0
  Bucket size:                             512k
  First bucket:                            0
  Buckets:                                 3090
  Last mount:                              (never)
  Last superblock write:                   0
  State:                                   rw
  Data allowed:                            journal,btree,user
  Has data:                                (none)
  Rotational:                              0
  Btree allocated bitmap blocksize:        1
  Btree allocated bitmap:                  0000000000000000000000000000000000000000000000000000000000000000
  Durability:                              1
  Discard:                                 1
  Freespace initialized:                   0
  Resize on mount:                         0
  Last device name:
  Last device model:
Using encoding defined by superblock: utf8-12.1.0
starting version no_sb_user_data_replicas (1.36)
initializing new filesystem
going read-write
initializing freespace
clean shutdown complete, journal seq 7
+ grep -q TYPE=bcachefs
++ blkid -lU 057886fd-6985-12ce-5ce4-4798889d19fa
+ blkid -o export /dev/vda3
++ mktemp -d
+ TEMPDIR=/tmp/tmp.WKmjcCUtKF
++ mktemp -d
+ MNTPOINT=/tmp/tmp.QuzLxZxace
+ mount -t bcachefs -o X-mount.mkdir /dev/disk/by-uuid/057886fd-6985-12ce-5ce4-4798889d19fa /tmp/tmp.QuzLxZxace
mount: /tmp/tmp.QuzLxZxace: unknown filesystem type 'bcachefs'.
       dmesg(1) may have more information after failed mount system call.
+ rm -rf /tmp/tmp.on6Tu3NuPA
+ exitHandler
+ exitCode=32
+ set +e
+ '[' -n '' ']'
+ ((  32 != 0  ))
+ runHook failureHook
+ local hookName=failureHook
+ shift
+ local 'hooksSlice=failureHooks[@]'
+ local hook
+ for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}
+ _logHook failureHook '_callImplicitHook 0 failureHook'
+ [[ -z 2 ]]
+ local hookKind=failureHook
+ local 'hookExpr=_callImplicitHook 0 failureHook'
+ shift 2
+ declare -F '_callImplicitHook 0 failureHook'
+ type -p '_callImplicitHook 0 failureHook'
+ [[ _callImplicitHook 0 failureHook != _callImplicitHook* ]]
+ _eval '_callImplicitHook 0 failureHook'
+ declare -F '_callImplicitHook 0 failureHook'
+ eval '_callImplicitHook 0 failureHook'
++ _callImplicitHook 0 failureHook
++ local def=0
++ local hookName=failureHook
++ declare -F failureHook
++ type -p failureHook
++ '[' -n '' ']'
++ return 0
+ return 0
+ '[' -n '' ']'
+ return 32
[   10.147517] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00002000
[   10.149237] CPU: 13 UID: 0 PID: 1 Comm: 5cqacs2w30rd86f Not tainted 6.19.0 #1-NixOS PREEMPT(voluntary)
[   10.151270] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS unknown 02/02/2022
[   10.153094] Call Trace:
[   10.153643]  <TASK>
[   10.154187]  dump_stack_lvl+0x5d/0x80
[   10.155063]  vpanic+0xdb/0x2d0
[   10.155738]  panic+0x6b/0x6b
[   10.156423]  do_exit.cold+0x15/0x15
[   10.157228]  ? handle_mm_fault+0x1d9/0x2e0
[   10.158167]  do_group_exit+0x2d/0xc0
[   10.158990]  __x64_sys_exit_group+0x18/0x20
[   10.159861]  x64_sys_call+0x14fd/0x1510
[   10.160706]  do_syscall_64+0xb6/0x560
[   10.161564]  ? exc_page_fault+0x6a/0x150
[   10.162450]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
[   10.163564] RIP: 0033:0x7f8bfa6ee118
[   10.164377] Code: ff 64 89 02 eb b4 e8 d7 4e 04 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8b 35 d5 dc 10 00 eb 04 0f 1f 00 f4 b8 e7 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 f0 f7 d8 64 89 06 eb e9 66 0f 1f 84 00 00 00
[   10.168365] RSP: 002b:00007ffcd60c5958 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
[   10.170034] RAX: ffffffffffffffda RBX: 00007f8bfa7fdfc8 RCX: 00007f8bfa6ee118
[   10.171539] RDX: 0000000000000000 RSI: ffffffffffffffa0 RDI: 0000000000000020
[   10.173111] RBP: 00007ffcd60c59b0 R08: 0000000000000000 R09: 0000000000000000
[   10.174619] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
[   10.176194] R13: 0000000000000020 R14: 00007f8bfa7fc680 R15: 00007f8bfa7fdfe0
[   10.177705]  </TASK>
[   10.179453] Kernel Offset: 0xd000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[   11.361726] Rebooting in 1 seconds..
[2026-02-20T12:48:23Z INFO  virtiofsd] Client disconnected, shutting down
[2026-02-20T12:48:23Z INFO  virtiofsd] Client disconnected, shutting down
Virtual machine didn't produce an exit code.
With a disko template:
{ lib, pkgs, ... }:
{
  boot.supportedFilesystems = [ "bcachefs" ];
  boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
  environment.systemPackages = [ pkgs.bcachefs-tools ];

  virtualisation.vmVariantWithDisko = {
    virtualisation.cores = 2;
    virtualisation.memorySize = 2 * 1024;
  };

  disko.devices = {
    disk.disk1 = {
      device = lib.mkDefault "/dev/sda";
      type = "disk";
      content = {
        type = "gpt";
        partitions = {
          boot = {
            name = "boot";
            size = "1M";
            type = "EF02";
          };
          esp = {
            name = "ESP";
            size = "500M";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
              mountOptions = [ "umask=0077" ];
            };
          };
          root = {
            name = "bcachefs";
            size = "100%";
            content = {
              type = "bcachefs";
              filesystem = "bcachefs_desktop";
              label = "bcachefs_desktop";
              extraFormatArgs = [
                "--discard"
                "--compression=zstd:6"
              ];
            };
          };
        };
      };
    };
    bcachefs_filesystems = {
      bcachefs_desktop = {
        type = "bcachefs_filesystem";
        subvolumes = {
          "root" = {
            mountpoint = "/";
            mountOptions = [
              "noatime"
            ];
          };
          "home" = {
            mountpoint = "/home";
            mountOptions = [
              "noatime"
            ];
          };
          "nix" = {
            mountpoint = "/nix";
            mountOptions = [
              "noatime"
            ];
          };
          "persist" = {
            mountpoint = "/persist";
            mountOptions = [
              "noatime"
            ];
          };
          "log" = {
            mountpoint = "/var/log";
            mountOptions = [
              "noatime"
            ];
          };
        };
      };
    };
  };
};

I've tried

  • Setting boot.supportedFilesystems = [ "bcachefs" ]
  • Using boot.kernelPackages = pkgs.linuxPackages_latest
  • Including bcachefs-tools in environment.systemPackages

I suppose it might be related to #1151 and #1159

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions