Saturday, October 18, 2025

Nvidia new hotplug feature on Linux


 If you use nvidia driver for your GPU, you probably wonder why in some config, you can't hotplug your second monitor. You need to reboot to be able to use it. I found out recently with the help of chatgpt that I have been using old feature of nvidia driver all this time. The key settings are in /etc/environment.

 My previous settings:

  __NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
LIBVA_DRIVER_NAME=nvidia
GTK_USE_PORTAL=1

KWIN_DRM_USE_EGL_STREAMS=1

If you can see above, I am using KWIN_DRM_USE_EGL_STREAMS=1 which means KDE is using NVIDIA’s old EGLStreams backend, which is notoriously bad at detecting new monitors in Wayland sessions. I should remove it and replace it with    GBM_BACKEND=nvidia-drm which is the modern buffer management backend for NVIDIA + Wayland that supports hotplugging of monitors.

 So i replaced it with this settings:

  
__NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
LIBVA_DRIVER_NAME=nvidia
GTK_USE_PORTAL=1  
GBM_BACKEND=nvidia-drm

 I need to reboot once and testing it by unplugging and plugging it back. It works!

 That's all there is to it. Have fun! 

Wednesday, December 18, 2024

Renew letsencrypt ssl certificate for zimbra 8.8.15


 Letsencrypt certs usually consists of these files:

1. cert.pem

2. chain.pem

3. fullchain.pem

4. privkey.pem


I am not going to discuss about how you get those files from letsencrypt. This is for how to renew ssl cert for zimbra specifically version 8.8.15 GA 4717 that i am using. It may or may not work for previous or later version. YMMV

Put the folder containing the certs in /opt/zimbra. Let's say directory named letsencrypt. Make sure it owns by zimbra. 

Step 1:

Download letsencrypt root cert here to the same folder as those letsencrypt certs above. The file name is isrgrootx1.pem.

Step 2:

run this: cat isrgrootx1.pem >> chain.pem

Step 3:

Verify the certs using zmcrtmgr. Run the command as user zimbra. The output as following:

zmcertmgr verifycrt comm privkey.pem cert.pem chain.pem  
** Verifying 'cert.pem' against 'privkey.pem'
Certificate 'cert.pem' and private key 'privkey.pem' match.
** Verifying 'cert.pem' against 'chain.pem'
Valid certificate chain: cert.pem: OK

Step 4: 

If step 3 above is ok. Deploy the certs (asa user zimbra)

zmcertmgr deploycrt comm  cert.pem chain.pem


Step 5: 

If step above is successful. Restart the services (as user zimbra):

zmcontrol restart


If there's no error. Your zimbra's ssl is renewed successfully.


Friday, December 6, 2024

Merge pdf files using command line in Linux

 To merge 2 pdf files for example using command line best using pdfunite.

pdfunite file1.pdf file2.pdf output.pdf

where output.pdf is the resulted merged pdf files


The quality is good. I used convert before but the quality of the resulted pdf was not good.

source: https://www.omglinux.com/merge-pdf-files-on-linux/


Tuesday, October 3, 2023

Second monitor no display after latest update - KDE-neon

 After latest update as of Oct 3, 2023, my second monitor was undetected with latest kernel (6.2.0-33-generic). If I boot with previous kernel, it can be detected. After searching a little bit, one suggestion is to delete kscreenrc directory in .local/share and then reboot.

Voila!... it was detected and the second monitor was running well

TQ for the tip. 

Source: https://forum.endeavouros.com/t/2nd-monitor-disabled-in-kde-plasma/34239


Thursday, September 14, 2023

KDE: bluetooth headset battery percentage

 If you like mine, I can't view my headset's battery percentage in my KDE's bluetooth notification.

To be able to see it, I need to add a line as below to /etc/bluetooth/main.conf under [General] section:

Experimental = true

Then you need to restart bluetooth service thusly:

systemctl restart bluetooth


You can see the percentage as screenshot below:




If you still can't see the percentage, it may mean your device or driver does not support it. 

That's all there is to it


Thursday, September 7, 2023

Installing kde-neon user edition using btrfs for root filesystem

 If you want to install KDE-Neon using btrfs as / filesystem, there is a bug that preventing it to boot successfully to console or to X or Wayland. For simplicity and laziness :)), i won't show here the errors but straight to solution or workaround.

1. Boot to live CD installer

2. Go to Konsole and edit file: sudo vi /calamares/desktop/modules/fstab.conf 

3. find word space_cache and change it to space_cache=v2

4. Start Installer and choose btrfs as filesystem for / 

It should successfully install KDE-Neon and boot to the new system successfully.


That's all there is to it. Have fun

Wednesday, June 14, 2023

How to resize a partition in proxmox 5 or 6

Background

