Skip to content

Commit 8409f45

Browse files
committed
Mount proc when needed
Using cp -a might lookup in proc/self/.. under certain conditions. Make sure to mount proc for config/function that might trigger this condition. This Fixes #2876
1 parent 5bfce21 commit 8409f45

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kiwi/config/functions.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export LC_ALL=C
2525
#======================================
2626
# Common Functions
2727
#--------------------------------------
28+
function mountProc {
29+
if ! mountpoint -q /proc; then
30+
mount -t proc proc /proc
31+
trap "umount /proc" EXIT
32+
fi
33+
}
34+
2835
function mountCgroups {
2936
mount -t tmpfs cgroup_root /sys/fs/cgroup
3037
for group in devices blkio cpuset pids; do
@@ -737,6 +744,7 @@ function baseCreateKernelTree {
737744
# /kernel-tree/ for stripping operations
738745
# ----
739746
echo "Creating copy of kernel tree for strip operations"
747+
mountProc
740748
mkdir -p /kernel-tree
741749
cp -a /lib/modules/* /kernel-tree/
742750
}
@@ -747,6 +755,7 @@ function baseSyncKernelTree {
747755
# version from /kernel-tree/.
748756
# ----
749757
echo "Replace kernel tree with downsized version"
758+
mountProc
750759
rm -rf /lib/modules/*
751760
cp -a /kernel-tree/* /lib/modules/
752761
rm -rf /kernel-tree
@@ -764,6 +773,7 @@ function baseFixupKernelModuleDependencies {
764773
local module_info
765774
local dependency
766775
local module_files
776+
mountProc
767777
for kernel_dir in /kernel-tree/*;do
768778
echo "Checking kernel dependencies for ${kernel_dir}"
769779
kernel_version=$(/usr/bin/basename "${kernel_dir}")

0 commit comments

Comments
 (0)