# [pfSense] What exactly is that "Safe mode"



## Patrix87 (Jun 8, 2016)

Hi,

I posted this here because it is more related to FreeBSD than to pfSense.

I'm having an issue with FreeBSD and pfSense where I can only launch pfSense when going in that loader and selecting safemode *(not single user but safe mode, there's that option)

Anyway I went through all the troubleshooting steps and spent at least 4 hours on Google without success.

So I would like to know what is that "Safe mode" exactly ?

What does it disable or enable or change in the boot process for pfSense to launch instead of crashing and rebooting.

I went in the documentation section but I could not find anything about "safe mode".

Thanks


----------



## SirDice (Jun 8, 2016)

From /boot/menu-commands.4th:

```
\
\ Safe Mode
\

: safemode_enabled? ( -- flag )
        s" kern.smp.disabled" getenv -1 <> dup if
                swap drop ( c-addr flag -- flag )
        then
;

: safemode_enable ( -- )
        s" set kern.smp.disabled=1" evaluate
        s" set hw.ata.ata_dma=0" evaluate
        s" set hw.ata.atapi_dma=0" evaluate
        s" set hw.ata.wc=0" evaluate
        s" set hw.eisa_slots=0" evaluate
        s" set kern.eventtimer.periodic=1" evaluate
        s" set kern.geom.part.check_integrity=0" evaluate
;

: safemode_disable ( -- )
        s" kern.smp.disabled" unsetenv
        s" hw.ata.ata_dma" unsetenv
        s" hw.ata.atapi_dma" unsetenv
        s" hw.ata.wc" unsetenv
        s" hw.eisa_slots" unsetenv
        s" kern.eventtimer.periodic" unsetenv
        s" kern.geom.part.check_integrity" unsetenv
;
```

Not everything is documented. Sometimes you just have to read the source.


----------



## kpa (Jun 8, 2016)

Ok, SirDice was quicker  Looking at the tunables the safemode sets it's not very useful unless you have a truly buggy and broken BIOS on an old machine. For example need to disable SMP is practically unheard of now. Second one is that those ATA tunables have no effect at all on modern SATA controllers and drives. So it's nothing like the safe mode you might be used to on Microsoft Windows that loads a set of very slow but reliable drivers that are guaranteed to work in case you make a boo boo with a driver installation.


----------



## Patrix87 (Jun 8, 2016)

set kern.smp.disabled=1 worked 

Thanks

Now my problem is that if I try to make the change permanent it won't work...

here's the command I used in the loader prompt :

`echo "kern.smp.disabled=\"1\"" >> /boot/loader.conf.local`

I also tried :

`echo "kern.smp.disabled=1" >> /boot/loader.conf.local`

Still doesn't seem to save the change.


----------



## Patrix87 (Jun 8, 2016)

I finally used the easy editor *EE command in the pfSense shell to edit /boot/loader.conf and I added the line and now it is working.

Thanks a lot


----------



## kpa (Jun 8, 2016)

I'm curious to know what kind of hardware is this? As I noted disabling SMP is a drastic measure and is very rarely needed.


----------



## Patrix87 (Jun 8, 2016)

kpa said:


> I'm curious to know what kind of hardware is this? As I noted disabling SMP is a drastic measure and is very rarely needed.



Acer G43T-AM V2.0 motherboard from a Gateway DX4822 computer with a very limited AMI Bios.

2Gb DDR2 667mhz 

HDD seagate 80Gb Sata 3 refurbished

Intel Pentium Duo E5400

TPLink TG3468 Gigabit ethernet

Nice whiteish case from the 90s

400W psu


----------



## kpa (Jun 8, 2016)

Ok that explains it to a degree, those type of machines were designed to run MS Windows only pretty much.


----------



## Patrix87 (Jun 8, 2016)

I don't need extreme performances anyway, so it's no big deal for me.


----------

