Apt upgrade fails "No space left on device"

Recently did a clean install of Bullseye on a freshly imaged SD card and this morning am getting lots of

dpkg: cannot write to log file '/var/log/dpkg.log': No space left on device

errors when running sudo apt upgrade. Not sure where I’ve gone wrong but am certainly hoping it’s not an issue with my SD card…

─────────────────────────────────────────────────────
DietPi v8.8.1 : 27 APT updates available
─────────────────────────────────────────────────────

  • Device model : RPi 3 Model B (aarch64)
    ─────────────────────────────────────────────────────

df -h:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  3.8G   25G  14% /
devtmpfs        446M     0  446M   0% /dev
tmpfs           480M  4.0K  480M   1% /dev/shm
tmpfs           192M   20M  173M  11% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.0G     0  1.0G   0% /tmp
tmpfs            50M   50M     0 100% /var/log
/dev/mmcblk0p1  127M   35M   92M  28% /boot
/dev/sda1       1.8T  759G  1.1T  42% /mnt/media

The log directory is a temporary file system and will be cleaned on a reboot. However it’s used for log files only. Usually there should not that much logs generated to fill the directory. Definitely something you would need to check where the logs are coming from

du -a /var/log | sort -n -r | head -n 20
2 Likes

Thank you for the reply. A reboot cleaned things up, and I’m also not seeing the prompt to run apt upgrade. Here’s the output from the command you shared; looks like I should turn off debug logging in sonarr.

dietpi@DietPi:~$ sudo du -a /var/log | sort -n -r | head -n 20
1808	/var/log
1396	/var/log/sonarr
1020	/var/log/sonarr/logs.db-wal
356	/var/log/radarr
244	/var/log/sonarr/sonarr.debug.txt
168	/var/log/radarr/logs.db-wal
104	/var/log/radarr/radarr.txt
56	/var/log/sonarr/sonarr.txt
52	/var/log/radarr/logs.db
48	/var/log/readarr
44	/var/log/sonarr/logs.db
32	/var/log/sonarr/logs.db-shm
32	/var/log/radarr/logs.db-shm
24	/var/log/readarr/logs.db
24	/var/log/readarr/Readarr.txt
4	/var/log/wtmp
4	/var/log/lastlog
0	/var/log/sonarr/sonarr.debug.9.txt
0	/var/log/sonarr/sonarr.debug.8.txt
0	/var/log/sonarr/sonarr.debug.7.txt

df -h after reboot:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  3.8G   25G  14% /
devtmpfs        446M     0  446M   0% /dev
tmpfs           480M  4.0K  480M   1% /dev/shm
tmpfs           192M  2.9M  190M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.0G     0  1.0G   0% /tmp
tmpfs            50M  3.1M   47M   7% /var/log
/dev/mmcblk0p1  127M   35M   92M  28% /boot
/dev/sda1       1.8T  728G  1.1T  40% /mnt/media

Definitely. Just use debugging mode for the moment you analyse issues and not for normal operation.