Can't create BTRFS storage pool

Hello,

I’m trying to create a BTRFS pool on a partition but that fails:

pulsar@zira:~$ cat /etc/debian_version 
10.3
pulsar@zira:~$ uname -a
Linux zira 5.4.0-0.bpo.4-amd64 #1 SMP Debian 5.4.19-1~bpo10+1 (2020-03-09) x86_64 GNU/Linux
pulsar@zira:~$ snap list
Name  Version    Rev    Tracking       Publisher   Notes
core  16-2.44.1  8935   latest/stable  canonical✓  core
lxd   4.0.0      14194  latest/stable  canonical✓  -
pulsar@zira:~$ sudo wipefs -a /dev/sda4
/dev/sda4: 8 bytes were erased at offset 0x00010040 (btrfs): 5f 42 48 52 66 53 5f 4d
pulsar@zira:~$ cat lxdinit.yml | lxd init --preseed
Error: Failed to create storage pool 'local': Failed to mount '/dev/sda4' on '/var/snap/lxd/common/lxd/storage-pools/local': no such device
pulsar@zira:~$ cat lxdinit.yml 
config:
  images.auto_update_interval: "0"
networks: []
storage_pools:
- config:
    source: /dev/sda4
  description: ""
  name: local
  driver: btrfs
profiles:
- config: {}
  description: ""
  devices:
    eth0:
      name: eth0
      nictype: bridged
      parent: lxdbr3
      type: nic
    root:
      path: /
      pool: default
      type: disk
  name: default
cluster: null

I tried with an older version and I have the same problem:

pulsar@zira:~$ snap list
Name  Version    Rev    Tracking       Publisher   Notes
core  16-2.44.1  8935   latest/stable  canonical✓  core
lxd   3.18       12631  3.18/stable    canonical✓  -
pulsar@zira:~$ sudo wipefs -a /dev/sda4
pulsar@zira:~$ cat lxdinit.yml | lxd init --preseed
Error: Failed to create storage pool 'local': no such device

Do you think it’s a bug? If so, I’ll open an issue on github.

Thank you for your time.

Can you update onto a supported version of the snap? 3.18 is rather old :slight_smile:

I’m not sure it’ll fix the issue but considering the entire storage logic got rewritten between 3.18 and now, there’s little point in us debugging this until you’re on 3.23 or 4.0.

Thank you for your response.
The first code block concerns version 4.0. As you can see, the problem is the same.

Oh right, sorry.

Can you show nsenter --mount=/run/snapd/ns/lxd.mnt ls -lh /dev?

No problem and thanks!
Yes, sure:

