Wednesday, June 15, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


can you modify the filename during "find"

Posted: 15 Jun 2022 12:31 PM PDT

find uses {} to indicate "this file"(ish). You can feed a series of files into myprog, thus:

find ./tests/ -name *.in -exec myprog -i {} \;  

Is there a way to modify the name in {}? In my case, I use -i to define an input file and -o for the output, and I would like the output to go to a slightly modified file name, such that "a.in" would produce "a.out". Ideally, I would like something to the effect of:

find ./tests/ -name *.in -exec myprog -i {} -o {}.out \;  

Additionally, the output directory may be a different path. In this case, the output would not go to /tests/ but perhaps /tests_20220615/.

I've looked at numerous pages with examples of find, and nothing like this shows up, so perhaps "no"?

I know there are ways to do this using loops in bash or zsh, but the list of possible gotchas is great ("nullglob"?!), and if find can do this it seems much safer to this noob.

RHEL 7.9 remote install fails / stalls at Plymouth Boot Screen

Posted: 15 Jun 2022 12:19 PM PDT

I am trying to install RHEL 7 on a remote HP system which is quite old. It is running ilo v2.

I am remotely mounting the ISO and it is reading it fine. I get the initial choice screen.

I felt like I had GUI issues, so I started install in text mode. But I still get stuck at below (see screenshot)

remote terminal...

on the 4th tty I see this. It seems it is struggling with login service. (stop/start/stop/start....) om

2: DEBUG log 1

debug log 2:

enter image description here

Driver for AX88179 Gigabit Ethernet

Posted: 15 Jun 2022 11:57 AM PDT

I have the following Ethernet to USB-C adapter:

$ lsusb | grep Ethernet  Bus 002 Device 003: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet  

Currently it is not working when plugged into the USB-C port, in dmesg I get:

[23552.344134] ax88179_178a 2-1:2.1 eth1: Failed to read reg index 0x0000: -32  

(However, it works on a different machine, but the error is still shown, and the transfer rate seems limited.)

I am wondering if I have the correct driver installed. I've seen that axge seems to be the correct driver, but it does not show up in lsmod.

What is the correct driver to use for AX88179, how to check if it is installed, and how to install it otherwise?

I am currently using Linux Mint 20.3.

Using 2 For loop print the output of 2 answers from two different files

Posted: 15 Jun 2022 10:55 AM PDT

I have 2 files with some content/lines.

Example :

cat a.txt    1    2    3    4    cat b.txt    a    b    c    d  

Need to get below output using for loop

 1 a   2 b   3 c   4 d  

I have tried the below script but it gives the wrong output

for i in `cat a.txt`   do     for j in `cat b.txt`     do        echo $i and $j     done   done    1 and a  1 and b  1 and c  1 and d  2 and a  2 and b  2 and c  2 and d  3 and a  3 and b  3 and c  3 and d  4 and a  4 and b  4 and c  4 and d  

Kindly help me to do with For loop. Thanks in Advance

smbclient works but mount.cifs doesn't (NT_STATUS_MORE_PROCESSING_REQUIRED)

Posted: 15 Jun 2022 10:12 AM PDT

I am attempting to access a file share on an old machine which uses SMBv1. This is a remote machine which I do not have physical access to, but I believe it runs Windows XP.

I can access it fine using smbclient '\\172.25.162.14\nda20' -N -m NT1 --option="client min protocol"=NT1. However, I am unable to mount it with mount.cifs. It just sits there doing nothing for several minutes before eventually showing:

> mount -t cifs -vvvv //172.25.162.14/nda20 /mnt/aa -o vers=1.0,guest  mount.cifs kernel mount options: ip=172.25.162.14,unc=\\172.25.162.14\nda20,vers=1.0,user=,pass=********  mount error(11): Resource temporarily unavailable  Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)  

If I enable debugging:

echo 7 > /proc/fs/cifs/cifsFYI  echo 1 > /proc/fs/cifs/traceSMB  

Then dmesg shows the following:

