# [WORKAROUND] Thinkpad x220: restart on shutdown (on battery)

## Khumarahn

Hi.

When I ask my laptop to shutdown (say, with "shutdown -h now"), it shuts down, and starts again in half a second, as if I was rebooting it. This only happens when on battery power.

After some search I found that issue may be related to e1000e module, or to laptop-more-tools, or old kernel. However, for me blacklisting e1000e and not starting laptop-mode, and running kernel as new as gentoo-sources-3.3.2 has no effect on this issue.

How would you track down the origin of the problem?Last edited by Khumarahn on Fri Apr 20, 2012 11:33 pm; edited 2 times in total

----------

## Veldrin

I own a X220, and it works fine, even on battery.

what happens if you use just shutdown now, or init 0?

V.

----------

## Khumarahn

If I "shutdown now", computer goes down and asks for a root password for maintenance, or ctrl-D for continue; "init 0" works just like "shutdown -h now", computer restarts after shutting down.

There may be many x220 laptops that are different in hardware.. Would you mind posting your configuration to compare with mine? This might give some idea on what causes the issue.

```

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)

00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)

00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)

00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)

00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)

00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)

00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)

03:00.0 Network controller: Intel Corporation Centrino Advanced-N + WiMAX 6250 (rev 5e)

0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 07)

```

```

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor

Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller

Bus 001 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd 

Bus 002 Device 003: ID 8086:0187 Intel Corp. 

Bus 002 Device 004: ID 056a:0090 Wacom Co., Ltd TPC90

```

----------

## Khumarahn

Veldrin, what bootloader do you use? I use grub2-beta3 with EFI... may this be related?

----------

## Veldrin

Could not be the bootloader, as it is only responsible for booting the device. But there may be something funny in BIOS/EFI settings.

I also use a grub2 setup.

there you go. though I would be surprised if it was one of the integrated devices.

```
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)

00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)

00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)

00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)

00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)

00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b4)

00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)

00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)

03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)

0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 07)

0e:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor

Bus 001 Device 006: ID 0a5c:217f Broadcom Corp. Bluetooth Controller

Bus 001 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo Integrated Camera (0.3MP)

Bus 002 Device 004: ID 0bdb:1911 Ericsson Business Mobile Networks BV 
```

I quickly looked through the device: the only differences I could find is the NEC USB3 controller and the Ericsson WWAN modem that are in addition on my system, and the different WLAN chips (6205 vs 6250).

Where does your Wacom device come from? 

V.

----------

## Khumarahn

Thank you! Differences are minor, indeed. My wacom comes from a touchscreen -  my x220 is a convertible tablet.

I wonder if it is possible to get some logs that would tell why it reboots.

```

@@ -1,6 +1,7 @@

 00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

 00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

+00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)

 00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)

 00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

 00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)

@@ -8,22 +9,19 @@

 00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)

 00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)

 00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)

-00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b4)

 00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

 00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)

 00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)

 00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)

-03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)

+03:00.0 Network controller: Intel Corporation Centrino Advanced-N + WiMAX 6250 (rev 5e)

 0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 07)

-0e:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

 

 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

-Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

-Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

 Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

 Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor

-Bus 001 Device 006: ID 0a5c:217f Broadcom Corp. Bluetooth Controller

-Bus 001 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo Integrated Camera (0.3MP)

-Bus 002 Device 004: ID 0bdb:1911 Ericsson Business Mobile Networks BV

+Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller

+Bus 001 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd

+Bus 002 Device 003: ID 8086:0187 Intel Corp.

+Bus 002 Device 004: ID 056a:0090 Wacom Co., Ltd TPC90

```

----------

## Khumarahn

Veldrin, can you also share your kernel .config?

----------

## Khumarahn

For some reason my computer has been shutting down fine when on battery. It was surprising. I was rebooting it, monitoring /var/log/messages, and trying to figure out, what has changed. Then I saw some unusual logs, after which laptop rebooted after shutdown again.

