mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-06 14:13:17 +00:00
osbuilder: Include minimal set of device nodes in ubuntu initrd
When starting an initrd the kernel expects to find /dev/console in the initrd, so that it can connect it as stdin/stdout/stderr to the /init process. If the device node is missing the kernel will complain that it was unable to open an initial console. If kata-agent is the initrd init process, it will also result in log messages not being logged to console and thus not forwarded to host syslog. Add a set of standard device nodes for completeness, so that console logging works. To do that we install the makedev packge which provides a MAKEDEV helper that knows the major/minor numbers. Unfortunately the debian package tries to create devnodes from postinst, which can be suppressed if systemd-detect-virt is present. That's why we create a small dummy script that matches what systemd-detect-virt would output (anything is enough to suppress mknod). Fixes: #6261 Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
parent
86501d5f6f
commit
76e926453a
@ -6,6 +6,8 @@ ARG IMAGE_REGISTRY=docker.io
|
|||||||
FROM ${IMAGE_REGISTRY}/ubuntu:@OS_VERSION@
|
FROM ${IMAGE_REGISTRY}/ubuntu:@OS_VERSION@
|
||||||
@SET_PROXY@
|
@SET_PROXY@
|
||||||
|
|
||||||
|
# makedev tries to mknod from postinst
|
||||||
|
RUN [ -x /usr/bin/systemd-detect-virt ] || ( echo "echo docker" >/usr/bin/systemd-detect-virt && chmod +x /usr/bin/systemd-detect-virt )
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
apt-get --no-install-recommends -y install \
|
apt-get --no-install-recommends -y install \
|
||||||
@ -20,6 +22,7 @@ RUN apt-get update && \
|
|||||||
echo "gcc-$gcc_arch-linux-gnu libc6-dev-$libc_arch-cross")) \
|
echo "gcc-$gcc_arch-linux-gnu libc6-dev-$libc_arch-cross")) \
|
||||||
git \
|
git \
|
||||||
make \
|
make \
|
||||||
|
makedev \
|
||||||
multistrap \
|
multistrap \
|
||||||
musl-tools \
|
musl-tools \
|
||||||
protobuf-compiler
|
protobuf-compiler
|
||||||
|
@ -34,4 +34,10 @@ EOF
|
|||||||
|
|
||||||
# Reduce image size and memory footprint by removing unnecessary files and directories.
|
# Reduce image size and memory footprint by removing unnecessary files and directories.
|
||||||
rm -rf $rootfs_dir/usr/share/{bash-completion,bug,doc,info,lintian,locale,man,menu,misc,pixmaps,terminfo,zsh}
|
rm -rf $rootfs_dir/usr/share/{bash-completion,bug,doc,info,lintian,locale,man,menu,misc,pixmaps,terminfo,zsh}
|
||||||
|
|
||||||
|
# Minimal set of device nodes needed when AGENT_INIT=yes so that the
|
||||||
|
# kernel can properly setup stdout/stdin/stderr for us
|
||||||
|
pushd $rootfs_dir/dev
|
||||||
|
MAKEDEV -v console tty ttyS null zero fd
|
||||||
|
popd
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user