>>>>> Ivan Shmakov <
iv...@gray.siamics.net> writes:
[Removing news:alt.os.linux.debian, as I believe that the
solutions below are applicable to the other systems based on
Linux just as well.]
[…]
> Another problem
[… with Debian's kexec-tools package, which makes the system
perform a “shortened” reboot, completely bypassing BIOS.]
> is that with the kernel mode setting feature being active, the screen
> gets garbled, as the re-initializing kernel assumes a VGA text mode,
> while it's in fact a graphics mode. Thus, the initial (prior to the
> loading of the respective framebuffer module) kernel messages
> couldn't be read.
So far, I've found two ways to disable the Kernel mode-setting
feature, enabled by default in recent kernels shipped with
Debian (from 6.0 “Squeeze” onwards.)
These are outlined below.
Background
The Kernel mode-setting feature, somewhat recently added to the
Linux kernel, is intended to finally supersede the user-space
video adapter initialization (as historically done by an X.org
server), by the one residing in kernel-space.
The advantages of such a move are, firstly, that the kernel
becomes fully aware of the video mode changes, and is thus able
to save and restore the video mode when the system is suspended
or goes into hibernation. Secondly, it becomes possible to
switch to the graphics mode early in the boot process and never
change it afterwards.
The disadvantages are that the virtual terminals emulated in the
graphics mode are more flexible, and thus require additional
configuration. In particular, while the VGA text modes (as well
as the EGA and CGA ones) allow 8-pixel wide characters
(sometimes enlarged to 9-pixel wide by the video adapter itself)
exclusively, and are by default programmed to the 640-pixels
width text mode (thus giving the familiar 80-column text mode,
which is conventionally used since the age of teletypes), the
graphics mode selected by the KMS feature has typically much
higher resolution, resulting in, when using the same 8-pixel
wide font, in barely readable font.
Also, I haven't checked it as of yet, but I presume that the KMS
feature relies on the EDID [1] information available from the
modern video displays through the video adapter.
This information, however, may not be available if using either
a legacy hardware, or a Keyboard-Video-Mouse (KVM) switch, thus
resulting in an unsuitable video mode being selected. It could
be especially unfortunate if using a LCD display having an
unaligned native resolution (such as 1280x1024 LCD vs. the
1024x768 KMS default.)
Moreover, I know of no tools to change the video mode once the
KMS-supporting kernel module is initialized, while the existing
tools (such as SVGATextMode(8), vbetool(8), and fbset(1))
preasumably won't work with KMS.
The disadvantages stated above have provoked me to search for a
way to disable KMS entirely.
[1]
http://en.wikipedia.org/wiki/EDID
Using a module option
The first one is to pass an appropriate option to the kernel's
module in charge. The option is modeset=0, and it could be
specified via either as a kernel command line argument (as:
MODULE.modeset=0), or a /etc/modprobe.d/ .conf file.
The modules supporting such an option (for the kernel shipped
with a recent Debian stable) are: i915, nouveau, radeon; as per
the following Shell code:
$ uname -r
2.6.32-5-amd64
$ cat < kernel-gpu-modeset.sh
#!/bin/bash
if [ $# -le 0 ] ; then
set -- /lib/modules/"$(uname -r)"/kernel/drivers/gpu/
fi
find -- "$@" -type f -name \*.ko \
| while read f ; do
/sbin/modinfo "$f" | grep -qF -- modeset: \
|| continue
printf %s\\n "$(basename "$f" .ko)"
done
$ bash kernel-gpu-modeset.sh | fmt -w72
i915 nouveau radeon
$
An example /boot/grub/grub.cfg line (tested) may be like:
linux /vmlinuz-2.6.32-5-amd64 root=/dev/mapper/vgsys-lvroot ro i915.modeset=0
(But please note that Debian's grub.cfg is autogenerated, and
such a kernel command line argument should instead be added to
/etc/default/grub.)
An example /etc/modprobe.d/disable-kms-radeon.conf (untested)
could then be:
options radeon modeset=0
Using blacklist
An alternative solution is to blacklist all the GPU drivers
shipped with the kernel. A corresponding /etc/modprobe.d/ file
could easily be generated with the following Shell code:
#!/bin/bash
find /lib/modules/2.6.32-5-amd64/kernel/drivers/gpu/ \
-type f -name \*.ko -printf %f\\n \
| sed -e '/\(.*\)\.ko$/!d; s//blacklist \1/' \
| LC_ALL=C sort -u
This effectively prevents the kernel (modprobe(8)? udev(7)?)
module autoloading mechanism from ever using these modules,
unless required to fulfil a dependency of some other module. As
a (wanted) side effect, KMS is also disabled.
Conclusion
Please note that both of the solutions are “fragile”, in the
sense that should the kernel upgrade bring into one's system a
module suitable for one's video adapter, the KMS will be back.
Thus, it's advisable to check if the module list has changed,
and update the blacklist (or module options) as necessary, on
each major kernel upgrade.
There're also some rumors that KMS may at one time become
necessary for running the X.org X window server. I could only
hope that the VESA driver (which I'm proud to use) will not be
removed from the distribution.
That being said, I still believe that for certain systems, such
as the servers which only occasionally get connected to a video
display (for maintenance purposes), the disadvantages of the
Kernel mode-setting could easily outweight its advantages.
This concludes my quest for the solution of the “KMS problem”
[2, 3].
[2]
news:86ehzjv...@gray.siamics.net
[3]
news:8662mtx...@gray.siamics.net (Gmane)
> Is there a way to force switching to a text mode either before
> reboot, or at the early stage of kernel's initialization?
It's my understanding that the vga= kernel command line option
(as in: vga=3, which was suggested to solve the issue) requires
switching to the (IA-32, AMD64) real mode, and thus isn't
available when using either kexec(8) or GRUB 2.
The solution is still sought.