Linux 8 | Enable desktop icons

I had a colleague, he challenged me 20 years back that “One day Linux will take over”. I don’t see anyone I know using Linux until date. That’s the end of the story.

So, let us see how a default installation of Linux 8 (Oracle Linux 8) looks immediately after installation

That’s it. User must click on the lone “Activities” menu & choose one of the listed. We’ve had a joke doing rounds about driver’s license application from a particular Indian state. That form had 5 names listed and the applicant was asked to select HIS name from the given.

I don’t have to look for another reason to understand why my ex-colleague was wrong whole the way. Instead of adapting to the users experience base that is mostly around Microsoft Windows, Linux is getting further away from normal desktop users. Minimum the Enterprise editions are. I know Ubuntu is far different from the Enterprise distros & this article is not meant for Ubuntu users.

So, let us see how to get few of the desktop icons (Classic as it is called now)

Click on “Activities” that will provide you a search box. Type in “Gnome” and you will see a number of suggested software listing. Select “GNOME Tweaks” & Install it.

Click on Extensions & switch Desktop icons “ON”. The moment you do that, Desktop icons will be visible.

Shame on you for using the old “Classic mode” geeks. Shame on you!

Oracle Linux | “Peer’s certificate issuer has been marked as not trusted by the user.”

Recently I was trying to update one of the Oracle Linux 7 boxes that is used for lab & came across multiple errors.

OCI : Yum Fails with [Errno 14] curl#6 - "Could not resolve host: yum-iad.$ocidomain; Unknown error"
[Errno 14] curl#60 - "Peer's certificate issuer has been marked as not trusted by the user."

I kept on doing almost everything yum was suggesting, disable the repos, cleaning etc. Yes, I did ping both google.com & yahoo.com to “insure” that I was connected to “internet” (I’m still struggling to figure out how the heck I managed to ping these hosts when I was actually unable to connect to Oracle mirrors)

However, after exhausting more than couple of hours, I decided to access the server through VNC & see whether I am missing something, that cannot be done from the command line.

Fired up Firefox & realized, I am not connected to “Internet” in real terms. I couldn’t open any pages and I proceeded with adding the static IP address to exclusion list and that was it.

So, if you ever come across the above mentioned errors, make sure you ARE connected!

Linux HugePages for Oracle

Few weeks back one DBA told me there is no need to setup HugePages as we are not using 40+GB SGA & we had it enabled from the initial days of 11g migration from 10g (10.2.0.3). Well, here is how you can setup HugePages for your Oracle database instance.

A brief explanation that might help you to decide whether you should enable HugePages or not is quoted from Tim Hall’s article below.

“For large SGA sizes, HugePages can give substantial benefits in virtual memory management. Without HugePages, the memory of the SGA is divided into 4K pages, which have to be managed by the Linux kernel. Using HugePages, the page size is increased to 2MB (configurable to 1G if supported by the hardware), thereby reducing the total number of pages to be managed by the kernel and therefore reducing the amount of memory required to hold the page table in memory. In addition to these changes, the memory associated with HugePages can not be swapped out, which forces the SGA to stay memory resident. The savings in memory and the effort of page management make HugePages pretty much mandatory for Oracle 11g systems running on x86-64 architectures.

Recently I had a short Twitter exchange with Tim Hall about the subject & He mentioned that he always enables it.

Please refer the article from below link, it is by Tim Hall, a geek in this field and the owner of https://oracle-base.com

https://oracle-base.com/articles/linux/configuring-huge-pages-for-oracle-on-linux-64

Exercises explained in this article is applicable to 19c also (verified as working). Please make sure that your version of Oracle database supports these settings before attempting. Please do not copy this to PRODUCTION environments without enough testing.

Linux | Folder permissions for group

Let us see how we can create and give a group write permission for a folder on Linux environment. This becomes helpful when you want to keep downloaded files accessible to multiple users. Very helpful if you are dealing with Oracle EBS like applications that has different users for both database and application.

[root@erp-test /]# mkdir -p orapatches


--Change group ownership for the newly created folder.
[root@erp-test /]# chgrp -R oinstall /orapatches


--Finally change the mode so that all the members in this group could write to this folder.

[root@erp-test /]# chmod g+w /orapatches

Hope this helps few newbies out there!

Oracle VirtualBox Guest Addons | kernel headers not found for target kernel

