Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
New notebook, questions on swap and booting
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
Gentlenoob
n00b
n00b


Joined: 10 Apr 2008
Posts: 37

PostPosted: Mon Aug 26, 2019 9:35 pm    Post subject: New notebook, questions on swap and booting Reply with quote

Hi all,

I finally got myself a new HP laptop (labeled 14-MA1311NG). It comes with Windows 10 Home preinstalled. Of course I want it to run Gentoo, preferably in a dual boot setup alongside with Windows.

So far things look ok'ish. Without much hassle I've been able to liberate enough disk space, boot the minimal install ISO from USB-stick (secure boot turned off), connect to LAN (luckily, this box still got a RJ-45) and play around with fdisk, parted, mkfs.* and the likes. The only slowdown is myself tiptoeing around, since my last install was on legacy hardware 7 years ago. In particular I've got to catch up on (U)EFI, booting options and a bit of partitioning, so here it goes:

* How much swap do I need? The box has got 16 GB RAM, so I'd guess it's rarely needed, but what about hibernation? I've not yet found a straightforward answer. I'd opt for 16 GB swap, i.e. same as RAM size, but that's just gut feeling.

* How do I best setup booting? As said, I'd like to dual boot with Windows. Is this case implicitly covered by the handbooks "Default:GRUB2" section? I.e. is windows still bootable once I've performed the steps mentioned there, in particular 'grub-install', which, if I'm not mistaken, modifies the EFI system partition? When googling for dual boot, I only seem to find the "direct" UEFI boot variant with stub kernel and without grub or other bootloader in between. However this method seems to have its own caveats, e.g. boot command line to be compiled in the kernel and not easily modifiable.

Thanks a lot for some clarifying remarks, pointers and hints
Ralph
Back to top
View user's profile Send private message
wokko
n00b
n00b


Joined: 31 Aug 2013
Posts: 2

PostPosted: Tue Aug 27, 2019 12:03 am    Post subject: Reply with quote

With swap on 16G you can either do half or equal if you want to hibernate
With booting you use windows uefi partition (need to mount it before you run your grub commands) for grubs/gentoo efi image
The hand book covers it for grub/uefi https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader#Install
Just make sure you have os-prober installed
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14290

PostPosted: Tue Aug 27, 2019 1:06 am    Post subject: Reply with quote

For hibernation, you need sufficient swap space that every useful page of RAM can be written to swap during hibernation, so that you can restore everything when you resume. A page is "useful" if it contains data that cannot be recreated from some other source. Mapped copies of program text can be reread from disk. Pages used for caching data loaded from disk can be reread. Application data cannot, so it must be saved. The number of useful pages varies over time and as a function of how you use the system. I have a system where I can hibernate with everything open, unless Firefox has been used to view certain poorly written webapps, in which case Firefox has bloated up so far that I can't page out everything. In those cases, closing Firefox before hibernation frees enough memory that I can hibernate successfully.
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1769
Location: United Kingdom

PostPosted: Tue Aug 27, 2019 3:22 am    Post subject: Reply with quote

Gentlenoob wrote:
How much swap do I need? The box has got 16 GB RAM, so I'd guess it's rarely needed, but what about hibernation? I've not yet found a straightforward answer. I'd opt for 16 GB swap, i.e. same as RAM size, but that's just gut feeling.

You won't find a straightforward answer because the amount of swap required depends on so many factors. For hibernation these include what exactly the machine is running at the time you want to put it into hibernation, whether the kernel has been configured to compress the RAM image, which kernel compression mode has been configured, the precise data that has to be compressed, and no doubt other factors. You will often see recommendations to make the size of the swap partition the same as the size of the RAM if you want to be able to put the computer into hibernation. In fact, the Linux kernel is normally configured to compress the contents of the RAM image for hibernation, and I personally have seen the disk image of 4GB of RAM on an old laptop of mine compressed to 23% of that size in a specific case. Nevertheless, in my opinion if you have a large drive and 16GB of RAM you may as well just take the easy route and allocate the size of the swap partition to be the same as the RAM size, even if all of the swap partition may never be used in practice in your case. That way you are essentially guaranteed to be able to put the computer into hibernation without having to think about it. I have a 16 GB swap partition on a laptop that has 16 GB RAM, for example.

Red Hat publishes a table with recommendations for swap space in RHEL 7 with and without the ability to hibernate, but I think 1.5 times the amount of RAM for your model of laptop with 16 GB RAM would be complete overkill:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/ch-swapspace

Red Hat wrote:
Table 15.1. Recommended System Swap Space

Amount of RAM in the system    Recommended swap space      Recommended swap space if allowing for hibernation

⩽ 2 GB                                         2 times the amount of RAM         3 times the amount of RAM

> 2 GB – 8 GB                              Equal to the amount of RAM        2 times the amount of RAM

