Laptop doesn't suspend properly on closing lid
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I'm running Ubuntu 16.04 LTS on my Lenovo G50 and everything is going fine except that I can't close the lid of my laptop without needing to reboot afterwards. When I close the lid (or if I run pm-suspend
), my laptop screen goes dark for a few seconds, then turns back on.
The problem is that when I try resuming it, my laptop basically turns into a potato... For some reason, the network manager (both wifi and ethernet) doesn't work whatsoever, the terminal becomes extremely slow and I can't run any command using sudo
because it will hang there forever.
I've tried changing the logind.conf
file, I've tried changing the Power System Settings
, I've updated my Intel Graphics driver, I've installed tools like pmi
or laptop-mode
... I'm running out of ideas but I would do anything to fix this issue.
If there's any system information that could be useful, let me know and I'll add it to the post.
suspend power-management lenovo
add a comment |
I'm running Ubuntu 16.04 LTS on my Lenovo G50 and everything is going fine except that I can't close the lid of my laptop without needing to reboot afterwards. When I close the lid (or if I run pm-suspend
), my laptop screen goes dark for a few seconds, then turns back on.
The problem is that when I try resuming it, my laptop basically turns into a potato... For some reason, the network manager (both wifi and ethernet) doesn't work whatsoever, the terminal becomes extremely slow and I can't run any command using sudo
because it will hang there forever.
I've tried changing the logind.conf
file, I've tried changing the Power System Settings
, I've updated my Intel Graphics driver, I've installed tools like pmi
or laptop-mode
... I'm running out of ideas but I would do anything to fix this issue.
If there's any system information that could be useful, let me know and I'll add it to the post.
suspend power-management lenovo
add a comment |
I'm running Ubuntu 16.04 LTS on my Lenovo G50 and everything is going fine except that I can't close the lid of my laptop without needing to reboot afterwards. When I close the lid (or if I run pm-suspend
), my laptop screen goes dark for a few seconds, then turns back on.
The problem is that when I try resuming it, my laptop basically turns into a potato... For some reason, the network manager (both wifi and ethernet) doesn't work whatsoever, the terminal becomes extremely slow and I can't run any command using sudo
because it will hang there forever.
I've tried changing the logind.conf
file, I've tried changing the Power System Settings
, I've updated my Intel Graphics driver, I've installed tools like pmi
or laptop-mode
... I'm running out of ideas but I would do anything to fix this issue.
If there's any system information that could be useful, let me know and I'll add it to the post.
suspend power-management lenovo
I'm running Ubuntu 16.04 LTS on my Lenovo G50 and everything is going fine except that I can't close the lid of my laptop without needing to reboot afterwards. When I close the lid (or if I run pm-suspend
), my laptop screen goes dark for a few seconds, then turns back on.
The problem is that when I try resuming it, my laptop basically turns into a potato... For some reason, the network manager (both wifi and ethernet) doesn't work whatsoever, the terminal becomes extremely slow and I can't run any command using sudo
because it will hang there forever.
I've tried changing the logind.conf
file, I've tried changing the Power System Settings
, I've updated my Intel Graphics driver, I've installed tools like pmi
or laptop-mode
... I'm running out of ideas but I would do anything to fix this issue.
If there's any system information that could be useful, let me know and I'll add it to the post.
suspend power-management lenovo
suspend power-management lenovo
edited Sep 25 '18 at 1:13
muru
1
1
asked Feb 24 '18 at 18:25
theGirrafishtheGirrafish
1217
1217
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
To change close lid action in Ubuntu :
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo nano /etc/systemd/logind.conf
Change this line :
#HandleLidSwitch=ignore
To this line :
HandleLidSwitch=suspend
Make sure its commented out.
Alternately you can also add this line, but i prefer the first one :
HandleLidSwitchDocked=suspend
Then run :
sudo service systemd-logind restart
Or reboot.
To Troubleshoot the hibernate/suspend mode you should type following command in terminal :
dmesg|less
There is usually an entry what application caused the suspension to fail:
[32467.560058] Freezing of tasks failed after 20.01 seconds (1 tasks refusing to freeze, wq_busy=0):
[32467.560115] plasma-desktop D 0000000000000000 0 2065 1 0x00800004
Fix suspend on laptops
sudo apt-get install uswsusp
Now test suspend with :
sudo s2ram
If it doesn't work use :
sudo s2ram --force
Next edit this file :
sudo nano /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
Change code to :
#!/bin/sh
/sbin/s2ram --force
Edit :
Another fix :
Put a script in ' /etc/pm/sleep.d/ ' , scripts there will be run at suspend and resume. The file name should start with an ordering number, 00-49 for user scripts (for more details, see man pm-suspend).
The script could look like this
#!/bin/sh
(killall -9 mount.nfs; exit 0)
If you're having problems, check /var/log/pm-suspend.log that will log the attempt to suspend and to run your script.
Ubuntu Suspend not working FIX
Step 1:
Open up a terminal and create a script file as follows:
sudo nano /etc/pm/sleep.d/20_custom-ehci_hcd
Step 2:
Copy the entire script below into the file you just created and save it:
#!/bin/sh
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
#done
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "$1" in
hibernate|suspend)
unbindDev;;
resume|thaw)
bindDev;;
esac
Step 3:
Give the script run permissions by typing:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands usingsudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the commandreboot
makes the laptop hang on the shutdown screen)
– theGirrafish
Feb 24 '18 at 19:24
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
1
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
|
show 5 more comments
After reading around, I found that the issue was with the Qualcomm Atheros QCA6164 WiFi card used in many Lenovo laptops (G50-80 in my case). Ubuntu doesn't seem to have the proper firmware for this card which makes it act up.
I also found out that turning off the Wifi before closing my laptop would prevent everything from bugging, so I put that and the solution from this post together and created a file in /etc/acpi/
to handle the lid closing event.
Add the following code using sudo nano /etc/acpi/lid.sh
:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
nmcli radio wifi off
pm-suspend
else
nmcli radio wifi on
fi
Next, add the following lines using sudo nano /etc/acpi/events/lm_lid
:
event=button/lid.*
action=/etc/acpi/lid.sh
Now, uncomment and set the following line using sudo nano /etc/systemd/logind.conf
:
HandleLidSwitch=ignore
Finally, go into the System Settings > Power
and put all closing lid options to Do Nothing
.
Run the following to set the permissions and finalize the changes:
sudo chmod 755 /etc/acpi/lid.sh
sudo /etc/init.d/acpid restart
sudo service systemd-logind restart
Hopefully it works for you!
1
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1009387%2flaptop-doesnt-suspend-properly-on-closing-lid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To change close lid action in Ubuntu :
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo nano /etc/systemd/logind.conf
Change this line :
#HandleLidSwitch=ignore
To this line :
HandleLidSwitch=suspend
Make sure its commented out.
Alternately you can also add this line, but i prefer the first one :
HandleLidSwitchDocked=suspend
Then run :
sudo service systemd-logind restart
Or reboot.
To Troubleshoot the hibernate/suspend mode you should type following command in terminal :
dmesg|less
There is usually an entry what application caused the suspension to fail:
[32467.560058] Freezing of tasks failed after 20.01 seconds (1 tasks refusing to freeze, wq_busy=0):
[32467.560115] plasma-desktop D 0000000000000000 0 2065 1 0x00800004
Fix suspend on laptops
sudo apt-get install uswsusp
Now test suspend with :
sudo s2ram
If it doesn't work use :
sudo s2ram --force
Next edit this file :
sudo nano /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
Change code to :
#!/bin/sh
/sbin/s2ram --force
Edit :
Another fix :
Put a script in ' /etc/pm/sleep.d/ ' , scripts there will be run at suspend and resume. The file name should start with an ordering number, 00-49 for user scripts (for more details, see man pm-suspend).
The script could look like this
#!/bin/sh
(killall -9 mount.nfs; exit 0)
If you're having problems, check /var/log/pm-suspend.log that will log the attempt to suspend and to run your script.
Ubuntu Suspend not working FIX
Step 1:
Open up a terminal and create a script file as follows:
sudo nano /etc/pm/sleep.d/20_custom-ehci_hcd
Step 2:
Copy the entire script below into the file you just created and save it:
#!/bin/sh
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
#done
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "$1" in
hibernate|suspend)
unbindDev;;
resume|thaw)
bindDev;;
esac
Step 3:
Give the script run permissions by typing:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands usingsudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the commandreboot
makes the laptop hang on the shutdown screen)
– theGirrafish
Feb 24 '18 at 19:24
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
1
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
|
show 5 more comments
To change close lid action in Ubuntu :
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo nano /etc/systemd/logind.conf
Change this line :
#HandleLidSwitch=ignore
To this line :
HandleLidSwitch=suspend
Make sure its commented out.
Alternately you can also add this line, but i prefer the first one :
HandleLidSwitchDocked=suspend
Then run :
sudo service systemd-logind restart
Or reboot.
To Troubleshoot the hibernate/suspend mode you should type following command in terminal :
dmesg|less
There is usually an entry what application caused the suspension to fail:
[32467.560058] Freezing of tasks failed after 20.01 seconds (1 tasks refusing to freeze, wq_busy=0):
[32467.560115] plasma-desktop D 0000000000000000 0 2065 1 0x00800004
Fix suspend on laptops
sudo apt-get install uswsusp
Now test suspend with :
sudo s2ram
If it doesn't work use :
sudo s2ram --force
Next edit this file :
sudo nano /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
Change code to :
#!/bin/sh
/sbin/s2ram --force
Edit :
Another fix :
Put a script in ' /etc/pm/sleep.d/ ' , scripts there will be run at suspend and resume. The file name should start with an ordering number, 00-49 for user scripts (for more details, see man pm-suspend).
The script could look like this
#!/bin/sh
(killall -9 mount.nfs; exit 0)
If you're having problems, check /var/log/pm-suspend.log that will log the attempt to suspend and to run your script.
Ubuntu Suspend not working FIX
Step 1:
Open up a terminal and create a script file as follows:
sudo nano /etc/pm/sleep.d/20_custom-ehci_hcd
Step 2:
Copy the entire script below into the file you just created and save it:
#!/bin/sh
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
#done
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "$1" in
hibernate|suspend)
unbindDev;;
resume|thaw)
bindDev;;
esac
Step 3:
Give the script run permissions by typing:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands usingsudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the commandreboot
makes the laptop hang on the shutdown screen)
– theGirrafish
Feb 24 '18 at 19:24
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
1
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
|
show 5 more comments
To change close lid action in Ubuntu :
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo nano /etc/systemd/logind.conf
Change this line :
#HandleLidSwitch=ignore
To this line :
HandleLidSwitch=suspend
Make sure its commented out.
Alternately you can also add this line, but i prefer the first one :
HandleLidSwitchDocked=suspend
Then run :
sudo service systemd-logind restart
Or reboot.
To Troubleshoot the hibernate/suspend mode you should type following command in terminal :
dmesg|less
There is usually an entry what application caused the suspension to fail:
[32467.560058] Freezing of tasks failed after 20.01 seconds (1 tasks refusing to freeze, wq_busy=0):
[32467.560115] plasma-desktop D 0000000000000000 0 2065 1 0x00800004
Fix suspend on laptops
sudo apt-get install uswsusp
Now test suspend with :
sudo s2ram
If it doesn't work use :
sudo s2ram --force
Next edit this file :
sudo nano /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
Change code to :
#!/bin/sh
/sbin/s2ram --force
Edit :
Another fix :
Put a script in ' /etc/pm/sleep.d/ ' , scripts there will be run at suspend and resume. The file name should start with an ordering number, 00-49 for user scripts (for more details, see man pm-suspend).
The script could look like this
#!/bin/sh
(killall -9 mount.nfs; exit 0)
If you're having problems, check /var/log/pm-suspend.log that will log the attempt to suspend and to run your script.
Ubuntu Suspend not working FIX
Step 1:
Open up a terminal and create a script file as follows:
sudo nano /etc/pm/sleep.d/20_custom-ehci_hcd
Step 2:
Copy the entire script below into the file you just created and save it:
#!/bin/sh
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
#done
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "$1" in
hibernate|suspend)
unbindDev;;
resume|thaw)
bindDev;;
esac
Step 3:
Give the script run permissions by typing:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
To change close lid action in Ubuntu :
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo nano /etc/systemd/logind.conf
Change this line :
#HandleLidSwitch=ignore
To this line :
HandleLidSwitch=suspend
Make sure its commented out.
Alternately you can also add this line, but i prefer the first one :
HandleLidSwitchDocked=suspend
Then run :
sudo service systemd-logind restart
Or reboot.
To Troubleshoot the hibernate/suspend mode you should type following command in terminal :
dmesg|less
There is usually an entry what application caused the suspension to fail:
[32467.560058] Freezing of tasks failed after 20.01 seconds (1 tasks refusing to freeze, wq_busy=0):
[32467.560115] plasma-desktop D 0000000000000000 0 2065 1 0x00800004
Fix suspend on laptops
sudo apt-get install uswsusp
Now test suspend with :
sudo s2ram
If it doesn't work use :
sudo s2ram --force
Next edit this file :
sudo nano /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
Change code to :
#!/bin/sh
/sbin/s2ram --force
Edit :
Another fix :
Put a script in ' /etc/pm/sleep.d/ ' , scripts there will be run at suspend and resume. The file name should start with an ordering number, 00-49 for user scripts (for more details, see man pm-suspend).
The script could look like this
#!/bin/sh
(killall -9 mount.nfs; exit 0)
If you're having problems, check /var/log/pm-suspend.log that will log the attempt to suspend and to run your script.
Ubuntu Suspend not working FIX
Step 1:
Open up a terminal and create a script file as follows:
sudo nano /etc/pm/sleep.d/20_custom-ehci_hcd
Step 2:
Copy the entire script below into the file you just created and save it:
#!/bin/sh
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
#done
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "$1" in
hibernate|suspend)
unbindDev;;
resume|thaw)
bindDev;;
esac
Step 3:
Give the script run permissions by typing:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
edited Feb 24 '18 at 20:43
answered Feb 24 '18 at 18:54
An0nAn0n
979121
979121
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands usingsudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the commandreboot
makes the laptop hang on the shutdown screen)
– theGirrafish
Feb 24 '18 at 19:24
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
1
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
|
show 5 more comments
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands usingsudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the commandreboot
makes the laptop hang on the shutdown screen)
– theGirrafish
Feb 24 '18 at 19:24
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
1
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
I've tried every combination of those 2 but it still completely bugs out trying to suspend
– theGirrafish
Feb 24 '18 at 19:13
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
What you mean with bugs out ? What happen when you suspend manually ?
– An0n
Feb 24 '18 at 19:17
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands using
sudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the command reboot
makes the laptop hang on the shutdown screen)– theGirrafish
Feb 24 '18 at 19:24
If I try to suspend by any method, the network manager stops working, the terminal becomes extremely slow and I can't run any commands using
sudo
because it will hang indefinitely. I pretty much have no choice but to hard reboot my laptop (the command reboot
makes the laptop hang on the shutdown screen)– theGirrafish
Feb 24 '18 at 19:24
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
Use the trouble shoot method i descibed in my answer to check wich program cause your ubuntu to freeze/bug.
– An0n
Feb 24 '18 at 19:32
1
1
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
No problem, glad its fixed.
– An0n
Feb 24 '18 at 21:29
|
show 5 more comments
After reading around, I found that the issue was with the Qualcomm Atheros QCA6164 WiFi card used in many Lenovo laptops (G50-80 in my case). Ubuntu doesn't seem to have the proper firmware for this card which makes it act up.
I also found out that turning off the Wifi before closing my laptop would prevent everything from bugging, so I put that and the solution from this post together and created a file in /etc/acpi/
to handle the lid closing event.
Add the following code using sudo nano /etc/acpi/lid.sh
:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
nmcli radio wifi off
pm-suspend
else
nmcli radio wifi on
fi
Next, add the following lines using sudo nano /etc/acpi/events/lm_lid
:
event=button/lid.*
action=/etc/acpi/lid.sh
Now, uncomment and set the following line using sudo nano /etc/systemd/logind.conf
:
HandleLidSwitch=ignore
Finally, go into the System Settings > Power
and put all closing lid options to Do Nothing
.
Run the following to set the permissions and finalize the changes:
sudo chmod 755 /etc/acpi/lid.sh
sudo /etc/init.d/acpid restart
sudo service systemd-logind restart
Hopefully it works for you!
1
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
add a comment |
After reading around, I found that the issue was with the Qualcomm Atheros QCA6164 WiFi card used in many Lenovo laptops (G50-80 in my case). Ubuntu doesn't seem to have the proper firmware for this card which makes it act up.
I also found out that turning off the Wifi before closing my laptop would prevent everything from bugging, so I put that and the solution from this post together and created a file in /etc/acpi/
to handle the lid closing event.
Add the following code using sudo nano /etc/acpi/lid.sh
:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
nmcli radio wifi off
pm-suspend
else
nmcli radio wifi on
fi
Next, add the following lines using sudo nano /etc/acpi/events/lm_lid
:
event=button/lid.*
action=/etc/acpi/lid.sh
Now, uncomment and set the following line using sudo nano /etc/systemd/logind.conf
:
HandleLidSwitch=ignore
Finally, go into the System Settings > Power
and put all closing lid options to Do Nothing
.
Run the following to set the permissions and finalize the changes:
sudo chmod 755 /etc/acpi/lid.sh
sudo /etc/init.d/acpid restart
sudo service systemd-logind restart
Hopefully it works for you!
1
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
add a comment |
After reading around, I found that the issue was with the Qualcomm Atheros QCA6164 WiFi card used in many Lenovo laptops (G50-80 in my case). Ubuntu doesn't seem to have the proper firmware for this card which makes it act up.
I also found out that turning off the Wifi before closing my laptop would prevent everything from bugging, so I put that and the solution from this post together and created a file in /etc/acpi/
to handle the lid closing event.
Add the following code using sudo nano /etc/acpi/lid.sh
:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
nmcli radio wifi off
pm-suspend
else
nmcli radio wifi on
fi
Next, add the following lines using sudo nano /etc/acpi/events/lm_lid
:
event=button/lid.*
action=/etc/acpi/lid.sh
Now, uncomment and set the following line using sudo nano /etc/systemd/logind.conf
:
HandleLidSwitch=ignore
Finally, go into the System Settings > Power
and put all closing lid options to Do Nothing
.
Run the following to set the permissions and finalize the changes:
sudo chmod 755 /etc/acpi/lid.sh
sudo /etc/init.d/acpid restart
sudo service systemd-logind restart
Hopefully it works for you!
After reading around, I found that the issue was with the Qualcomm Atheros QCA6164 WiFi card used in many Lenovo laptops (G50-80 in my case). Ubuntu doesn't seem to have the proper firmware for this card which makes it act up.
I also found out that turning off the Wifi before closing my laptop would prevent everything from bugging, so I put that and the solution from this post together and created a file in /etc/acpi/
to handle the lid closing event.
Add the following code using sudo nano /etc/acpi/lid.sh
:
#!/bin/sh
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
nmcli radio wifi off
pm-suspend
else
nmcli radio wifi on
fi
Next, add the following lines using sudo nano /etc/acpi/events/lm_lid
:
event=button/lid.*
action=/etc/acpi/lid.sh
Now, uncomment and set the following line using sudo nano /etc/systemd/logind.conf
:
HandleLidSwitch=ignore
Finally, go into the System Settings > Power
and put all closing lid options to Do Nothing
.
Run the following to set the permissions and finalize the changes:
sudo chmod 755 /etc/acpi/lid.sh
sudo /etc/init.d/acpid restart
sudo service systemd-logind restart
Hopefully it works for you!
edited Feb 25 at 4:08
answered Feb 24 '18 at 21:46
theGirrafishtheGirrafish
1217
1217
1
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
add a comment |
1
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
1
1
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
After trying everything across the internet to make my laptop sleep after lid close, this is the only solution for me on Ubuntu 18.10
– Leo
Jan 23 at 21:22
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1009387%2flaptop-doesnt-suspend-properly-on-closing-lid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown