[arch-projects] [devtools] [PATCH] mkarchroot: Avoid binding cache dirs in the host mirror path
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> This is a workaround that should prevent the zombie mounts we've been seeing on brynhild that crept up when combining systemd's shared-by-default mounts, nested bind mounts and concurrent mkarchroots. So get rid of the nested bind mounts. A more proper fix would probably be to --make-slave every bind we're making. I've been looking into doing that along with using systemd-nspawn. Alas, nspawn currently seems to be interactive-use only, as it expects a terminal on STDIN and epoll-able STDOUT. --- mkarchroot.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mkarchroot.in b/mkarchroot.in index 5bcde76..519837a 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -75,6 +75,8 @@ fi host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -E 's#(.*/)extra/os/.*#\1$repo/os/$arch#') if echo "${host_mirror}" | grep -q 'file://'; then host_mirror_path=$(echo "${host_mirror}" | sed -E 's#file://(/.*)/\$repo/os/\$arch#\1#g') + # Remove cache dirs in host mirror path, those are handled specially to avoid additional binds + cache_dirs=( "${cache_dirs[@]/${host_mirror_path}*/}" ) fi # {{{ functions @@ -149,7 +151,12 @@ copy_hostconf () { cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf fi - sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i ${working_dir}/etc/pacman.conf + local conf_cache_dirs=( "${cache_dirs[@]}" ) + if [[ -n ${host_mirror_path} ]]; then + conf_cache_dirs+=( "${host_mirror_path}"/pool/{packages,community} ) + fi + + sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${conf_cache_dirs[@]})|" -i ${working_dir}/etc/pacman.conf } chroot_umount () { -- 1.7.12
On Sun, Sep 02, 2012 at 03:42:19AM +0200, Jan Alexander Steffens (heftig) wrote:
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
This is a workaround that should prevent the zombie mounts we've been seeing on brynhild that crept up when combining systemd's shared-by-default mounts, nested bind mounts and concurrent mkarchroots.
So get rid of the nested bind mounts.
A more proper fix would probably be to --make-slave every bind we're making. I've been looking into doing that along with using systemd-nspawn. Alas, nspawn currently seems to be interactive-use only, as it expects a terminal on STDIN and epoll-able STDOUT. --- mkarchroot.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mkarchroot.in b/mkarchroot.in index 5bcde76..519837a 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -75,6 +75,8 @@ fi host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -E 's#(.*/)extra/os/.*#\1$repo/os/$arch#') if echo "${host_mirror}" | grep -q 'file://'; then host_mirror_path=$(echo "${host_mirror}" | sed -E 's#file://(/.*)/\$repo/os/\$arch#\1#g') + # Remove cache dirs in host mirror path, those are handled specially to avoid additional binds + cache_dirs=( "${cache_dirs[@]/${host_mirror_path}*/}" ) fi
# {{{ functions @@ -149,7 +151,12 @@ copy_hostconf () { cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf fi
- sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i ${working_dir}/etc/pacman.conf + local conf_cache_dirs=( "${cache_dirs[@]}" ) + if [[ -n ${host_mirror_path} ]]; then + conf_cache_dirs+=( "${host_mirror_path}"/pool/{packages,community} ) + fi + + sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${conf_cache_dirs[@]})|" -i ${working_dir}/etc/pacman.conf
As I mentioned on IRC, you should be about to get rid of the echo -n hack by expanding conf_cache_dirs correctly as ${conf_cache_dirs[*]}.
}
chroot_umount () { -- 1.7.12
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> This is a workaround that should prevent the zombie mounts we've been seeing on brynhild that crept up when combining systemd's shared-by-default mounts, nested bind mounts and concurrent mkarchroots. So get rid of the nested bind mounts. A more proper fix would probably be to --make-slave every bind we're making. I've been looking into doing that along with using systemd-nspawn. Alas, nspawn currently seems to be interactive-use only, as it expects a terminal on STDIN and epoll-able STDOUT. --- mkarchroot.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mkarchroot.in b/mkarchroot.in index 5bcde76..f67f333 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -75,6 +75,8 @@ fi host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -E 's#(.*/)extra/os/.*#\1$repo/os/$arch#') if echo "${host_mirror}" | grep -q 'file://'; then host_mirror_path=$(echo "${host_mirror}" | sed -E 's#file://(/.*)/\$repo/os/\$arch#\1#g') + # Remove cache dirs in host mirror path, those are handled specially to avoid additional binds + cache_dirs=( "${cache_dirs[@]/${host_mirror_path}*/}" ) fi # {{{ functions @@ -149,7 +151,12 @@ copy_hostconf () { cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf fi - sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i ${working_dir}/etc/pacman.conf + local conf_cache_dirs=( "${cache_dirs[@]}" ) + if [[ -n ${host_mirror_path} ]]; then + conf_cache_dirs+=( "${host_mirror_path}"/pool/{packages,community} ) + fi + + sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${conf_cache_dirs[*]}|" -i ${working_dir}/etc/pacman.conf } chroot_umount () { -- 1.7.12
participants (2)
-
Dave Reisner
-
Jan Alexander Steffens (heftig)