No Linux No Life – Not enough space in /var/cache/apt/archives/

Learn from error messages.

One of the best things about Linux is its unmatched level of flexibility. No other operating system provides the same level of freedom to users because they are not open-source. Thanks to its open and free nature, you can break and repair the system itself, and that’s just awesome when it comes to embracing a spirit of experimentation.

Yesterday, I had a tough time with my home Linux server. I talk about it a lot in my blogging because right now, it’s essentially my tech universe’s hub spot. It serves as not only my Dropbox alternative but also my go-to place for daily Linux experimentation.

Okay, let’s get back on track. I had trouble logging in to the MySQL server as the root user, so I uninstalled and reinstalled it. But I ran into a lot of unexpected issues along the way. I tried to find solutions by googling and came across some pages with suggestions. Unfortunately, following those suggestions only made things worse because I accidentally deleted some important files.

One of the files I deleted was the list of apt updates/upgrades, so as you can imagine, I had trouble updating or upgrading any software on the server.

And today, when I executed ‘sudo apt upgrade’ command, I got the below error message. There wasn’t enough space for /var/cache/apt/archives/.

$ sudo apt upgrade

...
E: You don't have enough free space in /var/cache/apt/archives/.

So, I googled again and found one possible solution to it – so, here, I’ll share how I solved the issue.

Thankfully, I had already made enough room on the system by mounting and partitioning external HDDs, so all I did was redirect ‘/var/cache/apt/’ to one of the partitioned directories.

$ sudo apt autoclean
$ sudo mv /var/cache/apt/ /path/to/partitioned_directry/new_apt
$ sudo ln -s /path/to/partitioned_directry/new_apt /var/cache/apt
$ ls -l /var/cache/
...

lrwxrwxrwx  1 root      root     37 Feb  2 16:36 apt -> /path/to/partitioned_directry/new_apt

And it worked!! I was successfully able to execute the ‘sudo apt update’ command this time!

Linux is so fun to interact with!

No Linux, No Life!

Leave a Reply