# Small Commands, Issues And Guides - A Collection

<span style="color: rgb(0, 0, 0);">This page is for commands, issues or guides which don't need to be added as a separate page. You can search for them with **Ctrl + F** or click the "Search" at the top.</span>

##### <span style="color: rgb(0, 0, 0);">**Only Allow PublicKey Authentication Overriding Password Auth**</span>

<span style="color: rgb(0, 0, 0);">No idea why, some systems are completely ignorant and ignoring the demand for no password auth.</span>

<span style="color: rgb(0, 0, 0);">Add this line to bottom of SSHD config. No idea why, but the The PA parameter is no and ChallengeResponseAuthentication is also no, but still auths with password... ***sigh.***</span>

<span style="color: rgb(0, 0, 0);">**AuthenticationMethods publickey**</span>

##### <span style="color: rgb(0, 0, 0);">**Give A MongoDB User Permission To Command "mongodump”**</span>

<span style="color: rgb(0, 0, 0);">use admin</span>  
<span style="color: rgb(0, 0, 0);">db.grantRolesToUser( "<span style="color: rgb(186, 55, 42);">**USER**</span>", \[ "readWrite" , { role: "readWrite", db: "config" } \] )</span>

##### **<span style="color: rgb(0, 0, 0);">Remove Apache2/Nginx Python3’s modules for Certbot</span>**

**<span style="color: rgb(0, 0, 0);">Apache2: </span>**<span style="color: rgb(0, 0, 0);">python3-certbot-apache</span>**<span style="color: rgb(0, 0, 0);">  
Nginx: </span>**<span style="color: rgb(0, 0, 0);">python3-certbot-nginx  
</span>

##### <span style="color: rgb(0, 0, 0);">**Remove a package that is being stubborn and will not remove**</span>

<span style="color: rgb(0, 0, 0);">sudo dpkg --force-all -P &lt;package-name-to-remove&gt;</span>

##### **<span style="color: rgb(0, 0, 0);">Absolute headache with MySQL 8.0 mixing with MariaDB’s installs</span>**

<span style="color: rgb(0, 0, 0);">MySQL 8.0 has the config file in <span style="color: rgb(176, 19, 243);">*/etc/mysql/mysql.conf.d/mysqld.cnf*</span> like MariaDB has <span style="color: rgb(176, 19, 243);">*/etc/mysql/mariadb.conf.d/50-server.cnf*</span>.</span>

<span style="color: rgb(0, 0, 0);">**BY DEFAULT** MySQL binds publicly… MariaDB binds to internal localhost.</span>

<span style="color: rgb(0, 0, 0);">Use **mysqld --verbose --help | grep bind** to actually see it bind publicly on first installation…</span>

<span style="color: rgb(0, 0, 0);">If you mix MariaDB’s config files + MySQL’s, it’s not my.cnf, mysql.cnf, the conf.d folder entirely or any other configuration. **It is literally mysqld.cnf in the mysql.conf.d folder.** What utter BS.</span>

##### <span style="color: rgb(0, 0, 0);">**Fixing the repository error for changing it’s “version” for updates**</span>

<span style="color: rgb(0, 0, 0);">**Example:** *N: Repository 'http://deb.debian.org/debian bullseye InRelease' changed its 'Version' value from ‘11.7' to '11.8'*</span>

<span style="color: rgb(0, 0, 0);">**One command:** apt-get --allow-releaseinfo-change update</span>

