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.

I know this thread is kind of old, but when I was updating my dietpi I ran into an error at the end that says

Write error - ~LZMAFILE (28: No space left on device)

Sure enough, the only partition that was out of room was the one /var/log is stored on. Looks like it’s set to 50MB.

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  2.7G   26G  10% /
devtmpfs        926M     0  926M   0% /dev
tmpfs           959M  4.6M  954M   1% /dev/shm
tmpfs           959M   99M  860M  11% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           959M     0  959M   0% /sys/fs/cgroup
tmpfs           958M     0  958M   0% /tmp
tmpfs            50M   50M     0 100% /var/log
/dev/mmcblk0p1  253M   50M  203M  20% /boot
tmpfs           192M     0  192M   0% /run/user/998

The question I have here is: instead of having to reboot and clear the temp logs every time I want to update or write to the log directory, is there a way to expand that partition from 50MB to say, 256mb?

(I’ve been searching for hours through dietpi and pihole docs to no avail- I am medically retired and very out of practice with linux systems)

Thanks,
Joseph, aka Cinement

Better to check what is cluttering up the log directory which so much data.

As a quick fix, reboot your system. Long-term, check which app is filling up your log directory that much.