[85673.032167] CIFS: fs/cifs/cifsfs.c: Devname: //172.25.162.14/nda20 flags: 0  [85673.032181] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers  [85673.039302] CIFS: fs/cifs/connect.c: Anonymous login  [85673.039307] CIFS: fs/cifs/connect.c: file mode: 0755  dir mode: 0755  [85673.039310] CIFS: fs/cifs/connect.c: VFS: in mount_get_conns as Xid: 110 with uid: 0  [85673.039311] CIFS: fs/cifs/connect.c: UNC: \\172.25.162.14\nda20  [85673.039313] CIFS: fs/cifs/connect.c: Existing tcp session with server found  [85673.039314] CIFS: fs/cifs/connect.c: VFS: in cifs_get_smb_ses as Xid: 111 with uid: 0  [85673.039316] CIFS: fs/cifs/connect.c: Existing smb sess not found  [85673.039318] CIFS: fs/cifs/connect.c: Security Mode: 0x3 Capabilities: 0x8000e3fd TimeAdjust: -3600  [85673.039319] CIFS: fs/cifs/sess.c: sess setup type 4  [85673.039321] CIFS: fs/cifs/sess.c: rawntlmssp session setup negotiate phase  [85673.039327] 0000 d800                                ....  [85673.039329] 53ff 424d 0073 0000 0000 c801 0000 0000  .SMBs...........  [85673.039330] 0000 0000 0000 0000 0000 6778 0000 000f  ..........xg....  [85673.039332] ff0c 0000 5400 0a40 0100 0000 0000 2000  .....T@........   [85673.039332] 00 00 00 00 00 dc c0 00 80 9d 00                 ...........  [85673.039334] 544e 4d4c 5353 0050 0001 0000 0225 a008  NTLMSSP.....%...  [85673.039335] 0000 0000 0000 0000 0000 0000 0000 0000  ................  [85673.039336] 4c00 6900 6e00 7500 7800 2000 7600 6500  .L.i.n.u.x. .v.e  [85673.039338] 7200 7300 6900 6f00 6e00 2000 3500 2e00  .r.s.i.o.n. .5..  [85673.039339] 3100 3000 2e00 3000 2d00 3100 3500 2d00  .1.0...0.-.1.5.-  [85673.039340] 6300 6c00 6f00 7500 6400 2d00 6100 6d00  .c.l.o.u.d.-.a.m  [85673.039341] 6400 3600 3400 0000 4300 4900 4600 5300  .d.6.4...C.I.F.S  [85673.039342] 2000 5600 4600 5300 2000 4300 6c00 6900  . .V.F.S. .C.l.i  [85673.039343] 6500 6e00 7400 2000 6600 6f00 7200 2000  .e.n.t. .f.o.r.   [85673.039344] 00 4c 00 69 00 6e 00 75 00 78 00 00 00           .L.i.n.u.x...  [85673.059537] 0000 fb00 53ff 424d 1673 0000 80c0 c801  .....SMBs.......  [85673.059538] 0000 0000 0000 0000 0000 0000 0000 6778  ..............xg  [85673.059540] 1000 000f ff04 fb00 0000 8600 d000 4e00  ...............N  [85673.059541] 4c54 534d 5053 0200 0000 0a00 0a00 3800  TLMSSP.........8  [85673.059543] 0000 2500 8a02 8ca2 0df2 4c5d 49de 000d  ...%......]L.I..  [85673.059544] 0000 0000 0000 4400 4400 4200 0000 0500  .......D.D.B....  [85673.059546] 2801 000a 0000 530f 4300 4100 4400 4100  .(.....S.C.A.D.A  [85673.059547] 0200 0a00 5300 4300 4100 4400 4100 0100  .....S.C.A.D.A..  [85673.059548] 0a00 5300 4300 4100 4400 4100 0400 0a00  ...S.C.A.D.A....  [85673.059549] 5300 4300 4100 4400 4100 0300 0a00 5300  .S.C.A.D.A.....S  [85673.059550] 4300 4100 4400 4100 0600 0400 0100 0000  .C.A.D.A........  [85673.059551] 0000 0000 0000 0057 0069 006e 0064 006f  ......W.i.n.d.o.  [85673.059553] 0077 0073 0020 0035 002e 0031 0000 0057  w.s. .5...1...W.  [85673.059554] 0069 006e 0064 006f 0077 0073 0020 0032  i.n.d.o.w.s. .2.  [85673.059555] 0030 0030 0030 0020 004c 0041 004e 0020  0.0.0. .L.A.N. .  [85673.059556] 4d 00 61 00 6e 00 61 00 67 00 65 00 72 00 00     M.a.n.a.g.e.r..  [85673.059576] 0000 fb00 53ff 424d 1673 0000 80c0 c801  .....SMBs.......  [85673.059578] 0000 0000 0000 0000 0000 0000 0000 6778  ..............xg  [85673.059579] 1000 000f ff04 fb00 0000 8600 d000 4e00  ...............N  [85673.059581] 4c54 534d 5053 0200 0000 0a00 0a00 3800  TLMSSP.........8  [85673.059582] 0000 2500 8a02 8ca2 0df2 4c5d 49de 000d  ...%......]L.I..  [85673.059583] 0000 0000 0000 4400 4400 4200            .......D.D.B  [85673.059585] CIFS: Status code returned 0xc0000016 NT_STATUS_MORE_PROCESSING_REQUIRED  [85673.064232] CIFS: fs/cifs/netmisc.c: Mapping smb error code 0xc0000016 to POSIX err -5  [85673.064248] CIFS: fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release  [85673.064251] CIFS: fs/cifs/sess.c: rawntlmssp session setup challenge phase  [85673.064252] CIFS: fs/cifs/sess.c: UID = 4096  [85673.064254] CIFS: fs/cifs/sess.c: rawntlmssp session setup authenticate phase  [85673.064278] 0000 0c01                                ....  [85673.064279] 53ff 424d 0073 0000 0000 c801 0000 0000  .SMBs...........  [85673.064281] 0000 0000 0000 0000 0000 6778 1000 0010  ..........xg....  [85673.064282] ff0c 0000 5400 0a40 0100 0000 0000 5400  .....T@........T  [85673.064283] 00 00 00 00 00 dc c0 00 80 d1 00                 ...........  [85673.064284] 544e 4d4c 5353 0050 0003 0000 0000 0000  NTLMSSP.........  [85673.064286] 0040 0000 0000 0000 0040 0000 0000 0000  @.......@.......  [85673.064287] 0040 0000 0000 0000 0040 0000 0000 0000  @.......@.......  [85673.064288] 0042 0000 0010 0010 0044 0000 0225 a088  B.......D...%...  [85673.064289] 0000 0000 fae3 63dc 6008 8a82 56b6 756d  .......c.`...Vmu  [85673.064290] 58fd f5ac                                .X..  [85673.064291] 4c00 6900 6e00 7500 7800 2000 7600 6500  .L.i.n.u.x. .v.e  [85673.064292] 7200 7300 6900 6f00 6e00 2000 3500 2e00  .r.s.i.o.n. .5..  [85673.064294] 3100 3000 2e00 3000 2d00 3100 3500 2d00  .1.0...0.-.1.5.-  [85673.064295] 6300 6c00 6f00 7500 6400 2d00 6100 6d00  .c.l.o.u.d.-.a.m  [85673.064296] 6400 3600 3400 0000 4300 4900 4600 5300  .d.6.4...C.I.F.S  [85673.064297] 2000 5600 4600 5300 2000 4300 6c00 6900  . .V.F.S. .C.l.i  [85673.064298] 6500 6e00 7400 2000 6600 6f00 7200 2000  .e.n.t. .f.o.r.   [85673.064299] 00 4c 00 69 00 6e 00 75 00 78 00 00 00           .L.i.n.u.x...  [85791.774454] CIFS: fs/cifs/cifssmb.c: In echo request  [85791.774461] AllocMidQEntry: 5 callbacks suppressed  [85791.774464] CIFS: fs/cifs/transport.c: For smb_command 43  [85791.777750] __smb_send_rqst: 5 callbacks suppressed  [85791.777751] CIFS: fs/cifs/transport.c: Sending smb: smb_len=42  [85791.780928] 0000 2600                                ...&  [85791.780930] 53ff 424d 002b 0000 0000 8001 0000 0000  .SMB+...........  [85791.780931] 0000 0000 0000 0000 ffff 6470 0000 0000  ..........pd....  [85791.780932] 0101 0100 6100                           .....a  [85853.211229] CIFS: fs/cifs/cifssmb.c: In echo request  [85853.211234] CIFS: fs/cifs/transport.c: For smb_command 43  [85853.211239] CIFS: fs/cifs/transport.c: Sending smb: smb_len=42  [85853.211244] 0000 2600                                ...&  [85853.211246] 53ff 424d 002b 0000 0000 8001 0000 0000  .SMB+...........  [85853.211248] 0000 0000 0000 0000 ffff 6470 0000 0000  ..........pd....  [85853.211250] 0101 0100 6100                           .....a  [85859.356975] CIFS: VFS: \\172.25.162.14 has not responded in 180 seconds. Reconnecting...  [85859.361809] CIFS: fs/cifs/connect.c: cifs_reconnect: will retry 1 target(s)  [85859.361810] CIFS: fs/cifs/connect.c: Mark tcp session as need reconnect  [85859.361811] CIFS: fs/cifs/connect.c: cifs_reconnect: marking sessions and tcons for reconnect  [85859.361813] CIFS: fs/cifs/connect.c: cifs_reconnect: tearing down socket  [85859.361814] CIFS: fs/cifs/connect.c: State: 0x3 Flags: 0x0  [85859.361846] CIFS: fs/cifs/connect.c: Post shutdown state: 0x3 Flags: 0x0  [85859.361852] CIFS: fs/cifs/connect.c: cifs_reconnect: moving mids to private list  [85859.361854] CIFS: fs/cifs/connect.c: cifs_reconnect: issuing mid callbacks  [85859.361856] CIFS: fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release  [85859.361858] CIFS: fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release  [85859.361872] CIFS: fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: probably server name is whole unc: \\172.25.162.14  [85859.361874] CIFS: fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: unc is IP, skipping dns upcall: 172.25.162.14  [85859.361876] CIFS: fs/cifs/connect.c: generic_ip_connect: connecting to 172.25.162.14:445  [85859.361888] cifs_sync_mid_result: 4 callbacks suppressed  [85859.361890] CIFS: fs/cifs/transport.c: cifs_sync_mid_result: cmd=115 mid=16 state=8  [85859.361896] CIFS: fs/cifs/connect.c: Socket created  [85859.365253] CIFS: fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x6d6  [85859.365254] CIFS: fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release  [85859.365262] CIFS: VFS: \\172.25.162.14 Send error in SessSetup = -11  [85859.369030] CIFS: fs/cifs/connect.c: VFS: leaving cifs_get_smb_ses (xid = 111) rc = -11  [85859.369034] CIFS: fs/cifs/dfs_cache.c: __dfs_cache_find: search path: \172.25.162.14\nda20  [85859.369037] CIFS: fs/cifs/dfs_cache.c: get_dfs_referral: get an DFS referral for \172.25.162.14\nda20  [85859.369039] CIFS: fs/cifs/connect.c: VFS: leaving mount_put_conns (xid = 110) rc = 0  [85859.369040] CIFS: VFS: cifs_mount failed w/return code = -11  [86010.843369] CIFS: fs/cifs/connect.c: Received no data or error: -104  [86010.843375] CIFS: fs/cifs/connect.c: cifs_reconnect: will retry 1 target(s)  [86010.843376] CIFS: fs/cifs/connect.c: Mark tcp session as need reconnect  [86010.843377] CIFS: fs/cifs/connect.c: cifs_reconnect: marking sessions and tcons for reconnect  [86010.843378] CIFS: fs/cifs/connect.c: cifs_reconnect: tearing down socket  [86010.843379] CIFS: fs/cifs/connect.c: State: 0x3 Flags: 0x0  [86010.843381] CIFS: fs/cifs/connect.c: Post shutdown state: 0x3 Flags: 0x0  [86010.843392] CIFS: fs/cifs/connect.c: cifs_reconnect: moving mids to private list  [86010.843393] CIFS: fs/cifs/connect.c: cifs_reconnect: issuing mid callbacks  [86010.843396] CIFS: fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: probably server name is whole unc: \\172.25.162.14  [86010.843398] CIFS: fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: unc is IP, skipping dns upcall: 172.25.162.14  [86010.843400] CIFS: fs/cifs/connect.c: generic_ip_connect: connecting to 172.25.162.14:445  [86010.843407] CIFS: fs/cifs/connect.c: Socket created  [86010.843409] CIFS: fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x6d6  

