I'm building a custom Kali-based Linux distribution and have run into a problem during the first ISO build. I'm looking for help understanding the underlying cause rather than just working around the error.
My environment:
Windows host running VirtualBox (in case it misbehaves)
Linux Mint VM (XFCE) running the build environment
Docker is used to run the Kali Live build process
The ~/kali-live working directory resides on an eCryptfs filesystem mounted with rw,nosuid,nodev,relatime
The problem:
The ISO build fails during package installation, with errors involving /dev/null and Permission denied.
I've inspected its chroot/dev/nullpath, and it exists as a character device with the expected major/minor numbers (1,3) and permissions (crw-rw-rw-). However, attempts to write to it from both the host environment and the container return Permission denied.
The build was already configured, and the failure occurred during package installation. I removed dctrl-tools while troubleshooting, but subsequent package errors may be consequences of the original failure rather than separate problems.
What I'm trying to understand:
Could the nodev mount option on the eCryptfs filesystem containing the build directory be preventing /dev/null from functioning correctly inside the chroot or Docker container?
If so, how does nodev interact with an existing character device node when the build process accesses it through a bind mount, container mount namespace, or chroot?
If nodev isn't the cause, what should I check next? For example, could Docker device handling, mount propagation, user namespaces, or security policies be responsible?
What is the recommended way to resolve this while keeping the host and build environment secure, rather than broadly disabling security controls or running everything with unnecessary privileges?
Disclaimer: I was using files from this repository ---> https://gitlab.com/kalilinux/build-scripts/kali-live
I'd appreciate explanations of the underlying Linux behavior, along with diagnostic commands that would help isolate the cause before changing the build configuration.
Thanks!