{"record":{"id":"bf48348e0562d137","repo":"juicedata/juicefs","slug":"read-device-list-file","errorCode":null,"errorMessage":"read device list file","messagePattern":"read device list file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/fuse/device_linux.go","lineNumber":85,"sourceCode":"\t}\n\n\tif len(deviceCgroup) == 0 {\n\t\treturn errors.Errorf(\"fail to find device cgroup\")\n\t}\n\n\tdeviceListPath := path.Join(\"/sys/fs/cgroup/devices\" + deviceCgroup, \"/devices.list\")\n\tdeviceAllowPath := path.Join(\"/sys/fs/cgroup/devices\" + deviceCgroup, \"/devices.allow\")\n\n\t// check if fuse is already allowed\n\tdeviceListFile, err := os.OpenFile(deviceListPath, os.O_RDONLY, 0)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"open %s\", deviceListPath)\n\t}\n\tdefer deviceListFile.Close()\n\tdeviceListScanner := bufio.NewScanner(deviceListFile)\n\tfor deviceListScanner.Scan() {\n\t\tif err := deviceListScanner.Err(); err != nil {\n\t\t\treturn errors.Wrap(err, \"read device list file\")\n\t\t}\n\t\tvar (\n\t\t\ttext  = deviceListScanner.Text()\n\t\t\tparts = strings.SplitN(text, \" \", 3)\n\t\t)\n\t\tif len(parts) < 3 {\n\t\t\treturn errors.Errorf(\"invalid device list entry: %q\", text)\n\t\t}\n\n\t\tif (parts[0] == \"c\" || parts[0] == \"a\") && (parts[1] == \"10:229\" || parts[1] == \"*:*\") && parts[2] == \"rwm\" {\n\t\t\tlogger.Debug(\"/dev/fuse is already granted\")\n\t\t\t// fuse is already allowed\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tf, err := os.OpenFile(deviceAllowPath, os.O_WRONLY, 0)\n\tif err != nil {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/fuse/device_linux.go#L67-L103","documentation":"Wraps failures while reading the cgroup v1 devices.list file in grantAccess: the scanner on /sys/fs/cgroup/devices/<group>/devices.list errored. The FUSE device permission check cannot verify or grant /dev/fuse access without it.","triggerScenarios":"Reading /sys/fs/cgroup/devices<path>/devices.list fails partway through — e.g. EIO from a corrupted sysfs mount, or the file being removed/unmounted while the scan is in progress.","commonSituations":"Race with container teardown deleting the cgroup directory during mount startup; fs corruption in sysfs-backed pseudo-filesystems; rare kernel/fs errors under memory pressure.","solutions":["Re-run the mount — transient I/O errors usually clear on retry","Verify the cgroup directory still exists and is stable during startup (avoid racing container teardown)","Check dmesg for underlying I/O errors on the sysfs/cgroup mount","If persistent, grant /dev/fuse manually so the devices.list read is skipped"],"exampleFix":"// before\n./juicefs mount ...   // read device list file: input/output error\n// after (retry or manual grant)\necho 'c 10:229 rwm' > /sys/fs/cgroup/devices/.../devices.allow && ./juicefs mount ...","handlingStrategy":"retry","validationCode":"// sysfs files rarely fail preemptively; check the mount is stable\nif _, err := os.Stat(\"/sys/fs/cgroup/devices\"); err != nil {\n  // cgroup dir unstable/missing\n}","typeGuard":null,"tryCatchPattern":"if err := grantAccess(); err != nil && strings.Contains(err.Error(), \"read device list file\") {\n  time.Sleep(time.Second)\n  err = grantAccess() // transient EIO usually clears\n}","preventionTips":["Avoid racing container teardown with mount startup","Monitor dmesg for sysfs/cgroup I/O errors","Grant the device manually to skip the devices.list read"],"tags":["linux","cgroups","io","fuse"],"backgroundTag":"file-read-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}