|
| 1 | +# Troubleshooting Guide |
| 2 | + |
| 3 | +Common errors and solutions for Cortex Linux. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [API Key Issues](#api-key-issues) |
| 8 | +- [Installation Errors](#installation-errors) |
| 9 | +- [Network & Connectivity](#network--connectivity) |
| 10 | +- [Permission Problems](#permission-problems) |
| 11 | +- [LLM Provider Issues](#llm-provider-issues) |
| 12 | +- [Package Manager Conflicts](#package-manager-conflicts) |
| 13 | +- [Performance Issues](#performance-issues) |
| 14 | +- [Rollback & Recovery](#rollback--recovery) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## API Key Issues |
| 19 | + |
| 20 | +### Error: "No API key found" |
| 21 | + |
| 22 | +**Symptom:** |
| 23 | +```text |
| 24 | +Error: No API key found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable. |
| 25 | +``` |
| 26 | + |
| 27 | +**Solutions:** |
| 28 | + |
| 29 | +1. **Set the environment variable:** |
| 30 | +```bash |
| 31 | +# For Claude (recommended) |
| 32 | +export ANTHROPIC_API_KEY='<YOUR_ANTHROPIC_API_KEY>' |
| 33 | + |
| 34 | +# For OpenAI |
| 35 | +export OPENAI_API_KEY='<YOUR_OPENAI_API_KEY>' |
| 36 | +``` |
| 37 | + |
| 38 | +2. **Add to shell config for persistence:** |
| 39 | +```bash |
| 40 | +echo 'export ANTHROPIC_API_KEY="<YOUR_ANTHROPIC_API_KEY>"' >> ~/.bashrc |
| 41 | +source ~/.bashrc |
| 42 | +``` |
| 43 | + |
| 44 | +3. **Use the setup wizard:** |
| 45 | +```bash |
| 46 | +cortex wizard |
| 47 | +``` |
| 48 | + |
| 49 | +4. **For Local Provider mode (No API key needed):** |
| 50 | + *Note: Installation of tools like Docker may still require an internet connection.* |
| 51 | +```bash |
| 52 | +export CORTEX_PROVIDER=ollama |
| 53 | +cortex install docker |
| 54 | +``` |
| 55 | + |
| 56 | +### Error: "API rate limit exceeded" |
| 57 | + |
| 58 | +**Symptom:** |
| 59 | +```text |
| 60 | +Error: Rate limit exceeded. Please wait before trying again. |
| 61 | +``` |
| 62 | + |
| 63 | +**Solutions:** |
| 64 | +1. **Wait and retry:** |
| 65 | +```bash |
| 66 | +sleep 60 && cortex install docker |
| 67 | +``` |
| 68 | + |
| 69 | +2. **Use a different provider temporarily:** |
| 70 | +```bash |
| 71 | +export CORTEX_PROVIDER=ollama |
| 72 | +``` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Installation Errors |
| 77 | + |
| 78 | +### Error: "Package not found" |
| 79 | + |
| 80 | +**Symptom:** |
| 81 | +```text |
| 82 | +E: Unable to locate package xyz |
| 83 | +``` |
| 84 | + |
| 85 | +**Solutions:** |
| 86 | + |
| 87 | +1. **Update package lists:** |
| 88 | +```bash |
| 89 | +sudo apt update |
| 90 | +``` |
| 91 | + |
| 92 | +2. **Use natural language for better matching:** |
| 93 | +```bash |
| 94 | +cortex install "text editor like vim" # Instead of exact package name |
| 95 | +``` |
| 96 | + |
| 97 | +### Error: "Dependency problems" |
| 98 | + |
| 99 | +**Solutions:** |
| 100 | + |
| 101 | +1. **Fix broken packages:** |
| 102 | +```bash |
| 103 | +sudo apt --fix-broken install |
| 104 | +``` |
| 105 | + |
| 106 | +2. **Update and upgrade:** |
| 107 | +```bash |
| 108 | +sudo apt update && sudo apt upgrade |
| 109 | +``` |
| 110 | + |
| 111 | + |
| 112 | +### Error: "dpkg lock" |
| 113 | + |
| 114 | +**Symptom:** |
| 115 | +```text |
| 116 | +E: Could not get lock /var/lib/dpkg/lock-frontend |
| 117 | +``` |
| 118 | + |
| 119 | +**Solutions:** |
| 120 | + |
| 121 | +1. **Check what's using it:** |
| 122 | +```bash |
| 123 | +sudo lsof /var/lib/dpkg/lock-frontend |
| 124 | +``` |
| 125 | + |
| 126 | +2. **If it's genuinely stuck, stop the specific process (use with caution):** |
| 127 | +```bash |
| 128 | +# Check for apt, apt-get, or unattended-upgrades |
| 129 | +ps aux | egrep 'apt|apt-get|unattended' | egrep -v egrep |
| 130 | + |
| 131 | +# Then (only if needed) kill the specific PID (replace <PID>): |
| 132 | +sudo kill <PID> |
| 133 | + |
| 134 | +# Recovery: Run these if the package manager breaks after killing the process |
| 135 | +sudo dpkg --configure -a |
| 136 | +sudo apt --fix-broken install |
| 137 | +``` |
| 138 | +--- |
| 139 | + |
| 140 | +## Network & Connectivity |
| 141 | + |
| 142 | +### Error: "Could not resolve host" |
| 143 | + |
| 144 | +**Symptom:** |
| 145 | +```text |
| 146 | +Could not resolve 'archive.ubuntu.com' |
| 147 | +``` |
| 148 | + |
| 149 | +**Solutions:** |
| 150 | + |
| 151 | +1. **Check internet connection:** |
| 152 | +```bash |
| 153 | +ping -c 3 8.8.8.8 |
| 154 | +``` |
| 155 | + |
| 156 | +2. **Try different DNS (Temporary):** |
| 157 | + *Note: `/etc/resolv.conf` is often overwritten. Use `resolvectl` for permanent changes.* |
| 158 | +```bash |
| 159 | +# Append Google DNS |
| 160 | +echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf |
| 161 | + |
| 162 | +# Rollback (Undo): Edit the file and remove the line |
| 163 | +sudo nano /etc/resolv.conf |
| 164 | +``` |
| 165 | + |
| 166 | + |
| 167 | +### Error: "SSL certificate problem" |
| 168 | + |
| 169 | +**Solutions:** |
| 170 | + |
| 171 | +1. **Update CA certificates:** |
| 172 | +```bash |
| 173 | +sudo apt install ca-certificates |
| 174 | +sudo update-ca-certificates |
| 175 | +``` |
| 176 | + |
| 177 | +2. **Check system time (SSL requires correct time):** |
| 178 | +```bash |
| 179 | +timedatectl status |
| 180 | +sudo timedatectl set-ntp true |
| 181 | +``` |
| 182 | +--- |
| 183 | + |
| 184 | +## Permission Problems |
| 185 | + |
| 186 | +### Error: "Permission denied" |
| 187 | + |
| 188 | +**Solutions:** |
| 189 | + |
| 190 | +1. **Run with sudo for system packages:** |
| 191 | +```bash |
| 192 | +sudo cortex install docker --execute |
| 193 | +``` |
| 194 | + |
| 195 | +2. **Check file ownership:** |
| 196 | +```bash |
| 197 | +ls -la ~/.cortex/ |
| 198 | +``` |
| 199 | + |
| 200 | +--- |
| 201 | + |
| 202 | +## LLM Provider Issues |
| 203 | + |
| 204 | +### Error: "Ollama not running" |
| 205 | + |
| 206 | +**Symptom:** |
| 207 | +```text |
| 208 | +Error: Could not connect to Ollama at localhost:11434 |
| 209 | +```` |
| 210 | +
|
| 211 | +**Solutions:** |
| 212 | +
|
| 213 | +1. **Start System Service (Recommended):** |
| 214 | +
|
| 215 | +```bash |
| 216 | +sudo systemctl start ollama |
| 217 | +``` |
| 218 | + |
| 219 | +2. **Manual Start (Fallback):** |
| 220 | + *Note: Only use this if the system service is unavailable.* |
| 221 | + |
| 222 | +```bash |
| 223 | +ollama serve |
| 224 | +``` |
| 225 | + |
| 226 | +3. **Install Ollama if missing:** |
| 227 | + *Note: Always review remote scripts before running them.* |
| 228 | + |
| 229 | +```bash |
| 230 | +curl -fsSL https://ollama.com/install.sh | sh |
| 231 | +``` |
| 232 | + |
| 233 | +### Error: "Context length exceeded" |
| 234 | + |
| 235 | +**Symptom:** |
| 236 | + |
| 237 | +```text |
| 238 | +Error: This model's maximum context length is 4096 tokens |
| 239 | +``` |
| 240 | + |
| 241 | +**Solutions:** |
| 242 | + |
| 243 | +1. **Simplify your request:** |
| 244 | + Instead of asking for a "complete development environment," try installing tools individually (e.g., "python development tools"). |
| 245 | + |
| 246 | +2. **Change Provider:** |
| 247 | + Switch to a provider that supports larger context windows (e.g., Anthropic) using the wizard: |
| 248 | + |
| 249 | +```bash |
| 250 | +cortex wizard |
| 251 | +``` |
| 252 | +--- |
| 253 | + |
| 254 | +## Package Manager Conflicts |
| 255 | + |
| 256 | +### Error: "Snap vs apt conflict" |
| 257 | + |
| 258 | +**Symptom:** |
| 259 | +```text |
| 260 | +error: cannot install "firefox": classic confinement requires snaps |
| 261 | +``` |
| 262 | + |
| 263 | +**Solutions:** |
| 264 | + |
| 265 | +1. **Use snap with classic:** |
| 266 | +```bash |
| 267 | +sudo snap install firefox --classic |
| 268 | +``` |
| 269 | +--- |
| 270 | + |
| 271 | +## Performance Issues |
| 272 | + |
| 273 | +### Slow AI responses |
| 274 | + |
| 275 | +**Solutions:** |
| 276 | + |
| 277 | +1. **Use local LLM:** |
| 278 | +```bash |
| 279 | +export CORTEX_PROVIDER=ollama |
| 280 | +``` |
| 281 | + |
| 282 | +2. **Check network latency:** |
| 283 | +```bash |
| 284 | +ping api.anthropic.com |
| 285 | +``` |
| 286 | +--- |
| 287 | + |
| 288 | +## Rollback & Recovery |
| 289 | + |
| 290 | +### How to undo an installation |
| 291 | +```bash |
| 292 | +# View installation history |
| 293 | +cortex history |
| 294 | + |
| 295 | +# Rollback last installation |
| 296 | +cortex rollback |
| 297 | + |
| 298 | +# Rollback specific installation |
| 299 | +cortex rollback <installation-id> |
| 300 | +``` |
| 301 | + |
| 302 | +### System recovery |
| 303 | + |
| 304 | +If Cortex causes system issues: |
| 305 | + |
| 306 | +1. **Boot into recovery mode** |
| 307 | +2. **Use dpkg to fix:** |
| 308 | +```bash |
| 309 | +sudo dpkg --configure -a |
| 310 | +sudo apt --fix-broken install |
| 311 | +``` |
0 commit comments