10 ms·
You do need swap if you're running Linux on a laptop! If you want Hibernate to work on your Linux laptop, you'll need to have a swap partition with space equal
by ogogmad 5y ago
You do need swap if you're running Linux on a laptop!
If you want Hibernate to work on your Linux laptop, you'll need to have a swap partition with space equal to (or bigger than) your RAM. Apparently, while there is a way to avoid setting aside a partition by using a swap file instead, it doesn't seem to work as well as using a partition.
Hibernate seems to work OK on my current laptop running Linux * and using a swap partition. I've had poorer experiences with previous laptops though. Now that I'm sure it's possible, having functioning "Hibernate" is a requirement for me when buying Linux laptops.
* - A LaptopWithLinux laptop running up-to-date Manjaro.
- chrismorgan 5y agoHibernate is not a requirement for everyone. First time I set up Arch Linux, I just never got round to setting up swap, and never felt any need for it either. Over the course of three years, I ran into OOM trouble four times (8GB of RAM was a lot in those days…). On my current laptop, I have a swap file and hibernation works fine (because this time I wanted to be able to switch over to Windows occasionally briefly without losing my session). It’s definitely more fiddly to set up in the Arch DIY style, but it’s still just following a set of instructions, so a distro that didn’t have the DIY philosophy could set it up easily enough.
- chickenimprint 5y agoDo you use multiple drives on your laptop? Because a single EFI system partition might become corrupted if you boot a system while the other is hibernated. Please refer to https://wiki.archlinux.org/title/Dual_boot_with_Windows#Fast_Startup_and_hibernation https://wiki.archlinux.org/title/Dual_boot_with_Windows#Fast...
- Macha 5y agoI think this is a little overblown. The old kernel ntfs driver which nobody uses and which is read only anyway ignores the fact that a drive is mounted by windows, so you could read corrupted data from the ntfs drive mounted by windows if windows hasn't fully completed writes that are hibernated, but you can't fuck up the partition because Linux won't write anything. The user space ntfs-3g, which is the one everyone actually uses, will refuse to mount a hibernated windows drive. The same appears to be true for the new kernel ntfs3 driver, since it's mount options include an option to force mount a dirty drive. If you use the options to force mount a dirty drive read/write, then yes, all bets are off, but you have to have dug pretty deep into your config to find out how to do that and at that point you have to know what you're doing.
- chickenimprint 5y agoSorry for the late reply. Okay, so I'm aware of the conundrums surrounding mounting the ntfs volume of a hibernated windows installation detailed on the wiki page. However, the same section clearly states that booting another OS even while a Linux system is hibernating can result in a broken EFI System Partition. This clearly does not relate to NTFS. I'm not knowlegdeable enough to understand the means by which this occurs, but I felt like I needed to give the person a heads-up before they brick their install.
- diffeomorphism 5y agoYou can get away with swap smaller than RAM just fine: https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#About_swap_partition/file_size https://wiki.archlinux.org/title/Power_management/Suspend_an...
- akvadrako 5y agoMost people don't really need hibernate. If you use your computer every couple days sleep is good enough. And if you make sure the apps you use save their state often enough that you won't lose things, it's just as fast to boot normally.
- krageon 5y ago> If you want Hibernate to work If you need swap enabled to have it, why would anyone want this? Swap makes everything worse.
- adrian_b 5y agoHibernate is just a workaround for having too long power-on or power-off times. I have been using Linux on all my laptops for the last 20 years. I have always taken care to configure them such that the boot time does not exceed some tens of seconds at worst. The result is that I have never felt any need to use either hibernate or a swap.
- rcxdude 5y agoIt's also related to the amount of volatile state that exists in applications: it doesn't matter in the slightest to me that I can boot my laptop to the desktop in 10 seconds, it'll take 10 minutes to actually open all my applications and restore them to the state they were in when I turned it off.
- adrian_b 5y agoAll the applications where the volatile state matters, e.g. browsers like Chrome or Firefox, source code editors, office applications, etc. already restore their tabs/working documents on restart, in a second or so on my computers. If there are such applications which do not restore their previously open documents upon restart, it is they who should be improved, instead of using hibernate. More frequently than wanting to close the entire computer, I just happen to stop using a certain application. In that case I want to be able to close it and restart from the same state at some later time. So this is a feature that I want in any application. If the feature already exists at the lower granularity of each application, it also removes the need for a hibernate feature of the entire computer.
- Beltalowda 5y agoThe biggest issue is restoring terminal states. I think there are some tmux plugins for this (but never looked too much in to it), and maybe some terminals support it natively too, but getting it properly restored is not so easy (including environment, shell variables, the shell's "local" history, and that kind of thing). Maybe there's some zsh plugin for it though. Now, if you don't use terminals much then that's not much of an issue, but I tend to do most things there, with Firefox being the only actual GUI I'm running in Xorg.