Tuesday, November 30, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Missing values in outpu file

Posted: 30 Nov 2021 07:28 AM PST

I have three text files and I want to combine them in one text file.

Input files:

1_val.txt

0x0000000000060b7c02555b80  0x0000000000060b7c026c6580  0x0000000000060b7c0285ff80  

2_val.txt

0x0000000000060b7c0257a180  0x0000000000060b7c026eab80  0x0000000000060b7c02884580  

3_val.txt

2.2734  2.2734  2.2734  

Expected output:

values.txt

0x0000000000060b7c02555b80 0x0000000000060b7c0257a180 2.2734  0x0000000000060b7c026c6580 0x0000000000060b7c026eab80 2.2734  0x0000000000060b7c0285ff80 0x0000000000060b7c02884580 2.2734  

Output generated: The last three values in the first and second column are missing.

0x0000000000060b7c02555 0x0000000000060b7c0257a 2.2734  0x0000000000060b7c026c6 0x0000000000060b7c026ea 2.2734  0x0000000000060b7c0285f 0x0000000000060b7c02884 2.2734  

The code I used to get this done,

pr -m -t 1_val.txt 2_val.txt 3_val.txt > values.txt  

Kill process once it produces certian output

Posted: 30 Nov 2021 07:20 AM PST

I'm running a program which executes (mostly) correctly, but then hangs. I'd like to run the program such that once it outputs a certain string, or stops producing output it gets killed.

The output string I'm interested in is:

Was exported to:  

After I see this output, I'd like to automatically kill the program. Alternatively, the program stops producing output after this, so I could kill it based on that condition. How can I accomplish one of these?

Routing traffic from Server A via VPN Server B

Posted: 30 Nov 2021 07:01 AM PST

I have IPSec (Libreswan) Server B (10.0.0.2) and a Server A (10.0.0.1) within the same network. Both servers have only one external network interface. I want to route the packets from Server A with source IP belonging to remote network (192.168.1.1, right side of IPSec) via Server B.

Server A ====> Server B == IPSEC ==> Remote IP

I add a route on server A like:

ip route add 192.168.1.1 via 10.0.0.1

And expect the traffic to be routed automatically in Server B to IPSec tunnel.

Telnet from Server B is okay:

telnet 192.168.1.1 22  Trying 192.168.1.1...  Connected to 192.168.1.1.  Escape character is '^]'.  

Telnet from Server A times out:

telnet 192.168.1.1 22  Trying 192.168.1.1...  telnet: connect to address 192.168.1.1: Connection timed out  

IP Forwarding is enabled on Server B:

sysctl net.ipv4.ip_forward  net.ipv4.ip_forward = 1  

What should I configure on Server B to route traffic from Server A to IPSec tunnel?

can't SSH from docker container to remote server

Posted: 30 Nov 2021 07:13 AM PST

on my host server I have my user with generated private and public keys. I have copied public key value to my remote server authorized_keys file. I have mapped new docker container instance to use the .ssh folder as a volume and set network to the host's network.

-v /home/jenkins/.ssh:/home/jenkins/.ssh --network host'  

Now I try to SSH authenticate myself inside the container towards the remote computer.

ssh -vvv -o StrictHostKeyChecking=no jenkins@10.7.175.143  

My user does not have SSH pass phrase. Output on the SSH server side:

sshd: Failed none for jenkins from 10.7.148.219 port 42058 ssh2  sshd: Failed password for jenkins from 10.7.148.219 port 42058 ssh2  

Output on the client side:

