# Weird Xorg glitches



## thedude22 (Dec 14, 2018)

I'm trying to set up my laptop here and I'm having some problems.

I can start xorg but Ctrl alt backspace doesn't kill it for some reason. I didn't change any options so I don't know why that doesn't work.
Anyway after I kill X the screen flashes a blinking cursor a few times and then I get some weird glitches. The keyboard is still responsive as the glitches change randomly as I type.

I tried disabling nvidia-modeset but now x just won't load at all and the screen just freezes with a stuck mouse cursor in a black screen, no xterms.

I only have the standard Nvidia driver file in xorg.conf.d. Any common issues with laptops like this? It's a GTX 1070 and I have the latest driver. 

My kld_list has just nvidia and nvidia-modeset. Fresh install. Everything works as normal if I remove the Nvidia driver conf file.

That file looks like this:

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


----------



## shkhln (Dec 14, 2018)

thedude22 said:


> I can start xorg but Ctrl alt backspace doesn't kill it for some reason.



Took you a while to notice.


----------



## thedude22 (Dec 14, 2018)

Lol. 

I haven't tried to manually kill X in forever. Usually I don't have to, but this driver isn't playing nice.


----------



## toorski (Dec 14, 2018)

thedude22 said:


> My kld_list has just nvidia and nvidia-modeset. Fresh install. Everything works as normal if I remove the Nvidia driver conf file.



Same here: 12.0-RELEASE
Desktop System with GTX960

When I re'move  */etc/X11/xorg.conf*,  that I created with *nvidia-xconfig*,  then * X& xterm* come alive.
*lumina-desktop* will play too, but at VESA resolution, *startkde* nada 

*Edit:*
Forgot to load nvidia-modeset 
X is  working OK now, with /etc/X11/xorg.conf  created with nvidia-xconfig 
Now, I have to learn how to startkde(5)  - lol  *<- Edit Update Solved:*
in * .xinitrc*
`exec startkde`

Lucky me and KDE - hehe


----------



## Vull (Dec 14, 2018)

You don't need an xorg.conf file to kill an X session with ctrl-alt-backspace. Here's another way:


```
$ cat .xinitrc
setxkbmap -option terminate:ctrl_alt_bksp
exec ck-launch-session dbus-launch --exit-with-session startkde
```

However, if I kill a session that way (with ctrl-alt-backspace), it doesn't exit cleanly or normally.


----------



## toorski (Dec 15, 2018)

thedude22 said:


> I haven't tried to manually kill X in forever. Usually I don't have to, but this driver isn't playing nice.



After correcting couple of my typos and remembring to include the follwing in */etc/rc.conf:*

`linux_enable="YES"
kld_list="linux nvidia nvidia-modeset"`

Then doing:
`nvidia-xconfig`
and in *~/.xinitrc*
`exec startkde`

KDE5 is in FreeBSD-12.0 RELEASE, looking nice and working as intended

 Thus, the *nvidia-driver-390.87* is working fine too.


----------



## thedude22 (Dec 15, 2018)

Yeah I tried nvidia-xconfig.  That didn't help me.  Also I think you only need nvidia-modeset in kld_list.  The rest are loaded as dependencies I believe, and I have learned that you cannot load the newest nvidia drivers without that module.

So the nvidia driver is working as expected for me.  I can launch Xorg with it.  I can load the nvidia settings panel.  I just can't switch back to the vt terminal or close X at all.  I guess this is a bug with the kernal modesetting (?).

But as long as I stay in X everything works fine, and I only see the graphical glitches when X is killed, e.g. when I reboot.  No big deal for now.  I'll do everything in my window manager anyway.


----------



## thedude22 (Dec 17, 2018)

I'm not an expert but I don't think `linux_enable="YES"` should go in /etc/rc.conf.  That syntax is used in the /boot/loader.conf file.  I think you can use `kld_list="linux ..."` in /etc/rc.conf

I would appreciate some clarification on this if I am incorrect.  That line is probably just ignored in your file.


----------



## Deleted member 30996 (Dec 17, 2018)

thedude22 said:


> I'm not an expert but I don't think `linux_enable="YES"` should go in /etc/rc.conf.  That syntax is used in the /boot/loader.conf file.  I think you can use `kld_list="linux ..."` in /etc/rc.conf
> 
> I would appreciate some clarification on this if I am incorrect.  That line is probably just ignored in your file.



Having `linux_enable="YES"` in /etc/rc.conf is correct.

My /boot/loader.conf consists of:


```
linux_load="YES"
nvidia_load="YES"
nvidia-modset_load="YES"
```

Though needing both of the last two lines is debatable it's what I use on all my FreeBSD boxen with x11/nvidia-driver-304.


----------



## thedude22 (Dec 17, 2018)

Boxen.  Lol.  Do you also hunt for moosen?
EDIT: Wow I didn't know boxen was actual hacker slang.  My mind immediately went to the Brian Regan bit about being stupid in school.

Ok, not to derail the thread but what is the difference between:

`linux_load="YES"` in /boot/loader.conf
`linux_enable="YES"` in /etc/rc.conf
and
`kld_list="linux"` in /etc/rc.conf

I looked at the handbook but I didn't see much of an explanation.


----------



## Deleted member 30996 (Dec 17, 2018)

thedude22 said:


> Ok, not to derail the thread but what is the difference between:
> 
> `linux_load="YES"` in /boot/loader.conf
> `linux_enable="YES"` in /etc/rc.conf
> ...



Syntax is the difference. The correct syntax for entries in /etc/rc.conf is as stated for others as well. A snippet from mine:


```
microcode_update_enable="YES"
hald_enable="YES"
dbus_enable="YES"
linux_enable="YES"
```

The syntax for /boot/loader.conf in those instances is as shown above.

I don't use `kld_list="linux"` on any of my machines and believe it is used with a newer card than mine.


----------



## thedude22 (Dec 17, 2018)

So they all just load the linux.ko kernel module?

There must do different things, right?  Why else have both linux_load and linux_enable?  It would be redundant.


----------



## Deleted member 30996 (Dec 17, 2018)

One is for Linux compatibility and the other loads the kernel module.



> For Linux® compatibility to be enabled at boot time, add this line to /etc/rc.conf:
> 
> linux_enable="YES"
> 
> https://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html


----------



## k.jacker (Dec 17, 2018)

And the difference between
_foo_load="YES"_
in /boot/loader.conf
and
_kld_list="foo"_
in /etc/rc.con
is that it's recommended to only put modules that are required to boot in /boot/loader.conf like e.g. zfs or gjournal in my case.
But if you like, you can put any modul here. The reason why you shouldn't is that it can slow down the booting process.
So easy rule of thumb, if not required to boot, it goes to /etc/rc.conf


----------



## grahamperrin@ (Jan 2, 2019)

thedude22 said:


> … can't switch back to the vt terminal or close X …



Control-Alt-F2 has no effect? 

Try x11/sddm, maybe?


----------

