Troubleshooting Guide
Solutions to common problems you may encounter while learning Linux.
Permission Errors
"Permission denied"
Symptom:
$ touch /etc/test.txt
touch: cannot touch '/etc/test.txt': Permission denied
Solutions:
-
Use
sudofor system operations:sudo touch /etc/test.txt -
Check if you need to own the file:
sudo chown $USER /etc/test.txt -
Check file permissions:
ls -l /etc/test.txt
Command Not Found
"command not found"
Symptom:
$ git
git: command not found
Solutions:
-
Check spelling:
# Common typos cd /hme/user # Wrong cd /home/user # Correct -
Install missing package:
Fedora:
sudo dnf install gitDebian:
sudo apt install git -
Check PATH:
echo $PATH which git
File System Issues
"No such file or directory"
Symptom:
$ cd documents
bash: cd: documents: No such file or directory
Solutions:
-
List current directory contents:
ls -la -
Check your location:
pwd -
Use tab completion to avoid typos:
cd doc<Tab> # Completes to documents/ -
Search for the file:
find ~ -name "documents" -type d
"Directory not empty"
Symptom:
$ rm directory/
rm: cannot remove 'directory/': Is a directory
Solutions:
-
Use recursive remove:
rm -r directory/ -
Remove with confirmation:
rm -ri directory/
Package Management Issues
"Could not get lock /var/lib/dpkg/lock"
Symptom (Debian):
E: Could not get lock /var/lib/dpkg/lock-frontend
Solutions:
-
Wait for another package manager to finish
-
Check for running processes:
ps aux | grep apt -
Remove lock (if stuck):
sudo rm /var/lib/dpkg/lock-frontend sudo rm /var/lib/dpkg/lock
"Cannot update repository metadata"
Symptom (Fedora):
Error: Cannot update repository metadata
Solutions:
-
Clean metadata cache:
sudo dnf clean all sudo dnf makecache -
Check network connection:
ping -c 3 fedoraproject.org -
Refresh repositories:
sudo dnf refresh
Process Issues
Process won't stop
Symptom: Application freezes and won't close.
Solutions:
-
Find the process ID:
ps aux | grep application_name -
Try graceful termination:
kill <PID> -
Force kill if needed:
kill -9 <PID> -
Kill by name:
pkill application_name killall application_name
Service won't start
Symptom:
$ sudo systemctl start nginx
Job for nginx.service failed.
Solutions:
-
Check service status:
systemctl status nginx -
View service logs:
journalctl -u nginx -n 50 -
Check configuration:
sudo nginx -t # Test nginx config -
Check for port conflicts:
sudo ss -tulpn | grep :80
Network Issues
Cannot connect to WiFi
Solutions:
-
Check network interface:
ip link show -
Bring interface up:
sudo ip link set wlan0 up -
Use NetworkManager (GUI or CLI):
nmcli dev wifi list nmcli dev wifi connect "SSID" password "password" -
Restart network service:
sudo systemctl restart NetworkManager
SSH connection refused
Symptom:
$ ssh user@host
ssh: connect to host port 22: Connection refused
Solutions:
-
Check if SSH server is running:
systemctl status sshd # Fedora systemctl status ssh # Debian -
Start SSH server:
sudo systemctl start sshd sudo systemctl enable sshd -
Check firewall:
sudo firewall-cmd --list-all # Fedora sudo ufw status # Debian -
Check if port 22 is open:
sudo ss -tulpn | grep :22
Disk Space Issues
"No space left on device"
Symptom:
$ touch file.txt
touch: cannot touch 'file.txt': No space left on device
Solutions:
-
Check disk usage:
df -h -
Find large files:
du -h ~ | sort -hr | head -20 -
Clean package cache:
Fedora:
sudo dnf clean allDebian:
sudo apt clean sudo apt autoremove -
Empty trash:
rm -rf ~/.local/share/Trash/* -
Clean old logs:
sudo journalctl --vacuum-time=7d
Git Issues
"fatal: not a git repository"
Symptom:
$ git status
fatal: not a git repository (or any of the parent directories)
Solutions:
-
Initialize repository:
git init -
Clone existing repository:
git clone <url>
Merge conflicts
Symptom:
$ git merge feature
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Solutions:
-
Edit the file and resolve conflicts manually
-
Mark as resolved:
git add file.txt git commit -
Abort merge if needed:
git merge --abort
Docker Issues
"Permission denied while trying to connect to the Docker daemon"
Symptom:
$ docker ps
permission denied while trying to connect to the Docker daemon socket
Solutions:
-
Use sudo:
sudo docker ps -
Add user to docker group:
sudo usermod -aG docker $USER -
Log out and back in for changes to take effect.
Container exits immediately
Symptom:
$ docker run nginx
$ docker ps -a
CONTAINER ID STATUS
abc123 Exited (0) 5 seconds ago
Solutions:
-
Container may have no foreground process
-
Use
-dfor detached mode:docker run -d nginx -
Check logs:
docker logs <container_id>
Getting Help
Built-in Help
Man pages (manual):
man <command> # e.g., man ls
man -k <keyword> # Search man pages
Help flag:
<command> --help # e.g., ls --help
Info pages:
info <command>
Online Resources
- Fedora Documentation: https://docs.fedoraproject.org/
- Debian Documentation: https://www.debian.org/doc/
- Arch Wiki (excellent general reference): https://wiki.archlinux.org/
- Linux Command Library: https://linux.die.net/
- Stack Overflow: https://stackoverflow.com/questions/tagged/linux
Community Forums
- Fedora Discussion: https://discussion.fedoraproject.org/
- Debian Forums: https://forums.debian.net/
- Reddit r/linux4noobs: https://reddit.com/r/linux4noobs
Debugging Commands
| Command | Purpose |
|---|---|
journalctl -xb | View boot messages |
dmesg | Kernel ring buffer |
systemctl --failed | List failed services |
strace <command> | Trace system calls |
ltrace <command> | Trace library calls |
tail -f /var/log/syslog | Follow system log |