First, make sure that pm-utils is installed.
sudo apt install pm-utils
.
Then,edit the logind.conf file. You should always back up a critical file before changing it.
sudo cp /etc/systemd/logind.conf /etc/systemd/logind.conf.back
.
Now, edit the file.
sudo gedit /etc/systemd/logind.conf
You'll see some lines like this.
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=12288
What you have to do is to remove the # from some of the lines and change it’s value to
HandleSuspendKey=suspend
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
Now, restart your system and see if your laptop goes into suspend.