Bug 246158

Summary: Fallback to VGA, if X.org cannot be started
Product: [openSUSE] openSUSE 10.3 Reporter: Forgotten User --EoyBps8f <forgotten_--EoyBps8f>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: E-mail List <xorg-maintainer-bugs>
Severity: Enhancement    
Priority: P1 - Urgent CC: aceler, al4321, eich, fmfischer, jsrain, markgray+to-suse, ms
Version: Final   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on: 352020    
Bug Blocks:    
Attachments: xdm.diff

Description Forgotten User --EoyBps8f 2007-02-16 09:17:10 UTC
Many people have problems if they have to work on the CLI. So if they messed up X.org in a way that it does not start anymore, they are in trouble.

For those it would be very useful, if there was a standard xorg.conf that has a very basic, but always working configuartion. In case X.org fails to start, it should be started with that config-file instead of leaving the user at the CLI.
Comment 1 Stefan Dirsch 2007-02-16 10:21:52 UTC
It seems with CLI you mean command line interface.
Comment 2 Stefan Dirsch 2007-02-16 10:41:05 UTC
Such a fallback has been discussed often in the past. I'll attach an email by Egbert with a proposal.
Comment 3 Forgotten User --EoyBps8f 2007-02-16 10:42:48 UTC
Yes, that's what I meant. BTW, one does not even have to mess up xorg.conf, but e.g. buy a new graphics-card or update the kernel without having the binary driver's update-source in YaST.

Although there are some graphical-installers for binary-drivers, e.g. the Ati one, it is of no use, if there is no X running. So if X would at least come up in 640x480 after a kernel-update, the user could start the graphical-installer to install the driver.

Although it never happened to me, some people claimed that some online-update broke their xorg.conf, which would be a lot less severe, if the user would get a working X anyway in order to use a non-cli editor to have a look at the config-files or logs.
Comment 5 Stefan Dirsch 2007-03-13 15:07:46 UTC
*** Bug 254051 has been marked as a duplicate of this bug. ***
Comment 6 Benjamen Aceler 2007-03-13 15:44:53 UTC
Ok, what is my proposal.

First (simple):

