dsg_admin https://datastorageguy.com Consulting Services and Tech-Tips from Ben Patridge Wed, 26 Nov 2025 18:07:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.1 https://datastorageguy.com/wp-content/uploads/2025/11/cropped-dsgplatter-32x32.png dsg_admin https://datastorageguy.com 32 32 189268276 On MacOSX Sequoia Key Repeat Not working for the letter J and K https://datastorageguy.com/2025/11/26/on-macosx-sequoia-key-repeat-not-working-for-the-letter-j-and-k/ Wed, 26 Nov 2025 17:30:59 +0000 https://datastorageguy.com/?p=337 As a hopeless Linux-A-Holic I spend my life in Terminal.

However on OSX Sequoia it drove me Bat Sheep crazy that key repeat would not work when in the VI editor using the letter J and K.

I tried numerous 'fixes' and the only solution that I found that worked was the following:

Open iTerm2 and sudo to root

defaults write -g ApplePressAndHoldEnabled -bool false

Modify the key repeat speed for a shorter delay

defaults write -g InitialKeyRepeat -int 10

Restart Terminal.

I use Devolutions Remote Desktop Manager and the above did not work.

With RDM I had to upgrade to a later version and disable on-hold suggestions via the UI

The above was discussed in the following Tech Article on their website

]]>
337
Faking no read or write errors on a disk in Linux https://datastorageguy.com/2025/11/08/faking-no-read-or-write-errors-on-a-disk-in-linux/ Sat, 08 Nov 2025 23:18:06 +0000 https://datastorageguy.com/?p=334

I have a major Linux Geek Filesystem hack I absolutely had to share express to those who would get and appreciate!

Here goes,

I have had this issue I have been working to resurrect a 6+2 raidset with 3 bad disks..

In a 6+2 raidset when 2 disks are bad then the raidset is degraded but can function, However when 3 disks are offline the raidset will not function and will be rendered offline there for the data is unaccessible

2 of the disks were marked as failed and 1 drive was rebuilding so the filesystem would not bring the raidset online

In this case, the 2 disks were offline because the disk read/write error counts exceeded the threshold allowable for us to keep the disk in the raidset.

I noted that we (Tintri TXOS) fail the disks when the read/write or other values exceed a specific threshold.

My intention was to find a way to make a couple disks online temporarily that had already been marked failed.

The disks do not have any hardware IO or MCE (Machine Check Errors) so I felt there must be a way.

I did not have a way to just replace them because there are not enough spares to rebuild the raidset. Also the supported drives were EOL.

So in this case I had to find a way to unfail the disks so I could temporarily make them online so we can evacuate the data!

So here is my hack…

In Linux the disk errors are kept in

/sys/block/sdX/device/read_err (cor write_err)

Because this is the Linux “sysfs” file system you cannot write to those files to change or clear it those values are kept on the disk where they are read here upon disk insertion and it is read by the kernel

Sooo

My crazy workaround was to make a script that would mimic the data in each of those files.

For example the filesystem comes looks like this:

# cat /tmp/fake_sdX/read_err
0 0 0 7 0 20 0 0 [ 0 0 0 0 0 ]

I would make 3 directories and 3 empty files for the disk

/tmp/fake_sdX/read_err
/tmp/fake_sdX/write_err
/tmp/fake_sdX/other_err

I stop the file system so all of the disks are unmounted

Then echo the above values in there:

echo -e “0 0 0 0 0 0 0 0 [ 0 0 0 0 0 ]” > /tmp/fake_sdX/read_err

echo -e “0 0 0 0 0 0 0 0 [ 0 0 0 0 0 ]” > /tmp/fake_sdX/write_err

echo -e “0 0 0 0 0 0 0 0 [ 0 0 0 0 0 ]” > /tmp/fake_sdX/other_err

Then I mount the actual files to the temporary fake files:

Meaning I mount:

/sys/block/sdX/device/read_err —-> /tmp/fake_sdX/read_err

/sys/block/sdX/device/write_err—-> /tmp/fake_sdX/write_err

/sys/block/sdX/device/other_err —-> /tmp/fake_sdX/other_err

Then I verify the disk errors are now cleared and use my fake zeroed values.

Then I restart the file system

The filesystem comes up and the disks because the 2 disks previously marked failed due to threshold errors are now temporarily active !

]]>
334
Using grep to search a file using multiple words as boolean AND OR condition https://datastorageguy.com/2024/09/10/using-grep-to-search-a-file-using-multiple-words-as-boolean-and-or-condition/ Tue, 10 Sep 2024 22:37:52 +0000 https://datastorageguy.com/?p=312

Command Overview

The following extended grep  (grep -E) example shows how to search a log files for

  1. Any line containing the words
    1. init
      AND
    2. SNMP OR tomcat 
  2. Any line containing either
    1. start_tomcat
      OR
    2. stop_tomcat
      OR
    3. start_snmp
      OR
    4. stop_snmp
  3. excluding any match with the word INT

Example

