tui: require graphical session for pkexec and fall back to sudo

Only select pkexec as the default TUI elevation tool when running in a
local graphical session (DISPLAY or WAYLAND_DISPLAY set and not over
SSH). Without a graphical polkit agent or active logind session (e.g.,
over SSH, in tmux/screen, or on a TTY), pkexec's internal text agent
can fail with 'No session for cookie'.

Also detect that polkitd 'No session for cookie' failure in
run_elevated_cmd() and automatically fall back to sudo when available.
4 files changed
tree: 4b41cb43f04c24f0321f8754e2b3af03b9cb2973
  1. .github/
  2. .vscode/
  3. docs/
  4. src/
  5. .gitignore
  6. .pre-commit-config.yaml
  7. codecov.yml
  8. LICENSE
  9. Makefile
  10. psr.py
  11. pyproject.toml
  12. README.md
README.md

Helpful tools for debugging AMD and Intel s2idle systems

codecov PyPI

This repository hosts open tools that are useful for debugging issues on systems which use the s2idle (Low Power S0 Idle) suspend state.

Both AMD and Intel platforms are supported. The prerequisites that are checked are selected based on the CPU vendor, and the NVIDIA proprietary driver is supported on both. See platform support for the details.

Installation

Using a python wheel (Generic)

It is suggested to install tools in a virtual environment either using pipx, uvx, or python3 -m venv.

From PyPI

amd-debug-tools is distributed as a python wheel, which is a binary package format for Python. To install from PyPI, run the following command:

pipx install amd-debug-tools

Ensuring path

If you have not used a pipx environment before, you may need to run the following command to set up the environment:

pipx ensurepath

This will add the pipx environment to your path.

Distro (Arch)

amd-debug-tools has been packaged for Arch Linux (and derivatives). You can install it using:

pacman -Sy amd-debug-tools

Distro (Debian)

amd-debug-tools has been packaged for Debian Linux. You can install it using:

apt install amd-debug-tools

From source

To build the package from source, you will need to the python3-build package natively installed by your distribution package manager. Then you can generate and install a wheel by running the following commands:

python3 -m build
pipx install dist/amd-debug-tools-*.whl

Running in-tree

Documentation about running directly from a git checkout is available here.

Tools

Each tool has its own individual documentation page:

Platform support

The s2idle tool supports AMD and Intel platforms, including systems using the NVIDIA proprietary driver. See platform support for the details of what is checked on each platform.