我一直在尝试创建自定义 ISO 映像,并且取得了成功。然而,在这个过程中,我遇到了一个我不明白的情况。
我的系统是 Ubuntu 20.04.6 LTS Desktop。
基本上,在我运行到一个目录,然后列出生成的squashfs-rootsudo unsquashfs ubuntu-server-minimal.squashfs
目录所在的父目录的内容后,我收到以下内容和许多警告:
$ ls -l
total 2231416
dr-xr-xr-x 9 mike mike 4096 Aug 9 22:06 extracted-iso
drwxr-xr-x 18 root root 4096 Aug 9 17:20 squashfs-root
-rw-rw-r-- 1 mike mike 2133391360 Sep 18 18:13 ubuntu-22.04.3-live-server-amd64.iso
-r--r--r-- 1 mike mike 151560192 Sep 18 18:15 ubuntu-server-minimal.squashfs
warning: could not open directory 'iso/squashfs-root/var/lib/polkit-1/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/apt/lists/partial/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/snapd/void/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/log/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/pollinate/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/ldconfig/': Permission denied
warning: could not open directory 'iso/squashfs-root/root/': Permission denied
warning: could not open directory 'iso/squashfs-root/run/lock/lvm/': Permission denied
warning: could not open directory 'iso/squashfs-root/run/lvm/': Permission denied
warning: could not open directory 'iso/squashfs-root/etc/polkit-1/localauthority/': Permission denied
warning: could not open directory 'iso/squashfs-root/etc/ssl/private/': Permission denied
这就是我感到困惑的地方。我知道squashfs-root归 root 所有,但每个人都对其具有读取权限。chroot
其次,在创建进入squashfs-root时所需的各种安装后,警告数量会增加,如下所示:
mount --bind /etc/resolv.conf squashfs-root/etc/resolv.conf
mount -t proc none squashfs-root/proc
mount -t sysfs none squashfs-root/sys
mount -t devpts none squashfs-root/dev/pts
此外,这些警告现在出现在任何命令中,例如lsb_release -a
和pwd
:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
warning: could not open directory 'iso/squashfs-root/var/lib/polkit-1/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/apt/lists/partial/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/snapd/void/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/log/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/pollinate/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/ldconfig/': Permission denied
warning: could not open directory 'iso/squashfs-root/root/': Permission denied
warning: could not open directory 'iso/squashfs-root/run/lock/lvm/': Permission denied
warning: could not open directory 'iso/squashfs-root/run/lvm/': Permission denied
warning: could not open directory 'iso/squashfs-root/etc/polkit-1/localauthority/': Permission denied
warning: could not open directory 'iso/squashfs-root/etc/ssl/private/': Permission denied
$ pwd
/home/mike/custom-iso/iso
warning: could not open directory 'iso/squashfs-root/var/lib/polkit-1/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/apt/lists/partial/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/lib/snapd/void/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/log/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/private/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/pollinate/': Permission denied
warning: could not open directory 'iso/squashfs-root/var/cache/ldconfig/': Permission denied
warning: could not open directory 'iso/squashfs-root/root/': Permission denied
warning: could not open directory 'iso/squashfs-root/run/lock/lvm/': Permission denied
warning: could not open directory 'iso/squashfs-root/run/lvm/': Permission denied
warning: could not open directory 'iso/squashfs-root/etc/polkit-1/localauthority/': Permission denied
warning: could not open directory 'iso/squashfs-root/etc/ssl/private/': Permission denied
- 如果我
sudo su
,所有警告都会消失。 - 使用删除squashfs-root
sudo rm -fr squashfs-root
后,所有警告都会消失。
那么这是怎么回事呢?为什么我会收到这些警告?又如何能够压制他们呢?我在这方面做错了什么吗unsquashfs
?
更新:
作为测试,我在 VirtualBox 中创建了两个虚拟机,一个使用 Ubuntu 20.04.6 LTS Desktop,另一个使用 22.04.3 LTS Desktop。我下载了相同的 ISO,解压并解压了所有的 squashfs,就像以前一样到两个系统上。我在任一虚拟机中都没有收到任何警告。
因此,我当前的系统似乎存在问题,需要帮助进行故障排除。关于从哪里开始有什么想法吗?
我解决了这个问题。
我意识到 的父目录
iso/squashfs-root
中有一个 Git 存储库,并且iso/squashfs-root
没有添加到.gitignore文件中。因此,警告实际上来自 Git,而不是操作系统。所以我只是将此目录添加到.gitignore中,警告就消失了。