# Not able to get correct display resolution



## WinFyter (May 14, 2017)

Hi,

I have a Dell E6510 with NVidia card
I have installed FreeBSD 11.0, updated it, and installed KDE
My laptop screen native resolution is 1366 x 768
In KDE > Display the max resolution I can set is 1024 x 768
So I cannot set the resolution to the native resolution.

I have been using Windoze for decades and just making the switch - I am REALLY impressed with FreeBSD! I like it much more than Windows or any Linux variant. I have been able to solve all issues I came across, until this one.

So far, this is what I have tried:

*2 Setting up the FreeBSD nVidia driver*
https://docs.freebsd.org/doc/7.3-RELEASE/usr/share/doc/en/articles/compiz-fusion/nvidia-setup.html
I found when I followed this page, I got an error on boot that the X server could not start, and i could not boot into KDE


*HOWTO: Setup Xorg with NVIDIA's driver*
https://forums.freebsd.org/threads/52311/#post-318536/

The below are my notes as to what I did. The result was the same - 
I got an error on boot that the X server could not start, and i could not boot into KDE



Find out what hardware you have on your PC

Ref:
https://www.freebsd.org/doc/handbook/kernelconfig-devices.html
Run # dmesg
This will show the hardware you have on your computer
It shows:

vtvga0: <VT VGA driver> on motherboard

<NVIDIA GT21x.........>

Googling NVIDIA GT21x gives:
https://en.wikipedia.org/wiki/GeForce_300_series
GeForce 300 series Release date    2009-10
Codename    GT21x


Reference for FreeBSD

Review this page to see how to do it:
HOWTO: Setup Xorg with NVIDIA's driver
https://forums.freebsd.org/threads/52311/#post-318536/


Find out which driver you need

Goog "NVidia unix drivers"
This will find:
http://www.nvidia.ca/object/unix.html
On this page is a heading called FreeBSD x64
This page shows:
FreeBSD x64
Latest Long Lived Branch version: 375.66
Latest Short Lived Branch version: 381.22
Latest Legacy GPU version (340.xx series): 340.102
Latest Legacy GPU version (304.xx series): 304.135

The 375 version says it added a bunch of drivers for video cards that I dont have
So I could use 375 BUT since my card is old (2009) and I used 340 in Linux Mint and it worked so use it


Set FreeBSD up for this driver

Using:
https://forums.freebsd.org/threads/52311/#post-318536/

If you are following the handbook on configuring Xorg, ignore what the handbook says about running Xorg -configure.
    Don't run Xorg -configure

I did not do that


    If you already followed the handbook and created an xorg.conf make sure to remove /etc/X11/xorg.conf or /usr/local/etc/X11/xorg.conf before proceeding: rm -f /etc/X11/xorg.conf /usr/local/etc/X11/xorg.conf

I checked - neither of these files exist


    Install x11/nvidia-driver: pkg install x11/nvidia-driver

    For some older cards you need to use x11/nvidia-driver-340 or x11/nvidia-driver-304 instead. Consult NVIDIA's download page to see which driver version you need. Note that there is no need (and it's even counterproductive) to download the driver from that page.

For me in this case:
pkg install x11/nvidia-driver-340
I ran this and it installed this driver


    Run sysrc kld_list+="nvidia-modeset" to add an entry to /etc/rc.conf to load the kernel modules at boot. sysrc(8) is a nice utility that safely edits /etc/rc.conf for you.

    nvidia-modeset is only available for driver versions >= 358.009, if you to use an older version use sysrc kld_list+="nvidia" instead.

I ran sysrc kld_list+="nvidia"


    Either reboot with shutdown -r now or load the required kernel modules now with kldload nvidia-modeset or kldload nvidia

I did
shutdown -r now


    Create the /usr/local/etc/X11/xorg.conf.d directory:
    mkdir -p /usr/local/etc/X11/xorg.conf.d

I did this by copying and pasting from the web page into Konsole


    Use your favourite editor to create /usr/local/etc/X11/xorg.conf.d/10-nvidia.conf with the following contents:
    Code:

    Section "Device"
            Identifier "NVIDIA Card"
            VendorName "NVIDIA Corporation"
            Driver "nvidia"
    EndSection

Done

Rebooting, the above gives an errror
X server cannot be started

Deleting /usr/local/etc/X11/xorg.conf.d/10-nvidia.conf  allows me to get KDE back


I am not sure what to try next.

Any help would be much appreciated.


----------



## tobik@ (May 14, 2017)

Please post your /var/log/Xorg.0.log with /usr/local/etc/X11/xorg.conf.d/10-nvidia.conf in place.


----------



## WinFyter (May 14, 2017)

Hi tobik@ 
Thank you very much for your quick reply and help!
Please see below for log contents


----------



## WinFyter (May 14, 2017)