> 8 GB – 64 GB                            At least 4 GB                             1.5 times the amount of RAM

> 64 GB                                       At least 4 GB                             Hibernation not recommended

_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
rpruen
n00b
n00b


Joined: 08 Aug 2019
Posts: 33
Location: Burnham on Sea

PostPosted: Tue Aug 27, 2019 7:09 am    Post subject: Reply with quote

I recently installed a new laptop, a HP 255 G6

My thinking for the swap was to allocate as much as the machine can have RAM (16GB in my case), though only 4 GB is fitted yet. Allowing to hibernate the machine to disk even if you have filled up the memory slots. Its a small fraction of the 1TB drive.

As for installing on UEFI that went smoothly following the manual, you need to mount the EFI partition before installing Grub2. You can choose either to have grub boot windows, or choose to keep the option within the UEFI boot manager. I have only Gentoo on the laptop so don't use that feature.


Hope it goes smoothly for you

Regards

Richard
Back to top
View user's profile Send private message
Gentlenoob
n00b
n00b


Joined: 10 Apr 2008
Posts: 37

PostPosted: Tue Aug 27, 2019 8:50 am    Post subject: Reply with quote

Thanks to all of you! Progress is slow right now as I haven't much spare time. So I'll play it safe and stick with 16 GB swap. Indeed I missed that os-prober remark in the handbook and will look into it.

Cheers, Ralph
Back to top
View user's profile Send private message
Gentlenoob
n00b
n00b


Joined: 10 Apr 2008
Posts: 37

PostPosted: Thu Aug 29, 2019 2:48 pm    Post subject: Reply with quote

Hi again,

still not much spare time for real progress. I did some more googling on UEFI and dual booting, but don't get it yet. So please bear with me and share some more of your knowledge.

Right now, without having meddled with grub or any other boot-/uefi-tools yet, there's the UEFI firmware, which acts as a bootloader (NB: I'm not on solid grounds with terminology either). I.e. after power up, when the screen lits, I can press ESC, which brings up a simple text-menu, which offers to boot Windows, or USB, or enter the BIOS (and few more items I forgot). Without ESC pressed, it boots up Windows after a few seconds. All this is as expected and fine with me.

Now, what will happen once I'll install Grub according to the handbook? 'emerge grub; emerge os-prober' won't do any harm as I read it. But the next steps along
Code:

  mount /dev/<ThePreinstalledESPpartition> /boot
  grub-install --target=x86_64-efi --efi-directory=/boot
  grub-mkconfig -o /boot/grub/grub.cfg

scare me. Specifically:

  • What's the bootup sequence supposed to be after those steps? Will Grub somehow override/-write my UEFI/firmware/partition/whatever and come up first after powerup? I hope it won't! Ideally, in order to keep things well separated, I'd like to have the same UEFI-firmware-bootloader with the same entries as before (Windows, BIOS, eventually USB), plus by now some additional 'Grub' entry, which then would bring me to Grub proper as a secondary boot loader, from where I finally can boot Gentoo. Since I fear that this is not the result of the handbook recipe, any hints on how to accomplish this?
  • Is there some recommended way to backup in particular boot related stuff, to easily revert to the original behaviour if needed? From the legacy days I remember e.g. 'fdisk /mbr' from within Windows, 'dd' on boot sectors or whole partitions from RescueCDs and some such, which I'd guess won't do anymore nowadays.


Sorry for being overly cautious, and thanks again
Ralph
Back to top
View user's profile Send private message
rpruen
n00b
n00b


Joined: 08 Aug 2019
Posts: 33
Location: Burnham on Sea

PostPosted: Thu Aug 29, 2019 3:09 pm    Post subject: Reply with quote

Gentlenoob wrote:

[*] What's the bootup sequence supposed to be after those steps? Will Grub somehow override/-write my UEFI/firmware/partition/whatever and come up first after powerup? I hope it won't! Ideally, in order to keep things well separated, I'd like to have the same UEFI-firmware-bootloader with the same entries as before (Windows, BIOS, eventually USB), plus by now some additional 'Grub' entry, which then would bring me to Grub proper as a secondary boot loader, from where I finally can boot Gentoo. Since I fear that this is not the result of the handbook recipe, any hints on how to accomplish this?


You should still get the option to press escape, but what will happen is grub should load if you don't press escape, and will give you the option to load either windows or Gentoo.

To do what you want it looks like you need to use efibootmgr to create an efi boot for gentoo, and then to load grub.

Gentlenoob wrote:

[*] Is there some recommended way to backup in particular boot related stuff, to easily revert to the original behaviour if needed? From the legacy days I remember e.g. 'fdisk /mbr' from within Windows, 'dd' on boot sectors or whole partitions from RescueCDs and some such, which I'd guess won't do anymore nowadays.
[/list]


