Tuesday, August 3, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Netcat with device or interface flag?

Posted: 03 Aug 2021 10:06 AM PDT

Traceroute has an -i flag,

-i interface, --interface=interface Specifies the interface through which traceroute should send packets. By default, the interface is selected according to the routing table.

ping also provides this with -I. Netcat has no such flag. Is there an easy work around for nc?

can not delete file with root in /etc/pam.d directory

Posted: 03 Aug 2021 10:15 AM PDT

can not delete file in /etc/pam.d directory with root user on centos7.7 system,please help work out this problem.

#rm -f /etc/pam.d/2.txt  rm: cannot remove '/etc/pam.d/2.txt': Permission denied  

directory and file permission as follow:

$ ls -ld /  drwxr-xr-x 21 root root 4096 Aug  3 19:29 /  $ ls -ld /etc  drwxr-xr-x 154 root root 12288 Aug  3 22:26 /etc  $ ls -ld /etc/pam.d/  drwxrwxrwx 2 root root 4096 Aug  3 22:26 /etc/pam.d/  $ ls -l /etc/pam.d/2.txt  -rwxrwxrwx 1 root root 0 Aug  3 19:37 /etc/pam.d/2.txt  

But when i rename pam.d to pam.dd(mv pam.d pam.dd) ,it is can delete file under pam.dd,it's strange! selinux is not open,selinux content also removed,facl is not set

# ls -lZd /etc  drwxr-xr-x root root ?                                /etc  # ls -lZd /etc/pam.d  drwxrwxrwx root root ?                                /etc/pam.d  # ls -lZd /etc/pam.d/2.txt  -rwxrwxrwx root root ?                                /etc/pam.d/2.txt  

both file and directory is mutable

# lsattr -d /etc/pam.d  ---------------- /etc/pam.d    # lsattr /etc/pam.d/2.txt  ---------------- /etc/pam.d/2.txt  

MATE Terminal; has stopped working; returns “Failed to parse arguments: Cannot open display:”

Posted: 03 Aug 2021 09:40 AM PDT

I installed the MATE desktop environment into my onprem EC2 instance as per this URL; https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-2-install-gui/

And was able to kick-off terminal commands such as; mate-terminal --window --zoom=2 --geometry=30x12 --command timer.sh &

Which opened a terminal window and looped over printing the date and time until killed.

Now, I get Failed to parse arguments: Cannot open display:

I think this might be due to the following, as it caused problems with TigerVNC ; chmod 775 /home/ec2-user

I have tried setting DISPLAY to "localhost:0.0" and ":0.0" but to no avail.

I know MATE is a fork of the now unmaintained GNOME 2 but I just can't find enough documentation, so any help is appreciated?

Chris

Can you force a shared object to run as root or use setuid or setgid if its caller is not one of those?

Posted: 03 Aug 2021 09:32 AM PDT

My App needs to have write access to /dev/input/event*. On my Ubuntu system /dev/input/event* is owned by root:input. My app runs fine if I use sudo, but I'm trying to avoid that. So I set my App up to be in the 'input' group and run with setgid. But it's a cross platform App (GTK) which detects and disallows that. (It literally says the GTK has detected it's trying to run as setgid or setuid and it's not going to allow it.) But it's really the .so file that wants to write to /dev/input/event*. I'd feel a lot better if I could allow just this .so (that's in good shape and won't change often) run as root. Or if the .so file got to run as setgid then the GTK environment may not detect it. I've tried setting the special bits on the .so file, but then when I run the app it has the same permissions problem on /dev/input/event*.

simulating user input in a bash script on slurm

Posted: 03 Aug 2021 10:00 AM PDT

