Install custom updated Perl

If you need a second perl installation, without messing up the system perl, there’s a fairly easy way:

mkdir /usr/local/perls;cd /usr/local/perls
wget http://www.cpan.org/src/5.0/perl-5.26.1.tar.gz
tar -xzf perl-5.26.1.tar.gz
cd perl-5.26.1
./Configure -des -Dusethreads -Dprefix=/usr/local/perls/perl-5.26.1
make;make test;make install
cd /usr/local/perls/
rm -f /usr/local/perls/perl-5.26.1.tar.gz

Enjoy!

Migrate/clone WHM settings between cPanel/WHM servers

If you want to clone or migrate between cPanel/WHM servers, the cpconftool is available and should make life a little bit easier unless you automated configuring all the options through the cPanel/WHM api.

As far as usage goes, it’s fairly standard: check what modules are tracked

[root@test ~]# /usr/local/cpanel/bin/cpconftool –list-modules
cpanel::easy::apache
cpanel::smtp::exim
cpanel::system::backups
cpanel::system::mysql
cpanel::system::whmconf
cpanel::ui::themes

Backup the modules and then restore them on the target server.

/usr/local/cpanel/bin/cpconftool [–restore=file|–backup|–list-modules|–query-module-info] –modules=MODULE,MODULE,MODULE [–prerestore_backup] [–verbose]
[root@test ~]# /usr/local/cpanel/bin/cpconftool –modules=cpanel::easy::apache,cpanel::smtp::exim,cpanel::system::backups,cpanel::system::mysql,cpanel::system::whmconf,cpanel::ui::themes –backup
Backup Successful
/home/whm-config-backup-cpanel__easy__apache-1.0.0_cpanel__smtp__exim-10.990000_cpanel__system__backups-11.76.0.10_cpanel__system__mysql-11.76.0.10_cpanel__system__whmconf-11.76.0.10_cpanel__ui__themes-1.0.1-1543688144.tar.gz

Restoration goes like this:

/usr/local/cpanel/bin/cpconftool –modules=cpanel::easy::apache,cpanel::smtp::exim,cpanel::system::backups,cpanel::system::mysql,cpanel::system::whmconf,cpanel::ui::themes –restore /home/whm-config-backup-cpanel__easy__apache-1.0.0_cpanel__smtp__exim-10.990000_cpanel__system__backups-11.76.0.10_cpanel__system__mysql-11.76.0.10_cpanel__system__whmconf-11.76.0.10_cpanel__ui__themes-1.0.1-1543688144.tar.gz

If you came to this page and you’re looking for someone to make all your server related problems go away, feel free to drop us a message and we’ll get back to you asap.

Repair/Optimize all cPanel/WHM databases

If you ever want to repair/optimize all databases on your cPanel server (this also works on non-cPanel servers by the way) all you have to do is run this:

  • Repair all databases:

mysqlcheck –all-databases -r

  • Optimize all databases:

mysqlcheck –all-databases -o

Windows EC2 INACCESSIBLE BOOT DEVICE

So i have a Windows 2016 Datacenter edition EC2 instance that was used for a SQL server and it’s killing me today with the INACCESSIBLE BOOT DEVICE blue screen.

Here’s me documenting what i tried to use to fix it and things that failed:

[Preparations]

  • Take snapshot of the instance
  • Stop instance
  • Detach root volume
  • Create a secondary windows instance, which i’ll be using for restore purposes and log on via RDP to it.
  • Points 1 2 3  below are happening with the volume attached to the recovery instance, after which i detach it, and reattach it to the damaged instance, and boot it up, see if it works.
  • Between each failed point 1 2 3 etc, i am detaching the volume from the damaged instance, and attaching it back to the rescue instance to try the next thing. Make sure you attach it as “/dev/sda1”, as that’s the root mount.

[Things that have failed so far]

1 – Attach it to the recovery instance, run CMD in an elevated prompt and run the command below(didn’t boot):

bcdedit /store D:\boot\bcd /set {default} bootstatuspolicy ignoreallfailures

2 – Use DISM to figure out if it was an automated windows update that installed some patch that bricked it (wasn’t)

dism /Image:D:\ /Get-Packages

3 – Installed EC2 Recovery tools and tried using the offline mode both to “fix boot issues” and “restore last known registry config” (neither worked)

4 – Running a SFC scan to see if there’s any integrity issues (didn’t work):

sfc /scannow /offwindir=d:\windows /offbootdir=d:\

5 – Attempt to rewrite the boot records with bcdedit:

bootsect /nt60 D: /mbr
D:\windows\system32\bcdboot.exe D:\Windows /s D:
bcdedit /store D:\Boot\BCD /set {default} device partition=D:
bcdedit /store D:\Boot\BCD /set {default} osdevice partition=D:
bcdedit /store D:\Boot\BCD /set {bootmgr} device partition=D:

6 – Re-create the boot partition:

bcdboot C:\Windows /S D:

The system received an error from the “MySQL” database “mysql”: ER_PASSWORD_NO_MATCH (Can’t find any matching row in the user table)

One of my proactive management customers came up to me today with an issue he’s been having on one of his cPanel/WHM servers: he has been trying to add a user to a database he created and he received this error:

The system received an error from the “MySQL” database “mysql”: ER_PASSWORD_NO_MATCH (Can’t find any matching row in the user table)

Apparently commenting out skip-name-resolve in /etc/my.cnf fixed it.

then run a MySQL server restart with: /scripts/restartsrv_ mysql and you should be good to go.

How to fix -> npm ERR! cb() never called!

npm install
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>

I got this error today on a cPanel server where i am running a node.js app that’s reversed proxy to, by Nginx. The error happens when trying to run “npm install” on a large project where roughly 1200 modules should be installed. What happens is that not all of them got installed and some were missing the binaries.

After doing a ton of googling, i found that the ulimit might be an issue, so i went ahead and disabled “Shell and fork bomb protection” that limits the ulimit to 100.

Restart the shell and npm install worked without issues due to having ulimit set to 4096.

Good luck!

Ubuntu how to right click and scroll

I have not been using my Ubuntu laptop touchpad for ages, but recently i have been traveling and i am taking my laptop out every day, so i have to use the touchpad way more frequently.

A wrench got thrown in my thinking process when i saw i cannot right click or edge scroll but it looks like this behavior was just changed. If it’s simpler or not it’s for you to judge:

Right clicking in Ubuntu is now achieved by using 2 fingers to click on the touchpad.

Edge scroll seem to not be working anymore, however you can scroll by using 2 fingers instead of one, anywhere on the touchpad.

Happy Ubuntu-ing!

Ubuntu – close Discord but notifications still come

So i am using Discord a lot and i have encountered this problem more than once: you close Discord but the notifications still come even though the icon in the systray is not there. Pretty annoying right?

I found 2 cool things to deal with this:

1 – https://extensions.gnome.org/extension/1031/topicons/ – install topIcons Plus – this will show you the systray at the top and if you close any program from there, it really stays closed.

2 – press “control+q” while having Discord opened. – same result.

Enjoy!

Create MySQL Admin user

If you want to create a MySQL admin user that can connect from anywhere, feel free to tweak the string below:

#create SQL Admin user
CREATE USER ‘clusterAdmin’@’%’ IDENTIFIED BY ‘YOUR_cool_password_here’;
GRANT ALL PRIVILEGES ON *.* TO ‘clusterAdmin’@’%’;
FLUSH PRIVILEGES;

If you want to limit connections to localhost, switch the “%” to “localhost”