The Linux Page

Failing cmake find_library(), returning just a path instead of the path and library name

Forest Trail

Introduction

The CMake search algorithms are fairely simple, but it feels like each time I try to use them I make a small mistake and something goes wrong.

First there are three very important variables that are used in the search. Note that there are many other variables that can be used in the search which are listed on this page. But 99.9% of the time, these three are enough:

  1. CMAKE_MODULE_PATH

    This variable defines where to search for modules, but only if the prefix matches. Without a matching prefix, it somehow gets ignored.
     
  2. CMAKE_PREFIX_PATH

    ...

No time service when using NTP without Internet access

Broken Clock when Internet is not Available

I had an issue on a system which could be started in a complete standalone manner. In other words, without an Internet connection.

That system runs 10 computers, 9 of which are slaves as far as NTP is concerned and these computers must have their clocked set as close as possible to the controller's clock or the system won't work as expected.

So the main issue was that by default NTP is setup to listen to a few NTP servers on the Internet and if it can't connect to the Internet, it pretty much shuts down. In other words, the ability of the server to allow the slaves to get time ...

Transform Gnome settings in Command Lines

Adjusting to your preference

When trying to setup the Ubuntu environment automatically by installing a package so it works as expected, I have to use the gsettings command. Only, in most cases, the posts you find online tell you to tweak such and such value and these are wrong about 50% of the time. (Or to be more correct, they changed over time and now those old posts give you the wrong answer each time).

In order to find out what you need to change, one way is to use the GUI to make the changes and compare the settings from before and after. Here are the steps to do exactly that:

1. Open the GUI preferences allowing ...

My new WiFi router, the TP-Link Archer A9

My new TP-Link and what I think about it...

TP-Link AC1900 (click to find it on Amazon.com where I'm an affiliate)

Introduction

As my old Belkin WiFi device was not able to properly support UDP packets that it was not even concerned about, I looked into a new system and selected the TP-Link AC 1900 also known as the Archer 9.

It works. But...

Setup

First I edited the settings. One reason I selected this (opposed to say a Google Nest thingy), is that this device has a normal web interface to edit the settings. I find that much better than the concept of the Google Nest WiFi router requires voice activation. I just ...

How to remove the ffmpeg / ffprobe "stupid" banner!?

Removing the ffmpeg & ffprobe annoying banner permanently.

In some of my work, I use ffmpeg to compress/decompress video and audio files.

My big problem with the ffmpeg and ffprobe tools is the incredibly annoying banner that they print and covers most of my console output. It's not only useless, but it makes it really hard to very quickly see the standard output of the command. (if only they were to put a line of dash or something to separate that section with the next...)

Under Linux, there is actually a really easy way to prevent that stupid banner from appearing all the time. It's by using the alias command.

First, the command line ...

Encrypt zip or PDF file

Hiding keyboard while typing.

Linux has options to encrypt zip or PDF files.

Note that the zip encryption capabilities are not very strong (i.e. they can be easily cracked). So don't use it if you can avoid it and keep in mind that most anyone can see what's inside either way.

zip --encrypt file.zip files

Note that there is an option to define the password on the command line (with --password) which is safe if you're the only user on your machine, but not so much on a shared machine since the password will appear in the list of processes.

And the PDF is very similar, but you have to enter the ...

Currently Unreadable Sectors detected by SMART...

Hard Drives for a RAID system

I got 4 x 10Tb HDD -- HGST Ultrastar He10 -- click the link to find them on Amazon

What Happened?

One of my RAID1 drives, the important ones, started sending me error email messages about 8 sectors being "unreadable".

So first I waited a bit to see whether it would resolve itself. It did go silent for a few months and came back...

At that point, I decided to purchase a replacement and retire the drive giving me errors. The new drive looks good so far!

Check Current SMART Status

To see what the SMART system discovered, you can use the smartctl command like so:

 ...

Creating a message of a length equal to a string in your console

Transform a frame so the message fits.

If you are writing many scripts, once in a while, you may want to print out a message surrounded by a box. But how do you create a box of the right width?

Say for example, that you want to surround your message with + characters like so:

+++++++++++++++++++
+ My Message Here +
+++++++++++++++++++

The message itself would be coming from a variable. Maybe there is a filename into it so the width can vary widely.

Say the line in the middle is written like so:

echo "+ ${MESSAGE} +"

Then you can create the string of just + characters with the following command:

 ...

Run the Repair command in a MS-Windows console

Repair your Windows Installation

My MS-Windows 10 instance would not run properly anymore. Once booted, the login prompt worked as expected (yeah!) but once logged in, the OS would crash after a minute or two and show me the blue screen of death (BSoD).

I wanted to try a repair, so I looked into various websites, here I write what I ran so I can remember for next time (assuming it worked this time, at least).

dism /image:C:\ /cleanup-image /restorehealth

Most often, somehow, you seen people tell you to use /online as the first parameter. The fact is that your drive is not likely going to be online if you can't run ...

Creating and sharing a public key from Termux on Android

How to connect to a server from your Termux terminal

I found that good documentation from Termux, about Remote Access. It mentions [S]FTP and SSH. The main problem to use SSH is that you need to have access to the public key and... how do you copy the public key from your Termux terminal to your server?

What I've found is that you can use ssh-copy-id with a local VPS on the same network. When I'm at home, I have my phone on a LAN IP address and I can access my VPS servers... at least those that allow for a password login.

So what I've done is something like this:

1. Make sure that your VPS SSH server is still allowing password ...