How To Enable Hibernation in Manjaro
Manjaro is great, but sometimes you have to let your computer take a break.
Over the last six-or-so months, I’ve been testing different Linux distributions, but I’ve not been able to get hibernation to work properly on my eight year old Dell XPS 12 9Q23 with any of them. I’ve tried every suggestion I’ve found on the internet to solve the problem, but to no avail. When I installed Manjaro, however, all the planets suddenly aligned. Manjaro did not support hibernation on the Dell XPS 12 out of the box, but thanks to the Manjaro documentation, I was able to make it work.
Linux is an unpredictable animal, though, and even if this guide contains everything I had to do to get my Dell XPS 12 to hibernate, your milage may vary. I’ve also discovered that hibernation doesn’t work every time, and I have no idea why. Sometimes it helps to turn off Bluetooth, sometimes it helps to terminate a VirtualBox VM, and sometimes I just have to sacrifice a goat and retry a couple of times until it magically works again.
Before we being, here’s a word of advice: Keep in mind that you’re following a guide written by some rando on the internet. Weird and unexpected things might happen, and you of course take full responsibility for everything since you’re taking technical advice from a complete stranger. In a worst case scenario, you might render your Manjaro installation FUBAR , and you will not be able to boot. Recovering your system might not be possible. Consider yourself warned.
The guide assumes that you have a swap partition on your hard drive, and that you’re using GRUB as your boot loader. If that’s not the case — there’s a good chance you’re using a swap file instead of a swap partition — parts of this guide can be used, but you’ll also have to consult other guides on the internet. I’ll try my best to point you in the right direction when that’s necessary.
How To Enable Hibernation in Manjaro
In order to use hibernation, you will need to point the kernel to your swap partition, which is configured via the boot loader. You will also need to configure the initramfs. This tells the kernel to attempt resuming from the specified swap in early userspace. If you don’t have a swap partition yet, refer to the swap article on the ArchWiki for instructions on how to create one.
First, we need to know the location of your swap partition. Run the swapon command from a shell of your choice:
$ swapon NAME TYPE SIZE USED PRIO /dev/sda3 partition 7,7G 4,5G -2
The name of the swap partition should be displayed. If the TYPE is not partition but file , you should skip this guide, and follow the instructions in the Power management/Suspend and hibernate — Hibernation article on the ArchWiki instead.
Next, we need to find the UUID of the swap partition:
$ sudo blkid /dev/sda3: UUID="5d825bb9-1874-42f8-9b1d-1314709da5e6" TYPE="swap" PARTUUID="e96e2512-e351-408f-9677-ad82c3e27f5e"
Copy the UUID key/value pair without the quotes, in this case UUID=5d825bb9-1874-42f8-9b1d-1314709da5e6 , and then open GRUB’s default configuration file in your favorite text editor. Personally, I prefer micro.
sudo micro /etc/default/grub
Find the line that begins with GRUB_CMDLINE_LINUX_DEFAULT and add resume= and the UUID key/value pair you copied earlier to the end of the line, but inside the quotes. Here’s an example of what the line in the GRUB configuration file might look like after you’ve edited it:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=1 security=apparmor udev.log_priority=3 resume=UUID=5d825bb9-1874-42f8-9b1d-1314709da5e6"
Then regenerate the GRUB configuration with
sudo grub-mkconfig -o /boot/grub/grub.cfg
Next, we have to configure the initramfs. This is done by adding the resume hook in /etc/mkinitcpio.conf . Open the file with
sudo micro /etc/mkinitcpio.conf
Then find the line that begins with HOOKS and add resume somewhere after udev . Here’s an example of what the HOOKS line might look like after you’ve edited it:
HOOKS="base udev autodetect modconf block keyboard keymap plymouth filesystems resume"
Note that if you see systemd in the HOOKS line, a resume mechanism is already provided, meaning that you don’t have to add the resume hook.
If you did have to add the resume hook, the next thing to do is to regenerate the configuration:
Then, resume hook or not, reboot your system:
After the reboot, you should be able to hibernate by running the following command:
But, as I mentioned in the beginning of this guide, hibernate might not work for you even if it worked for me. And there can be any number of reasons why it’s not working. Troubleshooting is not in the scope of this guide, but you might have some luck with running journalctl and searching for relevant error messages there.
Sources
Feedback
This post has no feedback yet.
Do you have any thoughts you want to share? A question, maybe? Or is something in this post just plainly wrong? Then please send an e-mail to vegard at vegard dot net with your input. You can also use any of the other points of contact listed on the About page.
It looks like you’re using Google’s Chrome browser, which records everything you do on the internet. Personally identifiable and sensitive information about you is then sold to the highest bidder, making you a part of surveillance capitalism.
The Contra Chrome comic explains why this is bad, and why you should use another browser.
Спящий режим
Всем прекрасного солнышко и здрасти
Крыска не хочет ««спать»» не переходит в спящий режим
каким накотиком её туда загнать? Впрочем это не актуально ждущий режим она нормально отрабатывает но хотелось бы иметь все опции на борту
ЗЫ
немного лениво гуглить ибо на отдыхе хотелось бы тут сразу получить ответ и заранее спасибки
8 комментариев
И это — логично. Если создаёшь раздел подкачки во время установки системы, то умная манжара сама пропишет в конфиги (у меня гибернация и спящий режимы работали в этом случае искаропки), если своп не задавать, то потом придётся ковыряться к конфигах самостоятельно (такое тоже было). Что править — смотрите у ораторов ниже.
не забывайте еще swap раздел прописать в fstab (/dev/sdxx none swap defaults,pri=-2 0 0) или (UUID=xxxxxxxx… none swap defaults,pri=-2 0 0) примерно так.
в файлик /etc/fstab
в файле /etc/mkinitcpio.conf в строке HOOKS=«base udev autodetect modconf block filesystems keyboard fsck»
добавляем resume, например HOOKS=«base udev resume autodetect modconf block filesystems keyboard fsck»
затем в файле /etc/default/grub в строке GRUB_CMDLINE_LINUX_DEFAULT добавляем ваш swap раздел GRUB_CMDLINE_LINUX_DEFAULT=”resume=/dev/sdXX”. Затем sudo mkinitcpio -p linux14 (укажите свою версию ядра LinuxXX)
обновляем grub — sudo grub-mkconfig -o /boot/grub/grub.cfg, перегружаемся и… гибернация работает
— не забывайте еще swap раздел прописать в fstab
Прямой эфир
- berligostr Вчера в 21:36
Pamac9 - berligostr Вчера в 21:33
Firefox и thunderbird очень медленно запускаются2 - JAB 12 июля 2023, 22:27
Не отображаются файлы на раб. столе + не запускаются приложения13 - ink 11 июля 2023, 11:52
установка gnome на ноутбук Chuwi3 - HargardMoroznyy 10 июля 2023, 13:47
Прошу подсказать1 - dwadatka 7 июля 2023, 12:39
Должна (по вашему ) быть награда за решённый вопрос? например в конфиденциальной криптовалюте.2 - AlexxSanich 4 июля 2023, 22:19
Настройка энергоэффективности/автономности3 - Kronton 3 июля 2023, 13:20
Бесплатный VPN — настройки и поддержка12 - mva 1 июля 2023, 22:33
Приложения медленно запускаются29 - Маленький_Любитель_анонимности 1 июля 2023, 20:01
вылет в tty и дальнейшее зависание2
Howto enable hibernate on a Linux Manjaro
I run into some issues with my current Debian systems. In fact, I use Debian on a lot of computers, but most of the time the sessions are consistent, some have nautilus working some don’t .. same for automount, grub-updater, and so on.
I decided to switch my desktop computer to another distro. After about 5 years with the same Debian Sid install, I switched to Manjaro. Manjaro use the same base system as Arch Linux but seems to be more user friendly.
Anyway, the hibernate don’t work out-of-the-box. When you restart the computer, it doesn’t restore the hibernate image from the swap. You can fix that quickly. Edit /etc/mkinitcpio.conf file and add “resume” to the HOOK flag like this.
HOOKS="base udev autodetect modconf block resume filesystems keyboard fsck"
After that, you must rebuild the initcpio file :
sudo mkinitcpio -p linux39
That’s enough, you can now test with a simple pm-hibernate.
/Enjoy Linux again.
Related Posts
This entry was posted in Unix and tagged linux, Manjaro by admin. Bookmark the permalink.
5 thoughts on “ Howto enable hibernate on a Linux Manjaro ”
Thanks for the help. However, it is not complete as it is necessary to update grub accordingly and provide a resume partition. That means, edit the appropriate line in: /etc/default/grub
GRUB_CMDLINE_LINUX=”resume=/dev/sdaOFYOURSWAPPARTITION”
or
GRUB_CMDLINE_LINUX=”resume=UUID=OFYOURSWAPPARTITION” Afterwards, don’t forget to update grub and run:
grub-mkconfig -o /boot/grub/grub.cfg
The HOOKS above are probably correctly set in Manjaro as of 2014, even when encrypting the root partition. However, the following GRUB2 config changes may be required, where the UUID corresponds to a sufficiently large swap partition. /etc/default/grub #GRUB_CMDLINE_LINUX_DEFAULT=”quiet”
GRUB_CMDLINE_LINUX_DEFAULT=”resume=/dev/disk/by-uuid/12345678-c123-1234-1ed2-f123a12e1234″ To find your swap partition UUID, the following commands should be helpful:
$ swapon -s
$ free -m
$ ls -l /dev/disk/by-uuid/ | grep sda Reference links: https://wiki.archlinux.org/index.php/Suspend_and_Hibernate https://wiki.archlinux.org/index.php/Power_management#Power_management_with_systemd
I should add that to make the GRUB2 configuration file, one must run: # grub-mkconfig -o /boot/grub/grub.cfg To test hibernation (with systemd) via the cli: $ systemctl hibernate If the root partition is encrypted but the swap is not, I suspect hibernating (even once) compromises the entire encrypted disk as the keys will have been written to swap disk in plaintext, no?