Problem because of the race condition between chvt logind service and tty6 during installation of Red Hat Enterprise Linux 7.2 using kickstart?

Solution Verified - Updated -

Issue

  • Why does python %pre script execution fail and halt installation of Red Hat Enterprise Linux 7.2 ?
  • This works as expected with Red Hat Enterprise Linux 7.1 and 6.x whereas with Red Hat Enterprise Linux 7.2, it fails.
  • The following example %pre script halts installation.
%pre --interpreter /bin/python
import os
import sys
import re
import os.path
import time
import socket
import commands
import urllib2, base64, sys, json, base64
from pprint import pprint

os.system('exec < /dev/tty6 > /dev/tty6')
os.system('chvt 6')
os.system('clear')

fd = os.open("/dev/tty6", os.O_RDWR)
os.dup2(fd, 0)
os.dup2(fd, 1)
os.dup2(fd, 2)
sys.stdin = os.fdopen(0, "r")
sys.stdout = os.fdopen(1, "w")
sys.stderr = os.fdopen(2, "w")

os.system('clear')
print ""
print " Testing Dracut"
print " ----------------------------------------"
print ""
print " Enter anything when prompted"
print ""
print " You should never see the command prompt"
print ""
print " ----------------------------------------"
print ""
print ""

fd = open("/tmp/rhel-dracut-test-out","w")
userinput = raw_input(" Enter something: ")
fd.write(userinput + '\n')

userinput = raw_input(" Enter more: ")
fd.write(userinput + '\n')

userinput = raw_input(" Enter last one: ")
fd.write(userinput + '\n')
fd.close

userinput = raw_input(" \nPress enter to display the file:")

fd = open("/tmp/rhel-dracut-test-out","r")
lines = fd.read()
print lines
fd.close()


userinput = raw_input(" \nPress enter to return to tty1")

os.system('chvt 1')
os.system('exec < /dev/tty1 > /dev/tty1')

%end

Environment

  • Red Hat Enterprise Linux 7.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content