Skip to content

Commit

Permalink
Cleanup remaining Xorg and VNC references and dead code
Browse files Browse the repository at this point in the history
After the main PR series that turned Anaconda into a native Wayland
application and switched from VNC to RDP fro remote access, there were
still some leftovers here and there.

So lets address those - adjust various references in doc strings to
correctly mention Wayland and RDP. And also drop various bits of code
that are no longer needed.

Lastly, drop a few Anaconda boot options that no longer work in the
Wayland world:

- xdriver
- usefbx
- vnc
- vncconnect
- vncpassword

NOTE: Even with Anaconda running natively on a Wayland compositor,
keyboard layouts are still called X layouts. This is the correct,
as Wayland is still using the keyboard layout format introduced by
the X server.

Resolves: RHEL-41219
  • Loading branch information
M4rtinK committed Jul 24, 2024
1 parent d331ba0 commit ee14273
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 197 deletions.
18 changes: 0 additions & 18 deletions anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,6 @@ def setup_environment():
if "EDITOR" not in os.environ and os.path.isfile("/etc/profile.d/nano-default-editor.sh"):
os.environ["EDITOR"] = "/usr/bin/nano"


def warn_on_deprecated_options(opts, log):
"""Check if deprecated options have been used & log a warning."""

if opts.vnc:
log.warning("The vnc option has been deprecated, use the rdp and "
"related options instead.")
if opts.vncconnect:
log.warning("The vncconnect option has been deprecated, use the rdp and "
"related options instead.")
if opts.vncpassword:
log.warning("The vncpassword option has been deprecated, use the rdp and "
"related options instead.")


if __name__ == "__main__":
# check if the CLI help is requested and return it at once,
# without importing random stuff and spamming stdout
Expand Down Expand Up @@ -263,9 +248,6 @@ def warn_on_deprecated_options(opts, log):
stdout_log.warning("All Anaconda kernel boot arguments are now required to use "
"'inst.' prefix!")

# log warning when deprecated options are used
warn_on_deprecated_options(opts, log)

# print errors encountered during boot
startup_utils.print_dracut_errors(stdout_log)

Expand Down
3 changes: 1 addition & 2 deletions anaconda.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Requires: python3-pid
Requires: crypto-policies
Requires: /usr/bin/update-crypto-policies

# required because of the rescue mode and VNC question
# required because of the rescue mode and RDP question
Requires: anaconda-tui = %{version}-%{release}

# Make sure we get the en locale one way or another
Expand Down Expand Up @@ -251,7 +251,6 @@ Requires: zram-generator
# needed for proper driver disk support - if RPMs must be installed, a repo is needed
Requires: createrepo_c
# Display stuff moved from lorax templates
Requires: dbus-x11
Requires: gsettings-desktop-schemas
Requires: nm-connection-editor
Requires: librsvg2
Expand Down
26 changes: 1 addition & 25 deletions data/anaconda_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,8 @@ Run in live installation mode.
resolution
Run GUI installer in the resolution specified, "1024x768" for example.

usefbx
Use the framebuffer X driver instead of attempting to use a hardware-specific one.

vnc
Enable VNC-based installation. You will need to connect to the machine using a VNC client application.
A VNC install implies that the installed system will boot up in runlevel 3 instead of to the graphical
login screen. The VNC session will be shared. Consider setting a VNC password using the vncpassword
option. This option is deprecated and will be removed in future releases. Use rdp and related options
instead.

vncconnect
Once installation is up and running, connect to the VNC client named HOST, and optionally use port PORT.
This option is deprecated and will be removed in future releases.

vncpassword
Enable a password for the VNC connection. This will prevent someone from inadvertently connecting
to the vnc-based installation. Requires the VNC option to be specified as well. If you have specified
vncconnect the PASSWORD will not be used unless connection to host is not possible. Please note that
the password needs to be 6 to 8 characters long (limitation of the VNC protocol).This option is deprecated
and will be removed in future releases. Use rdp and related options instead.

xdriver
Use DRIVER as the X driver to use during installation as well as on the installed system.

