Thursday, January 22, 2026

Run GUI as root on Linux with PowerBank

 

1) First, confirm you’re actually on an X11-forwarded display

Run as your normal user (not root):

echo "$DISPLAY" xauth info

If DISPLAY looks like localhost:10.0, you’re using SSH X11 forwarding. In that case, xhost is often unnecessary (and sometimes useless) because the “X server” is actually on your Mac and access is controlled by xauth cookies.

2) Use xauth (works even when xhost syntax fails)

Goal: let root use your forwarded X session by giving root the same Xauthority cookie.

As your normal user:

echo "$DISPLAY" xauth list "$DISPLAY"

If that prints a line, export the cookie into a temp file:

xauth extract /tmp/root.xauth "$DISPLAY" chmod 644 /tmp/root.xauth

Then become root via pbrun:

pbrun su -

As root:

export DISPLAY=<paste the exact value from user, e.g. localhost:10.0> export XAUTHORITY=/tmp/root.xauth xauth list

Test with something simple (if available):

xclock

Then start IBMIM:

/opt/IBM/InstallationManager/eclipse/IBMIM

Thursday, May 23, 2024

Recover the deleted files in Linux

 Reference: https://forums.unraid.net/topic/101686-xfs_undelete-seems-to-be-a-better-way-to-recover-files/


mkdir xfs_undelete

cd xfs_undelete/

wget https://github.com/ianka/xfs_undelete/archive/refs/tags/v12.0.zip -O temp.zip

dnf install tcl

dnf install tcllib


xfs_undelete -t 2024-05-14 -o /root/recover /dev/mapper/ol-root

Wednesday, May 22, 2024

Settings for Live SASS Compiler in Visual Studio

 Add below block into file>preference>settings>user Settings


Settings

"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css/apps"
}
],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.includeItems": [
"/scss/apps/**/*.scss"
],

Friday, May 10, 2024

Increase Space in CentOS 9 with lvm

yum install cloud-utils-growpart -y

 Grow the partition

# growpart /dev/sda 2

Extend lv

#  lvextend -l +100%FREE /dev/ol/root

Grow File System

# xfs_growfs /dev/ol/root

Wednesday, March 20, 2024

Jenkins: Disable all jobs in all folders

 https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/disableAllJobsInAllFolders.groovy

Friday, January 12, 2024

Reduce /home and Add SWAP space in Centos 9

dnf install xfsdump
dnf install xfsrestore

 umount /home

xfsdump -f home.bkup /dev/mapper/ol-home

lvchange -an /dev/ol/home

 lvremove /dev/ol/home

 lvcreate -L 30G -n home ol

mkfs.xfs /dev/ol/home

 mount -a

 df -h


 xfsrestore -f home.bkup /home

ls /home

   df -h

 lvcreate -L 4G -n swap ol

  mkswap /dev/ol/swap

  swapon /dev/ol/swap

  echo "/dev/ol/swap swap swap defaults 0 0" >> /etc/fstab

free


Monday, November 27, 2023

ACL in Linux

ACL in Linux

Set ACL

  setfacl -m user:clinton:rwx /testfolder

Verify ACL

 getfacl /testfolder

Remove ACL

setfacl -R -x u:cgao /testfolder

  getfacl /testfolder


Friday, November 24, 2023

Excel: Auto Fill a Column with a Specific Value

 Open Excel and click Automate in menu -> New Script, Customize below script and paste in the Code Editor:


```

function main(workbook: ExcelScript.Workbook) {
  // Get the active worksheet
  let ws = workbook.getActiveWorksheet();
  // Find the last row with data in column C
  let lastRowC = ws.getRange("C:C").getLastCell().getRowIndex();
  // Loop through all the rows
  for (let i = 1; i <= lastRowC; i++) {
    // Get the cells in column C and BP
    let cellC = ws.getCell(i, 2); // 2 is the correct column index for C
    let cellBP = ws.getCell(i, 67); // 67 is the correct column index for BP
    // Replace the value in column BP with the value in column C
    // cellBP.setValue(cellC.getValue())
    try {
      // Set the value in column BP to "Y202309"
      cellBP.setValue("2023-09");
    } catch (error) {
      console.error(`Error setting value in BP for row ${i}${error}`);
    };
  }
}
```

And click Run, then monitor if the column is updated.


Wednesday, June 14, 2023

Error creating: admission webhook "namespace.sidecar-injector.istio.io" denied the request: failed to run injection template: template: inject:212:12: executing "inject" at <.EstimatedConcurrency>: can't evaluate field EstimatedConcurrency in type *inject.SidecarTemplateData

 Problem:

