What does "safe mode" do, exactly?

cracauer@

Developer
Anybody knows what the kernel boot option "safe mode" does, exactly? And maybe how I can apply the same effect to random kernel modules loaded later?

I have this laptop, a 15" LG Gram with a 12th gen Intel i7. In non-safe mode it hangs in kernel boot. In safe mode it manages to get to working single user mode. But when going multiuser from there, there is again a hang, when loading kernel modules from /etc/rc. Just hangs, no panic.

Seems annoying to debug.
 
Modules specified in /boot/loader.conf get loaded. As soon as kernel finishes and init starts no other services are started, single shell is spawned by init. No other filesystems but / is mounted. Basically you're loading kernel only (with its configuration) and the only "service" is shell. You could go even simplier - unload the kernel from bootprompt (bootloader), specify what kernel and/or modules to load ( not needed in your case ).

And maybe how I can apply the same effect to random kernel modules loaded later?

I'd simplify /etc/rc.conf to its minimum (hostname, ip). Check what services are started that would require modules to be loaded (virtualbox, bhyve, graphics driver options..).

If I have to put wager I'd start with the graphics driver (which I have very little experience with). Check what services/options are in rc.conf, remove those, try that way. Or maybe even blacklist given module from loading.
Other option would be to manually start services from single mode as defined in rc.conf trying to hit the issue. Just remember that / is read-only by default and filesystems are not mounted.
 
Modules specified in /boot/loader.conf get loaded. As soon as kernel finishes and init starts no other services are started, single shell is spawned by init. No other filesystems but / is mounted. Basically you're loading kernel only (with its configuration) and the only "service" is shell.

I think you are mixing up single user mode and safe mode. Safe mode does something to the probing of hardware (I think), but it boots through to multi-user (unless you also requested single user mode).
 
Hmmm...

Code:
        loader.setenv("kern.smp.disabled", "1")
        loader.setenv("hw.ata.ata_dma", "0")
        loader.setenv("hw.ata.atapi_dma", "0")
        loader.setenv("hw.ata.wc", "0")
        loader.setenv("hw.eisa_slots", "0")
        loader.setenv("kern.eventtimer.periodic", "1")
        loader.setenv("kern.geom.part.check_integrity", "0")

Could go through that list and isolate the one that matters to my laptop. But then I still wouldn't be able to do anything about it. I don't think I want to run with SMP off (although it would mitigate a lot of hardware security problems...).
 
It's a pity, with older notebook with rs232 port you'd be able to enable serial console and drop to debugger, debug with other machine.

It's not too many options to test manually though; I wonder if evettimer is a culprit (broken apic implementation ? ).
 
Absolute FreeBSD-3ed:
FreeBSD’s safe mode turns on just about every conservative option in the operating system. It turns off DMA and write caching on hard disks, limiting their speed but increasing their reliability. It turns off ACPI. 32-bit systems disable SMP. USB keyboards no longer work in safe mode. This option is useful for debugging older hardware.
 
Did you try to isolate it and specify one of those toggled on option in safe mode manually ? SMP or event timer.
On a topic of troubleshooting: did previous syslog leave any traces of what might have been going on ?
 
Did you try to isolate it and specify one of those toggled on option in safe mode manually ? SMP or event timer.
On a topic of troubleshooting: did previous syslog leave any traces of what might have been going on ?

There's no previous run, this thing never ran FreeBSD and has never made it into multiuser mode. It also has ACPI problems under Linux. I think the only debugging left to do is put it on Ebay.
 
No boot. "panic: running without device atpic requires a local ACPI".

Are you sure it doesn't say "... requires a local APIC" (Advanced Programmable Interrupt Controller) rather than ACPI (Advanced Configuration and Power Interface)?

$earch 'local apic mode' for the gory details.

Unless it's changed, I don't think 64-bit FreeBSD will boot with ACPI disabled.
 
Back
Top