Any idea what's wrong with it? Or tips to find out?

Additional information:

Debian 11  Linux VM-DMS-App-01 5.10.0-15-cloud-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64 GNU/Linux  mount.cifs version: 6.11  

Bash script doesn't allow variables to be created/used [duplicate]

Posted: 15 Jun 2022 10:32 AM PDT

I'm at a loss at the moment with a problem regarding my bash script trying to convert midi input into key strokes using xdotool.

#!/bin/bash  aseqdump -p "USB MIDI cable" | \  while IFS=" ," read src ev1 ev2 ch label1 data1 label2 data2 rest; do      case "$ev1 $ev2 $data1" in          "Note on 48" ) if[$octave=0]                            then                              xdotool key 9; octave=1                          elif[$octave=1]                            then xdotool key 1                          else                              xdotool key 0; octave=1                          fi ;;          "Note on 36" ) xdotool key 9; octave=0 ;;        esac  done  

for my problem: If I understand creating variables correctly, then pressing the key responsible for "Note 36" should set octave to 0 though the if statement on "Note 48" doesn't recognize it. in Addition even using a simpler

if[$octave=1] then xdotool key 1 fi ;;  

Does not work with the variable provided.

sooo in the end what the script is supposed to do is convert midi input from a device to keystrokes though depending on the keys pressed beforehand the same key is supposed to output different keystrokes.