So how many Oracle VirtualBox VM (Virtual Machine)s you do have?

I’ve many. I try many new software & not to break production box, I try them using Virtual Machines. I use Oracle VirtualBox (mostly) for both Windows and Linux machines (and VMWare ESXi for Production servers), as you could see with the above image. VirtualBox and VMWare supply additional software called “Guest Additions” that synchronize the Guest Virtual Machines with Host machine seamlessly. Like Mouse integration that allows your mouse to travel between both host and guest machines without any difficulties.

On Linux OS, installing the Guest Additions could be sometimes challenging. Especially with Oracle Linux that uses UEK kernels. Let us see how to “fix” the common error messages that appears when installing the Guest Additions on Oracle Linux 7 and 8.

The best approach is to update your Linux OS with latest patches before trying the below. I consider you already updated your Linux box, if yes then

yum install kernel-uek-devel

is enough to install the devel package, suffice the kernel headers missing error. Install the package, reboot the box and try to install VirtualBox Guest Additions. This time module should get installed properly. You may need make, gcc & perl already installed for a successful installation of Guest Additions. You will find instructions to install them later in the article.

Now we have another situation when guest add-ons are required, however updating the new Linux box is not possible due to many reasons. Here we will use the Linux OS ISO image. Please note, the ISO file that you are going to use must be the same ISO that you used to install OS and OS was not updated at all. That means your Linux box is as it is after the OS installation.

Attach the ISO file to your Linux box & Switch to

Packages folder for Oracle Linux 7 and “BaseOS\Packages” for Linux 8

Now locate the kernel-uek-devel-xxxxxxxxxxxxxxxxxxxx package and install it. For example, I will execute the following for Linux 8

rpm -ivh kernel-uek-devel-5.4.17-2136.300.7.el8uek.x86_64.rpm

That’s it. Restart the box and try to install the guest add-ons once again and you must be through without other issues. You might need to install gcc, make & perl also to get the guest add-ons installed.

If you are connected to internet, you can install the above packages by issuing the command

yum install gcc make perl -y

Or go through the packages available in the Packages repo, install them.

All the best!

Slow SSH connections from Windows to Linux hosts

Windows built-in firewall does not block SSH connections those are going out & there is no need to create an exception for SSH connections from Windows to LINUX hosts. Still many things could mess up connections.

One of the major culprits being the DNS settings. We had a migration for Primary domain controller from 2008 R2 to Windows Server 2016. Prior the upgrade we brought a temporary VM using VirtualBox to insure that the migration could happen seamlessly. The migration to temporary server happened without issues and we rushed to change the DNS settings for all production servers with the new VM IP address, after removing the IP address for the old PDC from the list.

After the confirmations, we built a fresh VM on VMWare ESXi environment and promoted it as PDC & we ahead with decommissioning the VM built on VirtualBox and forgot that “one thing”. Changing DNS server details for our LINUX servers.

Initially we didn’t give much attention to the SSH connection slowness as these LINUX server(s) running Oracle Applications were known to be slow in responding. However, things didn’t look quite promising as we noticed delays like 40s+ to establish connection to the host while trying to upload files using FileZilla client. It took us almost 8 days to realize that the connection issues were not from the client end, rather from the servers.

Checking the network configurations revealed these servers were still configured with the IP address of the temporary DC at the first entry, that we had for a while. Resetting the DNS entries to existing DNS servers IP addresses resolved the problems instantly.

Side note: No, you cannot overcome this issue by using IP addresses to establish the SSH connection. Regardless, the Linux HOST will try to resolve the client’s IP using the given DNS entries. So the only solution was to correct the DNS entries!

If you ever run into a slow SSH, well, hope know where to look at first after reading this post.

Linux | File Cleaner | bash script

Recently we setup a Linux server for keeping backups & decided not to use certain switches while the backups were synched from Windows machines. This created an additional situation like maintaining the storage space based on different business requirements and using our own solutions. So the following script was developed. Please note, this script has been tested on CentOS/RHEL/OEL 7 environment & executed with root privileges.

#!/bin/bash

# Cleanup tool for Linux Samba Server
# Rajesh Thampi
# Date: Sep 2021
# Instructions
# Copy the script to a file with .sh extension
# Make it executable (eg: chmod +x filecleaner.sh)
# Execute! (eg:./filecleaner.sh 1>filecleaner.log 2>filecleaner.err
# And be careful :)


