Skip to content

feat(env): Detect Linux package manager (apt-get/dnf) when installing prerequisites - #1021

Open
rkntan wants to merge 1 commit into
espressif:masterfrom
rkntan:feature/detect_linux_package_manager
Open

feat(env): Detect Linux package manager (apt-get/dnf) when installing prerequisites#1021
rkntan wants to merge 1 commit into
espressif:masterfrom
rkntan:feature/detect_linux_package_manager

Conversation

@rkntan

@rkntan rkntan commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Fixes #1010

./build.py install currently assumes a Debian-based system and unconditionally runs sudo apt-get install ... on Linux. On distributions without apt-get (e.g. Fedora), the install step fails:

sudo: apt-get: command not found
A fatal error occurred: install prerequisites failed!

Changes

  • Added a small detect_linux_package_manager() helper that uses shutil.which() to find the first available supported package manager (apt-get, dnf).
  • When dnf is detected, prerequisites are installed with the package list from the ESP-IDF Get Started guide for Fedora (libffi/openssl dev headers are not needed there per IDF docs; libusbx replaces libusb-1.0-0).
  • If no supported package manager is found, the script falls back to the previous apt-get behavior with a warning, so existing behavior on unknown systems is unchanged (the existing error message still prints the exact command to run manually).

Testing

Credit to @ChaiJahan for reporting the issue and proposing the initial approach.

Previously `./build.py install` unconditionally used apt-get on Linux,
which fails on non-Debian distributions such as Fedora.

Now the script detects the available package manager (apt-get or dnf)
and uses the matching prerequisite install command. The dnf package
list follows the ESP-IDF Get Started guide for Fedora. If no supported
package manager is found, it falls back to the previous apt-get
behavior with a warning.

Closes espressif#1010
@ustccw

ustccw commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

thanks for the feedback! will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Linux prerequisite installation by detecting package manager (apt vs dnf)

2 participants