Additional Information

  • I am currently running on Ubuntu 22.04
  • The Keys are so far read and translated correctly, only the variable creates issues

RHEL + can we improve disks performance by tuning kernel parameters?

Posted: 15 Jun 2022 09:54 AM PDT

we have Hadoop cluster and we are collection metrics collection data in order to investigate slowness behavior on spark applications

after long investigation on our Hadoop cluster

we noticed from Prometheus metrics point that node_disk_io_now is with high values more then normal , and its relevant for all HDFS disks on data-node machines

the node_disk_io_now definition is:

node_disk_io_now (field 9) The only field that should go to zero. Incremented as requests are given to appropriate struct request_queue and decremented as they finish.

we want to know , if tuning kernel parameters can gives positive aspects on disks performance

according to node_disk_io_now definition , seems that too many tasks are waiting in queue ,

and maybe some kernel parameters can help to improve the above bhavior so tasks in queue , will not be there for a long time

Comparing Sets with 'comm'

Posted: 15 Jun 2022 09:49 AM PDT

Trying to get a list of available IP addresses based off all usable IPs in a range when compared to a device's ARP table.

Basing what I'm doing with comm on this discussion: Intersection of two arrays in BASH

Creating ranges of IPs to compare against - e..g 192.168.20.0/23

RANGE1=(192.168.20.{2..255})  RANGE2=(192.168.21.{0..254})  RANGE=("${RANGE1[@]}" "${RANGE2[@]}")  printf '%s\n' "${RANGE[@]}" | LC_ALL=C sort > "${IPSETS_DIR}/<city-alias>_set.txt"  

$1 is an IP of a network device. OID is basically a device's ARP table. GREP_SEARCH example: "192.168.20|192.168.30|192.168.55"

