Skip to content

Commit

Permalink
el8toel9: Warn about deprecated Xorg drivers
Browse files Browse the repository at this point in the history
Some Xorg drivers have been deprecated in favor of the "modesetting"
driver.

If Xorg is configured to use those drivers, it may not be able to work
properly after the upgrade.

Add a new actor to check in the journal whether such Xorg drivers are in
use and in that case, also warn if there are custom Xorg config options.

Known limitation: This actor checks the journal logs since the last
boot, meaning that if Xorg was started manually from a console or if the
system has been rebooted after a graphical Xorg session was used, the
actor will not be able to detect the use of deprecated drivers.

Signed-off-by: Olivier Fourdan <[email protected]>
  • Loading branch information
ofourdan committed May 5, 2023
1 parent d1a7170 commit 2d8c2e6
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from leapp import reporting
from leapp.actors import Actor
from leapp.libraries.actor.xorgdriverlib import was_xorg_driver_used, has_xorg_driver_config
from leapp.reporting import create_report, Report
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag


class CheckXorgDeprecatedDrivers(Actor):
"""
Warn if Xorg deprecated drivers are in use.
"""

name = 'check_xorg_deprecated_drivers'
consumes = ()
produces = (Report,)
tags = (ChecksPhaseTag, IPUWorkflowTag)

def process(self):
for driver in [ 'RADEON', 'ATI', 'AMDGPU', 'MACH64', 'intel', 'spiceqxl', 'qxl', 'NOUVEAU', 'NV', 'VESA' ]:
if was_xorg_driver_used(driver):
report_summary = ('Leapp has detected that the deprecated Xorg driver {} is used.'
'\n\n'
'Please uninstall the Xorg driver before upgrading to make sure you have a '
'graphical session after upgrading.')
create_report([
reporting.Title('Deprecated Xorg driver detected'),
reporting.Summary(report_summary.format(driver)),
reporting.Severity(reporting.Severity.MEDIUM),
reporting.Groups([reporting.Groups.DRIVERS]),
])

if has_xorg_driver_config(driver):
report_summary = ('Leapp has detected a custom configuration for the deprecated Xorg driver {}.'
'\n\n'
'Driver specific options will be ignored and have no effect without the driver.')
create_report([
reporting.Title('Deprecated Xorg driver detected'),
reporting.Summary(report_summary.format(driver)),
reporting.Severity(reporting.Severity.MEDIUM),
reporting.Groups([reporting.Groups.DRIVERS]),
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Helper functions
#

from leapp.libraries.stdlib import api, CalledProcessError, run

def was_xorg_driver_used(_driver=""):
"""
Determines whether a given Xorg driver has been used in the path month,
by checking the journalctl.
:param _driver: name of the driver to check
:return: True if the driver usage has been found.
:rtype: bool
"""
try:
run(['check_syslog_for_driver.sh', _driver])
except CalledProcessError:
api.current_logger().debug('Nothing about Xorg driver {} was found in journal.'.format(_driver))
return False
api.current_logger().debug('Found logs from driver {} in journal.'.format(_driver))
return True

def has_xorg_driver_config(_driver=""):
"""
Determines whether custom options for the the given Xorg driver has been
used in the path month, by checking the journalctl.
:param _driver: name of the driver to check
:return: True if custom options for the driver were found.
:rtype: bool
"""
try:
run(['check_syslog_for_driver_config.sh', _driver])
except CalledProcessError:
api.current_logger().debug('No custom options for Xorg driver {} were found in journal.'.format(_driver))
return False
api.current_logger().debug('Custom options for driver {} found in journal.'.format(_driver))
return True
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo Usage: $0 DRIVER
exit -1
fi

/usr/bin/journalctl /usr/libexec/Xorg -b 0 | \
/usr/bin/grep "DPI set to" | \
/usr/bin/grep -q -F $1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo Usage: $0 DRIVER
exit -1
fi

/usr/bin/journalctl /usr/libexec/Xorg -b 0 | \
/usr/bin/grep -q -F "(**) $1"

0 comments on commit 2d8c2e6

Please sign in to comment.