Automated post-install setup of Ubuntu 20.04 and 22.04 on the Framework

Automated post-install setup of Ubuntu 20.04 and 22.04 on the Framework Laptop

CAUTION

This has been tested on Ubuntu 20.04.3, 20.04.4 and 22.04 Beta (Linux 5.11, Linux 5.13 and Linux 5.15), on Frameworks with i5, i7 and non-vPro AX210 by a good number of users. It may or may not work on anything that it wasn’t tested on. Work has been done to make it safe for other versions, but testing outside of 20.04 and 22.04 is out of scope. Use your own judgement.

CHANGELOG

Click to see more...
  • Silence spurious errors on 22.04 due to Python packaging.
  • Fix hibernate swap removal in certain cases.
  • Simplify hibernate by adding it as an option to the tldr script.
  • Install HiRes codecs (aptX, LDAC) for PulseAudio to use with Bluetooth devices.
  • Add a workaround for a kernel quirk that should improve idle power consumtion by
    about 2-3W after resuming from suspend, when using the s2idle sleep mode.
  • Add support for Ubuntu 22.04.
  • Update kernel before applying AX210.
  • Disable PSR on Linux 5.13 in order to avoid screen tearing.
  • Updated TL;DR command to handle Linux 5.13 and check for AX210.
  • Remove fingerprint reader prebuilt packages if updated fprintd is found.
  • Remove AX210 workaround after upgrade to Linux 5.13.
  • Increase the number of retries fingerprint auth allows.
  • Disable AX on AX210 when running kernel 5.11.
  • Only apply AX210 workaround if it’s found on the system.
  • Document defaults.yaml usage.
  • Enable graphics acceleration in VMware Workstation Player.
  • Workarounds relevant to Ubuntu 20.04 are only applied on 20.04. Applying the formula on 21.04 or above would skip those. This has not been tested on non-20.04.
  • hibernate was tested on Manjaro 21.1.6. It works and can be used.

Upgrading from Ubuntu 20.04 to 22.04

  1. Perform the upgrade.
  2. Grab the latest version of this Salt formula and re-run it after upgading by following the instructions below.

ATTENTION: In case of broken WiFi on Intel AX210

Click to see more...

If you’ve already applied this formula and your WiFi suddenly stopped working around mid-January 2022, without explanation, chances that your system got upgraded to Linux 5.13. The AX210 workaround used for Linux 5.11 breaks WiFi on 5.13. In order to get your WiFi working, execute the following:

sudo systemctl disable intel-ax210-workaround.service
sudo mv /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.renamed-by-salt /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm
sudo rmmod iwlmvm
sudo rmmod iwlwifi
sudo modprobe iwlwifi

Following that, pull the latest formula and execute it again in order to remove the workaround completely. Executing the command from the TL;DR in a clean location should also do the trick.

If this is your first rodeo and your WiFi isn’t working after fresh Ubuntu 20.04.3 install, get it running by doing this:

sudo mv -f /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.renamed-by-salt
sudo rmmod iwlmvm
sudo rmmod iwlwifi
sudo modprobe iwlwifi

TL;DR

Ideally, read the rest if this is your first time

In order to setup Ubuntu 20.04 or 22.04 with most common config and workarounds needed for the Framework Laptop, connect to the internet, then run the following:

wget -O /tmp/framework-laptop-tldr.sh https://raw.githubusercontent.com/lightrush/framework-laptop-formula/main/framework-laptop-tldr.sh && bash /tmp/framework-laptop-tldr.sh

If you also want hibernate, run the following instead or after:

wget -O /tmp/framework-laptop-tldr.sh https://raw.githubusercontent.com/lightrush/framework-laptop-formula/main/framework-laptop-tldr.sh && bash /tmp/framework-laptop-tldr.sh --enable-hibernate

By default it enables suspend-then-hibernate with 120 minutes delay. That can be changed in defaults.yaml. The hibernate function also creates a swapfile that’s as large as your RAM size plus 1GB.

NB: You have to disable Secure Boot for hibernate to function.

