# New motherboard - X does not start



## callado (Dec 21, 2009)

I have replaced my motherboard with an ASUS P5QPL-AM and I have only the integrated G41 express chipset X4500 video. 
The previous one with GMA 3000 worked fine with X.
In FreeBSD 8.0 X crashes immediately to CLI, with the error message in Xorg.0.log that agpgart is not available. I included 'load_agp="YES"' in /boot/loader.conf, although my previous intel chip worked without this. But X still crashes with the same error message and I don't see /dev/agp*.
I have no xorg.conf, I have enabled hal and dbus in /etc/rc.conf.
I have also PCBSD 7.1.1 (based on FreeBSD 7.2) and X crashes the same way.
Under linux X works without problem.


----------



## vermaden (Dec 21, 2009)

@callado

Report a BUG here with all possible details:
http://freebsd.org/send-pr.html


----------



## sixtydoses (Dec 21, 2009)

callado said:
			
		

> I included 'load_agp="YES"' in /boot/loader.conf...



It should be `agp_load="YES"`.

Do you have `device agp` in your kernel?


----------



## SirDice (Dec 21, 2009)

*device agp* is in GENERIC.


----------



## sixtydoses (Dec 21, 2009)

Just in case he's using custom kernel.


----------



## callado (Dec 21, 2009)

Ok, there was 'agp_load="YES"' in /boot/loader.conf, I mistyped it.
I use GENERIC.
Anyway, if I enter 'kldload agp', I get 'kldload: can't load agp: File exists'
Now both PCBSD and FreeBSD work only with 'vesa' driver.


----------



## achix (Dec 22, 2009)

`% Xorg -configure` could help you guess your new driver.
When swapping motherboards/graphic cards chances are that the previous /etc/X11/xorg.conf will NOT work out of the box for the new hardware.


----------



## callado (Dec 22, 2009)

achix said:
			
		

> `% Xorg -configure` could help you guess your new driver.
> When swapping motherboards/graphic cards chances are that the previous /etc/X11/xorg.conf will NOT work out of the box for the new hardware.


I had no xorg.conf at all, it is no longer required if hal is running. I also tried 'Xorg -configure' and copying '/root/xorg.conf.new' to '/etc/X11/xorg.conf', but it did not help. I need the same driver ('intel') as before. Now I use the xorg.conf to start X with 'vesa'.


----------



## adamk (Dec 22, 2009)

Please show us the full /var/log/Xorg.0.log file from when you tried using the "intel" driver.

Adam


----------



## achix (Dec 22, 2009)

callado said:
			
		

> I had no xorg.conf at all, it is no longer required if hal is running. I also tried 'Xorg -configure' and copying '/root/xorg.conf.new' to '/etc/X11/xorg.conf', but it did not help. I need the same driver ('intel') as before. Now I use the xorg.conf to start X with 'vesa'.



oops, i didn't know that, i just tried it today for the first time.
Thanx for pointing this out.
However, i still i read a lot of graphics "hardcore" stuff, referring to xorg.conf.


----------



## callado (Dec 22, 2009)

adamk said:
			
		

> Please show us the full /var/log/Xorg.0.log file from when you tried using the "intel" driver.
> 
> Adam



I reported a bug, as vermaden recommended: Details. Xorg log is included.


----------



## adamk (Dec 22, 2009)

Your Xorg log file shows that it's running as DISPLAY :1...  Is there another X server already running on that machine as :0?

Adam


----------



## callado (Dec 22, 2009)

adamk said:
			
		

> Your Xorg log file shows that it's running as DISPLAY :1...  Is there another X server already running on that machine as :0?
> 
> Adam


No. In which line do you see that?


----------



## adamk (Dec 22, 2009)

```
(==) Log file: "/var/log/Xorg.1.log",
```

The log files are numbered based on their DISPLAY.  So something is causing X to start as DISPLAY :1, which is very odd.  It maybe completely unrelated to this crash, but that's certainly something to look into.  What's the output of 'ps ax'?  Does /var/log/Xorg.0.log exist?

Adam


----------



## callado (Dec 22, 2009)

adamk said:
			
		

> ```
> (==) Log file: "/var/log/Xorg.1.log",
> ```
> Adam


I think that it only means that it is a backup of a previous X log. Xorg.0.log is the latest, the previous one is moved to Xorg.0.log.old, the ones before that are moved to Xorg.1.log, Xorg.1.log.old, Xorg.2.log, Xorg.2.log.old, etc. In order to launch X, I needed the 'vesa' driver, so I provided an earlier log.


----------



## adamk (Dec 22, 2009)

That is not correct.  The number in the log file specifies the the display.  Xorg.0.log is the most recent log for display :0.  Xorg.0.log.old is the next most recent.  It does not keep older versions around.

EDIT:  You can confirm this by looking at the -logfile option in the Xorg man page.

Adam


----------



## zeiz (Dec 22, 2009)

