Adding block device "Invalid Argument" error

When I try to add an rbd block device to a running container, I see this:

root@v57:# lxc config device add one-23572 rbd4 unix-block major=252 minor=0 path=/dev/rbd4 
Error: Failed to add mount for device: Failed to run: /snap/lxd/current/bin/lxd forkmount mount 2207498 /dev/.lxd-mounts/lxdmount_324109137 dev/rbd4: Failed mounting /dev/.lxd-mounts/lxdmount_324109137 onto dev/rbd4: Invalid argument

In the container I see this:

root@v57:# lxc exec one-23572 -- ls -al /dev | grep rbd 
-rwxr-xr-x  1 root root        0 Nov 13 02:31 rbd4

Repeating the device add command results in this:

root@v57:# lxc config device add one-23572 rbd4 unix-block major=252 minor=0 path=/dev/rbd4 
Error: Failed to setup device: Failed to create device /var/snap/lxd/common/lxd/devices/one-23572/unix.rbd4.dev-rbd4 for /dev/rbd4: file exists

And I see this on the host:

root@v57:# ls -al /var/snap/lxd/common/lxd/devices/one-23572/unix.rbd4.dev-rbd4
brw-rw---- 1 root root 252, 0 Nov 12 18:31 /var/snap/lxd/common/lxd/devices/one-23572/unix.rbd4.dev-rbd4

What is the “Invalid Argument” referring to when I try to add the block device?

Relevant Info:

  • Ubuntu 18.04.4 LTS
  • LXD 3.0.4
  • Container launched by OpenNebula