Monday, April 11, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


The qemu service libvirtd/virtqemud crashes with an "End of file while reading data: Input/output error"

Posted: 10 Apr 2022 11:36 PM PDT

On my CentOS 9 Stream box my qemu service libvirtd or virtgemud crashes, tried both, not at the same time though ;-) (I'm aware I should use virtgemud)

I run fine between 5-300 seconds randomly :-/

The journal says:

enter image description here

Which file is it reading? I checked /etc/hostname but that seems to be fine?

Creating and arranging files into folders based on date and time in file name

Posted: 11 Apr 2022 12:45 AM PDT

I have many files in a folder Main which are named like these:

2021_10_15_23_35_SIP_CDR_pid3894_ins2_thread_1_4718.csv.gz  2021_11_24_21_15_Gi_pid25961_ins2_thread_1_6438.csv.gz  2021_11_25_20_55_Gi_pid29741_ins5_thread_4_7540.csv.gz  2021_11_24_21_15_Gi_pid27095_ins2_thread_1_6485.csv.gz  2021_11_25_20_55_Gi_pid30842_ins3_thread_2_7489.csv.gz  2021_11_24_21_15_Gi_pid27095_ins3_thread_2_6485.csv.gz  2021_11_25_20_55_Gi_pid30842_ins4_thread_3_7488.csv.gz  2021_11_24_21_15_Gi_pid27095_ins4_thread_3_6485.csv.gz  2021_11_25_20_55_Gi_pid30842_ins5_thread_4_7489.csv.gz  2021_11_24_21_15_Gi_pid681_ins5_thread_4_6457.csv.gz  

The first 10 characters shows the date, followed by the digits which is the time in 24 hour format. The rest is the file details which we can ignore.

I want to create folders within the Main folder based on the date in the filename and then another folder inside the date folder based on the hour in file name. Eventually I want to move the files from the Main folder into the respective hour folder.

Main -> Date -> hh -> file.csv.gz  

For eg: The file 2021_11_24_21_15_Gi_pid27095_ins3_thread_2_6485.csv.gz in the Main folder will eventually end up in a folder like this with the below path Main/2021_11_24/21/2021_11_24_21_15_Gi_pid27095_ins3_thread_2_6485.csv.gz

Can you please help with the bash script to achieve the grouping of files in folders like mentioned above?

umask ACLs and socket permissions

Posted: 10 Apr 2022 10:16 PM PDT

I looked at the answer here How to set default file permissions for all folders/files in a directory?

And set the acls using setfacl

getfacl: Removing leading '/' from absolute path names  # file: run/nordlayer  # owner: nordlayer  # group: nordlayer  # flags: -s-  user::rwx  group::rwx  other::---  default:user::rwx  default:group::rwx  default:other::r-x  

Now when I create a file using touch /run/nordlayer/test

I get the write permissions

-rw-rw-r-- 1 void nordlayer 0 Apr 11 01:14 test

But when I create a socket using nc -lkU /run/nordlayer/testSocket.sock

I do not get write permissions on the socket

srwxr-xr-x 1 void nordlayer 0 Apr 11 01:15 testSocket.sock

However setting umask to 0 gives me the write permissions umask 0 && nc -lkU /run/nordlayer/testSocket.sock

What is the difference here? Why is umask needed for a socket and not needed for creating a file?

UNIX shell script to check the status from oracle table and move the file to appropriate direcoty

Posted: 10 Apr 2022 10:12 PM PDT

I have a requirement to loop through sales files in UNIX and then check the status of file in oracle table (status column in svc_posupld_status table) . If the status is C then move the file to "done" directory. If the status of file is not C , then move the file to "reject" directory I have written following code

for file in `find . -type f -name "POSU*.dat.*" |sort |awk 'gsub("^./","")' | egrep -v "/"`  do    echo "select reference_id, status from svc_posupld_status where reference_id = '$file'  ;" >>outfile.sql    echo exit | $ORACLE_HOME/bin/sqlplus -s $UP @outfile.sql >> sql.log  done   - if the status is C then move the file to done directory   - if the status is NOT C then move the file to reject directory  

How do I check the status and move files accordingly?

Purge old folders without find

Posted: 10 Apr 2022 10:16 PM PDT

Here I am trying to delete old folders which are older then xdays. Path of these disk are mentioned in file_path.txt

What I need here is to search each path available in the mentioned file & delete those files which are available.

Below is what i have tried so far, but not working.

dir_to_check='file_path.txt'  CY=`date +"%Y"`  last_month=`date '+%B' --date '1 month ago'`  lmdate=`date '+%d' --date='32 days ago'`    cmd="$dir_to_check/$CY/$last_month/$lmdate"    cat file_path.txt | while read output  do  find $cmd -type d -ctime +30  if [ $? -eq 0 ]; then  echo "Directory exists and can be deleted"  echo "rm dir"  else  echo "FAIL to delete directory as its not exists"  fi  done  

RHEL7 not Booting Suspected issue in /DEV

Posted: 10 Apr 2022 09:07 PM PDT

My machine is a blades server on which Base OS is "RHEL 7" which runs on locally attached SSD.

On this base machine I have three VMs on which one SAN LUN is mounted (its not mounted on base machine)

While creating new VM through KVM , I accidentally selected /DEV partition which was through "devtmpfs" after which KVM crashed and machine is not coming up

  1. Its booting in rescue mode but not through any previous kernel

  2. In normal boot , its going to rhel logo and then showing undermentioned errors "scsi 2.0.0 alua not attached" "scsi 2.0.1 alua not attached" "scsi 1.0.0 alua not attached" "scsi 1.0.1 alua not attached" watchdog0 watchdog didnt run after pressing enter it goes to command prompt login but hangs

after selecting rescue mode and going into single user mode I am able to see everything, even /DEV and no change is visible there

Rescue booting through USB ISO is also working and I am able to enable network and transfer .

Please suggest what to do

Shell scripts: How to copy past outputs of terminal emulator?

Posted: 11 Apr 2022 12:16 AM PDT

I want to make a shell script which copies the past outputs of the GUI terminal emulator (for example, last 20 lines). The motivation is as following:

When I execute a procedure which requires long time (for example, downloading a very large file, or converting a very large movie file), I sometimes remember another job, and I have to leave the room. In such a case, I press ctrl+z to stop the procedure. And I type

fg; echo $? >> log.txt; date >> log.txt; systemctl poweroff  

then I leave the room.

This way works and is not bad. But it has a disadvantage that I cannot read the outputs of the procedure. I can know only the status ($?). So I want to copy last 20 or 40 lines and save them in log file.

where in the FHS does command less store its buffers?

Posted: 10 Apr 2022 07:42 PM PDT

Using Kubuntu 20.04, which is running from an USB stick. Therefore there is a /cow overlay file system mounted on /. The USB stick has a total capacity of 32 GB, But to the cow overlay file system only 16 GB were assigned. My computer has a RAM size of 32 GB (as shown by utility "free" in total).

The cause of my current state is, that I have forgotten to disable the internet connection.

Before, I have used aptitude to search, but I have not intentionally downloaded something. Overnight from the 16 GB in "cow" about 2 GB have gone used. df -Th -a shows "used" is grown from 21% to 33%.

Now I am investigating, who has done what.

For this I have running (for many hours) a self-written program wels_fullpath (based on bash globstar and **) over /, piping the output to sort (for sorting by time), and from sort to less. While this is running, I have to pay attention which memory is used for buffers of sort and of less. (I am neglecting sort in the moment).

For this I have continuously running the watch utility to observe the changes in df and free:

watch -d  "df -T -a >/tmp/WEx_df__2; diff -U0 /tmp/WEx_df__1 /tmp/WEx_df__2; free -w -h"  

strace shows that wels_fullpath is working.

But neither in df nor in free are changes reported.

So the question came up, where in the list of df some continuously growing buffers should appear?

I have read the documentation to less and I have long googled in internet. There are some good articles regarding less and buffers. But nowhere is a description where in the FHS the less buffers should be seen and with what a name.

  • addendum:

A new question came up.

I have changed my calling sequence and do no longer use "less" here.

Nevertheless my question is of general importance for me.

And perhaps for the place where the buffers of less are, I have not written the appropriate term "storage". I have ment "in memory or on disk". less buffers should have an effect on either "free" or "df". And this should be noted in some documentatin.

Now my command chain is:

/.../wels_fullpath -d / 2>/dev/null | grep -v -e "^fd1" | sort -s -r -k7,8 >/tmp/WEx01

As I see in "top" ("htop" is not installed by default) the execution is yet on the very beginning:

top -p <PID>

shows:

PID USER PR NI VIRT RES

2159985 root 20 0 242132 235816

SHR S %CPU %MEM TIME+

3160 R 99.3 0.7 1634:33

COMMAND

wels_fullpath

In my program I use an array. And while reading the files in the source "/", they are written into the array. Thus VIRT and RES are continuously growing, ok.

But my perpetually running "watch" of "df" and "free" does not show these changes. The values in "free" varies by a very small amount up and down.

Thus my additional question is, please:

why the growing memory usage of my program is not reflected in "free"?

is there an utility in Linux, Kubuntu to analize and display a l l aspects of memory (like "df", "du")?

Regards antondhidh

Adding custom field to the subject line in a opensssl X509 certificate via command line

Posted: 10 Apr 2022 11:17 PM PDT

I am attempting to generate a CSR for a certificate and wish to include a unique id as part of the certificate subject line. this information shall be used by the TLS client for some purpose after the certificate is validated (via normal TLS validation method) and the connection is established.

I am using a script to generate the CSR automatically and I don't have the option to modify the openssl config file present in the system. I understand that there is a option to generate a temporary ssl config for this purpose where I can specify additional attributes and values into it. But for simplicity I am attempting to avoid it untill I absolutely have to use it.

I am trying the following command but geting a warning mesaage as follows:

$ openssl req -key abc.pem -new -out abc.csr -subj "/CN=myhostname.mydomain.com/uuid=a1b2c3d4e5f6"  req: Skipping unknown attribute "uuid"  

Is there a way to pass the UUID via command line? If not, is the only other alternative is to use a temp config file?

How do you expand a variable in a heredoc as one argument when its value has spaces?

Posted: 11 Apr 2022 01:03 AM PDT

I've created a script to upload via lftp:

#! /usr/bin/bash  set -xe    if [ -n "$1" ]; then    # ...  else    source="."    # target=name of current local folder    target="${PWD##*/}"/    cmd="mirror --reverse --continue --parallel=5 "$source" "$target""  fi      lftp -u $user,$pass $host << EOF  set log:enabled true    eval "$cmd"    quit  EOF    

If the current directory does not contain spaces, this works correctly. The problem occurs when the current directory does have spaces. Here is what the debug information shows:

➜  upload.sh  + '[' -n '' ']'  + source=.  + target='Two Words/'  + cmd='mirror --reverse --continue --parallel=5 . Two Words/'  

As a result of this issue, the script uploads to directory named Two instead of Two Words.

I'm not sure how to fix this problem, especially because I don't know which line is where I went wrong: cmd=...? eval "$cmd"? Neither? Both?

Regardless, I was expecting that debug output to look like this: + cmd='mirror --reverse --continue --parallel=5 "." "Two Words/"' (notice the double quotes) and I'm not sure why it didn't.

This question is similar to a lot of others I researched to get this far. What makes this different/hard to Google is that the expansion is happening inside of a "here string". For all I know that's irrelevant, but for all I know it could be critically unique, too.


Comments suggested I store everything into an array. Here's my attempt to do so:

#! /usr/bin/bash  set -xe    if [ -n "$1" ]; then    cmd=(mput -c -P 5 "$1")    if [ -n "$2" ]; then      cmd=(mkdir -p "$2"          mput -c -P 5 -O "$2" "$1") #*    fi  else    source="."    # target=name of current local folder    target="${PWD##*/}"/    cmd=(mirror --reverse --continue --parallel=5 "$source" "$target")  fi      lftp -u $user,$pass $host << EOF    "${cmd[@]}"    quit  EOF  

(* I can't figure out how to have multilines in a subshell. That's why I put actual newlines in there, but I'm not sure if that's the correct thing to do. Every result I google has to do with command substitution, not subshells.)

When I run this, it gives me this error: Unknown command 'mirror --reverse --continue --parallel=5 . Two Words/'. If I copy and paste that into my shell, it gives me a different error, so I'm not understanding what's going on.

Calling lftp -u $user,$pass $host -e "${cmd[@]}" didn't work either. That gives this error:

open: unrecognized option '--reverse'  Usage: lftp [-e cmd] [-p port] [-u user[,pass]] <host|url>  

running lftp ... -e "$("${cmd[@]}")" gave this error:

open: option requires an argument -- 'e'  Usage: lftp [-e cmd] [-p port] [-u user[,pass]] <host|url>  

As you can see, at this point, I'm just trying random stuff and hoping it'll provide insight. Not a good strategy.

echoing value in same indexes of 2 arrays simulataneously

Posted: 10 Apr 2022 11:05 PM PDT

I have 2 arrays to prcoess in bash script simultaneously. First array contains sort of lables. Second array contains values, as under

LABELS=(label1 label2 label3 labe4 )  VALUES=(91 18 7 4)  

What's required is: a loop that will echo the indexed-item from LABELS array & and in front of that corresponding value for that item from VALUES array, as under

label1 91  label2 18  label3 7  label4 4  

I guess nested loop will not work, I tried below, but it won't work by syntax

for label in {LABELS[@]} && value in {VALUES[@]}  do      echo ${label} ${value}  done  

tail -f executed of ssh repeat output multiple times

Posted: 10 Apr 2022 09:08 PM PDT

I am trying to monitor a file remotely. Since I cannot install additional useful applications on the source I plan to use tail over ssh to bring the information local where I have more options.

Since I'm only interested in the last line I also use -n 1.

Testing the command without any piping or redirection (that'll come later):

ssh serverhost tail -fn 1 /var/log/somelog.log  

Running this I get the expected output. However, any subsequent tail updates will produce multiple output lines.

e.g.

test file:

this is line 1    this is line 2    this is line 3    

On client side runssh serverhost tail -fn 1 /var/log/somelog.log

Output:

this is line 3  

On server side echo this is line 4 >> /var/log/somelog.log

On client side output:

this is line 3  this is line 4  this is line 4  this is line 4  this is line 4  

As a test I redirected the output to a file locally. In that case, I get one line in the file and one less line in the local console output.

I tested this from and to different client-server combinations and so far I can only replicate this from MobaXterm to SLES 12 SP1.

The question is, before I call this a bug, are there any settings on either side that may cause such behaviour?

How do I boot into pop!_os on an older bios

Posted: 10 Apr 2022 09:59 PM PDT

I recently downloaded pop!_os onto my older dell laptop and it worked somewhat for a little bit. Until oneday I opened up my laptop and it wouldn't boot properly. It loads me into a busybox v1.30.1. But it is not specific on the problem I've tried everything I've been told to do. When I run the exit command it tells me "ALERT! /dev/mapper/data-root does not exist. Dropping to a shell!" I have no idea what this means.

Please help me fix my computer.

Use self-built Mesa binaries with startx?

Posted: 10 Apr 2022 07:17 PM PDT

How can I use self-built Mesa binaries with startx "rootlessly"? That is, without:

  • installing them to a "special" system-wide location like /usr or /usr/local
  • altering system configuration files like /etc/ld.so.conf or /etc/ld.so.conf.d/*
  • otherwise modifying system/root-owned files/configuration

Running startx with an appropriate LD_LIBRARY_PATH & LIBGL_DRIVERS_PATH:

LD_LIBRARY_PATH="$HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu" \  LIBGL_DRIVERS_PATH="$HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri" \  startx  

...sadly doesn't work:

...  MESA-LOADER: failed to open radeonsi: $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri/radeonsi_dri.so: undefined symbol: amdgpu_query_video_caps_info (search paths $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri)  failed to load driver: radeonsi  MESA-LOADER: failed to open kms_swrast: $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so: undefined symbol: amdgpu_query_video_caps_info (search paths $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri)  failed to load driver: kms_swrast  MESA-LOADER: failed to open swrast: $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri/swrast_dri.so: undefined symbol: amdgpu_query_video_caps_info (search paths $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri)  failed to load swrast driver  ...  

The Mesa binaries work fine if I have $HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu in /etc/ld.so.conf & run LIBGL_DRIVERS_PATH="$HOME/Workspace/mesa-bin/lib/x86_64-linux-gnu/dri" startx so I suspect LD_LIBRARY_PATH is being removed from the environment, probably due to some part of the startx chain running afoul of ld.so's "secure-execution mode" rules.

System information:

  • Debian 11/bullseye
  • Mesa git, tag mesa-21.3.7
  • Radeon RX 6700 XT
  • Kernel 5.15 from backports
  • firmware-amd-graphics from bookworm

How can I remove lines from my file according to a threshold in Unix?

Posted: 10 Apr 2022 10:13 PM PDT

I have an input file with different columns, like the following:

VARIANT,SNP,chr,pos,A1,A2,BETA,P_value             7:106350628_G_A,rs6977865,7,106350628,G,A,-0.0808873,8.6E-309  7:106353698_T_C,rs74804152,7,106353698,T,C,-0.0808701,9.3E-309  20:57674276_T_A,rs6026699,20,57674276,T,A,-0.0945835,6.0E-314  1:10177_A_AC,rs367896724,1,10177,A,AC,0.000264372,9.3E-01  1:10642_G_A,rs558604819,1,10642,G,A,0.0425225,7.0E-01  2:31467079_G_A,rs2295471,2,31467079,G,A,-0.0830949,8.6E-320  

Now, I'd like to remove the rows at which the P-value is less than 2.23E-308, in order to have the following output file:

VARIANT,SNP,chr,pos,A1,A2,BETA,P_value  1:10177_A_AC,rs367896724,1,10177,A,AC,0.000264372,9.3E-01  1:10642_G_A,rs558604819,1,10642,G,A,0.0425225,7.0E-01  

I ran the following command in the Unix shell:

awk -F, '$8!"<2.23E-308"' input.file > output.file  

However, I still have the first input file, with all the rows...

Is the command wrong? May be there a problem in recognizing the set threshold?

I am using Linux.

Errors were encountered while processing libc6:amd64

Posted: 10 Apr 2022 09:03 PM PDT

I installed WSL Kali Linux, then I typed apt-get update so when I type apt-get dist-upgrade for upgrade then I saw this

$ sudo apt-get dist-upgrade   Reading package lists... Done  Building dependency tree   Reading state information... Done   You might want to run 'apt --fix-broken install' to correct these.   The following packages have unmet dependencies:   bsdmainutils : Depends: calendar but it is not installed                  Depends: ncal but it is not installed   libc-bin : Depends: libc6 (< 2.31) but 2.31-2 is installed              Recommends: manpages but it is not installed   E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution)  

I tried apt --fix-broken install yet the errors message continued:

$ sudo apt --fix-broken install  Reading package lists... Done  Building dependency tree  Reading state information... Done  The following additional packages will be installed:    calendar cpp cpp-9 libc-bin libisl22 libmpc3 libmpfr6 ncal  Suggested packages:    cpp-doc gcc-9-locales  Recommended packages:    manpages  The following NEW packages will be installed:    calendar cpp cpp-9 libisl22 libmpc3 libmpfr6 ncal  The following packages will be upgraded:    libc-bin  1 upgraded, 7 newly installed, 0 to remove and 67 not upgraded.  6 not fully installed or removed.  Need to get 0 B/13.4 MB of archives.  After this operation, 34.7 MB of additional disk space will be used.  Do you want to continue? [Y/n] y  Setting up libc6:amd64 (2.31-2) ...  Checking for services that may need to be restarted...  Checking init scripts...  Nothing to restart.  sleep: cannot read realtime clock: Invalid argument  dpkg: error processing package libc6:amd64 (--configure):   installed libc6:amd64 package post-installation script subprocess returned error exit status 1  Errors were encountered while procesing:   libc6:amd64  E: Sub-process /usr/bin/dpkg returned an error code (1)  

Here is the screenshot. I really need help to solve this issue

Screenshot of error

Why does awk behave differently for $1 if the value is 0 (number zero)?

Posted: 11 Apr 2022 01:10 AM PDT

When awk receives "0" as input, it behaves differently in some cases. Code below:

var=$1  echo ""; echo -n 'o/p of $1=$1 ==>'; echo $var | awk '$1=$1'  echo "";echo -n 'o/p of {$1=$1;print} ==>';echo $var | awk '{$1=$1;print}'  echo "";echo -n 'o/p of $1==$1 ==>';echo $var | awk '$1==$1'  echo "";echo -n 'o/p of {$1==$1;print} ==>';echo $var | awk '{$1==$1;print}'  

The output with "0" (number zero):

[root@host ~]# sh /tmp/te.sh 0    o/p of $1=$1 ==>  o/p of {$1=$1;print} ==>0    o/p of $1==$1 ==>0    o/p of {$1==$1;print} ==>0  [root@GORJALA ~]#  

The output with "1" (number one):

[root@host ~]# sh /tmp/te.sh 1    o/p of $1=$1 ==>1    o/p of {$1=$1;print} ==>1    o/p of $1==$1 ==>1    o/p of {$1==$1;print} ==>1  [root@host ~]#  

Why is there a difference when I use var=0; echo $var | awk '$1=$1' and var=1; echo $var | awk '$1=$1'? All numbers are working fine other than 0.

Versions:

  • GNU bash, version 4.2.46
  • GNU Awk 4.0.2
  • coreutils-8.22-24.el7.x86_64

Checking for freetype2 configure error when installing PHP 5.6.37 from AUR

Posted: 10 Apr 2022 11:01 PM PDT

I'm trying to install PHP version 5.6.37 from AUR using makepkg -i command, but when it reaches the moment to check for the "freetype2" it displays the error:

checking for freetype2... configure: error: freetype-config not found.

I already have 7.2 installed, but I need the 5.6 for an older project, and as in Ubuntu, I intend to have both installed.

makepkg -i  ==> Making package: php56 5.6.37-1 (Wed 12 Sep 2018 12:27:39 PM +08)  ==> Checking runtime dependencies...  ==> Checking buildtime dependencies...  ==> Retrieving sources...    -> Found php-5.6.37.tar.xz    -> Found php-5.6.37.tar.xz.asc    -> Found php.ini.patch    -> Found apache.conf    -> Found php-fpm.conf.in.patch    -> Found logrotate.d.php-fpm    -> Found php-fpm.service    -> Found php-fpm.tmpfiles    -> Found use-enchant2.patch    -> Found php-freetype-2.9.1.patch  ==> Validating source files with sha512sums...    [...]    checking whether to enable truetype string function in GD... yes  checking whether to enable JIS-mapped Japanese font support in GD... no  If configure fails try --with-vpx-dir=<DIR>  checking for jpeg_read_header in -ljpeg... yes  checking for png_write_image in -lpng... yes  checking for XpmFreeXpmImage in -lXpm... yes  checking for pkg-config... (cached) no  checking for freetype2... configure: error: freetype-config not found.  ==> ERROR: A failure occurred in build().      Aborting...  

Installing freetype2 with Pacman didn't solve it.

GTK+3 change text color in a label (raspberry pi)

Posted: 10 Apr 2022 10:08 PM PDT

I am trying to change the color of text in a label on the fly at runtime. I've tried applying a css style, I've tried two depreciated methods, and none of it works. Can it even be done, and if not, why is something this simple not available?

Applying a css style on the fly partially works: when I specify

.pinkStyle {      background-color: rgb(241, 135, 135);      color: black;  }  

at runtime I can see the background turn pink. But the text stays white.

How can I detect whether an "NMI watchdog: BUG: soft lockup" is a hardware or a software issue?

Posted: 10 Apr 2022 10:06 PM PDT

Soft Lockup

dmesg reports in my laptop, since quite some time now, NMI watchdog: BUG: soft lockup every time I try to use updatedb or firefox. Samples of what is reported posted at https://github.com/zfsonlinux/zfs/issues/4536#issuecomment-280894134.

Related questions are

I have also read/commented at - https://github.com/zfsonlinux/zfs/issues/4536

Question

How can I detect whether it's a hardware issue or, as I think, confirm it's an issue related to the kernel/software?


Details

Linux Distribution

Funtoo-Linux, a rolling distribution

Kernels

I have (at least) observed the "BUG" while using the following kernel(s) versions:

pf

  • 4.11_p4-pf
  • 4.8_p8
  • 4.5_p4

ck

  • 4.12.7-ck

debian

  • lts-4.9.30
  • 4.8.x
  • 4.7.8

Configuration

I use a custom configuration to compile the kernel. It's mostly the same configuration I use(d) for long time, when there was no "soft lockup" problem or whatsoever related to a "watchdog".

I can copy-paste or link the configuration file. However, two important settings I have found else to be "required"

CONFIG_KALLSYMS=y  CONFIG_PREEMPT_NONE=y  

ZFS

I observed the "BUG" while using ZoL versions

  • 0.6.5.11
  • 0.6.5.10
  • 0.6.5.9
  • 0.6.5.8
  • 0.6.5.3

expect: get error status when spawn command fails

Posted: 11 Apr 2022 12:04 AM PDT

The below is the sample of a script which we execute daily for getting info from the server. For the last couple of days, some server data is missing from the output which is captured on the local file VS-HV-Report_2017.txt.

Is it possible to get error status when the script is executed, but its unable to connect the server? So that we have a black line or and error status instead of output?

#!/usr/bin/expect  set timeout 5  #find /path/to/files -type f -mtime +10 -delete  set date [exec date "+%d-%B-%Y"]    spawn sh -c "yes | cp -ifr .ssh/VS-HV-config .ssh/config"    spawn sh -c "> VS-HV-Report_2017.txt"    #cat ./info.py   spawn sh -c "ssh L1n \"./info.py | sed 's/total.*//g'\" >> VS-HV-Report_2017.txt"  expect "Enter passphrase for key '/root/.ssh/id_rsa':"  send "passwd\r"    spawn sh -c "ssh L2n \"./info.py | sed 's/total.*//g'\" >> VS-HV-Report_2017.txt"  expect "Enter passphrase for key '/root/.ssh/id_rsa':"  send "passwd\r"    spawn sh -c "ssh L3n \"./info.py | sed 's/total.*//g'\" >> VS-HV-Report_2017.txt"  expect "Enter passphrase for key '/root/.ssh/id_rsa':"  send "passwd\r"  set timeout 5    #spawn sh -c "./format-VS-HV.sh > format-allinement-output.csv"  #spawn sh -c \"./format-VS-HV.sh\" > format-allinement-output.csv  exec ./format-VS-HV.sh > /root/format-allinement-output/format-allinement-output-$date.csv  

Cron tab to run a java file

Posted: 11 Apr 2022 01:00 AM PDT

I'm having issues getting a cron tab to run a java file every 5 minutes.

I have tried to create an executable script to see if that is what's needed:

My script and java file are both stored in /usr/local/bin and this is what I have in my crontab:

*/5 * * * * /usr/local/bin/java-crontab.sh  

This is what I have in my script

#!/bin/bash  JAVA_HOME=usr/java/jdk1.6.0_40  export JAVA_HOME  PATH=$JAVA_HOME/bin:$PATH  export PATH  java -jar /usr/local/bin/javatest.jar  

Sorry update - my JAVA_HOME file is not stored in usr/java but in usr/share/doc/openjdk-6-jre-headless. However when I enter that path in the executable script file I don't have permission to do so.

Brand new to creating VM's so apologies for my utter confusion here!

Bash: Assign output of pipe to a variable

Posted: 10 Apr 2022 10:33 PM PDT

I am trying to get the output of a pipe into a variable. I tried the following things:

echo foo | myvar=$(</dev/stdin)  echo foo | myvar=$(cat)  echo foo | myvar=$(tee)  

But $myvar is empty.

I don't want to do:

myvar=$(echo foo)  

Because I don't want to spawn a subshell.

Any ideas?

Edit: I don't want to spawn a subshell because the command before the pipe needs to edit global variables, which it can't do in a subshell. Can it? The echo thing is just for simplification. It's more like:

complex_function | myvar=$(</dev/stdin)  

And I don't get, why that doesn't work. This works for example:

complex_function | echo $(</dev/stdin)  

How do I get Mint to recognize my laptop's microphone as a mono input instead of stereo input?

Posted: 10 Apr 2022 08:07 PM PDT

I'm having an issue with Mint XFCE 17.2 detecting my laptop's internal microphone as a stereo microphone at a hardware level. The problem is that, since it's a mono device, the microphone's "right channel" is complete static:

Recording audio in Audacity shows a blown-out right channel

As I've come to find out, the non-existent right channel is "floating", and when its signal hits the amplifier it gets amplified into static. I've discovered that it's possible to silence the right channel via PulseAudio, but this leads to weird things like my voice only coming in on the left side during Skype calls.

How do I get PulseAudio (or maybe alsa at a lower level) to see that the microphone is a mono input? Is it possible to somehow tweak the audio drivers?

And I have tried creating a virtual source that maps the mic to a mono source:

# Added to /etc/pulse/default.pa  load-module module-remap-source master=alsa_input.pci-0000_00_1b.0.analog-stereo source_name=mono_mic channels=1 master_channel_map=left channel_map=left  

This successfully created a second mono input that seems to work fine in Skype/etc...:

So long as I keep that right channel silenced, it works fine

But I'm not happy with this virtual input since I still have to keep the right channel on Silence on the hardware device itself. In addition, when I try to adjust the hardware device's left channel levels via PulseAudio, for some stupid reason (a bug perhaps?) Pulse automatically locks both channels, which causes the right channel to snap to the left channel's levels. This is despite my turning off channel locking beforehand. I then have to manually disable the channel lock and set the right channel back to Silence.

In the end I'd prefer to fix the underlying issue and get the microphone properly recognized as a mono input. Any advice?

Share wlan connection to ethernet using command line

Posted: 10 Apr 2022 10:07 PM PDT

I have a wlan1 connection that I want to share to other computers on my LAN (via Ethernet - eth0). As this is somehow a temporary solution, I want this to be done by a script, so that I do not touch the network configuration files of my host (i.e I'll run this script after each reboot if I want to).

The problem is that I am unable to bridge wlan1 and eth0.

sudo brctl addif br0 eth0 wlan1  

I saw that one needs to enable 4addr:

 iw dev wlan1 set 4addr on  

Indeed, I can then add wlan1 to the bridge, but ... I lose the wifi connection! I saw this is also a common issue :( In 2, the solution says to do this

iw dev wlan0 interface add wds.wlan0 type managed 4addr on  ip link set dev wds.wlan0 addr $ADDR  ip link set dev wds.wlan0 up  

where $ADDR is "WDS device address configured in the router". I don't understand what that is? The MAC address of my network card for wlan1? And how should I then create my bridge? The following is not working:

sudo brctl addbr br0  sudo brctl addif br0 eth0 wds.wlan0  

Or here, they suggest to install ebtables. But the page does not explain how I should create the bridge, and they modify /etc/network/interfaces which I do not want to do...

So, can somebody please help me create that bridge correctly?

So far, my wifi script is:

 #!/bin/bash   # this is for wlan1 - wifi connection   pkill dhclient   pkill wpa_supplicant   ip link set dev wlan1 down   ip addr flush dev wlan1   iwconfig wlan1 essid "mywifi"   iwconfig wlan1 frag 2432   iwconfig wlan1 rts 2432   ip link set dev wlan1 up      iwconfig wlan1 rate 1M   dhclient -v wlan1     # this is my IP address on my LAN   ifconfig eth0 192.168.0.8 netmask 255.255.255.0  

I am running a Linux Mint 17.1 host. I have installed bridge-utils.

How to create folder shortcuts in file manager?

Posted: 10 Apr 2022 11:37 PM PDT

enter image description here

I'm using Thunar. What i want is remove Networks since i don't use it, and add Lello below videos. I know if you right click on any folder like videos you can remove the shortcut, I don't know how to add shortcuts.

How to Extract Album Cover Image from MP3 file?

Posted: 10 Apr 2022 10:08 PM PDT

I have a bunch of MP3 files that have their album art included within the file itself. I am now looking for a way to extract them to store them separably, at best from command line.

Is there a way to achieve this?

No comments:

Post a Comment