Skip to content
Daniel Wagner edited this page May 28, 2026 · 13 revisions

nvme show-regs /dev/nvme0 returns: nvme0 failed to map

It's more of a "feature" than an issue. The kernel will not allow user space to map a device's IO memory when that config option is set and the tooling can't get around that limitation.

When the Linux kernel is configured with CONFIG_IO_STRICT_DEVMEM, the kernel prevents user space to map IO memory to userspace. Either compile a kernel without this option enabled or set the kernel command line option iomem=relaxed.

Also when secure boot is enabled the lockdown is activated, which prevents mapping PCI bars to user space.

nvme list shows wrong disk/block size

nvme-cli v2 relies on the kernel reporting the correct disk/block size via the sysfs interface.

Also ensure libnvme has:

and Linux kernel has (v6.8):

nvme id-ns shows the correct disk/block size because it will issue a command to read the current value.

nvme list shows old firmware version after firmware udpate

nvme-cli reads the firmware version from sysfs. Older kernel don't update the firmware entry in sysfs after an firmware upgrade. After a reboot the correct version will be shown. Alternatively you can use nvme id-ctrl to check the firmware version.

Linux kernel fix (v6.2)

If this still doesn't fix your problem, it needs to be addressed in the kernel. nvme list is a non privileged operation and thus can't issue any NVMe Commands via the passthru interface. This is on purpose.

The workaround is to use nvme id-ctrl, reset the PCI device or reboot the machine.

Ensuring correct shutdown ordering for NVMe/TCP mounted filesystems

When using NVMe/TCP, it is common to have filesystems mounted from remote NVMe namespaces.

During shutdown, the correct ordering is:

  1. Unmount all filesystems using the NVMe/TCP devices
  2. Run nvme disconnect-all
  3. Shut down networking

If nvme disconnect-all runs too early, mounted filesystems may hang or shutdown may fail because the remote block devices disappear before unmounting completes.

The recommended solution is to create a dedicated systemd service and use a systemd drop-in override instead of modifying vendor unit files directly.

Create a new service:

sudo tee /etc/systemd/system/nvme-disconnect.service >/dev/null <<'EOF'
[Unit]
Description=Disconnect NVMe Fabrics devices at shutdown
DefaultDependencies=no
Before=network.target shutdown.target
After=remote-fs.target umount.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/nvme disconnect-all

[Install]
WantedBy=shutdown.target
EOF

Enable the service:

sudo systemctl daemon-reload
sudo systemctl enable nvme-disconnect.service

This ensures that:

  • remote filesystems are unmounted first,
  • nvme disconnect-all is executed afterwards,
  • networking remains available until disconnect processing is complete.

Do not place local modifications into /usr/lib/systemd/system/.

If later versions of nvme-cli ship a vendor-provided unit, local customizations should instead be placed under:

/etc/systemd/system/<unit>.d/

using systemctl edit.

Additional information about systemd unit overrides can be found in:

man systemd.unit
man systemctl

Relevant project documentation:

Clone this wiki locally