function purgeit(){
# local DIRNAME="$1"
# local FILETYPE="$2"

cd "$1"
echo "Entered Directory: ${PWD}"
#Logic
#Check whether $3 number of files matching the patterns provided by $2 are present those were created within $4 days, then delete all files older than $4 days
 
if [ $(find -maxdepth 1 -name "$2" -type f -mtime -"$4" | wc -l) -ge $3 ]; then
local OBSFILECNT=$(find -maxdepth 1 -name "$2" -type f -mtime +"$4" | wc -l)
echo "There are ${OBSFILECNT} files & will be purged"
local obsfiles=$(find -maxdepth 1 -name "$2" -type f -mtime +"$4")

#The below loop is ONLY for logging purpose
#We'll delete all files matching the pattern in a single line command using "find"

        if [ $OBSFILECNT -gt 0 ]; then
        echo "Below Files will be deleted"
        for eachfile in "$obsfiles"
                do
                echo "$eachfile"
                done
                #find and delete will eliminate the need to treat files with space and other escape characters in the filenames.
                find -maxdepth 1 -name "$2" -type f -mtime +"$4" -exec rm -rf {} \;
        fi
fi
}

#Call the function passing four variables: path, type of the files to purge, number of files to keep & age of the files
#those need to be deleted

#syntax: purgeit "/backup/server_sql" ("*.txt" OR "my*.php" OR "*" OR "*.*") 4 5
#example: purgeit "/backup/server_sql" "*.zip" 4 5
#You can call this function N number of times passing different paths and other values

Now let us see the logic in details.

Consider you have a path “/backup/server_sql” where your Microsoft SQL Server is uploading a full backup daily. As we are synching the backup files using ROBOCOPY from the Windows server without mirroring, the daily full backup files will start mounting in the Linux files server. Then we came up with a business plan to:

  • Keep minimum 4 number of most recent full backups for the SQL server in the Linux path those were created within last N number of days. If there are no files for last N days found, existing files will not deleted (gives an opportunity to investigate why there are no files uploaded to Linux file server)
  • Delete files those are 5 days or older from the Linux path after insuring minimum N number of files are within the repository.
  • Combined with a function send alert emails, this small snippet could function as both a storage maintenance and monitoring tool.

Interested about including email alerts? Let us know and will share the additional code with you exclusively.

rsync | Excluding a subdirectory/folder

We’ve Oracle RMAN backups copied to a remote server everyday & those chunks are once again copied to a removable media to “avoid”, disasters.

After a revamp of backup path, I needed to adjust the rsync command within a shell script to exclude a folder from the source. Misunderstanding the instructions, the new modifications made the shell script to copy the backup chunks twice on the removable media!

Let us see what I did initially that caused the duplication

[root@orcl DAILYBKP]# cd /u03
[root@orcl u03]# mkdir -p folder1/erp/RMAN/DAILYBKP
[root@orcl u03]# mkdir -p folder1/sf1
[root@orcl u03]# mkdir -p folder1/sf2
[root@orcl u03]# mkdir -p folder1/sf3
[root@orcl u03]# mkdir -p folder2
[root@orcl u03]# touch folder1/erp/RMAN/DAILYBKP/r1.txt
[root@orcl u03]# touch folder1/erp/RMAN/DAILYBKP/r2.txt
[root@orcl u03]# touch folder1/sf2/r1.txt
[root@orcl u03]# touch folder1/sf3/r1.txt
[root@orcl u03]# rsync -avz --exclude '/u03/folder1/erp' /u03/folder1 /u03/folder2
sending incremental file list
folder1/
folder1/erp/
folder1/erp/RMAN/
folder1/erp/RMAN/DAILYBKP/
folder1/erp/RMAN/DAILYBKP/r1.txt
folder1/erp/RMAN/DAILYBKP/r2.txt
folder1/sf1/
folder1/sf2/
folder1/sf2/r1.txt
folder1/sf3/
folder1/sf3/r1.txt

The above example demonstrates the mistake that I made while “excluding” a folder from the source. The correct method to exclude a subdirectory or folder was as below

[root@orcl u03]# rsync -avz --exclude 'erp/' /u03/folder1 /u03/folder2
sending incremental file list
folder1/
folder1/sf1/
folder1/sf2/
folder1/sf2/r1.txt
folder1/sf3/
folder1/sf3/r1.txt

