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 postgresql@15-main
systemctl stop postgresql@14-main

To disable them from booting:

systemctl disable postgresql@15-main
systemctl disable postgresql@14-main

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.

ipset: error while loading shared libraries: libipset.so.13: cannot open shared object file: No such file or directory

Troubleshooting Imunify360 Installation on Linux: Resolving Missing Libraries

When installing security tools like Imunify360 on a Linux system, dependency issues can arise due to missing libraries or incompatible configurations. This guide walks you through resolving a common error encountered during installation:

The Problem

During installation, you might see an error similar to this:

[root@stack10 ~]# bash i360deploy.sh IPL  
...  
ipset: error while loading shared libraries: libipset.so.13: cannot open shared object file: No such file or directory  
[2022-12-21 04:44:14] Your OS virtualization technology kvm has limited support for ipset in containers. Please, contact Imunify360 Support Team.  

The key issue here is the missing libipset.so.13 library, which is required by ipset, a tool used by Imunify360 for managing firewall rules.

Step-by-Step Solution

1. Install the ipset-libs Package

Run this command to install the missing library:


sudo yum install ipset-libs -y

2. Verify Library Installation

Confirm the library exists:


ls /usr/lib64/libipset.so.13

3. Update Dynamic Linker Cache

Update the system’s dynamic linker cache:


sudo ldconfig

4. Retry Imunify360 Installation

Re-run the installer:


bash i360deploy.sh IPL

5. Address KVM Virtualization Warning

If the error persists:

  • If using a container (e.g., LXC, Docker) or nested virtualization: Contact Imunify360 Support for guidance.
  • For critical systems: Install Imunify360 on a bare-metal or non-containerized environment.

Why Does This Happen?

  • Missing Dependencies: The ipset-libs package provides libipset.so.13, which Imunify360 requires.
  • Outdated Repositories: Unupdated package managers may lack the latest versions of required packages.

Additional Checks

1. Update Package Repositories


sudo yum clean all  
sudo yum makecache

2. Check ipset Version


ipset --version  
rpm -q ipset ipset-libs

If outdated, reinstall with:


sudo yum reinstall ipset ipset-libs -y

3. Check for Conflicting Packages


rpm -qa | grep ipset

Uninstall conflicting versions if found.

Final Notes

  • Documentation First: Always check the Imunify360 documentation for the latest steps.
  • Contact Support: If issues persist, provide:
    • Full error logs.
    • Output of uname -a (system details).
    • Output of rpm -qa | grep ipset.

Stay Secure & Updated

By following these steps, you can resolve dependency issues and ensure a smooth Imunify360 installation. Keep your system’s packages updated and verify dependencies before deploying security tools!

Leave a comment below if you encountered other errors during installation—we’re here to help!

Keywords: Imunify360 installation error, libipset.so.13 missing, KVM virtualization limitation, ipset-libs CentOS.

Could not make the Query. Virtualizor Error

Today, when I opened a Virtualizor panel for a VM node, I found an issue like the following:

