Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to reset the graphics adapter to textmode after it has been set to some sort of graphical mode by the kernel on bootup, and possibly used by an X server.

Is there any code to do this in the Kernel or the X Server?

I figure there must have been such code, because before the introduciton of KMS, the X server used to set the VGA adapter back to text mode when switching to a linux console (e.g. Ctrl+Alt+F1)

I also figure that this is highly adapter-specific. My graphics adapter is controlled by i915.

I've been looking at places in the X source code where I assumed the code would reside, but have been unable to find anything.

So the precise thing I am asking of you would be, in this priority,

  • A kernel interface that allows returning to textmode
  • An existing utility
  • An ugly hack that might involve directly writing to the kernel memory or invoking the VGA bios to do the initialization
  • Hints at where (version-wise, repository-wise and sourcefile-wise) in the pre-KMS X or kernel sources I might find such code

I have found a utility called restoretextmode, but all it did was crash my VGA adapter. It appears to come from ancient times, and not to be designed to handle these kinds of situations at all (but I might be in error).

For those of you who are curious why I require this functionality, it is related to running all kinds of low-level utilities such as memtest86 or a boot loader directly via kexec. These utilities require the graphics adapter to be in textmode.

share|improve this question
It should be enough to move out of runlevel 5 to runlevel 3 (or whatever runlevels your distribution uses). Or just boot into runlevel 3. – vonbrand Mar 6 '13 at 20:36
if you are talking simply about killing/not launching the X server, that won't do it. The modesetting is still done by the kernel at bootup, and changes the Linux console from 80x25 to something at the full resolution of the monitor. The proper boot option to avoid modesetting at all would be nomodeset. – mic_e Mar 6 '13 at 23:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.