lightrush / framework-laptop-formula Goto Github PK
View Code? Open in Web Editor NEWSalt formula for setting up Ubuntu on the Framework Laptop
License: Apache License 2.0
Salt formula for setting up Ubuntu on the Framework Laptop
License: Apache License 2.0
See if there's a way to do this. There are reports saying there's a significant speed improvement when WiFi is taken out of powersave with a corresponding power consumption increase. Try to see if there's anything built-in that can toggle powersave depending on AC/BAT state.
Since there's already a variant of the mainboard with non-Realtek audio codec, we should only apply this workaround if Realtek is found. Applying it on a non-Realtek mainboard would lead to unknown effects.
GNOME Tweaks (sudo apt install gnome-tweaks
) can enable two-finger right-clicks. See what gsetting gets changed and implement it within a state.
There are a few easy things that can be changed in tlp.conf to get more battery life at expense of performance. Provide some default with tunables.
I am not expert at salt here, but I wanted to find out what is what. I am applying (some of) the states indivudually.
I have looked at some of the salt documentation and, yes, a little knowledge is a dangerous thing. But you should be able to see below, I applied one state and it failed and another and it succeeded. Now I would like to see a list of the states and what succeeded, what failed, what has not been run yet, and such as test. I would also like to be able to dry-run the state.apply commands, but it is not clear how or if that can be done.
Any suggestions here?
$ git clone [email protected]:lightrush/framework-laptop-formula.git
$ cd framework-laptop
$
$ sudo bash
#
# salt-call -l error --local --file-root="$(pwd)" state.test
local:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or master_tops data matches found. Please see master log for details.
Changes:
Summary for local
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
#
# salt-call -l error --local --file-root="$(pwd)" state.apply intel-audio-workaround
[ERROR ] Source file salt://framework-laptop/files/intel-audio-workaround.conf not found in saltenv 'base'
local:
----------
ID: intel_audio_workaround_modprobe_conf_installed
Function: file.managed
Name: /etc/modprobe.d/intel-audio-workaround.conf
Result: False
Comment: Source file salt://framework-laptop/files/intel-audio-workaround.conf not found in saltenv 'base'
Started: 13:13:59.507277
Duration: 802.34 ms
Changes:
----------
ID: intel_audio_workaround_initramfs_updated
Function: cmd.run
Name: update-initramfs -u
Result: False
Comment: One or more requisite failed: intel-audio-workaround.intel_audio_workaround_modprobe_conf_installed
Started: 13:14:00.309935
Duration: 0.003 ms
Changes:
Summary for local
------------
Succeeded: 0
Failed: 2
------------
Total states run: 2
Total run time: 802.343 ms
root@ray0:/home/ray/Projects/framework-laptop-formula/framework-laptop# salt-call -l error --local --file-root="$(pwd)" state.apply tlp
local:
----------
ID: tlp_package_installed
Function: pkg.installed
Name: tlp
Result: True
Comment: The following packages were installed/updated: tlp
Started: 13:15:15.960058
Duration: 10151.787 ms
Changes:
----------
ethtool:
----------
new:
1:5.4-1
old:
tlp:
----------
new:
1.3.1-2
old:
tlp-rdw:
----------
new:
1.3.1-2
old:
----------
ID: tlp_service_running
Function: service.running
Name: tlp
Result: True
Comment: Service tlp is already enabled, and is running
Started: 13:15:26.120020
Duration: 426.251 ms
Changes:
----------
tlp:
True
Summary for local
------------
Succeeded: 2 (changed=2)
Failed: 0
------------
Total states run: 2
Total run time: 10.578 s
#
# salt-call -l error --local --file-root="$(pwd)" state.test
local:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or master_tops data matches found. Please see master log for details.
Changes:
Summary for local
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
#
# salt-call -l error --local --file-root="$(pwd)" state.list_disabled
local:
#
# salt-call -l error --local --file-root="$(pwd)" state.highstate test
local:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or master_tops data matches found. Please see master log for details.
Changes:
Summary for local
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
#
# salt-call -l error --local --file-root="$(pwd)" state.sls test
local:
Data failed to compile:
----------
No matching sls found for 'test' in env 'base'
#
# salt-call -l error --local --file-root="$(pwd)" state.list_enabled
'state.list_enabled' is not available.
#
# salt-call -l error --local --file-root="$(pwd)" state.check_request
local:
Summary for local
-----------
Succeeded: 0
Failed: 0
-----------
Total states run: 0
Total run time: 0.000 ms
#
# salt-call -l error --local --file-root="$(pwd)" state.apply test
local:
Data failed to compile:
----------
No matching sls found for 'test' in env 'base'
#
# exit
Warnings may spook users who've never seen Salt and make them think something went wrong when everything's actually fine.
Currently a few workarounds are simply not included when the formula is ran on jammy. That's great for a fresh install but if someone upgraded, it would cause leave the workarounds behind. Some of those are breaking in jammy. Instead of not including those states, add cleanup for 22.04 and include them.
Hi @lightrush, thanks for sharing your excellent work. I'm using it on Pop!_OS 22.04 now. Salt-bootstrap didn't have support for Pop!_OS but my PR just got merged.
Pop!_OS uses sytemd-boot instead of grub so the following equivalents were needed:
➜ sudo kernelstub -a "mem_sleep_default=deep"
➜ sudo kernelstub -a "nvme.noacpi=1"
Would you be interested in adding support for Pop!_OS? If so, I can try to learn Salt a bit more and propose a PR.
Thanks again for this super helpful repo and introducing me to Salt.
Maybe the touchpad workaround won't be needed with BIOS v3.06. Check if that's the case. If so, stop applying the workaround by default.
Hey, thanks for creating and maintaining this project! Is it possible to undo the hibernate step? I applied it, but for whatever reason my Framework laptop no longer goes to sleep when I close the lid, so I'm wondering if there's a way to undo it.
There's at least one occasion when my LVM raid1 became inconsistent and needed a refresh when resuming from deep sleep. See if this warrants disabling deep sleep or is there some other workaround. One stupid idea is to make a service that refreshes the raid on resume.
Make the fingerprint more usable since it often doesn't read from the first time.
since I installed this my computer is not suspending anymore when I close the lid
Hello,
Thanks for your formula, it helped me a lot on ubuntu 21.
I recently made a clean install of ubuntu 22.04 (Linux 5.15), and Wifi stopped worked after a few days.
When I run
sudo salt-call -l error --local --file-root="$(pwd)" state.apply framework-laptop.intel-ax210-workaround
I get:
local:
----------
ID: intel_ax210_workaround_linux_generic_latest
Function: pkg.latest
Name: linux-generic-hwe-20.04
Result: True
Comment: Package linux-generic-hwe-20.04 is already up-to-date
Started: 18:51:14.702797
Duration: 1324.113 ms
Changes:
----------
ID: intel_ax210_workaround_service_dead
Function: service.dead
Name: intel-ax210-workaround
Result: True
Comment: The named service intel-ax210-workaround is not available
Started: 18:51:16.035617
Duration: 4.695 ms
Changes:
----------
ID: intel_ax210_workaround_service_removed
Function: file.absent
Name: /etc/systemd/system/intel-ax210-workaround.service
Result: True
Comment: File /etc/systemd/system/intel-ax210-workaround.service is not present
Started: 18:51:16.041953
Duration: 0.354 ms
Changes:
----------
ID: intel_ax210_workaround_service_removed
Function: module.run
Name: service.systemctl_reload
Result: True
Comment: State was not run because none of the onchanges reqs changed
Started: 18:51:16.042977
Duration: 0.002 ms
Changes:
----------
ID: intel_ax210_workaround_firmware_restored
Function: cmd.run
Name: /bin/sh -c "mv -f /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.renamed-by-salt /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm ; rmmod iwlmvm ; rmmod iwlwifi ; modprobe iwlwifi"
Result: True
Comment: unless condition is true
Started: 18:51:16.043511
Duration: 308.665 ms
Changes:
----------
ID: intel_ax210_workaround_firmware_reinstalled
Function: pkg.installed
Name: linux-firmware
Result: True
Comment: unless condition is true
Started: 18:51:16.352294
Duration: 4.037 ms
Changes:
----------
ID: intel_ax210_workaround_modprobe_conf_removed
Function: file.absent
Name: /etc/modprobe.d/intel-ax210-workaround.conf
Result: True
Comment: File /etc/modprobe.d/intel-ax210-workaround.conf is not present
Started: 18:51:16.356399
Duration: 0.282 ms
Changes:
----------
ID: intel_ax210_workaround_initramfs_updated
Function: cmd.run
Name: update-initramfs -u
Result: True
Comment: State was not run because none of the onchanges reqs changed
Started: 18:51:16.356879
Duration: 0.001 ms
Changes:
Summary for local
------------
Succeeded: 8
Failed: 0
------------
Total states run: 8
Total run time: 1.642 s
And if I try the workaround described here immediatly after
I get :
$ sudo systemctl disable intel-ax210-workaround.service
> Failed to disable unit: Unit file intel-ax210-workaround.service does not exist.
$ sudo mv /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.renamed-by-salt /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm
> mv: cannot stat '/lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.renamed-by-salt': No such file or directory
$ sudo rmmod iwlmvm
$ sudo rmmod iwlwifi
$ sudo modprobe iwlwifi
$
I tried booting ubuntu 22 from a usb key and wifi didn't work there either.
I'm a bit lost as how to fix this issue do you have any idea of what's going on ?
Thanks
Setting up Ubuntu on UEFI (with boot on LVM?) always displays the GRUB boot menu with 30 seconds timeout. This is partially due to a workaround that makes sure the menu can be accessed on UEFI systems due to some key handling - https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1800722. Assuming this workaround is valid, we could set the recordfail timeout to some small value like 1-2 seconds in order to not delay the boot process too much as well as allow GRUB menu access in emergencies such as bad kernel update.
Make the state idempotent. Check if the hw exists as well as the kernel version that needs the workaround (5.11).
In an attempt to resolve the occurrence of broken touchpad on resume, stop/start its driver on suspend/resume. Attempt similar implementation to what is described here - https://askubuntu.com/questions/671910/touchpad-not-working-after-suspending-laptop.
Hello,
I just upgraded to ubuntu 22 again :)
I try to run the formula but I am returned a python error :
KeyError: 'config.get'
Full output :
» 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
--2022-05-26 19:39:36-- https://raw.githubusercontent.com/lightrush/framework-laptop-formula/main/framework-laptop-tldr.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 868 [text/plain]
Saving to: ‘/tmp/framework-laptop-tldr.sh’
/tmp/framework-laptop-tldr.sh 100%[=================================================================>] 868 --.-KB/s in 0s
2022-05-26 19:39:37 (92.5 MB/s) - ‘/tmp/framework-laptop-tldr.sh’ saved [868/868]
Hit:1 http://fr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://fr.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 https://updates.signal.org/desktop/apt xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:5 http://fr.archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Fetched 210 kB in 1s (228 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
libc++1
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
salt-common is already the newest version (3004.1+dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
--2022-05-26 19:39:43-- https://github.com/lightrush/framework-laptop-formula/archive/refs/heads/main.zip
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/lightrush/framework-laptop-formula/zip/refs/heads/main [following]
--2022-05-26 19:39:43-- https://codeload.github.com/lightrush/framework-laptop-formula/zip/refs/heads/main
Resolving codeload.github.com (codeload.github.com)... 140.82.121.9
Connecting to codeload.github.com (codeload.github.com)|140.82.121.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 363558 (355K) [application/zip]
Saving to: ‘framework-laptop-formula-main.zip’
framework-laptop-formula-main.zip 100%[=================================================================>] 355.04K 1.02MB/s in 0.3s
2022-05-26 19:39:44 (1.02 MB/s) - ‘framework-laptop-formula-main.zip’ saved [363558/363558]
Archive: framework-laptop-formula-main.zip
925443a4ddbca2c1612e278cab216d982a5e7731
inflating: framework-laptop-formula-main/.gitignore
inflating: framework-laptop-formula-main/LICENSE
inflating: framework-laptop-formula-main/README.md
inflating: framework-laptop-formula-main/framework-laptop-tldr.sh
inflating: framework-laptop-formula-main/framework-laptop/defaults.yaml
inflating: framework-laptop-formula-main/framework-laptop/files/10-framework-sec-trim.rules
inflating: framework-laptop-formula-main/framework-laptop/files/com.ubuntu.enable-hibernate.pkla
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/libfprint_delete_device_prints.py
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/debian.libfprint.install.patch
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/debian.rules.patch
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/fprintd-doc_1.94.0-1_all.deb
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/fprintd_1.94.0-1_amd64.deb
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/gir1.2-fprint-2.0_1.94.1-1_amd64.deb
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/libfprint-2-2_1.94.1-1_amd64.deb
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/libfprint-2-doc_1.94.1-1_all.deb
inflating: framework-laptop-formula-main/framework-laptop/files/fingerprint-reader/prebuilt/libpam-fprintd_1.94.0-1_amd64.deb
inflating: framework-laptop-formula-main/framework-laptop/files/intel-audio-workaround.conf
inflating: framework-laptop-formula-main/framework-laptop/files/intel-ax210-workaround.conf
inflating: framework-laptop-formula-main/framework-laptop/files/intel-ax210-workaround.service
inflating: framework-laptop-formula-main/framework-laptop/files/touchpad-suspend-workaround
inflating: framework-laptop-formula-main/framework-laptop/fingerprint-reader.sls
inflating: framework-laptop-formula-main/framework-laptop/framework-sec-trim-enable.sls
inflating: framework-laptop-formula-main/framework-laptop/grub-cleanup.sls
inflating: framework-laptop-formula-main/framework-laptop/grub-decrease-menu-timeout.sls
inflating: framework-laptop-formula-main/framework-laptop/hibernate.sls
inflating: framework-laptop-formula-main/framework-laptop/hpet-disable.sls
inflating: framework-laptop-formula-main/framework-laptop/init.sls
inflating: framework-laptop-formula-main/framework-laptop/intel-audio-workaround.sls
inflating: framework-laptop-formula-main/framework-laptop/intel-ax210-workaround.sls
inflating: framework-laptop-formula-main/framework-laptop/intel-xe-tearing-workaround.sls
inflating: framework-laptop-formula-main/framework-laptop/map.jinja
inflating: framework-laptop-formula-main/framework-laptop/mem-sleep-default.sls
inflating: framework-laptop-formula-main/framework-laptop/mouse-accel-profile.sls
inflating: framework-laptop-formula-main/framework-laptop/oscodenamemap.yaml
inflating: framework-laptop-formula-main/framework-laptop/osfamilymap.yaml
inflating: framework-laptop-formula-main/framework-laptop/osmap.yaml
inflating: framework-laptop-formula-main/framework-laptop/pillar.example
inflating: framework-laptop-formula-main/framework-laptop/post-resume-power-draw-workaround.sls
inflating: framework-laptop-formula-main/framework-laptop/pulseaudio-bt-hires-codecs.sls
inflating: framework-laptop-formula-main/framework-laptop/salt-masterless.sls
inflating: framework-laptop-formula-main/framework-laptop/tlp.sls
inflating: framework-laptop-formula-main/framework-laptop/touchpad-click-method.sls
inflating: framework-laptop-formula-main/framework-laptop/touchpad-suspend-workaround.sls
inflating: framework-laptop-formula-main/framework-laptop/vmware-graphics-acceleration.sls
Traceback (most recent call last):
File "/usr/bin/salt-call", line 33, in <module>
sys.exit(load_entry_point('salt==3004.1', 'console_scripts', 'salt-call')())
File "/usr/lib/python3/dist-packages/salt/scripts.py", line 432, in salt_call
client.run()
File "/usr/lib/python3/dist-packages/salt/cli/call.py", line 55, in run
caller.run()
File "/usr/lib/python3/dist-packages/salt/cli/caller.py", line 111, in run
ret = self.call()
File "/usr/lib/python3/dist-packages/salt/cli/caller.py", line 218, in call
ret["return"] = self.minion.executors[fname](
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 10, in execute
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/state.py", line 793, in apply_
return sls(mods, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/state.py", line 1295, in sls
opts["test"] = _get_test_value(test, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/state.py", line 475, in _get_test_value
elif __salt__["config.get"]("test", omit_opts=True) is True:
File "/usr/lib/python3/dist-packages/salt/loader/context.py", line 78, in __getitem__
return self.value()[item]
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 334, in __getitem__
super().__getitem__(item) # try to get the item from the dictionary
File "/usr/lib/python3/dist-packages/salt/utils/lazy.py", line 105, in __getitem__
raise KeyError(key)
KeyError: 'config.get'
Nobody on the internet seems to be having the same issue, so I was wondering if you have any idea of what is happening ?
Thanks
Rewrite this in a state:
echo 'ACTION=="add|change", ATTRS{idVendor}=="13fe", ATTRS{idProduct}=="6500", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"' | sudo tee /etc/udev/rules.d/10-framework-sec-trim.rules
This gets harder to copy without error as more edge cases need to be covered. Put it in a bootstrap script and change the readme to call that instead.
There seems to be some timeout that has to expire before it accepts the password. See what it is and whether it could be shortened.
The touchpad got broken once on resume so far. Some people are reporting the same in the forum. See if disabling deep sleep is warranted.
Use Ubuntu-provided SaltStack across the board.
Detail and workaround here. Make a state to apply it.
There's an audio workaround in a couple of threads that allows headsets to be used in the headphone jack. See what it is and implement is as a state.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.