[lxc-devel] [lxc/master] Unable to login via console in OL7.2
thtanaka on Github
lxc-bot at linuxcontainers.org
Thu Jun 9 21:31:56 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 507 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160609/828ab271/attachment.bin>
-------------- next part --------------
From 6efaa00c7f550fd7ac311d0f4b25e0aeda4f2d55 Mon Sep 17 00:00:00 2001
From: Thomas Tanaka <thomas.tanaka at oracle.com>
Date: Thu, 9 Jun 2016 13:41:02 -0700
Subject: [PATCH] Unable to login via console in OL7.2
There is container-getty.service with OL7.2 systemd, it
is also used for managing the getty service, use that
instead and not manually create it.
Signed-off-by: Thomas Tanaka <thomas.tanaka at oracle.com>
---
templates/lxc-oracle.in | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
index 00af55d..eb01ecb 100644
--- a/templates/lxc-oracle.in
+++ b/templates/lxc-oracle.in
@@ -145,21 +145,25 @@ EOF
# OL7 has systemd, no rc.sysinit
if [ $container_release_major = "7" ]; then
- # from mhw in the fedora template: We do need to disable the
- # "ConditionalPathExists=/dev/tty0" line or no gettys are started on
- # the ttys in the container. Lets do it in an override copy of the
- # service so it can still pass rpm verifies and not be automatically
- # updated by a new systemd version.
- sed -e 's/^ConditionPathExists=/#LXC ConditionPathExists=/' \
- < $container_rootfs/usr/lib/systemd/system/getty\@.service \
- > $container_rootfs/etc/systemd/system/getty\@.service
- # Setup getty service on the 4 ttys we are going to allow in the
- # default config. Number should match lxc.tty
- ( cd $container_rootfs/etc/systemd/system/getty.target.wants
- for i in 1 2 3 4 ; do ln -sf ../getty\@.service getty at tty${i}.service; done )
- # We only want to spawn a getty on /dev/console in lxc, libvirt-lxc
- # symlinks /dev/console to /dev/tty1
- sed -i '/Before=getty.target/a ConditionVirtualization=lxc' $container_rootfs/usr/lib/systemd/system/console-getty.service
+ # with newer systemd (OL7.2), getty service include container-getty.service
+ # let that be the one who manage the getty service instead
+ if [ ! -f $container_rootfs/usr/lib/systemd/system/container-getty at .service ]; then
+ # from mhw in the fedora template: We do need to disable the
+ # "ConditionalPathExists=/dev/tty0" line or no gettys are started on
+ # the ttys in the container. Lets do it in an override copy of the
+ # service so it can still pass rpm verifies and not be automatically
+ # updated by a new systemd version.
+ sed -e 's/^ConditionPathExists=/#LXC ConditionPathExists=/' \
+ < $container_rootfs/usr/lib/systemd/system/getty\@.service \
+ > $container_rootfs/etc/systemd/system/getty\@.service
+ # Setup getty service on the 4 ttys we are going to allow in the
+ # default config. Number should match lxc.tty
+ ( cd $container_rootfs/etc/systemd/system/getty.target.wants
+ for i in 1 2 3 4 ; do ln -sf ../getty\@.service getty at tty${i}.service; done )
+ # We only want to spawn a getty on /dev/console in lxc, libvirt-lxc
+ # symlinks /dev/console to /dev/tty1
+ sed -i '/Before=getty.target/a ConditionVirtualization=lxc' $container_rootfs/usr/lib/systemd/system/console-getty.service
+ fi
# disable some systemd services, set default boot, sigpwr target
rm -f $container_rootfs/usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service
More information about the lxc-devel
mailing list