# grep -E "init.*(snmp|tomcat)|(start|stop)_(tomcat|snmp)" debug.log |grep -v INT 2024-09-10T13:54:36.686053-07:00 nec-6090-01#b stop_tomcat[4019]: running, pid file: /var/run/jsvc.pid , timeout interval: 15 secs 2024-09-10T13:54:36.687429-07:00 nec-6090-01#b stop_tomcat[4019]: pid: 1651 2024-09-10T13:54:36.704588-07:00 nec-6090-01#b stop_tomcat[4019]: init-+-AuthenticationS---7*[{Authentication}] 2024-09-10T13:54:36.705498-07:00 nec-6090-01#b stop_tomcat[4019]: |-HAMon---15*[{HAMon}] 2024-09-10T13:54:36.706346-07:00 nec-6090-01#b stop_tomcat[4019]: |-PlatMon---13*[{PlatMon}] 2024-09-10T13:54:36.707142-07:00 nec-6090-01#b stop_tomcat[4019]: |-ProcMon-+-realstore---98*[{realstore}] 2024-09-10T13:54:36.707881-07:00 nec-6090-01#b stop_tomcat[4019]: | 2024-09-10T13:54:36.708690-07:00 nec-6090-01#b stop_tomcat[4019]: `-9*[{ProcMon}] 2024-09-10T13:54:36.709454-07:00 nec-6090-01#b stop_tomcat[4019]: |-agetty 2024-09-10T13:54:36.710315-07:00 nec-6090-01#b stop_tomcat[4019]: |-cimserver---2*[{cimserver}] 2024-09-10T13:54:36.711077-07:00 nec-6090-01#b stop_tomcat[4019]: |-corewatch 2024-09-10T13:54:36.711792-07:00 nec-6090-01#b stop_tomcat[4019]: |-crond 2024-09-10T13:54:36.712541-07:00 nec-6090-01#b stop_tomcat[4019]: |-dbus-daemon 2024-09-10T13:54:36.713388-07:00 nec-6090-01#b stop_tomcat[4019]: |-java---21*[{java}] 2024-09-10T13:54:36.714237-07:00 nec-6090-01#b stop_tomcat[4019]: |-jsvc-+-jsvc 2024-09-10T13:54:36.714977-07:00 nec-6090-01#b stop_tomcat[4019]: | 2024-09-10T13:54:36.715776-07:00 nec-6090-01#b stop_tomcat[4019]: `-jsvc---62*[{jsvc}] 2024-09-10T13:54:36.716540-07:00 nec-6090-01#b stop_tomcat[4019]: |-jsvc-+-jsvc 2024-09-10T13:54:36.717367-07:00 nec-6090-01#b stop_tomcat[4019]: | 2024-09-10T13:54:36.718192-07:00 nec-6090-01#b stop_tomcat[4019]: `-jsvc---109*[{jsvc}] 2024-09-10T13:54:36.720254-07:00 nec-6090-01#b stop_tomcat[4019]: |-lldpd---lldpd 2024-09-10T13:54:36.721010-07:00 nec-6090-01#b stop_tomcat[4019]: |-6*[mingetty] 2024-09-10T13:54:36.721717-07:00 nec-6090-01#b stop_tomcat[4019]: |-ntpd---ntpd 2024-09-10T13:54:36.722473-07:00 nec-6090-01#b stop_tomcat[4019]: |-rpcbind 2024-09-10T13:54:36.723252-07:00 nec-6090-01#b stop_tomcat[4019]: |-rsyslogd-+-log_scrub.py 2024-09-10T13:54:36.724039-07:00 nec-6090-01#b stop_tomcat[4019]: | 2024-09-10T13:54:36.724822-07:00 nec-6090-01#b stop_tomcat[4019]: `-9*[{rsyslogd}] 2024-09-10T13:54:36.725621-07:00 nec-6090-01#b stop_tomcat[4019]: |-runuser---postmaster---18*[postmaster] 2024-09-10T13:54:36.726416-07:00 nec-6090-01#b stop_tomcat[4019]: |-runuser---postmaster---16*[postmaster] 2024-09-10T13:54:36.727143-07:00 nec-6090-01#b stop_tomcat[4019]: |-sh---stop_tomcat---pstree 2024-09-10T13:54:36.727860-07:00 nec-6090-01#b stop_tomcat[4019]: |-sshd-+-sshd---rsync.bin 2024-09-10T13:54:36.728562-07:00 nec-6090-01#b stop_tomcat[4019]: | 2024-09-10T13:54:36.729270-07:00 nec-6090-01#b stop_tomcat[4019]: `-sshd---bash---service---tomcat---initctl 2024-09-10T13:54:36.730039-07:00 nec-6090-01#b stop_tomcat[4019]: |-thriftshell---11*[{thriftshell}] 2024-09-10T13:54:36.730807-07:00 nec-6090-01#b stop_tomcat[4019]: |-udevd---2*[udevd] 2024-09-10T13:54:36.731537-07:00 nec-6090-01#b stop_tomcat[4019]: |-watchdog 2024-09-10T13:54:36.732229-07:00 nec-6090-01#b stop_tomcat[4019]: `-winbindd---winbindd 2024-09-10T13:54:37.735365-07:00 nec-6090-01#b stop_tomcat[4019]: Tomcat is stopped 2024-09-10T13:54:37.738757-07:00 nec-6090-01#b init[4098]: tomcat post-start 2024-09-10T13:54:39.366904-07:00 nec-6090-01#b start_tomcat[4097]: LOG-TOMCAT-0003: TASKSET options 2024-09-10T13:54:39.369087-07:00 nec-6090-01#b start_tomcat[4097]: Set JAVA options -Xms128M -Xmx2800M -XX:MaxMetaspaceSize=140M -XX:ReservedCodeCacheSize=140M -XX:+UseCodeCacheFlushing -Xss512k -XX:+UseStringDeduplication -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005 -XX:+PrintClassHistogram -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/corefiles -XX:ErrorFile=/var/corefiles/hs_err_pid<>.log -Dfile.encoding=UTF8 -Dcom.tintri.platform.productid=BR2 -Dhttps.protocols=TLSv1.2 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false 2024-09-10T13:54:39.396222-07:00 nec-6090-01#b start_tomcat[4097]: Starting server using jsvc. 2024-09-10T13:55:11.215363-07:00 nec-6090-01#b stop_snmp[15117]: Stopping snmp agent 2024-09-10T13:55:12.217316-07:00 nec-6090-01#b stop_snmp[15117]: SNMP agent is stopped 2024-09-10T13:55:12.246235-07:00 nec-6090-01#b start_snmp[15416]: Set JAVA options -Xms64M -Xmx128M -XX:MaxMetaspaceSize=48M -XX:ReservedCodeCacheSize=48M -XX:+UseCodeCacheFlushing -Xss512k -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5006 -XX:+UseStringDeduplication -XX:+PrintClassHistogram -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/corefiles -Dcom.tintri.platform.productid=BR2 -Dfile.encoding=UTF8 2024-09-10T13:55:12.247242-07:00 nec-6090-01#b start_snmp[15416]: Starting SNMP agent using jsvc. 2024-09-10T14:27:39.615636-07:00 nec-6090-01#b vmstore[2582]: HA: [2961] [tid 4996] HA-STATE: errorDetected: module [1], current state [104] indicates Error 2024-09-10T14:27:39.615698-07:00 nec-6090-01#b vmstore[2582]: HA: [2962] [tid 4996] HA-STATE: setStatusLocked: setting nodeRole to [SECONDARY], nodeStatus to [DISCONNECTED] 2024-09-10T14:27:39.690762-07:00 nec-6090-01#b vmstore[2582]: HA: [2967] [tid 5043] HA-STATE: errorDetected: module [5], current state [104] indicates Error 2024-09-10T14:27:40.191327-07:00 nec-6090-01#b vmstore[2582]: HA: [2969] [tid 5020] HA-STATE: setStatusLocked: setting nodeRole to [PRIMARY], nodeStatus to [SELECTED] 2024-09-10T14:27:40.312790-07:00 nec-6090-01#b vmstore[2582]: HA: [2970] [tid 2911] HA-STATE: disconnecting Secondary; becoming Primary 2024-09-10T14:27:40.313379-07:00 nec-6090-01#b vmstore[2582]: HA: [2980] [tid 2911] HA-STATE: notified HA modules to become Primary 2024-09-10T14:27:40.914011-07:00 nec-6090-01#b vmstore[2582]: HA: [3672] [tid 2911] HA-STATE: becomePrimary: invoked 2024-09-10T14:27:40.914059-07:00 nec-6090-01#b vmstore[2582]: HA: [3673] [tid 2911] HA-STATE: becomePrimary: eligible to be Primary due to NVRAM gen num [4] >= current disk gen num [4] 2024-09-10T14:27:40.914099-07:00 nec-6090-01#b vmstore[2582]: HA: [3674] [tid 2911] HA-STATE: updateGenNum: STARTUP: writing intended gen num [5] 2024-09-10T14:27:40.956406-07:00 nec-6090-01#b vmstore[2582]: HA: [3676] [tid 2911] HA-STATE: updateGenNum: writing NVRAM gen num as [5] 2024-09-10T14:27:40.999307-07:00 nec-6090-01#b vmstore[2582]: HA: [3681] [tid 2911] HA-STATE: setStatusLocked: setting nodeRole to [PRIMARY], nodeStatus to [RECOVERING] 2024-09-10T14:27:46.172490-07:00 nec-6090-01#b vmstore[2582]: HA: [7846] [tid 2911] HA-STATE: primaryBeginAccepting: invoked 2024-09-10T14:27:46.172972-07:00 nec-6090-01#b vmstore[2582]: HA: [7856] [tid 2911] HA-STATE: setStatusLocked: setting nodeRole to [PRIMARY], nodeStatus to [ACTIVE] 2024-09-10T14:27:46.173513-07:00 nec-6090-01#b vmstore[2582]: HA: [7868] [tid 746] HA-STATE: haManagerListenerThread: invoked 2024-09-10T14:28:46.213586-07:00 nec-6090-01#b vmstore[2582]: HA: [10685] [tid 746] HA-STATE: syncComplete: module [5] indicates SyncComplete 2024-09-10T14:28:47.113674-07:00 nec-6090-01#b vmstore[2582]: HA: [10815] [tid 4997] HA-STATE: syncComplete: module [1] indicates SyncComplete
]]>
312
Use sed to replace last character after matching a line https://datastorageguy.com/2024/05/14/use-sed-to-replace-last-character-after-matching-a-line/ Tue, 14 May 2024 21:08:19 +0000 https://datastorageguy.com/?p=308 If you are a coder like me we tend to discover after we have made a script that we need to change something on multiple lines.

Recently I have a script whereby added a "log_message" function which would echo a phrase.

However, I wanted to append a double parenthesis after the last character in the entire file.

For example.

Inside of myscript.sh I have the following

# grep Beginning myscript.sh
        log_message "Beginning function enableOrDisableRealstore"
        log_message "Beginning function modulePowerCycleChassis"
        log_message "Beginning function checkFipsLicense"
        log_message "Beginning function enableFips"
        log_message "Beginning function backupFips"
        log_message "FIPS: Beginning function isFipsEnabled"
        log_message "Beginning function isEncryptionEnabled"
        log_message "Beginning function isControllerPrimary"
        log_message "Beginning function isPeerControllerUpAndExecuting"
        log_message "Beginning function preZeroizeControllersValidation"
        log_message "Beginning function preZeroizeHaValidation"
        log_message "Beginning function preZeroizeDataCollection"
        log_message "Beginning function validateMachine"
        log_message "Beginning function cleanupDatabases"
        log_message "Beginning function isTxosRunning"
        log_message "Beginning function cleanupTunables"
        log_message "Beginning function checkControllerFailLogs"
        log_message "Beginning function getNetworkInfo"
        log_message "Beginning function getMDRaidInfo"
        log_message "Beginning function eraseSsdZion"
        log_message "Beginning function secureEraseSsd"
        log_message "Beginning function _retry_secerase for $disk"
        log_message "Beginning function _powercycle_disk_slot for $disk"
        log_message "Beginning function check_dd_process"
        log_message "Beginning function writeZeroesToHdd"
        log_message "Beginning function verifyBootDomPartition"
        log_message "Beginning function listDOM"
        log_message "Beginning function makePartitionsOnSSD"
        log_message "Beginning function formatRealstore"
        log_message "Beginning function updateDiskSignature"
        log_message "Beginning function deleteLogsAndCores"
        log_message "Beginning function resetRootPassword_default"
        log_message "Beginning function resetRootPassword_internal"
        log_message "Beginning function resetRootPassword"
        log_message "Beginning function resetAdminPasswordToSerialNumber"
        log_message "Beginning function validateSerialNumber"

My goal was to replace the last quote with ()" so that each line would look like

log_message "Beginning function validateSerialNumber()"

This is easily resolved using sed!

# sed -i.bak 's/\(.*Beginning.*\)[^ ]$/\1\(\)\"/' myscript.sh

the above backs up myscript.sh to myscript.sh.bak