1) add /etc/X11/xorg.conf.default with default failsafe configuration.
2) add some code to startx (or x, I don't know exactly) script, which will check if Xorg started (for example, with tail /var/log/Xorg.0.log | grep "no screens found") and, if not, starts X with /etc/X11/xorg.conf.default automatically.

Second (not so simple):

Write down a new application, which will catch when the Xorg fails, and ask user about 2 things: 1. Start GUI with failsafe mode (still /ect/X11/xorg.conf.default) or 2. Start GUI with last known good config (which will create automatically somewhere when Xorg starts normally).
Comment 7 Forgotten User --EoyBps8f 2007-06-10 16:56:10 UTC
Any progress on this issue? Does the "Failsafe" grub-entry use a failsafe xorg.conf which enables the user to use X?
Comment 8 Stefan Dirsch 2007-06-10 19:50:35 UTC
No.
Comment 9 Forgotten User --EoyBps8f 2007-06-10 20:26:58 UTC
Would it be possible to have Failsafe from the boot-menu use a failsafe xorg.conf then?, as a minimal implementation.

Could you please attach the email mentioned in comment #2?
Comment 10 Stefan Dirsch 2007-06-10 20:32:20 UTC
(In reply to comment #9)
> Could you please attach the email mentioned in comment #2?
No. This is only for internal discussion. 

Comment 11 Forgotten User --EoyBps8f 2007-06-10 20:53:49 UTC
Sorry if this sounds rude, but if there is no progress within 4 months and apparently not result either, what kind of discussion is going on internally? 

Where did it get stuck? Whether this is neccessary or not, or which way to go?

To the user it is not really important how this works, just that there is a working X no matter whether the issue was caused by changing the graphics-board, some online-update or a self-compiled kernel-module. I know that people, including me, do not like the argument, but Windows has been able to handle this issue for years and it really should not take another 8 months to get this into opensuse.
Comment 12 Matthias Hopf 2007-06-22 15:53:50 UTC
This is not a bug report but a feature request. More than a single component is involved, it is difficult to make this fail-safe, there are more pressing issues, and all developers are pretty much working on real bug reports right now.

That's why you don't see any progress here.
Comment 13 Egbert Eich 2007-08-14 08:49:24 UTC
This is indeed a feature request and we should treat it as such. 
A generic failsave config file which uses fbdev and whatever vesa mode is set should be easy to provide and satisfy the vast majority of users - in fact all those who use a fbdev mode instead of vga console (thus all ia64 users would be excluded).
As a minimal first step this config could be shipped and a script could be provided that allowed the user to switch between this file and the original version.
This would require the user to briefly log in on the text console and run the script.
An automated setup which will switch to a failsave config file would most likely involve modifications to 3 different display managers.
The most obvious solution would be to select another line in the /etc/X11/xdm/Xservers file (along the lines of what kdm already does to support multiple concurrent sessions).
startx is not the preferred method of starting X any more. Thus hacking this script would only satisfy a small subset of users.
Comment 14 Stefan Dirsch 2007-08-14 09:21:52 UTC
Well, we could use /etc/X11/xorg.conf.install for failsafe. This is the one, which has also been used for installation and is therefore supposed to work.

There's already a failsafe entry generated for grub. But this one explicitely disables framebuffer, so changing this behaviour would be fundamental.

Grepping for an extra grub "x11failsafe" option in /proc/cmdline  and copying /etc/X11/xorg.conf.install to /etc/X11/xorg.conf-4 in /etc/init.d/xdm
shouldn't be that hard. Of course /etc/X11/xorg.conf-4 should be removed if this option is *not* set.

Comment 15 Benjamen Aceler 2007-08-14 17:01:55 UTC
> This would require the user to briefly log in on the text console and run the
script.

Red Hat have a feature that automatically starts a config utility if Xorg fails. I think we don't need to ask user to start this script, too.
Comment 16 Stefan Dirsch 2007-08-14 17:06:02 UTC
How do you define "Xorg fails"? How do you want to detect a black screen? The easiest and IMHO most reliable solution would be to provide a failsafe boot option, which usese the X driver, which has been used for installation as well. In most cases this will be the fbdev driver.
Comment 17 Frank-Michael Fischer 2007-10-04 16:01:38 UTC
I agree with comment #16. As long as the average user will be capable to browse around the internet for a proper solution, such fallback is fine. w3m would be a hard browser to use for problem solution.

Strategically why not having a "whitelist" type of X11 drivers table? Left column: chip type, right column default driver, where sax2 without "-m" switch would look first. The latest version of this table could be put into GM after RC and we would spare more users from sax2 type user unfriendly stuff. It should also be part of online update then.
Comment 18 Stefan Dirsch 2007-12-28 16:07:15 UTC
Proposal
--------

--- xdm.orig    2007-12-28 16:01:48.000000000 +0100
+++ xdm 2007-12-28 17:08:19.000000000 +0100
@@ -140,6 +140,22 @@
                 "$DISPLAYMANAGER_STARTS_XSERVER" = "no" ]; then
                XDMOPTIONS="--no-console"
        fi
+       # Graphical failsafe mode (Bug #246158).
+       #
+       # Needs changes in kernel commandline of "Failsafe" entry in
+       # /boot/grub/menu.lst.
+       #
+       #  * use the same "vga" option value as in the non-"Failsafe" entry
+       #  * remove "3" option (runlevel)
+       #  * add "x11failsafe" option
+       if cat /proc/cmdline | grep -q x11failsafe; then
+            if [ -f /etc/X11/xorg.conf.install ]; then
+               export XORGCONFIG=xorg.conf.install
+            else
+                rc_status -u
+                rc_exit
+            fi
+       fi
        startproc -p $PIDFILE $DISPLAYMANAGER $XDMOPTIONS || rc_failed
        # After a crash or a kill signal we may have
        # a wrong owner ship of /dev/xconsole
Comment 19 Stefan Dirsch 2007-12-28 16:09:24 UTC
Created attachment 188872 [details]
xdm.diff

Patch again as attachment.
Comment 20 Stefan Dirsch 2007-12-28 16:16:56 UTC
> # Needs changes in kernel commandline of "Failsafe" entry in
> # /boot/grub/menu.lst.
> #
> #  * use the same "vga" option value as in the non-"Failsafe" entry
> #  * remove "3" option (runlevel)
> #  * add "x11failsafe" option

Coolo, this would require changes in our bootloader and our failsafe mode
will change to a grahical one. Not sure if this would be appreciated. Please comment.
Comment 21 Luc Verhaegen 2007-12-28 17:16:21 UTC
I am not certain what the fallback driver choice is, but i would like to take one driver out of the equation.

VGA is the most horrible fallback you can name. Compatibility is a lie, nothing less. The only way to reliably use VGA is to not touch the mode at all.

All one should do is find out the current mode (usually 640x400 - 80x25) alter the way the framebuffer is used (from text to graphics), and not touch anything else.

Change the mode, and you risk not setting up the mode fully and correctly for all active heads and all active outputs. While on radeonhd a modechange will be emulated fully and correctly, devices like the unichrome will mess up rather horribly.

Whenever i have time, i should alter the vga driver (generic.c) to work as described, unless it gets fed a special option to allow all modes possible with 256kB. 
Comment 22 Matthias Hopf 2007-12-28 17:23:33 UTC
Using the installation Xserver is probably the very best solution. If that one failed, the user wouldn't have been able to install at all. If the user is proficient enough to install in text mode, he is able to boot into runlevel 3 all by himself as well.

As long as we do not remove the ability to add boot options (again).
Any automatism is critical here. Maybe one could grep the log for segfaults or some error lines - but also then nobody will tell you whether the driver has already borked up the display and fbdev will work, or not.
Comment 23 Stefan Dirsch 2007-12-28 17:36:56 UTC
Luc, since the vga driver is never used for installation, we don't consider to use it as fallback driver. The drivers used for installation are either

- fbdev (in most cases)
- vesa (only in some rare cases)
- the native driver (only on IA64 - due to missing VBIOS IIRC)

Matthias, thanks for the supportive comment.
Comment 24 Stephan Kulow 2008-01-07 14:21:04 UTC
I guess that's a good change. For the bootloader change, you need to create a new bug for yast2-bootloader.
Comment 25 Stefan Dirsch 2008-01-07 15:07:27 UTC
(In reply to comment #24 from Stephan Kulow)
> I guess that's a good change. 
Thanks.

> For the bootloader change, you need to create a new bug for yast2-bootloader.
done (Bug #352020). It's marked as enhancement. Jozef, any chance to get this implemented still for openSUSE 11.0?
 

Comment 26 Stefan Dirsch 2008-01-07 22:13:35 UTC
(In reply to comment #25 from Stefan Dirsch)
> > For the bootloader change, you need to create a new bug for
> > yast2-bootloader.
> done (Bug #352020). It's marked as enhancement. Jozef, any chance to get
> this implemented still for openSUSE 11.0?

I attached a patch proposal to Bug #352020.
Comment 27 Stefan Dirsch 2008-01-15 04:14:46 UTC
Jozef, could you comment?
Comment 28 Jiri Srain 2008-01-17 14:57:03 UTC
The patch attached to bug #352020 sounds OK, but how are we going to handle problems with framebuffer? Wouldn't it be better to set framebuffer to a safe mode instead of the standard one?
Comment 29 Stephan Kulow 2008-01-17 15:01:14 UTC
I'm not the expert there. 
Comment 30 Stefan Dirsch 2008-01-17 15:07:22 UTC
Well, what do you think which mode would be safe here? 640x480@16bpp? In this mode many X applications (like YaST2/SaX2) won't show their Ok button any more, though are becoming useless in failsafe mode.

I assume the installation fbdev mode *is* safe. Otherwise the graphical installation would not have been possible at all. Makes sense?
Comment 31 Matthias Hopf 2008-01-17 15:37:58 UTC
The installation xserver configuration is the safest thing we can ever come to. If it doesn't work, we do have other more prominent problems that this little thing.
Comment 32 Jiri Srain 2008-01-17 15:54:54 UTC
OK, agreed.

Jozef, I think you can apply the suggested patch.
Comment 33 Stefan Dirsch 2008-01-22 00:27:00 UTC
Jozef? I think that Jiri set NEEDINFO to you, because he wanted here from you if you agree as well and plan to integrate the patch to yast2-bootloader.
Comment 34 Jozef Uhliarik 2008-01-22 08:22:44 UTC
Stefan, Jiri is my teamleader. If he agrees I have to do it. ;-)

I agree too and I will ask you about details via IRC or mails.
Comment 35 Stefan Dirsch 2008-01-22 09:00:10 UTC
Sounds good. :-)
Comment 36 Stefan Dirsch 2008-01-23 22:18:21 UTC
I've added the patch of comment #19 now to xdm init script.
Comment 37 Stefan Dirsch 2008-04-24 01:50:44 UTC
This feature should be in place now since openSUSE 11.0 Alpha 2. Anybody, who verfified that it works as expected?
Comment 38 Stefan Dirsch 2008-04-24 12:46:07 UTC
This feature does not work since the failsafe contains again "vga=normal" and "3" and is missing "x11failsafe". :-( I need to reopen Bug #352020.
Comment 39 Stefan Dirsch 2008-04-24 12:55:51 UTC
reopen this one as well.
Comment 40 Stefan Dirsch 2008-04-25 12:03:10 UTC
The issue has been fixed now in perl-Bootloader - yast2-bootloader was the wrong package with dead code I patched. I keep this bugreport open until I tested it with Beta2.
Comment 41 Stefan Dirsch 2008-05-06 10:56:44 UTC
Finally this feature works - with openSUSE 11.0 Beta2.
Comment 42 Stefan Dirsch 2008-07-09 22:31:43 UTC
*** Bug 407735 has been marked as a duplicate of this bug. ***