I believe my problem is similar as found here but I was confused by the reply (and I can't comment in this question yet due to my low rep).

I have a bash script I need to run using slurm, so when the script needs input from the user, such as this:

Enter y or yes if you want to continue Compass and used cached results.  

The script stops. This line shows up after this line of code runs:

compass --data compass_adipocytes_only_input_transposed.tsv --num-processes 10 --species mus_musculus  

What can I do to make my script reply this with "y"?

This is the entire script

#!/usr/bin/env bash  #SBATCH --job-name=Compass  #SBATCH --ntasks=54  #SBATCH --output=compass.%j.out  #SBATCH --exclusive    # To activate this environment, use  . /tools/Miniconda3.7/etc/profile.d/conda.sh  conda activate /data04/projects04/MarianaBoroni/lbbc_members/lib/conda_envs/compass    which compass      compass --data compass_adipocytes_only_input_transposed.tsv --num-processes 10 --species mus_musculus  yes | compass    # To deactivate an active environment, use:  conda deactivate  exit  

I executed it with the command

sbatch metabolismanalysis.sh  

How to allow Thunderbird to receive local mail (from apps to the user/root) while in offline mode?

Posted: 03 Aug 2021 09:20 AM PDT

I'd like to have Thunderbird running on Debian10/KDE in Offline mode (mostly for security and privacy purposes but also to not receive any other mails) but still be able to receive mails to the user or root from processes / apps running on the machine (e.g. for popup KDE notifications about system events like cronjob-scan-results, intrusion-attempts, file-monitoring etc).

Is that possible (how)?

grep complaining `grep: : No such file or directory`

Posted: 03 Aug 2021 10:29 AM PDT

I am getting the following error from grep and trying to figure out what could be creating the problem.

grep: : No such file or directory  

What can I do?

This is the code

grep -rl "${isufx[@]}" "$ptrn" "${fdir[@]}" |    while read f; do      echo -e $(tput setaf 46)"==> $f <==\n"$(tput sgr0)      grep -ni "${ictx[@]}" "$ptrn" "$f"      echo ""    done  

This is what I have for the variables

fdir:  ./01cuneus  isufx: --include=*.texi --include=*.org  ictx: -C 8  

The arrays were made as follows

ictx=( -C "$ctx" )      for ext in "${incl[@]}"; do    [[ (! -z "$fs") && ("$ext" == *"$fs"*) ]] && s=${ext//"$fs"/" "}      for fltyp in $s; do      isufx+=( --include="*$fltyp" )    done  done    if (( $# >= 1 )); then          declare -A tag                 # declare Associative Array    for dpa in "$@"; do      [[ ! -d $dpa ]] && continue  # skip to next iteration      [[ ${tag[din:$dpa]} ]] && continue      fdir+=("$dpa")      tag[din:$dpa]=1    done  

The command

grep -rl --include=*.texi --include=*.org "short" ./01cuneus  

does not show the problem, all files are valid.

grep -rl --include=*.texi --include=*.org "short" ./01cuneus  ./01cuneus/articles/detailed/advoc/privasec--2018/biographies.texi  ./01cuneus/articles/short/advoc/naiad/2018/q3/2017--naiad--hackers.texi  ./01cuneus/articles/short/advoc/naiad/2017/q4/2017--paul--digital--advocacy.texi  ./01cuneus/articles/short/advoc/ictja/2018--paul--freegeosw.texi  ./01cuneus/articles/short/advoc/ictja/2018--cdi--libertad--cientificos--bsa.texi  ./01cuneus/articles/txMacro/titl-fmatr.texi  ./01cuneus/freelic/latest/freelic-3.4/cc/by-nc-nd/by-nc-nd.texi  ./01cuneus/freelic/latest/freelic-3.4/cc/by-nc-nd/orgts.texi  ./01cuneus/freelic/latest/freelic-3.4/gnu/gfdl-1.3.texi  ./01cuneus/freelic/latest/freelic-3.4/gnu/gpl-3.0.texi  ./01cuneus/freelic/latest/freelic-3.4/gnu/lgpl-3.0.texi  ./01cuneus/freelic/latest/freelic-3.4/gnu/agpl-3.0.texi  ./01cuneus/legal/employer-disclaim.texi  ./01cuneus/legal/university-disclaim.texi  ./01cuneus/books/Infocs/cvs/2017--cdi--cvs.texi  ./01cuneus/books/Infocs/Gra/LibMacro/DocuSeg.mc.texi  ./01cuneus/books/Infocs/Gra/Ch04--GCoreUt/Ch04a--GCoreUt.texi  ./01cuneus/books/GeoMtk/IntegrSeism/03--Snapshots/tdr.0.1--2020.04.22/2020--paul--Tdr--TmExten.texi  ./01cuneus/books/GeoMtk/IntegrSeism/03--Snapshots/tdr.0.1--2020.04.22/tx--chap/Titl--FMatr.macro.texi  ./01cuneus/books/GeoMtk/IntegrSeism/03--Snapshots/tdr.0.2--2020.05.25/2020--paul--Tdr--TmExten.texi  ./01cuneus/books/GeoMtk/IntegrSeism/03--Snapshots/tdr.0.2--2020.05.25/tx--chap/Titl--FMatr.macro.texi  ./01cuneus/books/GeoMtk/IntegrSeism/05--Development/tdr.0.2/chMacro/Titl--FMatr.macro.texi  ./01cuneus/books/GeoMtk/IntegrSeism/05--Development/tdr.0.2/tdr--p01/Titl--FMatr.macro.texi  ./01cuneus/books/GeoMtk/IntegrSeism/05--Development/tdr.0.2/2020--paul--Tdr--TmExten.texi  ./01cuneus/books/GeoMtk/IntegrSeism/02--Releases/tdr--0.1/2019--tdr411--paul.texi  ./01cuneus/books/GeoMtk/IntegrSeism/04--Branches/tdr.0.2/2020--paul--Tdr--TmExten.texi  ./01cuneus/books/GeoMtk/IntegrSeism/04--Branches/tdr.0.2/tx--chap/Titl--FMatr.macro.texi  ./01cuneus/books/WrtCraft/tx--chap/Wrtc--TFMatr.macro.texi  ./01cuneus/tdr/admin/2020-paul-tdr-tmexten.texi  ./01cuneus/tdr/tdr-p01/titl-fmatr.macro.texi  ./01cuneus/tdr/cyclopes/dissert.texi  

How to write a script that monitors the creation of .pdf or .PDF files in the current directory?

Posted: 03 Aug 2021 08:59 AM PDT

We need to display only new files created every minute. I can use watch and find command to either find new files using newermt or find file of certain extension. But, how to do both together.

How do I nest a variable that is a string inside of another variable that is a saved output of a command?

Posted: 03 Aug 2021 09:00 AM PDT

How do I nest a variable that is a string inside of another variable that is a saved output of a command?

I want to accomplish what this code does:

xmrprice=$(curl -s 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cbitcoin-cash%2Clitecoin%2Cmonero&vs_currencies=usd&include_market_cap=true' |jq -r '.monero'|jq -r '.usd')  echo "The price of Monero is $xmrprice"  btcprice=$(curl -s 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cbitcoin-cash%2Clitecoin%2Cmonero&vs_currencies=usd&include_market_cap=true' |jq -r '.bitcoin'|jq -r '.usd')  echo "The price of BTC is $btcprice"  ltcprice=$(curl -s 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cbitcoin-cash%2Clitecoin%2Cmonero&vs_currencies=usd&include_market_cap=true' |jq -r '.litecoin'|jq -r '.usd')  echo "The price of Litecoin is $ltcprice"    

but without calling curl three times. Removing the -s flag would demonstrate that curl is indeed called three times. I want to assign the string from the output of

curl -s https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cbitcoin-cash%2Clitecoin%2Cmonero&vs_currencies=usd&include_market_cap=true  

to a variable and then extract from it the values of xmrprice, brcprice, and ltcprice. Much like this Python code does it:

#!/usr/bin/python3    #pip3 install requests    import requests  import json    result = requests.get("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cbitcoin-cash%2Clitecoin%2Cmonero&vs_currencies=usd&include_market_cap=true", headers = {"accept":"application/json"})    print("Monero's and Bitcoin's prices as of now:")  print(str(result.json()["monero"]["usd"]))  print(str(result.json()["bitcoin"]["usd"]))    

I have come across this question on nesting variables in Bash but it relates more to assigning a nested outputs of multiple commands to a variable.

I've tried all this:

response=$(curl -s https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cbitcoin-cash%2Clitecoin%2Cmonero&vs_currencies=usd&include_market_cap=true)  #xmrprice=(${response}|jq -r '.monero'|jq -r '.usd') #syntax error near unexpected token `|'  #xmrprice=("${response}"|jq -r '.monero'|jq -r '.usd') #syntax error near unexpected token `|'  #xmrprice=$("${response}"|jq -r '.monero'|jq -r '.usd') #{"error":"Missing parameter vs_currencies"}: command not found  #xmrprice=$("{response}"|jq -r '.monero'|jq -r '.usd') #: {response}: command not found    echo "The price of Monero is ${xmrprice}".   

None of it works. The comments describe the errors that I got from Bash.

How install sudo from user without root password

Posted: 03 Aug 2021 08:08 AM PDT

On Debian 10 I do:

adduser myuser  usermod -aG sudo myuser  usermod -p '*' root  reboot  

And then I saw that Debian comes without sudo by default :)

Is possible to install sudo or set root password again without chroot?

How to set bash default shell for the root user

Posted: 03 Aug 2021 08:25 AM PDT

my shell config was changed to zsh for the root user for some reason. This does not allow me to root user and I do not have another user in sudoers file, can I return the shell configuration to bash without having root access or a user in sudoers file? this on a ubuntu server

Why doesn't fdisk -l not show all connected drives?

Posted: 03 Aug 2021 08:30 AM PDT

I've found countless threads started by others where they can't boot from a device because they are using the wrong SATA configuration. Let me assure you this is not my issue.

I work in an IT dept for a company and I have SSDs that I need to wipe. I have created my own Ubuntu machine complete with dcfldd and hdparm (even though I physically break the HDDs). I have several USB to SATA readers connected to the computer to easily swap connected drives to be wiped.

ALL of the SSDs we wipe were initially imaged in the SATA AHCI configuration. When I run fdisk -l in terminal I occasionally run into an SSD that does not get listed.

I've disconnected the drives and tried them in a different SATA reader only to get the same result. The SATA pins on the SSD are not damaged or bent. I've tried using the command hdparm -I /dev/(drive) in an attempt to view information of the drive to see if it's locked/frozen/etc but the command fails.

Internet searches yield no results for how to troubleshoot/fix the issue I have or force the connected drive to get wiped despite it not being recognized by the system.


I humbly have the two following requests for any data gurus who may stumble upon this issue:

  1. I'd love to learn why some of the drives are not being recognized and are inaccessible. If it's likely due to a failed drive, is there something I can do to verify this?
  2. What are my alternatives for wiping these drives that aren't being recognized? I need to securely clear the company data. Being able to verify the data is destroyed is a plus.

EDIT: I don't want to confuse anyone. I follow the US government's protocol and use the command

for n in 'seq 7'; do dcfldd if=/dev/urandom of=/dev/destination bs=8b conv=notrunc; done  

to make the data of the drives unrecoverable. Again, the issue is that /dev/sda is Ubuntu, and drives /dev/sdb - /dev/sdf are the SSDs I am wiping. At times any number of those drives are not listed so the command I use to wipe them does nothing to them. Using commands of this nature are not alternatives to the method I am currently using to wiping the drives.

Also, connecting these drives directly to a SATA cable on the motherboard does not make them recognizable for any live-boot USB.

kill -9 backgrounded job also kills bash

Posted: 03 Aug 2021 10:12 AM PDT

sleep 1 & kill -9 $?  

The above will kill either (most likely) the bash shell or the current terminal window.

Why is that?


NOTE: sleep 1 & kill $? does not kill the shell/terminal.

Just to be sure that I don't run something different what I think, have some race condition, etc., the following also produces the same effect:

/bin/sleep 2 & pid=$?; sleep 1; kill -9 $pid  

GNU bash, version 5.0.3(1)-release

My live kali Linux gets freezed

Posted: 03 Aug 2021 07:26 AM PDT

Recently I've made a live kali on my 32gb pendrive, whenever i use live kali linux it gets freezed and the only option i have at time is to restart my pc. My machine have a core 2 duo and 2gb ram

OpenAL error: 40964 when running an executable

Posted: 03 Aug 2021 07:07 AM PDT

I recently installed the missing libraries for an executable, but I have problems when I run it. It doesn't sound and these are the errors I get when I run it from the terminal.

OpenAL error: 40964 (SoundHardware::Tick)  OpenAL error: 40964 (Audio_Tick Start)  OpenAL error: 40964 (Audio_Tick End)  

This is the ldd of the binary:

user@debian:~/Games/Undertale$ ldd runner       linux-gate.so.1 (0xf7f4c000)      libstdc++.so.6 => /lib/i386-linux-gnu/libstdc++.so.6 (0xf7daf000)      libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7d90000)      libXxf86vm.so.1 => /lib/i386-linux-gnu/libXxf86vm.so.1 (0xf7d89000)      libGL.so.1 => /lib/i386-linux-gnu/libGL.so.1 (0xf7d23000)      libopenal.so.1 => /lib/i386-linux-gnu/libopenal.so.1 (0xf7c2d000)      libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7b27000)      librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf7b1c000)      libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7afb000)      libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7af5000)      libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0xf7912000)      libXext.so.6 => /lib/i386-linux-gnu/libXext.so.6 (0xf78fd000)      libX11.so.6 => /lib/i386-linux-gnu/libX11.so.6 (0xf77ad000)      libXrandr.so.2 => /lib/i386-linux-gnu/libXrandr.so.2 (0xf77a0000)      libGLU.so.1 => /lib/i386-linux-gnu/libGLU.so.1 (0xf7725000)      libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0xf76c1000)      libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf76a3000)      libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf74c5000)      /lib/ld-linux.so.2 (0xf7f4e000)      libGLX.so.0 => /lib/i386-linux-gnu/libGLX.so.0 (0xf74a1000)      libGLdispatch.so.0 => /lib/i386-linux-gnu/libGLdispatch.so.0 (0xf743f000)      libsndio.so.7.0 => /lib/i386-linux-gnu/libsndio.so.7.0 (0xf742c000)      libatomic.so.1 => /lib/i386-linux-gnu/libatomic.so.1 (0xf7422000)      libxcb.so.1 => /lib/i386-linux-gnu/libxcb.so.1 (0xf73f2000)      libXrender.so.1 => /lib/i386-linux-gnu/libXrender.so.1 (0xf73e6000)      libasound.so.2 => /lib/i386-linux-gnu/libasound.so.2 (0xf72cc000)      libbsd.so.0 => /lib/i386-linux-gnu/libbsd.so.0 (0xf72ad000)      libXau.so.6 => /lib/i386-linux-gnu/libXau.so.6 (0xf72a8000)      libXdmcp.so.6 => /lib/i386-linux-gnu/libXdmcp.so.6 (0xf72a1000)  

