Can't ping or remote connect to Ubuntu 18.04 when I close computer lid

I've set up an old laptop (dell e6330) with Ubuntu 18.04 Desktop. I want to be able to stash the machine in a closet but be able to have it continue to run as a server and also be able to remote connect to it (from Windows 10).

Note about remote connection config: I had lots of trouble getting this to work at all. In the end, the only good solution I found was to use the xrdp-install-1.2.3 from "c-nergy.be".

What I tried: I have changed the systemd logind.conf so that handlelidclose = ignore (not sure of the exact setting). I also installed gnome tweaks and set power > suspend when laptop lid is closed = off.

When I close the ubuntu lid and try to remote connect or try to ping the machine, it's not reachable.

I did test the behavior for closing lid when I have an external monitor attached and that part seems to work okay (meaning: with the lid closed, i can use the actual machine when i have external mouse/keyboard/monitor). So, my desired behavior is almost working.

With the lid closed, I want to be able to remote connect, ssh, ping the machine and these things are failing.

Thanks in advance for your advice!


@ned300889 - yes it's similar. i tried searching but my eyes and brain are blurry after trying so hard for so long to get this to work. ;-)

here is how i managed to fix it:

edit /etc/systemd/logind.conf and set these values:

HandleSuspendKey=ignore

HandleHibernateKey=ignore

HandleLidSwitch=ignore

HandleLidSwitchDocked=ignore