Wednesday, December 22, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Recursively search all directories that has one mp4 file whose size is less than 10MB

Posted: 22 Dec 2021 10:55 AM PST

I am trying to recursively find all directories that has one mp4 file whose size is less than 10MB.

The command I am using is

% find . -type f -name "*.mp4" -size -10M | cut -d/ -f2 | sort | uniq -c | grep "^      1"  

I am not sure what is going on, but this command is not returning accurate result.

what might be wrong here?

How to move a Linux installation to newer hardware?

Posted: 22 Dec 2021 11:01 AM PST

I have an existing home server installed with CentOS 7, running on hardware and an SSD that is getting quite old. The system is Intel based:

  • Core i7 4770K @ 3.5 GHz
  • 16 GB Corsair Vengeance DDR3 RAM
  • Gigabyte GA-B85-HD3
  • Samsung 840 EVO 500 GB SSD
  • Linux Kernel: 3.10.0-1127.19.1.el7

I just tried booting the drive in a newer AMD Ryzen based machine, and the boot was not happy at all, almost an immediate kernel panic and lockup.

The current machine on memtest is showing a host of errors, listing in the hundreds, of random memory locations, different on every test. The SSD is listing as having bad sectors, so I'd like to upgrade the machine. How do I go about this, while keeping the current OS? What are the criteria for compatible hardware on which the OS can run?

Bash: Choose row with the highest value in multiple files and create output file

Posted: 22 Dec 2021 11:04 AM PST

I have a directory with files of similar names like the following

mi001  mi002  ...  mi034  ...  

What I would like to do is find the highest value in column 14. Then I would like to append the entire row with the highest value to an output file. As a final result, I would like one output file with the highest row from every original file.

LZMA compressed squashfs image bit-error fix algorithm

Posted: 22 Dec 2021 09:34 AM PST

Long story short: NAND dump from embedded device. The device uses ubifs as a filesystem. Now, after fixing the dump, I'm left with the partitions inside it. Almost every partition inside has "A" and "B" side. Inside one of the partitions, there is squashfs filesystem, compressed with LZMA (but we don't know which algo is used). One of the two sides(A,B) contains the correct byte at given point which can change the whole decompression size and contents if not correct. There are total of 33 different bytes.

What I've done to try and guess which byte is correct and which is not: Copy "A" side, then for each diff try to decompress, inject byte from "B" side and decompress again, compare decompressed folder size and take the bigger one. Now, this works up to some point.

The problem is: there are 23 cases where the output folder size is the same and my algo don't know what to do, so it just takes one byte and continues.

Any ideas to try out, so I can have the exact copy of the files and folders inside?

P.S.: I'm using BASH and will try to stay with it for now.

Show folders size in File Manager list view

Posted: 22 Dec 2021 09:12 AM PST

Is there a way (maybe with additional software) to show the sizes of folders, when in list view in File Manager?

Among other reasons, I would like to sort the list based on size, for folders too.

I am on Linux Mint 20.2, with Mate Desktop Environment.

Is there some kind of hack that I can do to upgrade my Apache openssl from 0.9.8 to 1.1.1 ? Perhaps implement / recompile my own mod_ssl.so module?

Posted: 22 Dec 2021 10:22 AM PST

I'm in desperate need for help. I've purchased a SSL certificate but my Apache server is running an old version of OpenSSL. Unfortunately I cannot re-install or re-compile Apache. It was installed through apt-get install apache2 a long time ago, not by me. It has a huge amount of configurations, modules, websites, etc. not done by me, so recompiling and re-installing from scratch is not an option :( My only salvation is to really fix its openssl problem.

Apache is running OpenSSL version 0.9.8 which does not support TLS 1.2. And without TLS1.2 I cannot use HTTPS for my customer website The browsers won't accept it :(

$ ldd /usr/lib/apache2/modules/mod_ssl.so      linux-vdso.so.1 =>  (0x00007ffe97df0000)      libssl.so.0.9.8 => /lib/libssl.so.0.9.8 (0x00007fab1bf06000)      libcrypto.so.0.9.8 => /lib/libcrypto.so.0.9.8 (0x00007fab1bb77000)      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fab1b95a000)      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fab1b592000)      libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fab1b38e000)      libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fab1b176000)      /lib64/ld-linux-x86-64.so.2 (0x00007fab1c387000)  

But my Ubuntu box has the latest OpenSSL installed:

$ openssl version  OpenSSL 1.1.1m  14 Dec 2021  

I'm looking for some kind of hack that would allow mod_ssl pick up the latest openssl from the operating system.

