# Stuck in a reboot loop after enabling nvidia driver (Macbook Air)



## ctps (Nov 15, 2017)

Hi all!
I have a MacBookAir3,2 (13") with a Nvidia GeForce 320M and FreeBSD 11.1 installed.
I took most of the configuration from this thread:
https://forums.freebsd.org/threads/52311/

Installed nvidia-driver-340 that fits the card, according to nvidia.com

I got these errors in Xorg.0.log:

```
[    22.850] (EE) NVIDIA: Failed to initialize the NVIDIA kernel module. Please see the
[    22.850] (EE) NVIDIA:     system's kernel log for additional error messages and
[    22.850] (EE) NVIDIA:     consult the NVIDIA README for details.
[    22.851] (EE) No devices detected.
```
I then put

```
linux_load="YES"
nvidia_load="YES"
```
into /boot/loader.conf to test that scenario

/etc/rc.conf looks like this:

```
hald_enable="YES"
dbus_enable="YES"
gdm_enable="YES"
gnome_enable="YES"
```
And now when my laptop boots I get the command prompt and then gdm loads and the laptop reboots  help?


----------



## SirDice (Nov 15, 2017)

Boot to single user mode and remove gnome_enable from rc.conf. Make sure X is properly configured and working before enabling Gnome.


----------



## ctps (Nov 15, 2017)

Alrighty, did that. When I enter `startx` the laptop reboots as well, it panics with a page fault.
My Xorg.0.log is empty - I guess that's normal since no process uses it now?


----------



## SirDice (Nov 15, 2017)

ctps said:


> I guess that's normal since no process uses it now?


No, that's definitely not normal. You would, at the very least, see the default Xorg stuff appearing. And you should have something in /var/log/Xorg.0.log, even if it failed miserably. That is, it can fail but it should never panic(9). A panic(9) means there's something seriously wrong and the system can't recover from the error.


----------



## ctps (Nov 17, 2017)

Alright, tried a fresh start, enable linux64 in kldload, installed nvidia-driver-340 pkg and installed xorg pkg.
I've put 

```
linux_load="YES"
nvidia_load="YES"
```
into /boot/loader.conf again and they get loaded.

Added the user to video group, and when I try to run `startx` this happened:

```
[  1380.891] (EE) open /dev/dri/card0: No such file or directory
[  1380.891] (WW) Falling back to old probe method for modesetting
[  1380.891] (EE) open /dev/dri/card0: No such file or directory
[  1380.891] (WW) Falling back to old probe method for scfb
[  1380.891] scfb trace: probe start
[  1380.891] (II) scfb(1): using default device
[  1380.891] scfb trace: probe done
[  1380.891] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[  1380.891] (EE) Screen 0 deleted because of no matching config section.
[  1380.891] (II) UnloadModule: "modesetting"
[  1380.891] (EE)
Fatal server error:
[  1380.891] (EE) Cannot run in framebuffer mode. Please specify busIDs        for all framebuffer devices
[  1380.891] (EE)
```

And the server fataled and exited.
I then created /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf with this content:

```
Section "Device"
        Identifier  "Card0"
        Driver      "nvidia"
EndSection
```

If the user tries to run startx now, the laptop reboots


----------



## ctps (Nov 17, 2017)

this is what can be seen in /var/run/dmesg.boot


```
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)
ACPI Warning: \134_SB.PCI0.IXVE.IGPU._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-205)


Fatal trap 12: page fault while in kernel mode
cpuid = 1; apic id = 01
fault virtual address   = 0x328
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff8270ee82
stack pointer           = 0x28:0xfffffe010f2ac400
frame pointer           = 0x28:0xfffffe0000f0ef58
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 3
current process         = 91513 (Xorg)
trap number             = 12
panic: page fault
cpuid = 1
KDB: stack backtrace:
#0 0xffffffff80aadac7 at kdb_backtrace+0x67
#1 0xffffffff80a6bba6 at vpanic+0x186
#2 0xffffffff80a6ba13 at panic+0x43
#3 0xffffffff80edf832 at trap_fatal+0x322
#4 0xffffffff80edf889 at trap_pfault+0x49
#5 0xffffffff80edf0c6 at trap+0x286
#6 0xffffffff80ec36d1 at calltrap+0x8
Uptime: 16m6s
Dumping 434 out of 3786 MB:..4%..12%..23%..34%..41%..52%..63%..74%..81%..93%
```


----------



## tehpeh (Sep 25, 2018)

Same for me on a 2010 Mac Mini. I posted this to the Nvidia forum https://devtalk.nvidia.com/default/...2-with-nvidia-driver-340-107-on-geforce-320m/

At the moment I'm using SCFB.


----------



## SirDice (Sep 25, 2018)

Don't install the official package on 11.2. The packages are built for 11.1 and a 11.1 NVidia kernel module will crash an 11.2 FreeBSD. The solution is to build the NVidia driver from ports (so it matches your FreeBSD version). 

This issue will be resolved at the end of the month when 11.1 will be EoL and packages are built for 11.2.


----------



## tehpeh (Sep 25, 2018)

Unfortunately I did build from ports (I know the issue you're referring to). I'm just hoping that with enough visibility it will get looked at. Alternatively I need to upgrade to a newer machine.


----------



## SirDice (Sep 25, 2018)

Is it the same Geforce 320M card? That would indeed need the -340 version. Looking at the ACPI errors, did you enable ACPI_PM? Try turning that off.


----------



## tehpeh (Oct 1, 2018)

Today I tried building the port and toggling each of the options on and off ACPI_PM, LINUX, and WBINVD, but I still get a crash when running `startx`.


----------



## Hakaba (Dec 23, 2019)

Same issue here with freebsd 12.0 in a Macbook Pro 2009 (NVidia 8600GT).
Did you find the solution ?


----------



## tehpeh (Dec 23, 2019)

For me on the Mac mini, no. SCFB was fine but made the poor little thing run hot and slow.

Apple hardware contains too much proprietary hardware to run open source operating systems. A 2009 Macbook is getting on now, so I'm sad to say you might not find a solution.

I eventually bought an HP small profile desktop. It's much cheaper than anything Apple can put out, and it's faster with a desktop class CPU, 32GB RAM and SSD.

(The Mac mini was re-purposed with VMWare ESXi running pfSense and Ubiquiti UniFi via FreeBSD of course)


----------



## Hakaba (Dec 24, 2019)

For me, the issue is related with nvidia card/driver.
There is a wiki page to install freebsd on the previous macbook pro version (with ati graphic card) and this thread for the next generation : https://forums.freebsd.org/threads/apple-macbook-pro-touchpad-configuration.50170/

I will try to install nvidia-driver-304 instead of 340.

I investigate a little in the linux world if there some special things to do with old nvidia mac.


> Apparently what is happening is that both the open source and Nvidia drivers are buggy when doing an "EFI Install" on Mac machines. If full graphics performance is desired, a "Legacy BIOS Install" is needed.



Source : https://sts10.github.io/linux-book/installing-ubuntu-on-an-old-macbook-pro.html


----------



## Hakaba (Dec 24, 2019)

I found a another info :








						Proprietary NVidia drivers with EFI on Mac, to prevent overheating
					

I have a dual-boot Mac OS X 10.8 and Kubuntu 12.10 64x on my white MacBook from mid-2010  installed. (Model identifier: MacBook7,1 . I have upgraded my RAM from 2GB to 8GB, if that matters.) I have...




					askubuntu.com
				




I really don't know how to this with freebsd...
But maybe that hack will do the job.


----------



## SirDice (Dec 24, 2019)

Just install the appropriate x11/nvidia-driver, x11/nvidia-driver-304, x11/nvidia-driver-340, x11/nvidia-driver-390. They all install the propriatory driver from NVidia.


----------



## Hakaba (Dec 24, 2019)

I have installed nvidia-driver-340 according to the Nvidia website.
Since then startx reboot the macbook. That is why I investigate on this bug.


----------