```
[    16.348]
X.Org X Server 1.18.4
Release Date: 2016-07-19
[    16.348] X Protocol Version 11, Revision 0
[    16.348] Build Operating System: FreeBSD 11.0-RELEASE-p10 amd64
[    16.348] Current Operating System: FreeBSD host.domain.home 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017     [email]root@amd64-builder.daemonology.net[/email]:/usr/obj/usr/src/sys/GENERIC amd64
[    16.349] Build Date: 29 April 2017  09:45:40AM
[    16.349]  
[    16.349] Current version of pixman: 0.34.0
[    16.349]    Before reporting problems, check [URL]http://wiki.x.org[/URL]
   to make sure that you have the latest version.
[    16.349] Markers: (--) probed, (**) from config file, (==) default setting,
   (++) from command line, (!!) notice, (II) informational,
   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    16.349] (==) Log file: "/var/log/Xorg.0.log", Time: Sun May 14 16:03:25 2017
[    16.437] (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
[    16.442] (==) No Layout section.  Using the first Screen section.
[    16.442] (==) No screen section available. Using defaults.
[    16.442] (**) |-->Screen "Default Screen Section" (0)
[    16.442] (**) |   |-->Monitor "<default monitor>"
[    16.448] (==) No device specified for screen "Default Screen Section".
   Using the first device section listed.
[    16.448] (**) |   |-->Device "NVIDIA Card"
[    16.448] (==) No monitor specified for screen "Default Screen Section".
   Using a default monitor configuration.
[    16.448] (==) Automatically adding devices
[    16.448] (==) Automatically enabling devices
[    16.448] (==) Not automatically adding GPU devices
[    16.448] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    16.550] (==) FontPath set to:
   /usr/local/share/fonts/misc/,
   /usr/local/share/fonts/TTF/,
   /usr/local/share/fonts/OTF/,
   /usr/local/share/fonts/Type1/,
   /usr/local/share/fonts/100dpi/,
   /usr/local/share/fonts/75dpi/
[    16.550] (==) ModulePath set to "/usr/local/lib/xorg/modules"
[    16.550] (II) The server relies on devd to provide the list of input devices.
   If no devices become available, reconfigure devd or disable AutoAddDevices.
[    16.550] (II) Loader magic: 0x813b70
[    16.550] (II) Module ABI versions:
[    16.550]    X.Org ANSI C Emulation: 0.4
[    16.550]    X.Org Video Driver: 20.0
[    16.550]    X.Org XInput driver : 22.1
[    16.550]    X.Org Server Extension : 9.0
[    16.550] (--) PCI:*(0:1:0:0) 10de:0a6c:1028:040b rev 162, Mem @ 0xe2000000/16777216, 0xd0000000/268435456, 0xe0000000/33554432, I/O @ 0x00007000/128, BIOS @ 0x????????/65536
[    16.551] (II) LoadModule: "glx"
[    16.563] (II) Loading /usr/local/lib/xorg/modules/extensions/libglx.so
[    16.712] (II) Module glx: vendor="X.Org Foundation"
[    16.712]    compiled for 1.18.4, module version = 1.0.0
[    16.712]    ABI class: X.Org Server Extension, version 9.0
[    16.712] (==) AIGLX enabled
[    16.713] (II) LoadModule: "nvidia"
[    16.736] (WW) Warning, couldn't open module nvidia
[    16.736] (II) UnloadModule: "nvidia"
[    16.736] (II) Unloading nvidia
[    16.736] (EE) Failed to load module "nvidia" (module does not exist, 0)
[    16.736] (EE) No drivers available.
[    16.754] (EE)
Fatal server error:
[    16.754] (EE) no screens found(EE)
[    16.754] (EE)
Please consult the The X.Org Foundation support
    at [URL]http://wiki.x.org[/URL]
 for help.
[    16.754] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    16.754] (EE)
[    16.754] (EE) Server terminated with error (1). Closing log file.
```


----------



## tobik@ (May 14, 2017)

WinFyter said:


> Please see below for log contents


I don't see it anywhere.  Can you upload it to Pastebin (or a similar site)?


----------



## WinFyter (May 15, 2017)

Sorry about that

I don't see the log in a post I made if I am not logged in to this forum, but I do see it if I am logged in.....hmmmmmmm

I can link to the post containing the log at https://forums.freebsd.org/threads/60945/#post-350630 and I can view this in other browsers...

In any case, please see:
https://pastebin.com/fwhvk277


----------



## tobik@ (May 15, 2017)

Well now I see it  


WinFyter said:


> [ 16.736] (EE) Failed to load module "nvidia" (module does not exist, 0)


That's odd. Is x11/nvidia-driver-340 still installed?


----------



## WinFyter (May 15, 2017)

Hi,

I am a complete noob to FreeBSD. I think it is important to learn stuff on my own and so I have been googling "FreeBSD how to list installed drivers" etc.

I have come up with:

dmesg
- It does show a number of lines that refer to "NVIDIA GT21x" but that seems to be identifying the audio and video hardware components of the card, and nothing referencing a driver with the text "340" in it.

kldstat
- It does not show anything referring to the driver.

I am not sure if these are the correct commands to show if the driver is installed. Can't find anything else at the moment on how to tell if the driver is installed.

I could of course re-install the driver but would prefer to learn how to tell if it is installed.

Could you please let me know how to determine if the driver is installed?


----------



## tobik@ (May 15, 2017)

`pkg info` will show you a list of installed packages. You can also ask it show more information about a specific package: `pkg info nvidia-driver-340`

I think the table at https://wiki.freebsd.org/PkgPrimer#Rosetta_Stone is a good overview over available package commands. However please ignore the legacy pkg column, only the pkgng column is relevant today ;-)


----------



## WinFyter (May 15, 2017)

Thank you. 
I need to go off to work at the moment (I am in Canada, EST) and will report back this eve or tomorrow.


----------



## WinFyter (May 16, 2017)

Hi tobik@,

Thanks for explaining how to check if the NVidia driver was installed.

I am embarrassed and puzzled to say it was not......because I thought that I did install it and remember checking the pkg verbosity to make sure it installed ok.

When I tried to (re)install it pkg reported that the kernel did not support Linux.
That was easy to fix.

Then I followed the rest of the instructions on your very well written page:
https://forums.freebsd.org/threads/52311/#post-318536/

And POP! up comes this beautiful rendering of KDE desktop in the correct resolution!!!!

This was my first ever post for help on FreeBSD and your support has been great! I really appreciate it!! 

I am sorry though that I wasted your time in this - I should have been able to check that the driver was installed.

In any case I owe you one - please let me know if there is anything I can do to help you or the FreeBSD community.


----------

