0

The goal is simple: start Ubuntu and find it how you left it after turning your PC off (no power consumption). Startup Applications alone is not enough, because it doesn't open the applications in separate workspaces, and it's annoying to move the apps around every time.

I'm asking here after having searched extensively and finding old recipes, unmaintained software, or daring/dubious recommendations that involve command line and sometimes deep changes in your system. After years upgrading Ubuntu, I have decided to start fresh with 23.10 and I though about asking here for an updated recommendation before I start messing up with my PC.

About possible duplicates: there are many web pages related to this use case, also in AskUbuntu (example), but the ones I have found date years back and in the meantime GNOME and the Ubuntu stack underneath have changed a lot. It is not clear whether "gdevilspie", "Auto Move Windows" or "dconf-editor" are still valid options. It is also not clear whether the best approach is to find a utility that will place startup applications on a specific workspace or to go for deeper routes like enabling hibernate...

Given that this use case is so common and basic, I believe more users of the last Ubuntu version will welcome a clear recommendation and the steps to implement it in their desktop.

  • Is your question: how do I enable hibernation? (Which will do exactly what you've asked for). Check this answer – kanehekili Nov 15 '23 at 09:18
  • I don't know what I don't know. :) Whether hibernation is the best approach or not is part of the question. In principle it looks like the ideal solution but since it isn't enabled in Ubuntu, maybe there is a simpler approach to have the startup applications in separate workspaces. – icaria36 Nov 15 '23 at 09:26
  • gsettings get org.gnome.SessionManager auto-save-session is this key still available? – nobody Nov 15 '23 at 11:18
  • @nobody thanks for the hint. I installed dconf-editor, enabled that auto-save-session setting, rebooted, and... there weren't any apps opened after logging again. I disabled the setting again. – icaria36 Nov 15 '23 at 23:30
  • @kanehekili I have tried hibernation but in my system it doesn't work out of the box. The changes needed to make it work are complex and a mistake can go wrong. Too risky to just have startup applications opening in their workspaces after a full restart. – icaria36 Nov 15 '23 at 23:48
  • Since hibernation is the only way to achieve your objective. I've written here how to check your basic hibernation function (and possible misbehaving drivers). – kanehekili Nov 16 '23 at 08:17

1 Answers1

0

The way to close your computer and keep the current session intact is to have the computer suspend. There are two different "low energy" states:

  • Sleep state: the current session stays into memory, and the computer goes to a low energy state, essentially only consuming power to keep the memory. To awake the computer from this state is almost instantanious. This is suited to power down the computer for shorter periods during the day.
  • Hibernation: the current session is written to swap space on the hard drive, after which the computer is fully powered down. When the computer is restarted, it will restore the memory data from the swap space, and resume the session where it left of. This is suited to shut down the computer for longer periods.

"Sleep" state usually is not a problem. As such, it is enable by default.

However, linux in general has difficulties to implement hibernation flawlessly on any hardware. While it works on many hardware, there are issues on many other hardware. The reason for this is that many hardware components and power saving implementations are proprietary and different between computer brands. Therefore, hibernation is not enabled by default.

You can enable hibernation and check whether it works reliably on your system. However, that is not trivial. I advise you to make use of the "sleep" state, and shut the computer fully off for longer periods. For any operating system, it is advisable to have the system fully reboot from time to time.

vanadium
  • 88,010
  • Thank you for your comprehensive answer. In my case, hibernate doesn't work out of the box, and the changes required are daunting. Sleep works, but I think it's overkill to leave my PC consuming energy every night in sleep mode instead of turning it off just for my comfort of finding a few apps open in the same workspaces. I know the difference between my PC being asleep or turned off won't fix climate change etc but it's a matter of mentality. Before trying to enable hibernation I will look deeper at the GNOME / Dconf level. – icaria36 Nov 15 '23 at 23:54
  • Gnome used to have "sessions" for that, and XFCE still has that, but that never worked reliably so has been removed from Gnome. It is unfortunate that hibernation is a problem in linux. Personally, I rather like to start with a tidy desktop, so I shut down (even for lunch) unless I deliberately want to take a short break to resume later - in which case I would use sleep. – vanadium Nov 16 '23 at 20:01