# Cannot shutdown/reboot after upgrade to 13.0-RELEASE



## fireinthebush (May 2, 2021)

Hello,

I'm having a similar problem to the one described in this thread:









						Solved - FreeBSD 13 does not shut down my laptop
					

Hello.  Got a weird bug with my new FreeBSD 13.0 installation. 12.2 version of FreeBSD did shut down my laptop OK, but 13.0 (i used 13.0 from -BETA1) does not. Laptop reboots instead of shutting down. How can I fix that, and which additional info i need to provide about my hardware?  Thank you.




					forums.freebsd.org
				




I upgraded the install on my hosted VM server from 12.2 to 13.0-RELEASE and can no longer shutdown or reboot. The system hangs after "uhub0: detached," and I have to send a hard reset or power off from my hosting provider. In my case, however, setting hw.efi.poweroff to "0" doesn't resolve the issue.

Here's my output from `uname -a` so you can see that I'm using the generic amd64 kernel:

FreeBSD xxx.yyy.com 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

Any ideas, things to try? Any help would be hugely appreciated.


----------



## astyle (May 3, 2021)

The difference between the thread you quoted and you is that you're running FreeBSD as a guest in a VM.  I can point to FreeBSD Handbook Ch. 22 on virtualization, but that place is a little outdated (mentions hal (Hardware Abstraction Layer), which is done differently in 13.0 than earlier).

I have not played with virtualization recently, but from some of my old notes, FreeBSD does have an annoying tendency to not shut down cleanly inside a VM.  My educated guess is that the VM has some weird settings that don't match what the generic amd64 kernel expects. I think it would be good to find out the VM settings, and try to match the kernel config to those settings. Doing it the other way around (matching VM settings to default kernel config) is not always easy.


----------



## SirDice (May 4, 2021)

astyle said:


> but that place is a little outdated (mentions hal (Hardware Abstraction Layer), which is done differently in 13.0 than earlier).


It mentions some configurations you can set _if_ you use HAL. Not that HAL is required. Shutdown of a VM is done through ACPI, just like regular hardware. This has nothing to do with the version of FreeBSD or HAL. 



fireinthebush said:


> The system hangs after "uhub0: detached," and I have to send a hard reset or power off from my hosting provider.


Try setting `hw.usb.no_shutdown_wait="1"` in /boot/loader.conf. For some reason there's something attached to the USB and it's causing the shutdown to stall on it. I've had this happen on "real" hardware too when there was a certain external HD attached to the USB.


----------



## T-Daemon (May 4, 2021)

fireinthebush said:


> The system hangs after "uhub0: detached," and I have to send a hard reset or power off from my hosting provider.


It looks like it's being worked on the problem: Comment #18, PR 253175

Meanwhile this might be of use for you:

I have observed in a VirtualBox (6.1.20) FreeBSD 12.2 host and FreeBSD 13.0-RELEASE guest VM, EFI system setting, `shutdown -p now` (or `poweroff`) won't shutdown the VM. It waits at `uhub0: detached` indefinetly. Setting `hw.kern.efi.poweroff=0` helps to resolves the issue.

In the same VM I disabled the USB controller. Without the above sysctl(8) setting it hangs at

```
All buffers synced.
Uptime: xxx
```

It seems there are situations in which a none USB related issue is at work (referring here to SirDice's post #3), preventing the machine to power off.

Here comes the interesting part: Setting the VM's system chip set to _ICH9_ (instead of the default _PIIX3_), with enabled USB controller, and default `hw.efi.poweroff=1` the VM powers off immediate after `uhub0: detached`.

Apparently there is a relation between the chip set in use and a complete power off of the VM.

fireinthebush, if there is an option to change the chip set on the hosted VM try that.


----------



## fireinthebush (May 6, 2021)

Thanks so much, all, for your thoughtful replies. 

SirDice, I was able to get the shutdown sequence to advance beyond "uhub0: detached" to "Rebooting" (or something like that), but it still wouldn't restart.

T-Daemon, I have a query in with my hosting provider to look into this. Will report back.


----------

