From ee142738aa74693098a1fa0e4c178029e5d16b43 Mon Sep 17 00:00:00 2001 From: Martin Kolman Date: Thu, 20 Jun 2024 18:52:45 +0200 Subject: [PATCH] Cleanup remaining Xorg and VNC references and dead code 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 --- anaconda.py | 18 ---- anaconda.spec.in | 3 +- data/anaconda_options.txt | 26 +---- data/liveinst/liveinst | 3 - docs/boot-options.rst | 5 + docs/intro.rst | 2 +- dracut/parse-anaconda-options.sh | 6 +- pyanaconda/core/constants.py | 2 +- pyanaconda/core/util.py | 98 +------------------ pyanaconda/display.py | 36 ++----- pyanaconda/exception.py | 2 +- pyanaconda/startup_utils.py | 2 +- pyanaconda/ui/gui/__init__.py | 2 +- pyanaconda/ui/gui/spokes/keyboard.py | 6 +- pyanaconda/ui/tui/spokes/askrd.py | 4 +- tests/pylint/runpylint.py | 4 +- .../pyanaconda_tests/test_argparse.py | 16 +-- widgets/configure.ac | 2 +- 18 files changed, 40 insertions(+), 197 deletions(-) diff --git a/anaconda.py b/anaconda.py index 042f62eedb5..7b4ce94a8e4 100755 --- a/anaconda.py +++ b/anaconda.py @@ -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 @@ -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) diff --git a/anaconda.spec.in b/anaconda.spec.in index 00fa11723c5..9ed47a4e359 100644 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -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 @@ -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 diff --git a/data/anaconda_options.txt b/data/anaconda_options.txt index b82a8ed1c9e..c1cef37e72c 100644 --- a/data/anaconda_options.txt +++ b/data/anaconda_options.txt @@ -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 diff --git a/data/liveinst/liveinst b/data/liveinst/liveinst index a9ccedd362c..dadcd0f573f 100755 --- a/data/liveinst/liveinst +++ b/data/liveinst/liveinst @@ -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=}" ;; diff --git a/docs/boot-options.rst b/docs/boot-options.rst index d385ea43eab..79fab310fd6 100644 --- a/docs/boot-options.rst +++ b/docs/boot-options.rst @@ -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 @@ -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 diff --git a/docs/intro.rst b/docs/intro.rst index be1a2fed4a8..3c62e77d42c 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -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 diff --git a/dracut/parse-anaconda-options.sh b/dracut/parse-anaconda-options.sh index 3152ab57da7..935042f8aac 100755 --- a/dracut/parse-anaconda-options.sh +++ b/dracut/parse-anaconda-options.sh @@ -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" diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py index 1c676909411..5232e6d87d9 100644 --- a/pyanaconda/core/constants.py +++ b/pyanaconda/core/constants.py @@ -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") diff --git a/pyanaconda/core/util.py b/pyanaconda/core/util.py index 8d2a6d543ab..38adb92951b 100644 --- a/pyanaconda/core/util.py +++ b/pyanaconda/core/util.py @@ -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 @@ -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): diff --git a/pyanaconda/display.py b/pyanaconda/display.py index 46f2ee96c37..96f6142aa8d 100644 --- a/pyanaconda/display.py +++ b/pyanaconda/display.py @@ -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 @@ -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 @@ -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. @@ -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. @@ -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.")) @@ -411,9 +390,10 @@ 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 @@ -421,7 +401,7 @@ def on_mutter_ready(observer): 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: diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 28ee8c4aa56..87a43fc8a3c 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -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: diff --git a/pyanaconda/startup_utils.py b/pyanaconda/startup_utils.py index 8f46d090790..fc68f35ec41 100644 --- a/pyanaconda/startup_utils.py +++ b/pyanaconda/startup_utils.py @@ -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. diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index 520c9b942e9..930b6269255 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -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, diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py index 2f97bf80185..66efb407bf1 100644 --- a/pyanaconda/ui/gui/spokes/keyboard.py +++ b/pyanaconda/ui/gui/spokes/keyboard.py @@ -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 @@ -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. """ @@ -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: diff --git a/pyanaconda/ui/tui/spokes/askrd.py b/pyanaconda/ui/tui/spokes/askrd.py index f87131a8588..47bbc066a76 100644 --- a/pyanaconda/ui/tui/spokes/askrd.py +++ b/pyanaconda/ui/tui/spokes/askrd.py @@ -132,12 +132,12 @@ def input(self, args, key): return super().input(args, key) def apply(self): - self.data.vnc.enabled = self._use_rd + pass class RDPAuthSpoke(NormalTUISpoke): """ - .. inheritance-diagram:: VNCPassSpoke + .. inheritance-diagram:: RDPAuthSpoke :parts: 3 """ diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py index 39c52dc1096..3f3372cdb9f 100755 --- a/tests/pylint/runpylint.py +++ b/tests/pylint/runpylint.py @@ -103,10 +103,10 @@ def setup_environment(): # Don't try to connect to the accessibility socket. os.environ["NO_AT_BRIDGE"] = "1" - # Force the GDK backend to X11. Otherwise if no display can be found, Gdk + # Force the GDK backend to Wayland. Otherwise if no display can be found, Gdk # tries every backend type, which includes "broadway", which prints an error # and keeps changing the content of said error. - os.environ["GDK_BACKEND"] = "x11" + os.environ["GDK_BACKEND"] = "wayland" # Save analysis data in the pylint directory. os.environ["PYLINTHOME"] = builddir + "/tests/pylint/.pylint.d" diff --git a/tests/unit_tests/pyanaconda_tests/test_argparse.py b/tests/unit_tests/pyanaconda_tests/test_argparse.py index 0f32836f149..6079a891308 100644 --- a/tests/unit_tests/pyanaconda_tests/test_argparse.py +++ b/tests/unit_tests/pyanaconda_tests/test_argparse.py @@ -38,11 +38,11 @@ def test_without_inst_prefix(self): assert removed == ["stage2"] boot_cmdline = KernelArguments.from_string("stage2=http://cool.server.com/test " - "vnc") + "rdp") opts, removed = self._parseCmdline([], boot_cmdline=boot_cmdline) assert opts.stage2 is None - assert not opts.vnc - assert removed == ["stage2", "vnc"] + assert not opts.rdp_enabled + assert removed == ["stage2", "rdp"] def test_with_inst_prefix(self): boot_cmdline = KernelArguments.from_string("inst.stage2=http://cool.server.com/test") @@ -51,19 +51,19 @@ def test_with_inst_prefix(self): assert removed == [] boot_cmdline = KernelArguments.from_string("inst.stage2=http://cool.server.com/test " - "inst.vnc") + "inst.rdp") opts, removed = self._parseCmdline([], boot_cmdline=boot_cmdline) assert opts.stage2 == "http://cool.server.com/test" - assert opts.vnc + assert opts.rdp_enabled assert removed == [] def test_inst_prefix_mixed(self): boot_cmdline = KernelArguments.from_string("inst.stage2=http://cool.server.com/test " - "vnc") + "rdp") opts, removed = self._parseCmdline([], boot_cmdline=boot_cmdline) assert opts.stage2 == "http://cool.server.com/test" - assert not opts.vnc - assert removed == ["vnc"] + assert not opts.rdp_enabled + assert removed == ["rdp"] def test_display_mode(self): opts, _removed = self._parseCmdline(['--cmdline']) diff --git a/widgets/configure.ac b/widgets/configure.ac index 3f8f0bc1123..c38a3ae6db5 100644 --- a/widgets/configure.ac +++ b/widgets/configure.ac @@ -71,7 +71,7 @@ AS_IF([test "x$enable_glade" != "xno"], AC_CONFIG_FILES([glade/Makefile])], [AC_SUBST(GLADE_SUBDIR, "")]) -ANACONDA_PKG_CHECK_MODULES([GTK], [gtk+-x11-3.0 >= 3.11.3]) +ANACONDA_PKG_CHECK_MODULES([GTK], [gtk+-wayland-3.0 >= 3.11.3]) ANACONDA_PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 1.30]) # Use AM_PATH_GLIB_2_0 to define some extra glib-related variables