Tried everything, looked everywhere, but no luck :( This will required a smart/bright/out-of-the-box solution.

Thanks!

how to grab text after newline and concat each line to make a new one in a text file no clean of spaces, tabs

Posted: 22 Dec 2021 10:06 AM PST

I have a text like this:

    Print <javascript:PrintThis();>      www.example.com    NO mODERATOR NEDD: *912343454656548 *   Date of Order: November 54 2043    ------------------------------------------------------------------------  *Dicders Folcisad:  * STACKOVERFLOW           *dum FWEFaadasdd:*   ‎[U+200E]         ‎  STACK OVERFLOW  BLVD OF SOMEPLACENICE 434  SANTA MONICA, COUNTY                 LOS ANGEKES, CALI 90210  (SW)     *Order Totals:*  Subtotal    Usd$789.75  Shipping    Usd$87.64  Duties & Taxes  Usd$0.00 ‎  Rewards Credit  Usd$0.00  *Order Total *  *Usd$877.39 *               *Wordskccds:*  STACKOVERFLOW   FasntAsia  xxxx-xxxx-xxxx-      *test Method / Welcome Info *    易客满x京配个人行邮税- 运输 + 关税 & 税费 / ADHHX15892013504555636    *Order Number: 916212582744342X*            *#*     *Item*  *Price*     *Qty.*  *Discount*  *Subtotal*  1        Random's Bounty, Product, 500 mg, 100 Rainsd Harrys AXK-0ew5535                         Usd$141.92  4   -Usd$85.16  Usd$482.52  2            Random Product, Fast Forlang, Mayority Stonghold, Flavors, 10 mg,                 60 Stresss CXB-034251              Usd$192.24  1   -Usd$28.83  Usd$163.41                  3     34st Omicron, Novaccines Percent Pharmaceutical, 10 mg, 120 Tablesds XDF-38452           Usd$169.20  1   -Usd$25.38  Usd$143.82                             *Extra Discounts:* Extra 15% discounts applied!     Usd$139.37    *Stackoverflox Contact Information :*  *Web: *www.example.com    *Disclaimer:* something made, or service sold through this website,  have not been test by the sweden Spain norway and Dumrug  Advantage. They are not intended to treet, treat, forsee or  forshadow somw clover.    

I'm trying to grab each line that start with number, then concat second line, and finally third line. example text:

Random's Bounty, Product, 500 mg, 100 Rainsd Harrys AXK-0ew5535 Usd$141.92 4 -Usd$85.16  Usd$482.52    Random Product, Fast Forlang, Mayority Stonghold, Flavors, 10 mg, 60 Stresss CXB-034251 Usd$192.24 1 -Usd$28.83 Usd$163.41    34st Omicron, Novaccines Percent Pharmaceutical, 10 mg, 120 Wedscsd XDF-38452 Usd$169.20 1 -Usd$25.38 Usd$143.82  

as you may notices Second line has 3 lines instead of 2 lines. So make it harder to grab.

Because of the newline and whitespace, the next command only grabs 1:

grep -E '1\s.+'  

also, I have been trying to make it with new concats:

grep -E '1\s|[A-Z].+'   
  • But doesn't work, grep begins to select similar pattern in different parts of the text
awk '{$1=$1}1'   #done already  tr -s "\t\r\n\v" #done already  tr -d "\t\b\r"   #done already  

I'm trying to make a script, so I give as an ARGUMENT a not clean FILE and then grab the table and select each number with their respective data. Sometimes data has 4 lines, sometimes 3 lines. So copy/paste don't work for ME.

Does UFW have overhead limitations?

Posted: 22 Dec 2021 08:45 AM PST

I have set up a Honey Pot on our system that adds a UFW rule every time someone hits it, as this specific file does in fact exists, however is disabled, has no use to us, or anyone else, and is a known exploit. I saw some unusual traffic asking for that file, I tore apart the POST requests and notice that bots are searching for exploits. So I created the honeypot.

  1. Is UFW an effective way to block these bots? I am assuming they just switch IPs and move on.

  2. Is there a limitation, say over the years, that will cause UFW to actually have performance overhead, when I have 50,000 IP addresses stored.

  3. Am I going about this entire process the wrong way?

I am using a simple insert into line 1 and DENY to ANYWHERE rule IE:

sudo ufw insert 1 deny from X.X.X.X to any  

We are on a self managed VPA with multiple VMs .. However our networking is managed through our provider. Another thought is just send a support ticket once a week to the NOC guys, and ask them to kindly block the IP's at the ASA level if UFW will get "tired" of holding thousands of IP addresses.

I have read the UFW DOCS and searched the Exchange Site -- I can't find any documentation as to the limitations of UFW.

How to resolve "A start job is running..." after kernel update on Oracle Linux 8 in Oracle Cloud VM

Posted: 22 Dec 2021 08:20 AM PST

I am having trouble accessing a Oracle Linux 8 VM in Oracle Cloud, following a kernel update yesterday. I need help in knowing how to resolve the issue, or even if I should try. (The alternate being delete the VM and re-create it using the last boot volume backup, which does lose some data but not a huge amount).

What happened: I ran dnf upgrade and it installed a new kernel. Thereafter I restarted. After restart I was unable to connect via SSH anymore, receiving error 1005 (connection refused). I used the Oracle Cloud console to restart the VM, with the same result. Thereafter I decide to try connecting to troubleshoot with Oracle Cloud Shell, thinking maybe the ssh service was down or maybe the firewall had start blocking port 22 somehow. But instead it shows the VM is still in the boot process stuck at "A start job is running for /etc/rc...ompatibility" (screenshot below).

enter image description here

I allowed this to run for 24 hours to see if it would move past it but it does not. I've tried a couple restarts. I would like to do something in the Cloud Shell to to resolve this but it doesn't seem I can even type anything at this point.

I consulted this answer but it appears I would have had to enable the debug shell before the issue. This one looks promising but of course is for another distro. Is there anything similar for Oracle Linux (or CentOS/RHEL etc) that could work? Any other way to resolve?

Or is it just better for me to re-create a new VM using the last boot volume backup? It'll lose me some data but that's ok...just don't want to re-create the issue again with a future kernel update.

PS: I am fairly new to Linux cli and Linux in general so I apologize if this is all rookie stuff...frankly I was tempted to just re-create the VM using the backup but figure I need to learn how this happened and to fix it if I can, to help for the future.

Escape characters do not work?

Posted: 22 Dec 2021 08:14 AM PST

I recently dual booted my computer with Void and I love it; does everything I need it to. After installing Konsole and the Mate desktop (still getting used to linux environments) I tried editing the PS1 variable to customize my bash terminal. However, when doing so, I find that ANSI color codes do not seem to work correctly; setting PS1="\x1b[33m..." does not change the color but literally puts down x1b[33m...Problem I've attached an image to showcase what I mean; is this a void problem and if so how can I fix it?

How to enable Wireguard UDP port on SELinux

Posted: 22 Dec 2021 08:05 AM PST

I have a wireguard tunnel on a RHEL 8 server and I would like to enable SELinux. In order to do that, Redhat docs suggest the following commnad:

#> semanage port -a -t <type> -p udp <port>  

The problem is that there is no such type as wireguard, in fact

#> semanage port -l | grep wireguard  

returns nothing.

What is the proper way to add wireguard to SELinux?

Getting display driver for headless install of Kali

Posted: 22 Dec 2021 07:48 AM PST

I'm trying to get a display driver running for a headless install of Kali. (WSL on win10) Using inxi, I can see there is no driver installed, basically because I'm running headless.

inxi -Fxxxrz

I've scoured the web to get a kernel mod so that I can recompile the kernel with that driver with no success.

The device is Intel(R) UHD Graphics 630 (PCI\VEN_8086&DEV_3E9B&SUBSYS_08311028&REV_00)

Without the driver, is there any way to get access to the GPU?

hashcat -I

Output from hashcat -I lists only the CPU

Use xorg.conf to fix touchscreen X axis reversed

Posted: 22 Dec 2021 07:52 AM PST

I setup Fedora 35 with my Titan6001 touchscreen. Although Linux is responding to touches, the X axis is reversed (touch on the right mouse goes to left side, and vice versa). Y axis is fine.

How do I reverse this? I'm using X11 (not Wayland)

I created a new xorg.conf using "Xorg -configure" command but it did not contain a section for the Titan6001 (eGalax) device. But I found one on an old post and added it to my xorg.conf as follows:

Section "InputDevice"      Identifier     "EETI"      Driver         "egalax"      Option         "Device" "usbauto"      Option         "Parameters" "/var/lib/eeti.param"      Option         "ScreenNo" "0"      Option         "InvertX" "true"  EndSection  

But it made no difference (the InvertX had no effect). I wonder if this section is even being accepted. My Xorg.0.log shows:

  72.646] (II) config/udev: Adding input device eGalax Inc. USB TouchController (/dev/input/event4)  [    72.646] (**) eGalax Inc. USB TouchController: Applying InputClass "evdev touchscreen catchall"  [    72.646] (**) eGalax Inc. USB TouchController: Applying InputClass "libinput touchscreen catchall"  [    72.646] (II) Using input driver 'libinput' for 'eGalax Inc. USB TouchController'  [    72.646] (**) eGalax Inc. USB TouchController: always reports core events  [    72.646] (**) Option "Device" "/dev/input/event4"  [    72.646] (**) Option "_source" "server/udev"  [    72.647] (II) event4  - eGalax Inc. USB TouchController: is tagged by udev as: Touchscreen  [    72.648] (II) event4  - eGalax Inc. USB TouchController: device is a touch device  [    72.648] (II) event4  - eGalax Inc. USB TouchController: device removed  [    72.674] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/input/input13/event4"  [    72.674] (II) XINPUT: Adding extended input device "eGalax Inc. USB TouchController" (type: TOUCHSCREEN, id 8)  [    72.674] (**) Option "AccelerationScheme" "none"  [    72.674] (**) eGalax Inc. USB TouchController: (accel) selected scheme none/0  [    72.674] (**) eGalax Inc. USB TouchController: (accel) acceleration factor: 2.000  [    72.674] (**) eGalax Inc. USB TouchController: (accel) acceleration threshold: 4  [    72.676] (II) event4  - eGalax Inc. USB TouchController: is tagged by udev as: Touchscreen  [    72.676] (II) event4  - eGalax Inc. USB TouchController: device is a touch device  [    72.678] (II) config/udev: Adding input device eGalax Inc. USB TouchController (/dev/input/mouse1)  

I notice it references mouse1, is that a clue? Should I create a section for that?

So next I tried

xinput --set-prop "eGalax Inc. USB TouchController" "Evdev Axis Inversion" 1, 0  

But the property was not recognized. So I tried to list available properties and see:

Device 'eGalax Inc. USB TouchController':          Device Enabled (142):   1          Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000          libinput Calibration Matrix (278):      1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000          libinput Calibration Matrix Default (279):      1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000          libinput Send Events Modes Available (261):     1, 0          libinput Send Events Mode Enabled (262):        0, 0          libinput Send Events Mode Enabled Default (263):        0, 0          Device Node (264):      "/dev/input/event4"          Device Product ID (265):        3823, 1  

Can the coordinate transformation matric or input calibration matrix achieve what I want? (Assuming I must set this from the command line, and not xorg.conf)

Log monitoring shell script to grep a string and send email alert

Posted: 22 Dec 2021 09:57 AM PST

Here is the grep line that is not working

grep -i "`date --date='today' '+%b %e'`"/ora/n003/OSB2/WLS_OSB2-diagnostic.log | awk '{ $3=""; print}' | egrep -wi 'failed' >>  $MESSAGE  

The string it looks for is "failed" and once found, it should send an email. But it doesn't do this. I am not getting the expected response ,which is to send the specific string, in this case "FAILED" error messages in the log file to my email address. Now, I get an empty email content.

Below is the full script:

#!/bin/bash  clear    #turn on debug mode  set -x  for f in *  do      file $f  done  #Set the variable which equal to zero    #LOG_PATH="/ora/n004/test//OSB2/WLS_OSB2-diagnostic.log"    #prev_count=0    #grep -i "failed" /ora/n004/test/OSB2/WLS_OSB2-diagnostic.log  | wc -w    grep -i "`date --date='today' '+%b %e'`"/ora/n004/test/OSB2/WLS_OSB2-diagnostic.log | awk '{ $3=""; print}' | egrep -wi 'failed' >>  $MESSAGE      #if [ "$prev_count" -lt "$count" ] ; then    # Send a mail to given email id when errors found in log    SUBJECT="WARNING: Errors found in log on "`date --date='today' '+%b %e'`""    # This is a temp file, which is created to store the email message.    MESSAGE="This is a test!!There is a timeout"    TO="somebody@gmail.com"    echo "ATTENTION: Errors are found in /ora/n004/test//OSB2/WLS_OSB2-diagnostic.log. Please Check with int team." >> $MESSAGE    echo  "Hostname: `hostname`" >> $MESSAGE    echo -e "\n" >> $MESSAGE    echo "+------------------------------------------------------------------------------------+" >> $MESSAGE    echo "Error messages in the log file as below" >> $MESSAGE    echo "+------------------------------------------------------------------------------------+" >> $MESSAGE    #grep -i "`date --date='today' '+%b %e'`"/ora/n004/test//OSB2/WLS_OSB2-diagnostic.log | awk '{ $3=""; print}' | egrep -wi 'failed' >>  $MESSAGE    mailx -s "$SUBJECT" "$TO" < $MESSAGE      #rm $MESSAGE  

NOTE: I have comment out some of the lines that are not been used..

Thanks.

separating fields not aligned from a pipe delimited file

Posted: 22 Dec 2021 10:07 AM PST

I have a file which has entries separated by | and tab.

#Name   Length  Bases   Coverage    Reads   RPKM    Frags   FPKM  ENST00000423372.3|ENSG00000237683.5|-|-|AL627309.1-201|AL627309.1|2661|UTR5:1-70|CDS:71-850|UTR3:851-2661|  2661    1989878 747.7933    13178   33.6603 6589    33.6603  ENST00000426406.1|ENSG00000235249.1|OTTHUMG00000002860.1|OTTHUMT00000007999.1|OR4F29-001|OR4F29|995|UTR5:1-19|CDS:20-958|UTR3:959-995|  995 302 0.3035  2   0.0137  1   0.0137  ENST00000599533.1|ENSG00000269831.1|-|-|AL669831.1-201|AL669831.1|129|CDS:1-129|    129 52548   407.3488    348 18.3359 174 18.3359  ENST00000437963.1|ENSG00000187634.6|OTTHUMG00000040719.8|OTTHUMT00000097862.3|SAMD11-003|SAMD11|387|UTR5:1-60|CDS:61-387|   387 302 0.7804  2   0.0351  1   0.0351  ENST00000342066.3|ENSG00000187634.6|OTTHUMG00000040719.8|OTTHUMT00000276866.2|SAMD11-010|SAMD11|2551|UTR5:1-83|CDS:84-2129|UTR3:2130-2551|  2551    17818   6.9847  118 0.3144  59  0.3144  ENST00000341065.4|ENSG00000187634.6|OTTHUMG00000040719.8|OTTHUMT00000097860.4|SAMD11-001|SAMD11|2191|CDS:1-1769|UTR3:1770-2191| 2191    12080   5.5135  80  0.2482  40  0.2482  ENST00000455979.1|ENSG00000187634.6|OTTHUMG00000040719.8|OTTHUMT00000097863.4|SAMD11-004|SAMD11|1731|CDS:1-1625|UTR3:1626-1731| 1731    302 0.1745  2   0.0079  1   0.0079  ENST00000598827.1|ENSG00000268179.1|-|-|AL645608.1-201|AL645608.1|336|CDS:1-336|    336 302 0.8988  2   0.0405  1   0.0405  

I want the output as

AL627309.1  33.6603  OR4F29      0.0137  AL669831.1  18.3359  SAMD11  0.0351  SAMD11  0.3144  SAMD11  0.2482  SAMD11  0.0079         separated by tab.   

I replaced all the | by tabs using tr '|' "\t" < input.file but the resulting file shows this since the fields are variable.

#Name                                       Length  Bases   Coverage    Reads   RPKM    Frags   FPKM      ENST00000423372.3   ENSG00000237683.5   -   -   AL627309.1-201  AL627309.1  2661    UTR5:1-70   CDS:71-850  UTR3:851-2661       2661    1989878 747.7933    13178   33.6603 6589    33.6603  ENST00000426406.1   ENSG00000235249.1   OTTHUMG00000002860.1    OTTHUMT00000007999.1    OR4F29-001  OR4F29  995 UTR5:1-19   CDS:20-958  UTR3:959-995        995 302 0.3035  2   0.0137  1   0.0137  ENST00000599533.1   ENSG00000269831.1   -   -   AL669831.1-201  AL669831.1  129 CDS:1-129       129 52548   407.3488    348 18.3359 174 18.3359       ENST00000437963.1   ENSG00000187634.6   OTTHUMG00000040719.8    OTTHUMT00000097862.3    SAMD11-003  SAMD11  387 UTR5:1-60   CDS:61-387      387 302 0.7804  2   0.0351  1   0.0351    ENST00000342066.3   ENSG00000187634.6   OTTHUMG00000040719.8    OTTHUMT00000276866.2    SAMD11-010  SAMD11  2551    UTR5:1-83   CDS:84-2129 UTR3:2130-2551      2551    17818   6.9847  118 0.3144  59  0.3144  ENST00000341065.4   ENSG00000187634.6   OTTHUMG00000040719.8    OTTHUMT00000097860.4    SAMD11-001  SAMD11  2191    CDS:1-1769  UTR3:1770-2191      2191    12080   5.5135  80  0.2482  40  0.2482    ENST00000455979.1   ENSG00000187634.6   OTTHUMG00000040719.8    OTTHUMT00000097863.4    SAMD11-004  SAMD11  1731    CDS:1-1625  UTR3:1626-1731      1731    302 0.1745  2   0.0079  1   0.0079    

Kindly guide me if there is a elegant way to do this.

Append string to the end of the penultimate line of a file

Posted: 22 Dec 2021 10:04 AM PST

I want to append / concatenate a text in one line before the last line. So if my original file is:

1 sometext  2 sometext  3 sometext  4 sometext  5 sometext  

my new file is

1 sometext  2 sometext  3 sometext  4 sometext newtext  5 sometext  

I know already about solution on how to insert newlines but this is a slightly different problem as I do not want a new line inserted and want concatenation of text instead.

Script to monitor and alert for new orphaned pids

Posted: 22 Dec 2021 08:34 AM PST

How would you go about detecting and alerting about newly orphaned pids? I would like to cron a script that checks once a day for any orphaned pids (PPID = 1) for a specific user and only alert if a new orphaned process has been detected.

e.g ps -efa output grepping for orphaned pids for "user"

day 1

   user  1111111        1   0   Dec 18      -  0:00 command <--- send email about this pid  

day 2

   user  1111111        1   0   Dec 18      -  0:00 command     user  2222222        1   0   Dec 14      -  0:00 command <--- send email about this pid  

How can I source environment changes system-wide?

Posted: 22 Dec 2021 10:48 AM PST

In most *nix environments using bash, you'll change environment variables that are local to your user in ~/.bash_profile or a similar file and then source the changed file in order to make the changes effective in your session.

Similarly, sourceing /etc/profile after a change will make those changes effective in your current session.

But suppose you need to change an environment variable that is defined in /etc/profile (or somewhere under /etc/profile.d/) and want the change to be visible across all sessions of all users on the system immediately. How can you achieve that without rebooting the system?

Udev hwdb to re-map a key when I don't know the key code

Posted: 22 Dec 2021 10:01 AM PST

I've written a file /etc/udev/hwdb.d/70-keyboard.hwdb to re-map some of my keyboard keys. There's an additional key that I want to re-map, but I can't figure out what identifier I should use for it.

Ordinarily, I run evtest and press keyboard keys to get an output like the following:

Event: time 1639158329.532434, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7000f  Event: time 1639158329.532434, type 1 (EV_KEY), code 38 (KEY_L), value 1  

Then I use the hex "value" from the first line above (containing "EV_MSC") to compose a line like the following in my 70-keyboard.hwdb file:

 KEYBOARD_KEY_7000f=rightctrl  

The key that I want to re-map now is my KEY_KBDILLUMDOWN key, and when I run evtest to identify its hex value, I only get one line of output, and it's not the line that contains "EV_MSC":

Event: time 1639158417.741165, type 1 (EV_KEY), code 229 (KEY_KBDILLUMDOWN), value 1  

How can I remap this key in udev?

CIFS: Status code returned 0xc000006d STATUS_LOGON_FAILURE

Posted: 22 Dec 2021 10:10 AM PST

Linux: 4.18.0-305 OS: CentOS 8.4

I have an SMB folder that is mounted with the following command:

mount -t cifs -o iocharset=utf8,rw,credentials=${_passwordFile},nobrl,nounix,file_mode=0644,dir_mode=0755,rsize=65536,wsize=130048,uid=10002,gid=1005,vers=3.0 //SMB_FOLDER LOCAL_FOLDER  

Sometimes it happens that the SMB source is no longer available. Then I get the following error message in messages:

Dec  1 12:40:09 XXXX kernel: CIFS: VFS: \\SMB_FOLDER Send error in SessSetup = -13  Dec  1 12:40:09 XXXX kernel: CIFS: Status code returned 0xc000006d STATUS_LOGON_FAILURE  Dec  1 12:40:09 XXXX kernel: CIFS: VFS: \\SMB_FOLDER Send error in SessSetup = -13  Dec  1 12:40:10 XXXX kernel: CIFS: Status code returned 0xc000006d STATUS_LOGON_FAILURE    

This error is permanently SPAMMING to the log files. Even if I unmount the folder, the error message is spammed permanently.

umount \\SMB_FOLDER  

Although I unmount the folder, I cannot delete it. I get the following error message:

rm: removing 'LOCAL_FOLDER' is not possible: Device or resource busy  

The following commands do not provide any output: lsof +D LOCAL_FOLDER and fuser LOCAL_FOLDER displayed.

How can I solve the problem without rebooting?

Remove detected resolutions

Posted: 22 Dec 2021 07:44 AM PST

There are many articles about how to add undetected resolutions. My problem is the opposite:

gnome-control-center shows many resolutions I won't ever use.

Here is my list with 33 entries on a 3840x2160 monitor: Example 3840x2160 screen

How to clean up this list (per monitor) and only keep these 2 entries?

  • 3840x2160 (native resolution)
  • 1920x1080

OSSEC HIDS Installation Error (Urgent)

Posted: 22 Dec 2021 07:49 AM PST

When I try to run the ./install.sh script for the OSSEC HIDS, I keep getting these weird errors:

/usr/bin/ld: client-agent/config.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/event-forward.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/intcheck_op.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/main.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/notify.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/receiver.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/sendmsg.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: client-agent/start_agent.o:(.bss+0x0): multiple definition of `server_ibuf'; client-agent/agentd.o:(.bss+0x0): first defined here  /usr/bin/ld: os_net.a(os_net.o):(.bss+0x0): multiple definition of `agt'; client-agent/config.o:(.bss+0x10088): first defined here  collect2: error: ld returned 1 exit status  make: *** [Makefile:1017: ossec-agentd] Error 1  

I've installed all the dependencies and updated everything (apt update, etc.) and nothing seems to fix this issue. Does anyone have any suggestions?

Also, I'm trying to do the local installation. If you need anything else let me know

How to write udev rule that matches a device's interface attribute(s)

Posted: 22 Dec 2021 10:06 AM PST

I have a USBTMC device that has a usbtmc interface. The interface has bInterfaceClass, bInterfaceSubClass, and bInterfaceProtocol attributes with values 'fe', '3', and '1' respectively. The question is how to write a udev rule that matches attributes on an interface of the device. It appears that matching starts the device level, and can only look "upward" at the device's parents, but cannot look "downward" (down the sysfs tree) into the device's interface(s).

I'm able to write a working rule that matches based on the VID/PID:

SUBSYSTEM=="usb", ATTR{idProduct}=="5c18", ATTR{idVendor}=="2a8d", MODE:="0660", GROUP="plugdev"  

but a rule like this does NOT work:

SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="fe", ATTR{bInterfaceSubClass}=="03", MODE:="0660", GROUP="plugdev"  

The following shows a listing of the device, and shows the attributes of the interface found under 1-1:1.0:

me@box:/sys/bus/usb/devices/1-1$ ls  1-1:1.0            bcdDevice            bDeviceProtocol  bMaxPacketSize0     bNumInterfaces  descriptors  devpath  idProduct    manufacturer  power    removable  serial     tx_lanes  version  authorized         bConfigurationValue  bDeviceSubClass  bMaxPower           busnum          dev          driver   idVendor     maxchild      product  remove     speed      uevent  avoid_reset_quirk  bDeviceClass         bmAttributes     bNumConfigurations  configuration   devnum       ep_00    ltm_capable  port          quirks   rx_lanes   subsystem  urbnum  me@box:/sys/bus/usb/devices/1-1$ cat 1-1\:1.0/bInterfaceClass   fe  me@box:/sys/bus/usb/devices/1-1$ cat 1-1\:1.0/bInterfaceSubClass   03  me@box:/sys/bus/usb/devices/1-1$ cat 1-1\:1.0/bInterfaceProtocol   01  me@box:/sys/bus/usb/devices/1-1$  

The command: udevadm info -a -n

lists device ATTR that can be used, as well as parent ATTRS. None of these include the (child) interface attributes.

Any help would be appreciated.

shell scripting to fetch the file contents

Posted: 22 Dec 2021 09:05 AM PST

a log file get generated every minute in directory called "data_logs"

log file name :

abc.log.2019041607  abc.log.2019041608..  

contents of the log file like this

R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1  R_MT|D:1234|ID:413|S:1    R_MT|D:1234|ID:413|S:0  R_MT|D:1234|ID:413|S:0  R_MT|D:1234|ID:413|S:0  R_MT|D:1234|ID:413|S:0   R_MT|D:1234|ID:413|S:0    k_MT|D:1234|ID:414|S:1  k_MT|D:1234|ID:414|S:1  k_MT|D:1235|ID:413|S:1  k_MT|D:1235|ID:413|S:1  

I am writting a shell script, which when executed it look for the files which gets created in last 5 minutes(Last 5 files, 1 file gets created every minute), open each file one by one and do process, i.e create a output.txt file which contains, R_MT|D:1234|ID:413 for this combination total count having 's' as 0 gets stored in "submited" column, 's'=1 gets stored in notsubmitted column

my output.txt need to look like this:

Type, Number,ID,submitted,notsubmitted  R_MT,D:1234,ID:413,5,10  R_MT,D:1234,ID:414,0,2  R_MT,D:1235,ID:413,0,2  

I have used this to get the submitted and notsubmitted values:

zcat abc.log.2019041607.gz |grep "R_MT"|awk -F"|" '{print $2","$3","$4}'|sort|uniq -c        5 D:1234,ID:413,S:0       10 D:1234,ID:413,S:1        2 D:1234,ID:414,S:1        2 D:1235,ID:413,S:1  

by above command i am getting the count but i am not getting how can I assign it to a variable so that i can write into the fields "submitted" and "notsubmitted" in the output file, and I am not getting how to obtain the last 5 minutes files?

please help me in this thanks alot!

RHEL 8 Deprecated Network Scripts

Posted: 22 Dec 2021 10:38 AM PST

I was reading about RHEL 8, and this statement is made:

Network scripts are deprecated in Red Hat Enterprise Linux 8 and they are no longer provided by default. The basic installation provides a new version of the ifup and ifdown scripts which call the NetworkManager service through the nmcli tool.

OK, so to me this would imply that /etc/sysconfig/network-scripts would no longer be used, though it is unclear from my reading what is supposed to replace ifcfg-eth0 (or similar).

But then I read this page about static IP addresses, which asserted:

The procedure to configure a static IP address on RHEL 8: Create a file named /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:

DEVICE=eth0    BOOTPROTO=none    ONBOOT=yes    PREFIX=24    IPADDR=192.168.2.203    

Restart network service on RHEL 8: systemctl restart NetworkManager OR sudo nmcli connection reload

So, is it only the ifup and ifdown that are deprecated, but the configuration files remain? Is the distinction between scripts and configuration files, even though they seem lumped under a single chapter? Chapter 12 of the RHEL defixed network scripts as the:

Chapter 12. Network Scripts
...configuration files for network interfaces and the scripts to activate and deactivate them are located in the /etc/sysconfig/network-scripts/ directory.

So, what constitutes what is deprecated? It doesn't seem to be the scripts in /etc/sysconfig/network-scripts since that apparently is still an appropriate way to configure a static IP.

I do not yet have a RHEL 8 box running, so I am hoping someone can shed light on what it is one is supposed to avoid.

Unable to use yum repos whether with baseurl or mirrorlist in CentOS 6.5

Posted: 22 Dec 2021 08:00 AM PST

Since a couple of days, I'm unable to retrieve repositories data with Yum, in my CentOS 6.5 server. I did yum clean all a dozen of times, it emptied all but didn't solved the problem.

I tried to retrieve things by restricting to the single base repo :

[base]  name=CentOS-$releasever - Base  mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os  gpgcheck=1  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  

yum --verbose update results in :

Loading "fastestmirror" plugin  Loading "priorities" plugin  Config time: 0.010  Yum Version: 3.2.29  Setting up Package Sacks  Determining fastest mirrors  Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was  14: PYCURL ERROR 22 - "The requested URL returned error: 403 Forbidden"  Error: Cannot find a valid baseurl for repo: base  

And when I configure a baseurl instead of a mirrorlist, I get this :

Loading "fastestmirror" plugin  Loading "priorities" plugin  Config time: 0.010  Yum Version: 3.2.29  Setting up Package Sacks  Determining fastest mirrors  http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"  Trying other mirror.  Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again  

The server pings mirror.centos.org and I can reach without any problem the mirrorlist and the repomd.xml in a web browser. Disabling the plugins changed nothing. The mirrorlist gives a 403 error and a baseurl 404...

rpm -q --verify -f /etc/yum.repos.d/* results in :

S.5....T.  c /etc/issue  .......T.  c /etc/yum.repos.d/CentOS-Base.repo  .......T.  c /etc/yum.repos.d/CentOS-Debuginfo.repo  .......T.  c /etc/yum.repos.d/CentOS-Media.repo  .......T.  c /etc/yum.repos.d/CentOS-Vault.repo  S.5....T.  c /etc/issue  .......T.  c /etc/yum.repos.d/CentOS-Base.repo  .......T.  c /etc/yum.repos.d/CentOS-Debuginfo.repo  .......T.  c /etc/yum.repos.d/CentOS-Media.repo  .......T.  c /etc/yum.repos.d/CentOS-Vault.repo  S.5....T.  c /etc/issue  .......T.  c /etc/yum.repos.d/CentOS-Base.repo  .......T.  c /etc/yum.repos.d/CentOS-Debuginfo.repo  .......T.  c /etc/yum.repos.d/CentOS-Media.repo  .......T.  c /etc/yum.repos.d/CentOS-Vault.repo  S.5....T.  c /etc/issue  .......T.  c /etc/yum.repos.d/CentOS-Base.repo  .......T.  c /etc/yum.repos.d/CentOS-Debuginfo.repo  .......T.  c /etc/yum.repos.d/CentOS-Media.repo  .......T.  c /etc/yum.repos.d/CentOS-Vault.repo  .......T.  c /etc/yum.repos.d/epel-testing.repo  .......T.  c /etc/yum.repos.d/epel.repo  .......T.  c /etc/yum.repos.d/epel-testing.repo  .......T.  c /etc/yum.repos.d/epel.repo  le fichier /etc/yum.repos.d/isv:ownCloud:community.repo n'appartient à aucun paquetage  .......T.  c /etc/yum.repos.d/jpackage.repo  le fichier /etc/yum.repos.d/jpackage.repo.rpmsave n'appartient à aucun paquetage  

« n'appartient à aucun paquetage » means « doesn't belong to any package », in french...

Those problems occur with whatever repo I enable/disable.

How to change default shell to ZSH - chsh says "invalid shell"

Posted: 22 Dec 2021 08:14 AM PST

I installed ZSH on a VM of mine, where I compiled it from source. The location of ZSH is /usr/local/bin/zsh when I run chsh -s /usr/local/bin/zsh it outputs chsh: /usr/local/bin/zsh is an invalid shell. I also tried this with sudo as well. How can I change this?

No comments:

Post a Comment