我正在尝试创建一个循环设备,并收到一个我不明白的错误:
# losetup -f /media/2TB/sdb2-fix-file
losetup: cannot find an unused loop device
我没有设置循环设备。的输出losetup -a
为空,并且:
# ls -l /dev/loop*
crw-rw---- 1 root disk 10, 237 Oct 4 15:50 /dev/loop-control
跑步losetup -D
根本没有帮助。
为什么会出现这种情况?
以下是完整strace
输出:
# strace -fs80 losetup -f /media/2TB/sdb2-fix-file execve("/usr/bin/losetup", ["losetup", "-f", "/media/2TB/sdb2-fix-file"], 0x7ffc6fe88c38 /* 164 vars */) = 0 brk(NULL) = 0x55a51e754000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=215090, ...}) = 0 mmap(NULL, 215090, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f35d682e000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libsmartcols.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000n\0\0\0\0\0\0@\0\0\0\0\0\0\0\210\341\2\0\0\0\0\0\0\0\0\0@\0008\0\10\0@\0\34\0\33\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=190600, ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f35d682c000 mmap(NULL, 2290720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f35d640f000 mprotect(0x7f35d643b000, 2097152, PROT_NONE) = 0 mmap(0x7f35d663b000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c000) = 0x7f35d663b000 mmap(0x7f35d663e000, 1056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f35d663e000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\20\2\0\0\0\0\0@\0\0\0\0\0\0\0\360s\37\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0G\0F\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=2065840, ...}) = 0 mmap(NULL, 3893456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f35d6058000 mprotect(0x7f35d6206000, 2093056, PROT_NONE) = 0 mmap(0x7f35d6405000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ad000) = 0x7f35d6405000 mmap(0x7f35d640b000, 14544, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f35d640b000 close(3) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f35d6829000 arch_prctl(ARCH_SET_FS, 0x7f35d6829740) = 0 mprotect(0x7f35d6405000, 16384, PROT_READ) = 0 mprotect(0x7f35d663b000, 8192, PROT_READ) = 0 mprotect(0x55a51ccf5000, 4096, PROT_READ) = 0 mprotect(0x7f35d6863000, 4096, PROT_READ) = 0 munmap(0x7f35d682e000, 215090) = 0 brk(NULL) = 0x55a51e754000 brk(0x55a51e775000) = 0x55a51e775000 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=1687072, ...}) = 0 mmap(NULL, 1687072, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f35d668d000 close(3) = 0 stat("/sys/block", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 uname({sysname="Linux", nodename="svelte", ...}) = 0 stat("/dev/loop-control", {st_mode=S_IFCHR|0660, st_rdev=makedev(10, 237), ...}) = 0 openat(AT_FDCWD, "/dev/loop-control", O_RDWR|O_CLOEXEC) = -1 ENODEV (No such device) stat("/dev/loop", 0x7fffae014c60) = -1 ENOENT (No such file or directory) stat("/dev/loop0", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop1", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop2", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop3", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop4", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop5", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop6", 0x7fffae014c00) = -1 ENOENT (No such file or directory) stat("/dev/loop7", 0x7fffae014c00) = -1 ENOENT (No such file or directory) open("/dev/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFDIR|0755, st_size=3400, ...}) = 0 getdents(3, /* 170 entries */, 32768) = 4936 getdents(3, /* 0 entries */, 32768) = 0 close(3) = 0 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2997, ...}) = 0 read(3, "# Locale name alias data base.\n# Copyright (C) 1996-2017 Free Software Foundatio"..., 4096) = 2997 read(3, "", 4096) = 0 close(3) = 0 open("/usr/share/locale/en_AU.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_AU/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "losetup: ", 9losetup: ) = 9 write(2, "cannot find an unused loop device", 33cannot find an unused loop device) = 33 write(2, "\n", 1 ) = 1 close(1) = 0 close(2) = 0 exit_group(1) = ? +++ exited with 1 +++
答案1
磁盘上的内核模块与正在运行的内核不兼容。我已经更新了内核,但尚未重新启动。
modprobe: FATAL: Module loop not found in directory /lib/modules/4.9.51-1-MANJARO.
重新启动后,modprobe loop
工作正常。