How to Disable Laptop Screen on Startup in Ubuntu / Fedora & other Linux

This simple tutorial shows how to turn off your laptop built-in display automatically on startup of Ubuntu or other Linux.

Disable laptop’s built-in display may be useful to save power when an external monitor connected, or use as server for only remote access. Or even the built-in screen is just broken, you need to turn it off until replaced with a new one.

If you want to temporarily turn the screen off, most Linux desktop has an ON/OFF switch in ‘Display’ settings page to do the job.

Temporarily turn off a display

To automatically turn off the screen on system startup, you may just add a kernel parameter to boot menu. And, here’s how to do the job step by step!

NOTE 1: This tutorial is tested and works in Ubuntu 22.04, Fedora 37, Linux Mint 21. Though, it should works in most Linux that use Grub boot-loader, unless your system block the kernel parameter.

NOTE 2: After this tutorial, your laptop screen should turn off automatically after boot-menu. EVEN when you disconnect the external screen.

Step 1: Tell your display device name

Each monitor connected into Linux has a device name. You have to find it out before disabling it while booting.

Option 1: for classic Xorg session

For most Linux with non-GNOME desktop that use the classic X display server. Open a terminal window from start menu, then run command:

xrandr --listmonitors

or use command:

xrandr |grep connected

It will tell you all current monitors connected. In my case, they are eDP-1 and DP-1.

Option 2: for Wayland session

For Wayland that is default in Ubuntu 22.04+ and Fedora Workstation with default GNOME Desktop. Also, open a terminal window by searching from ‘Activities’ overview and run command:

cat ~/.config/monitors.xml |grep -E "connector|vendor"

NOTE: This command ONLY works after connecting an external display, and switching primary display!!

Or, you may run command to check ‘status‘ file content under each key folder under ‘/sys/class/drm/‘ by running command:

 

for folder in /sys/class/drm/*/status; do content=${folder%/status}; \
echo -n "${content#*/card?-}: "; cat $folder; done

Step 2: Add a Kernel Parameter to display built-in screen

Once you got the device name, you can now add a kernel parameter to boot menu entry to turn it off.

To do it, open a terminal window and run command to edit the config file:

sudo nano /etc/default/grub

When file opens in terminal windows, use arrow keys to scroll up/down and left/right, and add video=eDP-1:d as value of GRUB_CMDLINE_LINUX_DEFAULT.

Change eDP-1 to yours device name. And, press Ctrl+X, type y and hit Enter to save the file.

Step 3: Apply change

For Debian/Ubuntu based systems, run the command below in terminal to apply Grub configuration changes:

sudo update-grub

For Fedora, the command varies. Use one of them below depend on your machine (BIOS/UEFI or legacy):

sudo grub2-mkconfig -o /etc/grub2.cfg
sudo grub2-mkconfig -o /etc/grub2-efi.cfg
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

In addition for those having Grub-Customer installed, just add the kernel parameter under ‘General settings’ page and save the change.

Turn off screen on startup via Grub Customizer

(Optional) How to Re-enable the built-in display

Option 1: To re-enable the built-in screen, either connect and boot your Linux with an external screen. Then, delete the kernel parameter by re-editing the ‘/etc/default/grub’ file, and apply via step 3.

Option 2: Or, press and hold Esc (or maybe Shift depends on your machine) key on startup to show the Grub boot-menu. Then, highlight the first menu entry, press e to go edit screen. Delete the video=eDP-1:d flag in the end of line that started with ‘linux’.

After that, press F10 to boot with the screen enabled. Finally, re-edit the grub config file to delete the kernel parameter.

That’s all. Enjoy!

Exit mobile version