Skip to content

Instantly share code, notes, and snippets.

View s-ol's full-sized avatar

s-ol s-ol

View GitHub Profile
@setzer22
setzer22 / README.md
Last active December 2, 2023 14:03
Linux command to hibernate and then reboot into a different OS

Linux command to hibernate and then reboot into a different OS

In this document I describe my setup about how to add a menu shortcut that will hibernate and reboot the system into a different OS (in my case, Windows), and then restore linux on the next reboot.

For this, I'll be using Arch Linux with systemd-boot as my boot manager, but in practice any bootloader that handles the LoaderEntryOneShot (a.k.a. BootNext) efivar should work.

NOTE It is advisable to not do this with window's fast boot feature active, since alternating the hibernation of two systems can cause shared partitions to get corrupted. However, if additional steps are taken in order to ensure the shared partition are unmounted before reboot, or no partitions are shared between the two OSs, this can be made to work with fastboot enabled which should give quite a boost in Windows' startup time.

Set the LoaderEntryOneShot/BootNext EFI variable

/*
* © 2016 - Julián Acosta
* License: CC BY-SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0/)
*
* Print your own logo in developer tools!
*
* Step 1: Convert your logo to ASCII text here: http://picascii.com (I used color output)
* Note: Is possible that you'll have to resize your photo in order to retain aspect ratio
* Step 2: Remove the <pre></pre> tag that is surrounding the generated code, replace with "[" and "]"
* Step 3: Run the following regexes (*DON'T ALTER THE ORDER*) in order to convert to JSON (Works in PHPStorm and Sublime Text 2):
#!/usr/bin/env python
# freeleech.py originally by tobbez
# Now maintained at github.com/spaghetti2514/What.cd-Freeleech
import os
import re
import sys
import json
import time