1. The partition is ordinary partition and not LVM

2. The filesystem is ext4

3. The steps tested on proxmox 5 and 6 and maybe applicable to other versions of Proxmox


Step by step

1. Select and resize the disk you want in proxmox gui


2. Login to the VM and type dmesg command to see the relevant device that has changed i.e /dev/vde

3. unmount the partition i.e /dev/vde1 : umount /dev/vde1

4. use parted to extend the disk's size:
    4.1 parted /dev/vde
    4.2 resizepart 1
    4.3 q

5. unmount the partition if it is automatically mounted. If it is not, then proceed to the next step: 
     umount /dev/vde1

6. run filesystem check: e2fsck -f /dev/vde1

7. filesystem resize: resize2fs /dev/vde1

8. mount the partition i.e mount to /data: mount /dev/vde1 /data

9. Check and verify

That's all there is to it. Have fun!







Sunday, April 2, 2023

Install a Sectigo Domain Validation SSL certificate in Zimbra

We usually get the below four files from Sectigo in the certificate bundle. The file name may vary depending on the certificate type 

  1. yourdomain.com.crt – main certificate 
  2. AAACertificateServices.crt – Root Certificate 
  3. USERTrustRSAAAACA.crt – Intermediate Certificate – 1
  4. SectigoRSADomainValidationSecureServerCA.crt – Intermediate Certificate – 2 

 Step 1: We shall create two files as below

  • commercial_ca.crt (includes root certificate and two intermediate certificates)
  • commercial.crt (includes main certificate, root certificate and two intermediate certificates)
Step 2: Login to Zimbra server, move to directory /opt/zimbra/ssl/zimbra/commercial and create two files as below.

root@mail:~# cd /opt/zimbra/ssl/zimbra/commercial/
root@mail:/opt/zimbra/ssl/zimbra/commercial# touch commercial_ca.crt
root@mail:/opt/zimbra/ssl/zimbra/commercial# touch commercial.crt

Step 3: Provide ownership to Zimbra.

root@mail:/opt/zimbra/ssl/zimbra/commercial# chown zimbra:zimbra commercial_ca.crt
root@mail:/opt/zimbra/ssl/zimbra/commercial# chown zimbra:zimbra commercial.crt

Step 4: Add the certificates into respective files as mentioned above.

root@mail:/opt/zimbra/ssl/zimbra/commercial# vim commercial_ca.crt

-----BEGIN CERTIFICATE-----
<root certificate is here>
-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----
<intermediate certificate 1 is here>
-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----
<intermediate certificate 2 is here>
-----END CERTIFICATE---

root@mail:/opt/zimbra/ssl/zimbra/commercial# vim commercial.crt

-----BEGIN CERTIFICATE-----
<main certificate is here>
-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----
<root certificate is here>
-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----
<intermediate certificate 1 is here>
-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----
<intermediate certificate 2 is here>
-----END CERTIFICATE-----

Step 5: Execute below command as Zimbra user to verify the certificate.


zimbra@mail:~/ssl/zimbra/commercial$ /opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key /opt/zimbra/ssl/zimbra/commercial/commercial.crt /opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt

Step 6: Install the certificate.

zimbra@mail:~/ssl/zimbra/commercial$ /opt/zimbra/bin/zmcertmgr deploycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.crt /opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt


Step 7: Restart Zimbra service to take effect the changes.

zimbra@mail:~$ zmcontrol restart

Source: https://tweenpath.net/install-sectigo-domain-validation-ssl-certificate-zimbra/

Wednesday, December 21, 2022

What package does cal utility comes from in Ubuntu Jammy?

 The package name is bsdmainutils, so:

    apt install bsdmainutils


That's all there is to it. 

Tuesday, July 19, 2022

Workaround: insync icon doesn't show up in KDE's tray in Wayland session

 This is a workaround for insync icon doesn't show up in KDE's tray in Wayland session

1. Go to System Settings


2. Click on Startup and Shutdown menu on the left


3. Clik on + Add... button to add insync and then select + Add Application...

4. Select insync in the dialog and click OK


5. insync should be listed in the Autostart 



6. Click on the insync's Properties button


7. Go o Application tab and add QT_QPA_PLATFORM=xcb in the Command section as below and then click OK button to save the settings:


8. Reboot your computer. The insync's tray icon should show up in the tray.



That's all there is to it.


Tuesday, October 12, 2021

KDE: How to make firefox to open kde's file manager (Dolphin) when saving or open file in KDE

 Make sure your Mozilla Firefox is version > 78. Mine is version 93 as of 12 Oct 2021.

1. Open firefox and type in the address bar : about:config

2. Ignore the warning by clicking "Accept the risk and Continue" button

3. type in the search bar: widget.use-xdg-desktop-portal and change the value to true

4. Restart the browser

 Have fun!


Thursday, July 29, 2021

How to enable hardware acceleration on firefox

 Below are the steps to check and enable harware acceleration on Firefox browser:

1. launch firefox and type in address bar: about:config

2. Accept the risk if prompted.

3. Type layers.acceleration.force-enabled in the search bar

4. Turn it to true

5. Close all browser's windows and restart firefox to make it effective

Cheers.

How to run firefox in Wayland?

Firefox is not running in wayland mode by default. The command below is to run firefox browser in wayland:

MOZ_ENABLE_WAYLAND=1 firefox &
  
You can also put this in your desktop's shortcut for firefox in wayland environment.
To verify whether Wayland support is enabled, go to about:support,and check “WebGL 1 Driver 
WSI Info” and/or “WebGL 2 Driver WSI Info”. If they say something about GLX, Wayland support 
is not enabled. If they say something about EGL, it is. 
 
That's all there is to it. Cheers 

Tuesday, July 6, 2021

Wireguard on Linux : A basic approach using Ubuntu 20.04 LTS server and client

 We begin with a fresh installation of Ubuntu server 20.04 LTS

Server

  1. Install wireguard
    • sudo apt install wireguard
  2. Generate server and client keys
    • umask 077
    • wg genkey | tee server_private_key | wg pubkey > server_public_key
    • wg genkey | tee client_private_key | wg pubkey > client_public_key
  3. Create server config
    • Create a file wg0.conf in /etc/wireguard/
    • [Interface] Address = 10.199.0.1/24 SaveConfig = true PrivateKey = <insert server_private_key> ListenPort = 51820 [Peer] PublicKey = <insert client_public_key> AllowedIPs = 10.199.0.2/24 <-- it means 254 IPs allowed to connect
    • Note: If you only want 1 IP to connect,change /24 to /3You can change filename from wg0.conf to vpn.conf or whatever name you want
  4. Running the wireguard's service
    • sudo systemctl enable wg-quick@wg0 <-- need to run for the first time only
    • sudo systemctl start wg-quick@wg0
  5. Enable IP forwarding (Applicable for internet-enabled vpn connection. See client's note below)
    • echo 1 > /proc/sys/net/ipv4/ip_forward
    • sudo sysctl -p <-- to make the above change effective without reboot
Client
  1. Install wireguard package
    • sudo apt install wireguard
  2. Create a file in /etc/wireguard called wg0.conf
    • [Interface] Address = 10.199.0.2/24 PrivateKey = <insert client_private_key> DNS = 1.1.1.1 [Peer] PublicKey = <insert server_public_key> Endpoint = <insert vpn_server_address>:51820 AllowedIPs = 10.199.0.0/24 PersistentKeepalive = 60
    • Note: Address parameter is the IP address for the client
      • you can also change the name of the file wg0.conf to something else
      • EndPoint is the wireguard server's IP address above.You can use IP or domain name
      • DNS is the IP of DNS server for the client.
      • *IF* the AllowedIPs is 0.0.0.0/0, it means all the traffic from the client
        • will go through vpn server and if you want the client to be able to go to
        • the internet, you must add this rule in the server:
        • iptables -t nat -A POSTROUTING -s 10.199.0.0/24 -o eth0 -j MASQUERADE or
        • You can put the iptables command above in server's wireguard config as below under [Interface]:
        • PostUp = iptables -t nat -A POSTROUTING -s 10.199.0.0/24 -o eth0 -j MASQUERADE 
  3. Connect the client
    • sudo systemctl enable wg-quick@wg0 <-- run only this time
    • sudo systemctl start wg-quick@wg0
    • Test the connection: ping 10.199.0.1
That'sall there is to it. Hope it is working for you.

Cheers!

PS: Check this out! Easy setup for wireguard : https://github.com/burghardt/easy-wg-quick
            

Wednesday, June 10, 2020

DNS error: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP

I saw a lot of errors like below in my /var/log/syslog:

Jun 10 11:06:39 zabbix systemd-resolved[30232]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jun 10 11:06:48 zabbix systemd-resolved[30232]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jun 10 11:06:51 zabbix systemd-resolved[30232]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jun 10 11:06:51 zabbix systemd-resolved[30232]: message repeated 4 times: [ Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.]
Jun 10 11:07:02 zabbix systemd-resolved[30232]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.

I checked my /etc/resolv.conf and it symlinked to a file which was not exist.

ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Apr 27  2018 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

So I removed it and symlinked it to /run/systemd/resolve/resolv.conf which is systemd's resolv.conf file because I am using systemd's resolver.

So,

ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Then restart the relevant service: systemctl restart systemd-resolved

I checked again and the errors was gone.

That's all there is to it.

Thursday, June 4, 2020

How to upgrade Ubuntu 19.04 to 19.10

Steps to upgrade from 19.04 to 19.10

1. sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list
2. sudo sed -i -e 's|cosmic|eoan|g' /etc/apt/sources.list
3. sudo apt update
4. sudo apt upgrade


Happy upgrading!

How to upgrade ubuntu 18.10 to 19.04

Since 18.10 no longer supported you can upgrade manually to 19.04
Steps to upgrade:

1. mkdir /tmp/upgrade
2. cd /tmp/upgrade
3. wget http://old-releases.ubuntu.com/ubuntu/dists/disco-updates/
   main/dist-upgrader-all/current/disco.tar.gz
4. tar -xvf disco.tar.gz
5. sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
6. /etc/apt/sources.list change all links prefix to ->
    http://old-releases.ubuntu.com/
7. sudo python3 dist-upgrade.py or run do-release-upgrade

If you run do-release-upgrade, answer yes to all the questions asked.

Happy upgrading!

Tuesday, March 3, 2020

zfs and megacli

Recently I had a task to replace a disk in my server that was throwing many smart errors to my email. It was actually an indicator that the disk is failing. Maybe not as critical as it seemed because it is a mirrored disk.  But i didn't like it when it happened.

The error I got in my email as below:


This message was generated by the smartd daemon running on:

   host name:  hq-hv-06
   DNS domain: mydomain.com.my

The following warning/error was logged by the smartd daemon:

Device: /dev/bus/1 [megaraid_disk_03] [SAT], 1 Offline uncorrectable sectors

Device info:
WDC WD2002FAEX-007BA0, S/N:WD-WCAY00005116, WWN:5-0014ee-206439d3b, FW:05.01D05, 2.00 TB

For details see host's SYSLOG.

You can also use the smartctl utility for further investigation.
The original message about this issue was sent at Sun Jan 13 02:43:43 2019 +08
Another message will be sent in 24 hours if the problem persists.

To replace the disk, since I use mega RAID card, I have to use megacli utility for removal of the old disk and to replace with the new disk

These commands should be run before disk removal:

  1.  Offline the disk: megacli -PDOffline -Physdrv[252:3] -a0
  2. Mark the disk as missing: megacli -PDMarkMissing -Physdrv[252:3] -a0
  3. Prepare for removal: megacli -PDPrpRmv -Physdrv[252:3] -a0
Then, you can remove the disk from the slot and insert the new disk. When you remove the disk, the zpool status shows DEGRADED state


Let the server detects the disk and check the info of the disk by running :

megacli -PDInfo -PhysDrv[252:3] -a0

The you run this command to create virtual disk:

megacli -cfgLDAdd -r0 [252:3] -a0



and you can also use megaclisas-status command :

megaclisas-status

The output is as below: 

But, If you get this error:

The current operation is not allowed because the controller has data in cache for offline or missing virtual drives

Run this command the find what disk cause the cache:


megacli -GetPreservedCacheList -a0

The output is:

Adapter #0
Virtual Drive(Target ID 03): Missing.
Exit Code: 0x00
then run this command to discard the cache:

megacli -DiscardPreservedCache -L"03" -a0

The output:

Adapter #0
Virtual Drive(Target ID 03): Preserved Cache Data Cleared.
Exit Code: 0x00
Then you can run the command above to create a virtual disk.
Then run megaclisas-status again to check whether the virtual disk is created
If it is successfully created, for zfs, run command to replace the disk:
zpool replace rpool /dev/sdd 
(if the disk is sdd) and if it is successful, it will start the resilvering process
 

Check the status: zpool status rpool


When the resilvering process finish, check zfs zpool status



That's all there is to it

Tuesday, March 12, 2019

time synchronization on Ubuntu 16.04

Hi there,

If you use Ubuntu 16.04 or Ubuntu-Debian derivatives and above, systemd provides an easier way to do time synchronization to time server.

First you have to install ntdate package:

sudo apt install ntpdate

Secondly, you have to edit /etc/systemd/timesyncd.conf and add your prefered time server to sync to:

[Time]
NTP=0.asia.pool.ntp.org
FallbackNTP=ntp.ubuntu.com

Save the file and restart the time synchronization service:

sudo systemctl restart systemd-timesyncd 

To check the status:

sudo systemctl status systemd-timesyncd




Saturday, October 13, 2018

Redirect http connection to https for zimbra 8.8.9

Run this command as zimbra:

zmprov ms webmail.myserver.yourdomain.com zimbraReverseProxyMailMode redirect

Substitute the hostname with yours.

That's all there is to it.

Have fun.


Nvidia new hotplug feature on Linux

 If you use nvidia driver for your GPU, you probably wonder why in some config, you can't hotplug your second monitor. You need to reboo...