sent 263 bytes  received 74 bytes  674.00 bytes/sec
total size is 0  speedup is 0.00
[root@orcl u03]# cd folder2
[root@orcl folder2]# ls -ltrh
total 4.0K
drwxr-xr-x 5 root root 4.0K Aug 12 09:39 folder1
[root@orcl folder2]# cd folder1
[root@orcl folder1]# ls -ltrh
total 12K
drwxr-xr-x 2 root root 4.0K Aug 12 09:39 sf1
drwxr-xr-x 2 root root 4.0K Aug 12 09:40 sf2
drwxr-xr-x 2 root root 4.0K Aug 12 09:41 sf3
[root@orcl folder1]#

All I needed was to just mention the name of the subfolder that I needed to exclude, not the whole path. I’ve limited exposure to Linux and much of the OS activities are initiated on demand. This causes some interesting situations like the one above & definitely helps to learn something new!

Linux multipath partitions unavailable after cold restart

Yesterday I shutdown one of our legacy system Linux servers after a long interval. May be almost after 1.5 years. Once restarted, I started getting alert emails from cronjobs which were using those mount points. After a quick checking I found that few the UUIDs I have used with fstab were missing when I issued “blkid” command…

Please note, I am not at all a Linux/Storage expert. I consider “finding” this solution as a blind shot as my immediate technical support guys were too busy to answer the calls. You are asked not to copy these to a production instance! I took the risk because the data, the server itself is NOT significant for us and we had the freedom to rebuild it as and when we needed it.

Linux Server IBM x3560 running OEL 6 & the storage device is DS3200 that uses HBA interface to the physical server.

Doing a fdisk -l listed the following for me:

Disk /dev/mapper/mpathb: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 

             Device Boot      Start         End      Blocks   Id  System

Disk /dev/mapper/mpathc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 
			
			 Device Boot      Start         End      Blocks   Id  System

and I remembered that earlier I had listings like the below

Disk /dev/mapper/mpathb: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 

             Device Boot      Start         End      Blocks   Id  System
/dev/mapper/mpathbp1               1       78325   629145531   83  Linux

Disk /dev/mapper/mpathc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 

             Device Boot      Start         End      Blocks   Id  System
/dev/mapper/mpathcp1               1       26108   209712478+  83  Linux

In addition to, I have noticed that there were two devices /dev/sdd, /dev/sde with the same size of the multipath sizes, however without any paritions.

After rebooting twice, I decided to create new partitions under /dev/sdd & /dev/sde which succeeded. However, when I tried to format these newly created partitions, I started getting “/dev/sdd1 is apparently in use by the system; will not make a filesystem here” and “/dev/sde1 is apparently in use by the system; will not make a filesystem here”, that forced me to restart the server once again.

To my utter surprises, once the machine booted up, all my mount points were back online once again without doing anything else.

[root@xyz multipath]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdk2              59G   11G   46G  20% /
tmpfs                  10G  228K   10G   1% /dev/shm
/dev/sdk1             2.0G  330M  1.5G  18% /boot
/dev/sdk5             738G  632G   69G  91% /u01
/dev/mapper/mpathbp1  591G  332G  229G  60% /u02
/dev/mapper/mpathcp1  197G  134G   54G  72% /u03
/dev/sdg1             591G   70M  561G   1% /u04
/dev/sdj1             269G   59M  256G   1% /u05
/dev/sda1             917G  765G  107G  88% /usbdrive
/dev/sdb1             1.8T  642G  1.1T  37% /RDX
Disk /dev/sdd: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035652

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       78325   629145531   83  Linux

Disk /dev/sde: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002b47b

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1       26108   209712478+  83  Linux

Disk /dev/mapper/mpathb: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035652

             Device Boot      Start         End      Blocks   Id  System
/dev/mapper/mpathbp1               1       78325   629145531   83  Linux

Disk /dev/mapper/mpathc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002b47b

             Device Boot      Start         End      Blocks   Id  System
/dev/mapper/mpathcp1               1       26108   209712478+  83  Linux

Prior deciding to create the partitions once again, I cross verified that multipath daemon was loaded and I can see the information. For a primarily a Windows OS person, the whole thing looked like a messed up “File Allocation Table”

