My laptop shuts down instead of going to sleep when I close the lid

When I close the lid of my laptop, it shuts down instead of going to sleep. What can I do to prevent this? I checked and all my power settings are set to suspend when you close the lid, with no effect.

Hi I have a tower and its been one day so will attempt an answer of sorts

first check your bios settings to ensure nothing gets in the way
ie, is a bios setting causing power down?

Second review your installed and uninstall so apps as per link

Now first link is not directly your issue.....and it involves an older release of Ubuntu
but I assume you want suspend....rather than hibernate

thirdly....some apps can misbehave on wake up...that is they do truly wake up.
I have a tower and it takes seconds for me to boot it up from cold start.
so I am not interested suspend or hibernate.

also there is another link to wiki
https://help.ubuntu.com/stable/ubuntu-help/power-closelid.html.en

more info on suspend and why you might prefer it is here
https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate

I already tried the 1st link, but not the 2 others. And what do you mean by reviewing my installed apps?

I mean from link

ensure that you have pm-utils installed on your system

and from the other link...if they exist....and you want suspend and if you have read the arch you know you need a swap partition and a grub entry IF you want HIBERNATE

Bad packages (swsusp, hibernate) can interfere with /etc/acpi/sleep.sh, so make sure they are purged

.

I just wanna sleep my pc, and I checked the bios, and there is one option labeled "Wake on lid open" and it was already on "Enabled".

Hey @aus9, I just noticed i don't have a sleep.sh, is that normal?

I have no idea. I have restored a different image and deleted a lot of sotware after that post.

what is the result when you run this command?
ls /etc/acpi

I am on a tower, but you have checked your power management options under control panel ?

My power management options are correctly set, and the output of ls /etc/acpi is:

I have the same results for /etc/acpi
It looks like that script is for those who suspend
as its mentioned in this wiki
https://wiki.ubuntu.com/FeistySuspendOverview

so I assume by sleep you mean hibernate so NOT suspend
so ignore missing file please

I do mean sleep, so what do i do now?

shivers....sorry I saw you said suspend in OP and I got confused with another post.

OK lets concentrate on getting some meaning.

I will show a link that you will need read but bear with me, there are more links but lets try simple first?

confirm pm-utils is installed by
sudo apt install pm-utils

Now run the command
sudo pm-suspend

What I get is a blanking of my monitor and blanking of my case HD led and if you can see it, blanking of my mobo led
NEXT, touch the power button to re-wake
not a long press....as I have set my bios to (full) shutdown if pressed for 4secs

Report your results for above
assuming you fail.....then show the the log for
dmesg | tail -50

while I will show a snip of success
ACPI: Waking up from system sleep state S3
r8169 0000:01:00.0 enp1s0: Link is Up - 1Gbps/Full - flow control off

Now I show my ethernet as some wifi devices do not behave themselves according to some internet posts.

I am no expert

This is what i get:

