Difference between revisions of "User:Saul/Laptop"
m (→CPUFreq: Add section.) |
m (→Disabling CPUs: Add section.) |
||
Line 108: | Line 108: | ||
<source lang="bash"> | <source lang="bash"> | ||
sudo apt-get install indicator-cpufreq | sudo apt-get install indicator-cpufreq | ||
+ | </source> | ||
+ | |||
+ | === Disabling CPUs === | ||
+ | This is an interesting one, you can disable what CPUs/Cores get used: | ||
+ | <source lang="bash"> | ||
+ | # Disable core 4 | ||
+ | sudo chcpu -d 4 | ||
+ | |||
+ | # Enable core 4 | ||
+ | sudo chcpu -e 4 | ||
+ | |||
+ | # Disable cores 8-15 | ||
+ | sudo chcpu -d 8-15 | ||
+ | |||
+ | # Enable cores 8-15 | ||
+ | sudo chcpu -e 8-15 | ||
+ | </source> | ||
+ | |||
+ | Now I only get 1-2 Watts difference between 4 and 16 cores idling, but it is something to fiddle with and see what the results are. | ||
+ | |||
+ | Apparently this will also work on some computers: | ||
+ | <source lang="bash"> | ||
+ | # Disable core | ||
+ | sudo echo 0 > /sys/devices/system/cpu/cpu<CPU NUMBER>/online | ||
+ | |||
+ | # Enable core | ||
+ | sudo echo 1 > /sys/devices/system/cpu/cpu<CPU NUMBER>/online | ||
</source> | </source> | ||
Revision as of 23:07, 11 November 2022
Contents
Brightness
At first the brightness controls won't work after a fresh install so here are some steps to try:
- Update all the packages in the update manager, on a fresh install this installs a new kernel version - 5.15.0-41.
- Open the Driver Manager application and use the latest Nvidia one, both 515.48.07 and 470.129.06 worked fine for me.
- Restart the computer
If the brightness controls still do not work after that try the following steps.
sudo nano /etc/default/grub
# Change the line:
# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# To become
# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_native_backlight=1"
sudo update-grub
Then again restart the computer and test again. If it is still not working (it should be) try these next steps:
# WARNING: This next step kills the user interface so make sure you memorize all the steps.
sudo service lightdm stop
# Hit ctrl-alt-f1 to open a session then login using your credentials.
sudo X -configure
sudo cp xorg.conf.new /etc/X11/xorg.conf
sudo reboot
The following notes might be of use if it still is not working but probably won't fix it outright.
The later linux kernels seem to handle the newer hardware better than the older ones so you can try installing mainline and installing a later kernel say 5.16 but make sure to uninstall it again if it does not install without errors. (You can still use it but some things will be broken like dependencies.) Another thing you can try is looking up brightness options for the /etc/X11/xorg.conf file.
Battery
TL;DR;
- Hybrid graphics mode (bios)
- NVIDIA On-Demand mode (nvidia-primus)
- Display 60Hz
- TLP
- sudo systemctl disable docker
The battery life was terrible at first - like less than 3h bad, however this can be fixed to give 10h or more. The first thing to do is ensure the computer is in dynamic graphics mode (set in the bios), this stops forcing the gpu to run all the time. The next thing to do is put nvidia primus (The amd? icon on the bottom right) into NVIDIA On-Demand mode - do not set it to AMD Power Saving Mode because contrary to the name it chews threw a lot of power for some reason. Another thing you can do is change the display to 60hz which saves a bit of battery. The next thing to do is install tlp.
TLP
# Install
sudo apt install tlp tlp-rdw
# Start (alternatively restart the computer)
sudo tlp start
# Verify it is running.
tlp-stat -s
You can further tune tlp by editing /etc/tlp.conf but personally the defaults were good enough for me.
GUI
TLP can be little tricky to figure out what settings need editing, a UI is most helpful for this.
sudo add-apt-repository ppa:linuxuprising/apps;
sudo apt-get update;
sudo apt-get install tlpui;
Then you can open the Tlp-UI application.
My TLP Settings
Usage during work: 10-12 W
# Note that my CPU will not go below a certain level so a low value is safe here.
CPU_SCALING_MAX_FREQ_ON_BAT=1
CPU_ENERGY_PREF_POLICY_ON_BAT=power
SCHED_POWERSAVE_ON_BAT=true
PLATFORM_PROFILE_ON_BAT=low-power
Debugging
Full output:
sudo tlp-stat
Get power mode:
sudo tlp-stat -p
Get battery status:
sudo tlp-stat -b
CPUFreq
CPUFreq is a good applet for quickly changing between CPU governing profiles.
sudo apt-get install indicator-cpufreq
Disabling CPUs
This is an interesting one, you can disable what CPUs/Cores get used:
# Disable core 4
sudo chcpu -d 4
# Enable core 4
sudo chcpu -e 4
# Disable cores 8-15
sudo chcpu -d 8-15
# Enable cores 8-15
sudo chcpu -e 8-15
Now I only get 1-2 Watts difference between 4 and 16 cores idling, but it is something to fiddle with and see what the results are.
Apparently this will also work on some computers:
# Disable core
sudo echo 0 > /sys/devices/system/cpu/cpu<CPU NUMBER>/online
# Enable core
sudo echo 1 > /sys/devices/system/cpu/cpu<CPU NUMBER>/online
Slimbook
You can install and use slimbook with tlp but be warned it does change a lot of tlp settings on install. I have found that Slimbook uses around 3x the battery power on my laptop. Slimbook will give you a UI for configuring some of tlp's options.
# Backup tlp settings.
sudo cp /etc/tlp.conf /etc/tlp.conf.bak
sudo add-apt-repository ppa:slimbook/slimbook
sudo apt update
sudo apt install slimbookbattery
Docker
Beware if you install docker - it chews through a fair bit of battery life so I have it disabled by default after installing:
sudo systemctl disable docker
If you want to stop it manually you need to run:
sudo service docker stop
sudo ifconfig docker0 down
GPU
To check the power draw run:
nvidia-smi -q -d POWER
When power draw is high the Power Draw field has a value but when power draw is low it has the value Unknown Error. Running this command seems to activate the GPU.
Applets
I have installed a couple of applets (Cinnamon) to help me figure out what is happening to the battery life.
- CPU Temperature Indicator
- Power Consumption Display
The Power consumption is the most useful as that immediately tells me what kind of battery life to expect.
Conservative Charging
Note: I have created a applet for cinnamon for toggling this here.
Linux can also modify and view conservative charging mode using the following commands:
# Enable
echo -n "1" | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode > /dev/null
# Disable
echo -n "0" | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode > /dev/null
# View state
cat /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
If you want to make a script to handle this create the file ~/.local/bin/conservative and make it executable with the following contents:
#/bin/bash
MODE=$(cat /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode);
if [ "$1" == "status" ]; then
if [ "$MODE" == "1" ]; then
echo "enabled";
else
echo "disabled";
fi
exit 0;
elif [ "$1" == "enable" ]; then
if [ "$MODE" == "1" ]; then
echo "Conservative charging is already enabled.";
exit 1;
fi
echo -n "1" | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode > /dev/null;
exit 0;
elif [ "$1" == "disable" ]; then
if [ "$MODE" == "0" ]; then
echo "Conservative charging is already disabled.";
exit 1;
fi
echo -n "0" | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode > /dev/null;
exit 0;
else
echo "Usage: conservative [status|enable|disable]";
exit 1;
fi
Then you can use it like so:
# Enable
conservative enable
# Disable
conservative disable
# View state
conservative status