I've been playing around with creating custom ISO images, and I've been successful. However, during the process I've come across a situation that I don't understand.
My system is Ubuntu 20.04.6 LTS Desktop.
Basically, after I run sudo unsquashfs ubuntu-server-minimal.squashfs
to a directory and then list the contents of the parent directory that the resulting squashfs-root directory is in, I get the following with a number of warnings:
$ 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
And this is where I'm confused. I know that squashfs-root is owned by root, but everyone has read access on it. Secondly, the number of warnings increase after creating various mounts necessary when chroot
-ing into squashfs-root such as the following:
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
Additionally, these warnings are now present with any command such as lsb_release -a
and 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
- If I
sudo su
, all warnings disappear. - After deleting squashfs-root with
sudo rm -fr squashfs-root
, all warnings disappear.
So what's going on here? Why am I getting these warnings? And how can they be suppressed? Am I doing something wrong with regards to unsquashfs
?
Update:
As a test, I created two VMs in VirtualBox, one with Ubuntu 20.04.6 LTS Desktop and another with 22.04.3 LTS Desktop. I downloaded the same ISO, extracted, and unsquashed the squashfs just as before to both systems. I do not get any warnings in either VM.
So it appears there's something amiss with my current system that I need help troubleshooting. Any ideas on where to start?
I solved the issue.
I realized that the parent directory of
iso/squashfs-root
had a Git Repository in it andiso/squashfs-root
was not added to the .gitignore file. As a result, the warnings were actually from Git and not the OS. So I simply added this directory to .gitignore and the warnings disappeared.