Error creating: admission webhook "namespace.sidecar-injector.istio.io" denied the request: failed to run injection template: template: inject:212:12: executing "inject" at <.EstimatedConcurrency>: can't evaluate field EstimatedConcurrency in type *inject.SidecarTemplateData

Solution:

In vaulues.yaml, make below change:

pilot:

  # Can be a full hub/image:taggcr.io/istio-release
  image: gcr.io/istio-release/pilot:1.16.5

Thursday, May 18, 2023

Logrotate

 

```

# cat /etc/logrotate.d/vault

/opt/vault/audit/audit.log {

    daily

    rotate 365

    compress

    missingok

    notifempty

    dateext

    dateformat %Y-%m-%d.

    create 0600 vault vault

    postrotate

        /bin/kill -HUP `cat /run/vault/vault.pid 2>/dev/null` 2> /dev/null || true

    endscript

}

```

Tuesday, May 2, 2023

Reference: 

https://stackoverflow.com/questions/11623862/fetch-in-git-doesnt-get-all-branches

Problem:

$ git checkout origin/INF-2308

error: pathspec 'origin/INF-2308' did not match any file(s) known to git

Solution: 

The problem can be seen when checking the remote.origin.fetch setting

(The lines starting with $ are bash prompts with the commands I typed. The other lines are the resulting output)

$ git config --get remote.origin.fetch
+refs/heads/master:refs/remotes/origin/master

As you can see, in my case, the remote was set to fetch the master branch specifically and only. I fixed it as per below, including the second command to check the results.

$ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
$ git config --get remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*
$ git checkout INF-2308

Thursday, January 26, 2023

 Problem:

We're sorry but jfrog webapp doesn't work properly without JavaScript enabled. Please enable it to continue.

Reference:

https://www.haproxy.com/blog/enabling-cors-in-haproxy/



Saturday, November 26, 2022

unknown service runtime.v1alpha2.ImageService

Problem:

# kubeadm config images pull

failed to pull image "registry.k8s.io/kube-apiserver:v1.25.4": output: E1126 17:51:40.858868   34828 remote_image.go:222] "PullImage from image service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.ImageService" image="registry.k8s.io/kube-apiserver:v1.25.4"

time="2022-11-26T17:51:40-05:00" level=fatal msg="pulling image: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.ImageService"

, error: exit status 1

To see the stack trace of this error execute with --v=5 or higher

Reason:

containerd cgroup driver is not equal with kubelet cgroup driver.

/etc/containerd/config.toml

### disabled_plugins = ["cri"]

Thursday, November 17, 2022

Git: Checkout Specific Folder in a Repository

Reference: https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository

Sparse Checkout is enabled in git 1.7.0

Check out the git version:

# git version

git version 1.8.3.1

Create a folder for the repository:
# mkdir myrepo

Initiate the folder for git

# git init

Disable ssl verify if you are using self-signed certificate:

#  git config http.sslVerify "false"

Fetch all objects from Remote

#  git remote add -f origin https://bitbucket.com/scm/iu/myrepo.git

Enable sparse checkout

#  git config core.sparseCheckout true

Append the subfolder to sparse-checkout

#  echo "tcsfs/helpdesk" >> .git/info/sparse-checkout

Pull your code: 

#  git pull origin master


Monday, October 31, 2022

Docker Client and Containerd Behind Proxy in CentOS 8

# docker pull kubeimage/kube-apiserver:v1.15.0

Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 17.15.75.8:53: no such host

 

vi /usr/lib/systemd/system/docker.service with below entries

[Service]
Environment=HTTP_PROXY=http://8.8.8.8:8888
Environment=HTTPS_PROXY=http://8.8.8.8:8888
systemctl daemon-reload
systemctl restart docker

# kubeadm config images pull --v=10

I1031 22:12:20.527118   22397 version.go:187] fetching Kubernetes version from URL: https://dl.k8s.io/release/stable-1.txt
exit status 1
output: E1031 22:12:20.843791   22419 remote_image.go:242] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to resolve reference \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to do request: Head \"https://registry.k8s.io/v2/kube-apiserver/manifests/v1.25.3\": dial tcp: lookup registry.k8s.io on 137.15.210.9:53: no such host" image="registry.k8s.io/kube-apiserver:v1.25.3"
time="2022-10-31T22:12:20-04:00" level=fatal msg="pulling image: rpc error: code = Unknown desc = failed to pull and unpack image \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to resolve reference \"registry.k8s.io/kube-apiserver:v1.25.3\": failed to do request: Head \"https://registry.k8s.io/v2/kube-apiserver/manifests/v1.25.3\": dial tcp: lookup registry.k8s.io on 137.15.210.9:53: no such host"
, error