Now reboot your Framework.

Afterwards, you should have:

  • 1 second GRUB menu timeout instead of 30 in case you use /boot on LVM
  • Intel HD audio mic TRRS jack workaround
  • Intel AX210 persistent workaround (doesn’t break on update of linux-firmware) (only on Ubuntu 20.04.3)
  • Suspend to RAM
  • TLP installed and enabled (only on Ubuntu 20.04)
  • Touchpad suspend workarond
  • Working fingerprint reader
  • Hibernate, if you opted to use it
  • No additional power draw after resume from suspend when usind s2idle
  • HiRes codecs (LDAC, aptX) for Bluetooth devices

For more features like 2/3-finger clicking or changing defaults, read the rest.

Updates

This Salt formula is designed to be idempotent. That is, it can be re-run over and over without causing unexpected problems. In fact that’s the intended path for using newer versions. Simply download the latest one and re-run it. For examle when some workaround is no longer needed, running the latest version of the formula should remove it automatically. When some new was added that you want - re-download and re-run it.

Spurious errors on Ubuntu 22.04

If you see errors similar to this:

[ERROR   ] Failed to import module pip, this is due most likely to a syntax error:
...

Fear not as they are benign. They’re caused by a known Salt-related bug that doesn’t affect the functionality of this code.

14 Likes

MOST excellent. If you really wanted to reach a little higher than you are already reaching, if you also automated the installation of the necessary fingerpint software (libfprint, fprint) that would be awesome!

1 Like

I am planning to look into it, but haven’t yet. If you know some veritable instructions for what needs to be done on 20.04, link it to make it easier.

This is what I’ve used. I can’t remember if I used it on 20.04, but I really would prefer to stick to a LTS release, provided everything works. I suspect there may be some dependency mismatches, but am hoping you know more about Linux than me and know your way around those.

1 Like

You and me both.

Thanks for the link. I’ll take a look next time I have a chance.

1 Like

@CJ_Elevated has already done so!
First, download this install script - http://elevatedsystems.tech/media/scripts/FP_Reader_install.sh
then run
cd ./Downloads
and then
bash ./FP_Reader_install.sh

1 Like

Thanks! But did he write that for 20.04 or 21.04. You can’t just assume something for 21.04 will work for 20.04.

̶F̶a̶i̶r̶ ̶p̶o̶i̶n̶t̶,̶ ̶b̶u̶t̶ ̶I̶ ̶r̶a̶n̶ ̶i̶t̶ ̶o̶n̶ ̶P̶o̶p̶!̶_̶O̶S̶ ̶2̶1̶.̶0̶4̶ ̶(̶a̶l̶b̶e̶i̶t̶,̶ ̶n̶o̶t̶ ̶k̶n̶o̶w̶i̶n̶g̶ ̶m̶y̶ ̶m̶i̶s̶t̶a̶k̶e̶,̶ ̶I̶ ̶a̶m̶ ̶v̶e̶r̶y̶ ̶m̶u̶c̶h̶ ̶a̶ ̶L̶i̶n̶u̶x̶ ̶n̶o̶o̶b̶)̶,̶ ̶a̶n̶d̶ ̶i̶t̶ ̶w̶o̶r̶k̶e̶d̶ ̶p̶e̶r̶f̶e̶c̶t̶l̶y̶ ̶f̶i̶n̶e̶.̶

I totally misread your reply. I thought you were TELLING me he wrote it for 20.04. He did write it for 21.04, his video can be found here.

Yep I’ve seen the video. Repos will be different between the two versions and so I don’t think we can assume this will be applicable here.

@nrp as this salt script continues to get fleshed out, could we pin this? I think MANY people would prefer using a LTS distro, and this will correctly help make the process of getting setup on their Framework much easier.

1 Like

To be clear I just added to the work of others and tweaked the script so it should work on most Ubuntu/Debian based distros. The original Debian packages were built for 20.04. I did this so I had a tool to quickly test multiple distros, however, I highly encourage anyone who is trying to build knowledge in Linux to manually work through @Brett_Kosinski solution here.

