Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Swap space on a dual boot machine
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Thu Apr 04, 2019 10:59 pm    Post subject: Swap space on a dual boot machine Reply with quote

How does it work? If I want to install Gentoo alongside an installation of Ubuntu basically not sure yet if I'm going to switch back and forth much or just use the Ubuntu as a recovery system locally. Either way now I have the question about the swap. Since both might require use of swap. So does that mean in dual boot scenario to set up separate swap partitions for each installation? Thanks in advance for this.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Fri Apr 05, 2019 12:55 am    Post subject: Reply with quote

Swap is only used while the kernel is up. When you shutdown the system, the contents of swap become irrelevant. You may safely share a swap device between two installs. However, swap is also borrowed by hibernation as a storage area for the hibernated system. If you hibernate, then the swap area cannot be used by any other kernel until you resume from hibernation or discard the hibernation image (thereby losing the ability to ever resume that image).
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Fri Apr 05, 2019 1:07 am    Post subject: Reply with quote

Thanks Hu for that. I recently experienced this with my windows/linux dual boot machine in the worst way manageable. I believe it actually went much further though because I had been writing to the windows partition in an unsafe way that involved some weird mounting control from one system to the other. Later I read that generally dual boot is not good with hibernation for the reason you mentioned I assume. I don't expect at this point to recover my windows laptop, although that would be great but it seems highly unlikely since the linux that is on there works fine I guess if I had to try it would be wipe clean install windows then restore linux. Does that sound about right? I think it could be done. The toughest part might be either the windows install or having to redo some step to allow secure vs. insecure boot option (I don't have an administrator password to bios so this is made incredibly by that).

None of this is in relation to my initial question by the way, since I have two laptops. The question was about the other laptop and that one used to be dual boot ubuntu and gentoo. Then after a while I removed the gentoo installation (attempting to migrate to virtual..but I probably should have kept that on and just switched init systems)...the goal of mine is to have the laptop running on systemd. Therefore at this point ubuntu it works, but now I want to replace or side by side install gentoo with systemd, which I've never administered before. So therefore I needed to know about the swap space In the end I will likely only keep ubuntu as a rescue OS on the hard drive in case I somehow can't get Gentoo properly working in the future.

What is your advice for disabling hibernation in these systems or else can there be any real side effect that is harmful from the situation of hibernating and losing the temporary hibernation data in the swap space? Other than temporary data loss in other words, which I would see as a minor trouble relatively speaking.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Fri Apr 05, 2019 2:04 am    Post subject: Reply with quote

Your Windows/Linux problem is because you cannot safely modify in any way a filesystem visible to a hibernated kernel, because the kernel may assume that no such modifications happen and become confused if they do.

Leaving hibernation enabled is fine and useful. Just remember that if you hibernate, you must resume from that hibernation image before you can use the swap device elsewhere and you must not modify any filesystems that the hibernated image had mounted. If you lose the hibernation image, it's roughly equivalent to crashing the machine due to sudden power loss, kernel panic, etc. You lose all open applications and any unsaved work. Your filesystems may be inconsistent and may require repair.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Fri Apr 05, 2019 2:42 am    Post subject: Reply with quote

Overall I would agree. EDIT: With one major exception that it could become difficult to remember which image was last hibernated, so I guess the safe thing may be to stop writing from one partition to the other in general if I can't also keep track of the hibernated state of that system.

Quote:
Your filesystems may be inconsistent and may require repair.


This too was a good assessment, however because I may have already attempted the repair using a windows recovery program like fsck or chkdsk or whatever and it found problems...I subsequently fixed those problems, but now there is some kind of weirdness in the window bootloader files that can't be fixed by a simple windows boot repair. So while the filesystem exists in good standing I can't for life of me make the proper changes to bootloader in windows. Microsoft is pretty bad too in terms of providing helpful/useful information about the bootloader that isn't either too specific or not specific enough to the problem I'm having. The exact error message I forgot in the Windows blue screen, but it would suggest something wrong with the boot image file. Maybe.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1014

PostPosted: Fri Apr 05, 2019 3:49 am    Post subject: Reply with quote

As for the situation of installing Gentoo next to another systemd installation and making it sort of the "same as" the other one with systemd, which I've never actually attempted supporting. Is the tarball better to install stage3 or stage4 on a new installation for systemd, and what's the diference between these two again?

EDIT: I sort of figured it out by reading a bit more on the wiki. My question now is stage 4 with the bootloader and kernel, so can I complete the rest of the installation from within the stage4, and not a chroot to it from a livecd? I would like to reboot my system, but I'm pretty sure there is a step I need to do in order to modify the system EFI to know to boot the new system partition. Is this just regular updating of bootloader as is mentioned in UEFI section of the installation or something else?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Sat Apr 06, 2019 12:41 am    Post subject: Reply with quote

LIsLinuxIsSogood wrote:
Overall I would agree. EDIT: With one major exception that it could become difficult to remember which image was last hibernated, so I guess the safe thing may be to stop writing from one partition to the other in general if I can't also keep track of the hibernated state of that system.
Yes, that is a risk, and your solution should address it.
LIsLinuxIsSogood wrote:
As for the situation of installing Gentoo next to another systemd installation and making it sort of the "same as" the other one with systemd, which I've never actually attempted supporting. Is the tarball better to install stage3 or stage4 on a new installation for systemd, and what's the diference between these two again?
I don't have an answer to any of these questions, sorry.
LIsLinuxIsSogood wrote:
can I complete the rest of the installation from within the stage4, and not a chroot to it from a livecd?
You can use any general purpose Linux environment, whether from another Gentoo drive, a foreign Linux, or a live CD.
LIsLinuxIsSogood wrote:
Is this just regular updating of bootloader as is mentioned in UEFI section of the installation or something else?
I think so.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum