# Computer automatically reboots after shutdown

## Ghoraab

Hello all.

I am stuck on a problem and I do not know what to do next, so I am looking for some hints and/or solutions.

I have the problem that my system reboots after I have told it to shut down. This problem affects all tested kernels 4.2.2, 4.0.5, 3.18.9 and 3.12.10 and occurs after an "intentional" reboot or cold start. After the computer is shut down and restarts itself after 1 or 2 two seconds ("unintentional" reboot), the next time the shutdown works.

Both ways of shutting down, via KDE GUI and shutdown -h now are affected in the same way. 

The problem does not occur when I boot with an old Gentoo live USB stick (Gentoo live, Syslinux 4.07, 2013-07-25, kernel version 3.10.7-11), with a Kubuntu live system (Kubuntu 14.10, kernel version 3.16.0-23) or Windows 7, so I suspect it to be a Gentoo-only problem. 

If I unplug the network cable the problem is gone. When shutting down the LED of my switch to which the computer is connected goes black for a second, lights up again and then, a second later, the computer reboots without being turned on. In the case when it stays turned off, the LED just goes black without turning on again.

The network adapter is a Realtek RTL8111/8168/8411 PCI Express Gigabit, the firmware driver is properly installed in the kernel. 

The problem occurs since I had to exchange my old mainboard GA-Z77P-D3 for a new GA-Z97P-D3 due to a defect. In the BIOS (Firmware version F8, 18.9.2015) power on by keyboard, password and mouse are turned off. Erp is enabled, platform power management is disabled. 

Given the fact that the other linux systems do not have this problem, I guess there'll be some problem with my kernel configuration. I found one similar thread  here , but without any solution. 

I'd be glad if someone could point me in some direction.

Regards

Marius

edit: Link syntax corrected

----------

## limn

Take a look at the Wake-on-LAN settings in the BIOS. Perhaps run ethtool on the device.

----------

## Ghoraab

ErP is enabled. This means that wake on LAN is disabled (sais the manual).

I ran ethtool and found that Wake-on is set to g (wake on magic package). I have set it to d (disabled). The computer does not shutdown if I set wake-on to d, but instead reboots as before. After the reboot, however, the Wake-on in ethtool is set back to g.

----------

## limn

Do you have a spare ethernet card you try instead of the onboard?

----------

## Ghoraab

Found an old Realtek RTL-8100/8101L/8139. Using this one the problem's gone. Where does this point to? Can't be a general kernel problem anymore, can it?

----------

## limn

Apparently a problem in the WOL interface of the onboard ethernet. The device probably has residual power in the 1-2 seconds.

If the driver is compiled into your kernel you could try making it a module. The live versions probably use modules. We've seen that make a difference in device behavior.

You might also try installing Kubuntu in place of Gentoo, trying to match kernel versions and so forth, as closely as possible.

That it stays down after an "unintentional" reboot is probably telling us something important.

----------

## Logicien

What about disable WOL and network boot in the Bios or Efi/Bios?

----------

## Ghoraab

 *limn wrote:*   

> Apparently a problem in the WOL interface of the onboard ethernet. The device probably has residual power in the 1-2 seconds.
> 
> 

 

I could very well imagine this. Through my research I came to know that this particular ethernet card is not the most favourite of linux users. There seem to be a lot of problems. 

 *limn wrote:*   

> 
> 
> If the driver is compiled into your kernel you could try making it a module. The live versions probably use modules. We've seen that make a difference in device behavior.
> 
> 

 

I removed all ethernet card drivers from my system, including the firmware blobs. No network but clean shutdown. Then I compiled r8169 module in my kernel which is reported to work with the r8168 card. The card worked but "unintentional" reboots again. If I rmmod the module before the shutdown everything works as it should. 

Then I removed the ethernet card drivers again and tried with the firmware blob again. No network. Obviously I was mistaken when I wrote that the firmware is installed correctly. 

I emerged linux-firmware and included all rtl8168-x.fw and rtl8144-x.fw files in my kernel. No network. When searching for solutions I came across Realteks site with the official drivers. There are no drivers for kernel version 4.x, just 3.x. Maybe the firmware in linux-firmware is not suited for 4.x kernel? Where can I find that out?

 *limn wrote:*   

> 
> 
> You might also try installing Kubuntu in place of Gentoo, trying to match kernel versions and so forth, as closely as possible.

 

Honestly, I'd rather not. I will probably (and hopefully) end up with a system that works without knowing why. 

 *limn wrote:*   

> 
> 
> That it stays down after an "unintentional" reboot is probably telling us something important.

 

Yes, but I don't have a clue what it might tell. Unfortunately. 

Thanks for your support so far. @Logicien: Is disabled. See posts above.

edit: corrected found typos

----------