6 Likes

This is a good resource. Thanks! I’ll probably try to backport the Ubuntu packages from 21.04 or 21.10 first, assuming they work. Failing that it seems this would do as well.

EDIT: Scratch that, libfprint only goes to 1.90.7 in impish. Oh well, building debs or reusing the existing ones it is then.

EDIT2: Or applying the patch mentioned here atop of the Ubuntu libfprint package. That would probably be easiest and most reliable.

Done.

It uses prebuilts I grabbed from here. I couldn’t get it to work properly by just applying the patch from Fedora to libfprint atop of Ubuntu’s libfprint since fprintd also needs a patch. Instead I lazied it out and did it using the prebuilt debs. Seems to work. Unfortunately I can’t seem to edit the original post anymore to indicate that the fingerprint reader is also handled.

1 Like

I haven’t dug too deep but if I want to use your script to configure hibernation but do not want it set and suspend to RAM and the swapfile, is it possible to just leave it s2idle deep and then manually allow hibernation?

I always setup hibernation with a swap partition instead of a file. This was because adjusting a swapfile next to LUKs was an archaic mess and I didn’t even bother. So your script doing the heavy lifting there is nice!

@2disbetter just pushed an update that parametrizes the hibernate state along with a few others. You can now choose whether you want just hibernate, hybrid-sleep or suspend-then-hibernate. I made the last one the default since I think it’s the best compromise and I don’t want to think whether to hibernate or suspend. I want to close my lid and the computer to do the right thing to not waste power and not lose my data. If you want hibernate only, you can change the default by editing defaults.yaml. Documentation is in-line. Unfortunately GNOME got rid of the Hibernate option in the menu so you’d have to install an extension if you want that. So with that change, I think it will do what you want.

Overall I’m pretty happy with the way this turned out. I can roll the whole thing out on the next Framework in the family with 3 commands (which could obviously be rolled into 1 :sweat_smile:).

Idling at 4.2W. Crazy. :sweat_smile:

1 Like

SO yesterday I installed Ubuntu 20.04.3. I installed Brave, and then installed Dash to Panel and Arc Menu extensions. Then I sudo apt full-update’d the thing and rebooted.

After rebooting I installed salt and downloaded your script. Ran it per the TL:DR instructions above. It had a bunch of errors and when I rebooted nothing was fixed.

Based on that lackluster description is there any reason coming to you on why it would have failed?

It’s all in the output log - what comes out in the terminal. I’ve most likely made some mistake somewhere that doesn’t take into account something. Re-run salt-call and paste the log here. Something that I haven’t mentioned is that you can re-run state.apply as may times is you like. If the changes were already done, it would do nothing.

EDIT: I ran a quick install and rolled the formula over it. I did break the AX210 state with a change yesterday as well as there’s a bug in the fingerprint state where it doesn’t install the new library because the Ubuntu version is already installed.

EDIT2: Actually no, I had a config difference in my Salt master which made the AX210 correct on mine but not on masterless machine like you’re running it. Fixed. Also I know what’s going on with the fingerprint states. I’ll fix them after work. Still if you post a log, I’ll know if anything else is broken.

As with ALL scripts you download from strangers on the Internet, instructions should really be:

  • Download script
  • Examine script so you understand what it does
  • Run script

Or words to that effect. I’m sure it’s safe, but downloading and running unknown scripts is a dicy habit to get into.

Ideally. Which is why the instruction starts with go and read the README.md. “Get the source by downloading it” is under TL;DR. Also if you understand what it does, fix bugs and contribute. As is the case with most open source. Unfortunately that’s not an option for a lot of users as often what you download requires domain knowledge. Especially novices. :pensive:

Alright. Fixed after a bit of rework in the failing states, I’ve pushed the changes. Tested them on a different SSD with clean Ubuntu 20.04.3 install on it. It should work.

@2disbetter could you re-download and try again?

Also, idling with WD SN550 instead of SN750 and fewer running services:

1 Like