Skip to content

Instantly share code, notes, and snippets.

@renxida
Created September 8, 2025 22:01
Show Gist options
  • Select an option

  • Save renxida/37161063b2abae50263a49ef95b0e6c1 to your computer and use it in GitHub Desktop.

Select an option

Save renxida/37161063b2abae50263a49ef95b0e6c1 to your computer and use it in GitHub Desktop.
Fix for RunPod CLI (runpodctl) DNS resolution issues on Termux

RunPod CLI on Termux - Setup & DNS Fix Guide

Problem

RunPod CLI (runpodctl) fails on Termux with DNS resolution errors because:

  1. Termux doesn't have /etc/resolv.conf (uses Android's DNS)
  2. Go binaries try to use localhost (::1) as DNS server
  3. Missing certificate paths that Linux programs expect

Solution

Use proot to map Termux paths to standard Linux paths.

Setup Steps

1. Install RunPod CLI

# Download and install runpodctl (adjust URL as needed)
curl -L https://github.com/runpod/runpodctl/releases/latest/download/runpodctl-linux-arm64 -o ~/.local/bin/runpodctl
chmod +x ~/.local/bin/runpodctl

2. Configure API Key

runpodctl config --apiKey YOUR_API_KEY_HERE

3. Install Required Tools

pkg update
pkg install proot dnsutils -y

4. Apply the Fix

# Backup original binary
mv ~/.local/bin/runpodctl ~/.local/bin/runpodctl.original

# Create wrapper script
cat > ~/.local/bin/runpodctl << 'EOF'
#!/data/data/com.termux/files/usr/bin/bash
# DNS fix wrapper using proot for Termux
mkdir -p $PREFIX/etc 2>/dev/null
echo "nameserver 8.8.8.8" > $PREFIX/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $PREFIX/etc/resolv.conf
exec proot -b $PREFIX/etc/resolv.conf:/etc/resolv.conf \
           -b $PREFIX/etc/tls/cert.pem:/etc/ssl/certs/ca-certificates.crt \
           /data/data/com.termux/files/home/.local/bin/runpodctl.original "$@"
EOF

# Make wrapper executable
chmod +x ~/.local/bin/runpodctl

5. Test

runpodctl get pod

How It Works

The wrapper script:

  1. Creates a resolv.conf with Google DNS servers
  2. Uses proot to bind mount it to /etc/resolv.conf
  3. Maps Termux's certificates to standard Linux location
  4. Executes the original runpodctl with proper DNS/cert paths

Alternative (If API Still Works)

If runpodctl still fails, use curl directly:

# Get your info
curl -X POST https://api.runpod.io/graphql?api_key=YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{"query":"{ myself { id email } }"}'

# List pods
curl -X POST https://api.runpod.io/graphql?api_key=YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{"query":"{ pod { id name status } }"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment