Dietpi turn off screen but not put laptop to sleep?

So crazy thing going on.
I picked up a Dell laptop with some bad pixel issues in the screen, other than that it works great. I installed DietPi 8.9.2 no problem, with the mate desktop, I planned on using rhe laptop with a monitor and keyboard a la a skinny desktop. :+1::grin:. The problem I am running into is when I close the laptop and the screen goes out, Dietpi goes to sleep. I know someone is going to say ā€œleave the screen openā€ but I’d rather not. I know how in windows to make the screen closing do nothing to the power,. But I am lost here. Do I need a different desktop than Mate or am missing something cause I can’t find any power or screen settings.

Thanks In advance for any help

I never tested it myself but did you try to install/use mate-power-manager ?? Debian -- Details of package mate-power-manager in bullseye

apt install mate-power-manager
1 Like

Yeah I also think you need to use the mate-power-manager.
From the ubuntu mate forums:

To disable the lid action:

$ dconf write /org/mate/power-manager/button-lid-ac 'nothing'
$ dconf write /org/mate/power-manager/button-lid-battery 'nothing'

And to enable it:

$ dconf write /org/mate/power-manager/button-lid-ac 'suspend'
$ dconf write /org/mate/power-manager/button-lid-battery 'suspend'

https://ubuntu-mate.community/t/command-to-prevent-laptop-to-go-into-standby-on-lid-close/12667/5

1 Like

Awesome help guys. I will try it out and let you know. :+1:

Well it didn’t seem to make a difference at first, I changed the setting on the gui in mate after the install, closed the screen and it still powered down wirh the ā€œblankā€ setting. So I changed it to ā€œdo nothingā€ and rebooted the laptop

Now it’s closed and fully functional. Hoping this will also help cool it down, she’s running a bit hot.

Thanks again, I knew I was missing something simple.

1 Like

Hello,
@Joulinar , @Jappe
what if I don’t use desktop and want to close laptop lid and use it as server and shh from other devices?

do you have a headless option inside dietpi-config display settings? Or do you mean the poweroff settings?

OK, it works out of the box. Thanks.

1 Like

Hi, it works OK all night but today when I connect to ethernet and install openssh laptop go to sleep when close the lid. I can’t find any option in dietpi-config > display settings to set headless server.

Edit.
OK, I find that solution:

sudo nano /etc/systemd/logind.conf
HandleLidSwitch=ignore
sudo systemctl restart systemd-logind
1 Like

Thanks for the hint! I never knew that systemd-logind handles power/suspend key and lid actions, but it has a whole set of settings for this: logind.conf(5) — manpages-de — Debian bullseye — Debian Manpages

On DietPi it is not installed OOTB, and usually not required on headless/console systems, but good to know that it can be used for it, respectively handles it (not always wanted) when installed for specific reasons.

As a general recommendation: Try to avoid editing existing config files, but create own ones for overriding settings instead:

mkdir /etc/systemd/logind.conf.d
echo 'HandleLidSwitch=ignore' > /etc/systemd/logind.conf.d/99-disable-lid-switch.conf

That way it is easier to revert, more transparent what changed and APT remains able to update the default config without interactive confirmation or having diverging logind.conf and logind.conf.dpkg-dist files.

It’s the last entry in the submenu of 1 : Display Resolution .

Thanks I will change that.

I don’t have that option:




Headless mode has only a meaning on RPi, where GPU memory allocation, framebuffer and HDMI signal stack can be completely turned off to save RAM and energy. On x86 systems there is no generic way of doing that which has any benefit, at least not to my knowledge.

Thanks, do You know any tricks to save energy when I use old laptop as server?

you could try to reduce CPU frequency.

I signed up to give this answer:

Two options.

  1. Always blank out after x seconds after startup:
    https://www.reddit.com/r/debian/comments/etggjk/comment/ffw66ye

I solved the problem on my own by changing the consoleblank at boot.

Verify the value used at the moment with cat /sys/module/kernel/parameters/consoleblank. The value is in seconds. The easiest way to add the parameter at boot is using the kernel command-line.

  1. Open /etc/default/grub
  2. Add consoleblank=600 to the GRUB_CMDLINE_LINUX_DEFAULT= which sets the timeout to 10 minutes (600 seconds).
  • GRUB_CMDLINE_LINUX_DEFAULT="quiet consoleblank=0"
  1. Run sudo update-grub, and reboot.
  1. Script to blank on lid close:
    18.04 - How do I configure laptop lid closing event to turn off screen but not put computer to sleep? - Ask Ubuntu

(didnt paste answer as stack overflow always archives posts)

I picked the first as I will never log in physically and do things. I set a two minute delay just in case.

1 Like