Then it replaces the last quote with ()"

The result is

# grep Beginn myscript.sh
        log_message "Beginning function enableOrDisableRealstore()"
        log_message "Beginning function modulePowerCycleChassis()"
        log_message "Beginning function checkFipsLicense()"
        log_message "Beginning function enableFips()"
        log_message "Beginning function backupFips()"
        log_message "FIPS: Beginning function isFipsEnabled()"
        log_message "Beginning function isEncryptionEnabled()"
        log_message "Beginning function isControllerPrimary()"
        log_message "Beginning function isPeerControllerUpAndExecuting()"
        log_message "Beginning function preZeroizeControllersValidation()"
        log_message "Beginning function preZeroizeHaValidation()"
        log_message "Beginning function preZeroizeDataCollection()"
        log_message "Beginning function validateMachine()"
        log_message "Beginning function cleanupDatabases()"
        log_message "Beginning function isTxosRunning()"
        log_message "Beginning function cleanupTunables()"
        log_message "Beginning function checkControllerFailLogs()"
        log_message "Beginning function getNetworkInfo()"
        log_message "Beginning function getMDRaidInfo()"
        log_message "Beginning function eraseSsdZion()"
        log_message "Beginning function secureEraseSsd()"
        log_message "Beginning function _retry_secerase for $disk()"
        log_message "Beginning function _powercycle_disk_slot for $disk()"
        log_message "Beginning function check_dd_process()"
        log_message "Beginning function writeZeroesToHdd()"
        log_message "Beginning function verifyBootDomPartition()"
        log_message "Beginning function listDOM()"
        log_message "Beginning function makePartitionsOnSSD()"
        log_message "Beginning function formatRealstore()"
        log_message "Beginning function updateDiskSignature()"
        log_message "Beginning function deleteLogsAndCores()"
        log_message "Beginning function resetRootPassword_default()"
        log_message "Beginning function resetRootPassword_internal()"
        log_message "Beginning function resetRootPassword()"
        log_message "Beginning function resetAdminPasswordToSerialNumber()"
        log_message "Beginning function validateSerialNumber()"
]]>
308
Viewing contents of an open filehandle on a deleted file https://datastorageguy.com/2024/05/01/viewing-contents-of-an-open-filehandle-on-a-deleted-file/ Wed, 01 May 2024 22:35:32 +0000 https://datastorageguy.com/?p=305 There are times when you may unintentionally delete a file which is being written to.

When this occurs it will leave an Open Filehandle.

In Linux open filehandles may be viewed via the 'lsof' command.

# lsof +L1

In the following example here was the situation.

  1. I executed a script using nohup
    (i.e.   "nohup vmstore-tnt.sh  &")   
  2. File /root/nohup.out was being written to.
  3. I deleted the file nohup.out
  4. Thus this left an open filehandle.
$ lsof +L1
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NLINK    NODE NAME
vmstore-t 57520 root    1w   REG  252,1    26136     0 1671175 /root/nohup.out (deleted)
vmstore-t 57520 root    2w   REG  252,1    26136     0 1671175 /root/nohup.out (deleted)

Merely recreating the file via (touch /root/nohup.out) will not restore the file

To view the contents of the file that was deleted, you have to locate the Process ID (PID) from the above 'lsof' output.

(The above shows the PID as 57520)

Now wee can look for the fd (file descriptors) in Linux /proc pseudo filesystem by looking in /proc/<pid>/fd

# ls /proc/57520/fd
0  1  2  255
NUMBER MEANING
0Standard Input
1Standard Output
2Standard Error
255The File

*note: There may be additional File Descriptor Numbers which are beyond  the scope of this document.

Now, to view the real-time file progress you may issue

# cat /proc/57520/fd/1

To view any standard error  real-time you may view

# cat /proc/57520/fd/2

If you wish to temporarily restore the standard output of the file so you can monitor the output, you may create a 'soft' link via:

# ln -s /proc/57520/fd/1  /root/nohup.out

You may verify the link via

$ ls -Al nohup.out
lrwxrwxrwx 1 root root    16 May  1 15:02 nohup.out -> /proc/57520/fd/1

*note: Once the process stops you will have to delete the soft link!

When you try to view the contents you will see

