From: Christian Brauner Date: Wed, 7 Feb 2018 10:39:19 +0000 (+0100) Subject: templates: CentOS fixes X-Git-Tag: lxc-2.0.10~349 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a30b05ac88a4d8757b3867f064c52fcbc0e8080a;p=thirdparty%2Flxc.git templates: CentOS fixes Issues fixed: - lxc-centos died about a missing /run directory - lxc-centos complained about some config files it couldn't modify - the new container got stuck at startup time for a minute (literally), waiting for systemd-remount-fs startup script Of course it still works for RHEL 6, CentOS 6 and 7 as well. I did not verify earlier CentOS or RHEL releases. Signed-off-by: Harald Dunkel Signed-off-by: Christian Brauner --- diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in index fc2da1937..949d57674 100644 --- a/templates/lxc-centos.in +++ b/templates/lxc-centos.in @@ -351,7 +351,7 @@ EOF # prevent mingetty from calling vhangup(2) since it fails with userns. # Same issue as oracle template: prevent mingetty from calling vhangup(2) # commit 2e83f7201c5d402478b9849f0a85c62d5b9f1589. - sed -i 's|mingetty|mingetty --nohangup|' $rootfs_path/etc/init/tty.conf + test -f $rootfs_path/etc/init/tty.conf && sed -i 's|mingetty|mingetty --nohangup|' $rootfs_path/etc/init/tty.conf if [ ${root_display_password} = "yes" ] then @@ -381,13 +381,18 @@ EOF configure_centos_init() { - sed -i 's|.sbin.start_udev||' ${rootfs_path}/etc/rc.sysinit - sed -i 's|.sbin.start_udev||' ${rootfs_path}/etc/rc.d/rc.sysinit + test -f ${rootfs_path}/etc/rc.sysinit && sed -i 's|.sbin.start_udev||' ${rootfs_path}/etc/rc.sysinit + test -f ${rootfs_path}/etc/rc.d/rc.sysinit && sed -i 's|.sbin.start_udev||' ${rootfs_path}/etc/rc.d/rc.sysinit if [ "$release" = "6" ]; then chroot ${rootfs_path} chkconfig udev-post off fi chroot ${rootfs_path} chkconfig network on + if [ "$release" = "7" ]; then + # don't wait for the timeout + chroot ${rootfs_path} chkconfig systemd-remount-fs off + fi + if [ -d ${rootfs_path}/etc/init ] then # This is to make upstart honor SIGPWR @@ -462,6 +467,9 @@ EOF force_mknod 666 $INSTALL_ROOT/dev/null c 1 3 force_mknod 666 $INSTALL_ROOT/dev/urandom c 1 9 + # create /run directory, just in case it is missing (e.g. RHEL7) + mkdir -p $INSTALL_ROOT/run + $YUM install $PKG_LIST # create symlink for /var/run -> ../run