How can I solve to have sound when the binary is running?

Installing Oracle Linux 8

Posted: 03 Aug 2021 07:55 AM PDT

I have built a virtual machines, the CPU has 1 socket with 4 cores and 4GB memory and it has 3 Disks.

I choose the custom storage method as I want to install OL8 assigning the following:

/root (/) LVM to sda (25GB)    /boot partition to sdb (5GB)    SWAP LVM to sdc (5GB)  

After going through custom setup there is no error prompts at all, it get through to the system reboot prompt, when the server restarts all I see is blinking cursor.

Systemctrl service exit 203, even though script works if started by "hand"

Posted: 03 Aug 2021 09:42 AM PDT

I am using Red Hat Linux 8 and want to create a systectrl command to start a flask script.

The script is working fine, if started manually like: /bin/bash /data_pyt/ro/python_script/folder_python/scripts/python_script.sh

My config looks like the following:

adminUser:/etc/systemd/system# sudo vi python_script.service  [Unit]  Description=Product  After=network.target    [Service]  Type=simple  User=flask  Group=flask  ExecStart="/bin/bash /data_pyt/ro/python_script/folder_python/scripts/python_script.sh"  Restart=always  RestartSec=10s  SyslogIdentifier=python_script    [Install]  WantedBy=multi-user.target  ~  

