Я пытаюсь создать устройство петли, и получаю ошибку, которую я не понимаю:
# losetup -f /media/2TB/sdb2-fix-file
losetup: cannot find an unused loop device
У меня нет настройки петлевых устройств. Вывод из losetup -a
null, и:
# 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 +++
loop-device
Том Хейл
источник
источник
mount
позаботиться о петлевом устройстве. Вам больше не нужно звонитьlosetup
, хотя я полагаю, что он по-прежнему всплывает во многих уроках в Интернете ...dm-setup
. Для других, интересующихся, вот в чем проблема XY .loop
модуль загружен ..# modprobe loop
.Ответы:
Модули ядра на диске были несовместимы с работающим ядром. Я обновил свое ядро и еще не перезагрузился.
Бег
modprobe loop
дал мне:После перезагрузки
modprobe loop
работал просто отлично.источник