<span style="color: rgb(0, 0, 0);">**Taken from:** <span style="color: rgb(0, 58, 255);">*[https://www.reddit.com/r/debian/comments/ca3se6/for\_people\_who\_gets\_this\_error\_inrelease\_changed/](https://www.reddit.com/r/debian/comments/ca3se6/for_people_who_gets_this_error_inrelease_changed/)* </span></span>

##### <span style="color: rgb(0, 0, 0);">**The certbot command that actually works to change the email**</span>

<span style="color: rgb(0, 0, 0);">certbot update\_account –email **&lt;email&gt;**</span>

##### <span style="color: rgb(0, 0, 0);">**SlimeWorldManager Installation**</span>

- <span style="color: rgb(0, 0, 0);">Download the latest Spigot/Paper jar you require and pop it into the main directory.</span>
- <span style="color: rgb(0, 0, 0);">Put the slimeworldmanager-plugin-&lt;version&gt;.jar into the same place as the server.jar.</span>
- <span style="color: rgb(0, 0, 0);">Update your startup command to include **-javaagent:&lt;thejar&gt;**, like the below:</span><span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/yZ16CD.png)</span>

<span style="color: rgb(0, 0, 0);">**Taken from:** <span style="color: rgb(0, 58, 255);">*[https://github.com/cijaaimee/Slime-World-Manager/blob/master/.docs/usage/install.md](https://github.com/cijaaimee/Slime-World-Manager/blob/master/.docs/usage/install.md)*</span></span>

##### <span style="color: rgb(0, 0, 0);">**Crons not running for WHMCS on cPanel - They hang and sit there d<span style="color: rgb(0, 0, 0);">oing nothing</span>**</span>

- <span style="color: rgb(0, 0, 0);">Log into WHM (The admin side of cPanel)</span>
- <span style="color: rgb(0, 0, 0);">Navigate to "*MultiPHP INI Editor*" by searching it on the left hand side.</span>
- <span style="color: rgb(0, 0, 0);">Select the version of PHP that your site uses, using the editor is easier.</span>
- <span style="color: rgb(0, 0, 0);">Increase the following variables:</span>
    - <span style="color: rgb(0, 0, 0);">"max\_execution\_time" - 240/300 should be fine.</span>
    - <span style="color: rgb(0, 0, 0);">"max\_input\_time" - same as above.</span>
    - <span style="color: rgb(0, 0, 0);">"memory\_limit" - Higher than 1024M.</span>
- <span style="color: rgb(0, 0, 0);">Click "*Apply"*</span>
- <span style="color: rgb(0, 0, 0);">Repeat for all versions of PHP that are having a timeout error.</span>
- <span style="color: rgb(0, 0, 0);">Restart cPanel's FPM with systemctl restart ea-php81/82-php-fpm.</span>

<span style="color: rgb(0, 0, 0);">**Taken from:** <span style="color: rgb(0, 58, 255);">*[https://support.cpanel.net/hc/en-us/articles/360052237994-How-to-increase-the-Max-Execution-Time-directive-for-PHP](https://support.cpanel.net/hc/en-us/articles/360052237994-How-to-increase-the-Max-Execution-Time-directive-for-PHP)*</span></span>

##### **<span style="color: rgb(0, 0, 0);">RAID Ubuntu 20.04</span>**

<span style="color: rgb(0, 0, 0);">**Taken from:** *<span style="color: rgb(0, 58, 255);">[https://kifarunix.com/setup-software-raid-on-ubuntu-20-04/](https://kifarunix.com/setup-software-raid-on-ubuntu-20-04/) </span>*</span>

<span style="color: rgb(0, 0, 0);">**Note** - If you get error: *partition length of \[BIGGERSIZE\] sectors exceeds the msdos-partition-table-imposed maximum of \[SMALLERSIZE\]*  
</span>

<span style="color: rgb(0, 0, 0);">**Follow**: <span style="color: rgb(0, 58, 255);">*[https://askubuntu.com/questions/84538/trouble-creating-3tb-ext4-partition-due-to-msdos-partition-table-imposed-error](https://askubuntu.com/questions/84538/trouble-creating-3tb-ext4-partition-due-to-msdos-partition-table-imposed-error)* </span></span>

##### <span style="color: rgb(0, 0, 0);">**Switching RAID 1 to RAID 0**  
</span>

<span style="color: rgb(0, 0, 0);">Scroll down a bit to locate the answer from nmr, which includes removing the mirror, changing, waiting then resizing. </span>

<span style="color: rgb(0, 0, 0);">**Taken From:** *<span style="color: rgb(0, 58, 255);">[https://serverfault.com/questions/915284/is-it-possible-to-convert-raid1-to-raid0-without-system-reinstalation](https://serverfault.com/questions/915284/is-it-possible-to-convert-raid1-to-raid0-without-system-reinstalation)</span>*  
</span>

##### **<span style="color: rgb(0, 0, 0);">Remove .html/.php extension</span>**

<span style="color: rgb(0, 0, 0);">Read the answer from Arnon, the big threaded part with explanations.</span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 58, 255);"><span style="color: rgb(0, 0, 0);">**Taken from:**</span> *<span style="color: rgb(0, 58, 255);">[https://stackoverflow.com/questions/38228393/nginx-remove-html-extension](https://stackoverflow.com/questions/38228393/nginx-remove-html-extension)</span>*</span></span>

##### **<span style="color: rgb(0, 0, 0);">Can't run a module or build a NodeJS app due to no such file and has no installation candidate</span>**

![](https://docs.jasmeow.systems/uploads/images/gallery/2024-02/MOKCKeQ0hZzhohh7-embedded-image-zjyajp8h.png)

![](https://docs.jasmeow.systems/uploads/images/gallery/2024-02/Q6vm9H9fOnfjgYTl-embedded-image-zmyppfch.png)

<span style="color: rgb(0, 0, 0);">One simple command to clear out the old NPM packages already downloaded from cache.</span>

**<span style="color: rgb(0, 0, 0);">npm clean-install</span>**

<span style="color: rgb(0, 0, 0);">You can then go about reinstalling with yarn build or another method used.</span>

##### **<span style="color: rgb(0, 0, 0);">Any NPM package doesn't install into /usr/local/bin, such as ghostcms - Updating the prefix location due to weird bug</span>**

<span style="color: rgb(0, 0, 0);">**Taken from:** <span style="color: rgb(0, 58, 255);">[https://askubuntu.com/questions/1102579/using-npm-to-install-file-to-usr-local-bin](https://askubuntu.com/questions/1102579/using-npm-to-install-file-to-usr-local-bin)</span> </span>

<span style="color: rgb(0, 0, 0);">For some weird reason, on some installs of NodeJS and then installing npm, it ends up at /usr and not /usr/local to allow /usr/local/bin packages to be viewable, such as GhostCMS's ghost-cli. Stupid bug, no idea why. Run the set prefix command to fix it, then install Ghost's CLI fine.</span>

<span style="color: rgb(0, 0, 0);">The reason why this needs doing is due to the error "Error: Cannot find module '/usr/local/bin/ghost'" and "MODULE\_NOT\_FOUND" which is absolutely idiotic since you literally just installed it, but in the wrong place. This will happen when trying to start the service and it fails.</span>

```bash
root@S01:/var/www/website.com# npm get prefix
/usr
root@S01:/var/www/website.com# npm config set prefix /usr/local
root@S01:/var/www/website.com# npm get prefix
/usr/local
sudo npm install ghost-cli@latest -g
```

##### **<span style="color: rgb(0, 0, 0);">Date command in linux - Echo and crontab support</span>**

<span style="color: rgb(0, 0, 0);">When using the date command in terminal, if you are echoing the line, you need to make sure you don't escape the percentages as it will include the slashes.</span>

- <span style="color: rgb(0, 0, 0);">echo $(date +"\\%d-\\%m-\\%Y").txt ![](https://jasmeow.pics/k50KLS.png)</span>
- <span style="color: rgb(0, 0, 0);">echo $(date +"%d-%m-%Y").txt ![](https://jasmeow.pics/1Shlbn.png)</span>

<span style="color: rgb(0, 0, 0);">However, when inside crontab, you will need to escape them otherwise cron believes it is an operand and not a variable to pass. And example is below where you also need the path in a full string for it to echo properly and understand the date variable.</span>

- <span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/kNcTEK.png)</span>
- <span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/wjcX1M.png)</span>

<span style="color: rgb(0, 0, 0);">You can also use **-d** for naming how we name things, such as "yesterday" "tomorrow" or "2 months ago".</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/z7U83n.png)</span>

- <span style="color: rgb(0, 0, 0);">**Note:** You can also do broken English such as "2 month ago" instead of months!</span>
- <span style="color: rgb(0, 0, 0);">**Taken from:** [https://stackoverflow.com/questions/17015187/how-does-date-d-parse-dates](https://stackoverflow.com/questions/17015187/how-does-date-d-parse-dates)   
    </span>

##### **<span style="color: rgb(0, 0, 0);">List hardware device information for PFSense &amp; FreeBSD OS</span>**

<span style="color: rgb(0, 0, 0);">Command **lshw** does not exist on these platforms, use **pciconf -lv**.</span>**<span style="color: rgb(0, 0, 0);">  
</span>**

![image.png](https://docs.jasmeow.systems/uploads/images/gallery/2025-01/scaled-1680-/h3PWubKQmyry7y5c-image.png)

##### <span style="color: rgb(0, 0, 0);"><span style="color: #000000;">**Qemu Image mounting &amp; commands on normal OS and Ceph installed systems**</span></span>

<span style="color: rgb(0, 0, 0);"><span style="color: #000000;">**Run:** apt install qemu-utils &amp;&amp; modprobe nbd max\_part=8  
**Connect:** qemu-nbd -c /dev/nbd0 a-disk-which-is-formatted-in-qcow2-format.img  
**Disconnect:** qemu-nbd -d /dev/nbd0</span></span>

<span style="color: rgb(0, 0, 0);">**Get information of a image:** qemu-img info a-disk-which-is-formatted-in-qcow2-format.img</span>

<span style="color: rgb(0, 0, 0);">**Converting:**  
qemu-img convert -f qcow2 -O raw image-to-convert.img image-to-get-as-raw.raw  
qemu-img convert -f raw -O qcow2 image-to-convert.raw image-to-get-as-qcow2.img</span>

<p class="callout info"><span style="color: rgb(0, 0, 0);">If disk is an LVM drive (With LVM partitions basically) and cannot be mounted/viewed to get to the root partition, you need to update the LVM configuration file.  
</span>  
**<span style="color: rgb(0, 0, 0);">nano /etc/lvm/lvm.conf</span>**  
<span style="color: rgb(0, 0, 0);">**Replace:** global\_filter=\["r|/dev/zd.\*|","r|/dev/rbd.\*|"\]</span>  
<span style="color: rgb(0, 0, 0);">**With:** global\_filter=\["r|/dev/zd.\*|","a|/dev/rbd.\*|"\]  
  
<span style="text-decoration: underline;">Then complete the following:</span></span>  
<span style="color: rgb(0, 0, 0);">**Run:** pvscan &amp;&amp; lvscan</span>  
<span style="color: rgb(0, 0, 0);">**Then enable with:** vgchange -ay</span>  
<span style="color: rgb(0, 0, 0);">**Run:** mount /dev/&lt;VG\_NAME&gt;/&lt;LV\_NAME&gt; /mnt/&lt;LOCATION&gt;  
  
<span style="text-decoration: underline;">Once you're done using the mounted LVM drive:</span>  
**Run:** vgchange -an &lt;VG\_NAME&gt;  
**IE:** vgchange -an vg0 (Doesn't actually mean now active, it is actually unmounting it #stupidLVM)</span>  
</p>

<span style="color: rgb(0, 0, 0);">**Get ceph pools:** ceph osd pool ls  
**List:** rbd ls &lt;POOL-NAME&gt;  
**Map a drive to be viewed:** rbd map ceph-disk/vm-&lt;ID&gt;-disk-0  
**Remove a mapped drive:** rbd unmap /dev/rbd0  
**Export:** rbd export &lt;POOL-NAME&gt;/vm-&lt;ID&gt;-disk-0 vm-&lt;ID&gt;-disk-0.raw  
**Import:** rbd import &lt;LOCATION&gt; &lt;POOL-NAME&gt;/&lt;IMAGE-NAME&gt;  
</span>

<p class="callout danger"><span style="color: rgb(0, 0, 0);">**Remove image from ceph cluster entirely for that VM (Careful):** rbd remove &lt;POOL-NAME&gt;/vm-&lt;ID&gt;-disk-0  
</span></p>

##### <span style="color: rgb(0, 0, 0);"><span style="color: #000000;">**Get into an OS that is stuck on the Grub boot window** </span></span>

<p class="callout warning"><span style="color: rgb(0, 0, 0);"><span style="color: #000000;">This section **only** applies if you knew the **OS booted before**, but now doesn't work. This is probably because you moved a virtual machine between hosts and/or software, like raw to qcow2, or from VirtFusion/Standalone to Proxmox, etc.  
  
You might need to boot into gparted to potentially grab the vmlinuz images to boot off of (what their names are and mount the drive, ls them, etc, **BUT** you might be able to do **ls** inside of your grub after setting the root=. (Such as set root=(hd0) then ls)  
  
set root=(hd0)  
linux /boot/vmlinuz-x.x.x-amd64 root=/dev/&lt;DRIVE&gt; ro  
initrd /boot/initrd.img-x.x.x-amd64  
boot  
  
**EXAMPLE:**  
set root=(hd0)  
linux /boot/vmlinuz-5.10.0-33-amd64 root=/dev/sda ro  
initrd /boot/initrd.img-5.10.0-33-amd64  
boot  
  
Running the "boot" command will make it freeze, wait up to 1 minute as it will glitch out and finally boot into normal OS. You can then repair grub with *update-grub*/*update-initramfs -u -k all*, etc.  
</span></span></p>

##### <span style="color: #000000;">**Fix syncing of MySQL servers not syncing when both master &amp; slave** </span>

<span style="color: #000000;">Run this on server 2:</span>

```mssql
STOP SLAVE;

CHANGE MASTER TO
MASTER_HOST='MYSQL-01.abc.com',
MASTER_USER='<username>',
MASTER_PASSWORD='<password>',
MASTER_LOG_FILE='mysql-bin.000001', -- from MYSQL-01 "SHOW MASTER STATUS;"
MASTER_LOG_POS=753, -- from MYSQL-01 "SHOW MASTER STATUS;"
MASTER_SSL=1,
MASTER_SSL_CA='/etc/mysql/ssl/ca-cert.pem',
MASTER_SSL_CERT='/etc/mysql/ssl/server-cert.pem',
MASTER_SSL_KEY='/etc/mysql/ssl/server-key.pem';
START SLAVE;
```

<span style="color: #000000;">Run this on server 1:</span>

```mysql
STOP SLAVE;

CHANGE MASTER TO
MASTER_HOST='MYSQL-02.abc.com',
MASTER_USER='<username>',
MASTER_PASSWORD='<password>',
MASTER_LOG_FILE='mysql-bin.000003', -- from MYSQL-02 "SHOW MASTER STATUS;"
MASTER_LOG_POS=157, -- from MYSQL-02 "SHOW MASTER STATUS;"
MASTER_SSL=1,
MASTER_SSL_CA='/etc/mysql/ssl/ca-cert.pem',
MASTER_SSL_CERT='/etc/mysql/ssl/server-cert.pem',
MASTER_SSL_KEY='/etc/mysql/ssl/server-key.pem';
START SLAVE;
```

##### <span style="color: #000000;">**When running "mysql" command in terminal, login prompts for password.**</span>

<span style="color: #000000;">This happens due to the password being modified for the root user, such as breaking into it from networking only mode, or from transferring the "mysql" database which houses the user logins. You need to make the root user login with "unix\_socket" to be able to just simply run "mysql" in terminal without a password again using the following command:</span>

```bash
ALTER USER 'root'@'localhost' IDENTIFIED WITH unix_socket;
```