```

Apr 20 15:21:13 sinkpad laptop-mode: Laptop mode 

Apr 20 15:21:13 sinkpad laptop-mode: disabled, not active

Apr 20 15:21:14 sinkpad kernel: [ 1017.450667] e1000e 0000:00:19.0: eth0: Unsupported Speed/Duplex configuration

Apr 20 15:21:14 sinkpad kernel: [ 1017.454574] e1000e 0000:00:19.0: eth0: Unsupported Speed/Duplex configuration

Apr 20 15:21:15 sinkpad nobody: ACPI event unhandled: battery BAT0 00000080 00000001

Apr 20 15:21:18 sinkpad kernel: [ 1022.026860] ehci_hcd 0000:00:1a.0: power state changed by ACPI to D3

Apr 20 15:21:19 sinkpad kernel: [ 1022.139917] ehci_hcd 0000:00:1d.0: power state changed by ACPI to D3

Apr 20 15:21:49 sinkpad dbus[3039]: [system] Activating service name='org.freedesktop.UPower' (using servicehelper)

Apr 20 15:21:49 sinkpad dbus[3039]: [system] Successfully activated service 'org.freedesktop.UPower'

Apr 20 15:21:50 sinkpad kernel: [ 1053.625574] ata1: hard resetting link

Apr 20 15:21:50 sinkpad kernel: [ 1053.944825] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

Apr 20 15:21:50 sinkpad kernel: [ 1053.946057] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (unknown) succeeded

Apr 20 15:21:50 sinkpad kernel: [ 1053.946069] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (unknown) filtered out

Apr 20 15:21:50 sinkpad kernel: [ 1053.946076] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (unknown) filtered out

Apr 20 15:21:50 sinkpad kernel: [ 1053.948218] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (unknown) succeeded

Apr 20 15:21:50 sinkpad kernel: [ 1053.948238] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (unknown) filtered out

Apr 20 15:21:50 sinkpad kernel: [ 1053.948244] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (unknown) filtered out

Apr 20 15:21:50 sinkpad kernel: [ 1053.949101] ata1.00: configured for UDMA/100

Apr 20 15:21:50 sinkpad kernel: [ 1053.949262] ata1: EH complete

Apr 20 15:21:51 sinkpad kernel: [ 1054.141471] EXT4-fs (sda3): re-mounted. Opts: commit=600

Apr 20 15:22:00 sinkpad shutdown[8568]: shutting down for system halt

Apr 20 15:22:00 sinkpad init: Switching to runlevel: 0

Apr 20 15:22:02 sinkpad ntpd[3189]: ntp engine exiting

Apr 20 15:22:02 sinkpad ntpd[3188]: Terminating

Apr 20 15:22:02 sinkpad fcron[3169]: SIGTERM signal received

Apr 20 15:22:02 sinkpad fcron[3169]: Exiting with code 0

Apr 20 15:22:03 sinkpad lightdm: pam_unix(lightdm-autologin:session): session closed for user khu

Apr 20 15:22:03 sinkpad su[5618]: pam_unix(su:session): session closed for user root

Apr 20 15:22:03 sinkpad kernel: [ 1066.743281] ehci_hcd 0000:00:1d.0: power state changed by ACPI to D0

Apr 20 15:22:03 sinkpad polkitd(authority=local): Unregistered Authentication Agent for unix-session:/org/freedesktop/ConsoleKit/Session1 (system bus name :1.11, object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.utf8) (disconnected from bus)

Apr 20 15:22:03 sinkpad kernel: [ 1066.756611] ehci_hcd 0000:00:1d.0: power state changed by ACPI to D0

Apr 20 15:22:03 sinkpad kernel: [ 1066.756676] ehci_hcd 0000:00:1d.0: power state changed by ACPI to D0

Apr 20 15:22:03 sinkpad kernel: [ 1066.756680] ehci_hcd 0000:00:1d.0: power state changed by ACPI to D0

Apr 20 15:22:03 sinkpad kernel: [ 1066.756693] ehci_hcd 0000:00:1d.0: setting latency timer to 64

Apr 20 15:22:04 sinkpad dhcpcd[8911]: dhcpcd not running

Apr 20 15:22:04 sinkpad kernel: [ 1067.680534] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

Apr 20 15:22:04 sinkpad kernel: [ 1067.680681] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0

Apr 20 15:22:04 sinkpad kernel: [ 1067.884717] iwlwifi 0000:03:00.0: L1 Disabled; Enabling L0S

Apr 20 15:22:04 sinkpad kernel: [ 1067.884864] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0

Apr 20 15:22:05 sinkpad dhcpcd[8917]: dhcpcd not running

Apr 20 15:22:05 sinkpad acpid: exiting

Apr 20 15:22:05 sinkpad syslog-ng[3074]: Termination requested via signal, terminating;

Apr 20 15:22:05 sinkpad syslog-ng[3074]: syslog-ng shutting down; version='3.2.5'

```

So I guess the issue has something to do wiith e1000e, ehci_hcd or ata1 ?

----------

## Khumarahn

Aha!

Compiling e1000e and ehci-hcd as modules and removing them on shutdown helped! Check out my script.

I see now, this is not a new problem on the internet, and some knew already that ehci-hcd causes trouble..... I am running laptop-mode just fine now.

```

khu@sinkpad ~ $ cat /etc/init.d/unload-modules-khu 

#!/sbin/runscript

# Copyright 1999-2012 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: $

depend() {

   before *

}

start() {

   ebegin "Starting unload-modules-khu (nothing to do on start)"

   eend $?

}

stop() {

   ebegin "Stopping unload-modules-khu"

   rmmod ehci-hcd || ewarn "cannot unload ehci-hcd"

   rmmod e1000e || ewarn "cannot unload e1000e"

   eend 0

}

khu@sinkpad ~ $ 

```

```

rc-update add unload-modules-khu boot

```

----------

## Zarhan

I've also ran into this issue. As a matter of fact, what happens for me is that if I do a "shutdown -h" - the OS shuts down and then - the BIOS resumes processing like it never booted into the OS in the first place - meaning it will try booting from CD and from net via PXE. Thanks for this thread, I'll try to unload those modules. 

Running Thinkpad W510.

----------

