No space left on device

This how to helps you to learn fixing the no space left on device issue during updating OpenHAB. Fixing is working with OpenHAB 3 and it also should work with OpenHAB 4 and any other Linux based system.

No space left of device

No space left of device

Index Of How To ….

Background

In one of the recent updates that I made to my system I noticed an endless amount of messages that said “No space left on device”. It actually looked like the above. Fixing this issue is fortunately very easy. This how to explains how you can fix this leveraging on the example that I faced.

In case of OpenHAB 3 you are likely to also see the below error message. In OpenHAB 4 and any other Linux system you might see error messages too. 

There was an error or interruption during the execution of Upgrade System

There was an error or interruption during the execution of Upgrade System

 

How to fix Now Space Left On The Device

In my case, the system complains that it has not enough space to write into the /var/log/dkpg.log. This logs like the below.

Setting up openhab-addons (3.4.4-2) ...
dpkg: cannot write to log file '/var/log/dpkg.log': No space left on device
dpkg: cannot write to log file '/var/log/dpkg.log': No space left on device
dpkg: cannot write to log file '/var/log/dpkg.log': No space left on device
dpkg: cannot write to log file '/var/log/dpkg.log': No space left on device
Setting up php-symfony-filesystem (4.4.19+dfsg-2+deb11u3) ...
dpkg: cannot write to log file '/var/log/dpkg.log': No space left on device

I would guess, that there is indeed an issue with the disk. Therefore, let’s check it. I check it by executing:
openhabian@OpenHAB:~ $ df -h

The system tells me the following:
openhabian@OpenHAB:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       469G   36G  409G   9% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           1.6G  156M  1.4G  10% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda1       253M   52M  201M  21% /boot
/dev/zram1      721M  230M  440M  35% /opt/zram/zram1
overlay1        721M  230M  440M  35% /var/lib/openhab/persistence
/dev/zram2      974M  951M     0 100% /opt/zram/zram2
overlay2        974M  951M     0 100% /var/log
tmpfs           787M     0  787M   0% /run/user/1000

Now, looking into these numbers in more details and considering that I have not enough disk space for /var/log/dkpg.log, it gets in the above quite visible that /var/log is 100% used. This is, why the system complains. 

Now… The overlay2 and /dev/zram2 both related to the zram service.

I therefore decided to restart this service (on OpenHAB 3) with the below command:

openhabian@OpenHAB:~ $ sudo systemctl stop zram-config.service

Following this I checked the status on my hard drive and (of course) it was resolved:

openhabian@OpenHAB:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       469G   37G  408G   9% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           1.6G  156M  1.4G  10% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda1       253M   52M  201M  21% /boot
tmpfs           787M     0  787M   0% /run/user/1000

After this, I started Zram again by the below command:
openhabian@OpenHAB:~ $ sudo systemctl start zram-config.service

Shutting again the df -h command shows the new reality, which indicates: Issue Fixed!

openhabian@OpenHAB:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       469G   37G  408G   9% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           1.6G  156M  1.4G  10% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda1       253M   52M  201M  21% /boot
tmpfs           787M     0  787M   0% /run/user/1000
/dev/zram1      721M   36K  669M   1% /opt/zram/zram1
overlay1        721M   36K  669M   1% /var/lib/openhab/persistence
/dev/zram3      974M   36K  907M   1% /opt/zram/zram3
overlay3        974M   36K  907M   1% /var/log

That’s it!

Additional Information

To learn more about zram and OpenHAB, checkout these websites:

Follow me

It would be amazing if you follow my myhowto.blog. To my blog is actually easy! You can leverage on

  • Click to follow me on Twitter
  • Bookmark this page and comeback from time to time

Help and Comments

I am really looking forward for you to contact me if for example you found a better option or other idea then in this how to. Also, please touch base if you found an error or anything not working or if you have something that you would love to be added to the myhowto.blog. Simply click this link to touch base with me.

Linking Or Recommending The How To Or The myhowto.blog

I would love to see you are recommending this how to or link it to your website. Also, I would love if you link or recommend the whole myhowto.blog. Please feel free to do so! In case you like to touch base regarding this topic with me, then simply click this link. I look forward!