# "shutdown -p now" doesn't work in multi-user mode



## sickboy (Sep 10, 2011)

Hi there,

I'm running FreeBSD 8.2 STABLE (i386) on a Samsung NC-10. Unfortunately, [cmd=]shutdown -p now[/cmd] doesn't turn off the machine. When I boot in single-user mode it works just fine.

In single-user mode:

```
# kldstat
kernel
sound.ko
snd_hda.ko
coretemp.ko
ahci.ko
```

In multi-user mode:

```
# kldstat
sound.ko
snd_hda.ko
coretemp.ko
ahci.ko
umodem.ko
ng_ubt.ko
ng_hci.ko
ng_bluetooth.ko
netgraph.ko
ng_l2cap.ko
ng_btsocket.ko
ng_socket.ko
```

dmesg says:

```
kldload: can't load ng_ubt: File exists
kldload: can't load ng_ubt: File exists
kldload: can't load ng_ubt: File exists
[...]
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
```

I guess it has something to do with Bluetooth. How can I avoid loading any Bluetooth modules at start-up, since I don't need it (and I can't disable it in BIOS)? I tried to comment Bluetooth-specific modules in my kernel conf, but couldn't find any.


----------



## da1 (Sep 11, 2011)

Have a look in /boot/loader.conf.


----------



## sickboy (Sep 11, 2011)

?

```
/boot/loader.conf:

ahci_load="YES"
autoboot_delay="5"
loader_color="YES"
loader_logo="beastie"
if_ath_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"

kern.maxfiles=16384
kern.maxfilesperproc=8192

sound_load="YES"
snd_hda_load="YES"

coretemp_load="YES"
```


----------



## da1 (Sep 11, 2011)

What error do you get when doing the shutdown command ?


----------



## sickboy (Sep 11, 2011)

Never mind. I started powerd and power is off after system halt, now.


----------



## wblock@ (Sep 11, 2011)

powerd(8) doesn't do system power, it controls CPU power saving.  A GENERIC kernel has those wireless modules built in, it's not necessary to load them unless you have a custom kernel.  And wlan_wep should not be necessary at all, since no one on the planet should be using WEP any more.


----------



## sickboy (Sep 11, 2011)

Yeah, you're right. I did a [cmd=]shutdown -p now[/cmd] via ssh and system power turned off after system halt (like in single user mode). It has nothing to do with powerd.

Which devices I've to comment in my kernel conf?


----------



## wblock@ (Sep 11, 2011)

sickboy said:
			
		

> Yeah, you're right. I did a [cmd=]shutdown -p now[/cmd] via ssh and system power turned off after system halt (like in single user mode). It has nothing to do with powerd.
> 
> Which devices I've to comment in my kernel conf?



If you're using a GENERIC kernel, just remove the "wlan" entries from loader.conf.  Might also consider that for the maxfiles entries unless they have a specific reason to be there.


----------



## sickboy (Sep 11, 2011)

I'm using a custom kernel. Commenting the wlan entries in loader.conf doesn't help. Power off only happened one time on ssh.


----------



## wblock@ (Sep 11, 2011)

Start by removing all the unnecessary stuff from /boot/loader.conf.

```
ahci_load="YES"
autoboot_delay="5"
loader_color="YES"
loader_logo="beastie"
if_ath_load="YES"
snd_hda_load="YES"
coretemp_load="YES"
```
Does coretemp(4) work on an Atom?  I don't know.

Modules built into a custom kernel are part of that kernel and should not be loaded in loader.conf.  (They can't/won't load, it will show an error as in post #1.)

Bluetooth modules are activated by devd(8).  Those sections can be commented in /etc/devd.conf, lines 90-98.  Don't forget to restart devd after changing that file.
`# service devd restart`


----------



## francis (Sep 11, 2011)

Hi, since You can display some informations about any file using the ls(1) command, You can see that the shutdown(8) command belongs to two groups; *root* and *operator*. Please try to add user to the *operator* group by using pw() utility. [1] 

`$ ls -lo /sbin/shutdown`

```
-r-sr-x---  1 root  operator  schg 10924 19 jul  2010 /sbin/shutdown
```

[1] You can add user to the *operator* group using e.g. this command;

`# pw usermod sickboy -G wheel,operator`

I suggest typing two groups, because when You will add user only to e.g. *operator* group, user will be only in this one group. As we know being in the *wheel* group is very important for many reasons, right? After reboot, You will be able to shutdown and reboot the system as a normal user.


----------



## sickboy (Sep 16, 2011)

Thank you for your suggestions, but it didn't help. Machine still doesn't turn off power after
[cmd=]# shutdown -p now[/cmd]


----------



## Yacki (Sep 16, 2011)

http://www.freebsd.org/cgi/man.cgi?query=acpi&sektion=4

That may help you.


----------



## francis (Sep 16, 2011)

Hi, *jacky* was faster (-: Exactly - maybe you should try with acpi(4) or apm(4)/apm(8)? Since both are responsible for managing power usage, you have to experiment with both. But remember, "_this is not very reliably supported under FreeBSD_", so unfortunately they may work or they may not work. Here you will find more informations;
Power management FreeBSD on Laptops chapter about both; *acpi* and *apm*.
FreeBSD and Laptops This article discuss about some issues about FreeBSD, laptops, different hardware requirements from desktops etc.
Laptops compatibility lists Here you will find informations, that Samsung is fully working with *acpi* but don't known how with *apm* (E.g. you can leave experiments with *apm* and focus only on *acpi*).
Using and debugging ACPI This document should help you with general FreeBSD *ACPI* issues.
ACPI problem Similar problem.

*Note;* "_Power management requires acpi(4) support in the kernel or loaded as module for"._

One more thing. You can try out PC-BSD DVD Live Mode or live USB version. More info you can find here DVD Live Mode. Like any live DVD, you can check for example PC-BSD's /boot/device.hints, /boot/loader.conf, /etc/rc.conf files or maybe sysctl variables for various settings according to *acpi* or even loaded modules with kldstat(8) utility etc. 

Because Live mode is meant to provide an environment for testing hardware, so generally you should check how PC-BSD solved issues with shutting down system. Of course you can try to restart/shutdown PC-BSD with already mentioned commands; shutdown -p now, shutdown -p, and check what happen etc.

*[* Download PC-BSD 8.2 *]* 

By the way. After all, you could try shutdown -p without now or even shutdown -h (more info; shutdown(8)) on FreeBSD. But it is only guessing. I hope those informations will be useful for you to find a solution. 
Best regards!


----------