pulsar@zira:~$ sudo nsenter --mount=/run/snapd/ns/lxd.mnt ls -lh /dev
total 0
crw-r--r-- 1 root root     10, 235 Apr  6 10:28 autofs
drwxr-xr-x 2 root root         320 Apr  6 10:28 block
drwxr-xr-x 2 root root          60 Apr  6 10:27 bsg
crw------- 1 root root     10, 234 Apr  6 10:28 btrfs-control
drwxr-xr-x 3 root root          60 Apr  6 10:27 bus
drwxr-xr-x 2 root root        2.6K Apr  6 11:24 char
crw------- 1 root root      5,   1 Apr  6 10:28 console
lrwxrwxrwx 1 root root          11 Apr  6 10:27 core -> /proc/kcore
crw------- 1 root root     10,  62 Apr  6 10:28 cpu_dma_latency
crw------- 1 root root     10, 203 Apr  6 10:28 cuse
drwxr-xr-x 8 root root         160 Apr  6 10:27 disk
drwxr-xr-x 3 root root          80 Apr  6 10:28 dri
lrwxrwxrwx 1 root root          13 Apr  6 10:27 fd -> /proc/self/fd
crw-rw-rw- 1 root root      1,   7 Apr  6 10:28 full
crw-rw-rw- 1 root root     10, 229 Apr  6 10:30 fuse
crw------- 1 root root     10, 228 Apr  6 10:28 hpet
drwxr-xr-x 2 root root           0 Apr  6 10:28 hugepages
lrwxrwxrwx 1 root root          12 Apr  6 10:28 initctl -> /run/initctl
drwxr-xr-x 2 root root         140 Apr  6 10:28 input
crw-r--r-- 1 root root      1,  11 Apr  6 10:28 kmsg
lrwxrwxrwx 1 root root          28 Apr  6 10:27 log -> /run/systemd/journal/dev-log
crw-rw---- 1 root disk     10, 237 Apr  6 10:28 loop-control
brw-rw---- 1 root disk      7,   0 Apr  6 10:28 loop0
brw-rw---- 1 root disk      7,   1 Apr  6 11:50 loop1
brw-rw---- 1 root disk      7,   2 Apr  6 10:28 loop2
brw-rw---- 1 root disk      7,   3 Apr  6 10:28 loop3
brw-rw---- 1 root disk      7,   4 Apr  6 10:28 loop4
brw-rw---- 1 root disk      7,   5 Apr  6 10:28 loop5
brw-rw---- 1 root disk      7,   6 Apr  6 10:28 loop6
brw-rw---- 1 root disk      7,   7 Apr  6 10:28 loop7
drwxr-xr-x 2 root root          60 Apr  6 10:28 mapper
crw-r----- 1 root kmem      1,   1 Apr  6 10:28 mem
drwxrwxrwt 2 root root          40 Apr  6 10:27 mqueue
drwxr-xr-x 2 root root          60 Apr  6 10:28 net
crw-rw-rw- 1 root root      1,   3 Apr  6 10:28 null
crw------- 1 root root     10, 144 Apr  6 10:28 nvram
crw-rw---- 1 root lp       99,   0 Apr  6 10:28 parport0
crw-r----- 1 root kmem      1,   4 Apr  6 10:28 port
crw------- 1 root root    108,   0 Apr  6 10:28 ppp
crw------- 1 root root     10,   1 Apr  6 10:28 psaux
crw-rw-rw- 1 root root      5,   2 Apr  6 11:50 ptmx
crw------- 1 root root    248,   0 Apr  6 10:28 ptp0
drwxr-xr-x 2 root root           0 Apr  6 11:50 pts
crw-rw-rw- 1 root root      1,   8 Apr  6 10:28 random
crw------- 1 root root     10, 242 Apr  6 10:28 rfkill
lrwxrwxrwx 1 root root           4 Apr  6 10:28 rtc -> rtc0
crw------- 1 root root    252,   0 Apr  6 10:28 rtc0
brw-rw---- 1 root disk      8,   0 Apr  6 10:28 sda
brw-rw---- 1 root disk      8,   1 Apr  6 10:28 sda1
brw-rw---- 1 root disk      8,   2 Apr  6 10:28 sda2
brw-rw---- 1 root disk      8,   3 Apr  6 10:28 sda3
brw-rw---- 1 root disk      8,   4 Apr  6 11:32 sda4
brw-rw---- 1 root disk      8,   5 Apr  6 10:28 sda5
crw-rw---- 1 root disk     21,   0 Apr  6 10:28 sg0
drwxrwxrwt 2 root root          40 Apr  6 10:27 shm
crw------- 1 root root     10, 231 Apr  6 10:28 snapshot
drwxr-xr-x 2 root root          80 Apr  6 10:28 snd
lrwxrwxrwx 1 root root          15 Apr  6 10:27 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root          15 Apr  6 10:27 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root          15 Apr  6 10:27 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty       5,   0 Apr  6 16:16 tty
crw--w---- 1 root tty       4,   0 Apr  6 10:28 tty0
crw--w---- 1 root tty       4,   1 Apr  6 10:28 tty1
crw--w---- 1 root tty       4,  10 Apr  6 10:28 tty10
crw--w---- 1 root tty       4,  11 Apr  6 10:28 tty11
crw--w---- 1 root tty       4,  12 Apr  6 10:28 tty12
crw--w---- 1 root tty       4,  13 Apr  6 10:28 tty13
crw--w---- 1 root tty       4,  14 Apr  6 10:28 tty14
crw--w---- 1 root tty       4,  15 Apr  6 10:28 tty15
crw--w---- 1 root tty       4,  16 Apr  6 10:28 tty16
crw--w---- 1 root tty       4,  17 Apr  6 10:28 tty17
crw--w---- 1 root tty       4,  18 Apr  6 10:28 tty18
crw--w---- 1 root tty       4,  19 Apr  6 10:28 tty19
crw--w---- 1 root tty       4,   2 Apr  6 10:28 tty2
crw--w---- 1 root tty       4,  20 Apr  6 10:28 tty20
crw--w---- 1 root tty       4,  21 Apr  6 10:28 tty21
crw--w---- 1 root tty       4,  22 Apr  6 10:28 tty22
crw--w---- 1 root tty       4,  23 Apr  6 10:28 tty23
crw--w---- 1 root tty       4,  24 Apr  6 10:28 tty24
crw--w---- 1 root tty       4,  25 Apr  6 10:28 tty25
crw--w---- 1 root tty       4,  26 Apr  6 10:28 tty26
crw--w---- 1 root tty       4,  27 Apr  6 10:28 tty27
crw--w---- 1 root tty       4,  28 Apr  6 10:28 tty28
crw--w---- 1 root tty       4,  29 Apr  6 10:28 tty29
crw--w---- 1 root tty       4,   3 Apr  6 10:28 tty3
crw--w---- 1 root tty       4,  30 Apr  6 10:28 tty30
crw--w---- 1 root tty       4,  31 Apr  6 10:28 tty31
crw--w---- 1 root tty       4,  32 Apr  6 10:28 tty32
crw--w---- 1 root tty       4,  33 Apr  6 10:28 tty33
crw--w---- 1 root tty       4,  34 Apr  6 10:28 tty34
crw--w---- 1 root tty       4,  35 Apr  6 10:28 tty35
crw--w---- 1 root tty       4,  36 Apr  6 10:28 tty36
crw--w---- 1 root tty       4,  37 Apr  6 10:28 tty37
crw--w---- 1 root tty       4,  38 Apr  6 10:28 tty38
crw--w---- 1 root tty       4,  39 Apr  6 10:28 tty39
crw--w---- 1 root tty       4,   4 Apr  6 10:28 tty4
crw--w---- 1 root tty       4,  40 Apr  6 10:28 tty40
crw--w---- 1 root tty       4,  41 Apr  6 10:28 tty41
crw--w---- 1 root tty       4,  42 Apr  6 10:28 tty42
crw--w---- 1 root tty       4,  43 Apr  6 10:28 tty43
crw--w---- 1 root tty       4,  44 Apr  6 10:28 tty44
crw--w---- 1 root tty       4,  45 Apr  6 10:28 tty45
crw--w---- 1 root tty       4,  46 Apr  6 10:28 tty46
crw--w---- 1 root tty       4,  47 Apr  6 10:28 tty47
crw--w---- 1 root tty       4,  48 Apr  6 10:28 tty48
crw--w---- 1 root tty       4,  49 Apr  6 10:28 tty49
crw--w---- 1 root tty       4,   5 Apr  6 10:28 tty5
crw--w---- 1 root tty       4,  50 Apr  6 10:28 tty50
crw--w---- 1 root tty       4,  51 Apr  6 10:28 tty51
crw--w---- 1 root tty       4,  52 Apr  6 10:28 tty52
crw--w---- 1 root tty       4,  53 Apr  6 10:28 tty53
crw--w---- 1 root tty       4,  54 Apr  6 10:28 tty54
crw--w---- 1 root tty       4,  55 Apr  6 10:28 tty55
crw--w---- 1 root tty       4,  56 Apr  6 10:28 tty56
crw--w---- 1 root tty       4,  57 Apr  6 10:28 tty57
crw--w---- 1 root tty       4,  58 Apr  6 10:28 tty58
crw--w---- 1 root tty       4,  59 Apr  6 10:28 tty59
crw--w---- 1 root tty       4,   6 Apr  6 10:28 tty6
crw--w---- 1 root tty       4,  60 Apr  6 10:28 tty60
crw--w---- 1 root tty       4,  61 Apr  6 10:28 tty61
crw--w---- 1 root tty       4,  62 Apr  6 10:28 tty62
crw--w---- 1 root tty       4,  63 Apr  6 10:28 tty63
crw--w---- 1 root tty       4,   7 Apr  6 10:28 tty7
crw--w---- 1 root tty       4,   8 Apr  6 10:28 tty8
crw--w---- 1 root tty       4,   9 Apr  6 10:28 tty9
crw-rw---- 1 root dialout   4,  64 Apr  6 10:28 ttyS0
crw-rw---- 1 root dialout   4,  65 Apr  6 10:28 ttyS1
crw-rw---- 1 root dialout   4,  66 Apr  6 10:28 ttyS2
crw-rw---- 1 root dialout   4,  67 Apr  6 10:28 ttyS3
crw------- 1 root root     10, 239 Apr  6 10:28 uhid
crw------- 1 root root     10, 223 Apr  6 10:28 uinput
crw-rw-rw- 1 root root      1,   9 Apr  6 10:28 urandom
crw-rw---- 1 root tty       7,   0 Apr  6 10:28 vcs
crw-rw---- 1 root tty       7,   1 Apr  6 10:28 vcs1
crw-rw---- 1 root tty       7,   2 Apr  6 10:28 vcs2
crw-rw---- 1 root tty       7,   3 Apr  6 10:28 vcs3
crw-rw---- 1 root tty       7,   4 Apr  6 10:28 vcs4
crw-rw---- 1 root tty       7,   5 Apr  6 10:28 vcs5
crw-rw---- 1 root tty       7,   6 Apr  6 10:28 vcs6
crw-rw---- 1 root tty       7, 128 Apr  6 10:28 vcsa
crw-rw---- 1 root tty       7, 129 Apr  6 10:28 vcsa1
crw-rw---- 1 root tty       7, 130 Apr  6 10:28 vcsa2
crw-rw---- 1 root tty       7, 131 Apr  6 10:28 vcsa3
crw-rw---- 1 root tty       7, 132 Apr  6 10:28 vcsa4
crw-rw---- 1 root tty       7, 133 Apr  6 10:28 vcsa5
crw-rw---- 1 root tty       7, 134 Apr  6 10:28 vcsa6
crw-rw---- 1 root tty       7,  64 Apr  6 10:28 vcsu
crw-rw---- 1 root tty       7,  65 Apr  6 10:28 vcsu1
crw-rw---- 1 root tty       7,  66 Apr  6 10:28 vcsu2
crw-rw---- 1 root tty       7,  67 Apr  6 10:28 vcsu3
crw-rw---- 1 root tty       7,  68 Apr  6 10:28 vcsu4
crw-rw---- 1 root tty       7,  69 Apr  6 10:28 vcsu5
crw-rw---- 1 root tty       7,  70 Apr  6 10:28 vcsu6
drwxr-xr-x 2 root root          60 Apr  6 10:28 vfio
crw------- 1 root root     10,  63 Apr  6 10:28 vga_arbiter
crw------- 1 root root     10, 137 Apr  6 10:28 vhci
crw------- 1 root root     10, 238 Apr  6 10:28 vhost-net
crw------- 1 root root     10, 241 Apr  6 10:28 vhost-vsock
crw------- 1 root root     10, 130 Apr  6 10:28 watchdog
crw------- 1 root root    247,   0 Apr  6 10:28 watchdog0
crw-rw-rw- 1 root root      1,   5 Apr  6 10:28 zero

