Tag: software errors / problem solutions

What is the difference between Suspend and Hibernate in Linux. Why is the Hibernation button missing?

When shutting down Linux, instead of completely shutting down the computer, you can select Suspend or Hibernate. These modes are also offered when configuring the behavior of the computer during inactivity (to save power), when the laptop battery is low, and when configuring the behavior after closing the lid of the laptop.

Suspend means stopping all applications and puts the computer into low power mode. When you turn on the computer, it returns to the same state that it was before Suspend. The difference from Hibernate is that the computer turns on faster, although it continues to consume energy. That is, the data remains in RAM, but the computer goes into a low power mode, similar to shutting down. In this state, the battery is consumed very slowly. When turned on, the computer wakes up very quickly. But if the battery is completely discharged before turning on, then the current data from the RAM will be lost)

Hibernate means writing the current state of the computer and RAM to the hard disk and turning off the computer. When you turn on the computer, it returns to the same state that it was before Hibernate. The difference from Suspend is that the computer completely stops consuming power and cannot lose data due to the fact that the battery is dead. But in Hibernate mode, the computer takes a little longer to turn on than when exiting the Suspend state. That is, the Hibernate mode means saving all data from RAM to disk and turning off the computer. The next time you turn on the data from the disk will be loaded into RAM and the computer will be able to continue from the same point that it stopped before sleep

That is, if the computer is often idle and you need to turn it on very quickly, then select the Suspend mode for this. If you expect the computer to be turned off for a long time, then select Hibernate.

Why is there no Hibernate mode in Linux?

In the following screenshot, you can see that when you turn off the computer, there is no option to select Hibernate. This is due to the fact that there is no Swap partition (Swap file) on the specified system, or it is of insufficient size.

In order for the Hibernate option to appear, you need to create a Swap file or increase its size, making it equal to or larger than the computer's RAM.

The created swap partition can be used not only to store some information from RAM while the computer is running, it can also be used in Hibernate mode. When adding this mode, an additional option will appear in the shutdown menu – Hibernate. If you select it, then the current state of the RAM will be written to the swap partition. The next time you turn on the computer, it reads the information from the swap file and restores the state of the computer. That is, those programs that were opened will be reopened and their result will be saved.

In modern Linux, hibernation (sleep) should be enabled automatically when a partition or swap file is added to the system.

For information on how to create a swap file in various distributions, see the articles:

Xfce boots without Taskbar and Start button (SOLVED)

From time to time my Kali Linux with Xfce desktop environment boots up without the taskbar and start button. Only desktop shortcuts and the desktop itself are visible, that is, the system looks like this (this is a full, uncropped screen).

It is almost impossible to work in such a system, although Linux works, it allows you to open a terminal window, launch desktop shortcuts.

Usually in this case, I right-clicked on the desktop, selected “Open Terminal Here” from the context menu, and entered the command to reboot the system:

reboot

After a reboot, the Taskbar might or might not appear, just as it did when the computer was turned on.

I don't know if this is a problem with my personal Kali Linux and Xfce installation, or a bug in the desktop environment or VirtualBox.

In addition to rebooting the entire system, there is another, faster way to reboot the desktop.

To do this, press the Win key.

This will open the Operating System Menu.

Click the “Log Out” button with the mouse.

Select “Log Out”.

You will be prompted to enter a username and password to log in.

Enter your username and password.

Now Xfce has booted up normally, with the Taskbar and other elements.

To quickly log out of Linux, you can use the keyboard shortcut Ctrl+Alt+Delete.

Alternatively, you can restart the Display Manager with the following command:

sudo systemctl restart lightdm

To enter it, open the terminal, this can be done by right-clicking on the desktop and selecting “Open Terminal Here”, or use the keyboard shortcut Ctrl+Alt+t