Could not make the Query.
SELECT tasks.actid, tasks.action, users.uid, users.email FROM `tasks` LEFT JOIN users on tasks.uid = users.uid WHERE action NOT IN ('vpsbackups_plan_email', 'send_background_mail', 'backuply_vpsbackups_plan_email') ORDER BY tasks.actid DESC LIMIT 10
Array
(
    [0] => HY000
    [1] => 144
    [2] => Table './virtualizor/tasks' is marked as crashed and last (automatic?) repair failed

Issue was the tasks table is marked as crashed. To solve this, we need to repair the table tasks.

First, find the password for database ‘virtualizor’ using the following command:

[root@sg40 ~]# grep dbpass /usr/local/virtualizor/universal.php
$globals['dbpass'] = 'gziqr4y989';

Now connect to the mysql using the password:

/usr/local/emps/bin/mysql -u root -p virtualizor

Now repair the table:

use virtualizor;
REPAIR TABLE tasks;

Now the virtualizor shall work.

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

root@hisab:/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'
Compressing...
Starting module build...
Building                      /          kernel module installer failed. (0):
Internal error encountered. Please contact support
Request ID: (75ca382d-5a0e-4161-8c70-8b136a6b1330)
http://www.r1soft.com/distros/index.php?uuid=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:

http://beta.r1soft.com/modules/

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:

root@hisab:~# uname -a
Linux hisab.skincafe.co 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@hisab:~#

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

http://beta.r1soft.com/modules/Ubuntu_2004_x64/

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

http://beta.r1soft.com/modules/Ubuntu_2004_x64/hcpdriver-cki-5.4.0-128-generic.209.ko

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
wget http://beta.r1soft.com/modules/Ubuntu_2004_x64/hcpdriver-cki-5.4.0-128-generic.209.ko

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:

root@hisab:~# hcp --list
Idera Hot Copy     6.16.4 build 117 (http://www.r1soft.com)
Documentation      http://wiki.r1soft.com
Forums             http://forum.r1soft.com

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


No Hot Copy sessions are currently running.
root@hisab:~#

Happy troubleshooting

How to mount raw (.img) images in Linux

You may have raw images in your system coming from some bare metal VM, like KVM/Vmware. You may mount them directly to the host machine without attaching them to a VM. To do so, you need two things:

  1. Partition to mount
  2. Sector size of the partition and the first position of the partition.

Both of these, can be derived using a command called fdisk with attribute l as the following:

[root@vps5 vpsextra]# fdisk -l mhdevelopment.img

Disk mhdevelopment.img: 268.4 GB, 268435456000 bytes, 524288000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000f1752

            Device Boot      Start         End      Blocks   Id  System
mhdevelopment.img1            2048   523241471   261619712   83  Linux
mhdevelopment.img2       523241472   524287999      523264   82  Linux swap / Solaris
You have new mail in /var/spool/mail/root
[root@vps5 vpsextra]#

Here, we are trying to mount an old image of mine, called ‘mhdevelopment.img. I would like to mount the partition that is not swap, which is namely ‘mhdevelopment.img2’ here. This partition starts from 2048 and the sector size is 512 bytes.

So to mount the partition, you can now use the following command:

sudo mount -o loop,offset=$((2048 * 512)) mhdevelopment.img /mnt

This will mount the the partition mhdevelopment.img1 to /mnt. If you want to change the mount destination, you may do this at the end in replace of /mnt to wherever you want this to be.

Happy shooting.

How to add Bangla Taka (৳) currency symbol in WkHTMLtoPdf / Odoo / OpenERP Qweb Report

WkHTMLtoPDF is a tool to convert html reports to PDF. Odoo/OpenERP uses this tool to generate PDF reports. If you are using an unicode character in PDF report, that character has to be installed in font package in the system. If you are using Windows, Bangla characters are available by default. But that is not same for Linux.

Bangla & Assamese fonts are available for Linux, in a package called ‘lohit’.

To install Bangla fonts in CentOS/Redhat based system, use the following:

yum install lohit-bengali-fonts

To install in Debian/Ubuntu based system, use the following:

apt install fonts-lohit-beng-bengali

Once this is installed, PDF reports should start showing the Bangla characters properly.

Happy shooting!

The GPG keys listed for the “MySQL 5.7 Community Server” repository are already installed but they are not correct for this package.

When you try to run yum update, you see an error like the following:

The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package.

This is coming because the GPG key for Mysql 5.7 community repo has changed. To update the GPG key, you may run the following:

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

This shall resolves the issue for you. Good luck.

How to Set Default Route Interface when there are multiple Interfaces in CentOS

Consider the following situation, you have two interfaces in your system, eth0, and eth1 (or more). Both the interfaces have a default gateway. But how can you choose which interface to follow as the default outbound requests by the server? This could be a situation like adding secondary alias IP addresses to an interface (Like eth0, eth0:0, eth0:1, eth0:2, etc).

In these cases, Linux can decide based on its own algorithm. The problem with this is in the case of Licensing. In most licensing systems these days, you need to provide an outbound IP address to your server. If this IP changes over time, you would have trouble managing the license. For these cases, you need to define your default interface to Linux.

You may set this configuration under /etc/sysconfig/network file. The ‘key’ for the settings is ‘GATEWAYDEV’.

So for example if your gatewaydev would be eth0:1, the file would look like something following:

NETWORKING=yes
HOSTNAME=hemonto.ethii.com
DOMAINNAME=ethii.com
GATEWAYDEV=eth0:1

or if it is eth1, the following:

NETWORKING=yes
HOSTNAME=hemonto.ethii.com
DOMAINNAME=ethii.com
GATEWAYDEV=eth1

I Hope, this helps somebody. Good luck

How to Concat/Merge/Join Two Array in Javascript ES6

Let’s say, we have two arrays:

let arr1 = [1, 2, 3]
let arr2 = [5, 6, 7]

Now, you want to have a third array that merges the two arrays:

let arr3 = [1, 2, 3, 4, 5, 6]

To achieve that, you can simply destructure the two arrays and use the result to create another array like following:

let arr3 = [...arr1, ...arr2]
console.log(arr3)
[1, 2, 3, 4, 5, 6]