How to stop Postgresql when you have multiple versions of PGSQL Running on Ubuntu

Question: How to stop Postgresql when you have multiple versions of PGSQL Running on Ubuntu

You may run the following command to stop specific version of postgresql when using multiple versions of postgresql in a single system, under Ubuntu

systemctl stop postgresql[@version-main]

So, for example, if you have a system, with 3 postgresql server, 12, 14, 15, and would like to stop 14 and 15, then you can run the following:

systemctl stop [email protected]
systemctl stop [email protected]

To disable them from booting:

systemctl disable [email protected]
systemctl disable [email protected]

How to mount NTFS in Debian/Ubuntu

You need to first install NTFS-3G package to access NTFS on Debian. NTFS-3g depends on libntfs and fuse. Using the following shall install NTFS-3g on the system:

apt install ntfs-3g -y

Once done, now you can mount ntfs using the following command:

mount -t ntfs /dev/sdb2 /mnt

In this case, sdb2 is the ntfs partition, and we are mounting this to /mnt directory.

If you are trying to mount a Windows 10/11 partition, you might end up having a read only NTFS file system. The reason is Windows 10/11 partition doesn’t fully shutdown on shutdown command, instead it hibernates the system. To properly shutdown the system, remember to shutdown the system with ‘SHIFT’ + SHUTDOWN.

kernel module installer failed. (0) – R1Soft – Could not find a suitable hcpdriver module for your system – How to install CDP Agent Kernel Module in Ubuntu

There are times, you may end up with the following error, when you are trying to install R1Soft hcp module or the kernel module in Ubuntu based servers:

kernel module installer failed. (0) - R1Soft - Could not find a suitable hcpdriver module for your system - Ubuntu

Full error could be like the following when you call for –get-module

[email protected]:/lib/modules/r1soft# serverbackup-setup --get-module
Building header archive ...
outfile = /tmp/headers881407773
headers = /usr/src/linux-headers-5.4.0-128-generic
Session ID: 379634599
Waiting to upload...
Uploading file...
Waiting in build queue...
Failed to get suitable module for this system: Failed to build module: No builders found.

Get module failed.
Falling back to old get-module ...
Checking if module needs updated
Checking for binary module
Waiting                       /
No binary module found
Gathering kernel information
Gathering kernel information complete.
Creating kernel headers package
Checking '/tmp/r1soft-cki.1667140819' for kernel headers
Found headers in '/tmp/r1soft-cki.1667140819'
Starting module build...
Building                      /          kernel module installer failed. (0):
Internal error encountered. Please contact support
Request ID: (75ca382d-5a0e-4161-8c70-8b136a6b1330)

To solve this error, you may get the built kernel module for Ubuntu based on it’s distribution in their repository. The link to the repository would be as following:

Now, if you are using Ubuntu 20.04, then the module would be available under the folder: Ubuntu_2004_x64

In my case, it was Ubuntu 20.04. Next stop, is to find the kernel version. You may get it from the following command:

[email protected]:~# uname -a
Linux 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[email protected]:~#

Kernel number to note in our case, would be ‘5.4.0-128’. Now search for this inside the link:

You should find a match, like for my case it was the following link:

Next stop, is to go to the r1soft module folder and load the module. You may do so like the following:

cd /lib/modules/r1soft

Now, all you need, is to restart r1soft. Remember to stop and star the agent instead of direct restart.

service cdp-agent stop
service cdp-agent start

This should be able to load the HCP module now. You may verify this by typing:

[email protected]:~# hcp --list
Idera Hot Copy     6.16.4 build 117 (

Thank you for using Hot Copy!
Idera makes the only Continuous Data Protection software for Linux.

No Hot Copy sessions are currently running.
[email protected]:~#

Happy troubleshooting

How To: Start a Screen Session and Run a Command at a Time

Sometimes, you may want to run a screen command in a remote server. That makes it necessary to run the command inside the screen session while starting it.

How to start a screen session and run a command in one line

# screen -d -m sh -c "yourcommand"

From the man page of Screen:

-d -m : Start screen in “detached” mode. This creates a new session but doesn’t attach to it. This is useful for system startup scripts.

sh -c: Starts a shell and runs a command for you.


Quick Tip: How to Check Total Number of Mails in Postfix Queue

Exim provides a quick way to check the total number of mails in the queue. This is done using the exim -bpc Although, this is not the same for postfix. Postfix doesn’t come with an easy way to do that.

How to Check Total Number of Mails in Postfix Queue

A quick tip on what I use to check the postfix queue number is the following command:

# mailq | tail -n 1
-- 6899 Kbytes in 1518 Requests.

Basically, postfix returns the queue statistics at the end of the queue listing command. We are simply tailing that to find the number.


Linux: Assertion failed on job for iptables.service.

If you are using Centos 7 or RHEL 7 or any of it’s variant, you are probably using ‘Firewalld’ by default. Although, if you are a iptables fan like me, who likes it’s simplicity and manipulative nature instead of a full form firewall, then you probably have disabled firewalld from your CentOS 7 instance and using iptables. There are couple of servers, where I use runtime iptables rules for postrouting and masquerading. These rules are dynamically generated by my scripts instead of the sysconfig file under:


This file is generated upon running the iptables save command:

service iptables save

which I rarely do so.

Error Details

Which is why, I don’t have a /etc/sysconfig/iptables file in those servers and a common error I see while restarting iptables in those system is the following:

# systemctl restart iptables.service
Assertion failed on job for iptables.service.

How to Fix The Error

The error appears because you don’t have any rule in /etc/sysconfig/iptables or the file doesn’t exist either. You can ignore the error as iptables would still run. To eradicate the error, simply make sure you have some iptables rules loaded on your system using the status command:

iptables -S

And then, run:

service iptables save

Once done, restarting iptables shouldn’t show the error any longer.

How to: Find dm number of a LVM logical volume

Sometimes, you will see the error thrown in dmesg or /var/log/messages are mentioned in dm-number format, while you manage the disk using lvm logical volume name. This is because lvm logical volumes are designed through kernel device mapper technique and kernel recognizes volumes using dm numbers. There is a tool to list all the device mappers used for block devices under Linux. Simply type the following to list the maps:

# lsblk

It shall show something like the following:

There you can see the dm number for each lvm volume is listed under first bracket. For example the swap in this server is created with LVM with the name vg_iof442/swap and has the dm-1 mapping.