Add below entries into /usr/lib/systemd/system/containerd.service under section [Service]
[Service]
Environment=HTTP_PROXY=http://8.8.8.8:8888
Environment=HTTPS_PROXY=http://8.8.8.8:8888
systemctl daemon-reload
systemctl restart containerd

Sunday, October 16, 2022

Install Minikube with Docker Engine

Install docker engine

```

yum install -y yum-utils
yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
yum remove docker
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin


Install minikube

https://minikube.sigs.k8s.io/docs/start/

```

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Install kubectl

https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/

Set environment variables if the minikube runs behind proxy

export HTTP_PROXY=http://<proxy hostname:port>
export HTTPS_PROXY=https://<proxy hostname:port>
export NO_PROXY=localhost,127.0.0.1,192.168.49.0/24

or run below command on fly
```
export no_proxy=$no_proxy,$(minikube ip)

Open firewall rule for port 8443

 ```
firewall-cmd --permanent --add-port=8443/tcp

Start minikube

```
minikube start --driver=docker 


List porfiles
```
minikube profiles list

Delete existing profile
```
minikube delete

Delete existing profile with force
```
minikube delete --purge --all

Get cluster information
```
kubectl cluster-info

Saturday, October 15, 2022

mysql-community-server-5.7 Requires: libsasl2.so.2()(64bit)

 

# yum install mysql-community-server

Loaded plugins: langpacks, ulninfo

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:5.7.40-1.el6 will be installed

--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.40-1.el6.x86_64

--> Processing Dependency: libsasl2.so.2()(64bit) for package: mysql-community-server-5.7.40-1.el6.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:5.7.40-1.el6 will be installed

---> Package mysql-community-server.x86_64 0:5.7.40-1.el6 will be installed

--> Processing Dependency: libsasl2.so.2()(64bit) for package: mysql-community-server-5.7.40-1.el6.x86_64

--> Finished Dependency Resolution

Error: Package: mysql-community-server-5.7.40-1.el6.x86_64 (mysql57-community)

           Requires: libsasl2.so.2()(64bit)

 You could try using --skip-broken to work around the problem

 You could try running: rpm -Va --nofiles --nodigest

Cause:
Baseurl in repo config file is mapped to old release.

Solution:
# cat /etc/yum.repos.d/mysql.repo
[mysql57-community]
name=MySQL 5.7 Community Server
## baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

https://blog.fearcat.in/a?ID=00001-3311f896-7ed9-4220-8f2f-0e7ba81f2add

Monday, October 10, 2022

Kubernetes: Setup K8s on your Local

 https://matt-rickard.com/docker-desktop-alternatives

https://cri-o.io/

Releases: https://github.com/cri-o/cri-o/releases

Install cri-o

  dnf module list cri-o
  VERSION=1.18
  dnf module enable cri-o:$VERSION
  dnf install cri-o
export OS=CentOS_8
export VERSION=1.25

curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/devel:kubic:libcontainers:stable.repo
curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo
yum install cri-o

https://minikube.sigs.k8s.io/docs/start/


Install kubectl

https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/


Friday, October 7, 2022

Linux partition operations

Reference: https://ismailyenigul.medium.com/resize-xfs-partition-without-lvm-df3ea681c6d3


# lsblk

# dnf install cloud-utils-growpart -y

# growpart /dev/sda 3
CHANGED: partition=3 start=6293504 old: size=35649536 end=41943040 new: size=203421663 end=209715167
# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           1.8G     0  1.8G   0% /dev/shm
tmpfs           1.8G  8.5M  1.8G   1% /run
tmpfs           1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/sda3        17G  2.4G   15G  14% /
/dev/sda1      1014M  349M  666M  35% /boot
tmpfs           364M     0  364M   0% /run/user/0
# xfs_growfs /
meta-data=/dev/sda3              isize=512    agcount=4, agsize=1114048 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=4456192, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 4456192 to 25427707
# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           1.8G     0  1.8G   0% /dev/shm
tmpfs           1.8G  8.5M  1.8G   1% /run
tmpfs           1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/sda3        97G  3.0G   95G   4% /
/dev/sda1      1014M  349M  666M  35% /boot
tmpfs           364M     0  364M   0% /run/user/0

Wednesday, September 7, 2022

Git client notes

 Save credential:

git config --global credential.helper store

refs/heads/master is set as the default branch, but this branch does not exist