+ ssh -vvv -o 'StrictHostKeyChecking=no' jenkins@10.7.175.143  OpenSSH_8.6p1, OpenSSL 1.1.1l  24 Aug 2021  debug1: Reading configuration data /etc/ssh/ssh_config  debug2: resolve_canonicalize: hostname 10.7.175.143 is address  debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'  debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'  debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling  debug3: ssh_connect_direct: entering  debug1: Connecting to 10.7.175.143 [10.7.175.143] port 22.  debug3: set_sock_tos: set socket 3 IP_TOS 0x48  debug1: Connection established.  .................................    debug1: Authentications that can continue: publickey,password,keyboard-interactive  debug3: start over, passed a different list publickey,password,keyboard-interactive  debug3: preferred publickey,keyboard-interactive,password  debug3: authmethod_lookup publickey  debug3: remaining preferred: keyboard-interactive,password  debug3: authmethod_is_enabled publickey  debug1: Next authentication method: publickey  debug1: Trying private key: /root/.ssh/id_rsa  debug3: no such identity: /root/.ssh/id_rsa: No such file or directory  debug1: Trying private key: /root/.ssh/id_dsa  debug3: no such identity: /root/.ssh/id_dsa: No such file or directory  debug1: Trying private key: /root/.ssh/id_ecdsa  debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory  debug1: Trying private key: /root/.ssh/id_ecdsa_sk  debug3: no such identity: /root/.ssh/id_ecdsa_sk: No such file or directory  debug1: Trying private key: /root/.ssh/id_ed25519  debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory  debug1: Trying private key: /root/.ssh/id_ed25519_sk  debug3: no such identity: /root/.ssh/id_ed25519_sk: No such file or directory  debug1: Trying private key: /root/.ssh/id_xmss  debug3: no such identity: /root/.ssh/id_xmss: No such file or directory  debug2: we did not send a packet, disable method  debug3: authmethod_lookup keyboard-interactive  debug3: remaining preferred: password  debug3: authmethod_is_enabled keyboard-interactive  debug1: Next authentication method: keyboard-interactive  debug2: userauth_kbdint  debug3: send packet: type 50  debug2: we sent a keyboard-interactive packet, wait for reply  debug3: receive packet: type 51  debug1: Authentications that can continue: publickey,password,keyboard-interactive  debug3: userauth_kbdint: disable: no info_req_seen  debug2: we did not send a packet, disable method  debug3: authmethod_lookup password  debug3: remaining preferred:   debug3: authmethod_is_enabled password  debug1: Next authentication method: password  debug1: read_passphrase: can't open /dev/tty: No such device or address  debug3: send packet: type 50  debug2: we sent a password packet, wait for reply  debug3: receive packet: type 51  debug1: Authentications that can continue: publickey,password,keyboard-interactive  debug2: we did not send a packet, disable method  debug1: No more authentication methods to try.  jenkins@10.7.175.143: Permission denied (publickey,password,keyboard-interactive).  

Can I somehow authenticate my self from the docker container?

Bash - how to run scl_devtool-9 and get the gcc --version output

Posted: 30 Nov 2021 06:36 AM PST

My bash script:

   #!/bin/bash    scl enable devtoolset-9 bash  gcc --version  

result: devtoolset-9 is now enable on the system but I don't have the gcc --version output. How can I run the bash script with the gcc --version outout.

Thank you

using grep to retrieve entries from excel

Posted: 30 Nov 2021 06:28 AM PST

My question is similar to what has been discussed here: 3 answers Basic grep/awk help - extracting all lines containing a list of terms from one file into a separate file

I don't have coding experience but I have used simple scripts to analyse my data. I am trying to print out some specific rows from an excel sheet (database.txt file) containing specific names which I have saved in another set1.txt file. The grep command grep -w -F -f set1.txt database.txt > test.txt works but it only retrieves one of the entries, whereas in my set1.txt file I have specified several entries. I have tried changing the format but still I get only one entry retrieved. There is something which I am missing here and I would really appreciate if someone can help me with this.

Thank you!

how to add arch zfs rpo to pacman on arch linux

Posted: 30 Nov 2021 06:17 AM PST

how to add arch zfs rpo to pacman on arch linux ?


on my arch linux am getting this error

❯ nocorrect sudo pacman -Syu  [sudo] password for beasly:   error: archzfs: signature from "ArchZFS Bot <buildbot@archzfs.com>" is invalid  error: could not register 'archzfs' database (database already registered)  :: Synchronizing package databases...  error: failed to synchronize all databases (no servers configured for repository)  

what have tried

  1. ntpd -qg followed by hwclock -w

  2. removing the /etc/pacman.d/gnupg folder (as root) and by rerunning pacman-key --init followed by pacman-key --populate archlinux to re-add the default keys

  3. Import keys of archzfs repository:

curl -L https://archzfs.com/archzfs.gpg |  pacman-key -a -  pacman-key --lsign-key $(curl -L https://git.io/JsfVS)  curl -L https://git.io/Jsfw2 > /etc/pacman.d/mirrorlist-archzfs  

Add archzfs repository:

tee -a /etc/pacman.conf <<- 'EOF'    #[archzfs-testing]  #Include = /etc/pacman.d/mirrorlist-archzfs    [archzfs]  Include = /etc/pacman.d/mirrorlist-archzfs  EOF  

Update pacman database:

pacman -Sy  
  1. /etc/pacman.d/gnupg/gpg.conf and change the keyserver line to:

keyserver hkp://keyserver.ubuntu.com


❯ uname -a  Linux lenovo 5.15.5-arch1-1 #1 SMP PREEMPT Thu, 25 Nov 2021 22:09:33 +0000 x86_64 GNU/Linux              /0.1s  

Open URL in new window in Firefox and not in tab

Posted: 30 Nov 2021 06:20 AM PST

How do I make Firefox open a URL in a new Window and not in a tab by default?

In Thunderbird, when I click, I get the URL opened in a tab. I would like to have a new window spawned. The specific version I am on is Firefox 94.0.

What does pr -m -t means?

Posted: 30 Nov 2021 07:05 AM PST

What does pr -m -t mean? I managed to find out that -t suppresses headers and footers. What does -m mean specifically?

Syncing several locations having btrfs - how to propagate rename/move of files/folders from both ends?

Posted: 30 Nov 2021 06:18 AM PST

I want to be able to sync some folders between hard drives, maybe with remote later. rsync as of now does not support propagating renames. bugzilla discussion Bug 2294 - Detect renamed files and handle by renaming instead of delete/re-send :

elatllat 2021-01-15 14:19:12 UTC

This feature request is so old it has lost relavence because btrfs/zfs/etc are more optimal backup solutions than rsync.

I don't mind much trying btrfs filesystem (I now use etx4 mostly). But I want not just backup, but sync solution, where changes (including renames) can happen on both ends. Does btrfs support sync out of the box, if yes, what is the command? If not, what are methods to sync if btrfs is on both ends? What happens with them if a file was renamed on both ends?

How to format computer I used to dual boot?

Posted: 30 Nov 2021 05:03 AM PST

My Mint install is very slow on idle and my python is broken after downloading packages for python2 and 3 - all imports stopped working.

Currently I have windows10 and Mint on my machine, and I want to format my computer to wipe out both of these for a new lighter distribution of Linux, in which I can carefully set up virtual environments and virtual machines in order to not break my python install again.

Currently my disk is divided as so:

enter image description here

I believe FS3 is the Windows reserved partition, and FS5 is the Windows Disk. I have tried deleting the latter, to no avail.

If I format regularly with another distro, will all these disks be wiped out?

Windows 10 won't boot from GRUB after installing qemu-system-i386 on ubuntu

Posted: 30 Nov 2021 05:08 AM PST

I've been using dual boot Windows 10 with Ubuntu 20.04 for over a year now. Yesterday I updated installed apps on linux with sudo apt-get update and then installed qemu with sudo apt-get install qemu-system-i386.

Today the GRUB loads as usual and Ubuntu works well, but the Windows 10 can't boot and the startup repair or system restore don't work.

Has anyone experienced similar issues and knows how to solve this issue?

Edit: I have also tried this, but it doesn't help: Create a file, /boot/grub/custom.cfg (by running sudo -H gedit /boot/grub/custom.cfg) with these contents:

#This entry should work for any version of Windows installed for UEFI booting    menuentry "Windows (UEFI)" {   search --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi   chainloader /EFI/Microsoft/Boot/bootmgfw.efi  }  

Then rebooted and selected Windows (UEFI).

Warnings Resource is promotable but has not been promoted on any node

Posted: 30 Nov 2021 07:04 AM PST

when i configuring cluster i get warning:

Resource is promotable but has not been promoted on any node  

My conf.

pcs resource create pgsqld ocf:heartbeat:pgsqlms            \  op start timeout=60s                                                            op stop timeout=60s                                                             op promote timeout=30s                                                          op demote timeout=120s                                                          op monitor interval=15s timeout=10s role="Master"                               op monitor interval=20s timeout=10s role="Slave"                                op notify timeout=60s     pcs resource create ip-virtual ocf:heartbeat:IPaddr2 \  ip=102.161.210.117 cidr_netmask=24 op monitor interval=10s    pcs resource promotable pgsqld notify=true    pcs constraint order promote pgsqld-clone then start ip-virtual symmetrical=false kind=Mandatory    pcs constraint order demote pgsqld-clone then stop ip-virtual symmetrical=false kind=Mandatory  

But not interesting at log's files.

Pls help me, i don't know what to do. =(

UPD, score promotion

pcs resource debug-start pgsqld

