How to switch to other OS without needing to shut down my Linux

Hello.
So I m running a MSI GF63 laptop, I have a dual boot installed with Windows 11 on other partition . Sometimes when i open my lid after a long period of time (usually first time in the morning), I was using windows before but it boots from the start, meaning I see the boot menu, I can successfully boot into garuda too, can't use the wifi, everything else works. And when i decide to restart the system from linux and then boot into windows, all my stuff from last night is still there.

What i want is to achieve this in linux, meaning a button or command of sorts that will save my current state (in linux), and allow me to reach my boot menu so I can boot into windows (to play some games maybe) without losing all the windows and stuff i had opened on different screens. And when I log off windows, I can just resume the work that I left in linux.

garuda-inxi
System:
Kernel: 5.17.4-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 11.2.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=fa48165e-1db5-4264-968d-2cbe91a74909 rw rootflags=subvol=@
quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0 loglevel=3
Desktop: KDE Plasma v: 5.24.4 tk: Qt v: 5.15.3 info: latte-dock
wm: kwin_x11 vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
Type: Laptop System: Micro-Star product: GF63 Thin 10SC v: REV:1.0
serial: <superuser required> Chassis: type: 10 serial: <superuser required>
Mobo: Micro-Star model: MS-16R5 v: REV:1.0 serial: <superuser required>
UEFI: American Megatrends v: E16R5IMS.104 date: 08/30/2021
Battery:
ID-1: BAT1 charge: 28.8 Wh (59.9%) condition: 48.1/51.3 Wh (93.7%)
volts: 11.8 min: 11.4 model: MSI BIF0_9 type: Li-ion serial: N/A
status: N/A
CPU:
Info: model: Intel Core i7-10750H bits: 64 type: MT MCP arch: Comet Lake
family: 6 model-id: 0xA5 (165) stepping: 2 microcode: 0xEC
Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
L3: 12 MiB desc: 1x12 MiB
Speed (MHz): avg: 800 min/max: 800/5000 scaling: driver: intel_pstate
governor: powersave cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800
8: 800 9: 800 10: 800 11: 800 12: 800 bogomips: 62399
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities:
Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2
mitigation: Enhanced IBRS, IBPB: conditional, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: Intel CometLake-H GT2 [UHD Graphics] vendor: Micro-Star MSI
driver: i915 v: kernel ports: active: eDP-1 empty: DP-1,HDMI-A-1,HDMI-A-2
bus-ID: 00:02.0 chip-ID: 8086:9bc4 class-ID: 0300
Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q]
vendor: Micro-Star MSI driver: nvidia v: 510.60.02
alternate: nouveau,nvidia_drm pcie: gen: 3 speed: 8 GT/s lanes: 8
link-max: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 02:00.0
chip-ID: 10de:1f9d class-ID: 0302
Display: x11 server: X.Org v: 21.1.3 with: Xwayland v: 22.1.1
compositor: kwin_x11 driver: X: loaded: modesetting,nvidia gpu: i915
display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
s-diag: 582mm (22.93")
Monitor-1: eDP-1 model: ChiMei InnoLux 0x15e7 built: 2020 res: 1920x1080
hz: 60 dpi: 142 gamma: 1.2 size: 344x193mm (13.54x7.6") diag: 394mm (15.5")
ratio: 16:9 modes: 1920x1080
OpenGL: renderer: Mesa Intel UHD Graphics (CML GT2) v: 4.6 Mesa 22.0.1
direct render: Yes
Audio:
Device-1: Intel Comet Lake PCH cAVS vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel
alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
chip-ID: 8086:06c8 class-ID: 0403
Sound Server-1: ALSA v: k5.17.4-zen1-1-zen running: yes
Sound Server-2: PulseAudio v: 15.0 running: no
Sound Server-3: PipeWire v: 0.3.50 running: yes
Network:
Device-1: Intel Comet Lake PCH CNVi WiFi driver: iwlwifi v: kernel
bus-ID: 00:14.3 chip-ID: 8086:06f0 class-ID: 0280
IF: wlo1 state: up mac: <filter>
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Micro-Star MSI driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: 3000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp4s0 state: down mac: <filter>
Bluetooth:
Device-1: Intel AX201 Bluetooth type: USB driver: btusb v: 0.8
bus-ID: 1-14:3 chip-ID: 8087:0026 class-ID: e001
Report: bt-adapter ID: hci0 rfk-id: 0 state: down
bt-service: enabled,running rfk-block: hardware: no software: yes
address: <filter>
Drives:
Local Storage: total: 1.14 TiB used: 658.07 GiB (56.2%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Kingston model: OM8PDP3256B-AI1
size: 238.47 GiB block-size: physical: 512 B logical: 512 B
speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter> rev: EDFK0S03
temp: 48.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST1000LM048-2E7172
size: 931.51 GiB block-size: physical: 4096 B logical: 512 B
speed: 6.0 Gb/s type: HDD rpm: 5400 serial: <filter> rev: 0001
scheme: GPT
Partition:
ID-1: / raw-size: 100.08 GiB size: 100.08 GiB (100.00%)
used: 29.21 GiB (29.2%) fs: btrfs dev: /dev/nvme0n1p5 maj-min: 259:5
ID-2: /boot/efi raw-size: 300 MiB size: 296 MiB (98.67%)
used: 28.1 MiB (9.5%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 100.08 GiB size: 100.08 GiB (100.00%)
used: 29.21 GiB (29.2%) fs: btrfs dev: /dev/nvme0n1p5 maj-min: 259:5
ID-4: /var/log raw-size: 100.08 GiB size: 100.08 GiB (100.00%)
used: 29.21 GiB (29.2%) fs: btrfs dev: /dev/nvme0n1p5 maj-min: 259:5
ID-5: /var/tmp raw-size: 100.08 GiB size: 100.08 GiB (100.00%)
used: 29.21 GiB (29.2%) fs: btrfs dev: /dev/nvme0n1p5 maj-min: 259:5
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 7.58 GiB used: 0 KiB (0.0%) priority: 100
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 58.0 C pch: 57.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info:
Processes: 359 Uptime: 26m wakeups: 2 Memory: 7.59 GiB
used: 3.85 GiB (50.8%) Init: systemd v: 250 tool: systemctl Compilers:
gcc: 11.2.0 clang: 13.0.1 Packages: pacman: 1413 lib: 353 Shell: fish
v: 3.4.1 default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.15
Garuda (2.6.1-3):
System install date:     2022-01-25
Last full system update: 2022-04-29
Is partially upgraded:   No
Relevant software:       NetworkManager
Windows dual boot:       Probably (Run as root to verify)
Snapshots:               Snapper
Failed units:

That describes Hibernation. If this isn’t in Garuda settings/welcome, look at Archwiki for instructions to enable it properly.
Although it should work fine and not interfere with Windows AFAIK, I have never used it this way. Maybe some other user can add such an experience :person_shrugging:

1 Like

i thought so too, so i looked into it on arch wiki "Power management/Suspend and hibernate - ArchWiki" but i don't think it will give me a button. Please correct me if i m wrong or if anyone has better documentation.

If you enable/configure Hibernation properly, your DE (Plasma) should show a nice button and some configuration options.

1 Like

I'll give it a try and get back to you, is there any thing i should avoid or skip?

quick question, can i use my zram partition as swap file?

 chris@Chris in ~ via C v11.2.0-gcc via  v17.9.0 as 🧙 took 41ms
[🔴] × gcc -O2 -o btrfs_map_physical btrfs_map_physical.c


 chris@Chris in ~ via C v11.2.0-gcc via  v17.9.0 as 🧙 took 6ms
[🔴] × sudo ./btrfs_map_physical /dev/zram0
BTRFS_IOC_TREE_SEARCH: Inappropriate ioctl for device

 chris@Chris in ~ via C v11.2.0-gcc via  v17.9.0 as 🧙 took 38ms
[🔴] ×

i tried to do this but i couldn't. I also created a swap partition using kde partition manager but i cant find it in lsbdk (it just comes blank)
i was trying to follow this guide "Arch Linux + Grub | Setup Hibernation - YouTube" but couldn't due to lsbdk, also should i follow this guide because on the arch wiki, i read that btrfs has a different procedure than other file types.

So essentially what you looking at doing is sleeping your linux state to a swap file. I am going to call this out and say its possible but difficult. Also from personal experience hibernation works best if you going to boot straight into the same OS straight away but changing OSs could be interesting.

Systemd, Btrfs and Hibernation can be tricky to get right.

Some links i suggest reading

https://bbs.archlinux.org/viewtopic.php?id=252769

1 Like

No!
Garuda installer can do this automatically, if selected during installation (there is a combo box setting related to swap/hibernation)

That’s very much true!
That’s why Garuda has included this in the (initial) installation, to make it easy.
BTRFS has special requirements concerning swap.
All info is at Archwiki.

2 Likes

so should i maybe give reinstalling garuda a try?
or can i get this without wiping off all my data?

The best way to switch to other OS without shut down is to have one OS on each computer or put up with a 30 second shut down and a 30 second restart.
Problem solved, that was easy. :sweat:

1 Like

The east way is to reinstall, backing up your current data, if possible for your needs.
Of course it is possible without reinstalling, but complicated and I can't help you with this. Maybe someone else could walk you through with the procedure :person_shrugging:

This.

I have not tried this yet, but the Logitech unifying receiver allows me to switch mouse & keyboard between active computers when a certain button is ‘clicked.’ Ergo, I only need one mouse & keyboard but two receivers, one being the master.

But it requires Logitech’s software, receiver(s) and AFAIK these “advanced” features aren’t usually available via the limited Linux/AUR software support. I don’t use them in either OS.

1 Like

Another option to explore is to setup KVM/QEMU emulation and install Windows with GPU passthrough -- which can be a challenge to setup.

Since you're using a dual-graphics (Optimus) laptop, you can use my guide for help

BUT... this solution requires shutting down the session. Unless you're fine with not having the NVidia GPU in Linux. Perhaps you can find a work-around or compromise that suits your needs?

1 Like

From the Arch Wiki:

Warning: Data loss can occur if Windows hibernates and you dual boot into another OS and make changes to files on a filesystem (such as NTFS) that can be read and written to by Windows and Linux, and that has been mounted by Windows [3]. Similarly, data loss can occur if Linux hibernates, and you dual boot into another OS etc. Windows may hibernate even when you press shutdown, see section

6 Likes

Since hybernation and using the mounted drive from a different OS won't work...

With my KVM/QEMU setup, I can boot into Windows a near-native performance without losing anything BUT without GPU passthrough, which is fine for most tasks except gaming.

Or, I can boot into Windows with GPU passthrough but that requires killing the session (unless you don't need the GPU in Linux at all). Games at near-native performance; sometimes it even feels smoother than native.

I got 2 KVM boot setups pointing to the same storage, so I decide whether I'll kill session and pass the GPU or not each time.

I don't think you'll find a much better option than this, but it does take a while to setup. Took me a full week of debugging.

How about this, in System Settings - Workspace - Startup and Shutdown - When logging in, chose Restore manually saved session. It will restore the applications you haven't turn off when you leave.

3 Likes

This is the closest solution to my situation which can be implemented without much hassle. Thanks

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.