This repository contains Debian packaging for the fan2go fan control daemon. The packaging follows DEP-14 standards and uses git-buildpackage (gbp) workflow.
This is a DEP-14 compliant packaging repository with the following branch structure:
main- Repository automation (.github/workflows/) and documentationupstream- Pristine upstream source codedebian/unstable- Upstream source + debian/ packaging directorypristine-tar- Pristine tar metadata for reproducible source packages
sudo apt-get install devscripts git-buildpackage pristine-tar golang-go libsensors-dev help2man- Clone the repository:
git clone https://github.com/johnwbyrd/fan2go-package.git
cd fan2go-package- Switch to the debian/unstable branch:
git checkout debian/unstable- Build the package:
# Use -nc flag to skip clean phase (upstream Makefile clean rule has issues)
dpkg-buildpackage -us -uc -ncThe resulting .deb packages will be created in the parent directory.
This package faces significant challenges due to incompatibilities between Go modules and dh-golang:
- dh-golang GOPATH vs Go modules: dh-golang was designed for GOPATH-based Go packages but fan2go uses Go modules
- Module cache dependencies: dh_golang tries to analyze and test all dependencies in the module cache
- Build environment conflicts: dh-golang's build environment breaks Go module resolution
Several environment variables and debian/rules overrides are required:
export DH_GOLANG_GO_GENERATE := 1
export GO111MODULE := on
export DH_GOPKG := github.com/markusressel/fan2go
export DH_GOLANG_BUILDPKG := ./cmd/...
export GOPROXY := https://proxy.golang.org,directKey overrides in debian/rules:
override_dh_auto_build: Explicitly runsmake buildsince dh_auto_build doesn't build the binaryoverride_dh_auto_test: Runs diagnostics instead of tests to avoid dependency testing issues
- GOPROXY enabled: Downloads dependencies during build (not ideal for Debian packaging)
- Limited scope:
DH_GOLANG_BUILDPKG := ./cmd/...limits dh-golang to only analyze the main package - Manual testing: Tests are run manually before dpkg-buildpackage to capture output properly
- Package all 39 Go dependencies for Debian to eliminate GOPROXY dependency
- Investigate dh-golang alternatives or improvements for Go modules support
- Work with upstream to improve Makefile clean rule (remove
-ncflag requirement)
fan2go requires 39 Go dependencies that are not currently packaged for Debian:
- github.com/spf13/cobra (and 38 others)
See go.mod in the upstream source for the complete list.
- Monitors upstream releases using
uscan - Automatically imports new upstream versions using
gbp import-orig --merge - Updates the upstream and debian/unstable branches
- Triggers automated builds for new releases
- Tests package building for multiple Debian releases (bookworm, bullseye, trixie)
- Checks out debian/unstable branch for building
- Uses debian:trixie container for consistent build environment
- Runs lintian checks on generated packages
- Captures test output for debugging
- Creates GitHub releases with build artifacts
After building, install the package:
sudo dpkg -i ../fan2go_*.deb
sudo apt-get install -f # Fix any dependency issuesThe package installs:
- Binary:
/usr/bin/fan2go - Default config:
/etc/fan2go/fan2go.yaml - Systemd service:
fan2go.service
Enable the service:
sudo systemctl enable --now fan2go- "go: not found": Install
golang-gopackage, notgolang-1.24 - Clean phase fails: Use
-ncflag with dpkg-buildpackage - Module resolution errors: Check Go environment variables in debian/rules
- Test failures: Tests run manually before dpkg-buildpackage; check test-output.log
- Permission errors: fan2go requires root privileges to access hardware sensors
- Missing sensors: Ensure lm-sensors is properly configured (
sensors-detect) - Service startup: Check
journalctl -u fan2gofor errors
To modify packaging:
- Make changes on debian/unstable branch
- Test build with
dpkg-buildpackage -us -uc -nc - Run lintian checks:
lintian ../*.deb - Update changelog:
dch -i
For upstream updates:
- Use
gbp import-orig --uscan --mergeto import new versions - Resolve any packaging conflicts
- Test build and update packaging as needed