Using Framework With Fedora

Edit 2022/01/02: I erroneously said that I created the /etc/tlp.conf file, where I actually modified the file after downloading the tlp package.

On my previous post, I chose the Framework laptop as my new daily driver.

Well, it’s been a few weeks now, and I wanted to give an update getting it set up. There has been many improvements since the framework laptop launched, I imagine some of these items may no longer be necessary as Linux support naturally improves.

Hardware Setup

The DIY framework laptop came much more assembled than I oiginally thought. I originally thought that I would have to connect the motherboard, battery, monitor, etc. together, but the only piece not already installed was the Wi-Fi card.

I plugged in NVMe SSD and RAM, and I was good to go!

Operating System Setup

After all the hardware installed, I powered up the laptop and launched into my pre-installed Fedora from my AMD laptop. Unfortunately, there was some error for detecting the boot system. I believe this has something to do with changes with UUID, but I didn’t investigate in too much detail.

I created a Fedora 34 bootable USB drive (35 wasn’t released at the time) and reinstalled fedora over my old root partition.

Although I did retain all my essential files from the home drive, I did lose all the installed packages and some of the files saved to the /etc drives.

My older Windows 10 partition booted without issue. Small kudos to Microsoft for getting it right.

Most of fedora worked out of the box. I’m going to highlight a collection the tips I from the Community Framework on Fedora 35 post.

Power Saving Settings

There wasn’t much to tweak for power savings. I downloaded and enabled TLP.

I modified the config file /etc/tlp.conf with 1 line:

PCIE_ASPM_ON_BAT=powersupersave

I also installed powertop, but I used it only to monitor power utilization. Tunables can be tweaked with powertop, but I’ve read that most of the time it ends up conflicting with TLP’s power savings settings.

Enabling Hibernation

There are two power saving sleep modes on the framework laptop, s2idle and deep. According to the Framework community, there are a few issues with the deep sleep on the intel chipset of the framework latop. Currently the best recommendation is to set up s2idle suspend and then hibernate.

Part of the sleep then hibernate configuration process is to actually enable hibernate within Fedora. Hibernate will move all the RAM to disk to fully power of the system. The disk typically used is the /swap partition. Unfortunately, the swap size I had set to was 8 GB, and the recommended size was at least the same amount of RAM. I needed to increase the swap partition size.

I reached out for some help on the #fedora chatroom within IRC. Here’s the list of steps I did to change my swap partition:

  1. shrink /home (this had the most available free space on my hard drive, I used GParted)
  2. swapoff (disable swap on fedora)
  3. wipefs swap partition (remove swap partition)
  4. Create swap partition, I used GParted
  5. reboot
  6. mkswap
  7. swapon

Fedora is a bit unique where by default it creates a ZRAM file as the swap. This is fine for normal OS use, but creates an issue with hibernation as the operating system needs to mount the file to create the swap space. The last step was to mount the swap space upon boot up:

  1. Use blkid to find the UUID of the newly created swap partition
  2. Edit fstab at /etc/fstab
  3. Add the swap mount: UUID=<<Your UUID for swap>> none swap defaults 0 0

After that, I followed the instructions to update GRUB located in this Ctrl blog post.

A lot of work, but success! I was able to hibernate by typing systemctl hibernate.

Enable Suspend then Hibernate

Now that I was able to hibernate reliably, I needed to change the sleep profile to suspend then hibernate.

This was a couple of config file edits:

  1. Edited /etc/systemd/logind.conf HandleLidSwitch=suspend-then-hibernate
  2. Edited /etc/systemd/sleep.conf and changed the following:

    AllowSuspendThenHibernate=yes
    HibernateDelaySec=45min
    

This configured the framework to suspend for the first 45 minutes, and then hibernate afterwards. This lets me boot up quickly if I’m planning on closing the lid and moving around while not having to worry about draining the battery if I close the lid and leave it alone for extended periods of time.

Other tweaks

The following tweaks weren’t listed on the Framework Community forums, but I decided to change them in hopes of additional power savings:

Audio: From the archi wiki on power management - Enabled audio power saving. Powertop was reporting a fairly consistent 2W usage even when there was no audio playing, and this appears to have fixed it.

Wi-Fi: Edit /etc/modprobe.d/iwlwifi.conf with the following:

options iwlwifi power_save=1
options iwlmvm power_scheme=3

I have not noticed any difference in power savings on these settings, so I may reverse them later.

Fixing GRUB Slowness

This was a persistent problem even on my previous AMD laptop; I would get a scrolling cursor running through the grub selection menu before the timer started.

I didn’t find the root cause, but various people reported that it fixed itself by rebuilding the GRUB configuration. This is the command for using updating UEFI (vs. legacy BIOS) GRUB:

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Conclusion

Despite some tradeoffs I made with purchasing a framework laptop, I am very happy with it. With the following tweaks done above, I have decent battery life and I don’t have to worry about my battery completely draining from closing the lid. I do hope that framework is able to continue it’s commitment to open source and implement coreboot in the future to further enhance security and performance.

Day #19 of #100DaystoOffload