Very weird.

Can you show modinfo btrfs and grep btrfs /proc/filesystems as well as check the end of dmesg following an attempt to use /dev/sda4 for anything suspicious?

pulsar@zira:~$ sudo modinfo btrfs
filename:       /lib/modules/5.4.0-0.bpo.4-amd64/kernel/fs/btrfs/btrfs.ko
softdep:        pre: crypto-crc32c
license:        GPL
alias:          devname:btrfs-control
alias:          char-major-10-234
alias:          fs-btrfs
depends:        libcrc32c,zstd_compress,zstd_decompress,raid6_pq,xor
retpoline:      Y
intree:         Y
name:           btrfs
vermagic:       5.4.0-0.bpo.4-amd64 SMP mod_unload modversions 
sig_id:         PKCS#7
signer:         Debian Secure Boot CA
sig_key:        A7:46:8D:EF
sig_hashalgo:   sha256
signature:      46:36:C3:CC:10:9D:02:B5:96:EE:3D:31:0B:F3:CF:D8:8A:D5:CA:07:
		D5:61:4F:AC:74:D1:E1:BF:47:E5:4C:E0:E1:00:B9:66:F8:DE:46:55:
		24:AC:19:A2:08:52:BA:01:35:92:CC:AD:A9:6E:C8:29:EC:87:73:B4:
		3F:D5:D2:10:4D:7A:5D:1C:3F:86:27:2E:16:18:B1:C8:82:80:74:21:
		C2:94:75:AD:02:F5:71:37:EB:32:21:79:1B:2E:97:09:33:4D:E5:AC:
		25:54:D5:A6:19:DC:70:58:FA:9F:BB:42:2B:DC:E4:49:29:A6:3C:5E:
		CD:B0:0A:FD:CD:B9:97:25:D4:F1:FE:34:59:CE:57:5F:79:54:58:5F:
		7D:C0:86:30:78:35:86:DC:EB:8D:C2:B1:97:56:A6:29:E3:A2:7E:EB:
		FC:7C:6C:90:E1:92:28:A2:D4:95:47:23:CA:3E:D8:98:D3:4C:F9:D8:
		0C:8B:A7:83:DF:D6:73:EF:FC:1C:0E:AE:86:D8:DB:37:C1:3C:71:10:
		11:0C:39:D4:33:4F:C9:C4:25:1D:82:F2:BC:23:72:A2:94:30:94:F7:
		09:FF:CA:0B:E3:A5:22:84:5D:7C:92:5F:6F:86:BD:A1:22:6F:E9:0A:
		AD:BA:08:0E:DC:EC:46:C1:37:74:1B:63:03:02:54:D3

