rpm-software-management / dnf-plugin-system-upgrade

A DNF plugin for system upgrades (moved to dnf-plugins-extras!)
GNU General Public License v2.0
24 stars 22 forks source link

Disable blanking #28

Closed keszybz closed 8 years ago

wgwoods commented 9 years ago

...I don't think your logic is right in 9fe9f47 - I'm almost certain I have seen this problem manifest on systems where plymouthd is alive and well.

Until someone has tested these patches and can vouch for the fact that they actually fix the problem in practice (@kparal, wanna give it a shot?) I'm probably not going to merge them.

kparal commented 8 years ago

I finally had time to test this properly. I have tested these two test cases:

  1. run system-upgrade with plymouth, but hit a keyboard arrow to switch from graphical splash to text console
  2. run system-upgrade while removing rhgb from the boot cmdline, therefore starting with the text console right away (plymouth was still installed, but I guess it was not running)

The patch as it is doesn't work for me well (it's still blanking). But I experimented with adjustments and I think I figured out what needs to be changed in order to have it working

kparal commented 8 years ago

The simplest patch which does what we want (works for me all the time and I've found no issues with it) seems to be this:

--- system_upgrade.py_orig  2015-11-11 11:52:56.774553749 +0100
+++ system_upgrade.py   2015-11-11 11:57:53.932622941 +0100
@@ -125,6 +125,14 @@
     if DNFVERSION < StrictVersion("1.1.0"):
         raise CliError(_("This plugin requires DNF 1.1.0 or later."))

+def disable_blanking():
+    try:
+        tty = open('/dev/tty0', 'wb')
+        tty.write(b'\33[9;0]')
+    except Exception as e:
+        print "Screen blanking can't be disabled: %s" % e
+        return
+
 # --- State object - for tracking upgrade state between runs ------------------

 # DNF-INTEGRATION-NOTE: basically the same thing as dnf.persistor.JSONDB
@@ -550,6 +558,9 @@
         Plymouth.progress(0)
         Plymouth.message(_("Starting system upgrade. This will take a while."))

+        # disable screen blanking
+        disable_blanking()
+
         # NOTE: We *assume* that depsolving here will yield the same
         # transaction as it did during the download, but we aren't doing
         # anything to *ensure* that; if the metadata changed, or if depsolving

It would be nice to change the print statement into something that will be visible in journal, so that it can be inspected later, but I don't know how to do that.

keszybz commented 8 years ago

You're right — my version could not work. It's no wonder it wasn't breaking anything — it wasn't doing anything ;) I only don't understand why it seemed to disable blanking, maybe the timeout was longer than I tested (about 10 minutes).

Can you turn this into a new pull request? But change print to print(), so it works under python3?

kparal commented 8 years ago

10 minutes should exactly be the timeout. Will post a new PR.

keszybz commented 8 years ago

I waited about 12 according to my wall clock, so blanking must have been disabled for a different reason. Strange.

kparal commented 8 years ago

Either you pressed a key accidentally, or maybe you tried a system without plymouth at all (in that case it might have worked)? Posted #41.

wgwoods commented 7 years ago

NOTE: this PR was not merged; it was obsoleted by #41. Go there for further discussion.