Errors “Incorrect definition of table mysql.event: expected column ‘definer’ at position 3 to have type varchar(, found type char(141)” and “Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler” (SOLVED)

When upgrading mariadb to version 10.8.3, the following messages were shown:

warning: directory permissions differ on /usr/lib/mysql/plugin/auth_pam_tool_dir/
filesystem: 700  package: 755
:: MariaDB was updated to a new feature release. To update the data run:
   systemctl restart mariadb.service && mariadb-upgrade -u root -p

They contain information about two events that require the action of a system administrator or user.

The second one is more important, it says that to update the data, you need to run the specified commands.

An error occurred when initializing system tables. Disabling the Event Scheduler (SOLVED)

First, restart the DBMS service and check its status:

sudo systemctl restart mariadb.service
systemctl status mariadb.service

Sample output:

● mariadb.service - MariaDB 10.8.3 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-06-01 03:40:27 MSK; 34s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 1271213 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 1271214 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 1271261 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
   Main PID: 1271247 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 14 (limit: 4690)
     Memory: 187.7M
        CPU: 788ms
     CGroup: /system.slice/mariadb.service
             └─1271247 /usr/bin/mariadbd

Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [Note] InnoDB: log sequence number 38052502275; transaction id 74463190
Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [Note] Server socket created on IP: '127.0.0.1'.
Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [ERROR] Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type varchar(, found type char(141).
Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [ERROR] mariadbd: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
Jun 01 03:40:26 suip.biz mariadbd[1271247]: 2022-06-01  3:40:26 0 [Note] /usr/bin/mariadbd: ready for connections.
Jun 01 03:40:26 suip.biz mariadbd[1271247]: Version: '10.8.3-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Arch Linux
Jun 01 03:40:27 suip.biz systemd[1]: Started MariaDB 10.8.3 database server.
Jun 01 03:40:27 suip.biz mariadbd[1271247]: 2022-06-01  3:40:27 0 [Note] InnoDB: Buffer pool(s) load completed at 220601  3:40:27

On the one hand, the service is up and running. However, there are a few error messages as well as a few warnings. Most important messages:

[ERROR] Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type varchar(, found type char(141).
[ERROR] mariadbd: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.

Action must be taken to fix errors.

To do this, run a database update:

sudo mariadb-upgrade -u root -p

You will need to enter the password of the DBMS root user and wait for the command to complete.

Then restart the service again and check its status:

sudo systemctl restart mariadb.service
systemctl status mariadb.service

As you can see, there are no errors.

directory permissions differ on /usr/lib/mysql/plugin/auth_pam_tool_dir/ filesystem: 700 package: 755 (SOLVED)

Now let's look at the second message:

warning: directory permissions differ on /usr/lib/mysql/plugin/auth_pam_tool_dir/
filesystem: 700 package: 755

This is not an error, but a warning. The bottom line is that the permission on the /usr/lib/mysql/plugin/auth_pam_tool_dir/ directory differs between the actual value in the file system and the one specified in the installation package.

The most likely reasons for this are:

  • in the previous version of the package, different permissions were specified for the directory, and then the package maintainers decided to change them for one reason or another
  • you yourself changed the permissions to the specified directory

To bring the value of permissions to those recommended in the installation package, start by checking the current value:

sudo ls -dl /usr/lib/mysql/plugin/auth_pam_tool_dir/

Then run the chmod command with the desired permissions:

sudo chmod 755 /usr/lib/mysql/plugin/auth_pam_tool_dir/

Check your permissions again:

sudo ls -dl /usr/lib/mysql/plugin/auth_pam_tool_dir/

As you can see in the following screenshot, the permissions to the specified directory have been changed:

Why doesn’t Linux with Persistence keep settings after reboot? (SOLVED)

Persistence is a partition on a flash drive with a Live Linux system, thanks to which the programs and settings installed on the system are saved.

A live image with a Linux distribution can be written to a USB flash drive. The result is a bootable USB flash drive with Linux. That is, you can boot into Linux and use the programs and tools of this operating system. A feature of the Live image is that you can install programs, save files and make other changes and settings in the operating system. All settings are stored in the virtual file system. That is, within one session, work in the Live system does not differ from work in any other Linux. But immediately after reboot, all changes made will be lost and the system will return to its initial state.

In order for files and changes in the OS to be saved between reboots, you can create a Persistence partition, in which all changes will be stored. For an example of how to create a bootable USB with Persistence, see “How to make Kali Linux 2022 Live USB with Persistence and optional encryption (on Windows)”.

After creating Persistence, all changes should be “remembered” and be visible after a reboot. But some users are faced with the fact that even after creating a persistent storage, files and installed programs disappear after a reboot. What could be the problem?

The fact is that even after creating the Persistence volume, the user still has several boot options, for example:

  • Live system – OS boot without using persistent storage
  • Live USB Persistence – OS boot using persistent storage
  • Live USB Encrypted Persistence – OS boot using encrypted persistent storage

As you might guess, if you select “Live system” from the boot menu, then your system will be a regular Live system that does not use Persistence. In this case, the Live system option is the first item in the boot menu, that is, it will be used by default if no other option is selected.

Thus, to see the changes made before rebooting Linux, select one of the following options from the boot menu:

  • Live USB Persistence
  • Live USB Encrypted Persistence

“Failed - Network error” when exporting from phpMyAdmin (SOLVED)

phpMyAdmin allows ones to export databases and individual tables (as well as individual rows) in the web interface.

In the latest stable version of phpMyAdmin 5.1.3, users encountered a problem when exporting data from tables and databases to a file.

Regardless of the selected settings, instead of downloading the file, an error is shown:

Failed - Network error

This is what the error looks like in a web browser:

This bug has been fixed in phpMyAdmin 5.3, which is available as a snapshot version at the time of writing.

You can download phpMyAdmin 5.3 from the direct link: https://files.phpmyadmin.net/snapshots/phpMyAdmin-5.3+snapshot-all-languages.zip

Or go to the download page of the phpMyAdmin site and select the latest version there: https://www.phpmyadmin.net/downloads/

After unpacking phpMyAdmin in the web server folder, no additional configuration is required - the export of databases and tables works again.

“Error: failed to commit transaction (invalid or corrupted package)” (SOLVED)

When updating or installing packages in Arch Linux, Manjaro and their derivatives, you may encounter the “error: failed to commit transaction (invalid or corrupted package). Errors occurred, no packages were upgraded.” issue.

Full error log:

:: Retrieving packages...
 libinih-55-2-x86_64                                15.4 KiB   385 KiB/s 00:00 [############################################] 100%
(40/40) checking keys in keyring                                               [############################################] 100%
(40/40) checking package integrity                                             [############################################] 100%
error: libinih: signature from "Maxime Gauduin <alucryd@gmail.com>" is marginal trust
:: File /var/cache/pacman/pkg/libinih-55-2-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.

In this case, the error occurs when trying to update the libinih package, but it can occur for other packages as well.

First, try delete the package, as recommended, and run the update again to download the installation package file. This will resolve the issue if the error is caused by a corrupted package, such as a network outage.

If this does not help, then instead of a complete update of the system, run the update of the archlinux-keyring package:

sudo pacman -Sy archlinux-keyring

This should fix the PGP signature verification issue.

This error and the problem with incorrect PGP signature can occur on systems that are rarely updated (updated with long breaks). The error lies in the fact that packages with “invalid” PGP signatures are signed with keys that are contained in the updated version of the archlinux-keyring package. Therefore, by starting with updating archlinux-keyring you get new versions of the keys, which then successfully verify the PGP signatures of the package files.

What happens if an IPv4 client tries to access an IPv6-only server (SOLVED)

Question:

Hey! The article says that IPv6 is a completely different protocol, I had a question. If my recipient's email works only on IPv6 (that is, his mail server listens only through the IPv6 protocol), does this mean that when sending a letter from a mail server that is connected only to IPv4, the letter simply will not reach the recipient, that is, I will have to choose some kind of mail service whose mail server works with both IPv6 and IPv4 so that my friend can read my letter?

Answer:

The considered situation, when one server has only an IPv4 address, and the second server has only an IPv6 address, is purely theoretical. ISPs that use IPv6 and provide IPv6 addresses to customers also provide IPv4 addresses at the same time.

For example, this router is connected to an ISP that supports IPv6. However, a router has two types of IP addresses:

  • 10.241.24.29
  • 2001:fb1:fc0:135:20e8:31d0:4821:6624

My computer is connected to this router, so it also has two types of IP addresses:

  • 192.168.1.58
  • 2001:fb1:139:20d8:82c0:cb25:b750:24d4

Note that IPv4 and IPv6 are such separate networks that for IPv6, the router has its own DNS server IP – 2001:fb0:100::207:49.

The same is true for hosting providers. For example, ISPs in my country do not support IPv6. But at the same time, hosting providers in my country have been supporting IPv6 for a very long time (for example, I set up IPv6 for SuIP.biz back in 2016, while one rented VPS server came with one free IPv4 and 3 free IPv6).

You can search for websites with IPv6 support and look at their DNS records – you will see that in addition to the AAAA record (IPv6 address of the site), there is also an A record for the site (IPv4 address of the site).

That is, yes, if one of the computers (client or server1) is connected only to an IPv4 network, and the second computer (server or server2) is connected only to an IPv6 network, then theoretically it is simply impossible to build a network route between them from the first to the second. But in practice, this problem does not arise simply for the reason that absolutely all clients and servers support IPv4, and some also support IPv6. That is, all possible combinations work according to one of the following options:

  • client and server support IPv6 – IPv6 is used
  • client supports IPv6 and server does not support IPv6 – IPv4 is used
  • client does not support IPv6 and server supports IPv6 – IPv4 is used
  • client does not support IPv6 and server does not support IPv6 – IPv4 is used

However, it is possible to isolate an IPv6-enabled server from an IPv4 network, which is what I talk about in the section “How to configure SSH to work with IPv6 only”.

In short: IPv4 and IPv6 are two different networks, even though they run on the same wires and on the same hardware.

If you're interested in a specific error, when you try to open an IPv6-only site from an IPv4-only client, you get the “Network is unreachable” error.

Another example of an error: if you try to run the following command from an IPv6-enabled network:

sudo nmap -6 suip.biz

then the host suip.biz will be scanned.

If you run the same command from a network without IPv6 support, an error will be displayed: “setup_target: failed to determine route to suip.biz (2a02:f680:1:1100::3d60)”.

See also detailed IPv6 guides:

Online services with IPv6 support:

Error “convert: cache resources exhausted” (SOLVED)

When using the convert utility to convert images, you may encounter an error stating that the cache resources have been exhausted.

Command example:

convert -density 300 -quality 100 input.pdf output.png

An example of the error it causes:

convert-im6.q16: cache resources exhausted `/tmp/magick-q7O_IcbbGpFULs5R34rLlwAyeW1slGHi19' @ error/cache.c/OpenPixelCache/4095.

This error occurs when two conditions are combined:

  • processing a large file (for example, when converting PDF to JPG)
  • weak computer with little RAM

As a quick fix, you can try reducing the image quality:

convert -density 150 -quality 70 input.pdf output.png

The -density option specifies the horizontal and vertical density of the image, that is, the number of dots. Typically, for scanning photographs, the setting is set to 300 dots – this is enough for good image quality for viewing on a monitor screen and for printing. You can experiment by choosing a lower value.

The -quality option specifies the compression level for JPEG/MIFF/PNG. Option value 100 means no compression, 100% image quality. An option value of 70 means 70% of the image quality by reducing its size.

If you do not want to reduce the quality, then you can try changing the settings. To do this, open the policy.xml file. Depending on your Linux distribution and version of ImageMagick, the path to the file may vary, for example:

  • /etc/ImageMagick-6/policy.xml
  • /etc/ImageMagick-7/policy.xml

Find and edit the string value:

<policy domain="resource" name="memory" value="256MiB"/>

Error “attempt to perform an operation not allowed by the security policy `PDF’” (SOLVED)

On Debian, Ubuntu, Linux Mint, Arch Linux, and derivative systems, when converting documents from PDF to PNG, an error occurs:

attempt to perform an operation not allowed by the security policy `PDF'

An example of a command that causes this error:

convert -density 300 -quality 100 PL48536179.pdf out.jpg
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421.
convert-im6.q16: no images defined `out.jpg' @ error/convert.c/ConvertImageCommand/3229.

Apparently Imagemagick's security policy does not allow this conversion from pdf to png. Converting other formats seems to work, but not from pdf. This happens with the default imagemagick settings.

Two options for solving the problem:

1.

In the file /etc/ImageMagick-6/policy.xml before the line

</policymap>

insert the line:

  <policy domain="coder" rights="read | write" pattern="PDF" />

and everything will work.

Note: The path to the policy.xml file may differ depending on the version of ImageMagick, for example, the path may be: /etc/ImageMagick-7/policy.xml

2.

The second option is similar, you also need to open the file /etc/ImageMagick-6/policy.xml

Find uncommented lines there

  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="PS2" />
  <policy domain="coder" rights="none" pattern="PS3" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <policy domain="coder" rights="none" pattern="PDF" />
  <policy domain="coder" rights="none" pattern="XPS" />

And comment them out, that is, put <!-- in front of them, and --> at the end.

This should work for Debian, Ubuntu, Linux Mint, and derivative systems.

In Arch Linux open the file /etc/ImageMagick-7/policy.xml

Find the uncommented line there

<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,PDF,XPS}" />

And comment them out, that is, put <!-- in front of them, and --> at the end.

After that pdf conversion should work again.

No need to do two options at once – choose one of them. The first option will only allow conversion from PDF, the second option will allow conversion from all PS, PS2, PS3, EPS, PDF, XPS formats.

This PDF policy was added due to a bug in Ghostscript that has now been fixed. That is, if you are using the current version of Ghostscript, then this policy is no longer needed.

That is, don't forget to update your Ghostscript to the latest version!

What files can be deleted when there is not enough disk space in Linux

There are situations when the disk space has run out completely and you need to urgently clean the disk and delete files. Disk space may run out even so that

  • when trying to clear the installation package cache, the system will report an error (there is no place even to save the lock file),
  • when trying to install ncdu to search for overgrown folders and files, the system will not be able to find even the 81 kilobytes required for this command
  • when trying to find the files and folders that take up the most space in Linux, the system will also give an error due to the fact that the sort command will not be able to save the data cache to disk if there is a lot of this data

That is, there are really critical situations – in these conditions, many programs and services stop working normally. Therefore, the task becomes the following: urgently at any cost to free up disk space so that you can continue servicing the system and proceed to the second stage – searching for directories and files that led to this problem due to the fact that they began to take up too much space.

I will warn you in advance: the following commands, although they mainly delete useless files, after their execution can lead to the following consequences:

  • the services will need to be restarted for them to work properly (so that they re-create the log files, caches, lock files)
  • various logs and files from the recycle bin may be lost, which, although not needed by most users, in some conditions you may want to keep them (for example, it is important for you to examine the log files, as they may be the cause of the problem).

This means that DO NOT mindlessly copy commands – read the explanations for them and evaluate how painless they are for your situation.

1. Deleting temporary files

The files in the /tmp/ directory will be deleted anyway on the next system reboot. That is, on the one hand, they can be removed quite painlessly:

sudo rm -rf /tmp/*

BUT: programs that are currently running and that have saved some data to the /tmp/ directory may be broken.

2. Deleting cache files

The /var/cache/ directory has many subdirectories that can be deleted almost painlessly (data will not be lost, and programs will create new cache files). This directory is of particular interest because on some systems caches grow to gigabytes and tens of gigabytes. Sometimes looking for a problematic directory in /var/cache/ can finally solve a situation with a lack of disk space.

To remove the font cache:

sudo rm -rf /var/cache/fontconfig/

To remove the installation package cache (on Debian, Linux Mint, Ubuntu, Kali Linux and derivatives):

sudo rm -rf /var/cache/apt/

To remove the installation package cache (on Arch Linux, BlackArch and their derivatives):

sudo rm -rf /var/cache/pacman/

Deleting the man page cache:

sudo rm -rf /var/cache/man/

You can continue searching for large caches applicable to the software installed on your system. For example, these can be web server caches, proxy servers, etc.

3. Delete logs

In this directory (/var/log/) you can delete almost all files, but try to keep the folder structure, because some applications, after deleting a directory here, are not able to create it a second time…

On web servers, the web server logs can grow too large.

To remove Apache logs on Debian, Linux Mint, Ubuntu, Kali Linux and derivatives:

sudo rm -rf /var/log/apache2/*

To remove Apache logs on Arch Linux, BlackArch and their derivatives:

sudo rm -rf /var/log/httpd/*

In order for the server to start creating and writing to new log files, the Web Server service must be restarted.

Depending on the intensity of system usage, the accumulated logs can take up gigabytes. Depending on the system, the files may have different names, a more accurate analysis is recommended to be performed using the ncdu utility:

sudo ncdu /var/log/

4. Empty the trash

This tip is more for desktop systems. The files you deleted in the desktop GUI end up in the ~/.local/share/Trash/files/ folder, you can analyze them and delete them (second time) if you wish:

ncdu ~/.local/share/Trash/files/

5. Remove unnecessary kernel header source code files

The following is only relevant for Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives. Check the /usr/src/ folder, there will be subfolders like linux-headers-; most of them can be deleted – leave only the one whose number corresponds to the current kernel of the system – this is usually the most recent release number.

6. Remove orphaned packages

Orphaned packages are those packages (programs) that were installed as dependencies for other programs. But for various reasons, they are no longer needed: either the program that used them was removed, or for that program they ceased to be dependencies after updating the program.

On Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives, you can remove unnecessary packages as follows:

sudo apt autoremove

For Debian and derivatives, the previous command is completely safe.

On Arch Linux and derivatives, the list of orphaned packages can be seen as follows:

pacman -Qdt

Before proceeding with their automatic removal, it is highly recommended to study this list!

To recursively remove orphans and their config files on Arch Linux and derivatives:

sudo pacman -Rns $(pacman -Qtdq)

If no orphaned packages were found, pacman will exit with an “error: no targets specified (use -h for help)”. This is expected since pacman -Rns took no arguments.

7. Clean up systemd logs

Over time, in some systems, the system logs begin to take up gigabytes on the hard drive. You can view the logs and free up space using the journalctl command.

To see how much space the logs are taking up, run:

journalctl --disk-usage

To remove all entries, leaving only entries per 100 megabytes, run:

journalctl --vacuum-size=100M

Or to delete all system log entries older than one week:

journalctl --vacuum-time=1weeks

8. Files in the /lost+found directory

The /lost+found directory contains files that were found after checking the disk file system. Typically, such checks are performed after a sudden reboot of the system or if there are signs of disk problems.

The files found are usually corrupted. Their goal is to save data that, if errors were corrected on the file system, would be completely lost.

The /lost+found folder may be empty (if there were no problems with the disk). If there are files there, then you can view them and, if desired, delete them.

9. Clean up PHP sessions

Sometimes web applications can create countless sessions due to a bug. Check the /var/lib/php/sessions/ directory for too many files.

(BONUS) 10. Analyze Docker Files

Don't mindlessly delete Docker files. I'm giving this directory as an example only because it caught my attention because of its sheer phantasmagoric size – and this despite the fact that I don't actually use Docker – I literally tried it several times to see what it is.

The largest folder is /var/lib/docker/overlay2/. To analyze disk space occupied, run:

sudo ncdu /var/lib/docker/

Conclusion

So, we have considered which files can be deleted from Linux with little or no loss of information. In addition to the directories discussed, which can be cleared both on a remote system with a web server and on a home computer, users with a graphical desktop should pay attention to such directories as:

  • ~/.cache
  • ~/.local
  • ~/Downloads (your downloaded files)

They do NOT need to be removed, but worth analyzing. For example, you may find out that the web browser on your computer has a cache of several gigabytes and that you can free them (it is recommended to do it using the web browser, rather than deleting files directly).

If I missed any directories with files that can be safely deleted, then write them in the comments!

Loading...
X