When starting the service I get:

adminUser:/etc/systemd/system# sudo systemctl daemon-reload  adminUser:/etc/systemd/system# sudo systemctl restart python_script.service  adminUser:/etc/systemd/system# sudo systemctl status python_script.service   python_script.service - Product routing     Loaded: loaded (/etc/systemd/system/python_script.service; disabled; vendor preset: disabled)     Active: activating (auto-restart) (Result: exit-code) since Tue 2021-08-03 15:26:42 CEST; 4s ago    Process: 444293 ExecStart=/bin/bash /data_pyt/ro/python_script/folder_python/scripts/python_script.sh (code=exited, status=203/EXEC)   Main PID: 444293 (code=exited, status=203/EXEC)  adminUser:/etc/systemd/system# sudo systemctl enable python_script.service  Created symlink /etc/systemd/system/multi-user.target.wants/python_script.service → /etc/systemd/system/python_script.service.  adminUser:/etc/systemd/system# sudo systemctl status python_script.service   python_script.service - Product routing     Loaded: loaded (/etc/systemd/system/python_script.service; enabled; vendor preset: disabled)     Active: activating (auto-restart) (Result: exit-code) since Tue 2021-08-03 15:27:13 CEST; 5s ago    Process: 444404 ExecStart=/bin/bash /data_pyt/ro/python_script/folder_python/scripts/python_script.sh (code=exited, status=203/EXEC)   Main PID: 444404 (code=exited, status=203/EXEC)      Tasks: 0 (limit: 101113)     Memory: 0B     CGroup: /system.slice/python_script.service     

