Disabling Laptop Screen with Ubuntu Server

As a part of my home network setup, I use an old Dell Studio XPS 15″ laptop as my “server.” It’s currently running Ubuntu 19.10. One issue I had during the last update was that whatever I set up a long time ago to manage the lid switch policy was lost, so I had to re-google it and re-do it, because I don’t want the screen to be on 24/7.

Some Googling led me to a post that got me part of the way there:

I had to adjust a few things for my setup, and for posterity I’m going to log them here for the future.

# As root, or sudo'd
apt install vbetool -y
echo 'event=button/lid.*' | tee --append /etc/acpi/events/lm_lid
echo 'action=/etc/acpi/lid.sh' | tee --append /etc/acpi/events/lm_lid
touch /etc/acpi/lid.sh
chmod +x /etc/acpi/lid.sh

This will set everything up for the lid.sh script to run:

#!/bin/bash

# Close
grep -q close /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
	sleep 1 && vbetool dpms off
fi

# Open
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
	sleep 1 && vbetool dpms on
fi

Finally, reboot and enjoy not having to worry about the screen dying.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s