[lxc-devel] improving compatibility with RHEL 7.4 in templates/lxc-centos.in

Christian Brauner christian.brauner at mailbox.org
Wed Feb 7 10:55:00 UTC 2018


On Wed, Feb 07, 2018 at 10:43:00AM +0100, Christian Brauner wrote:
> Hey,
> 
> On Wed, Feb 07, 2018 at 09:26:47AM +0100, Harald Dunkel wrote:
> > Hi folks,
> > 
> > attached you can find a patch for the lxc-centos template
> > script, making it more compatible with RHEL 7.4.
> > 
> > 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 RHEL6, CentOS 6 and 7 as well. I did
> > not verify earlier CentOS or RHEL releases.
> > 
> > Would you mind to include it into git for a future lxc release
> > (for stable-2.0, stable-2.1 and master, please)?
> > 
> > 
> > Thanx in advance
> > Harri
> 
> > Patch for templates/lxc-centos.in, making it more compatible with RHEL 7.4
> > 
> > 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 <harald.dunkel at aixigo.de>
> 
> I'll grab the patch and apply it to master and stable once I've taken a
> look.
> 
> Thanks!
> Christian
> 
> > 
> > 
> > Index: lxc-2.0.9/templates/lxc-centos.in
> > ===================================================================
> > --- lxc-2.0.9.orig/templates/lxc-centos.in
> > +++ lxc-2.0.9/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 
> 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

Hey,

Applied in
https://github.com/lxc/lxc/commit/ff5976cd546774dacdcc5ae75dabcf440af840bb

Thanks!
Christian


More information about the lxc-devel mailing list