The directory scripts/python_script.sh and the *.sh-file have chmod 777

Futhermore, the path /bin/bash /data_pyt/ro/python_script/folder_python/scripts/python_script.sh works when started manually.

Any suggestions where the error might be or how to locate the error?

I appreciate your replies!

execute command on all visible shells

Posted: 03 Aug 2021 08:38 AM PDT

I'm currently running a tiling window manager and I want to be able to use a custom function that is equivalent to one I had when I was using tmux that allowed me to run a command in all visible shells in the current window (E.G. ta cd to/dir)

The command/function was called ta meaning "to all"

I've managed to create the following function:

function ta() {      local current_workspace="$(xdotool get_desktop)"      local to_execute="`if [[ \"$current_workspace\" = \"\$(xdotool get_desktop)\"  ]]; then; $@; fi`"        for pts in $(ls  /dev/pts | grep -o '[0-9]*'); do          echo "$to_execut" > /dev/pts/$pts      done  }  

If I run the command manually like this:

te="`if [[ \"$current_workspace\" = \"\$(xdotool get_desktop)\"  ]]; then; xdotool get_desktop; fi`"    echo "$te" > /dev/pts/1  

I see the output 0 in my current shell

If I try to run my ta I get nothing, and I've noticed that even for the commands that do work, are only the commands that output something, so I it's actually executing the string I'm storing and then outputting that.

