28

December
2012

Better Xorg autodetection

I had an impression that recent versions of xorg can autodetect everything on its own when no configuration file is present, so I didn't care much about this in Slax. I thought that xorg is a smart system. I was wrong, it seems :) Yesterday I just purchased a cheap mini notebook (netbook) from Acer and Slax wasn't able to start X automatically on this device. What a shame. Yet X was running properly after xorgsetup command. So I started to wonder, what makes the difference?

I have to say that it's pretty odd. The difference is in running 'X -configure' to create an xorg.conf file which is later used by X itself again. One would say that if X can autodetect the hardware to create the configuration file, it should be smart enough to do the very same thing when running without one. But apparently that is not the case, so I saw "no screens found" error instead of X.

Good news is that thanks to these findings I can improve Slax again :) I will simply make it run X -configure first before X is started, to assure that there is at least some config file for further usage.

User comments
Russell Hernandez 2012-12-28 13:21

Does this mean another release?

Ivo Georgiev 2012-12-28 14:20

Have you investigated enough? Because it is possible that the autodetect is trying to load a nonexisting driver, while xorgsetup simply selects vesa.

Mark De Silva 2012-12-28 16:05

I find that when KMS is on, the xorg.conf file always fails. It doesn't find the correct screens. Then when I turn KMS off with the kernel opt nomodeset, X -configure still gives me a bad xorg.conf file. Even on machines when nomodset gives me a right X display, if I do a X -configure and use the xorg.conf file, the whole thing fails telling me "no screens found". This is on systems I've never had issues running X on with X -configure or xconf (old slax).

Mark De Silva 2012-12-28 17:01

If you're going to come out with another fix release, I would implore you to look at the device priority issue. Slackware doesn't exhibit this behaviour, neither do the other slackware based distros running slackware 14. It is only prevalent on pre i3 machines where as Slackware 14 and the other Slackware based distros have no issues assigning the first device letters to the internal hard drives first before the other thumbdrives, external hdds, etc. I've been trying to find the kernel config that solves that issue myself, but to no avail.

Tomas M 2012-12-28 19:36

@Mark: regarding xorg config, in my tests the command X -configure fails mostly with an error that the number of detected screens doesn't match number of devices... but still it produces xorg.conf file (in /root/xorg.conf.new) which makes the system properly run X desktop, while it wouldn't start with no config file otherwise.

If you have a machine where you're having problems with X -configure, would you please try 'xorgsetup' command before you start X, and let me know the result? It basically does the very same thing (calling X -configure and moving the config file to /etc/X11/)

Regarding drive order, I really do not know what to do in order to affect device priority (order of hard drives). It is strange to me. USB devices should ALWAYS be detected later than hard disks due to the nature of USB in general. Is it possible that you have set in BIOS to use some special mode for your usb devices, or some other setting which make it appear as a standard hard drive not on USB bus?

James Marsh 2012-12-28 20:13

Off topic...
"Documentation" > "use at your own risc".
"Risk" is the correct spelling.
(Unless its a pun).

Thanks for the great work. Am excited to contribute some buildscripts.

Mark De Silva 2012-12-28 20:17

Hi Tomas,

For the X3100 I get the same as you "number of screens doesn't match number of devices". I have to edit the generated xorg.conf, remove the 2 additional screens and then it run. This X3100 machine runs fine with or without KMS.

For the other machine it uses GM945, without KMS it will only go up to 1024x768 (it is supposed to go up to 1280x800). If I run xorgsetup or X -configure, it will generate the config file, but reports no screens found. I run X -configure again and this time I get the same "number of screens doesn't match number of devices" error. I edit the file to remove the additional 2 screens and I note the remaining screen is using the intel driver, however X only goes up to 1024x768 and can't go any further in the resolution.

Mark De Silva 2012-12-28 20:20

Hi Tomas,

For the device priority, I don't think its BIOS setting. I have done this on a few different laptops. As I mentioned, for some reason the pre i3 machines (Core 2 Duo) always put the USB drives as priority. The i3, i5 and i7 machines give the correct priority to the internal hard drives.

Just to be sure, I have also reset the BIOS settings on my Core 2 Duo machines and tried and it still doesn't give priority to the internal hard drives. I have tried booting Porteus v2rc1 (slackware 14 kernel 3.7.1) on the same machines and it gives the correct 1st priority to the internal hard drives.

Mark De Silva 2012-12-28 20:22

Just to add to my comments on the xorg - the GM945 should use the i810 driver. Its there in my Slax 7 but it still doesn't work.

Tomas M 2012-12-28 21:46

Regarding Xorg config, even if I get an error after running X -configure, I can copy the xorg.conf.new to /etc/X11/xorg.conf and it actually works, unmodified, regardless of the amount of screens detected. In your case, it doesn't work without manual tweaking?

Mark De Silva 2012-12-28 23:02

@Tomas, yes thats right, unless I manually tweak the conf file and remove the extra screens, it won't work.

Mark De Silva 2012-12-28 23:03

Previously, I was able to make X run find on most cards using the fb xorg.conf, but that doesn't exist anymore I think thanks to the KMS.

Tomas M 2012-12-28 23:37

Thank you for the feedback. I'm wondering what should Slax do in order to perhaps workaround this automatically. Could you please email me the xorg.conf.new file after it is generated by X -configure (while it doesn't work) and then the other xorg.conf after you edit it to make it work? (email both files please)

If this happens, Slax could maybe parse the config file and remove the extra screen sections. For me, it complains about the issue that number of screens doesn't match number of devices, but yet it produces xorg.conf.new file which is correct, so I can't reproduce it. Thanks!

jcsoh 2012-12-29 01:47

Off topic.
At times it sucks to be running linux.!. I just booted into windox xp as I was having problem accessing my email in slax remix . I then check out this page.
Woa , I see faces (none in slax remix).

@ Tomas -Is that really your photo ?
Last time I saw your photo was in your blog . I think in slax 5 or 6 time.

Liquid Snake 2012-12-29 04:06

Off-topic: Tomas, I tried to install Slax in another flash drive, inside Slax, ran bootinst.bat, which called bootinst.sh successful, and I got these messages:

Partition /dev/sdc1 seems to be located on a physical disk,
which is already bootable. If you continue, your drive /dev/sdc
will boot only Slax Linux by default.
Press [Enter] to continue, or [Ctrl+C] to abort...

* attempting to install bootloader to /media/FC13-98FC/slax/boot...
./bootinst.sh: line 112: ./extlinux.exe: cannot execute binary file
Error installing boot loader.
Read the errors above and press enter to exit...

What might be wrong? I can not depend on Windows just to install Slax.

Mark De Silva 2012-12-29 04:23

Tomas, just sent you the files.

Tomas M 2012-12-29 07:01

Regarding bootinst: I noticed another strange problem, extlinux.exe segfaulting even on Slax itself. It is very strange behavior, so I'm going to revert back to use extlinux from the current operating system, and if that fails then try extlinux.exe from the boot directory.

I have no explanation on why extlinux on the USB device behaves such strange. Maybe I may try to recompile it, but have no idea if that helps.

Somewhat Reticent 2012-12-29 07:17

And here I thought many OEMs' BIOS recognize removable ports like USB, CF, SD, MMC, etc as hard drives (even though empty) ...

vic 2012-12-29 16:13

I use:
#cat /root/.profile

[ -z $DISPLAY ] && {
echo -n "Trying autoconf Xorg...
Xorg -configure 2>/dev/null
[ -f /root/xorg.conf.new ] && (mv /root/xorg.conf.new /etc/X11/xorg.conf;\
echo OK) || echo ERROR
}
Enjoy
Regards

Manfred 2012-12-29 17:10

@vic:

And in which way does this fix the "number of screens doesn't match number of devices" error ?

vic 2012-12-29 18:01

@Manfred
Yes . In my netbook I see other Screen sections, but I don't
edit xorg.conf manually. Just do it.
In $HOME/.profile i used my own settings, IMHO it's simplest
way without rebuild system scripts.

vic 2012-12-29 18:25

sorry ,i find error:
#cat /root/.profile

[ -z $DISPLAY ] && {
echo -n "Trying autoconf Xorg"
Xorg -configure 2>/dev/null
[ -f /root/xorg.conf.new ] && \
(mv /root/xorg.conf.new /etc/X11/xorg.conf; echo OK) \
|| echo ERROR
}

pistal 2012-12-30 02:40

@Mark De Silva
>As I mentioned, for some reason the pre i3 machines (Core 2 Duo) always put the USB drives as priority
I have Core 2 Duo PC too (ASUSTEK), but HD are in correct priority sda and sdb are internal HD and sdc is USB flash with booted Slax 7.0.2

Mark De Silva 2012-12-30 11:50

@pistal, I haven't downloaded 7.0.2 yet, still using 7.0.0. Waiting for the release with PXE before downloading again.

Mark De Silva 2013-01-03 09:35

@Pistal, using Slax 7.0.3, the usb thumbdrive is still detected as /dev/sda.

I am now wondering if its because my thumbdrive is 64GB in size. I will have to test with a few smaller sized thumbdrives to confirm.

pistal 2013-01-06 08:00

@Mark De Silva
using 32 bit Slax 7.0.3 Slovak; fdisk -l says sdc is USB (like in 7.0.2). USB stick is 16GB.

pistal 2013-01-06 08:10

I also tried 64 bit version with the same result.

ashnazg 2013-01-09 21:58

I recently purchased an Acer Aspire V5-551G laptop. I've been trying out various live CD distributions with it. I tried Slax 7 earlier, but had problems with it, so I recently downloaded Slax 7.0.3 because I read it had better Xorg detection. However, when I attempted to boot to a graphical login, Slax entered an endless loop trying to create a usable X configuration file.

I rebooted to a console login and attempted to create a usable X configuration file using "Xorg -config; cp /root/xorg-conf.new /etc/X11/xorg.conf", xorgsetup, "cp /etc/X11/xorg.conf-vesa /etc/X11/xorg.conf", and even hand-editing the file created by xorgsetup to remove references to extra monitors and cards, but nothing worked.

Of the several Slackware-based distributions I've tried out with the laptop, only Wifislax (4.3) and Porteus (2.0 RC1) start X successfully. I booted into Porteus and poked around to see what the difference was. What I found was that, in addition to the /etc/X11/xorg.conf-vesa file, Porteus also has a file called /etc/X11/xorg.conf-modesetting that loads the kernel modesetting driver. If Porteus is unable to find a proprietary driver *.xzm module, it uses the xorg.conf-modesetting file as its X configuration file.

I copied the file to a USB flash drive, booted into Slax, copied the file to /etc/X11/xorg.conf, and started X. Xorg seemed a bit slow starting, but this time it worked.

The GPU is an AMD Radeon HD 7650M, I believe.

Tomas M 2013-01-10 09:00

Thank you ashnazg, I will try the same. What porteus version you used? So I could reuse their xorg.conf-modesetting file.

ashnazg 2013-01-11 00:04

It was Porteus 2.0 RC 1, the 64-bit KDE4 version:

http://forum.porteus.org/viewtopic.php?f=35&t=1780

What's odd is that just last night I tried out the OpenSuSE 12.2 GNOME live CD, but it hung on startup, and wouldn't boot to a desktop unless I *disabled* kernel mode-setting.