Operation force-start for pgsqld (ocf:heartbeat:pgsqlms) returned: 'ok' (0) /tmp:5432 - accepting connections

could not change directory to "/tmp/.private/root": Permission denied could not change directory to "/tmp/.private/root": Permission denied Nov 30 17:59:55 INFO: Instance "pgsqld" already started

"$-" Returns 569X During ZSH Invocation [duplicate]

Posted: 30 Nov 2021 07:12 AM PST

Background

While studying the shell parameter, $-, for sh, bash, and zsh, I discovered that it returned current option flags, hBc, for both sh and bash but 569X for zsh.

SUSE >> bash -c 'echo "$0"; echo "$-"'  bash  hBc  
SUSE >> sh -c 'echo "$0"; echo "$-"'  sh  hBc  
SUSE >> zsh -c 'echo "$0"; echo "$-"'  zsh  569X  

Issue

I used man zsh to find information about 569X but found nothing. Could someone explain why "$-" is returning 569X for zsh?

enumerate all matches in file with sed or perl

Posted: 30 Nov 2021 06:08 AM PST

I have next file:

:~$ cat test          <Set Id="16">                  <Ver="44" Sniff="no" B2vpnId="" Collision="no">          </Set>                  <Set Id="17">                  <Ver="22" Sniff="no" B2vpnId="" Collision="no">          </Set>  

and I need to increment B2vpnId value in file, I found a way how to get this change in output:

:~$ i=1;while read -r line; do echo "$line"|sed -e 's/B2vpnId=""/B2vpnId="'"vpn$i"'"/';((i+=1));done <<< "$(cat test|grep B2vpnId=)"  <Ver="44" Sniff="no" B2vpnId="vpn1" Collision="no">  <Ver="22" Sniff="no" B2vpnId="vpn2" Collision="no">  

but since I have many other config lines I need this change in file itself and cannot find a way to do it.

Comparison of unsorted and mixed case files to select only unique entries

Posted: 30 Nov 2021 07:18 AM PST

I've been facing some setbacks while having two way comparison in files.

  • File1
    bill   telephone  address_1  address_2  address_3  city  postal_code  
  • File2
    Bill  Bill_ID  Telephone  Address_1  Address_2  city  Postal_Code  

I'm trying to populate values which are unique in both the files. So my expected results should look like this:

+-----------+---------+  |   File1   |  File2  |  +-----------+---------+  |           | Bill_ID |  | address_3 |         |  +-----------+---------+  

Things I've tried to achieve it:

  • sdiff by sorting it lexicographically first but it yielded all columns.

  • Alternatively

    sdiff -Wais File1.txt File2.txt | awk '{print $1}' | sort -u  

    but I'll need to run it twice by reversing the files.

  • comm but having this error

    comm -23 < (sort File1.txt) <(sort File2.txt)  bash: syntax error near unexpected token '('  
  • diff but output seems to incorrect.

    diff File_1 File_2 | grep '^>' | cut -c 3-  

All in these cases I was facing issues with comparison only. I've not been able to move ahead to populate proper table yet.

Network unclaimed Wifi not available in new installed laptop

Posted: 30 Nov 2021 07:19 AM PST

I installed new os debian bullseye in laptop. I cant find wifi option in network manager.

sudo lshw -C network gives,

...    *-network UNCLAIMED         description: Network controller         product: RTL8821CE 802.11ac PCIe Wireless Network Adapter         vendor: Realtek Semiconductor Co., Ltd.         physical id: 0         bus info: pci@0000:02:00.0         version: 00         width: 64 bits         clock: 33MHz         capabilities: pm msi pciexpress cap_list         configuration: latency=0         resources: ioport:2000(size=256) memory:c0600000-c060ffff  ...  

lspci gives output like

...  Network controller: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter  ...  

lsmod gives

...  rtw88_8821ce           16384  0  rtw88_8821c            77824  1 rtw88_8821ce  rtw88_pci              28672  1 rtw88_8821ce  ...  

After adding backports to the source list, I run

sudo apt install -t bullseye-backports firmware-realtek, then is shows firmware-realtek is already the newest version (20210315-3).

I can see that RTL8821C is available without backports here.

output of sudo modprobe wl && dmesg | grep wl is modprobe: FATAL: Module wl not found in directory /lib/modules/5.10.0-9-amd64