Does any one have any better suggestions?

Centos/RHEL 8 systemd service not able to reference script from custom location

Posted: 03 Aug 2021 08:20 AM PDT

I am trying to create a systemd service, for a simple script present in a location (other than /usr/local/bin..)

Below script is under /home/vagrant/temp/test.sh

#!/bin/sh    MAX=500  i=0;  while true  do  i=$((i+1));  sleep 2  echo "$i = $(date)"  if [ $i == $MAX ]; then    exit 0;  fi;  done;  fi  

I created simple service named usr-print.service under /etc/systemd/system/. The content of the file is

[Unit]  Description=Simple print service  After=network.target    [Service]    Type=simple  Restart=always  StandardOutput=journal  StandardError=journal    ExecStart=/home/vagrant/temp/test.sh    [Install]  WantedBy=multi-user.target  

when i start the service using systemctl daemon-reload; systemctl start usr-print.service i get below exception.

● usr-print.service - Simple print service     Loaded: loaded (/etc/systemd/system/usr-print.service; disabled; vendor preset: disabled)     Active: failed (Result: exit-code) since Mon 2021-08-02 06:10:39 UTC; 7s ago    Process: 1504 ExecStart=/home/vagrant/temp/test.sh (code=exited, status=203/EXEC)   Main PID: 1504 (code=exited, status=203/EXEC)    Aug 02 06:10:39 localhost.localdomain systemd[1]: usr-print.service: Main process exited, code=exited, status=203/EXEC  Aug 02 06:10:39 localhost.localdomain systemd[1]: usr-print.service: Failed with result 'exit-code'.  Aug 02 06:10:39 localhost.localdomain systemd[1]: usr-print.service: Service RestartSec=100ms expired, scheduling restart.  Aug 02 06:10:39 localhost.localdomain systemd[1]: usr-print.service: Scheduled restart job, restart counter is at 5.  Aug 02 06:10:39 localhost.localdomain systemd[1]: Stopped Simple print service.  Aug 02 06:10:39 localhost.localdomain systemd[1]: usr-print.service: Start request repeated too quickly.  Aug 02 06:10:39 localhost.localdomain systemd[1]: usr-print.service: Failed with result 'exit-code'.  Aug 02 06:10:39 localhost.localdomain systemd[1]: Failed to start Simple print service.  

But if I move the script and update the usr-print.service file with ExecStart=/usr/local/bin/test.sh the service starts as expected.

Is there a way to user the /home/vagrant/temp/test.sh path in service file?

Centos 7 - ExecStart=/home/vagrant/temp/test.sh in service file works (shell is running)

Centos/RHEL 8 - ExecStart=/home/vagrant/temp/test.sh in service file DOES NOT work.

Removing invalid and repeating directories from an array

Posted: 03 Aug 2021 09:41 AM PDT

How can I remove repeating directory names in an array named fdir.

