我有一个定制的 ISO 映像,其中有一个 FAT16 类型的分区(实际上是空白的),我试图losetup
在其上运行**,但命令继续报告 ISO 不存在。这是我尝试运行的命令和结果输出:
losetup -o $START --sizelimit $SIZE --show --find bootable.iso
...
losetup: bootable.iso: failed to set up loop device: No such file or directory
这可能是什么问题?
变量START
等于512 * 2048
且SIZE
等于"99M"
。
我的基本操作系统是 Centos7。
**我正在跟进本教程从自定义 Docker 映像创建可启动 ISO。
答案1
事实证明,这个问题的解决方案非常简单:我需要运行sudo
。我通过运行命令发现了这一点strace
,并发现其他文件被报告为不存在,其中一些文件仅对 root 可用:
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/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)
open("/dev/loop-control", O_RDWR|O_CLOEXEC) = -1 EACCES (Permission denied)
stat("/dev/loop", 0x7ffe4de4e210) = -1 ENOENT (No such file or directory)
stat("/dev/loop0", 0x7ffe4de4d170) = -1 ENOENT (No such file or directory)
open("/sys/block/loop0/dev", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
getcwd("/home/vagrant/f-16_space", 4095) = 25
readlink("/home/vagrant/f-16_space/bootable.iso", 0x7ffe4de4c270, 4096) = -1 EINVAL (Invalid argument)
open("/home/vagrant/f-16_space/bootable.iso", O_RDWR|O_CLOEXEC) = 3
open("/dev/loop0", O_RDWR|O_CLOEXEC) = -1 ENOENT (No such file or directory)
close(3) = 0
write(2, "losetup: ", 9losetup: ) = 9
write(2, "bootable.iso: failed to set up l"..., 42bootable.iso: failed to set up loop device) = 42
write(2, ": ", 2: ) = 2
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "No such file or directory\n", 26No such file or directory
) = 26
close(1) = 0
close(2) = 0
exit_group(1) = ?
+++ exited with 1 +++