0

I'm still new to this field. I can't find a specific solution in any way. The first problem was that when I started the system after a long break, I was offered to update the application packages. I tried to update with the standard apt-upgrade, but I got the error "not enough space in /var/cache/apt/archives.

There are many solutions on the Internet, but I have not found the right one. I found one of the solutions where it was suggested to move /tmp/ to RAM [here], as I understood it. I'm not sure if the author wrote the command correctly or he gave incorrect instructions for further maintenance, which then filled my entire system to 100% (although there should have been enough memory, especially since I have vdi).

Now I can't, for example, scroll through the command history, and the files themselves can't be written and are moved to the swap partition (as I assume). The system starts, but it feels like I called a deadlock (I may be wrong). I know that snapshots should be taken regularly, but I still hope that there is a solution to these problems. And I'll also say about the first problem with updating packages, it seems to me that it may have something to do with docker.

Please tell me, I really don't want to lose data on this system (there were laboratory works).

    vae@lamervae:~$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              394M  1.3M  392M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   12G   12G     0 100% /
tmpfs                              2.0G     0  2.0G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/loop0                          64M   64M     0 100% /snap/core20/1778
/dev/loop1                          64M   64M     0 100% /snap/core20/1828
/dev/loop2                          92M   92M     0 100% /snap/lxd/24061
/dev/sda2                          2.0G  209M  1.6G  12% /boot
/dev/loop4                          41M   41M     0 100% /snap/snapd/20290
/dev/loop3                          68M   68M     0 100% /snap/lxd/22753
/dev/loop5                          50M   50M     0 100% /snap/snapd/18357
tmpfs                              394M     0  394M   0% /run/user/1000

Ubuntu 20.04 LTS Server

guiverc
  • 30,396
  • 10Gb is not enough for a desktop using snaps or docker, you need roughly 20Gb. Best thing to do is to remove some files manually (or move to a usb) and then see if you have any snaps you can replace by its 'apt' version (those take up far less space). – Rinzwind Dec 20 '23 at 18:51
  • @guiverc I`m using version 20.04. I have allocated 30 GiB of dynamic memory, especially since there was almost nothing in the system. I do not know if switching from dynamic to static memory can help in this case? And why am I being shown a memory size of 12 GB if 30 GB is allocated? At the same time, only 4 GB of real size is displayed in the settings of the virtual machine. – асланчик Dec 21 '23 at 11:05
  • Once again, all I did was mounting tmpfs into the created /media/job directory and made a symbolic link, and as a result (perhaps after a reboot) this situation developed. Now I can't delete the link and I can't unmount anything. vae@lamervae:~$ sudo unlink /var/cache/apt unlink: cannot unlink '/var/cache/apt': Is a directory vae@lamervae:~$ sudo umount /media/job umount: /media/job: not mounted. – асланчик Dec 21 '23 at 11:05
  • Do I understand correctly that tmpfs has grown to the maximum size after being transferred to main memory? @rinzwind warned in the above post that "tmpfs requires a lot of RAM," but as I understand it, that's not my issue. free -m total used free shared buff/cache available Mem: 1983 210 1135 23 637 1591 Swap: 2047 0 2047 – асланчик Dec 21 '23 at 11:09
  • As I imagine, I can only manually clear the memory. But I have no idea exactly what to clean. If the memory is filled with temporary data, is there any way to clear them all at once and return them to the /tmp/ partition? Maybe this data has some tags? Help me, I honestly don't know what to do and besides, what did I do wrong. – асланчик Dec 21 '23 at 11:15
  • 20.04.5 LTS Server. Btw im not a complete novice – асланчик Dec 21 '23 at 11:30
  • FYI: This is a Question & Answer site (not a forum, https://ubuntuforums.org/ is the address of Ubuntu Forums) thus all details belong in the question itself, that is what will be answered. Comments are intended to be comments on the question, and will get removed once addressed in the question. – guiverc Dec 21 '23 at 11:34

1 Answers1

0

Try deleting all the *.deb files in /var/cache/apt/archives . That should free up some space on root, leaving a minimal lock and a "partial" directory. Rename the directory archive to something like archive-sav.

Mount a USB with an ext4 filessystem at /var/cache/apt/archive. Copy the lock file and make a partial directory here like the archive-sav has. Now the downloaded deb files will not take up space on your root. Hopefully, the upgrade may now proceed.
No Idea why the VM doesn't expand to its fully allocated size -- as mentioned in comments, 12G is too small these days.

ubfan1
  • 17,838