Have made an initial attempt which does not work.

  if (( $# >= 1 )); then      for lpath in "$@"; do          fdir_redundant=false        for fde in "${fdir[@]}"; do          [[ $fde == $lpath ]] && fdir_redundant=true        done        [[ (-d "$lpath") && (! $fdir_redundant) ]] && fdir+=("$lpath")        done          else      fdir=("$PWD")    fi  

How to confirm I'm connected with WPA3 (on Linux Mint 20.2)?

Posted: 03 Aug 2021 09:02 AM PDT

In my TP-Link router, I have set WPA version 2/3:

router WPA 2&3

I am on Linux Mint 20.2 and I have explicitly set WPA3 for my connection:

mint WPA 3 explicit


sudo wpa_cli status wlp60s0  

outputs:

Selected interface 'p2p-dev-wlp60s0'  wpa_state=DISCONNECTED  ...  

and

sudo iwlist wlp60s0 scanning  

outputs:

wlp60s0   Scan completed :            Cell 01 - Address: [mac-censored]                      Channel:48                      Frequency:5.24 GHz (Channel 48)                      Quality=58/70  Signal level=-52 dBm                        Encryption key:on                      ESSID:"[ssid-censored]"                      Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s                                36 Mb/s; 48 Mb/s; 54 Mb/s                      Mode:Master                      Extra:tsf=00000009e5fb8041                      Extra: Last beacon: 652ms ago                      ...                      IE: IEEE 802.11i/WPA2 Version 1                          Group Cipher : CCMP                          Pairwise Ciphers (1) : CCMP                          Authentication Suites (2) : PSK unknown (8)  

Question:

I am testing WPA3, so far only Steam has had some crashes due to WPA3 that I know of, a quote:

... Fixed crashes when on a WPA3 wireless network ...

How to confirm I'm connected with WPA3 (on Linux Mint 20.2)?


The furthest I managed to get was to verify the connected (as for searching for yes) network is WPA3-capable or more precisely WPA2/WPA3 as set in the router using nmcli:

sudo nmcli -f all -s dev wifi | grep -e yes -e SSID  

which outputs:

NAME   SSID                SSID-HEX                              BSSID              MODE   CHAN  FREQ      RATE        SIGNAL  BARS  SECURITY   WPA-FLAGS                 RSN-FLAGS                     DEVICE   ACTIVE  IN-USE  DBUS-PATH                                        AP[2]  [censored]          [censored]                            [censored]         Infra  48    5240 MHz  270 Mbit/s  79      ▂▄▆_  WPA2 WPA3  (none)                    pair_ccmp group_ccmp psk sae  wlp60s0  yes     *       /org/freedesktop/NetworkManager/AccessPoint/1    

How to enable audio output with pulseaudio when it is running?

Posted: 03 Aug 2021 09:26 AM PDT

Here I described trouble installing pulseaudio due to mismatching dependencies when using packages of Kodi19 on Debian10. This is now resolved insofar that after a recent upgrade I was able to install pulseaudio and get it running via this command: sudo apt-get install pulseaudio/buster-backports libpulse0/buster-backports libasound2-plugins.

My problem now is that the audio output still isn't working even though pulseaudio is running. I tried some changes to client.conf, daemon.conf and default.pa as described here and here. It still doesn't work. I didn't have this problem before the audio stops working. I recently noticed the sound output actually still does work (for local audio files) but only over headphones (and then there's still no volume icon in the tray bar etc).

How to get audio output working again? If changes to the config files are needed how to find out which changes are required? Any ideas about why this problem occurred?


Running pulseaudio -k didn't restart pulseaudio.
The audio output still worked for online streaming even before pulseaudio was installed.

Another Debian10/KDE machine with almost the same setup including Kodi19 doesn't have this problem.

Once pulseaudio works there should be a volume-icon in the tray bar and the volume-buttons should work again.

There shouldn't be any need to change configs to get audio working after installing pulseaudio (which should never have been removed anyway as I didn't deliberately remove it).

I also have e.g. gstreamer1.0-pulseaudio installed. When I search for "pulse" "Audio Volume" is not showing upl in the search results like on another machine so maybe I need to install some additional package. Or maybe I need to clear some configs.

When I run pulseaudio in the console because it doesn't get restarted after running pulseaudio -k I get Failed to load module "module-native-protocol-unix" (argument: ""): initialization failed. (it does start it nevertheless).

One other thing that might have to do with it, is that running an upgrade with apper or sudo apt-get upgrade asks me to downgrade libwayland-client++0 libwayland-cursor++0 which appears to work but even after rebooting it still asks for the same two downgrades. This was solved by rerunning the setup steps for Basil Gello's repo.

Make the first character following a semicolon uppercase, for each line of a text file

Posted: 03 Aug 2021 07:30 AM PDT

I have a text file like this

John Doe;john Doe is ...;he lives in ...  Mike Nelson;mike Nelson works for ...;he makes ...  Marcy William;marcy's mother is ...;marcy travels a lot...   

I want to convert every character following a semicolon to uppercase, so the final result is

John Doe;John Doe is ...;He lives in ...  Mike Nelson;Mike Nelson works for ...;He makes ...  Marcy William;Marcy's mother is ...;Marcy travels a lot...  

keeping the rest intact.

This file contains accented letters and is coded in UTF-8.

KALI/Ubuntu running in VirtualBox: RALINK 5370 USB Wifi driver not working

Posted: 03 Aug 2021 09:07 AM PDT

Sometimes lsusb shows my Ralink 5370 USB Wifi adapter and sometimes it doesn't. When it does, the Wifi tab appears and it appears to be searching for available Wifis. Then my VM starts to lag with no results so I had to eject Wifi adapter. Other USB devices are working reliably. I verified that the Wifi adapter is shared with the VM (Devices -> USB menu).

Host system: MacOS

To rule out hardware problems I tested the Wifi adapter on Windows 10 and it works fine.

NUT UPS Setup Errors

Posted: 03 Aug 2021 08:47 AM PDT

I'm having a strange issue while trying to configure NUT on a CentOS 6 machine to control an Eaton 5E UPS.

I've taken the following steps

# yum install nut  # yum install usbutils  

Then updated nut.conf

MODE=standalone  

I confirmed that the UPS was visible

# lsusb    Bus 003 Device 006: ID 0463:ffff MGE UPS Systems UPS  

Then updated ups.conf

