I just installed NIxoS on my Thinkpad X1 Carbon that is 3 years old. My battery drains within 10 min if its unplugged. I used to have Manjaro installed and my battery would last an hour or more, with Nixos i barely have enough time to make a coffee before my battery is almost drained.
Please point me in the right direction to see what config i need to change to get the battery utilization to be more manageable.
Even 1 hour battery life is not a lot for any decent laptop. Unless you max screen brightness, compile on all core with a 100% load or something like that. Should be several hours of normal workloads.
Device: /org/freedesktop/UPower/devices/line_power_AC
native-path: AC
power supply: yes
updated: Wed 15 Nov 2023 11:03:50 AM CET (12 seconds ago)
has history: no
has statistics: no
line-power
warning-level: none
online: no
icon-name: 'ac-adapter-symbolic'
Device: /org/freedesktop/UPower/devices/battery_BAT0
native-path: BAT0
vendor: LGC
model: 5B10W13930
serial: 3444
power supply: yes
updated: Wed 15 Nov 2023 11:04:00 AM CET (2 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: none
energy: 50.2 Wh
energy-empty: 0 Wh
energy-full: 50.94 Wh
energy-full-design: 51 Wh
energy-rate: 7.223 W
voltage: 15.982 V
charge-cycles: 3752
time to empty: 6.9 hours
percentage: 98%
capacity: 99.8824%
technology: lithium-polymer
icon-name: 'battery-full-symbolic'
History (charge):
1700042640 98.000 discharging
History (rate):
1700042640 7.223 discharging
Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001
native-path: ucsi-source-psy-USBC000:001
power supply: yes
updated: Wed 15 Nov 2023 10:39:35 AM CET (1467 seconds ago)
has history: no
has statistics: no
line-power
warning-level: none
online: no
icon-name: 'ac-adapter-symbolic'
Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o002
native-path: ucsi-source-psy-USBC000:002
power supply: yes
updated: Wed 15 Nov 2023 11:03:49 AM CET (13 seconds ago)
has history: no
has statistics: no
line-power
warning-level: none
online: no
icon-name: 'ac-adapter-symbolic'
Device: /org/freedesktop/UPower/devices/DisplayDevice
power supply: yes
updated: Wed 15 Nov 2023 11:04:00 AM CET (2 seconds ago)
has history: no
has statistics: no
battery
present: yes
state: discharging
warning-level: none
energy: 50.2 Wh
energy-full: 50.94 Wh
energy-rate: 7.223 W
charge-cycles: N/A
time to empty: 6.9 hours
percentage: 98%
icon-name: 'battery-full-symbolic'
Daemon:
daemon-version: 1.90.0
on-battery: yes
lid-is-closed: no
lid-is-present: yes
critical-action: PowerOff
my battery is not that great for sure, but the level of discharge im seeing with nixos ive never seen before. 2 days ago i was on manjaro, battery would last 1 hr or so. now that i installed nixos, i get maybe 10 min
The energy-rate: 7.223 W for basically doing nothing is okayish, Iād say. Also you can see that it estimates time to empty: 6.9 hours at that rate. Now of course once you draw 16 Watts that changes the equation.
Something is broken with your Laptop. The reporting says that even in the last screenshot, when you draw a quite high 15W of power, it should last 2.4hours until empty. In the (I assume) idle case with 7W of power draw, it reported 7 hours. If your battery is done for after 10 minutes, then your battery controller that produces these numbers has quite the wrong idea of your battery state.
Iām also running on a X1 Carbon (Gen 9) that is close to three years old and while the battery life is not stellar, I never bothered to optimize it and it still runs for close to two hours even under very high loads (live synthesizer sessions) and a lot longer under light load.
so what next steps do u recommend? is the battery controller wack or is the battery dead? 2 days ago on arch/manjaro it was at least lasting an hour. or is there some setting on nixos that can get me back to the 1hr battery mark?
You need to monitor power draw in real-time. I recommend powertop. If itās not single-digit at idle, look into whatās causing that at that moment. If your 50Wh battery is drained in an hour, you must be drawing an average of 50W which is quite a lot.
It can also show you C-states for cores and package. Here you want to be in the highest one your platform supports for minimal idle draw. If C-state residency is not >80%, your CPU or peripherals are likely actively doing something and you might want to look into whether they should be doing that.
Having read through this thread, it sounds to me that you canāt trust the power reporting, neither with NixOS nor Manjaro. As others have pointed out, it just doesnāt seem reasonable that a software flaw could drain an entire healthy battery in one hour, let alone ten minutes. That leaves two options: that the physical battery is almost dead, and/or that the reported power level is incorrect and causing the laptop to shut down prematurely.
The motherboardās setup screen from a laptop that recent should show a battery level on it, alongside the UEFI/BIOS and other boot settings. I would suggest that you:
Use the laptop (running NixOS) with the power cable until itās fully charged
Unplug the power and use it normally until it turns itself off due to low power
Attempt to turn it back on, but into the āSETUPā screen rather than booting into NixOS
Read the battery level from that screen
If the battery is reported to be something like 30% or higher, then you have a software problem relating to power reporting in NixOS, probably coming from the Linux kernel itself.
If the battery is reported to be lower than about 30%, then you have a dying battery or hardware power reporting failure. In either case, youāll almost certainly need to replace the battery.
I hope this helps! In conclusion, I think itās very likely the problem is a hardware issue or incompatible Linux kernel version. I donāt think NixOS or Manjaro is specifically at fault.
interesting, depends on the tweaks and mods u add. if its stock standard nixos, then thereās absolutely NOTHING special about nixos except its a real pain to configure at first. do you have a git-hub repo or something?
I havenāt manually added any mods AFAIK. It feels like the base kernel in NixOS is maybe optimized for a different kind of machine than Iām running (Xeon + Nvidia). I still prefer to use NixOS just for the sense of order.
Might open a separate thread trying to figure out the performance difference when I have more time. Donāt want to hijack this one.
It might be because installer sets powerManagement.cpuFreqGovernor = "powersave";
You might want change āpowersaveā to āondemandā or āperformanceā
See: NixOS Search
Also linux-zen kernel helps responsiveness under heavy load you can use zen kernel by setting boot.kernelPackages = pkgs.linuxPackages_zen;
I already had my cpuFreqGovernor set to āperformanceā. Tried activating zen packages as @Alper-Celik suggested but not sure I notice a difference.
Running the ācheeseā GNOME webcam app under NixOS has it at ~0.5 frames per second. In Manjaro itās at least 15 FPS. Not that I really use it. Zoom/Jitsi run fine under NixOS. So yeah, itās not that urgent in my case.