xtimeout
Specify the timeout in seconds for starting X server.
Specify the timeout in seconds for starting X server or Wayland compositor.

rdp
Enable Remote Desktop Protocol-controlled installation. You will need to connect to the machine using an RDP
Expand Down
3 changes: 0 additions & 3 deletions data/liveinst/liveinst
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ fi
# Process cmdline args
for opt in $(cat /proc/cmdline) "$@"; do
case $opt in
xdriver=*)
ANACONDA="$ANACONDA --$opt"
;;
updates=*)
UPDATES="${opt#updates=}"
;;
Expand Down
5 changes: 5 additions & 0 deletions docs/boot-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ inst.xdriver
Specify the X driver that should be used during installation and on the
installed system.

This boot options is deprecated and has no effect.

.. inst.usefbx
inst.usefbx
Expand All @@ -599,6 +601,9 @@ Use the framebuffer X driver (``fbdev``) rather than a hardware-specific driver.

Equivalent to ``inst.xdriver=fbdev``.


This boot options is deprecated and has no effect.

.. inst.xtimeout:
inst.xtimeout
Expand Down
2 changes: 1 addition & 1 deletion docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Anaconda is a fairly sophisticated installer. It supports installation from
local and remote sources such as CDs and DVDs, images stored on a hard drive,
NFS, HTTP, and FTP. Installation can be scripted with kickstart to provide a
fully unattended installation that can be duplicated on scores of machines. It
can also be run over VNC on headless machines. A variety of advanced storage
can also be run over RDP on headless machines. A variety of advanced storage
devices including LVM, RAID, iSCSI, and multipath are supported from the
partitioning program. Anaconda provides advanced debugging features such as
remote logging, access to the python interactive debugger, and remote saving of
Expand Down
6 changes: 3 additions & 3 deletions dracut/parse-anaconda-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ if updates=$(getarg inst.updates); then
fi
fi

# for vnc bring network up in initramfs so that cmdline configuration is used
check_removed_no_inst_arg "vnc" "inst.vnc"
getargbool 0 inst.vnc && warn "anaconda requiring network for vnc" && set_neednet
# for rdp bring network up in initramfs so that cmdline configuration is used
check_removed_no_inst_arg "rdp" "inst.rdp"
getargbool 0 inst.rdp && warn "anaconda requiring network for RDP" && set_neednet

# Driver Update Disk
check_removed_no_inst_arg "dd" "inst.dd"
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda-eject.sh"

# VNC questions
# RDP questions
USERDP = N_("Use graphical mode via Remote Desktop Protocol")
USETEXT = N_("Use text mode")

Expand Down
98 changes: 1 addition & 97 deletions pyanaconda/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@

from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.core.path import make_directories, open_with_perm, join_paths
from pyanaconda.core.process_watchers import WatchProcesses
from pyanaconda.core.constants import DRACUT_SHUTDOWN_EJECT, \
IPMI_ABORTED, X_TIMEOUT, PACKAGES_LIST_FILE
IPMI_ABORTED, PACKAGES_LIST_FILE
from pyanaconda.core.live_user import get_live_user
from pyanaconda.errors import RemovedModuleError

Expand Down Expand Up @@ -165,101 +164,6 @@ def preexec():
return partsubp(preexec_fn=preexec)


class X11Status:
"""Status of Xorg launch.
Values of an instance can be modified from the handler functions.
"""
def __init__(self):
self.started = False
self.timed_out = False

def needs_waiting(self):
return not (self.started or self.timed_out)


def startX(argv, output_redirect=None, timeout=X_TIMEOUT):
""" Start X and return once X is ready to accept connections.
X11, if SIGUSR1 is set to SIG_IGN, will send SIGUSR1 to the parent
process once it is ready to accept client connections. This method
sets that up and waits for the signal or bombs out if nothing happens
for a minute. The process will also be added to the list of watched
processes.
:param argv: The command line to run, as a list
:param output_redirect: file or file descriptor to redirect stdout and stderr to
:param timeout: Number of seconds to timing out.
"""
x11_status = X11Status()

# Handle successful start before timeout
def sigusr1_success_handler(num, frame):
log.debug("X server has signalled a successful start.")
x11_status.started = True