No output for pulsar@zira:~$ sudo grep btrfs /proc/filesystems.
The very last ligne of dmesg command contains:

[21542.218615] new mount options do not match the existing superblock, will be ignored

lsmod | grep btrfs

If that doesn’t show it loaded, can you try modprobe btrfs?

No, same problem but another error message:

pulsar@zira:~$ sudo lsmod | grep btrfs
pulsar@zira:~$ sudo modprobe btrfs
pulsar@zira:~$ sudo lsmod | grep btrfs
btrfs                1466368  0
xor                    24576  1 btrfs
zstd_compress         172032  1 btrfs
raid6_pq              122880  1 btrfs
libcrc32c              16384  3 nf_conntrack,nf_nat,btrfs
zstd_decompress        86016  2 squashfs,btrfs
pulsar@zira:~$ sudo wipefs -a /dev/sda4
/dev/sda4: 8 bytes were erased at offset 0x00010040 (btrfs): 5f 42 48 52 66 53 5f 4d
pulsar@zira:~$ cat lxdinit.yml | lxd init --preseed
Error: Failed to update profile 'default': Device validation failed "root": The "default" storage pool doesn't exist

Not quite the same, the pool is setting up fine now.

Your pool is called local but you’re referring to it as default in the root device.

Yeah, you’re right, sorry and it’s now ok!
So, now I need to see why the btrfs module isn’t loaded at boot.