Check Battery and Power State with upower

A laptop that "randomly" drops to 5 percent is easier to debug once you can see what upower actually knows, and every query here is read-only. It talks to the UPower daemon and does not change charging policy, suspend settings or hardware.

Allow about ten minutes. You need a shell and the upower package. This guide was checked with UPower 1.90.3, installed as package version 1.90.3-1. Output is hardware-dependent, so use the shape of the output as your guide rather than copying battery names from another machine.

1. Confirm the client and daemon

Start with a version check. It is an ordinary command and does not require sudo:

$ upower --version
UPower client version 1.90.3
UPower daemon version 1.90.3

The client talks to upowerd over the system D-Bus. If this command cannot contact the daemon, the later queries will fail too. Do not solve a read-only query by restarting services as a first response: check the error, confirm the package is installed, and inspect the daemon's service status with your distribution's normal service tools.

Checkpoint: both version lines should appear. If they do not, stop here and fix the package or daemon connection before interpreting device output.

2. List the object paths

Ask UPower to enumerate its device objects:

$ upower --enumerate
/org/freedesktop/UPower/devices/DisplayDevice

Each line is a D-Bus object path, not a friendly battery label. A machine with a physical battery may also show paths such as /org/freedesktop/UPower/devices/battery_BAT0. A desktop or virtual machine may only expose the composite DisplayDevice, or no useful battery at all.

Capture a path instead of guessing one:

device_path=$(upower --enumerate | sed -n '1p')
printf 'first device: %s\n' "$device_path"

This is safe because it only stores text. The first path is not necessarily a physical battery, so use the full list when you need a particular device.

3. Read one device

Pass an object path to --show-info. The option prints the properties for that object:

$ upower --show-info /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         no
  updated:              Tue Sep 22 06:15:27 2026 (471502 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       none
    percentage:          0%
    icon-name:          'battery-missing-symbolic'

These values describe this host's current object. The updated age can be large when the machine has no battery or when a device has not reported a recent change. A percentage of zero alongside power supply: no is not proof a battery is empty: read the device type and power-supply fields together.

For a real battery, look for fields such as its state, percentage, energy and time estimates. Their presence and values depend on the device and the daemon. Do not build a script around a fixed line number or assume every laptop exports every field.

Checkpoint: verify the path came from --enumerate. If --show-info reports an unknown object, enumerate again: device paths can differ between machines and can disappear when hardware is removed.

4. Get a complete snapshot

When you need the daemon-wide picture, use --dump:

$ upower --dump
Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         no
  ...

Daemon:
  daemon-version:  1.90.3
  on-battery:      no
  lid-is-closed:   no
  lid-is-present:  no
  critical-action: HybridSleep

The dump includes every object and a daemon section. It is useful for a support record or a quick human inspection, but a poor machine-readable format. If a script needs stable data, use the UPower D-Bus API or a library designed for it rather than scraping presentation text.

Safety boundary: --dump does not apply the displayed critical-action, change the lid policy or request suspend. It reports configuration and state only. No elevated privilege is normally required for these client queries.

5. Watch for changes

Use --monitor when you need a live event stream:

$ upower --monitor
Monitoring activity from the power daemon. Press Ctrl+C to cancel.

The command stays attached and prints a line when a power source is added, removed or changed. Press Ctrl+C to stop it: that is the recovery action, since monitoring itself makes no persistent change.

For full device details on each event, use --monitor-detail instead. Expect no further output while nothing changes.

$ timeout 30s upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.

Tip: an apparently idle terminal can mean the monitor is working normally, not that it has frozen. timeout is optional, but useful in a script or a quick diagnostic; its non-zero status means the time limit ended the monitor, not that UPower reported a power failure.

Common traps

For the installed command, --help lists the available operations, including short forms such as -e, -d, -m, -i and -v. The local manpage is older and only documents the monitoring options in detail, so prefer the installed help and the output from the command itself when checking version-specific options.

Done means