$(which snmpbulkwalk) -v2c -c <community-string> "${1}" .1.3.6.1.2.1.4.35.1.4 > "${RESULTS_FILE}"  STRIPPED_RESULTS=( $(cut -d\" -f2 "${RESULTS_FILE}" | egrep -w "(^|\s)${GREP_SEARCH}") )  printf "%s\n" "${STRIPPED_RESULTS[@]}" | LC_ALL=C sort > "${STRIPPED_FILE}"  

The walk returns results such as:
IP-MIB::ipNetToPhysicalPhysAddress.118161416.ipv4."X.X.X.X" = STRING: XX:XX:XX:XX:XX:XX

I then compare using the below. $1 is city-alias.

$(which comm) -13 "${STRIPPED_FILE}" "${IPSETS_DIR}/${1}_set.txt" > "${DIR}/${1}_stored_results.txt"  

This MOSTLY works, but I'm still getting IPs that are in use. Not sure what I'm missing.

Cloud platform(IAAS) use baremetal hypervisor or hosted hypervisor?

Posted: 15 Jun 2022 09:34 AM PDT

Are the IAAS platforms use baremetal hypervisor or hosted hypervisor? Example vSphere, AWS, Esxi etc..? Which one is good if the number of VMs are more?

grub tries to read the kernel off encrypted root (not boot) partition

Posted: 15 Jun 2022 09:21 AM PDT

I am trying to set up encrypted arch with external boot partition on sd card because I want to be able to leave the boot partition at the house so I can leave things in the encrypted setup without worrying about for example losing my laptop at for example uni and having certain stuff available to just anyone with a bit of pen experience.

As of right now I have most of the install done. But when trying to boot, grub drops me into rescue shell and gives error:

attempt to read outside hd0. This means then it is seeing the sd card as hd0 and my actual harddrive as hd1.

I don't know how to make grub set roots properly. In /boot/grub/grub.cfg a lot of lines say: linux linux-zen root=UUID=ea17.. which is my /dev/mapper/cryptoroot uuid. They should say uuid=BBF1.. which is my fat32 /dev/mmcblk0p1 sd card unencrypted boot partition.

I was looking through grub.d/10_linux trying to find out how to make grub-mkconfig put in the correct uuid's. But i can't seem to understand the code well enough. In /etc/fstab are both the mount points for boot and root configured but it will put root uuid where boot uuids need to be anyway.

I was thinking maybe I could make my own version of update-grub that subsequently to grub-mkconfig also replaces the uuid's with the correct ones. If this would be the simplest solution, please let me know what i should use for scripting that.

Thanks for your time

RAID + how to manipulate the disk size with RAID controller

Posted: 15 Jun 2022 09:09 AM PDT

We have 3 Hadoop HDFS servers on DELL HW physical machines , when all servers are with RHEL 7.2 version

Each server include 3 HDFS disks when each disk is 1TB

Now we want to do add another 3 Hadoop servers with 3 disks per machine

The problem is that we not found 1TB disks , and what we can buy is only disks with 2TB

The Second problem is that when is dealing with HDFS disks , then all HDFS disks must be with the same size

Because the disks on the old servers can reached 100% use space while the new servers with the 3 disks of 2TB will be half of the used space

So basically all HDFS disks should be with the same size

So my Question is – can we manipulate by RAID the disks on the new servers , in way that Linux will identify the 2TB as 1TB disk?

.desktop file not showing icon in kde plasma

Posted: 15 Jun 2022 09:07 AM PDT

I created the following .desktop file:

[Desktop Entry]  Name=Firefox Nightly  Comment=Web Browser  Exec=/opt/firefox/firefox %u  Terminal=false  Type=Application  Icon=/opt/firefox/browser/chrome/icons/default/default128.png  Categories=Network;WebBrowser;  

And it shows the icon in /usr/share/applications: https://i.imgur.com/bG38jWi.png

When it opens, it shows the icon for a split-second, but then it shows this: https://i.imgur.com/RcTI9Ki.png (the orange and white icon)

Things I've tried:

  • Restarted Kde Plasma
  • Reloaded icon cache
  • Change the icon for another one (it still shows the W)

Any ideas?

Thank you in advance

Programmatically scroll as little distance as possible in Linux

Posted: 15 Jun 2022 09:06 AM PDT

I'm working on an autoscroll script for Linux and I'm trying to find a way to scroll as little distance as possible. I know I can generate mouse events using uinput (in particular, I can send REL_WHEEL events from a fake device in order to scroll) or Xorg-specific libraries, e.g. the pynput library for Python. The problem is that the distance scrolled by one mouse event is too big for my script to work smoothly at low speed.

What I've thought of so far:

  • sending REL_WHEEL_HI_RES events instead of REL_WHEEL
  • creating a fake touchpad device and generating scroll events from it

The first doesn't work - the events are generated correctly but nothing happens. The second is probably not possible.

How to upgrade MySQL 8 community server minor versions?

Posted: 15 Jun 2022 09:14 AM PDT

Currently I have installed MySQL 8.0.26 in Oracle Linux server. But due to the security vulnerabilities I have to upgrade it to 8.0.27. Is there way to do it?

find: only delete files which we're allowed to delete

Posted: 15 Jun 2022 12:09 PM PDT

I'm using find to delete files matching some criteria:

find -type f [more criteria] -delete  

That works fine, in general, but I'm running into issues with sub-directories created by other users: as far as I understand, whether I'm allowed to delete a file depends on my permissions w.r.t. the parent directory. Hence the command above fails for files contained in a sub-directory created by another user:

fbrucker@host /tmp $ ls -lh  total 4,0K  drwxrwxr-x 2 root root 4,0K Jun 15 11:44 foo/    fbrucker@host /tmp $ ls -lh foo/  total 0  -rw-rw-r-- 1 fbrucker fbrucker 0 Jun 15 11:44 a  -rw-rw-r-- 1 root     root     0 Jun 15 11:44 b    fbrucker@host /tmp $ find -type f -delete  find: cannot delete './foo/b': Permission denied  find: cannot delete './foo/a': Permission denied  

It's OK that I cannot delete the files, but the missing permissions make find exit with a non-zero status. I'd like to avoid that.

How can I filter out files that I cannot delete before trying to delete them?

Note that simply filtering out the error messages is not enough for me, since that will still leave me with the non-zero exit code. Also, ignoring the exit code completely won't work for me, because I do want catch other errors (my real find command is more complex, for example for find /somedir -type f -delete I'd like to not ignore the error that is raised when /somedir does not exist).

I know that find has tests for the file's permissions (e.g. -perm, -readable, -writable), but I don't think they apply here. For example,

fbrucker@host /tmp $ find -type f -writable  ./foo/a  

even though I cannot delete foo/a since I don't have the necessary permissions on foo.

What I'm looking for is something like a -deletable test, which doesn't seem to exist.

Bash variable substitution with json string as variable within larger json object

Posted: 15 Jun 2022 09:50 AM PDT

EDIT: Answer which solved the issue for me:

  1. Surround the string with single quotes SCHEMA_DEFINITION='{\"name\":\"Hello\"}'
  2. Replace all double quotes with backslash double quote SCHEMA_DEFINITION=${SCHEMA_DEFINITION//\"/\\\"}

This gives SCHEMA_DEFINITION='{\"name\":\"Hello\"}' which is what I needed to get the command working aws glue create-schema --cli-input-json '{"RegistryId": {"RegistryName": "hxp-schema-registry"},"SchemaName": "'$modelClassName'","DataFormat": "AVRO","Compatibility": "FULL_ALL","SchemaDefinition": "'$SCHEMA_DEFINITION'"}'

--- Original Post ---

I am having trouble getting the AWS cli working nicely with a bash variable. The AWS cli command takes in a JSON string as a parameter. However, within this json string I am using a variable $SCHEMA_DEFINITION which itself is a JSON string. For some reason the double quotes are being removed from $SCHEMA_DEFINITION and making it invalid JSON. How can I preserve these quotes and still produce a valid AWS command?

aws glue create-schema --cli-input-json '{"RegistryId": {"RegistryName": "hxp-schema-registry"},"SchemaName": "'$modelClassName'","DataFormat": "AVRO","Compatibility": "FULL_ALL","SchemaDefinition": "'"$SCHEMA_DEFINITION"'"}'  

Gives the error:

An error occurred (InvalidInputException) when calling the CreateSchema operation: Schema definition of AVRO data format is invalid: Unexpected character ('n' (code 110)): was expecting double-quote to start field name   at [Source: (String)"{name:hello}"  

Here is how I set the variable: SCHEMA_DEFINITION={"name":"Hello"}

alpine email client 2.22 gmail error BAD Client aborted AUTHENTICATE command

Posted: 15 Jun 2022 11:57 AM PDT

I'm on ubuntu 20.04 and use alpine as my email client for gmail. About a week ago I had to change the authentication method from user-password to xoauth2 due to gmail disabling secure apps (meaning I have to set up an id and secret). This worked fine till today when I got this error message:

IMAP protocol error: Client aborted AUTHENTICATE command.  

Runing alpine with debug options give me this:

02:54:10.270683   609   │ IMAP DEBUG 02:54:10.270683: * OK Gimap ready for requests from 200.126.96.24 f10mb126061768oov   610   │    611   │ 02:54:10.270814   612   │ IMAP DEBUG 02:54:10.270814: 00000000 CAPABILITY   613   │    614   │ 02:54:10.399210   615   │ IMAP DEBUG 02:54:10.399210: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1          │ XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH   616   │    617   │ 02:54:10.399329   618   │ IMAP DEBUG 02:54:10.399329: 00000000 OK Thats all she wrote! f10mb126061768oov   619   │    620   │ 02:54:10.399947   621   │ IMAP DEBUG 02:54:10.399947: 00000001 AUTHENTICATE XOAUTH2   622   │    623   │ 02:54:10.529686   624   │ IMAP DEBUG 02:54:10.529686: +    625   │    626   │ 02:54:16.085145   627   │ IMAP DEBUG 02:54:16.085145: *   628   │    629   │ 02:54:16.215203   630   │ IMAP DEBUG 02:54:16.215203: 00000001 BAD Client aborted AUTHENTICATE command. f10mb126061768oov   631   │    632   │ 02:54:16.215320   633   │ IMAP DEBUG 02:54:16.215320: 00000002 LOGOUT   634   │    635   │ 02:54:16.345417   636   │ IMAP DEBUG 02:54:16.345417: * BYE Logout Requested f10mb126061768oov   637   │    638   │ 02:54:16.345567   639   │ IMAP DEBUG 02:54:16.345567: 00000002 OK Quoth the raven, nevermore... f10mb126061768oov  

Looking around in google haven't give me any hints so far as to what the issue can be. Also, I can't access alpine site (https://alpine.x10host.com/).

The important stuff of .pinerc are:

          smtp-server : smtp.gmail.com:465/ssl/auth=xoauth2/user=user@gmail.com             inbox-path : {imap.gmail.com:993/ssl/auth=xoauth2/user=user@gmail.com}INBOX       postponed-folder : {imap.gmail.com:993/ssl/auth=xoauth2/user=user@gmail.com}[GMAIL]/Drafts  

I also tried the smtp-server with tls and port 587.

EDIT: Kind of testing out, I deleted .pine-passfile to do the authorization again. That worked, meaning I can access gmail now, but I have to re-do the whole process every time since there is no .pine-passfile created now.... Any ideas?

Replace last field with previous one

Posted: 15 Jun 2022 12:23 PM PDT

I have a file that look like this one:

10-04-2022 00:39:13,36707,1455008753,32  11-05-2022 00:39:13,36708,1555008753,26  21-05-2022 00:39:13,36708,1555408753,15  12-06-2022 00:39:13,36709,1655008753  

Because values into last field are related to running time of next line, I would like to shift down them to this way for using with gnuplot.

10-04-2022 00:39:13,36707,1455008753,  11-05-2022 00:39:13,36708,1555008753,32  21-05-2022 00:39:13,36708,1555408753,26  12-06-2022 00:39:13,36709,1655008753,15  

No longer able to input circumflex or diaeresis accented characters (qt5 apps only !)

Posted: 15 Jun 2022 10:44 AM PDT

Currently running KDE-Plasma-5.23.5 (X backend)/ KDE-Frameworks-5.90.0 / QT-5.15.3
I can assert that this used to work perfectly but am unfortunately unable to assert from which version of what the problem started to occur systematically.


Whatever the qt5 application I launch (kmail, kate, konsole, dolphin, qtdesigner…) I am no longer able to key in the â ä ë ê î ï ô ö ü û (as well as corresponding uppercase) characters. (usually possible via hitting the dedicated dead key then the desired vowel)

Keying any other directly accessible accentuated character works fine.

I suspect this problem to be restrained to qt5-ed apps since it does not impact non qt5-ed applications such as The-Gimp, Firefox, Chromium, Yoshimi (fltk), my Arduino prototyping platform, audacity… all launched from the same user under the same DE.


UPDATE 1 / XMODIFIERS :

Curiously enough, If I export XMODIFIERS= before launching my DE, or even within some konsole session, then, if I launch kate manually (via bash), the problem does not occur.
It however still occurs when starting kate from the KDE menu or clicking on its icon.
Therefore my problem would become, how should I set XMODIFIERS so that whatever qt5 app could automagically honour it ?
BTW, unless I export it explicitly, this variable is not part of the environment when my DE is running.

zfs pool metadata corrupt

Posted: 15 Jun 2022 11:40 AM PDT

I am an idiot. I had on my list to get my offsite backups set up and .. you guessed it, I didn't get around to it before this happened. I actually thought I had set up local backups properly but it turns out that no, I hadn't. Anyway:

I'm new to ZFS. I am running Proxmox, and enabled passthrough on 9 drives on a HDA card to a TrueNAS VM for a pool. I have two NVMe drives though I think I only set one of them up for caching, and one SSD for Proxmox. For reasons that aren't clear to me, my zpool corrupted yesterday. My Proxmox host seems aware of the pool, which is odd to me because I created the pool in the TrueNAS guest.

I have tried running zpool import with -f -F -FX and -fFX flags. I'm not sure if I should be running these commands on the host or the guest. I've also tried with --readonly=on and (on the host) I've tried setting echo 0 > /sys/module/zfs/parameters/spa_load_verify_metadata, although I haven't tried doing that before trying to import the zpool on the guest, because frankly, I'm a bit freaked out that both the host and guest seem to have access to the pool and I'm not sure that that isn't contributing to the problem.

The error I'm getting is that the metadata is corrupt. I don't know if this is related, but this happened around the time I was trying to get a GPU installed and PCIe/GPU passthrough enabled in Proxmox for that device.

Proxmox:

root@proxmox:~# zpool import     pool: Seabreeze       id: 821564149027342835    state: FAULTED  status: The pool metadata is corrupted.   action: The pool cannot be imported due to damaged devices or data.          The pool may be active on another system, but can be imported using          the '-f' flag.     see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-72   config:            Seabreeze   FAULTED  corrupted data            raidz2-0  FAULTED  corrupted data              sdf2    ONLINE              sdh2    ONLINE              sdc2    ONLINE              sde2    ONLINE              sdj2    ONLINE              sdb2    ONLINE              sdg2    ONLINE              sdd2    ONLINE              sdi2    ONLINE  root@proxmox:~#  

TrueNAS:

truenas% sudo zpool import     pool: Seabreeze       id: 821564149027342835    state: FAULTED  status: The pool was last accessed by another system.   action: The pool cannot be imported due to damaged devices or data.          The pool may be active on another system, but can be imported using          the '-f' flag.     see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY   config:            Seabreeze                                       FAULTED  corrupted data            raidz2-0                                      FAULTED  corrupted data              gptid/bb911e9d-c067-11ec-b393-734570047b00  ONLINE              gptid/bbb5c9f6-c067-11ec-b393-734570047b00  ONLINE              gptid/bba92ac5-c067-11ec-b393-734570047b00  ONLINE              gptid/bbbf0f87-c067-11ec-b393-734570047b00  ONLINE              gptid/bbda0fa2-c067-11ec-b393-734570047b00  ONLINE              gptid/bc03effa-c067-11ec-b393-734570047b00  ONLINE              gptid/bc114e59-c067-11ec-b393-734570047b00  ONLINE              gptid/bbd0f901-c067-11ec-b393-734570047b00  ONLINE              gptid/bc18eaf4-c067-11ec-b393-734570047b00  ONLINE  truenas%  

Is my data recoverable?

E: Unable to locate package azure-functions-core-tools-4

Posted: 15 Jun 2022 10:29 AM PDT

Running a docker container, trying to install azure-functions-core-tools-4. I can search for the package in the configured repo, but it fails to find the package when I try to install it. I have already run apt update several times, so that's not it.

root@eddf41a4eea9:/app# apt install azure-functions-core-tools-4  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  E: Unable to locate package azure-functions-core-tools-4  root@eddf41a4eea9:/app# apt search azure-functions-core-tools  Sorting... Done  Full Text Search... Done  azure-functions-core-tools-3/bullseye 3.0.3904-1 amd64    Azure Function Core Tools v3    azure-functions-core-tools-4/bullseye 4.0.3971-1 amd64    Azure Function Core Tools v3  

Some more information

root@eddf41a4eea9:/app# cat /etc/*release  PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"  NAME="Debian GNU/Linux"  VERSION_ID="11"  VERSION="11 (bullseye)"  VERSION_CODENAME=bullseye  ID=debian  HOME_URL="https://www.debian.org/"  

Contents of /etc/apt/sources.list.d/dotnetdev.list

root@eddf41a4eea9:/app# cat /etc/apt/sources.list.d/dotnetdev.list  deb [arch=amd64] https://packages.microsoft.com/debian/11/prod bullseye main  

What does KDE Compositor Tearing prevention ("vsync") do under the hood?

Posted: 15 Jun 2022 11:06 AM PDT

I have screen tearing issues. When I set Tearing prevention ("vsync") in Compositor to something else and then back to Automatic the screen tearing is gone. I would like to know what configuration files Tearing prevention ("vsync") changes to troubleshoot this problem and find a permanent fix.

I test for screen tearing with this video.

I also have screen tearing with the latest live iso with both free and non-free drivers.

Operating System: Manjaro Linux   KDE Plasma Version: 5.18.5  KDE Frameworks Version: 5.70.0  Qt Version: 5.15.0  Kernel Version: 5.6.16-1-MANJARO  OS Type: 64-bit  Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz  Memory: 15,5 GiB of RAM  GPU: Nvidia GeForce 940M  

How to create a kill switch for xdotool?

Posted: 15 Jun 2022 10:12 AM PDT

I used xdotool to automate some actions. It takes data from a spreadsheet, and "types" it into a Web site, instead of me having to manually copy and paste all of that data over, saving hundreds of hours of work. This is running through a simple while loop, and the data extracted using awk from the spreadsheet.

The problem is, sometimes either while testing out a new xdotool Bash script, or just in some random cases, xdotool starts to wreck havoc on things, and it is difficult to stop. I have to switch back to the terminal window, and hit CTRL+C quickly, but in the meantime, it can do some damaging things, such as type in potentially dangerous code in the terminal that mistakenly gets executed. The most serious issues I've actually had is that it takes over and I can't regain control of things.

Is there some way to integrate, perhaps into the Bash script, some kind of "kill switch", perhaps for instance, if I hit a certain key combo on the keyboard, it tells it to immediately stop running?

Restore single files from a btrfs snapshot without doing a full copy

Posted: 15 Jun 2022 11:29 AM PDT

Background

I maintain a series of hourly snapshots on my btrfs filesystem using btrbk. The subvolume and snapshots are stored like this (names shortened to make it easier to follow):

/@vol               (subvolume)  /btrbk/@vol.00      (snapshots of /@vol, one per hour)  /btrbk/@vol.01      ...  /home/user/vol      (mountpoint for /@vol)  

Now I deleted a single file in /home/user/vol which I should not have deleted. No problem, I can easily restore from the latest snapshot:

# cd /home/user/vol  # cp -a --reflink=always /btrbk/@vol.01/all_ipv4_numbers.txt ./  cp: failed to clone './all_ipv4_numbers.txt' from '/btrbk/@vol.01/all_ipv4_numbers.txt': Invalid cross-device link  

Seems I can't "reflink" the file. But I don't want to end up with two copies of the file. Ideally I want it to look like nothing happened between the most recent snapshot and the next snapshot that will be taken in the future.

(Yes, I also have actual backups, but restoring from snapshots are more convenient whenever available!)

Question

How do I restore a single file from a btrfs snapshot while keeping all the nice references and magic that makes btrfs know that it is the same data in all the snapshots?

How do I make all GTK applications use a custom DPI setting?

Posted: 15 Jun 2022 12:00 PM PDT

After upgrading from Debian 8 to Debian 9, the text editor Pluma (a Gedit fork) no longer use my custom DPI setting. I noticed the same thing with the editor Geany. Here are my Xft settings in ~/.Xresources:

Xft.antialias: true  Xft.autohint: false  Xft.dpi: 100  Xft.hinting: true  Xft.hintstyle: hintslight  Xft.lcdfilter: lcddefault  Xft.rgba: rgb  

The other Xft settings above are picked up Pluma, however. On the other hand, the text editor Leafpad correctly uses the DPI setting. Any clues? I use the window manager Blackbox started from a console.

Pluma (with DejaVu Sans 10):

enter image description here

Leafpad (with DejaVu Sans 10):

enter image description here

How to get trailing data of gzip archive?

Posted: 15 Jun 2022 11:49 AM PDT

I have a gzip archive with trailing data. If I unpack it using gzip -d it tells me: "decompression OK, trailing garbage ignored" (same goes for gzip -t which can be used as a method of detecting that there is such data).

Now I would like to get to know this garbage, but strangely enough I couldn't find any way to extract it. gzip -l --verbose tells me that the "compressed" size of the archive is the size of the file (i.e. with the trailing data), that's wrong and not helpful. file is also of no help, so what can I do?

Replacing only specific variables with envsubst

Posted: 15 Jun 2022 10:50 AM PDT

I'm trying to perform environment variable replacement through envsubst, but I want to only replace specific variables.

From the docs I should be able to tell envsubst to only replace certain variables but I'm failing to be able to do that.

For example, if I have a file containing:

VAR_1=${VAR_1}  VAR_2=${VAR_2}  

how should I execute envsubst so that it only replaces the reference to ${VAR_1}?

Security implications of forgetting to quote a variable in bash/POSIX shells

Posted: 15 Jun 2022 11:46 AM PDT

If you've been following unix.stackexchange.com for a while, you should hopefully know by now that leaving a variable unquoted in list context (as in echo $var) in Bourne/POSIX shells (zsh being the exception) has a very special meaning and shouldn't be done unless you have a very good reason to.

It's discussed at length in a number of Q&A here (Examples: Why does my shell script choke on whitespace or other special characters?, When is double-quoting necessary?, Expansion of a shell variable and effect of glob and split on it, Quoted vs unquoted string expansion)

That has been the case since the initial release of the Bourne shell in the late 70s and hasn't been changed by the Korn shell (one of David Korn's biggest regrets (question #7)) or bash which mostly copied the Korn shell, and that's how that has been specified by POSIX/Unix.

Now, we're still seeing a number of answers here and even occasionally publicly released shell code where variables are not quoted. You'd have thought people would have learnt by now.

In my experience, there are mainly 3 types of people who omit to quote their variables:

  • beginners. Those can be excused as admittedly it's a completely unintuitive syntax. And it's our role on this site to educate them.

  • forgetful people.

  • people who are not convinced even after repeated hammering, who think that surely the Bourne shell author did not intend us to quote all our variables.

Maybe we can convince them if we expose the risk associated with this kind of behaviours.

What's the worst thing that can possibly happen if you forget to quote your variables. Is it really that bad?

What kind of vulnerability are we talking of here?

In what contexts can it be a problem?

How to start an application as GNOME would by command line?

Posted: 15 Jun 2022 10:05 AM PDT

How would I start an application (by launcher) the exact same way as GNOME would, in a command line interface? I want to set some environment variables.

I know I can check the launcher file for the 'EXEC' command but for some reason that command makes my application crash; while when it's launched through GNOME it works fine.

Linux tools to treat files as sets and perform set operations on them

Posted: 15 Jun 2022 11:19 AM PDT

Does anyone know of any linux tool specifically designed to treat files as sets and perform set operations on them? Like difference, intersection, etc?

No comments:

Post a Comment