Use laptop with closed lid and Linux

I have been running a laptop with external keyboard, monitor and mouse with Windows and that works mostly fine, only time I really need to open the laptops lid is if I turn it off and need to reach the power button.

In Fedora 29 it’s not that easy, disk password has to be done on the laptops monitor and so does Gnome login. First after that I can use the external monitor which generally requires me to unplug and then connect the external monitor again to the display port on the laptop.

Suspend appear to allow me to stay with the external monitor but blank screen and lock required me to login on the laptop’s monitor.

The laptop is a Lenovo P50.

Short of disconnecting the laptops monitor internally is there a way to set up an external display as primary to display things like bios, boot manager and disk password prompt? Windows does not display the boot up logo but when it gets to the login screen it’s showing on the external monitor without any action on my part.

You can make Linux ignore putting the laptop in suspend on lid close, and then set up xrandr to make external display the main one.

To make Linux ignore lid events, edit /etc/systemd/logind.conf to say:
HandleLidSwitch=ignore

Restart the logind service.

# systemctl restart systemd-logind.service

be warned that this will terminate all login sessions that might still be open

Source:
https://wiki.archlinux.org/index.php/Power_management

2 Likes

Suspend does not appear to cause problems, it’s blank screen that requires me to reattach the DP cable for the monitor to come on. Arguably I could get a screen saver instead but I would prefer if the monitor went to sleep.

Ah, I see. Nothing comes up to mind in that case. Maybe fiddling with xrandr, but idk.

1 Like

You could always unplug the LVDS or eDP cable inside the laptop if you don’t care to have a working laptop screen. Not an ideal solution but it should make the external monitor your first screen.

1 Like

What I ended up doing for a similar setup was disabling the LVDS output with a kernel parameter.

I just appended “video=LVDS-1:d” to my grub kernel parameters, and once I did that I could see everything on my external displays, if the laptop lid was closed. From the manufacturer boot logo, to grub, to unlocking my LUKS volume.

I also had to add my graphics drivers to my initramfs, otherwise I would get no output. But with the Intel driver it worked fine. I haven’t tested it with AMD or Nvidia.

If your laptop uses eDP ( a lot of newer laptops do ) you may need to change the parameter slightly. Should be pretty easy to figure out though, I just looked at my X.org log to find the displays.

This may not work for every laptop, but for mine I was able to see the bios. USB Keyboard didn’t work in the BIOS, but I could see it at least.

This was a 2nd gen i3 machine.

2 Likes

Would prefer not to

1 Like

Thanks! Probably eDP as it’s a v5 Xeon with intel and quadro graphics.

Amazing, what’s the rational behind the external display showing bios? I thought kernel parameters would come into play after boot? Maybe some settings linger across reboots or something?

Most likely the laptop saw the lid closed, and since there was external displays, it used that instead of the built in panel. If the lid was open it would still use the built in panel for the bios. Kernel parameters make no difference here, probably just a thing the laptop supports or doesn’t.

The rest was probably the video bios that the Intel driver loaded telling where to output video.

My main goal was just getting grub and my LUKS unlock visible on my external displays as I used the laptop like a desktop.

In the end it was a combination of KMS and disabling the laptops panel with the kernel parameter that worked for me. The mkinitcpio stuff will be a little different between distributions, so I would refer to yours on how to set up KMS.

Looks like on Fedora with a nvidia card it is disabled by default because it may crash, but I am not sure how old that information was. It also looks like Fedora uses the noveau driver by default, you may have better luck with the proprietary driver. I know on a lot of laptops with discrete graphics only a certain display output is connected to the discrete card, so if you use the KMS only that output would be the one that would work, at least until X is started and can take over to set up the other displays. At least that is how I understood it. I have never had a laptop with discrete graphics so I don’t really know a lot about their setup.

I had a lot of trouble getting it to work honestly, and it was a real pain because if it doesn’t work you have to boot the OS installation medium and chroot into your install to change stuff back. If everything isn’t setup properly it is very likely that you will boot to a black screen, or not even make it that far.

are you directly connecting to the laptop or are you using a docking station?
the reason i’m asking is if you are using a docking station you don’t even have to open the lid!
docking stations have the power button on them and automatically switches to external monitor when you dock the laptop.

no dock

even though the systems can be used without a dock you need to leave the lid open.
software may not be able to disable the lid sensor on all devices.
Its better to get a docking station monitor, keyboard ,mouse, etc. is left connected to the dock

Do you think the the thunderbolt 3 dock would work well under Linux? There’s also an option for a regular dock for the docking port on this model.