[eaton5e]      driver = usbhid-ups      port = auto      desc = "Eaton5E"      vendorid = 0463  

Then attempted to run the driver control which failed

# upsdrvctl start    Network UPS Tools - UPS driver controller 2.6.5  Network UPS Tools - Generic HID driver 0.37 (2.6.5)  USB communication driver 0.31  No matching HID UPS found  Driver failed to start (exit status=1)  

When I tried to debug it though I got another error and I'm not sure why

# usbhid-ups -DDD -a eaton5e    *bunch of stuff*  0.000799     Trying to match device  0.000813     Device matches  0.001630     Unable to get HID descriptor (error sending control message: Broken pipe)  0.001636     HID descriptor, method 2: (9 bytes) => 09 21 10 01 21 01 22 25 02  0.001641     HID descriptor length 549  0.001890     Unable to get Report descriptor: Broken pipe  *more bunch of stuff*  

I've been fighting this thing for a while now but without any luck, has anyone encountered this before?

Restart nut-driver when data stale, usb device keeps changing

Posted: 03 Aug 2021 08:45 AM PDT

I have a PowerWalker VI 850 LCD ups connected to a Raspberry Pi Model B+ via USB. I have been trying to use NUT to monitor it, with lots of problems. First, it seems that the protocol detection wasn't working right, and I've since specified protocol = mustek and that seems to have partially stabilized it--now every time I start the nut-driver service it actually connects.

However, another quirk is that for some reason the USB device keeps changing (e.g. from /dev/bus/usb/001/005 at boot to 006 or 007) without warning or apparent cause. I tried to work around this by adding a SYMLINK parameter to my udev rule:

ACTION=="add", \  SUBSYSTEM=="usb", \  ATTR{idVendor}=="0665", ATTR{idProduct}=="5161", \  SYMLINK+="powerwalkerups" \  MODE="0660", GROUP="nut"  

Which makes sure /dev/powerwalkerups always points to the right bus device. But--it seems, at least--whenever the USB device magically changes, the nut-driver loses it connection and I get the wonderful "data stale" message. Just, now whenever I restart it, it will actually connect up properly with a good protocol and works. But I have to manually systemctl restart nut-driver.

Is there an automatic way to make NUT try restarting the driver if the data goes stale? Or can someone recommend a watchdog type process that will do this for me? Since the service doesn't actually stop, systemd doesn't see the service as failed. How can I try to restart the service at least once to see if that resolves connectivity?

(Or, any idea how to stop it from disconnecting in the first place?)

Uptime on my NUT host is now 5 days and the USB device has wiggled all the way up from 005 to 012. So, I'm running Icinga2 on another host, and I'm going to look into making it restart the service...but that requires SSH access from the Icinga host to the NUT host :-P. Better ideas?

How to find all symbolic links pointing to any file/directory inside a given directory

Posted: 03 Aug 2021 09:30 AM PDT

On this question or on this one (for example) you will get solutions on how to look for symlinks pointing to a given directory (let's call it /dir1), while I am interested to symbolic links possibly pointing to any file/folder inside /dir1.

I want to delete such directory but I am not sure that I am safe to do so, as on an other directory (let's call it /dir2), I may have symlinks pointing to inner parts of /dir1.

Further, I may have created these symlinks using absolute or relative paths. My only help is that I know the symlinks I want to check are on a mounted filesystem, on /dir2.

problem of denied access using kvm

Posted: 03 Aug 2021 08:07 AM PDT

I would like to test kvm with opensuse tumbleweed. I successfully installed kvm, but I am stuck in creating my first VM.

The trick is that I want to have the VM's directory in an external HDD.

When I set the directory of the VM file I get this error message:

Impossible de terminer l'installation : « Cannot access storage file '/run/media/lowley/424b7b47-883d-42ac-b6f3-994c0c01c01f/sauvegardes/fedora-haskell.qcow2' (as uid:471, gid:10): Permission denied »

I am not very strong in managing user rights. I set root belong to the kvm group, but I still have this error.

can you help me?

thank you

olivier

EDIT

I launch it by a entering virt-manager, as me and not as root. In fact I have a shortcut on the desktop.

What's the difference between SFTP, SCP and FISH protocols?

Posted: 03 Aug 2021 08:03 AM PDT

I used to think SCP is a tool to copy files over SSH, and copying files over SSH is called SFTP, which is itself a synonym to FISH.

But now as I was looking for a Total Commander plugin to do this in Windows, I've noticed that on its page it says "Allows access to remote servers via secure FTP (FTP via SSH). Requires SSH2. This is NOT the same as SCP!".

If it's not the same then what am I misunderstanding?

No comments:

Post a Comment