Output of ifconfig

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 10.42.0.2  netmask 255.255.255.0  broadcast 10.42.0.255          inet6 xxxx::xxxx:xxxx:xxxx:xxxx  prefixlen 64  scopeid 0x20<link>          ether xx:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)          RX packets 16449  bytes 16751257 (15.9 MiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 13241  bytes 1848301 (1.7 MiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536          inet 127.0.0.1  netmask 255.0.0.0          inet6 ::1  prefixlen 128  scopeid 0x10<host>          loop  txqueuelen 1000  (Local Loopback)          RX packets 129  bytes 11324 (11.0 KiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 129  bytes 11324 (11.0 KiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  

When reinstalling firmware I get below warnings,

W: Possible missing firmware /lib/firmware/amdgpu/arcturus_gpu_info.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_ta.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_sos.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_ta.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_asd.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_sos.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_rlc.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_mec2.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_mec.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_rlc.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_mec2.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_mec.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_me.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_pfp.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_ce.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_sdma.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_sdma.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/sienna_cichlid_mes.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navi10_mes.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_vcn.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_vcn.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_smc.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/arcturus_smc.bin for module amdgpu  W: Possible missing firmware /lib/firmware/amdgpu/navy_flounder_dmcub.bin for module amdgpu    

Also sudo journalctl | grep rtw returns

Nov 18 15:27:26 debian kernel: rtw_8821ce 0000:02:00.0: firmware: failed to load rtw88/rtw8821c_fw.bin (-2)  Nov 18 15:27:26 debian kernel: rtw_8821ce 0000:02:00.0: Direct firmware load for rtw88/rtw8821c_fw.bin failed with error -2  Nov 18 15:27:26 debian kernel: rtw_8821ce 0000:02:00.0: failed to request firmware  Nov 18 15:27:26 debian kernel: rtw_8821ce 0000:02:00.0: failed to load firmware  Nov 18 15:27:26 debian kernel: rtw_8821ce 0000:02:00.0: failed to setup chip efuse info  Nov 18 15:27:26 debian kernel: rtw_8821ce 0000:02:00.0: failed to setup chip information  Nov 18 15:27:26 debian kernel: rtw_8821ce: probe of 0000:02:00.0 failed with error -22  Nov 24 21:38:57 debian kernel: rtw_8821ce 0000:02:00.0: firmware: direct-loading firmware rtw88/rtw8821c_fw.bin  Nov 24 21:38:57 debian kernel: rtw_8821ce 0000:02:00.0: Firmware version 24.8.0, H2C version 12  Nov 24 21:38:57 debian kernel: rtw_8821ce 0000:02:00.0: rfe 2 isn't supported  Nov 24 21:38:57 debian kernel: rtw_8821ce 0000:02:00.0: failed to setup chip efuse info  Nov 24 21:38:57 debian kernel: rtw_8821ce 0000:02:00.0: failed to setup chip information  Nov 30 11:16:48 debian sudo[2358]: username : TTY=pts/0 ; PWD=/home/username ; USER=root ; COMMAND=/usr/sbin/modprobe rtw88_8821ce  Nov 30 11:23:31 debian sudo[2561]: username : TTY=pts/0 ; PWD=/home/username ; USER=root ; COMMAND=/usr/sbin/modprobe rtw88_8821ce  

and sudo dkms status returns nothing.

I disabled secure boot and reinstalled driver. But not worked.

Uninstall self-installed python version using make altinstall

Posted: 30 Nov 2021 06:03 AM PST

I self-installed python 3.10.0 using ./configure and make altinstall. I wanted to remove it from my system and used default python version 3.9.8

My self-installed python are place in directory /usr/local/bin, when I want to install new module, it throws an ssl-problem

How can I delete the self-installed python and point it back to python 3.9.8? Thank you.

I used Kali Linux 5.14.16-1kali1 (2021-11-05) x86_64 GNU/Linux

Same ssh command gives different results to different local machines

Posted: 30 Nov 2021 05:45 AM PST

Is this even possible or is there a bug with openssh?

I had a problem with a compiler, and to allow the compiler's developer to replicate the result I created a remote server. The crazy thing is me running the same command on the same remote machine with the same user resulted in a different output than his. What could be the cause of this?

So in short, I get a failure when running ssh root@remote_machine 'command' and another person runs the command successfully, even though the remote_machine is the same. This is extremely baffling, how could this be?

It also happens when I run this command interactively in ssh session.

When I run it from my local machine, it fails:

[efe@efeninki ~]$ ssh root@66.42.110.134  root@66.42.110.134's password:    [root@vultr ~]# cd test/  [root@vultr test]# ls  Address.sol  solc-linux-amd64-v0.8.10+commit.fc410830  test.sh  [root@vultr test]# ./solc-linux-amd64-v0.8.10+commit.fc410830 --bin Address.sol  Error: Function "extcodesize" not found.    --> Address.sol:34:21:     |  34 |             size := extcodesize(account)     |                     ^^^^^^^^^^^    Error: Variable count for assignment to "size" does not match number of values (1 vs. 0)    --> Address.sol:34:13:     |  34 |             size := extcodesize(account)     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^  

When the other user runs it from a docker instance, it succeeds:

[efe@efeninki ~]$ sudo docker run -it --rm ubuntu bash  root@437d7edb92fc:/# ssh root@66.42.110.134  root@66.42.110.134's password:    [root@vultr ~]# cd test/  [root@vultr test]# ls  Address.sol  solc-linux-amd64-v0.8.10+commit.fc410830  test.sh  [root@vultr test]# ./solc-linux-amd64-v0.8.10+commit.fc410830 --bin Address.sol    ======= Address.sol:Address =======  Binary:  60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ebf580f669e9f89d1faea352d4ba1d4ab2d9c9774fda9fb483588d4e9b09eb5564736f6c634300080a0033  

Checking command nested in conditional with shell [duplicate]

Posted: 30 Nov 2021 07:24 AM PST

I am currently trying to create a short and portable way to check if my working git directory is dirty and return T/F accordingly. My ultimate goal is to incorporate this into a Makefile and I have implemented it as such:

GIT_DIRTY       := $(shell [[ -n $(git status -s) ]] && echo '\ dev')  

My issue is that the [[ operator is bash only, and as a requirement this Makefile needs to be able to run with sh only, no more fully featured shells. My hunch is that there is a way to accomplish this using [ or test, but I am not sure how.

Thanks!

NanoPi mali GPU doesn't want to increase frequency

Posted: 30 Nov 2021 04:57 AM PST

I'm trying to increase frequency of mali GPU on my NanoPi M4.

I use friendlyarm-desktop distro.

The /sys/class/misc/mali0/device/devfreq/ff9a0000.gpu/governor is already in "performance" mode.

But /sys/class/misc/mali0/device/devfreq/ff9a0000.gpu/max_freq is only 200000000, when /sys/class/misc/mali0/device/devfreq/ff9a0000.gpu/available_frequencies is 800000000 600000000 400000000 300000000 200000000.

I change it to 600000000, but after few seconds it starts to change to 200000000 and to 600000000 again randomly.

How can I fix it with my value? Is it changed by some process? How can I find it?

Is it true that rsync does not handle "File renames" gracefully?

Posted: 30 Nov 2021 05:26 AM PST

While using the backup tool duplicity, I noticed that if I rename a file on the source, the data will be resent again over the network to the destination, which is a bit sad. Since duplicity uses librsync internaly, I decided to have a look at rsync.

This wikipedia page states:

Handles renames Moved/renamed files are detected and not stored or transferred twice. It typically means that a checksum of files or its chunks is computed. Applications missing this functionality can be supplemented by combining with hsyncAUR, which only synchronizes renames.

rsync: Handles renames: No

Does this really mean that, when using rsync, there is no way to prevent 10 GB to be re-transferred over the network to the destination, if I rename /test/10GBfile to /test/10GBfile_newname on the source computer?

Given the long-time popularity of rsync, is there no mode in which this would be better handled?

how to set passwordless authentication in a cluster where users /home directory from headnode is mounted to all machines /home of the cluster

Posted: 30 Nov 2021 06:24 AM PST

First of all thank you in advance for your help.

I hope the title makes sense. Basically, on the headnode the users' home directory (i.e: headnode:/home/eric) are NFS shared and mounted to all the machines /home directory (i.e: node01:/home/eric) I am trying to setup password-less SSH connections between all the users on the headnode and all the machines in the cluster. This is what I have done so far but i don't seem to be able to make it work.

I am running CentOS 7 on the headnode and all the machines in the cluster.

Mounted headnode's /home to all machine's /home in the cluster. On the headnode the /etc/exports looks like this.

/home    *(rw,sync,no_root_squash,no_all_squash)  

On the headnode for user eric I generated the RSA key.

eric@headnode $: ssh-keygen -t rsa   

With no passphrase.

Then I added the public key to the list of keys allowed to log in to eric's account.

cat id_rsa.pub >> authorized_keys  

I also created a "config" file in /home/eric/.ssh with the following lines.

StrictHostKeyChecking no  UserKnownHostsFile /dev/null  

I also edited /etc/ssh/ssh_config to reflect

StrictHostKeyChecking no  

I made sure that the /home/eric/id_rsa.pub key and the /home/eric/authorized_keys on the headnode are the same in /home/eric/id_rsa.pub key and the /home/eric/authorized_keys on the machines in the cluster. Which they are the same since /home/eric on the headnode is mounted on /home/eric in all machines in the cluster.

I also made sure that that the permissions on /home/eric/.ssh on the headnode and the machines in the cluster and the files inside .ssh were appropriate.

~/.ssh/  700  ~/.ssh/authorized_keys  600  ~/.ssh/config   600  ~/.ssh/id_rsa  600  ~/.ssh/id_rsa.pub 644  

After all these steps I still cannot establish a password-less ssh connection between the headnode and the machines in the cluster.

Here is the verbose log when I ssh from the headnode to the node in the cluster.

    OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017  debug1: Reading configuration data /home/eric/.ssh/config  debug1: Reading configuration data /etc/ssh/ssh_config  debug1: /etc/ssh/ssh_config line 58: Applying options for *  debug1: Connecting to tq3 [10.112.0.14] port 22.  debug1: Connection established.  debug1: identity file /home/eric/.ssh/id_rsa type 1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_rsa-cert type -1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_dsa type -1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_dsa-cert type -1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_ecdsa type -1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_ecdsa-cert type -1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_ed25519 type -1  debug1: key_load_public: No such file or directory  debug1: identity file /home/eric/.ssh/id_ed25519-cert type -1  debug1: Enabling compatibility mode for protocol 2.0  debug1: Local version string SSH-2.0-OpenSSH_7.4  debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4  debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000  debug1: Authenticating to tq3:22 as 'eric'  debug1: SSH2_MSG_KEXINIT sent  debug1: SSH2_MSG_KEXINIT received  debug1: kex: algorithm: curve25519-sha256  debug1: kex: host key algorithm: ecdsa-sha2-nistp256  debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none  debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none  debug1: kex: curve25519-sha256 need=64 dh_need=64  debug1: kex: curve25519-sha256 need=64 dh_need=64  debug1: expecting SSH2_MSG_KEX_ECDH_REPLY  debug1: Server host key: ecdsa-sha2-nistp256 SHA256:M8Z5sDopU8J8sEkr9dkAwnIUbhcnLSKZjLfn5RykKA0  Warning: Permanently added 'tq3,10.112.0.14' (ECDSA) to the list of known hosts.  debug1: rekey after 134217728 blocks  debug1: SSH2_MSG_NEWKEYS sent  debug1: expecting SSH2_MSG_NEWKEYS  debug1: SSH2_MSG_NEWKEYS received  debug1: rekey after 134217728 blocks  debug1: SSH2_MSG_EXT_INFO received  debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>  debug1: SSH2_MSG_SERVICE_ACCEPT received  debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password  debug1: Next authentication method: gssapi-keyex  debug1: No valid Key exchange context  debug1: Next authentication method: gssapi-with-mic  debug1: Unspecified GSS failure.  Minor code may provide more information  No Kerberos credentials available (default cache: KEYRING:persistent:1000)    debug1: Unspecified GSS failure.  Minor code may provide more information  No Kerberos credentials available (default cache: KEYRING:persistent:1000)    debug1: Next authentication method: publickey  debug1: Offering RSA public key: /home/eric/.ssh/id_rsa  debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password  debug1: Trying private key: /home/eric/.ssh/id_dsa  debug1: Trying private key: /home/eric/.ssh/id_ecdsa  debug1: Trying private key: /home/eric/.ssh/id_ed25519  debug1: Next authentication method: password  

Did i miss or miss-configured something?

Thank you all for your help.

Eric

Why virtual box disc can't be shrinked, when I specify the correct directory of my vm image?

Posted: 30 Nov 2021 05:51 AM PST

this is my virtual box installation dir.

C:\Program Files\Oracle\VirtualBox  

and this one is where my image (linux.vdi) is located.

C:\Users\hmkhitaryan\dev\vm\linux  

Now I want to add disc size to my vm, I did shrink it in "Virtual Media Manager", and now trying to do it in terminal, as the spec says, by this command

C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd "C:\Users\hmkhitaryan\VirtualBox VMs\linux.vdi" --resize 133672  

and got such error

    C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd "C:\Users\hmkhitaryan\dev\vm\linux\linux.vdi" --resize 133672  0%...  Progress state: VBOX_E_NOT_SUPPORTED  VBoxManage.exe: error: Failed to resize medium  VBoxManage.exe: error: Shrinking is not yet supported for medium 'C:\Users\hmkhitaryan\dev\vm\linux\linux.vdi'  VBoxManage.exe: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium  VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleModifyMedium(struct HandlerArg *)" at line 768 of file VBoxManageDisk.cpp  

Anybody help me Please, what can be the reason of this error.

How to check if TPM2.0 is owned and if TPM is enabled in Ubuntu 16.04?

Posted: 30 Nov 2021 05:01 AM PST

Is there any command to check if TPM2.0 is owned (i.e., ownership is taken) and if TPM is enabled on Ubuntu 16.04?

For TPM1.2 this was possible with

cat /sys/class/tpm/tpm0/device/owned  

We are using TPM2.0, Intel TXT, Ubuntu 16.04 and DL380Gen10 server

Problem with permissions when trying to sync two external hard drives with rsync

Posted: 30 Nov 2021 07:02 AM PST

I'm trying to sync an external hardrive with the one containing my photo archive.

I wanted to begin with the basics, so I run:

rsync -aHm --delete /Volumes/archivo_1a/ /Volumes/archivo_1c/  

In the first pass, it seemed to work allright. On subsequent runs, it gives me this message:

building file list ... rsync: opendir "/Volumes/archivo_1a/.DocumentRevisions-V100" failed: Permission denied (13)  rsync: opendir "/Volumes/archivo_1a/.TemporaryItems" failed: Permission denied (13)  rsync: opendir "/Volumes/archivo_1a/.Trashes" failed: Permission denied (13)  done  IO error encountered -- skipping file deletion  

and fails to delete files that were deleted from the source disk.

The source disk is a partitioned disk; the other two partitions I use for time machine backups. Could that be the issue? Or what else might be happening.

/tmp mounting options as tmpfs: Compatibility & Security

Posted: 30 Nov 2021 06:07 AM PST

Having a SSD - it is recommended to mount /tmp as tmpfs.

Examples:

The mounting options are different in each example - why???

The default Ubuntu 16 installation sets the mounting options for root (/) as (from /etc/mtab):

/dev/sda1 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0  

Ergo all other options - as suggested in the examples/links - shouldn't be applied.
Some of the mounting options in the various examples on the web are:

defaults,noatime,mode=1777  

or:

defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M  

But:

  • Having noatime feels useless because that the data is stored in RAM which is fast anyway.
  • Why nosuid,nodev,noexec ?
    How do they know whether softwares are dependent on certain options or not?

I think it is best to stick with the default permissions that the installation applied, meaning:

rw,relatime,mode=1777,uid=0,gid=0  

In order to ensure proper operation of various softwares:

  • The permissions are 1777 because that the default permissions for /tmp are also drwxrwxrwt (see stat -c "%a %n" /tmp).
  • The uid and gid are root because that /tmp has the same.

Is there something which I'm missing here?

How to split an image vertically using the command line?

Posted: 30 Nov 2021 06:51 AM PST

Say I have a large 800x5000 image; how would I split that into 5 separate images with dimensions 800x1000 using the command line?

How do you keep the password hidden when invoked during the su command?

Posted: 30 Nov 2021 04:56 AM PST

This is the first time it has happened to me where I am using the su command and it actually displays the password on the terminal and doesn't stay hidden. Here is my code snippet:

 sshpass -p "password" ssh -q username@74.11.11.11 "su -lc 'mkdir temp/'"  

Code explanation: I am accessing a remote server and trying be root on that server to create a folder. In doing so I have to use the su command and it prompts me for the password. When I enter the password, it gets displayed and doesn't stay hidden. How do I fix that?

Concatenate specific files into one single file

Posted: 30 Nov 2021 06:41 AM PST

In a folder containing X files, I need to concatenate Y files (where X > Y) together into a single text file. I have the filenames (of Y files) that I need to concatenate.

No comments:

Post a Comment