dd will work to image the disk and create a backup, assuming you have some media that will hod the image, its only a few hundred Mb so should be easy enough.

Gentlenoob wrote:

Sorry for being overly cautious, and thanks again
Ralph


Thats ok, im sure it will turn out easier than you expect.


Regards
Richard
Back to top
View user's profile Send private message
Prof. Frink
Apprentice
Apprentice


Joined: 07 Jan 2017
Posts: 176

PostPosted: Wed Sep 04, 2019 3:38 pm    Post subject: Reply with quote

If you have 16 GB of RAM, you do not need a SWAP, from my point of view. I have 32 GB and do not use a swap for some reasons on my system. But usually I would suggest 1.25*(GB of RAM) = GB swap.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14290

PostPosted: Thu Sep 05, 2019 1:20 am    Post subject: Reply with quote

Prof. Frink wrote:
If you have 16 GB of RAM, you do not need a SWAP, from my point of view. I have 32 GB and do not use a swap for some reasons on my system. But usually I would suggest 1.25*(GB of RAM) = GB swap.
How do you suggest the OP put the laptop into hibernate if there is no swap space?
Back to top
View user's profile Send private message
Prof. Frink
Apprentice
Apprentice


Joined: 07 Jan 2017
Posts: 176

PostPosted: Thu Sep 05, 2019 3:01 am    Post subject: Reply with quote

Hu wrote:
Prof. Frink wrote:
If you have 16 GB of RAM, you do not need a SWAP, from my point of view. I have 32 GB and do not use a swap for some reasons on my system. But usually I would suggest 1.25*(GB of RAM) = GB swap.
How do you suggest the OP put the laptop into hibernate if there is no swap space?


Ah okay, sorry. I did not read the thread carefully, sorry for that. Of course this is not possible, I suggest the standby-mode instead, but of course, this is a different thing.
Back to top
View user's profile Send private message
Gentlenoob
n00b
n00b


Joined: 10 Apr 2008
Posts: 37

PostPosted: Sun Sep 08, 2019 10:21 pm    Post subject: Reply with quote

... just a short update: As Richard and others suggested, my reservations around booting were mostly unfounded. Going by the handbook, grub2 (which until now I had avoided, and which I still have mixed feelings about) seems to do the right thing and I'm now happily dual-booting Gentoo and Windows. Let's hope it stays that way after the next Windows-update.

WiFi seems to work, as well as X, except for the touchpad, which is one of those Elan-I2C devices that seem to need extra attention. So some more rounds of tweaking are due, whenever time permits.

Cheers, Ralph
Back to top
View user's profile Send private message
Gentlenoob
n00b
n00b


Joined: 10 Apr 2008
Posts: 37

PostPosted: Thu Sep 19, 2019 10:55 pm    Post subject: Reply with quote

... the touchpad took me a while. After playing around for hours with a plethora of elantech, psmouse, smbus, etc. kernel modules, options and parameters, I finally cheated (should have done that much earlier) and booted into the latest ubuntu iso, where the touchpad just worked out of the box.

It seems that the modules I've been missing all the time relate to some i2c_designware driver, for whatever reason. I must admit that I don't really get how ps/2, psaux, smbus, i2c, and whatever are supposed to play together. Here's what finally made the difference for me
Code:

CONFIG_I2C_DESIGNWARE_CORE=m
CONFIG_I2C_DESIGNWARE_PLATFORM=m
CONFIG_I2C_DESIGNWARE_PCI=m

next to all the other options that might be somewhat relevant
Code:

CONFIG_REGMAP_I2C=m
CONFIG_MOUSE_ELAN_I2C=m
CONFIG_MOUSE_ELAN_I2C_I2C=y
CONFIG_MOUSE_ELAN_I2C_SMBUS=y
CONFIG_I2C=m
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=m
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=m
CONFIG_I2C_ALGOBIT=m
CONFIG_I2C_I801=m
CONFIG_I2C_ISCH=m
CONFIG_I2C_ISMT=m
CONFIG_SND_SOC_I2C_AND_SPI=m
CONFIG_I2C_HID=m
CONFIG_RTC_I2C_AND_SPI=m
CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_MOUSE_PS2_ELANTECH_SMBUS=y
CONFIG_MOUSE_ELAN_I2C=m
CONFIG_MOUSE_ELAN_I2C_I2C=y
CONFIG_MOUSE_ELAN_I2C_SMBUS=y
CONFIG_X86_INTEL_LPSS=y
CONFIG_MFD_INTEL_LPSS=m
CONFIG_MFD_INTEL_LPSS_ACPI=m
CONFIG_MFD_INTEL_LPSS_PCI=m

I'll eventually try and strip that down some more.

But hooray! Finally a functional new Gentoo laptop!

Cheers, Ralph
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