# Fail after, let's say a minute, in case something weird happens
# and we don't receive SIGUSR1
def sigalrm_handler(num, frame):
# Check that it didn't make it under the wire
if x11_status.started:
return
x11_status.timed_out = True
log.error("Timeout trying to start %s", argv[0])

# Handle delayed start after timeout
def sigusr1_too_late_handler(num, frame):
if x11_status.timed_out:
log.debug("SIGUSR1 received after X server timeout. Switching back to tty1. "
"SIGUSR1 now again initiates test of exception reporting.")
signal.signal(signal.SIGUSR1, old_sigusr1_handler)

# preexec_fn to add the SIGUSR1 handler in the child we are starting
# see man page XServer(1), section "signals"
def sigusr1_preexec():
signal.signal(signal.SIGUSR1, signal.SIG_IGN)

old_sigalrm_handler = None
old_sigusr1_handler = None
childproc = None
try:
old_sigusr1_handler = signal.signal(signal.SIGUSR1, sigusr1_success_handler)
old_sigalrm_handler = signal.signal(signal.SIGALRM, sigalrm_handler)

# Start the timer
log.debug("Setting timeout %s seconds for starting X.", timeout)
signal.alarm(timeout)

childproc = startProgram(argv, stdout=output_redirect, stderr=output_redirect,
preexec_fn=sigusr1_preexec)
WatchProcesses.watch_process(childproc, argv[0])

# Wait for SIGUSR1 or SIGALRM
while x11_status.needs_waiting():
signal.pause()

finally:
# Stop the timer
signal.alarm(0)
signal.signal(signal.SIGALRM, old_sigalrm_handler)

# Handle outcome of X start attempt
if x11_status.started:
signal.signal(signal.SIGUSR1, old_sigusr1_handler)
elif x11_status.timed_out:
signal.signal(signal.SIGUSR1, sigusr1_too_late_handler)
# Kill Xorg because from now on we will not use it. It will exit only after sending
# the signal, but at least we don't have to track that.
WatchProcesses.unwatch_process(childproc)
childproc.terminate()
log.debug("Exception handler test suspended to prevent accidental activation by "
"delayed Xorg start. Next SIGUSR1 will be handled as delayed Xorg start.")
# Raise an exception to notify the caller that things went wrong. This affects
# particularly pyanaconda.display.do_startup_wl_actions(), where the window manager
# is started immediately after this. The WM would just wait forever.
raise TimeoutError("Timeout trying to start %s" % argv[0])


def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None,
log_output=True, binary_output=False, filter_stderr=False,
do_preexec=True, env_add=None, user=None):
Expand Down
36 changes: 8 additions & 28 deletions pyanaconda/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def start_spice_vd_agent():
# RDP

def ask_rd_question(anaconda, grd_server, message):
""" Ask the user if TUI or GUI-over-VNC should be started.
""" Ask the user if TUI or GUI-over-RDP should be started.
:param anaconda: instance of the Anaconda class
:param grd_server: instance of the GRD server object
Expand Down Expand Up @@ -189,7 +189,7 @@ def check_rd_can_be_started(anaconda):
# disable remote desktop question if we don't have network
network_proxy = NETWORK.get_proxy()
if not network_proxy.IsConnecting() and not network_proxy.Connected:
error_messages.append("Not asking for VNC because we don't have a network")
error_messages.append("Not asking for RDP mode because we don't have a network")
rd_startup_possible = False

# disable remote desktop question if we don't have GNOME remote desktop
Expand All @@ -201,13 +201,8 @@ def check_rd_can_be_started(anaconda):


def do_startup_wl_actions(timeout, headless=False, headless_resolution=None):
"""Start the window manager.
"""Start the Wayland compositor.
When window manager actually connects to the X server is unknowable, but
fortunately it doesn't matter. Wm does not need to be the first
connection to Xorg, and if anaconda starts up before wm, wm
will just take over and maximize the window and make everything right,
fingers crossed.
Add XDG_DATA_DIRS to the environment to pull in our overridden schema
files.
Expand Down Expand Up @@ -283,19 +278,6 @@ def set_resolution(runres):
log.error("The resolution was not set: %s", error)


def write_xdriver(driver, root=None):
"""Write the X driver."""
if root is None:
root = conf.target.system_root

if not os.path.isdir("%s/etc/X11" % (root,)):
os.makedirs("%s/etc/X11" % (root,), mode=0o755)

f = open("%s/etc/X11/xorg.conf" % (root,), 'w')
f.write('Section "Device"\n\tIdentifier "Videocard0"\n\tDriver "%s"\nEndSection\n' % driver)
f.close()


# general display startup
def setup_display(anaconda, options):
"""Setup the display for the installation environment.
Expand Down Expand Up @@ -333,9 +315,6 @@ def setup_display(anaconda, options):
# note if we have both set
rdp_credentials_sufficient = options.rdp_username and options.rdp_password

if options.xdriver:
write_xdriver(options.xdriver, root="/")

# check if GUI without WebUI
if anaconda.gui_mode and not anaconda.is_webui_supported:
mods = (tup[1] for tup in pkgutil.iter_modules(pyanaconda.ui.__path__, "pyanaconda.ui."))
Expand Down Expand Up @@ -411,17 +390,18 @@ def on_mutter_ready(observer):

if anaconda.tui_mode and anaconda.gui_startup_failed and flags.rd_question:

message = _("X was unable to start on your machine. Would you like to start VNC to connect to "
"this computer from another computer and perform a graphical installation or continue "
"with a text mode installation?")
message = _("Wayland was unable to start on your machine. Would you like to start "
"an RDP session to connect to this computer from another computer and "
"perform a graphical installation or continue with a text mode "
"installation?")
ask_rd_question(anaconda, grd_server, message)

# if they want us to use RDP do that now
if anaconda.gui_mode and flags.use_rd:
do_startup_wl_actions(xtimeout, headless=True, headless_resolution=options.runres)
grd_server.start_grd_rdp()

# with X running we can initialize the UI interface
# with Wayland running we can initialize the UI interface
anaconda.initialize_interface()

if anaconda.gui_startup_failed:
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def handleException(self, dump_info):

except (RuntimeError, ImportError, ValueError):
log.debug("Gtk cannot be initialized")
# X not running (Gtk cannot be initialized)
# Wayland not running (Gtk cannot be initialized)
if thread_manager.in_main_thread():
log.debug("In the main thread, running exception handler")
if issubclass(ty, NonInteractiveError) or not self._interactive:
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/startup_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def initialize_default_systemd_target(text_mode):
NOTE:
Installation controlled via VNC is considered to be
Installation controlled via RDP is considered to be
a text mode installation, as the installation run itself
is effectively headless.
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/ui/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def reapply_language(self):

class GraphicalUserInterface(UserInterface):
"""This is the standard GTK+ interface we try to steer everything to using.
It is suitable for use both directly and via VNC.
It is suitable for use both directly and via RDP.
"""
def __init__(self, storage, payload,
distributionText=get_distribution_text,
Expand Down
6 changes: 3 additions & 3 deletions pyanaconda/ui/gui/spokes/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def completed(self):

# Below are checks if we want users attention when the spoke wasn't confirmed (visited)

# Not an issue for VNC, since VNC keymaps are weird and more on the client side.
# Not an issue for RDP, since RDP keymaps are weird and more on the client side.
if flags.flags.use_rd:
return True

Expand Down Expand Up @@ -481,7 +481,7 @@ def _addLayout(self, store, name):
def _removeLayout(self, store, itr):
"""
Remove the layout specified by store iterator from the store and
X runtime configuration.
Wayland runtime configuration.
"""

Expand All @@ -491,7 +491,7 @@ def _refresh_switching_info(self):
switch_options = self._l12_module.LayoutSwitchOptions
if flags.flags.use_rd:
self._layoutSwitchLabel.set_text(_("Keyboard layouts are not "
"supported when using VNC.\n"
"supported when using RDP.\n"
"However the settings will be used "
"after the installation."))
elif switch_options:
Expand Down
Loading

0 comments on commit ee14273

Please sign in to comment.