# tail nohup.out
tail: cannot open `nohup.out' for reading: No such file or directory

Therefore remove the file

# rm nohup.out

We should no longer see any open files

# lsof +L1
#
]]>
305
MACOS – Clicking on webpage automatically jumps to top of the page https://datastorageguy.com/2024/02/21/macos-clicking-on-webpage-automatically-jumps-to-top-of-the-page/ Wed, 21 Feb 2024 21:21:46 +0000 https://datastorageguy.com/?p=298 I recently encountered yet another MAC Madness issue!

I changed out my wired MacBook extended keyboard for a used Apple 'Magic' Keyboard.

Well the 'magic' was that it introduced an unwanted 'feature' whereby when I switch between external monitors, and the webpage in view is scrolled downward, the page would automagically jump to the top of the page. I am at Geek Level 4 in that I have 3 external monitors. So switching between them would move any object on that page automatically to the top; text box, text editor, webpage/etc.

After trolling the Google Verse I didn't find anything useful.

So after hacking at the Settings on MacOS Ventura I figured it out.

I went to Settings --> Accessibility --> Keyboard

Then uncheck Full Keyboard Access

After that I was back in business.

]]>
298
Cscope search results are invisible https://datastorageguy.com/2024/02/13/cscope-search-results-are-invisible/ Tue, 13 Feb 2024 21:58:59 +0000 https://datastorageguy.com/?p=286 Part of my 'day job' is trolling thru source code when looking for answers. My preferred mechanism, other than a recursive grep, is to use cscope

Cscope is a useful tool for searching a source code tree after you build a list of files to search

The Problem

However, in this conundrum, when I would use any of the search options within cscope the File list (or list of source files) was empty, blank, envisible... basically, I could not SEE any of the results!

Example

Recreating the issue

In the following example, I built a list of files so that I could populate cscope

# cd /export/hg/default/pstoolkit
# find PstkCore/ -type f -not -path "*__In*" -not -path "*__Out*" -not -path "*ThirdPart*" -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cs*" > cscope.files

Then I read the results into cscope

# ls -al cscope.files
-rw-rw-r-- 1 bpatridge bpatridge 77196 Feb 13 12:46 cscope.files
# cscope -q -R -b -i cscope.files
# 

Now I attempt to open cscope

# cscope -d

Now I see the window:

However,

When I search for string "TimeOfDay" the search results are invisible?

I even attempted to change the colors but the results were the same

Oddly enough, when I scroll down and press enter I CAN still view one of the source files?

However when I return it is still empty.

The Solution

The solution in this case was surprising.

I trolled the internet for weeks until I finally found a nugget on old ye faithful - stackoverflow which mentioned that cscope has problems with control characters!

I noted when viewing the contents of several files there was a ^M appended to each line.

Therefore I ran dos2unix on all of the files in cscope.files

# cat cscope.files |xargs -n1 -I{}  dos2unix  {}
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/SraPeerArray.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/SraPrepareReverseReplicationResponse.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/RecommendationSpaceOutcome.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/RemoteCopyInfo.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/ReplLinkStat.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/ReplicationStat.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/RestApi.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/RestApiPrivilege.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/RestoreInfo.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/ServiceGroup.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/ServiceGroupOperationStatus.cs to Unix format ...
dos2unix: converting file PstkCore/dotnetSDK/src/SDK/Tintri.Types/Generated/Severity.cs to Unix format ...
....

After this was complete, I was able to run cscope normally and now I can see the search results!!!


]]>
286
What every Programmer *should* know about Memory https://datastorageguy.com/2023/10/04/what-every-programmer-should-know-about-memory/ Wed, 04 Oct 2023 22:49:50 +0000 https://datastorageguy.com/?p=278 For my fellow Insomniacs out there…

If you are up scrolling your phone for things around the Google-verse to read to shut off your brain so you can possibly go to sleep.. I came across this article on LWN which provides a trough of information regarding Linux Memory Management.

The original document prints out at over 100 pages and is WAY more than I may ever digest in this lifetime.

Be sure to have a soft pillow for your head to fall down onto!!


]]>
278
Obtain the grub boot parameters from /var/log/messages https://datastorageguy.com/2023/09/20/obtain-the-grub-boot-parameters-from-var-log-messages/ Wed, 20 Sep 2023 17:41:36 +0000 https://datastorageguy.com/?p=272 There are times you may need to quickly confirm the grub boot parameters that were issued either at the console (or by default)

This information is logged to /var/log/messages when you grep with keywords "Kernel command"


# grep "Kernel command" messages
2023-09-19 2023-09-19T15:06:08.687 benvm1 NOT Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-1160.76.1.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet, transparent_hugepage=never LANG=en_US.UTF-8
]]>
272
Data Storage Funny #1 https://datastorageguy.com/2023/09/20/data-storage-funny-1/ Wed, 20 Sep 2023 17:38:17 +0000 https://datastorageguy.com/?p=269 Let this sink in!!

]]>
269
Display ethernet devices on a Fedora system using the Linux Pseudo Filesystem and create a static IP Address https://datastorageguy.com/2023/09/11/display-ethernet-devices-on-a-fedora-system-using-the-linux-pseudo-filesystem-and-create-a-static-ip-address/ Mon, 11 Sep 2023 21:56:31 +0000 https://datastorageguy.com/?p=267 Encountered a fun riddle recently whereby on a Fedora 34 system I needed to locate all ethernet interfaces on a system that are obtaining a DHCP address, then after the first reboot create a static IP address.

I am a big fan of looking thru the Linux pseudo filesystem in /sys

In this instance I wanted to exclude any Virtual, Bridge and Local Interfaces.

Therefore I do the following:

Listing all Interfaces in sysfs

# ls /sys/class/net|egrep -v "^vir|^lo|^wl|^br"

Example

# ls /sys/class/net|egrep -v "^vir|^lo|^wl|^br"
eno1

PART 1 - CHANGE FROM DHCP TO STATIC IP ADDRESS

To change from DHCP to a STATIC IP Address

First display the current interfaces

# nmcli con show
NAME    UUID                                  TYPE      DEVICE
enp1s0  46145016-ead7-4128-8d91-4b0b828162db  ethernet  enp1s0

and to set a STATIC IP with NAME "System-NIC-110" the format would be

# nmcli con add con-name "System-NIC-110" ifname enp1s0 type ethernet ip4 192.168.122.110/24 gw4 192.168.122.1

Then you would delete the original interface afterwards

# nmcli con del enp1s0

Then either reboot or restart networking

# nmcli networking off
# nmcli networking on

Now you will see the new interface name.

# nmcli con show
NAME            UUID                                  TYPE      DEVICE
System-NIC-110  fc1ca250-1481-4014-82bd-ad97d1c48ae4  ethernet  enp1s0

PART II - Script method to change all interfaces after first reboot

Here is a script example how to iterate thru all devices on the system and create static IP addresses:

#!/bin/bash
###################################################################
# SCRIPT BY The Data Storage Guy (https://datastorageguy.com)
# As an example how iterate thru all ethernet devices on a Fedora
# system and assign Static IP Addresses with a custom name
#
# location: /usr/local/bin/set-static-ip.sh
###################################################################
# The following will go thru all of the ethernet devices found
#
# It is used to on create static IP addresses with connection NAME
#
# $connection_prefix-$starting_octet
#
# with IP address using the format
#
# $ip_subnet.$starting_octet
#
# It will also increment should there be more
# than one ethernet device found
#
# the parameters are used within the following configuration file
###################################################################
connection_prefix="System-NIC"
ip_subnet="192.168.122"
starting_octet="110"
mask="24"
gateway="192.168.122.1"
###################################################################
PS4='${LINENO}: '
###################################################################
SCRIPT=$(basename ${BASH_SOURCE[0]})
###################################################################
export PATH=$PATH:/usr/bin/
log=/var/log/$(echo $SCRIPT|cut -d. -f1).log
line="-----------------------------------------------"
step=1
n=1
###################################################################
logm() {
        LOGDATE=`date '+%Y-%m-%dT%H:%M:%S'`
        echo $line |tee -a $log
        echo "[$LOGDATE] [$step]  $1" |tee -a $log |tee >(logger -t $SCRIPT)
        ((step++))
}
###################################################################
logm "Displaying Network General Status"
logm "Issuing command: nmcli general status"
nmcli general status  >>$log

logm "Displaying Network Interfaces"
logm "Issuing command: nmcli con show"
nmcli con show |tee -a $log | logger -t $SCRIPT

while read ethname; do
        ip="${ip_subnet}.${starting_octet}"
        UUID=$(nmcli conn show |awk -v iface=$ethname '$NF ~ iface {print $(NF-2)}')
        logm "Setting $ethname ip address to ${ip}/24 with name "${connection_prefix}-$ip" for ethernet $ethname UUID=$UUID"
        logm "Issuing Command:  nmcli con add con-name "${connection_prefix}-$starting_octet" ifname $ethname type ethernet ip4 ${ip}/$mask gw4 $gateway"
        nmcli con add con-name "${connection_prefix}-$starting_octet" ifname $ethname type ethernet ip4 ${ip}/$mask gw4 $gateway  |tee -a $log
        if [ $? == 0 ]; then
                logm "Successfully added con-name ${connection_prefix}-$starting_octet"
        else
                logm "ERROR: Problem adding con-name ${connection_prefix}-$starting_octet"
        fi
        sleep .2
        logm "Deleting $ethname: nmcli con del $ethname"
        logm "Issuing command: nmcli con del $ethname"
        nmcli con del $ethname |tee -a $log
        if [ $? == 0 ]; then
                logm "Successfully deleted $ethname: nmcli con del $ethname"
        else
                logm "ERROR: Unable to delete $ethname: nmcli con del $ethname"
        fi
        ((n++))
        ((starting_octet++))
done< <(ls /sys/class/net|egrep -v "^vir|^lo|^wl|^br")

logm "Displaying Network Interfaces"
logm "Issuing command: nmcli con show"
nmcli con show |tee -a $log |logger -t $SCRIPT

logm "Checking for the install cron job entry"
logm "Issuing command: crontab -l"
crontab -l |tee -a $log|logger -t $SCRIPT

logm "Restarting Network Services"
logm "Issuing command: nmcli networking off"
nmcli networking off |tee -a $log
sleep .2
logm "Issuing command: nmcli networking on"
nmcli networking on |tee -a $log
sleep 2
logm "Displaying Network Interfaces"
logm "Issuing command: ncmli con show"
nmcli con show |tee -a $log |logger -t $SCRIPT

if [ $(nmcli con show|grep -q $connection_prefix;echo $?) == 0 ]; then
        logm "GOOD: Found $connection_prefix Network Device"
        crontab -l |tee -a $log
        if [ $? == 0 ]; then
                logm "Sleeping for 15 seconds... then removing cron job"
                sleep 15
                logm "Removing cron jobs"
                logm "Issuing command: crontab -r"
                crontab -r &>/dev/null
        fi
else
        logm "ERROR: Unable to find $connection_prefix Network device"
fi


logm "Completed Network Setting Setup"
###################################################################

Now we create a cron entry to run only at reboot and log to /root/cron.log

@reboot  /usr/bin/bash /usr/local/bin/set-static-ip.sh >> /root/cron.log

Now when we reboot we see the new network settings.

# nmcli con show
NAME            UUID                                  TYPE      DEVICE
System-NIC-110  62a904ab-2be2-4223-bc13-0b7daba2409e  ethernet  enp1s0
System-NIC-111  350008d7-f075-4ca5-ad97-f5ba8e6f20d0  ethernet  enp7s0

The /var/log/set-static-ip.log shows the following script steps

# cat /var/log/set-static-ip.log
-----------------------------------------------
[2023-09-11T13:28:20] [1]  Displaying Network General Status
-----------------------------------------------
[2023-09-11T13:28:20] [2]  Issuing command: nmcli general status
STATE                  CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN
connected (site only)  limited       enabled  enabled  enabled  enabled
-----------------------------------------------
[2023-09-11T13:28:20] [3]  Displaying Network Interfaces
-----------------------------------------------
[2023-09-11T13:28:20] [4]  Issuing command: nmcli con show
NAME    UUID                                  TYPE      DEVICE
enp1s0  197a76a0-a28a-4db4-8e64-a90557e47c9f  ethernet  enp1s0
enp7s0  d0cf6083-8f35-4be1-8705-95ac804eecac  ethernet  enp7s0
-----------------------------------------------
[2023-09-11T13:28:20] [5]  Setting enp1s0 ip address to 192.168.122.110/24 with name System-NIC-192.168.122.110 for ethernet enp1s0 UUID=197a76a0-a28a-4db4-8e64-a90557e47c9f
-----------------------------------------------
[2023-09-11T13:28:20] [6]  Issuing Command:  nmcli con add con-name System-NIC-110 ifname enp1s0 type ethernet ip4 192.168.122.110/24 gw4 192.168.122.1
Connection 'System-NIC-110' (6bd11875-8971-41d0-9089-c3caebc02bb0) successfully added.
-----------------------------------------------
[2023-09-11T13:28:20] [7]  Successfully added con-name System-NIC-110
-----------------------------------------------
[2023-09-11T13:28:20] [8]  Deleting enp1s0: nmcli con del enp1s0
-----------------------------------------------
[2023-09-11T13:28:20] [9]  Issuing command: nmcli con del enp1s0
Connection 'enp1s0' (197a76a0-a28a-4db4-8e64-a90557e47c9f) successfully deleted.
-----------------------------------------------
[2023-09-11T13:28:20] [10]  Successfully deleted enp1s0: nmcli con del enp1s0
-----------------------------------------------
[2023-09-11T13:28:20] [11]  Setting enp7s0 ip address to 192.168.122.111/24 with name System-NIC-192.168.122.111 for ethernet enp7s0 UUID=d0cf6083-8f35-4be1-8705-95ac804eecac
-----------------------------------------------
[2023-09-11T13:28:20] [12]  Issuing Command:  nmcli con add con-name System-NIC-111 ifname enp7s0 type ethernet ip4 192.168.122.111/24 gw4 192.168.122.1
Connection 'System-NIC-111' (8eee96f7-8a42-4bb4-b57a-e15d222743f1) successfully added.
-----------------------------------------------
[2023-09-11T13:28:20] [13]  Successfully added con-name System-NIC-111
-----------------------------------------------
[2023-09-11T13:28:20] [14]  Deleting enp7s0: nmcli con del enp7s0
-----------------------------------------------
[2023-09-11T13:28:20] [15]  Issuing command: nmcli con del enp7s0
Connection 'enp7s0' (d0cf6083-8f35-4be1-8705-95ac804eecac) successfully deleted.
-----------------------------------------------
[2023-09-11T13:28:20] [16]  Successfully deleted enp7s0: nmcli con del enp7s0
-----------------------------------------------
[2023-09-11T13:28:20] [17]  Displaying Network Interfaces
-----------------------------------------------
[2023-09-11T13:28:20] [18]  Issuing command: nmcli con show
NAME            UUID                                  TYPE      DEVICE
System-NIC-110  6bd11875-8971-41d0-9089-c3caebc02bb0  ethernet  enp1s0
System-NIC-111  8eee96f7-8a42-4bb4-b57a-e15d222743f1  ethernet  enp7s0
virbr0          02b8c655-36de-4379-b096-b48de5941117  bridge    virbr0
-----------------------------------------------
[2023-09-11T13:28:21] [19]  Checking for the install cron job entry
-----------------------------------------------
[2023-09-11T13:28:21] [20]  Issuing command: crontab -l
@reboot  /usr/bin/bash /usr/local/bin/set-static-ip.sh >> /root/cron.log
-----------------------------------------------
[2023-09-11T13:28:21] [21]  Restarting Network Services
-----------------------------------------------
[2023-09-11T13:28:21] [22]  Issuing command: nmcli networking off
-----------------------------------------------
[2023-09-11T13:28:21] [23]  Issuing command: nmcli networking on
-----------------------------------------------
[2023-09-11T13:28:21] [24]  Displaying Network Interfaces
-----------------------------------------------
[2023-09-11T13:28:21] [25]  Issuing command: ncmli con show
NAME            UUID                                  TYPE      DEVICE
System-NIC-110  6bd11875-8971-41d0-9089-c3caebc02bb0  ethernet  enp1s0
System-NIC-111  8eee96f7-8a42-4bb4-b57a-e15d222743f1  ethernet  enps7
-----------------------------------------------
[2023-09-11T13:28:21] [26]  GOOD: Found System-NIC Network Device
@reboot  /usr/bin/bash /usr/local/bin/set-static-ip.sh >> /root/cron.log
-----------------------------------------------
[2023-09-11T13:28:21] [27]  Sleeping for 15 seconds... then removing cron job
-----------------------------------------------
[2023-09-11T13:28:36] [28]  Removing cron jobs
-----------------------------------------------
[2023-09-11T13:28:36] [29]  Issuing command: crontab -r
-----------------------------------------------
[2023-09-11T13:28:36] [30]  Completed Network Setting Setup
]]>
267
Modify gnome dock from the command line https://datastorageguy.com/2023/09/08/modify-gnome-dock-from-the-command-line/ Fri, 08 Sep 2023 22:21:16 +0000 https://datastorageguy.com/?p=265 To modify the gnome desktop dock (i.e. launcher or launchpad) from the command line an easy way is to perform the following:

/usr/bin/dbus-launch dconf write /org/gnome/shell/favorite-apps "['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'terminator.desktop', 'gnome-control-center.desktop']"

This above will add Firefox, The File Manager, Terminal, Terminator and Gnome Settings to the desktop

]]>
265
Downloading an RPM package including all of its dependencies on Fedora https://datastorageguy.com/2023/09/08/downloading-an-rpm-package-including-all-of-its-dependencies-on-fedora/ Fri, 08 Sep 2023 20:55:28 +0000 https://datastorageguy.com/?p=259 There are times when you need to fully download an RPM and all of its dependencies.


However,

If you have already downloaded the RPM re-downloading the RPM and all its dependencies can be very difficult.

I have found the following is a way to use an alternate installation 'root' directory so that you can ensure you are not using your system RPM database, and you can download all of the dependencies for the package.

In the following example I

  1. Create an "/installroot" directory
  2. Create a directory called /data/repo/terminator to store the downloaded RPM and its dependencies
  3. Download the 'terminator' package for fedora 34
# mkdir /installroot
# mkdir /data/repo/terminator
# dnf -y install --installroot=/instroot --downloaddir=/data/repo/terminator --downloadonly --noautoremove --releasever=34 terminator

The results will look like the following!

# ls /data/repo/terminator/
acl-2.3.1-1.fc34.x86_64.rpm
adwaita-cursor-theme-40.1.1-1.fc34.noarch.rpm
adwaita-icon-theme-40.1.1-1.fc34.noarch.rpm
alsa-lib-1.2.6.1-3.fc34.x86_64.rpm
alternatives-1.15-2.fc34.x86_64.rpm
atk-2.36.0-3.fc34.x86_64.rpm
at-spi2-atk-2.38.0-2.fc34.x86_64.rpm
at-spi2-core-2.40.3-1.fc34.x86_64.rpm
audit-libs-3.0.6-1.fc34.x86_64.rpm
avahi-libs-0.8-14.fc34.x86_64.rpm
basesystem-11-11.fc34.noarch.rpm
bash-5.1.0-2.fc34.x86_64.rpm
bzip2-libs-1.0.8-6.fc34.x86_64.rpm
ca-certificates-2021.2.52-1.0.fc34.noarch.rpm
cairo-1.17.4-3.fc34.x86_64.rpm
cairo-gobject-1.17.4-3.fc34.x86_64.rpm
colord-libs-1.4.5-2.fc34.x86_64.rpm
coreutils-8.32-32.fc34.x86_64.rpm
coreutils-common-8.32-32.fc34.x86_64.rpm
cpio-2.13-10.fc34.x86_64.rpm
cracklib-2.9.6-27.fc34.x86_64.rpm
crypto-policies-20210213-1.git5c710c0.fc34.noarch.rpm
crypto-policies-scripts-20210213-1.git5c710c0.fc34.noarch.rpm
cryptsetup-libs-2.3.7-1.fc34.x86_64.rpm
cups-libs-2.3.3op2-17.fc34.x86_64.rpm
curl-7.76.1-12.fc34.x86_64.rpm
cyrus-sasl-lib-2.1.27-9.fc34.x86_64.rpm
dbus-1.12.20-3.fc34.x86_64.rpm
dbus-broker-29-2.fc34.x86_64.rpm
dbus-common-1.12.20-3.fc34.noarch.rpm
dbus-libs-1.12.20-3.fc34.x86_64.rpm
dconf-0.40.0-3.fc34.x86_64.rpm
dejavu-sans-fonts-2.37-16.fc34.noarch.rpm
device-mapper-1.02.175-1.fc34.x86_64.rpm
device-mapper-libs-1.02.175-1.fc34.x86_64.rpm
diffutils-3.7-8.fc34.x86_64.rpm
dracut-055-6.fc34.x86_64.rpm
elfutils-debuginfod-client-0.186-1.fc34.x86_64.rpm
elfutils-default-yama-scope-0.186-1.fc34.noarch.rpm
elfutils-libelf-0.186-1.fc34.x86_64.rpm
elfutils-libs-0.186-1.fc34.x86_64.rpm
expat-2.4.7-1.fc34.x86_64.rpm
fedora-gpg-keys-34-2.noarch.rpm
fedora-release-34-39.noarch.rpm
fedora-release-common-34-39.noarch.rpm
fedora-release-identity-basic-34-39.noarch.rpm
fedora-repos-34-2.noarch.rpm
file-5.39-7.fc34.x86_64.rpm
file-libs-5.39-7.fc34.x86_64.rpm
filesystem-3.14-5.fc34.x86_64.rpm
findutils-4.8.0-2.fc34.x86_64.rpm
flac-libs-1.3.3-7.fc34.x86_64.rpm
fontconfig-2.13.94-5.fc34.x86_64.rpm
fonts-filesystem-2.0.5-5.fc34.noarch.rpm
freetype-2.10.4-3.fc34.x86_64.rpm
fribidi-1.0.11-3.fc34.x86_64.rpm
fuse-libs-2.9.9-11.fc34.x86_64.rpm
gawk-5.1.0-3.fc34.x86_64.rpm
gawk-all-langpacks-5.1.0-3.fc34.x86_64.rpm
gdbm-libs-1.19-2.fc34.x86_64.rpm
gdk-pixbuf2-2.42.6-1.fc34.x86_64.rpm
gdk-pixbuf2-modules-2.42.6-1.fc34.x86_64.rpm
gettext-0.21-4.fc34.x86_64.rpm
gettext-libs-0.21-4.fc34.x86_64.rpm
glib2-2.68.4-1.fc34.x86_64.rpm
glibc-2.33-21.fc34.x86_64.rpm
glibc-common-2.33-21.fc34.x86_64.rpm
glibc-doc-2.33-21.fc34.noarch.rpm
glibc-minimal-langpack-2.33-21.fc34.x86_64.rpm
gmp-6.2.0-6.fc34.x86_64.rpm
gnutls-3.7.4-1.fc34.x86_64.rpm
gobject-introspection-1.68.0-4.fc34.x86_64.rpm
graphite2-1.3.14-7.fc34.x86_64.rpm
grep-3.6-2.fc34.x86_64.rpm
grub2-common-2.06-9.fc34.noarch.rpm
grub2-tools-2.06-9.fc34.x86_64.rpm
grub2-tools-minimal-2.06-9.fc34.x86_64.rpm
grubby-8.40-51.fc34.x86_64.rpm
gsm-1.0.19-5.fc34.x86_64.rpm
gstreamer1-1.19.1-2.1.18.4.fc34.x86_64.rpm
gtk3-3.24.30-1.fc34.x86_64.rpm
gtk-update-icon-cache-3.24.30-1.fc34.x86_64.rpm
gzip-1.10-5.fc34.x86_64.rpm
harfbuzz-2.7.4-3.fc34.x86_64.rpm
hicolor-icon-theme-0.17-10.fc34.noarch.rpm
iptables-legacy-libs-1.8.7-8.fc34.x86_64.rpm
jbigkit-libs-2.1-21.fc34.x86_64.rpm
json-c-0.14-8.fc34.x86_64.rpm
kbd-2.4.0-2.fc34.x86_64.rpm
kbd-misc-2.4.0-2.fc34.noarch.rpm
keybinder3-0.3.2-11.fc34.x86_64.rpm
keyutils-libs-1.6.1-2.fc34.x86_64.rpm
kmod-29-2.fc34.x86_64.rpm
kmod-libs-29-2.fc34.x86_64.rpm
kpartx-0.8.5-4.fc34.x86_64.rpm
krb5-libs-1.19.2-5.fc34.x86_64.rpm
langpacks-core-font-en-3.0-14.fc34.noarch.rpm
lcms2-2.12-1.fc34.x86_64.rpm
libacl-2.3.1-1.fc34.x86_64.rpm
libarchive-3.5.2-2.fc34.x86_64.rpm
libargon2-20171227-6.fc34.x86_64.rpm
libasyncns-0.8-20.fc34.x86_64.rpm
libattr-2.5.1-1.fc34.x86_64.rpm
libblkid-2.36.2-1.fc34.x86_64.rpm
libbpf-0.4.0-1.fc34.x86_64.rpm
libbrotli-1.0.9-4.fc34.x86_64.rpm
libcanberra-0.30-24.fc34.x86_64.rpm
libcanberra-gtk3-0.30-24.fc34.x86_64.rpm
libcap-2.48-2.fc34.x86_64.rpm
libcap-ng-0.8.2-4.fc34.x86_64.rpm
libcbor-0.7.0-3.fc34.x86_64.rpm
libcloudproviders-0.3.1-3.fc34.x86_64.rpm
libcom_err-1.45.6-5.fc34.x86_64.rpm
libcurl-7.76.1-12.fc34.x86_64.rpm
libdatrie-0.2.13-1.fc34.x86_64.rpm
libdb-5.3.28-49.fc34.x86_64.rpm
libeconf-0.4.0-1.fc34.x86_64.rpm
libepoxy-1.5.9-1.fc34.x86_64.rpm
libevent-2.1.12-3.fc34.x86_64.rpm
libfdisk-2.36.2-1.fc34.x86_64.rpm
libffi-3.1-28.fc34.x86_64.rpm
libfido2-1.6.0-2.fc34.x86_64.rpm
libgcc-11.3.1-2.fc34.x86_64.rpm
libgcrypt-1.9.3-3.fc34.x86_64.rpm
libgomp-11.3.1-2.fc34.x86_64.rpm
libgpg-error-1.42-1.fc34.x86_64.rpm
libgusb-0.3.8-1.fc34.x86_64.rpm
libibverbs-37.2-2.fc34.x86_64.rpm
libICE-1.0.10-6.fc34.x86_64.rpm
libicu-67.1-7.fc34.x86_64.rpm
libidn2-2.3.2-1.fc34.x86_64.rpm
libjpeg-turbo-2.0.90-3.fc34.x86_64.rpm
libkcapi-1.2.1-1.fc34.x86_64.rpm
libkcapi-hmaccalc-1.2.1-1.fc34.x86_64.rpm
libmount-2.36.2-1.fc34.x86_64.rpm
libnghttp2-1.43.0-2.fc34.x86_64.rpm
libnl3-3.5.0-6.fc34.x86_64.rpm
libnsl2-1.3.0-2.fc34.x86_64.rpm
libogg-1.3.4-4.fc34.x86_64.rpm
libpcap-1.10.1-1.fc34.x86_64.rpm
libpng-1.6.37-10.fc34.x86_64.rpm
libpsl-0.21.1-3.fc34.x86_64.rpm
libpwquality-1.4.4-6.fc34.x86_64.rpm
libseccomp-2.5.3-1.fc34.x86_64.rpm
libselinux-3.2-1.fc34.x86_64.rpm
libsemanage-3.2-1.fc34.x86_64.rpm
libsepol-3.2-2.fc34.x86_64.rpm
libsigsegv-2.13-2.fc34.x86_64.rpm
libSM-1.2.3-8.fc34.x86_64.rpm
libsmartcols-2.36.2-1.fc34.x86_64.rpm
libsndfile-1.0.31-6.fc34.x86_64.rpm
libssh-0.9.6-1.fc34.x86_64.rpm
libssh-config-0.9.6-1.fc34.noarch.rpm
libstdc++-11.3.1-2.fc34.x86_64.rpm
libtasn1-4.16.0-4.fc34.x86_64.rpm
libtdb-1.4.3-6.fc34.x86_64.rpm
libtextstyle-0.21-4.fc34.x86_64.rpm
libthai-0.1.28-6.fc34.x86_64.rpm
libtiff-4.2.0-1.fc34.x86_64.rpm
libtirpc-1.3.2-0.fc34.x86_64.rpm
libtool-ltdl-2.4.6-40.fc34.x86_64.rpm
libunistring-0.9.10-10.fc34.x86_64.rpm
libunwind-1.4.0-5.fc34.x86_64.rpm
libusbx-1.0.24-2.fc34.x86_64.rpm
libutempter-1.2.1-4.fc34.x86_64.rpm
libuuid-2.36.2-1.fc34.x86_64.rpm
libverto-0.3.2-1.fc34.x86_64.rpm
libvorbis-1.3.7-3.fc34.x86_64.rpm
libwayland-client-1.20.0-4.fc34.x86_64.rpm
libwayland-cursor-1.20.0-4.fc34.x86_64.rpm
libwayland-egl-1.20.0-4.fc34.x86_64.rpm
libwebp-1.2.2-1.fc34.x86_64.rpm
libX11-1.7.2-3.fc34.x86_64.rpm
libX11-common-1.7.2-3.fc34.noarch.rpm
libX11-xcb-1.7.2-3.fc34.x86_64.rpm
libXau-1.0.9-6.fc34.x86_64.rpm
libxcb-1.13.1-7.fc34.x86_64.rpm
libXcomposite-0.4.5-5.fc34.x86_64.rpm
libxcrypt-4.4.28-1.fc34.x86_64.rpm
libxcrypt-compat-4.4.28-1.fc34.x86_64.rpm
libXcursor-1.2.0-5.fc34.x86_64.rpm
libXdamage-1.1.5-5.fc34.x86_64.rpm
libXext-1.3.4-6.fc34.x86_64.rpm
libXfixes-6.0.0-1.fc34.x86_64.rpm
libXft-2.3.3-6.fc34.x86_64.rpm
libXi-1.7.10-6.fc34.x86_64.rpm
libXinerama-1.1.4-8.fc34.x86_64.rpm
libxkbcommon-1.3.0-1.fc34.x86_64.rpm
libxml2-2.9.13-1.fc34.x86_64.rpm
libXrandr-1.5.2-6.fc34.x86_64.rpm
libXrender-0.9.10-14.fc34.x86_64.rpm
libXtst-1.2.3-14.fc34.x86_64.rpm
libzstd-1.5.2-1.fc34.x86_64.rpm
lua-libs-5.4.4-1.fc34.x86_64.rpm
lz4-libs-1.9.3-2.fc34.x86_64.rpm
memstrack-0.2.2-1.fc34.x86_64.rpm
mkpasswd-5.5.10-1.fc34.x86_64.rpm
mpfr-4.1.0-7.fc34.x86_64.rpm
ncurses-6.2-4.20200222.fc34.x86_64.rpm
ncurses-base-6.2-4.20200222.fc34.noarch.rpm
ncurses-libs-6.2-4.20200222.fc34.x86_64.rpm
nettle-3.7.3-1.fc34.x86_64.rpm
openldap-2.4.57-6.fc34.x86_64.rpm
openssl-libs-1.1.1n-1.fc34.x86_64.rpm
openssl-pkcs11-0.4.11-2.fc34.x86_64.rpm
opus-1.3.1-8.fc34.x86_64.rpm
os-prober-1.77-7.fc34.x86_64.rpm
p11-kit-0.23.22-3.fc34.x86_64.rpm
p11-kit-trust-0.23.22-3.fc34.x86_64.rpm
pam-1.5.1-8.fc34.x86_64.rpm
pango-1.48.11-1.fc34.x86_64.rpm
pcre2-10.36-4.fc34.x86_64.rpm
pcre2-syntax-10.36-4.fc34.noarch.rpm
pcre-8.44-3.fc34.1.x86_64.rpm
pigz-2.5-1.fc34.x86_64.rpm
pixman-0.40.0-3.fc34.x86_64.rpm
popt-1.18-4.fc34.x86_64.rpm
procps-ng-3.3.17-1.fc34.1.x86_64.rpm
publicsuffix-list-dafsa-20190417-5.fc34.noarch.rpm
pulseaudio-libs-14.2-3.fc34.x86_64.rpm
python3-3.9.12-1.fc34.x86_64.rpm
python3-cairo-1.20.1-1.fc34.x86_64.rpm
python3-configobj-5.0.6-23.fc34.noarch.rpm
python3-dbus-1.2.18-1.fc34.x86_64.rpm
python3-gobject-3.40.1-1.fc34.x86_64.rpm
python3-gobject-base-3.40.1-1.fc34.x86_64.rpm
python3-libs-3.9.12-1.fc34.x86_64.rpm
python3-pip-21.0.1-4.fc34.noarch.rpm
python3-psutil-5.8.0-5.fc34.x86_64.rpm
python3-setuptools-53.0.0-3.fc34.noarch.rpm
python3-six-1.15.0-5.fc34.noarch.rpm
python-pip-wheel-21.0.1-4.fc34.noarch.rpm
python-setuptools-wheel-53.0.0-3.fc34.noarch.rpm
python-unversioned-command-3.9.12-1.fc34.noarch.rpm
qrencode-libs-4.1.1-1.fc34.x86_64.rpm
readline-8.1-2.fc34.x86_64.rpm
rpm-4.16.1.3-1.fc34.x86_64.rpm
rpm-libs-4.16.1.3-1.fc34.x86_64.rpm
sed-4.8-7.fc34.x86_64.rpm
setup-2.13.7-3.fc34.noarch.rpm
shadow-utils-4.8.1-10.fc34.x86_64.rpm
shared-mime-info-2.1-2.fc34.x86_64.rpm
sound-theme-freedesktop-0.8-15.fc34.noarch.rpm
sqlite-libs-3.34.1-2.fc34.x86_64.rpm
systemd-248.10-1.fc34.x86_64.rpm
systemd-libs-248.10-1.fc34.x86_64.rpm
systemd-networkd-248.10-1.fc34.x86_64.rpm
systemd-pam-248.10-1.fc34.x86_64.rpm
systemd-rpm-macros-248.10-1.fc34.noarch.rpm
systemd-udev-248.10-1.fc34.x86_64.rpm
terminator-2.1.1-1.fc34.noarch.rpm
tpm2-tss-3.1.0-1.fc34.x86_64.rpm
tzdata-2022a-1.fc34.noarch.rpm
util-linux-2.36.2-1.fc34.x86_64.rpm
vte291-0.64.2-1.fc34.x86_64.rpm
vte-profile-0.64.2-1.fc34.x86_64.rpm
which-2.21-26.fc34.x86_64.rpm
whois-nls-5.5.10-1.fc34.noarch.rpm
xkeyboard-config-2.33-1.fc34.noarch.rpm
xml-common-0.6.3-56.fc34.noarch.rpm
xz-5.2.5-9.fc34.x86_64.rpm
xz-libs-5.2.5-9.fc34.x86_64.rpm
zlib-1.2.11-26.fc34.x86_64.rpm

If there is a need to download a GROUP of packages such as Gnome Desktop, you may do the following

# dnf -y group install "Basic Desktop" GNOME  --installroot=/installroot  --downloadonly --downloaddir=/tmp/repo -releasever=34

*note: If you need to re-download them again on the same system you should make a new /installroot directory.

]]>
259
List only ethernet Network Adapters on Debian/Fedora https://datastorageguy.com/2023/09/07/list-only-ethernet-network-adapters-on-debian-fedora/ Thu, 07 Sep 2023 19:14:12 +0000 https://datastorageguy.com/?p=257 Sometimes you want a quick way to verify all ethernet network adapters that are seen by the kernel at boot time. I find going directly to the pseudo filesystem is the fastest.

For example.

# ls /sys/class/net|egrep -v "^vir|^lo|^wl"
enp1s0

Similarly, you an modify the egrep accordingly if you want to view wifi and ethernet adapters and exclude any bridge or virtual adapters

# ls /sys/class/net|egrep -v "^v|^b|lo"
eno1
wlp3s0

]]>
257
Remove any potential special characters or spaces from an IP address using AWK https://datastorageguy.com/2023/07/12/remove-any-potential-special-characters-or-spaces-from-an-ip-address-using-awk/ Thu, 13 Jul 2023 00:26:30 +0000 https://datastorageguy.com/?p=249 Got stuck earlier in an interesting regex mystery and I command-line FU'd an AWK Solution.

PROBLEM

I want to strip out all spaces and/or special characters from an IP address

PROCESS

I know how to validate an IP address no problem..


Good IPO

# echo 192.168.1.122 |egrep -q  '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'; echo $?
0

Bad IP

# echo 192.168.xxx.111  |egrep -q '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'; echo $?
1

However..

What if am gathering user input via script and I want to strip out any and ALL characters except the numeric IP Address!

For example,

If IP

' _192. 168.122.35'_   "

And I want to only display

192.168.122.35

Leading/trailing spaces can be stripped no problem, but it will still print the special characters

# echo "   _192. 168.122.35'_   "|awk '{gsub(/^[[:space:]]+|[[:space:]]+$/,"",$0); print}'
_192. 168.122.35'_
#


SOLUTION

I put together the following awk script to strip out everything and ONLY print the IP address.

awk -F "." '{for (i=1;i<=NF;i++) {sub("[^[:digit:]]+", "", $i);gsub(/^[[:space:]]+|[[:space:]]+$/,"",$i);if (i < NF) {p="."}else{p=""}  ;printf $i p}}'

Example

#  echo ' _ 192 .168 .120.111 "@  '|awk -F "." '{for (i=1;i<=NF;i++) {sub("[^[:digit:]]+", "", $i);gsub(/^[[:space:]]+|[[:space:]]+$/,"",$i);if (i < NF) {p="."}else{p=""}  ;printf $i p}}'
192.168.120.111
#

To put it all together in a quick script called 'btest'

#!/bin/bash
if [ $# != 0 ]; then
        if [ $(echo "$1"  |egrep -q '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'; echo $?) == 0 ]; then
                echo "Validated IP address [$1]"
                IP=$(echo "$1"|awk -F "." '{for (i=1;i<=NF;i++) {sub("[^[:digit:]]+", "", $i);gsub(/^[[:space:]]+|[[:space:]]+$/,"",$i);if (i < NF) {p="."}else{p=""}  ;printf $i p}}')
                echo "Corrected IP Address=$IP"
        else
                echo "Invalid IP address [$1]"
        fi

else
        echo "Enter IP address"
fi

If we were to enter an IP address of "192.168.1.11'" which contains a 'tick' at the end , the initial Validation would succeed.

But I can then show you how we use awk to strip out any misc characters

# ./btest "192.168.1.11'"
Validated IP address [192.168.1.11']
Corrected IP Address [192.168.1.11]

If we were to add leading and trailing white spaces on the argument we can see that it is still corrected

# ./btest " 192.168.1.11' "
Validated IP address [ 192.168.1.11' ]
Ensuring IP does not have any special characters or spaces
Corrected IP Address [192.168.1.11]

If we type an invalid IP Address we see it is caught

# ./btest " 192.168.1.xx' "
Invalid IP address [ 192.168.1.xx' ]

If I got extra wild and crazy and used the following for an IP address we would see it would still succeed

# ./btest ' _ 192.168.120.111 "@  '
Validated IP address [ _ 192.168.120.111 "@  ]
Corrected IP Address [192.168.120.111]

Now to put it all together into a script that will gather user input

#!/bin/bash
e=0
while [ $e == 0 ]; do
        printf "Enter IP address > "
        read ip
        if [ ! -z "$ip" ]; then
                if [ $(echo "$ip"  |egrep -q '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'; echo $?) == 0 ]; then
                        echo "Validated IP address [$ip]"
                        ip=$(echo "$ip"|awk -F "." '{for (i=1;i<=NF;i++) {sub("[^[:digit:]]+", "", $i);gsub(/^[[:space:]]+|[[:space:]]+$/,"",$i);if (i < NF) {p="."}else{p=""}  ;printf $i p}}')
                        echo "Corrected IP Address [$ip]"
                        e=1
                else
                        echo "Invalid IP address [$ip]"
                        e=0
                fi

        else
                echo "ERROR: Enter IP address"
        fi
done

Example 1

# ./btest
Enter IP address > 192.168.1.222
Validated IP address [192.168.1.222]
Corrected IP Address [192.168.1.222]

Example 2

# ./btest
Enter IP address > '192.168.122.111 '
Validated IP address ['192.168.122.111 ']
Ensuring IP does not have any special characters or spaces
Corrected IP Address [192.168.122.111]
]]>
249
Sudo password fails even though it is correct [Fedora] https://datastorageguy.com/2023/04/15/sudo-password-fails-even-though-it-is-correct-fedora/ Sat, 15 Apr 2023 23:49:59 +0000 https://datastorageguy.com/?p=234 Newer fedora distros keep track of authentication failure attempts.

This may prevent sudo from working even though the password is correct!

In this example, I verified my user 'ben' is in /etc/sudoers

# grep ben /etc/sudoers
ben     ALL=(ALL)       ALL


Yet when I performed a simple operation the password was not accepted

# su - ben
[ben@bedora37]$ 
[ben@bedora37]$ sudo bash -c ls
[sudo] password for ben:
Sorry, try again.
[sudo] password for ben:
Sorry, try again.

I could verify the password I am using is correct by performing an SSH to localhost

# ssh ben@localhost
password
#

The problem in this case was that I needed to reset the failure lock

# faillock
ben:
When                Type  Source                                           Valid
2023-04-15 16:33:01 TTY   /dev/pts/1                                           V
2023-04-15 16:33:10 TTY   /dev/pts/1                                           V
2023-04-15 16:33:20 TTY   /dev/pts/1                                           V
root:
When                Type  Source                                           Valid

I reset via

# faillock --user ben --reset
#

Now my simple ls works

# su - ben
[ben@bedora37]$ 
[ben@bedora37]$ sudo bash -c ls
[sudo] password for ben:
Desktop  Documents  Downloads  logs  Music  Pictures  Public  snap Videos
[ben@bedora37]$ 
]]>
234
Obtain list of all physical hard drives (SSD, NVMe, VDA, HDD) https://datastorageguy.com/2023/03/20/obtain-list-of-all-physical-hard-drives-ssd-nvme-vda-hdd/ Mon, 20 Mar 2023 22:55:27 +0000 https://datastorageguy.com/?p=229 I came across an issue recently whereby I had a need to display all physical hard drives on a system whether it be HDD, VHD, or SSD (NVMe) drives that were above a certain size, excluding any USB or CD-ROM/DVD drives.

In the following example I needed to obtain the first drive that was larger than 50GB

#!/bin/bash
DIR=/sys/block
MINSIZE=50                  #Min size of drive in GB to look for
declare drive_type
drive_type=( "nvme" "sd" "hd" "vd" )
for t in ${drive_type[@]}; do
        if [ $(ls $DIR/|grep -q "^$t";echo $?) == 0 ]; then
                for d in $DIR/${t}*; do
                  DEV=`basename "$d"`
                  if [[ (  -d $DIR/$DEV  ||  -L $DIR/$DEV )  &&   ( $(cat $DIR/$DEV/removable) == 0 ) ]]; then
                    if [ -f $DIR/$DEV/size ]; then
                        GB=$((`cat $DIR/$DEV/size`/2**21))
                        if [ $GB -gt $MINSIZE ]; then
                                echo "Disk device $DEV has size $GB GB"
                                break 2
                        fi
                    fi
                  fi
                done
        fi
done

Example

$ bash drivesize.sh
Disk device nvme0n1 has size 1788 GB

Another variation is if I wanted to list all physical drives and their sizes I can modify the above to simplify:

#!/bin/bash
DIR=/sys/block
declare drive_type
drive_type=( "nvme" "sd" "hd" "vd" )
for t in ${drive_type[@]}; do
        if [ $(ls $DIR/|grep -q "^$t";echo $?) == 0 ]; then
                for d in $DIR/${t}*; do
                  DEV=`basename "$d"`
                  if [[ (  -d $DIR/$DEV  ||  -L $DIR/$DEV )  &&   ( $(cat $DIR/$DEV/removable) == 0 ) ]]; then
                    if [ -f $DIR/$DEV/size ]; then
                        GB=$((`cat $DIR/$DEV/size`/2**21))
                        echo "Disk device $DEV has size $GB GB"
                    fi
                  fi
                done
        fi
done

Example

$ bash drivesize_all.sh
Disk device nvme0n1 has size 1788 GB
Disk device nvme10n1 has size 1788 GB
Disk device nvme11n1 has size 1788 GB
Disk device nvme12n1 has size 1788 GB
Disk device nvme13n1 has size 1788 GB
Disk device nvme14n1 has size 1788 GB
Disk device nvme15n1 has size 1788 GB
Disk device nvme16n1 has size 1788 GB
Disk device nvme17n1 has size 1788 GB
Disk device nvme18n1 has size 1788 GB
Disk device nvme19n1 has size 1788 GB
Disk device nvme1n1 has size 1788 GB
Disk device nvme20n1 has size 1788 GB
Disk device nvme21n1 has size 1788 GB
Disk device nvme22n1 has size 1788 GB
Disk device nvme23n1 has size 1788 GB
Disk device nvme2n1 has size 1788 GB
Disk device nvme3n1 has size 1788 GB
Disk device nvme4n1 has size 1788 GB
Disk device nvme5n1 has size 1788 GB
Disk device nvme6n1 has size 1788 GB
Disk device nvme7n1 has size 1788 GB
Disk device nvme8n1 has size 1788 GB
Disk device nvme9n1 has size 1788 GB
Disk device sda has size 894 GB
Disk device sdb has size 894 GB

]]>
229
iterm2 adds line break when copying text https://datastorageguy.com/2022/10/10/iterm2-adds-line-break-when-copying-text/ Mon, 10 Oct 2022 20:50:49 +0000 https://datastorageguy.com/?p=226 I had an issue that drove me crazy for weeks.

When I would highlight text in iterm2 to copy it, upon pasting it would always add a carriage return (line-break) at the end of the line. Thus the line that I copied would not be contiguous.

This is extremely annoying when attempting to copy log file contents.

The solution was simpler and somewhat counter intuitive.

In iterm2 there is an option under Preferences --> General --> Selection

Check "Copied text includes trailing newline"

]]>
226
Double click select entire word in terminal (iterm2) on MAC OSX https://datastorageguy.com/2022/10/03/double-click-select-entire-word-in-terminal-iterm-on-mac-osx/ Mon, 03 Oct 2022 22:03:19 +0000 https://datastorageguy.com/?p=220 I have had issues when using Remote Desktop Manager Free (RDM) for MAC OSX.

Firstly ensure that you have iterm2 selected as the terminal

Next you want to be sure you are using the Legacy Engine set to NO under

Preferences > Types > Terminal:

I filed a bug with Devolutions and here is the reference link: https://forum.devolutions.net/topics/35957/doubleclick-select-in-terminal

]]>
220
Determine the Active Network Interface and IP address from Terminal on a MAC https://datastorageguy.com/2022/09/28/determine-the-active-network-interface-and-ip-address-from-terminal-on-a-mac/ Wed, 28 Sep 2022 21:00:59 +0000 https://datastorageguy.com/?p=216 On a MAC (OSX) Using the command line (Terminal) often you want a quick way to determine the Active Network Interfaces along with the IP address.

Here is a quick 'alias' you can make to get the IP(s)

# scutil --nwi|awk 'BEGIN {s=0} $0 ~ /^IPv4/ {s=1;next} s==1 && $0 ~ /flags/ {intf=$1;next} s==1 && $1 ~ /address/ {ip=$NF; print intf,ip} $1 ~ /REACH/{exit}'

Example Output

# scutil --nwi|awk 'BEGIN {s=0} $0 ~ /^IPv4/ {s=1;next} s==1 && $0 ~ /flags/ {intf=$1;next} s==1 && $1 ~ /address/ {ip=$NF; print intf,ip} $1 ~ /REACH/{exit}'
en9 192.168.1.88

Creating a small bash script in /usr/local/bin/ so you can reference it anytime.

#!/bin/bash
# scutil --nwi|awk 'BEGIN {s=0} $0 ~ /^IPv4/ {s=1;next} s==1 && $0 ~ /flags/ {intf=$1;next} s==1 && $1 ~ /address/ {ip=$NF; print intf,ip} $1 ~ /REACH/{exit}'

If you wish to only view the active interfaces on MAC OS you can do the following and create an alias for it

#ifconfig | pcregrep -M -o '^[^\t:]+(?=:([^\n]|\n\t)*status: active)'

Example Output

# ifconfig | pcregrep -M -o '^[^\t:]+(?=:([^\n]|\n\t)*status: active)'
en9
en6
]]>
216