[L14 Battery] Constant discharge + Charge in Qubes

Thanks for letting me know I’ll be waiting for news.

Any idea what the cause of this might be with Qubes?

Power barrel jack is physically plugged in, but yet, status file reports Discharging and charge_now continues to increase:

$ date && cat /sys/class/power_supply/BAT0/status && cat /sys/class/power_supply/BAT0/charge_now
Thu Jun 24 12:37:27 MDT 2021
Discharging
2381000
$ 
$ date && cat /sys/class/power_supply/BAT0/status && cat /sys/class/power_supply/BAT0/charge_now
Thu Jun 24 12:38:11 MDT 2021
Discharging
2402000
$

:confused:

More info:

$ date && upower --dump
Thu Jun 24 13:03:45 MDT 2021
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Thu 24 Jun 2021 12:20:00 PM MDT (2625 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:               Notebook
  model:                BAT
  serial:               0001
  power supply:         yes
  updated:              Thu 24 Jun 2021 01:02:21 PM MDT (84 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              18.63 Wh
    energy-empty:        0 Wh
    energy-full:         49.008 Wh
    energy-full-design:  52.8 Wh
    energy-rate:         10.488 W
    voltage:             7.797 V
    time to empty:       1.8 hours
    percentage:          37%
    capacity:            92.8182%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (charge):
    1624561341	37.000	discharging
  History (rate):
    1624561341	10.488	discharging

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Thu 24 Jun 2021 01:02:21 PM MDT (84 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              18.63 Wh
    energy-full:         49.008 Wh
    energy-rate:         10.488 W
    time to empty:       1.8 hours
    percentage:          37%
    icon-name:          'battery-good-symbolic'

Daemon:
  daemon-version:  0.99.6
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: PowerOff
$ 
$ date && upower --dump
Thu Jun 24 13:07:41 MDT 2021
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Thu 24 Jun 2021 12:20:00 PM MDT (2861 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:               Notebook
  model:                BAT
  serial:               0001
  power supply:         yes
  updated:              Thu 24 Jun 2021 01:06:21 PM MDT (80 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              19.584 Wh
    energy-empty:        0 Wh
    energy-full:         49.008 Wh
    energy-full-design:  52.8 Wh
    energy-rate:         10.488 W
    voltage:             7.81 V
    time to empty:       1.9 hours
    percentage:          39%
    capacity:            92.8182%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (charge):
    1624561581	39.000	discharging
  History (rate):
    1624561581	10.488	discharging

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Thu 24 Jun 2021 01:06:21 PM MDT (80 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              19.584 Wh
    energy-full:         49.008 Wh
    energy-rate:         10.488 W
    time to empty:       1.9 hours
    percentage:          39%
    icon-name:          'battery-good-symbolic'

Daemon:
  daemon-version:  0.99.6
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: PowerOff
$
2 Likes

I’m experiencing same type of behavior. One weird thing is that energy-full-desing for me is also only 52,8Wh even though it should be 66,8Wh

Thanks for posting your own experiences people. Good to hear I’m not the only one experiencing battery/charging issues with the L14 in Qubes

Same issue with preinstalled PureOS (not showing full battery capacity).

The weird battery behavior I have been seeing in Qubes 4.0.4 only occurs after the first suspend, and seems related to all ACPI events no longer occuring. If I reboot, everything works fine. For example:

  1. From a powered down state, power on.
  2. xfce4-power-manager and upowerd all handle un/plugging the charger properly. The battery percentage seems to make sense. The Fn+F5 and Fn+F6 keys work properly to change the screen brightness.
  3. Close the laptop lid which triggers a suspend.
  4. Open the laptop lid. The laptop stays suspended. Press the power button, the laptop resumes from suspend to the login screen.
  5. Notice that xfce4-power-manager and upowerd no longer handle un/plugging the charger properly. The Fn+F5 and Fn+F6 keys no longer work.
  6. Reboot, back to behavior at #1.

I’m wondering if this is a problem with the embedded controller. I don’t know if getting the librem-ec-acpi-dkms driver installed would resolve this problem. I gave it a go but ran into problems trying to get it built for Fedora-25 (what dom0 is using).

Related output from journalctl -b | grep --ignore-case "acpi":

### System boot
Jun 29 18:16:57 dom0 kernel: ACPI: Early table checksum verification disabled
Jun 29 18:16:57 dom0 kernel: ACPI: RSDP 0x00000000000F0000 000024 (v02 COREv4)
Jun 29 18:16:57 dom0 kernel: ACPI: XSDT 0x0000000099B510E0 000064 (v01 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: FACP 0x0000000099B54B80 000114 (v06 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: DSDT 0x0000000099B51280 0038FE (v02 COREv4 COREBOOT 20110725 INTL 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: FACS 0x0000000099B51240 000040
Jun 29 18:16:57 dom0 kernel: ACPI: FACS 0x0000000099B51240 000040
Jun 29 18:16:57 dom0 kernel: ACPI: SSDT 0x0000000099B54CA0 002130 (v02 COREv4 COREBOOT 0000002A CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: MCFG 0x0000000099B56DD0 00003C (v01 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: TCPA 0x0000000099B56E10 000032 (v02 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: LPIT 0x0000000099B56E50 000094 (v00 COREv4 COREBOOT 0000002A CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: APIC 0x0000000099B56EF0 0000B2 (v03 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: RMAD 0x0000000099B56FB0 000088 (v01 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: HPET 0x0000000099B57040 000038 (v01 COREv4 COREBOOT 00000000 CORE 20200925)
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving FACP table memory at [mem 0x99b54b80-0x99b54c93]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving DSDT table memory at [mem 0x99b51280-0x99b54b7d]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving FACS table memory at [mem 0x99b51240-0x99b5127f]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving FACS table memory at [mem 0x99b51240-0x99b5127f]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving SSDT table memory at [mem 0x99b54ca0-0x99b56dcf]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving MCFG table memory at [mem 0x99b56dd0-0x99b56e0b]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving TCPA table memory at [mem 0x99b56e10-0x99b56e41]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving LPIT table memory at [mem 0x99b56e50-0x99b56ee3]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving APIC table memory at [mem 0x99b56ef0-0x99b56fa1]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving RMAD table memory at [mem 0x99b56fb0-0x99b57037]
Jun 29 18:16:57 dom0 kernel: ACPI: Reserving HPET table memory at [mem 0x99b57040-0x99b57077]
Jun 29 18:16:57 dom0 kernel: ACPI: Local APIC address 0xfee00000
Jun 29 18:16:57 dom0 kernel: ACPI: PM-Timer IO Port: 0x1808
Jun 29 18:16:57 dom0 kernel: ACPI: Local APIC address 0xfee00000
Jun 29 18:16:57 dom0 kernel: ACPI: LAPIC_NMI (acpi_id[0xff] high edge lint[0x1])
Jun 29 18:16:57 dom0 kernel: ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
Jun 29 18:16:57 dom0 kernel: ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
Jun 29 18:16:57 dom0 kernel: ACPI: IRQ0 used by override.
Jun 29 18:16:57 dom0 kernel: ACPI: IRQ9 used by override.
Jun 29 18:16:57 dom0 kernel: Using ACPI (MADT) for SMP configuration information
Jun 29 18:16:57 dom0 kernel: ACPI: HPET id: 0x8086a701 base: 0xfed00000
Jun 29 18:16:57 dom0 kernel: ACPI: Core revision 20190816
Jun 29 18:16:57 dom0 kernel: ACPI: bus type PCI registered
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(Module Device)
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(Processor Device)
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(3.0 _SCP Extensions)
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(Processor Aggregator Device)
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(Linux-Dell-Video)
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
Jun 29 18:16:57 dom0 kernel: ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
Jun 29 18:16:57 dom0 kernel: ACPI: 2 ACPI AML tables successfully acquired and loaded
Jun 29 18:16:57 dom0 kernel: ACPI: EC: EC started
Jun 29 18:16:57 dom0 kernel: ACPI: EC: interrupt blocked
Jun 29 18:16:57 dom0 kernel: ACPI: \_SB_.PCI0.LPCB.EC0_: Used as first EC
Jun 29 18:16:57 dom0 kernel: ACPI: \_SB_.PCI0.LPCB.EC0_: GPE=0x50, EC_CMD/EC_SC=0x66, EC_DATA=0x62
Jun 29 18:16:57 dom0 kernel: ACPI: \_SB_.PCI0.LPCB.EC0_: Boot DSDT EC used to handle transactions
Jun 29 18:16:57 dom0 kernel: ACPI: Interpreter enabled
Jun 29 18:16:57 dom0 kernel: ACPI: (supports S0 S3 S5)
Jun 29 18:16:57 dom0 kernel: ACPI: Using IOAPIC for interrupt routing
Jun 29 18:16:57 dom0 kernel: PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in ACPI motherboard resources
Jun 29 18:16:57 dom0 kernel: PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
Jun 29 18:16:57 dom0 kernel: ACPI: Enabled 1 GPEs in block 00 to 7F
Jun 29 18:16:57 dom0 kernel: ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
Jun 29 18:16:57 dom0 kernel: acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
Jun 29 18:16:57 dom0 kernel: acpi PNP0A08:00: _OSC: OS now controls [PME AER PCIeCapability LTR]
Jun 29 18:16:57 dom0 kernel: ACPI: EC: interrupt unblocked
Jun 29 18:16:57 dom0 kernel: ACPI: EC: event unblocked
Jun 29 18:16:57 dom0 kernel: ACPI: \_SB_.PCI0.LPCB.EC0_: GPE=0x50, EC_CMD/EC_SC=0x66, EC_DATA=0x62
Jun 29 18:16:57 dom0 kernel: ACPI: \_SB_.PCI0.LPCB.EC0_: Boot DSDT EC used to handle transactions and events
Jun 29 18:16:57 dom0 kernel: ACPI: bus type USB registered
Jun 29 18:16:57 dom0 kernel: PCI: Using ACPI for IRQ routing
Jun 29 18:16:57 dom0 kernel: pnp: PnP ACPI init
Jun 29 18:16:57 dom0 kernel: system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
Jun 29 18:16:57 dom0 kernel: system 00:01: Plug and Play ACPI device, IDs PNP0103 PNP0c01 (active)
Jun 29 18:16:57 dom0 kernel: system 00:02: Plug and Play ACPI device, IDs PNP0c02 (active)
Jun 29 18:16:57 dom0 kernel: pnp 00:03: Plug and Play ACPI device, IDs PNP0b00 (active)
Jun 29 18:16:57 dom0 kernel: pnp 00:04: Plug and Play ACPI device, IDs PNP0303 PNP030b (active)
Jun 29 18:16:57 dom0 kernel: pnp 00:05: Plug and Play ACPI device, IDs PNP0f13 (active)
Jun 29 18:16:57 dom0 kernel: pnp 00:06: Plug and Play ACPI device, IDs PNP0c31 (active)
Jun 29 18:16:57 dom0 kernel: pnp: PnP ACPI: found 7 devices
Jun 29 18:16:57 dom0 kernel: ACPI: AC Adapter [AC] (on-line)
Jun 29 18:16:57 dom0 kernel: ACPI: Power Button [PWRB]
Jun 29 18:16:57 dom0 kernel: ACPI: Sleep Button [SLPB]
Jun 29 18:16:57 dom0 kernel: ACPI: Lid Switch [LID0]
Jun 29 18:16:57 dom0 kernel: ACPI: Power Button [PWRF]
Jun 29 18:16:57 dom0 kernel: hpet_acpi_add: no address or irqs in _CRS
Jun 29 18:16:57 dom0 kernel: battery: ACPI: Battery Slot [BAT0] (battery present)
Jun 29 18:16:59 dom0 kernel: ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
Jun 29 18:16:59 dom0 kernel: acpi device:03: registered as cooling_device6
### Suspend via lid close
Jun 29 18:17:20 dom0 kernel: xen_acpi_processor: Uploading Xen processor PM info
Jun 29 18:17:20 dom0 kernel: xen_acpi_processor: (CX): Hypervisor error (-14) for ACPI CPU1
Jun 29 18:17:20 dom0 kernel: xen_acpi_processor: (CX): Hypervisor error (-14) for ACPI CPU3
Jun 29 18:17:20 dom0 kernel: xen_acpi_processor: (CX): Hypervisor error (-14) for ACPI CPU5
Jun 29 18:17:20 dom0 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-backlight@backlight:acpi_video0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 29 18:17:20 dom0 systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:acpi_video0...
Jun 29 18:17:20 dom0 systemd[1]: Started Load/Save Screen Backlight Brightness of backlight:acpi_video0.
### Resume via lid open and power button press
Jun 29 18:23:21 dom0 kernel: ACPI: EC: interrupt blocked
Jun 29 18:23:21 dom0 kernel: ACPI: Preparing to enter system sleep state S3
Jun 29 18:23:21 dom0 kernel: ACPI: EC: event blocked
Jun 29 18:23:21 dom0 kernel: ACPI: EC: EC stopped
Jun 29 18:23:21 dom0 kernel: Modules linked in: loop ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter joydev snd_hda_codec_hdmi snd_soc_skl hid_multitouch snd_soc_hdac_hda snd_hda_ext_core snd_soc_sst_ipc snd_hda_codec_realtek snd_soc_sst_dsp iTCO_wdt snd_soc_acpi_intel_match snd_soc_acpi iTCO_vendor_support snd_hda_codec_generic ledtrig_audio snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine ath9k snd_hda_intel snd_intel_nhlt ath9k_common snd_hda_codec ath9k_hw snd_hda_core snd_hwdep snd_seq mac80211 snd_seq_device x86_pkg_temp_thermal intel_powerclamp coretemp snd_pcm ath snd_timer cfg80211 snd rfkill intel_lpss_pci pcspkr intel_lpss r8169 i2c_i801 soundcore libarc4 idma64 int340x_thermal_zone intel_soc_dts_iosf pinctrl_cannonlake pinctrl_intel intel_hid sparse_keymap xen_acpi_processor xenfs ip_tables dm_thin_pool dm_persistent_data libcrc32c dm_bio_prison dm_crypt i915 nvme crct10dif_pclmul crc32_pclmul crc32c_intel i2c_algo_bit drm_kms_helper ghash_clmulni_intel xhci_pci drm
Jun 29 18:23:21 dom0 kernel: ACPI: Low-level resume complete
Jun 29 18:23:21 dom0 kernel: ACPI: EC: EC started
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: Uploading Xen processor PM info
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (CX): Hypervisor error (-14) for ACPI CPU1
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (_PXX): Hypervisor error (-19) for ACPI CPU1
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (CX): Hypervisor error (-14) for ACPI CPU3
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (_PXX): Hypervisor error (-19) for ACPI CPU3
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (CX): Hypervisor error (-14) for ACPI CPU5
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (_PXX): Hypervisor error (-19) for ACPI CPU5
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (_PXX): Hypervisor error (-19) for ACPI CPU7
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (_PXX): Hypervisor error (-19) for ACPI CPU9
Jun 29 18:23:21 dom0 kernel: xen_acpi_processor: (_PXX): Hypervisor error (-19) for ACPI CPU11
Jun 29 18:23:21 dom0 kernel: ACPI: Waking up from system sleep state S3
Jun 29 18:23:21 dom0 kernel: ACPI: EC: interrupt unblocked
Jun 29 18:23:21 dom0 kernel: ACPI: EC: event unblocked

Related Arch Linux bug (0 and 1) describing the same behavior, root cause was a problem with the proprietary Samsung embedded controller: “The problem is that Samsung’s embedded controller stops sending GPE events if it still is waiting for previous GPE events to be queried from it.”

I can confirm that installing the librem_ec_acpi DKMS driver resolved the above problems. My guess is the bugs mentioned above, where the embedded controller gets into a stuck state, is what was happening. Nicole’s driver handles all ACPI notifications (see librem_ec_notify method). It would be nice if this driver made it to the upstream kernel particularly if the laptop is going to be marketed as the “best qubes laptop”.

For others, I used the following commands from dom0 (I tried to build a package to be copied and installed from dom0 using a fedora-25 template but ran into problem after problem so I went the direct DKMS route):

$ sudo qubes-dom0-update kernel-devel dkms gcc
$
$ sudo mkdir /usr/src/librem_ec_acpi-1.0.0 
$
$ # Create the following file with the contents below
$ sudo vim /usr/src/librem_ec_acpi-1.0.0/dkms.conf 
PACKAGE_NAME="librem_ec_acpi"
PACKAGE_VERSION="1.0.0"
BUILT_MODULE_NAME[0]="librem_ec_acpi"
DEST_MODULE_LOCATION[0]="/extra/"
AUTOINSTALL="yes"
$
$ sudo vim /usr/src/librem_ec_acpi-1.0.0/Makefile
obj-m                       += librem_ec_acpi.o

clean:
	rm -f *.o *.ko *~
	rm -f .librem_ec_acpi.* *.mod.c Module.symvers modules.order
	rm -fr .tmp_versions
	rm -f Makefile.xen
$
$ sudo vim /usr/src/librem_ec_acpi-1.0.0/librem_ec_acpi.c
<contents from https://source.puri.sm/nicole.faerber/librem-ec-acpi-dkms/-/blob/master/librem_ec_acpi.c>
$
$ sudo dkms build librem_ec_acpi/1.0.0
$
$ sudo dkms install librem_ec_acpi/1.0.0
5 Likes

Thanks for the instructions, I managed to follow and install the DKMS and now /sys/class/power_supply/BAT0/ has all the same entries as showed off in the post.

However, even after multiple restarts it still exhibits the same behavior as before unfortunately. Not sure why.

Edit:
Even after setting charge thresholds (to 60/80 for example) it still likes to start charging at 98%.

Edit2:
It appears that XFCE Power manager might just not like updating. Also these thresholds appear to be need to be set on boot everytime.

One thing that I have noticed is that battery led doesn’t indicate charging when xfce4 power manager notifies that battery is charging. This is without setting charge threshold

Hi leaningtress,

could you help me. I followed your instructions but when I build it gives me:

Error! echo
Your kernel headers for kernel 5.4.98-1.fc25.qubes.x86_64 cannout be found at /lib/modules/5.4.98-1.fc25.qubes.86_64/build or /lib/modules/5.4.98-1.fc25.qubes.x86_64/source.

I got it working under PureOS by installing the kernel-headers. However, on Qubes kernel-headers and kernel-devel are already installed.
Do you know what to do?

The issue seems to be that the kernel and the kernel-devel package don’t fit together:

dnf list installed kernel-devel kernel-headers kernel
kernel.x86_64 1000:5.4.98-1.fc25.qubes @anaconda
kernel-devel.x86_64 1000:5.4.125-1.fc25.qubes @qubes-dom0-cached
kernel-headers.x86_64 4.13.16-100.fc25 @qubes-dom0-chached

Still don’t know what to do. I have tried uninstall and reinstalling, still no difference.

I’ve fixed my issues by:

sudo qubes-dom0-update kernel

Then installed it via Yum-Extender Gui

Then according to “dnf list installed kernel” I had the old and new one still installed. I did:

sudo qubes-dom0-update kernel-qubes-vm --best --allowerasing

which is most likely not necessary since it is for the VMs not dom0.
Then:

sudo dnf remove kernel-5.4.98

The next hurdle was that the build process failed. I figued I had to download librem_ec_acpi.c myself from the link and put it in /usr/src/librem_ec_acpo-1.0.0/librem_ec_acpi.c.
The reason probably is that I am using Sys-Whonix for updates so it did not download the file.

Thanks a lot leaningtrees, it works!!! :slight_smile:
I am really dumb I set the start threshold to 40 and my battery was at 70. Consequently, it did not charge. It just did what it was meant to do.

cat /sys/class/power_supply/BAT0/status

gives you “unknown” when the notebook is running on powerplug. The LED indicates the same with the white color. I think it is a bug of fce4-powermanager that is says charging, though the battery is not charging at all.
It gives you “charging”, when it is really charging and “discharging” when it is discharging.

Should I mark learningtrees’ answer as the solution? It seems to have helped a few people and fixes issues.

I have the following issues remaining after installing the DKMS driver to get it to charge (running Qubes):

  • Same issue as fbk where i get discharge-charge-discharge-charge while connected to power
  • Sometimes on power disconnect complete power off of the laptop. Not failing over to battery quick enough?
  • When suspended it drains the battery quite fast
  • Fans are going loud too often. Changing governor to powersave or disabling turbo mode results in no CPU scaling at all and a very slow laptop. Need to find some way to reduce aggressive CPU scaling without killing it completely.
1 Like

When I attempt to adjust the start and end threshold with echo, I get a bash error that permission is denied. What am I doing wrong and how do I correct this?

May be you’re just missing sudo? And be sure to do it in dom0.

I have attempted using sudo with no change. I am admittedly a newbie to qubes and linux as a whole, so maybe I am missing something. As far as using dom0, should I be doing it a different way other than using the terminal emulator in the applications menu?

Everything else seem to have worked through there, and I get 100 and 0 for my start/stop threshold check.

Hey There,

Thanks for your post, Qubes is next level troubleshooting so every post is appreciated. I am having charging retention issues right now on my Qubes Librem 14.

In your Jul '21 post you mentioned fixing your issues with using the command sudo qubes-dom0-update kernel then you say
“Then installed it via Yum-Extender Gui” What is this it you are referring to?

I also attempted to run sudo dnf remove kernel-5.4.98 and an error resulted stating "The operation would result in removing the booted kernel: kernel-1000:5.4.98-1.fc25.qubes.x86_64.

Thank you kindly

These steps worked for me: https://source.puri.sm/-/snippets/1170

I have Qubes OS 4.2. I have executed the commands for Qubes OS 4.1 described in the solution, but I keep getting a message about charging and the end of charging approximately every 5-15 minutes. At the same time, the actual battery charge does not change and remains at 98%. Perhaps some adjustments need to be made for Qubes OS 4.2?

1 Like

Here is my script to install dkms automatically

  1. First
sudo qubes-dom0-update -y
sudo reboot
  1. The script (works on 4.2)
    Change first the VM variable for your AppVM
#!/bin/bash
VM="personal1"
sudo qubes-dom0-update dkms kernel-devel
qvm-run --pass-io $VM -- curl -O https://source.puri.sm/nicole.faerber/librem-ec-acpi-dkms/-/archive/master/librem-ec-acpi-dkms-master.tar.gz
qvm-run --pass-io $VM 'cat /home/user/librem-ec-acpi-dkms-master.tar.gz' > librem-ec-acpi-dkms-master.tar.gz
qvm-run --pass-io $VM -- rm /home/user/librem-ec-acpi-dkms-master.tar.gz
tar xvf librem-ec-acpi-dkms-master.tar.gz
rm librem-ec-acpi-dkms-master.tar.gz
cd librem-ec-acpi-dkms-master
cp debian/librem-ec-acpi-dkms.dkms dkms.conf
tee dkms.conf <<EOF
PACKAGE_NAME="librem_ec_acpi"
PACKAGE_VERSION="1.0"
BUILT_MODULE_NAME[0]="librem_ec_acpi"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="yes"
EOF

sudo dkms add ./
sudo qubes-dom0-update flex bison
sudo cp /boot/config-`uname -r` /usr/src/kernels/`uname -r`/.config
rm librem-ec-acpi-dkms-master
cd /usr/src/kernels/`uname -r`
sudo mkdir Documentation
sudo cp .config Documentation/Kconfig
sudo make oldconfig && sudo make prepare M="$(pwd)"
sudo dkms build librem_ec_acpi/1.0 --force
sudo dkms install librem_ec_acpi/1.0 --force

echo "librem_ec_acpi	       #####  0 ?"
lsmod | grep librem_ec_acpi
#librem_ec_acpi         16384  0

echo "90 ?"
cat /sys/class/power_supply/BAT0/charge_control_start_threshold
#90
echo "95 ?"
cat /sys/class/power_supply/BAT0/charge_control_end_threshold
#95

sudo systemctl enable dkms
cd ~
2 Likes