mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-12 06:38:11 +00:00
rootfs: Don't remove files from the rootfs by default
Recent PR #10732 moved the deletion of systemd files and units that were
deemed uneccessary by 02b3b3b977
from `image_builder.sh` to `rootfs.sh`.
This unfortunately broke `rootfs.sh centos` and `rootfs.sh -r` as used by
some other downstream users like fedora and RHEL, with the following error :
Warning FailedCreatePodSandBox 1s (x5 over 63s) kubelet
Failed to create pod sandbox: rpc error: code = Unknown
desc = CreateContainer failed: Establishing a D-Bus connection
Caused by:
0: I/O error: Connection reset by peer (os error 104)
1: Connection reset by peer (os error 104)
This is because the aforementioned distros use dbus-broker [1] that requires
systemd-journald to be present.
It is questionable that systemd units or files should be deemed unnecessary
for _all_ distros but this has been around since 2019. There's now also a
long-standing expectation from CI that `make rootfs && make image` does
remove these files.
In order to accomodate all the expectations, add a `-d` flag to `rootfs.sh`
to delete the systemd files and have `make rootfs` to use it.
[1] https://github.com/bus1/dbus-broker
Reported-by: Niteesh Dubey <niteesh@us.ibm.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
497ab9faaf
commit
734e7e8c54
@ -93,7 +93,7 @@ rootfs-%: $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX)
|
|||||||
|
|
||||||
.PRECIOUS: $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX)
|
.PRECIOUS: $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX)
|
||||||
$(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX):: rootfs-builder/%
|
$(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX):: rootfs-builder/%
|
||||||
$(call silent_run,Creating rootfs for "$*",$(ROOTFS_BUILDER) -o $(VERSION_COMMIT) -r $(ROOTFS_BUILD_DEST)/$*_rootfs $*)
|
$(call silent_run,Creating rootfs for "$*",$(ROOTFS_BUILDER) -o $(VERSION_COMMIT) -d -r $(ROOTFS_BUILD_DEST)/$*_rootfs $*)
|
||||||
@touch $@
|
@touch $@
|
||||||
|
|
||||||
# To generate a dracut rootfs, we first generate a dracut initrd and then
|
# To generate a dracut rootfs, we first generate a dracut initrd and then
|
||||||
|
@ -106,6 +106,8 @@ readonly -a systemd_files=(
|
|||||||
"systemd-tmpfiles-cleanup.timer"
|
"systemd-tmpfiles-cleanup.timer"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
typeset should_delete_unnecessary_files="no"
|
||||||
|
|
||||||
handle_error() {
|
handle_error() {
|
||||||
local exit_code="${?}"
|
local exit_code="${?}"
|
||||||
local line_number="${1:-}"
|
local line_number="${1:-}"
|
||||||
@ -158,6 +160,7 @@ $(get_distros | tr "\n" " ")
|
|||||||
Options:
|
Options:
|
||||||
-a <version> Specify the agent version. Overrides the AGENT_VERSION
|
-a <version> Specify the agent version. Overrides the AGENT_VERSION
|
||||||
environment variable.
|
environment variable.
|
||||||
|
-d Delete unnecessary systemd units and files
|
||||||
-h Show this help message.
|
-h Show this help message.
|
||||||
-l List the supported Linux distributions and exit immediately.
|
-l List the supported Linux distributions and exit immediately.
|
||||||
-o <version> Specify the version of osbuilder to embed in the rootfs
|
-o <version> Specify the version of osbuilder to embed in the rootfs
|
||||||
@ -818,7 +821,9 @@ EOF
|
|||||||
info "Create /etc/resolv.conf file in rootfs if not exist"
|
info "Create /etc/resolv.conf file in rootfs if not exist"
|
||||||
touch "$dns_file"
|
touch "$dns_file"
|
||||||
|
|
||||||
|
if [[ "${should_delete_unnecessary_files}" == "yes" ]]; then
|
||||||
delete_unnecessary_files
|
delete_unnecessary_files
|
||||||
|
fi
|
||||||
|
|
||||||
info "Creating summary file"
|
info "Creating summary file"
|
||||||
create_summary_file "${ROOTFS_DIR}"
|
create_summary_file "${ROOTFS_DIR}"
|
||||||
@ -828,10 +833,11 @@ parse_arguments()
|
|||||||
{
|
{
|
||||||
[ "$#" -eq 0 ] && usage && return 0
|
[ "$#" -eq 0 ] && usage && return 0
|
||||||
|
|
||||||
while getopts a:hlo:r:t: opt
|
while getopts a:dhlo:r:t: opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
a) AGENT_VERSION="${OPTARG}" ;;
|
a) AGENT_VERSION="${OPTARG}" ;;
|
||||||
|
d) should_delete_unnecessary_files="yes" ;;
|
||||||
h) usage ;;
|
h) usage ;;
|
||||||
l) get_distros | sort && exit 0;;
|
l) get_distros | sort && exit 0;;
|
||||||
o) OSBUILDER_VERSION="${OPTARG}" ;;
|
o) OSBUILDER_VERSION="${OPTARG}" ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user