GNU/Linux


Ubuntu how clear journal logs and free up some disk space

On a machine that has Ubuntu 20.04LTS was recently running out of space, while using the Disk Usage Analysis tool we noticed that /var/log/journal was taking a bit more than 4 GB.

We knew that the machine was not hosting any kind of public service nor did it have any hardware problems, so we decided to clear up old logs. To do so, we used the following command that removed all logs that were older than two days.

sudo journalctl --vacuum-time=2d;

The result was great as it saved 3.9 GB of space:

Vacuuming done, freed 3.9G of archived journals from /var/log/journal/ee4a566eacf347dbb47e03b3f33821a1.

More information on journalctl can be found here. You can find more options on removing old logs, for example limiting the total size of logs that you want to keep, using this variation which will keep only 50 MB of data:

sudo journalctl --vacuum-size=50M;

How to retrieve the SSL cert expiration date from a PEM encoded certificate?

We use the following command to get the ending date of PEM encoded certificates that are generated using certbot and Let's Encrypt:

openssl x509 -enddate -noout -in fullchain.pem;

To get a list of all certificates and their expiration dates, we issue the following find command that executes the above snippet on each result while printing the name of the file first.

find ~/certificates/ -name "fullchain.pem" -print -exec openssl x509 -enddate -noout -in '{}' \;

In this example, the certificates are in our home folder under the name ‘certificates’. The results will look like the following sample:

/home/tux/certificates/example.com/fullchain.pem
notAfter=Aug 22 10:12:55 2021 GMT
/home/tux/certificates/site2.example.com/fullchain.pem
notAfter=Nov 22 03:22:44 2021 GMT

Netflix error f7701-1003 on Ubuntu 1

Recently we got the error F7701-1003 on Netflix after an update on the operating system was performed. To repair it we installed the package libavcodec-extra using the following command:

sudo apt install libavcodec-extra;

After the installation was complete, we just restarted the browser and Netflix was operating again as expected.

Below is the basic information about the package that was installed:

Package: libavcodec-extra
Version: 7:4.2.4-1ubuntu0.1
Priority: extra
Section: universe/libs
Source: ffmpeg
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Multimedia Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 65,5 kB
Depends: libavcodec-extra58 (= 7:4.2.4-1ubuntu0.1)
Homepage: https://ffmpeg.org/
Download-Size: 14,8 kB
APT-Manual-Installed: yes
APT-Sources: http://cy.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
Description: FFmpeg library with extra codecs (metapackage)
 FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
 mux, demux, stream, filter and play pretty much anything that humans and
 machines have created. It supports the most obscure ancient formats up to the
 cutting edge.
 .
 This metapackage depends on the latest version of the libavcodec variant
 that offers additional codec support. Application packages can depend
 on it if they require or suggest this variant in a robust manner.

Package: libavcodec-extra
Version: 7:4.2.2-1ubuntu1
Priority: extra
Section: universe/libs
Source: ffmpeg
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Multimedia Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 65,5 kB
Depends: libavcodec-extra58 (= 7:4.2.2-1ubuntu1)
Homepage: https://ffmpeg.org/
Download-Size: 14,8 kB
APT-Sources: http://cy.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Description: FFmpeg library with extra codecs (metapackage)
 FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
 mux, demux, stream, filter and play pretty much anything that humans and
 machines have created. It supports the most obscure ancient formats up to the
 cutting edge.
 .
 This metapackage depends on the latest version of the libavcodec variant
 that offers additional codec support. Application packages can depend
 on it if they require or suggest this variant in a robust manner.