The Linux Page

A C++ implementation of a UDP client/server

A Telephone post with many lines to the surrounding homes.

I have noticed that quite a few people were trying to create UDP communication and I thought that proposing my class could help them. This is very basic as it does not define anything such as the size of a packet or any protocol to ensure arrival of the packets. However, it can be useful if you want to send a signal from one process to another, which is exactly how I use this implementation (i.e. I send a PING message to wake up a background process whenever the front end adds data to the database.)

This code is part of the Snap! C++ implementation. The latest version can be found in the ...

pulseaudio not starting on newer Ubuntu (21.10, 22.04...)

Namibia Desert has audio like curves

Issue with pulseaudio

It looks like pulseaudio is about to become history¹. I've read that you should be using a new system in replacement to pulseaudio.

In the meantime, I have pulse audio installed and so was thinking it makes more sense to use that at the moment rather than trying to get a new thing going and that was preventing Shotcut from working².

Is it running?

To see whether it is running, use:

$ pactl info

If it works, you see a list of details about your audio device.

Server String: 127.0.0.1
Library Protocol Version: 35
Server Protocol Version: ...

Since 22.04 (possibly 21.10?) anacron runs at the wrong time?!

Anacron Time Changed

After upgrading, I noticed that I was getting some results from my Anacron at 07:38 instead of the usual "around midnight" time (which was often off by 1h in winter and/or summer... but that was fine with me).

Anacron Settings on 22.04

So I looked around and found out that the setup to start the Anacron scripts, a calendar setup in systemd, is used on newer systems. The other scripts starting CRON will test whether anacron is installed then do nothing if so. The old anacron script will test whether systemd is installed and if so, again, do nothing.

...

Workspace Matrix (for when you want many workspaces in Linux)

Yesterday I upgraded to Ubuntu 20.04 from Ubuntu 18.04. I wanted to do that soon, but somehow the firewall stopped working and I just couldn't find a solution (the NAT table was being ignored and as a result the LAN was dead because all the FORWARD rules would not be hit).

First, the upgrade did not want to start because the 20.04 repository was being updated. I tried again after about 1h and that worked.

The whole process took a very long time, but at least it worked.

I'm not too sure why, but MySQL took FOREVER. I have database that should be copied in 2 minutes, okay, maybe 5. ...

Filtering a mailbox with formail and procmail

I had to delete many emails that ended up in my archives.

When I received an email from postfix, I have a virtual entry that looks like this:

alexis@example.com    archive@archive.example.comarchive@archive.example.com

example.com is the main mail server receiving all the external mail.

archive.example.com is a separate system where mail gets sent for archival.

The archival happens in /var/mail/archive and when the file grows over a certain size, it gets compressed and saved in a different location.

The files are therefore mailbox like. Emails are written one after the other with a From to start each email.

...

How do I get the motherboard, memory, etc. info from the command line?

dmidecode to retrieve information about your hardware

The Linux system offers a set of commands that allow you to read manufacturer information from the command line.

These are decoded as DMI data.

The motherboard info if listed with:

sudo dmidecode --type baseboard | less

The output should at least include a Manufacturer name and a Product Name. The Product Name would be the motherboard name as defined by the manufacturer.

You can also find memory information with:

sudo dmidecode --type memory | less

You should get a list of  DIMM slots with information about whether those slots are filled with a DIMM or not. Those with a DIMM ...

Upgrade from 18.04 or 20.04 to 22.04 and MPI packages...

What's the Issue?

It looks like there was a bug in the MPI binary package where some alternative created a "same link" issue.

alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link same as main link

The error says that an "update-alternatives ..." command found an issue trying to create an alternative where the alternative is actually not an alternative.

Did the Upgrade Work?

If you saw many other installations going and this is the last thing you see, then yes, you have your OS upgraded to the newer version. You can reboot and do whatever, ...

Useful Docker Commands

Retrieve a Docker Image

You found an image and you have a URL now you want to get a copy, you do a pull like so:

docker pull gcr.io/distroless/static

It will load that image in docker.

List Files in a Docker Image

I often would like to see the files inside a docker image. The fact is that Docker has a tarball of those files that one can export to see said files.

First you can try the save command like so:

docker save <image-uuid> > foo.tar

If that doesn't seem to work, you can try the following few steps to check out your image contents by first creating a ...

Parallelize a process in bash

Run processes in parallel in a bash script.

The other day, I worked on creating a video which means extract over 4,000 frames and then processing those frames. One of the processes is to overlay one image over another (using convert from ImageMagick). This process is very slow because each time the convert tool reloads the background image and the movie frame to overlay... so I thought I should run these commands in parallel. After all, I have 64 CPUs, let's use them!

In bash, there is a special option on the wait command: -n. This option means: wait for any one of the currently running jobs to finish. This is quite practical ...

How do I find the vim editor that locks my file?

Files piling up...

Once in a while, when I try to open a file, I get an error message saying that the file is already being edited in another instance of vim. I often have over 10 instances of vim opened so it makes it rather complicated to find out which one is the culprit.

In most likelihood, the error message includes all the information that you need. Here is an example:

E325: ATTENTION
Found a swap file by the name "/etc/apache2/sites-available/.linux.m2osw.com.conf.swp"
          owned by: root   dated: Fri Jan 22 16:19:51 ...