It is not required to load agp.ko module in /boot/loader.conf if you use GENERIC.

It may be quite useful to show here your /etc/X11/*xorg.conf* as it is at yours.
Eventually somebody who has same chip may post his/her working xorg.conf and then you just make "diff"


----------



## achix (Dec 22, 2009)

what happens if you
`# kldload /boot/kernel/i915.ko` 
by hand?
is your xf86-video-intel package up to date?

also, as zeiz said, its a good idea to put aside hal and dbus for a while, try to use xorg.conf till you have your first xterm appearing, and then you go back to hal, step by step.


----------



## callado (Dec 22, 2009)

achix said:
			
		

> is your xf86-video-intel package up to date?


Yes, I have xf86-video-intel-2.7.1

My xorg.conf (X works with this one with 'vesa'):

```
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load  "dbe"
	Load  "ddc"
	Load  "dri"
	Load  "dri2"
	Load  "extmod"
	Load  "glx"
	Load  "record"
	Load  "xtrap"
	Load  "freetype"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "Buttons" "6"
	Option	    "ZAxisMapping" "4 5"
	Option      "Emulate3Buttons"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	Vendorname	"LGE"
	Modelname	"LG FLATRON W2042S"
	Horizsync	30.0-80.0	
	Vertrefresh	59.9-60.0
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"            	# [<bool>]
        #Option     "SWcursor"           	# [<bool>]
        #Option     "ColorKey"           	# <i>
        #Option     "CacheLines"         	# <i>
        #Option     "Dac6Bit"            	# [<bool>]
        #Option     "DRI"                	# [<bool>]
        #Option     "NoDDC"              	# [<bool>]
        #Option     "ShowCache"          	# [<bool>]
        #Option     "XvMCSurfaces"       	# <i>
        #Option     "PageFlip"           	# [<bool>]
	Identifier  "Card0"
	Driver      "vesa"
#	VendorName  "Intel Corporation"
#	BoardName   "4 Series Chipset Integrated Graphics Controller"
#	BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	DefaultDepth	24
	SubSection "Display"
		Depth	24
		Modes "1280x1024"
	EndSubSection
EndSection
```


----------



## achix (Dec 22, 2009)

your Xorg.0.log posted in the PR, complains about not being abled to load i915 kernel module:

```
[drm] failed to load kernel module "i915"
```
did you try the kldload above?


----------



## callado (Dec 22, 2009)

achix said:
			
		

> what happens if you
> `# kldload /boot/kernel/i915.ko`
> by hand?


It loads. But if I start X after that with 'intel', it still crashes.


----------



## zeiz (Dec 22, 2009)

Specification for your monitor is (some important):
Screen Resolution  	1680x1050
Horizontal Frequency Bandwidth (H-Sync Rate)  	30-83 Hz
Vertical Frequency Bandwidth (V-Sync Rate)  	56-75 MHz
So sections "Monitor" and "Screen" (Subsection "Display") should rather look like this:


```
Section "Monitor"
	Identifier   "Monitor0"
	VendorName	"LGE"
	ModelName	"LG FLATRON W2042S"
	HorizSync	30.0-83.0	
	VertRefresh	56.0-75.0
        Option            "DPMS"
EndSection
```


```
Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	DefaultDepth	24
     SubSection "Display"
                Viewport 0 0
		Depth	24
		Modes "1680x1050_60"
     EndSubSection
EndSection
```

This already can help, try first with "vesa" then change to intel, lets see if we need more workaround 

PS. Forgot to highlight: probably it was just a typo but anyway capital letters must be in place:

```
Vendor[B]N[/B]ame	
Model[B]N[/B]ame	
Horiz[B]S[/B]ync	
Vert[B]R[/B]efresh
```


----------



## achix (Dec 22, 2009)

callado said:
			
		

> It loads. But if I start X after that with 'intel', it still crashes.



We usually say "crash" to denote a kernel panic/crash.
Anyway, after loading i915.ko, is your Xorg log still the same?
What does it complain about now?


----------



## adamk (Dec 22, 2009)

I'm wondering if it's possible that the FreeBSD agpgart driver doesn't support your particular chipset.  It would be odd, but not impossible.  What's the full output of 'pciconf -vl'?


----------



## zeiz (Dec 22, 2009)

just in case: http://gitorious.org/~mlaier/freebsd/mlaiers-clone/commit/ca9391509dfc861db04ac8329569afb005e7be70


----------



## callado (Dec 23, 2009)

zeiz said:
			
		

> just in case: http://gitorious.org/~mlaier/freebsd/mlaiers-clone/commit/ca9391509dfc861db04ac8329569afb005e7be70


Yes, that seems to be the solution, because:
[CMD=""]$ pciconf -l | grep vga[/CMD]

```
vgapci0@pci0:0:2:0: class=0x030000 card=0x836d1043 chip=[B]0x2e32[/B]8086 rev=0x03 hdr=0x00
```

And some lines in the patch:

```
555	 {0x8086, [B]0x2E32[/B], CHIP_I9XX|CHIP_I965, "Intel G41"}, \
648	 (dev)->pci_device == [B]0x2E32[/B])
657	 (dev)->pci_device == [B]0x2E32[/B] || \
```

So, I can add these lines to the headers sys/dev/drm/drm_pciids.h and sys/dev/drm/i915_drv.h. But how should I proceed after that? What should I recompile, modify, etc.?


----------



## vermaden (Dec 23, 2009)

@callado  

Rebuild i915.ko module.


----------



## achix (Dec 23, 2009)

Which means,
`# kldunload i915`
`# cd /usr/src/sys/modules/drm/i915`
`# make install`
`# kldload i915`


----------



## callado (Dec 23, 2009)

vermaden said:
			
		

> Rebuild i915.ko module.



Ok. Just to make sure, is this all?

As root:
_modify headers according to the patch_
[CMD=""]cd /usr/src/sys/modules/drm/i915
make[/CMD]
_and then reboot_?


----------



## vermaden (Dec 23, 2009)

You do not need to reboot, just make commands that _achix_ posted, it will unload current module, build the new one and load the new one.

Nest try Xorg with intel driver.


----------



## callado (Dec 23, 2009)

I have rebuilt /usr/src/sys/modules/drm/i915 and /usr/src/sys/modules/drm/drm with make and make install
X still does not start with 'intel':

```
drm0: <Intel G41> on vgapci0
error [drm:pid 1241: drm_load] *ERROR* Card isn't AGP or couldn't initialize AGP
```
I have found some reports like this. So now I also added my device (0x2E328086) to agp_i810.c after line 177. What should I rebuild now?


----------



## vermaden (Dec 23, 2009)

```
# kldunload i915
# kldunload agp
# cd /usr/src/sys/modules/agp
# make install
# kldload i915
```


----------



## achix (Dec 23, 2009)

agp IIRC is compiled in his kernel, so he should do a full kernel rebuild.


----------



## callado (Dec 23, 2009)

achix said:
			
		

> agp IIRC is compiled in his kernel, so he should do a full kernel rebuild.


Rebuilding only agp did not help, still the same error.
For rebuilding the kernel, is this ok? 
Add MODULES_OVERRIDE = agp to /etc/make.conf: 
Then:
[CMD=""]
# cd /usr/src
# make buildkernel KERNCONF=GENERIC
# make installkernel KERNCONF=GENERIC
[/CMD]


----------



## vermaden (Dec 23, 2009)

Yes I forgot that agp.ko by default is in kernel, as others suggested, you need to rebuild the kernel ... or build kernel without agp in, so you will have to rebuild only a module to check next changes.


----------



## callado (Dec 23, 2009)

So I have rebuilt the kernel. Now the problem is that I get the error message that linproc cannot be mounted from fstab


----------



## achix (Dec 23, 2009)

[CMD="kldstat |"]grep lin[/CMD] should give smth like

```
8    2 0xffffffff81026000 1c53f    linux.ko
 9    1 0xffffffff81022000 3a28     linprocfs.ko
```

whats your case?


----------



## callado (Dec 23, 2009)

The good news is that X now works with 'intel'. The bad news is that linux kernel modules are not loaded and the net does not work (ale0). Should I copy modules from /boot/kernel.old to /boot/kernel except for the modified agp? Now I have only agp.ko, agp.ko.symbols, kernel, kernel.symbols and linker.hints in in /boot/kernel/


----------



## zeiz (Dec 23, 2009)

It makes sense to backup new agp.ko and then try to copy modules from /boot/kernel.old except old agp.ko.

Sorry, I'm too late and had no chance to prevent you from modifying make.conf that way: it builds only the modules following MODULES_OVERRIDE, now you know yourself . 
Personally I have custom config file instead of GENERIC and this line in make.conf:

```
MODULES_OVERRIDE= acpi linux linprocfs sound/sound /sound/driver/emu10k1 msdosfs ntfs zfs opensolaris zlib
```
but I wouldn't customize as much, I'd rather stay with GENERIC this time without modifying make.conf.
BTW you don't need to mention KERNCONF=GENERIC since it builds and installs GENERIC by default.


----------



## callado (Dec 23, 2009)

Thank you gentlemen! The problem has been solved with your help. Merry Christmas!


----------



## zeiz (Dec 23, 2009)

Pleasure. Same to you!


----------



## vermaden (Dec 23, 2009)

@callado

You are welcome mate, same to You


----------



## grenyer (Jan 1, 2010)

you are the best.
Gracias brother.


----------



## SterlingCamden (Apr 12, 2010)

This is excellent.  Any chance of finding a similar cure for a series 55 or 57 chip (Intel i3)?


----------



## SterlingCamden (Apr 12, 2010)

My pciconf reports the chip=0x00468086


----------

