openmediavault/openmediavault · error · OMV\Exception
Failed to get list of unused devices.
Error message
Failed to get list of unused devices.
What it means
Thrown by the unused-devices RPC when the storage device enumeration call (filtered to non-read-only devices) returns false instead of an array, meaning the underlying enumeration of storage devices failed entirely rather than merely returning an empty list. The boolean-false sentinel marks an internal enumeration error (e.g. command failures while probing disks).
Solutions
- Run the probing commands manually (lsblk, blkid) as the omv user to find which command fails, and repair it (reinstall util-linux/blkid, fix device nodes).
- Check dmesg/journalctl for storage-layer errors (I/O errors, hot-unplug during scan) and rescan.
- If running in a container, expose /sys, /proc and /dev block devices properly to the openmediavault-engined process.
- Patch the RPC to return a partial/empty list or a structured error instead of a bare OMV\Exception when enumeration fails, so the UI can distinguish 'no unused devices' from 'scan failed'.
Defensive patterns
Strategy: retry
Validate before calling
exec('lsblk --all --json 2>&1', $out, $rc);
if (0 !== $rc) {
die("storage probing broken, fix lsblk/blkid before calling getUnusedDevices\n");
}
$this->rpc('FileSystemMgmt', 'getUnusedDevices', []); Type guard
function storageEnumerationWorks(): bool {
exec('lsblk -d -n -o NAME 2>/dev/null', $out, $rc);
return 0 === $rc;
} Try / catch
try {
$devs = $this->rpc('FileSystemMgmt', 'getUnusedDevices', []);
} catch (\OMV\Exception $e) {
if (str_contains($e->getMessage(), 'Failed to get list of unused devices')) {
sleep(2); // transient device churn: retry after a short backoff
$devs = $this->rpc('FileSystemMgmt', 'getUnusedDevices', []);
} else {
throw $e;
}
} Prevention
- Ensure the omv user can read /sys, /proc and block device nodes (no restrictive containers/seccomp).
- Avoid hot-unplugging devices during scans; debounce USB events before enumerating.
- Keep util-linux/blkid installed and current on the system.
- Monitor dmesg for storage I/O errors that would break device probing.
When it happens
Trigger: Calling rpc.filesystemmgmt.getUnusedDevices when \OMV\System\Storage\...::getDevices-style enumeration with the isReadOnly filter returns false — typically when blkid/lsblk/sysfs probing fails at the OS level.
Common situations: Broken /proc or /sys visibility in containers, missing or failing block-device tools, devices disappearing mid-scan (USB hot-unplug), or permissions/seccomp issues preventing the engined process from reading device information.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Failed to get list of storage devices
- Failed to start session.
- Failed to write session data.
- Failed to get list of hard disks and hardware RAID devices.
- No file system backend set for
AI-assisted analysis of openmediavault/openmediavault@dce610eb66 (2026-09-15).
Data as JSON: /api/errors/4a568fd048746cec.
Report an issue: GitHub.
Appendix: source
Thrown at deb/openmediavault/usr/share/openmediavault/engined/rpc/filesystemmgmt.inc:597
* devicefile, size and description.
* @throw \OMV\Exception
*/
public function getCandidates($params, $context)
{
// Validate the RPC caller context.
$this->validateMethodContext($context, [
"role" => OMV_ROLE_ADMINISTRATOR
]);
// Get a list of all potential usable devices (excluding read-only devices).
$devs = \OMV\System\Storage\StorageDevice::enumerateUnusedObjects(
OMV_STORAGE_DEVICE_KIND_DEFAULT,
\OMV\LogicalOperator::ALL,
function (\OMV\System\Storage\StorageDeviceInterface $sd): bool {
return !$sd->isReadOnly();
}
);
if (false === $devs) {
throw new \OMV\Exception("Failed to get list of unused devices.");
}
// Get a list of all detected file systems.
$filesystems = \OMV\System\Filesystem\Filesystem::getFilesystems();
// Get the list of device files that are occupied by a file system.
$usedDevs = [];
foreach ($filesystems as $filesystemk => $filesystemv) {
$usedDevs[] = $filesystemv->getParentDeviceFile();
// Check if the file system uses multiple devices, e.g.
// a BTRFS RAID, and add them.
if ($filesystemv->hasMultipleDevices()) {
$usedDevs = array_merge(
$filesystemv->getDeviceFiles(),
$usedDevs
);
}
}
$usedDevs = array_values(array_filter($usedDevs, "strlen"));
// Prepare the result list.View on GitHub (pinned to dce610eb66)