[root@erp-prodbak ~]# multipath -ll
mpathc () dm-1 IBM,1726-2xx  FAStT
size=200G features='1 queue_if_no_path' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=6 status=active
| `- 2:0:0:2  sde 8:64  active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 3:0:0:2  sdi 8:128 active ghost running
mpathb () dm-0 IBM,1726-2xx  FAStT
size=600G features='1 queue_if_no_path' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=6 status=active
| `- 2:0:0:1  sdd 8:48  active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 3:0:0:1  sdh 8:112 active ghost running

I have confirmed that the ids in use were same as /etc/multipath/wwids and bindings files.

Well, may be I was truly lucky to “get it done” this time without understanding what actually went wrong. You may not apply this solution to production environment in case if you are dealing with important data!

regards,

rajesh

Windows Subsystem for Linux | Backup & restore

Hello guys

WSL 2 is almost here! and if you are here, reading this post. Please consider reading about WSL 2

During one of the recent chit-chats, few of my contacts were asking me about the “real” business sense behind Linux on Windows. It is simple. Microsoft is:

Going to integrate LINUX so deep within Windows that, in the very near future, one don’t have to run a separate LINUX Server. Simple like that.

After experimenting with KALI Linux WSL, I managed to install Xfce & XRDP on Ubuntu 18.04 WSL & the only few things I couldn’t do with the WSL was starting services automatically when the subsystem starts. There are hacks, well, I don’t think they really worth a try soon as Microsoft will BE bringing it on to WSL pretty soon.

Now, let us get back to the topic. I’ve installed Ubuntu 18.04 WSL nothing less than half dozen times. Every time something goes wrong & I am forced to uninstall and re-install the WSL to continue with additional experiments. My last attempt was to install Kubuntu desktop, that screwed my Xfce & after 2 days of continuous efforts to “fix” few “unknown” things, I had to uninstall one Ubuntu WSL that had a fully functional WordPress instance :(

So, I decided to learn how to backup a functional WSL, so that if something goes wrong, I can restore & continue

I’ve ready at few places that Windows 10 version 1903 comes with WSL backup functionality out of the box. Until you decide to upgrade your box to 1903, you may use the below for backing up your dear WSL instance.

I came across a pretty decent thread here & a user Jaime’s answer is the apt ONE, missing only few details like /tmp folder.

Make a tar ball as mentioned by Jaime

# cd /
# sudo tar vzcpf /mnt/c/tmp/ubuntu_`date +%Y%m%d_%H`.tar.gz --exclude=/proc --exclude=/dev --exclude=/mnt --exclude=/media --exclude=/lost+found  --exclude=/tmp --exclude=/sys  --exclude=/run / > /mnt/c/tmp/ubuntu_`date +%Y%m%d_%H`.log 2> /mnt/c/tmp/ubuntu_`date +%Y%m%d_%H`.error

Where /mnt/c is C:\> drive of your Windows Machine. You may change /mnt/c/ to /mnt/d/ or /mnt/e/, based on how your partitions are laid. Closely watch the excluded directories. You MUST exclude them.

My tar ball was around 1.5GB in size & I moved the tar ball to another machine which didn’t have WSL activated.

First you have to enable Window Subsystem for linux from Turn Windows Features on or off (If you are not restoring the backup to same Windows Machine). This will ask you to restart your Windows Machine.

Copy the tar ball to a folder, say, D:\wsl

Download launcher.exe from https://github.com/yuk7/wsldl

Copy launcher.exe to D:\wsl

If you are going to restore a Ubuntu 18.04 WSL rename launcher.exe to Ubuntu1804.exe & rename your tar ball to rootfs.tar.gz

Open an elevated command prompt & switch to D:\wsl

and just execute, for example “Ubuntu1804.exe”

It will take a while for the installation to complete. As the superuser thread states, it installs and opens the WSL for you. From next time, all you need to do is to start Ubuntu1804.exe & your WSL instance is up and running!

However, I had an issue with the restored instance. It was related to missing /tmp folder. I found a solution for it with nixcraft article.

https://www.cyberciti.biz/faq/mysqld-innodb-error-unable-to-create-temporary-file/

Prior trying to start any sevices, those you were using with your backed up instance, make sure you create the /tmp folder like below

$sudo chown root:root /tmp
$sudo chmod 1777 /tmp

Now, try to start your services, start xrdp & enjoy!

regards,

rajesh