Fix Linux Mint Docker repository detection in lib/system.sh

- Replace Docker convenience script with manual repository setup in lib/system.sh
- Add proper Ubuntu codename detection for Linux Mint using UBUNTU_CODENAME from /etc/os-release
- Include fallback version mapping for older Linux Mint versions (22.x->noble, 21.x->jammy, 20.x->focal)
- Add debug output to track codename detection
- Resolves issue where get.docker.com script was using incorrect "xia" codename instead of "noble"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Stephen Klein
2025-07-19 23:35:58 -04:00
parent 4fd78ec40f
commit ce0f7f2ae4
4 changed files with 148 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
# HOPS Discord Channel Header
**HOPS - Homelab Orchestration Provisioning Script** 🏠
Cross-platform automation tool for deploying homelab infrastructure using Docker Compose. Menu-driven installation and management of media servers, download clients, monitoring tools, and more. Supports Linux, macOS, and Windows (WSL2).
🔗 **GitHub**: https://github.com/skiercm/hops
+47 -2
View File
@@ -811,6 +811,7 @@ check_existing_docker_macos() {
# Install Docker for the current platform
install_docker() {
echo "DEBUG: install_docker() function called from lib/system.sh"
info "🐳 Installing Docker..."
case "$OS_NAME_LOWER" in
@@ -1119,9 +1120,53 @@ install_docker() {
fi
fi
# Install fresh Docker using the official script
# Install fresh Docker using manual repository setup
info "📦 Installing Docker Engine..."
curl -fsSL https://get.docker.com | sh
# Install required packages
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
# Add Docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker repository with proper Ubuntu codename detection for Linux Mint
local ubuntu_codename
if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then
# Linux Mint provides UBUNTU_CODENAME in /etc/os-release
if [[ -f /etc/os-release ]]; then
ubuntu_codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2)
fi
# Fallback to version mapping if UBUNTU_CODENAME not found
if [[ -z "$ubuntu_codename" ]]; then
case "$(lsb_release -rs)" in
"22"|"22.1"|"22.2"|"22.3")
ubuntu_codename="noble" # Ubuntu 24.04
;;
"21"|"21.1"|"21.2"|"21.3")
ubuntu_codename="jammy" # Ubuntu 22.04
;;
"20"|"20.1"|"20.2"|"20.3")
ubuntu_codename="focal" # Ubuntu 20.04
;;
*)
ubuntu_codename="noble" # Default to latest LTS
;;
esac
fi
else
ubuntu_codename=$(lsb_release -cs)
fi
info "Using Ubuntu codename: $ubuntu_codename for Docker repository"
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $ubuntu_codename stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update package index with Docker packages
apt-get update
# Install Docker
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Add user to docker group if we're running with sudo
if [[ -n "$SUDO_USER" ]]; then
+1
View File
@@ -69,6 +69,7 @@ install_docker() {
ubuntu_codename=$(lsb_release -cs)
fi
echo "DEBUG: Detected OS: $(lsb_release -is), Ubuntu codename: $ubuntu_codename"
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $ubuntu_codename stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update package index with Docker packages
+95
View File
@@ -0,0 +1,95 @@
# HOPS Linux Mint Docker Repository Troubleshooting Summary
## Date: July 19, 2025
### Problem Description
HOPS installation failing on Linux Mint 22.1 with Docker repository error:
```
E: The repository 'https://download.docker.com/linux/ubuntu xia Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
```
### Root Cause Analysis
- Linux Mint uses its own codenames (e.g., "xia" for version 22.1)
- Docker repositories are structured around Ubuntu codenames (e.g., "noble", "jammy", "focal")
- HOPS was using `lsb_release -cs` which returns "xia" instead of the Ubuntu base codename
- Docker doesn't have a repository for Linux Mint's "xia" codename
### System Information (Linux Mint 22.1)
```
Distributor ID: LinuxMint
Description: Linux Mint 22.1
Release: 22.1
Codename: xia
UBUNTU_CODENAME=noble (from /etc/os-release)
```
### Troubleshooting Steps Attempted
#### 1. Initial Fix Attempt (Commit af57a77)
**Files Modified:** `privileged-setup`, `lib/privileges.sh`
**Approach:** Added Linux Mint version to Ubuntu codename mapping
- Mint 22.x → Ubuntu 24.04 (noble)
- Mint 21.x → Ubuntu 22.04 (jammy)
- Mint 20.x → Ubuntu 20.04 (focal)
**Result:** Still failed with same error
#### 2. System Cleanup
**Commands Executed:**
```bash
sudo rm -f /etc/apt/sources.list.d/docker*
sudo rm -f /etc/apt/sources.list.d/*docker*
sudo rm -f /usr/share/keyrings/docker*
sudo rm -f /etc/apt/keyrings/docker*
sudo grep -i docker /etc/apt/sources.list
sudo apt clean
sudo apt autoclean
```
**Result:** Confirmed clean state, but error persisted
#### 3. Improved Fix (Commit 4fd78ec)
**Files Modified:** `privileged-setup`, `lib/privileges.sh`
**Approach:** Use `UBUNTU_CODENAME` from `/etc/os-release` with fallback to version mapping
```bash
# Primary method: Read UBUNTU_CODENAME from /etc/os-release
ubuntu_codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2)
# Fallback: Version mapping if UBUNTU_CODENAME not found
```
**Result:** Still experiencing same error after system cleanup
#### 4. Discovery of UBUNTU_CODENAME
**Key Finding:** Linux Mint 22.1 provides `UBUNTU_CODENAME=noble` in `/etc/os-release`
- This is the correct Ubuntu codename that Docker repositories support
- Should eliminate need for manual version mapping
### Current Status
- Two commits pushed to fix the issue
- System cleanup performed on Linux Mint machine
- Error persists despite fixes
- User is updating Linux Mint system and rebooting before next test
### Next Steps
1. Test HOPS installation after Linux Mint system updates and reboot
2. If issue persists, investigate:
- Whether updated code is actually being executed
- Alternative installation paths being used
- System-level caching preventing fix from taking effect
3. Consider manual repository configuration as verification step
4. Update changelog if fix is successful
### Technical Notes
- Linux Mint consistently provides `UBUNTU_CODENAME` in modern versions
- Using this field is more reliable than version-based mapping
- Docker installation uses Ubuntu repositories for Debian-based distributions
- Issue affects all Linux Mint installations using HOPS
### Files Modified
- `privileged-setup` (lines 43-70)
- `lib/privileges.sh` (lines 199-226)
### Git Commits
- `af57a77`: Initial Linux Mint version mapping fix
- `4fd78ec`: Improved fix using UBUNTU_CODENAME detection