[ 31.093970] usbcore: registered new interface driver ath3k
[ 31.400130] usb 1-3: new full-speed USB device number 5 using xhci_hcd
[ 31.517669] intel_rapl: Found RAPL domain package
[ 31.517672] intel_rapl: Found RAPL domain core
[ 31.564265] uvcvideo: Found UVC 1.00 device USB2.0 VGA UVC WebCam (04f2:b52b)
[ 31.568286] uvcvideo 1-4:1.0: Entity type for entity Extension 4 was not initialized!
[ 31.568290] uvcvideo 1-4:1.0: Entity type for entity Processing 2 was not initialized!
[ 31.568292] uvcvideo 1-4:1.0: Entity type for entity Camera 1 was not initialized!
[ 31.568423] input: USB2.0 VGA UVC WebCam: USB2.0 V as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/input/input15
[ 31.568561] usbcore: registered new interface driver uvcvideo
[ 31.568562] USB Video Class driver (1.1.1)
[ 36.682548] usb 1-3: New USB device found, idVendor=13d3, idProduct=3423, bcdDevice= 0.02
[ 36.682555] usb 1-3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 37.713923] audit: type=1400 audit(1569860171.364:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-oopslash" pid=885 comm="apparmor_parser"
[ 37.718425] audit: type=1400 audit(1569860171.368:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-senddoc" pid=886 comm="apparmor_parser"
[ 37.724701] audit: type=1400 audit(1569860171.376:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=884 comm="apparmor_parser"
[ 37.724708] audit: type=1400 audit(1569860171.376:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=884 comm="apparmor_parser"
[ 37.724712] audit: type=1400 audit(1569860171.376:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=884 comm="apparmor_parser"
[ 37.730261] audit: type=1400 audit(1569860171.380:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=882 comm="apparmor_parser"
[ 37.730274] audit: type=1400 audit(1569860171.380:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=882 comm="apparmor_parser"
[ 37.730281] audit: type=1400 audit(1569860171.380:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=882 comm="apparmor_parser"
[ 37.730288] audit: type=1400 audit(1569860171.380:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=882 comm="apparmor_parser"
[ 37.774769] audit: type=1400 audit(1569860171.424:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-soffice" pid=887 comm="apparmor_parser"
[ 41.972351] bpfilter: Loaded bpfilter_umh pid 1055
[ 43.227958] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 43.227961] Bluetooth: BNEP filters: protocol multicast
[ 43.227968] Bluetooth: BNEP socket layer initialized
[ 45.330273] Lockdown: modprobe: Loading of unsigned module is restricted; see man kernel_lockdown.7
[ 52.098554] Generic PHY r8169-200:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=r8169-200:00, irq=IGNORE)
[ 52.365866] r8169 0000:02:00.0 enp2s0: Link is Down
[ 75.056397] Lockdown: Xorg: ioperm is restricted; see man kernel_lockdown.7
[ 145.741277] systemd-journald[407]: File /var/log/journal/65c9eb052d154723913f57393ed4279d/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.
[ 146.466192] wlp3s0: authenticate with 1c:24:cd:08:4a:40
[ 146.484337] wlp3s0: send auth to 1c:24:cd:08:4a:40 (try 1/3)
[ 146.487362] wlp3s0: authenticated
[ 146.488677] wlp3s0: associate with 1c:24:cd:08:4a:40 (try 1/3)
[ 146.494466] wlp3s0: RX AssocResp from 1c:24:cd:08:4a:40 (capab=0x1411 status=0 aid=3)
[ 146.494662] wlp3s0: associated
[ 146.494806] ath: EEPROM regdomain: 0x8114
[ 146.494808] ath: EEPROM indicates we should expect a country code
[ 146.494809] ath: doing EEPROM country->regdmn map search
[ 146.494810] ath: country maps to regdmn code: 0x37
[ 146.494811] ath: Country alpha2 being used: DE
[ 146.494812] ath: Regpair used: 0x37
[ 146.494814] ath: regdomain 0x8114 dynamically updated by country element
[ 146.561559] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready
[ 146.563638] wlp3s0: Limiting TX power to 20 (20 - 0) dBm as advertised by 1c:24:cd:08:4a:40
[ 148.098968] Bluetooth: RFCOMM TTY layer initialized
[ 148.098980] Bluetooth: RFCOMM socket layer initialized
[ 148.098995] Bluetooth: RFCOMM ver 1.11

that log command was from the link and was good enough for me but not for you mainly due to apparmor reporting to log

so first here is my log for apparmor
dmesg | grep apparmor
dmesg | grep apparmor
[ 0.990818] evm: security.apparmor
[ 3.699784] audit: type=1400 audit(1569887705.203:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=644 comm="apparmor_parser"
[ 3.699786] audit: type=1400 audit(1569887705.203:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=644 comm="apparmor_parser"
[ 3.699787] audit: type=1400 audit(1569887705.203:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=644 comm="apparmor_parser"
[ 3.704697] audit: type=1400 audit(1569887705.207:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/tcpdump" pid=641 comm="apparmor_parser"
[ 3.707581] audit: type=1400 audit(1569887705.211:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=645 comm="apparmor_parser"
[ 3.707583] audit: type=1400 audit(1569887705.211:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=645 comm="apparmor_parser"
[ 3.707584] audit: type=1400 audit(1569887705.211:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=645 comm="apparmor_parser"
[ 3.707585] audit: type=1400 audit(1569887705.211:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=645 comm="apparmor_parser"
[ 3.710865] audit: type=1400 audit(1569887705.215:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/cups/backend/cups-pdf" pid=646 comm="apparmor_parser"

Bottom line is unconfirmed is not an issue as my suspend works with similar apparmor results to you.

...

Try these commands instead please

sudo pm-suspend
dmesg | grep sleep

I will show mine after I pressed power button to get back from sleep
dmesg | grep sleep
[ 371.413326] ahci 0000:00:17.0: port does not support device sleep
[ 371.918699] ACPI: Preparing to enter system sleep state S3
[ 371.941027] cache: parent cpu1 should not be sleeping
[ 371.942559] cache: parent cpu2 should not be sleeping
[ 371.944092] cache: parent cpu3 should not be sleeping
[ 371.947544] ACPI: Waking up from system sleep state S3
[ 372.431697] ahci 0000:00:17.0: port does not support device sleep

...

Notice your log has an entry for a bad journal and lockdown?

Do a full reboot and then show the result of this command

dmesg | grep journal

did you do anything to enable or attempt to use lockdown?
I am not using it

I am doing a separate post because I hope to be wrong but maybe this is the reason for your problem?

I am talking about you setting up lockdown which can stop even root from doing things.

Let pretend one of those things is a file system check.....that might explain why you have a log for your journal error.

so if you don't mind post your /etc/fstab and if you want to block out the UUID but I will show my entry as its easier to read so easier to trouble shoot.
You can make labels for ext2/3/4 using command (as example for /dev/sda1)

sudo e2label /dev/sda1 s1
and check its landed by
sudo e2label /dev/sda1
s1

Ok so my fstab
cat /etc/fstab
LABEL=s1 / ext4 errors=remount-ro 0 1
LABEL=s3 /s3 ext4 users,rw 0 2
LABEL=sswap none swap defaults 0 0

Once a system is booted you can only do a file system check on an UNmounted partition
so if we have concerns on your next report best we use a live cd to fsck on your partitions

even if lockdown is NOT the culprit....please post as much of your fstab as possible combined with the results to my earlier post. We may be wasting time if your hard drive is failing, or your system can not use its journal proplerly such as a ext3 or ext4 system...or other journalised systems

Hey @aus9, I did what you asked and here's the fstab file output:

/etc/fstab: static file system information.

Use 'blkid' to print the universally unique identifier for a
device; this may be used with UUID= as a more robust way to name devices
that works even if disks are added and removed. See fstab(5).


: / was on /dev/sda5 during installation
UUID=blocked out/ ext4 errors=remount-ro 0 1
: /boot/efi was on /dev/sda1 during installation
UUID=AE23-4219 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0

Hi

I asked questions in my second last and last post. Please have another crack at that.

As I said...trying to read a fstab that uses UUID is difficult but it looks like you have boot/efi being checked at the same time as your root partition.

see
man fstab

and I am not sure your swap partition is correct at the beginning
/swapfile
IMHO this should be either at beginning of line for swap:
/dev/sdxn style or
UUID=string or
LABEL= string

maybe you could show the output of
swapon --show

Ubuntu have a wiki here
https://help.ubuntu.com/community/Fstab?

Sorry for not answering, here's the output @aus9 :

NAME TYPE SIZE USED PRIO
/swapfile file 8G 268K -2
nath_som@nathsom-X541SC:~$

I am not sure where we are at now... lets start again shall we?

sudo pm-suspend
dmesg | grep sleep
dmesg | grep journal

please show results for above commands.
If you think that might not be enough then dmesg | tail -50 won't work for you from above link
if you have a file hosting site like dropbox you can try
dmesg > /tmp/dmesg.txt
upload it somewhere and link to it

Hopefully we can catch some gremlins if

Next, what steps did you take to engage lockdown please?