Wednesday, July 21, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Getting Duplicate output in Nested for loop [Bash]

Posted: 21 Jul 2021 10:13 AM PDT

t1=`cat final-md5sum | awk '{print $3}'`  t2=`cat final-md5sum | awk '{print $5}'`    for ip in $t1; do          for  path in $t2; do          echo "Node Name: " $ip "| Out-Of-Sync File Details: " $path `ssh root@$ip stat -c%y $path | cut -d'.' -f1`          done  done      $cat final-md5sum  Node Name: 192.168.1.2 Out-ofSync-Filename: /home/user1/file1  Node Name: 192.168.1.3 Out-ofSync-Filename: /home/user3/file4  

My current Output:

Node Name:  192.168.1.2 | Out-Of-Sync File Details:  /home/user1/file1 2021-07-19 19:25:37  Node Name:  192.168.1.2 | Out-Of-Sync File Details:  /home/user1/file1 2021-07-19 19:25:37  Node Name:  192.168.1.3 | Out-Of-Sync File Details:  /home/user3/file4 2021-07-19 19:14:09  Node Name:  192.168.1.3 | Out-Of-Sync File Details:  /home/user3/file4 2021-07-19 19:14:09  

Expected Output:

Node Name:  192.168.1.2 | Out-Of-Sync File Details:  /home/user1/file1 2021-07-19 19:25:37  Node Name:  192.168.1.3 | Out-Of-Sync File Details:  /home/user3/file4 2021-07-19 19:14:09  

I'm getting duplicate values in my output. What am I doing wrong here?

zsh plugin that adds programming languages to the path

Posted: 21 Jul 2021 09:43 AM PDT

Is there a plugin that checks which programming languages I have installed and adds them all to the path? I don't like to modify my zshrc whenever I install a different language.

Why would one M1 machine need architecture-specific options for building from source and other M1 machines not?

Posted: 21 Jul 2021 09:30 AM PDT

I have tool version managers in the Ruby and react-native worlds that (underneath the layers of abstraction) end up building software like Ruby from source using a fairly mundane:

./configure  ./make  ./make install  

... with various options passed into those commands from the abstractions above.

On my M1 MacBook Pro I find I have to carefully pass in command line options to get the build to understand what architecture I am running. For instance:

export CONFIGURE_OPTS="--build aarch64-apple-darwin20"; asdf install ruby 2.6.6

...prevents configure from breaking during asdf install with an error like, machine not recognised.

Digging down I can see a config.sub file in the build directory that was created in 2007. It doesn't know anything about the arm64 architecture.

I am fairly certain that the problem is here because ./configure succeeds if I substitute a 2021 version config.sub from another project and try again.

I am very surprised to find that colleagues who are installing the same software on M1 machines with the exact same asdf install... process do not have any such hassles.

This is not asdf-specific, I have the same problem with dependencies installed by CocoaPods, which is also underneath it all using configure and make, and similarly my colleagues do not have any problems.

Something on other people's machines (or mine) is overriding the results of config.sub, or must be giving them a different copy of config.sub. I am mystified.

Open default application for file and wait until it terminates

Posted: 21 Jul 2021 09:29 AM PDT

I tried to use xdg-open but it does not wait until the application terminates.

I also tried to get the MIME-type of the file with xdg-mime query filetype fileHere and using xdg-mime query default MIME-type-here. If I use these two commands on a txt file for example, I get "org.gnome.gedit.desktop". I do not know however how I can start and wait for the application using this string.

Can a script be executed without the username being logged by $USER or $SUDO_USER

Posted: 21 Jul 2021 09:35 AM PDT

I'm trying to find out if its possible to execute a Bash script by another user or way than the user who is logged in or by sudo -u otherusername. I have a script with line: "echo $USER". "echo $SUDO_USER" this should always show me the user that executed that script.

Link to post: [1] : How to get the name of the user who executed a bash script as sudo?

From the link above i gathered that some user could use SUDO and so the variable SUDO_USER or ${SUDO_USER:-$USER} could show which user executed a Bash script whether invoked by the logged in user or an user using SUDO.

I cannot think of another way to execute a Bash script than with a logged in user or with SUDO. So is there another way to execute a script than the above mentioned methods and would the command "echo $USER or ${SUDO_USER:-$USER}" then be showing the "original" username?

In other words is it possible to hide your username from $USER or $SUDO_USER when executing a script?

I searched for it on the internet but i did not find any answer, search keywords used: "bash invoke script obfuscating username".

Probably the answer is no but since anything is possible... some hack or spoof of some sort is maybe possible...

rhel + any best practice to minimize the CLOSE_WAIT sessions from linux side

Posted: 21 Jul 2021 09:27 AM PDT

when we perform the following cli on our rhel machine we get more then 600 CLOSE_WAIT lines

lsof -i tcp:8088 | grep CLOSE_WAIT  java    31100 yarn  385u  IPv4 208022048      0t0  TCP master02.hgti.com:radan-http->master02.hgti.com:56504 (CLOSE_WAIT)  java    31100 yarn  407u  IPv4 208210692      0t0  TCP master02.hgti.com:radan-http->master02.hgti.com:58918 (CLOSE_WAIT)  java    31100 yarn  408u  IPv4 206182798      0t0  TCP master02.hgti.com:radan-http->master02.hgti.com:36538 (CLOSE_WAIT)  java    31100 yarn  410u  IPv4 208447279      0t0  TCP master02.hgti.com:radan-http->master02.hgti.com:60972 (CLOSE_WAIT)  java    31100 yarn  412u  IPv4 208287324      0t0  TCP master02.hgti.com:radan-http->master02.hgti.com:59820 (CLOSE_WAIT)  java    31100 yarn  413u  IPv4 206107964      0t0  TCP master02.hgti.com:radan-http->master02.hgti.com:35704 (CLOSE_WAIT)  .  .  .  .  .  

as I know During the communication between the server and the client, the closed_wait caused by the socket failure of the server occurs

so any chance to do some settings from Linux side? in order to minimize the close wait sessions?

or its should be only solution from application side?

reference - https://www.programmersought.com/article/74221875444/

what is the meaning of backslash in /etc/security/limits.conf

Posted: 21 Jul 2021 08:55 AM PDT

/etc/security/limits.conf looks lime this        #<domain>      <type>  <item>         <value>  #    #*               soft    core            0  #*               hard    rss             10000  #@student        hard    nproc           20  #@faculty        soft    nproc           20  #@faculty        hard    nproc           50  #ftp             hard    nproc           0  #@student        -       maxlogins       4    # End of file  \* soft nofile 20000  \* hard nofile 22000  

as I remember the backslash should not set before " * soft nofile 20000 "

so I not sure if backslash meaning is to ignore the line or just ignore the star (*) wildcard ?

Any tool to parse raw usbmon output?

Posted: 21 Jul 2021 08:01 AM PDT

As per usbmon documentation, there are steps to collect the raw data and its format. I have a bunch of such files to analyze. Is there any tool available to parse this data or does one has to go manually decode it ? Also, is the data captured same as the pcap data dumped using tcpdump for usbmon ?

How to combine multiple lines with xargs

Posted: 21 Jul 2021 09:39 AM PDT

I have a large input file which contains 30M lines, new lines in \r\n. I want to process this file in parallel by sending chunks of 1000 lines (or less, for the remainder of the file) to a REST API with curl.

I tried the following:

< input.xt tr -d '\r' | xargs -P 8 -r -d '\n' -n 1000 -I {} curl -s -X POST --data-binary '{}' http://...  

Note that I am stripping the \r's with tr from the input first, because xargs does not seem to be able to split on multiple characters.

However, that command above still seems to provide exactly one line to the curl process, albeit for 8 curl processes in parallel (because of the -P 8 argument).

How can I fix this command such that chunks of 1000 lines are passed to curl, while remaining the parallelism?

I understand that those lines will arrive in random order at the REST service, which is fine for my use case.

Best way to pad stdin to desired length with NULL

Posted: 21 Jul 2021 08:41 AM PDT

I have the following requirement. I have an input stream that I need to truncate to a certain fixed length of bytes. I do not know the length of the input stream beforehand. If the stream is less in length than the set length I want to pad it with zero bytes. I tried to use truncate but apparently it can only work with files not with stdin.

For example let's assume that our input stream (stdin) is TEST and we want to achieve a length of 10 bytes. Then the output stream (stdout) should be TEST\x00\x00\x00\x00\x00.

To clarify the example is done with small strings, but the result should perform well with large streams (megabytes up to a gigabyte). Also the container I use is currently based on Ubuntu.

Map One by Wacom pen button; tablet not detected by xsetwacom but detected by libwacom-list-local-devices. (Arch Linux)

Posted: 21 Jul 2021 07:37 AM PDT

I'm trying to work with my One by Wacom tablet now. It's working just as expected: pointer movement, clicks etc.

How do I map the single button on the stylus to something like C-z. I tried following the Arch wiki which tells me to run xsetwacom list devices. That didn't give me any output.But libwacom-list-local-devices said:

devices:  - name: 'One by Wacom (medium)'    bus: 'usb'    vid: '0x056a'    pid: '0x0301'    nodes:    - /dev/input/event14  

So I copied /usr/share/X11/xorg.conf.d/70-wacom.conf to /etc/X11/xorg.conf.d. I got the input file but I don't understand it. I can't seem to find any pen related option. I tried looking for libwacom docs online but can't find them.

Thanks in advance.

Arch linux not booting after replacement of mother board

Posted: 21 Jul 2021 09:17 AM PDT

I have been using arch for a few months. but due to a mother board issue, I had to get it replaced. Since then, the os doesn't boot. Dell Support Assist says No bootable device found, with a QR code when scanned takes me to dell website and says the error code is 0000 and the validation code is 91042.

in Bios, Boot sequence is empty, secure boot is switched off, and SATA operatioon is set to AHCI mode.

When I try to add a Boot option in the Boot list option, I get popup to select a file with this directory tree...

Grub  | x86_64-efi  | | acpi.mod  | | adler32.mod  | | affs.mod  | | ... and a lot more .mod files  | locale  | | ca.mo  | | da.mo  | | de.mo  | | ... and a lot more .mo files  | themes  | | COPYING.CC-BY-SA-3.0  | | README  | | blob_w.png  | | boot_menu_c.png  | | boot_menu_e.png  | | ... and a lot more .png files  | | theme.txt  | | ... there are a few .pf2 files like  | | dejavu_10.pf2  | | dejavu_12.pf2 ...  | fonts  | | unicode.pf2  | grub.cfg  | grubenv  EFI  | arch  | | grubx64.efi  | Dell  | | logs  | | | diags_previous.xml  | | | diags_current.xml  vmlinuz-linux  initramf-linux.img  initramfs-linux-fallback.imp  inter-ucode.img  

In this EFI Boot Selection menu, it says file system is FS0

Nmap stalling after reboot

Posted: 21 Jul 2021 07:37 AM PDT

I use nmap to find devices on my network that has the port 5300 open. At first it worked great. I could find devices in no time, but then I rebooted my computer and now nmap just stalls during the scan and does nothing. Here's my command with nmap 7.80:

nmap -Pn -oG - -p5300 --min-parallelism 5 --max-rtt-timeout 100ms 10.42.0/24

Any idea ? There is no router in between my devices and the computer I run the command.

why is "read" through each line of a file must faster than "xargs"

Posted: 21 Jul 2021 07:54 AM PDT

I have a large input file which contains 30M lines, new lines in \r\n. I decided to do something silly and compare the speed of counting all lines via read -r compared to xargs (stripping the \r first, because xargs does not seem to be able to split on multiple characters). Here are my two commands:

time tr -d '\r' | xargs -P 1 -d '\n' -I {} echo "{}" < input.txt | wc -l  
time while read -r p || [ -n "$p" ]; do echo "$p"; done < input.txt | wc -l  

Here, the second solution is much faster. Why is that?

Please note that I know that this is not a proper way to count lines of a file. This question is merely out of interest of my observation.

Modifying existing AWK program

Posted: 21 Jul 2021 08:24 AM PDT

I spotted the solution to this particular AWK programming question AWK to find Top 3 values and I wondered how the AWK program could be modified to output the top three values by each site (ie $1) as opposed to the top three values overall? I'm guessing this means either an additional array or loop that cycles through the values in $1 to create the top three rankings?

The input file would look something like this;-

Surrey,Guildford,East,1  Surrey,Guildford,West,2  Surrey,Guildford,North,3  Surrey,Guildford,South,2  Surrey,Weybridge,East,2  Surrey,Weybridge,North,3  Surrey,Weybridge,West,3  Surrey,Weybridge,South,1  Devon,Exeter,North,1  Devon,Exeter,South,2  Devon,Exeter,East,4  Devon,Exter,West,2  

Then the output should look like this;-

Surrey,Guildford,North,3  Surrey,Guildford,West,2  Surrey,Guildford,South,2  Surrey,Weybridge,North,3  Surrey,Weybridge,West,3  Surrey,Weybridge,East,2  Devon,Exeter,East,4  Devon,Exeter,South,2  Devon,Exeter,West,2  

How do I delete ProtonVPN connections with Network Manager?

Posted: 21 Jul 2021 07:54 AM PDT

On Ubuntu 18.04. I upgraded my ProtonVPN CLI client from 2.2.6 to 3.7.2, which was a gigantic mistake. In troubleshooting the resulting issues, ProtonVPN support has asked me to delete connections related to ProtonVPN, but they haven't been able to tell me how.

These are my connections:

$ nmcli d  DEVICE          TYPE      STATE        CONNECTION   wlp3s0          wifi      connected    WifiAP   enp2s0          ethernet  unavailable  --           pvpnroutintrf0  dummy     unmanaged    --           lo              loopback  unmanaged    --           proton0         tun       unmanaged    --  

They want me to delete pvpnroutintrf0 and proton0. They suggested the commands

$ nmcli c delete pvpnroutintrf0 dummy  

and

$ nmcli c delete proton0 tun  

but these result in "unknown connection" errors:

$ nmcli c delete pvpnroutintrf0 dummy  Error: unknown connection 'pvpnroutintrf0'.  Error: unknown connection 'dummy'.  Error: cannot delete unknown connection(s): 'pvpnroutintrf0', 'dummy'.    $ nmcli c delete proton0 tun  Error: unknown connection 'proton0'.  Error: unknown connection 'tun'.  Error: cannot delete unknown connection(s): 'proton0', 'tun'.  

I've tried using sudo with these, and it makes no difference. I've also tried

$ nmcli c delete pvpnroutintrf0  $ nmcli c delete id pvpnroutintrf0  $ nmcli c delete id pvpnroutintrf0 dummy  $ nmcli connection delete pvpnroutintrf0  $ nmcli connection delete pvpnroutintrf0 dummy  $ nmcli connection delete id pvpnroutintrf0 dummy  

They return the same "unknown connection" error.

This Unix SE page exists with a similar question but the answers there didn't help solve my problem, neither did the nmcli man page.

How do I delete these two connections?

Display file names produced by head to show in red

Posted: 21 Jul 2021 07:44 AM PDT

I am using find together with head to print the first n lines in the terminal.

Would like to show the lines containing the filenames in red. Have done an attempt with sed, but having problem with \e.

find "$fdir" -type f -name "*.org" -o -name "*.texi"  \    | xargs head -n "$n"                                \    | sed -e 's/==>/^\e[01;31m==>/;s/<==/<==^\e[0m/'  

The following did not work either

find "$fdir" -type f -name "*.org" -o -name "*.texi"  \    -exec head -n "$n" {} \+                            \    | sed -e 's/==>/^[[01;31m==>/;s/<==/<==^[[0m/'  

Invalid argument when downloading files with wget

Posted: 21 Jul 2021 08:15 AM PDT

I am attempting to download a set of files from an online database, which requires the use of wget. The shell script being used works on one of my computers, but I want to make it run on a different device, and therein lies the problem. For whatever reason, when executing the script, it gives me the following output:

--2021-07-21 12:03:12--  https://archive.eso.org/downloadportalapi/calibrationxml/672f7dfa-65b6-4117-aaf5-9eb2fd4d8759/GRAVI.2017-06-29T02:59:55.346_raw2master.xml  Resolving archive.eso.org (archive.eso.org)... 134.171.46.246  Connecting to archive.eso.org (archive.eso.org)|134.171.46.246|:443... connected.  HTTP request sent, awaiting response... 200   Length: 3484 (3.4K) [application/octet-stream]  GRAVI.2017-06-29T02:59:55.346_raw2master.xml: Invalid argument    Cannot write to 'GRAVI.2017-06-29T02:59:55.346_raw2master.xml' (Success).  

Instead of writing a line describing where it is being saved as/to, it instead outputs "Invalid argument" and I'm not sure why. Both devices are running the same version of wget and the script used on both devices is identical. I also have plenty of disk space, so that isn't an issue either. If you want to look at the shell script, it is available here.

EDIT: Here are the outputs of

mount

/dev/sdb2 on /media/keegan/LaCie type exfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro,uhelper=udisks2)  

and df -h

/dev/sdb2/      9.1T   14G  9.1T   1% /media/keegan/LaCie  

as requested in the comments.

How can I add a custom resolution to be always available for only a specific monitor using Intel's driver on xorg

Posted: 21 Jul 2021 08:21 AM PDT

I have a super-ultrawide (32:9) monitor from Samsung (G9 Odyssey) and it works fine under windows (with a nvidia gpu), however my work laptop (with hdmi 2) which CAN (sometimes) see the full resolution (5120x1440) will decide half of the time not to.

If I re-run xrandr a few times usually it'll "notice" that there are more resolutions and I can then switch, but sometimes it'll randomly switch back to 1024x768@60.

I saw that it's apparently an issue with how the monitor identifies the resolutions or whatever, so I thought I'd just add a custom xorg resolution to my system, but for obvious reasons I want it to only be available for the hdmi and only for this specific monitor.

I've been trying to get the edid of the monitor and do something with it, but all the time when I tried it said it's corrupted or too long or whatever and that didn't go so well.

How can I create a configuration file for xorg (and maybe also wayland for the future?) so it stays detected?

Using KDE Neon User Edition 5.22 with kernel 5.11.0-22-generic

Running xrandr got me a list of 4 resolutions for hdmi, then nothing (segmentation fault), then a list of multiple resolutions (including the one I wanted), and looped.

Sorting an XML file in UNIX with a Bash script?

Posted: 21 Jul 2021 07:50 AM PDT

I am trying to sort my XML file that looks like this by alphabetical order. This is a part of a larger bash script so it needs to work within that script:

<Module>      <Settings>          <Dimensions>              <Volume>13000</Volume>              <Width>5000</Width>              <Length>2000</Length>          </Dimensions>          <Stats>              <Mean>1.0</Mean>              <Max>3000</Max>              <Median>250</Median>          </Stats>      </Settings>      <Debug>          <Errors>              <Strike>0</Strike>              <Wag>1</Wag>              <MagicMan>0</MagicMan>          </Errors>      </Debug>  </Module>  

I want the end result to look like this, I only want the innermost tags to be sorted:

<Module>      <Settings>          <Dimensions>              <Length>2000</Length>              <Volume>13000</Volume>              <Width>5000</Width>          </Dimensions>          <Stats>              <Max>3000</Max>              <Mean>1.0</Mean>              <Median>250</Median>          </Stats>      </Settings>      <Debug>          <Errors>              <MagicMan>0</MagicMan>              <Strike>0</Strike>              <Wag>1</Wag>          </Errors>      </Debug>  </Module>  

I am trying to use sort like this where -t sorts by the > delimeter and then the 4 sorts by the 4th column which would be in the inner but it is not working.

sort -t'>' -k4 file > final.xml  

I get funky output that sorts the other columns in with the sorted inner tags.

Any help would be appreciated

CUDA not available on Deep Learning AMI (DLAMI) running on an Amazon EC2 P2 instance

Posted: 21 Jul 2021 10:03 AM PDT

I am running the Ubuntu 18.04 Deep Learning AMI (DLAMI) on AWS, and am attempting to run it on a p2.xlarge EC2 instance, but CUDA is not available.

I am trying to run my code within the pytorch_latest_p37 conda environment that comes pre-installed with the DLAMI:

ubuntu@ip-111-21-33-212:~$ source activate pytorch_latest_p37  

This uses Python3.7, and comes with PyTorch 1.7.1 built with CUDA 11.0. I was assuming that CUDA would work out of the box ... since it's an AMI that is supposedly designed to work with CUDA.

The output of nvidia-smi and nvcc both seem to indicate that CUDA is installed:

(pytorch_latest_p37) ubuntu@ip-111-21-33-212:~$ nvidia-smi  Sun Jul 18 07:51:09 2021  +-----------------------------------------------------------------------------+  | NVIDIA-SMI 450.119.03   Driver Version: 450.119.03   CUDA Version: 11.0     |  |-------------------------------+----------------------+----------------------+  | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |  | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |  |                               |                      |               MIG M. |  |===============================+======================+======================|  |   0  Tesla K80           On   | 00000000:00:1E.0 Off |                    0 |  | N/A   32C    P8    30W / 149W |      0MiB / 11441MiB |      0%      Default |  |                               |                      |                  N/A |  +-------------------------------+----------------------+----------------------+    +-----------------------------------------------------------------------------+  | Processes:                                                                  |  |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |  |        ID   ID                                                   Usage      |  |=============================================================================|  |  No running processes found                                                 |  +-----------------------------------------------------------------------------+      (pytorch_latest_p37) ubuntu@ip-111-21-33-212:~$ nvcc --version                  nvcc: NVIDIA (R) Cuda compiler driver  Copyright (c) 2005-2020 NVIDIA Corporation  Built on Mon_Oct_12_20:09:46_PDT_2020  Cuda compilation tools, release 11.1, V11.1.105  Build cuda_11.1.TC455_06.29190527_0  

But torch.cuda.is_available() is returning false in ipython and I am getting errors saying that torch was not compiled with CUDA support:

(pytorch_latest_p37) ubuntu@ip-111-21-33-212:~$ ipython  Python 3.9.5 (default, Jun  4 2021, 12:28:51)  Type 'copyright', 'credits' or 'license' for more information  IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.    In [1]: import torch    In [2]: torch.cuda.is_available()  Out[2]: False    In [3]: torch.zeros(1).cuda()  ---------------------------------------------------------------------------  AssertionError                            Traceback (most recent call last)  <ipython-input-2-0904fac96cba> in <module>  ----> 1 torch.zeros(1).cuda()    ~/anaconda3/envs/pytorch_latest_p37/lib/python3.9/site-packages/torch/cuda/__init__.py in _lazy_init()      164                 "Cannot re-initialize CUDA in forked subprocess. " + msg)      165         if not hasattr(torch._C, '_cuda_getDeviceCount'):  --> 166             raise AssertionError("Torch not compiled with CUDA enabled")      167         if _cudart is None:      168             raise AssertionError(    AssertionError: Torch not compiled with CUDA enabled  

What is going on here? What do I need to do to get CUDA running on P2/P3 instances?

Thanks!

Help with dnsmasq pxeproxy while using orbi RBR20 mesh router as DHCP server

Posted: 21 Jul 2021 09:08 AM PDT

I've read a small number of blogs with admins leveraging DNSProxy to respond to DHCP clients with additional options (such as PXE) without having to do any configuration on the primary DHCP server.

On my home network, I really just want to leave the default DHCP service on my orbi router alone and let it do what it normally does without having to hack it or modify it in any way.

Ideally, I'd be able to run a linux host on my network with DNSMasq and a TFTP server to respond to PXE boot. I've tried this on Ubuntu and Rocky Linux and I can't seem to figure out why dnsmasq doesn't respond.

The Orbi router is 192.168.1.254 and the PXE/TFTP/DNSMasq box is 192.168.1.17

This is my configuration in dnsmasq:

$ cat /etc/dnsmasq.conf  conf-dir=/etc/dnsmasq.d  port=0  log-dhcp  log-queries  interface=enp1s0,lo    # DHCP Proxy  dhcp-range=192.168.1.0,proxy,255.255.255.0    # PXE  dhcp-boot=pxelinux,,192.168.1.17    # TFTP Options  tftp-root=/var/lib/tftpboot  

No matter what I try, it seems that booting up a node doesn't get a response for PXE boot / boot from network...

From the logs, I can see that DNSMasq is intercepting the DHCP request broadcast packets as it logs a message when the request is made (last line):

$ sudo journalctl -efu dnsmasq  -- Logs begin at Mon 2021-07-12 22:25:44 EDT. --  Jul 12 22:48:28 localhost.localdomain systemd[1]: Started DNS caching server..  Jul 12 22:48:28 localhost.localdomain dnsmasq[5229]: started, version 2.79 DNS disabled  Jul 12 22:48:28 localhost.localdomain dnsmasq[5229]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN2 DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth DNSSEC loop-detect inotify  Jul 12 22:48:28 localhost.localdomain dnsmasq-dhcp[5229]: DHCP, proxy on subnet 192.168.1.0  Jul 12 22:48:35 localhost.localdomain dnsmasq-dhcp[5229]: 3411263825 available DHCP subnet: 192.168.1.0/255.255.255.0  

Trying to do some basic debugging... I'm logging into another linux box (192.168.1.80) to use nmap for testing dhcp and I can't seem to get the additional DHCP options from the DNSMasq box:

$ sudo nmap --script broadcast-dhcp-discover -e eth0  Starting Nmap 7.80 ( https://nmap.org ) at 2021-07-13 02:26 UTC  Pre-scan script results:  | broadcast-dhcp-discover:  |   Response 1 of 1:  |     IP Offered: 192.168.1.21  |     DHCP Message Type: DHCPOFFER  |     Server Identifier: 192.168.1.254  |     IP Address Lease Time: 1d00h00m00s  |     Subnet Mask: 255.255.255.0  |     Router: 192.168.1.254  |_    Domain Name Server: 192.168.1.254  WARNING: No targets were specified, so 0 hosts scanned.  Nmap done: 0 IP addresses (0 hosts up) scanned in 1.10 seconds  

When I run tcpdump from the DNSMasq box, I can see a packet being broadcasted from the test box (first packet below) and a response from the router (second packet) but not from the DNSMasq box's IP address:

$ sudo tcpdump -i enp1s0 port 67 or port 68 -e -n  dropped privs to tcpdump  tcpdump: verbose output suppressed, use -v or -vv for full protocol decode  listening on enp1s0, link-type EN10MB (Ethernet), capture size 262144 bytes  22:26:49.849265 dc:a6:32:64:61:49 > Broadcast, ethertype IPv4 (0x0800), length 358: 192.168.1.80.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from de:ad:c0:de:ca:fe, length 316  22:26:50.138984 78:d2:94:50:e9:12 > Broadcast, ethertype IPv4 (0x0800), length 342: 192.168.1.254.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length 300  

Not sure what I'm doing wrong and perhaps this is not the right way to do what I am trying to do. Any advice would be greatly appreciated.

Curl FTPS error:1408F10B:SSL routines:ssl3_get_record:wrong version number

Posted: 21 Jul 2021 09:37 AM PDT

I've looked at the related issues but none of them solved my issue.

I'm trying to transfer files via ftp using curl to a server in my dmz from an FTPS server on an EC2 server running vsftpd.

$ curl ftps://ec2-myserver.compute.amazonaws.com --verbose --tlsv1.1  * Rebuilt URL to: ftps://ec2-myserver.us-east-2.compute.amazonaws.com/  *   Trying ip_addr...  * TCP_NODELAY set  * Connected to ec2-myserver.us-east-2.compute.amazonaws.com (ip_addr) port ---- (#0)  * successfully set certificate verify locations:  *   CAfile: /etc/ssl/certs/ca-certificates.crt    CApath: /etc/ssl/certs  * TLSv1.1 (OUT), TLS handshake, Client hello (1):  * error:1408F10B:SSL routines:ssl3_get_record:wrong version number  * Closing connection 0  

I am able to get the files connection FTPS from Filezilla on a windows server.

I am getting the same error in every TLS version.

I've tried enabling ssl3 on the vsfpd server but it didn't solve it.

How can I control pavucontrol in command line?

Posted: 21 Jul 2021 10:00 AM PDT

I want to write a script where I can configure the settings in pavucontrol programmatically. It was suggested that I use pactl.

I am quite lost on the options and I would like to know how the Tabs and options from in pavucontrol UI translate to pactl options?

pavucontrol

Second OpenWRT network isn't getting an IP address

Posted: 21 Jul 2021 09:02 AM PDT

Goal

I'd like to have two LANs: lan0 and lan1. lan0 is unencrypted traffic; lan1 will be an always-active VPN. I haven't configured the VPN, so it's currently just a second unencrypted network.

I'm hoping to configure it as such:

enter image description here

Symptoms

Unfortunately, lan1 (named LAN1_INTERFACE in the configuration files) isn't working.

  • can't join WiFi network:

enter image description here

  • lan1 interface (LAN1_INTERFACE) doesn't have an IP addres:

enter image description here

I suspect that the firewall isn't properly configured.

What am I missing? Do I have any other issues that need to be addressed?

Configuration files

/etc/config/network:

config interface 'loopback'      option ifname 'lo'      option proto 'static'      option ipaddr '127.0.0.1'      option netmask '255.0.0.0'    config globals 'globals'      option ula_prefix 'fd22:91e8:0e0f::/48'    config interface 'wan'    option ifname 'eth1.201'      option proto 'pppoe'      option username 'user_name'      option password 'password'      option ipv6 '0'      option _orig_ifname 'eth1'      option _orig_bridge 'false'      option mtu '1492'    config interface 'lan'    option ifname 'eth0'      option force_link '1'      option type 'bridge'      option proto 'static'      option ipaddr '192.168.1.1'      option netmask '255.255.255.0'      option ip6assign '60'    option _orig_ifname 'eth0 wlan0'      option _orig_bridge 'true'    config interface 'lan1_interface'    option ifname 'eth2'    option force_link '1'    option type 'bridge'      option proto 'static'      option ipaddr '192.168.2.1'      option netmask '255.255.255.0'    option _orig_ifname 'eth2 wlan1'    option _orig_bridge 'true'    config interface 'vpn_interface'    option ifname 'tun0'    option proto 'none'    config switch      option name 'switch0'      option reset '1'      option enable_vlan '1'    config switch_vlan      option device 'switch0'      option vlan '1'      option ports '0 1 2 3 5'      option vid '1'    config switch_vlan      option device 'switch0'      option vlan '2'      option ports '4 6'      option vid '2'  

/etc/config/wireless:

config wifi-device 'radio0'      option type 'mac80211'      option channel '36'      option hwmode '11a'      option path 'platform/soc/soc:pcie-controller/pci0000:00/0000:00:02.0/0000:02:00.0'      option htmode 'VHT80'      option disabled '0'      option txpower '23'      option country 'US'    config wifi-iface      option device 'radio0'      option mode 'ap'      option disabled '0'      option encryption 'psk2+tkip+aes'      option key 'password'      option network 'lan'      option ssid 'Router'    config wifi-device 'radio1'      option type 'mac80211'      option channel '11'      option country 'US'      option hwmode '11g'      option path 'platform/soc/soc:pcie-controller/pci0000:00/0000:00:01.0/0000:01:00.0'      option htmode 'HT20'      option disabled '0'      option txpower '19'    config wifi-iface      option device 'radio1'      option mode 'ap'      option disabled '0'      option encryption 'psk2+tkip+aes'      option key 'password'      option network 'lan1_interface'      option ssid 'Router [VPN]'  

/etc/config/dhcp:

config dnsmasq      option domainneeded '1'      option boguspriv '1'      option localise_queries '1'      option rebind_protection '1'      option rebind_localhost '1'      option local '/lan/'      option expandhosts '1'      option authoritative '1'      option readethers '1'      option leasefile '/tmp/dhcp.leases'      option resolvfile '/tmp/resolv.conf.auto'      option localservice '1'      option nonwildcard '0'      option domain 'lan'      option port '5353'      option dhcpscript '/etc/resolver/dhcp_host_domain_ng.py'    config dhcp 'lan'      option interface 'lan'      option start '100'      option limit '150'      option leasetime '12h'      option dhcpv6 'server'      option ra 'server'      option ra_management '1'      list dhcp_option '6,192.168.1.1'    config dhcp 'wan'      option interface 'wan'      option ignore '1'    config odhcpd 'odhcpd'      option maindhcp '0'      option leasefile '/tmp/hosts/odhcpd'      option leasetrigger '/usr/sbin/odhcpd-update'    config dhcp 'lan1_interface'      option start '100'      option leasetime '12h'      option limit '150'      option interface 'lan1_interface'      list dhcp_option '6,192.168.2.1'  

/etc/config/firewall:

config defaults      option syn_flood '1'      option input 'ACCEPT'      option output 'ACCEPT'      option forward 'REJECT'    #  # includes  #  config include      option path '/etc/firewall.user'    config include      option path '/usr/share/firewall/turris'      option reload '1'    config include      option path '/etc/firewall.d/with_reload/firewall.include.sh'      option reload '1'    config include      option path '/etc/firewall.d/without_reload/firewall.include.sh'      option reload '0'    config include 'miniupnpd'      option type 'script'      option path '/usr/share/miniupnpd/firewall.include'      option family 'any'      option reload '1'    #  # zones  #  config zone      option name 'wan'      option network 'wan wan6'      option input 'REJECT'      option output 'ACCEPT'      option forward 'REJECT'      option masq '1'      option mtu_fix '1'    config zone      option name 'vpn_zone'      option network 'vpn_interface'      option input 'REJECT'      option forward 'REJECT'      option output 'ACCEPT'      option masq '1'      option mtu_fix '1'    config zone      option name 'lan'      option network 'lan'      option input 'ACCEPT'      option output 'ACCEPT'      option forward 'ACCEPT'    config zone      option name 'lan1_zone'      option network 'lan1_interface'      option output 'ACCEPT'      option input 'ACCEPT'      option forward 'ACCEPT'    #  # fowarding  #    config forwarding      option dest 'wan'      option src 'lan'    config forwarding      option dest 'vpn_zone'      option src 'lan1_zone'    config forwarding      option dest 'wan'      option src 'lan1_zone'    #  # IPv4 rules  #  config rule      option name 'Allow-DHCP-Renew'      option src 'wan'      option proto 'udp'      option dest_port '68'      option target 'ACCEPT'      option family 'ipv4'    config rule      option name 'Allow-Ping'      option src 'wan'      option proto 'icmp'      option icmp_type 'echo-request'      option family 'ipv4'      option target 'ACCEPT'    config rule      option name 'Allow-IGMP'      option src 'wan'      option proto 'igmp'      option family 'ipv4'      option target 'ACCEPT'    #  # IPv6 rules  #  config rule      option name 'Allow-DHCPv6'      option src 'wan'      option proto 'udp'      option src_ip 'fe80::/10'      option src_port '547'      option dest_ip 'fe80::/10'      option dest_port '546'      option family 'ipv6'      option target 'ACCEPT'    config rule      option name 'Allow-MLD'      option src 'wan'      option proto 'icmp'      option src_ip 'fe80::/10'      list icmp_type '130/0'      list icmp_type '131/0'      list icmp_type '132/0'      list icmp_type '143/0'      option family 'ipv6'      option target 'ACCEPT'    config rule      option name 'Allow-ICMPv6-Input'      option src 'wan'      option proto 'icmp'      list icmp_type 'echo-request'      list icmp_type 'echo-reply'      list icmp_type 'destination-unreachable'      list icmp_type 'packet-too-big'      list icmp_type 'time-exceeded'      list icmp_type 'bad-header'      list icmp_type 'unknown-header-type'      list icmp_type 'router-solicitation'      list icmp_type 'neighbour-solicitation'      list icmp_type 'router-advertisement'      list icmp_type 'neighbour-advertisement'      option limit '1000/sec'      option family 'ipv6'      option target 'ACCEPT'    config rule      option name 'Allow-ICMPv6-Forward'      option src 'wan'      option dest '*'      option proto 'icmp'      list icmp_type 'echo-request'      list icmp_type 'echo-reply'      list icmp_type 'destination-unreachable'      list icmp_type 'packet-too-big'      list icmp_type 'time-exceeded'      list icmp_type 'bad-header'      list icmp_type 'unknown-header-type'      option limit '1000/sec'      option family 'ipv6'      option target 'ACCEPT'    #  # rules  #  config rule      option src 'wan'      option dest 'lan'      option proto 'esp'      option target 'ACCEPT'    config rule      option src 'wan'      option dest 'lan'      option dest_port '500'      option proto 'udp'      option target 'ACCEPT'    config rule      option target 'ACCEPT'      option proto 'tcp udp'      option dest_port '5353'      option name 'Allow Guest DNS Access'      option src 'lan1_zone'    config rule      option target 'ACCEPT'      option proto 'udp'      option dest_port '67-68'      option name 'Allow Guest DHCP Access'      option src 'lan1_zone'  

** edit **

Router: Turris Omnia

Should the second LAN's dhcp_option really be '6,192.168.2.1' or '6,192.168.1.1'? I don't understand what the 6 does, either.

Sound via HDMI on Arch Linux

Posted: 21 Jul 2021 07:43 AM PDT

I've got my Toshiba laptop (Satellite A300) connected to my TV via HDMI. Using VLC 2.2.6, video works just fine.

Currently, I'm trying to output sound to the TV's speakers.

aplay -l shows the HDMI playback device as the third one:

**** List of PLAYBACK Hardware Devices ****  card 0: Intel [HDA Intel], device 0: ALC268 Analog [ALC268 Analog]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: Intel [HDA Intel], device 1: ALC268 Digital [ALC268 Digital]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]    Subdevices: 1/1    Subdevice #0: subdevice #0  

I was able to play a test sound on the TV using speaker-test -D plughw:0,3 -c 2 after I've unmuted S/PDIF in alsamixer.

Yet, when playing a file with VLC, the only option in Audio → Audio Device is "Built-in Audio Analog Stereo". At the moment, sound is played using the laptop's speakers.

How can I have VLC output the sound to the TV's speakers?

MacBook Pro Parallels (Kali) Linux Limited Screen Resolution

Posted: 21 Jul 2021 10:00 AM PDT

I installed Kali Linux 2.0 in a virtual machine running Parallels on my 15-inch MacBook Pro with Retina display.

For some reason the max resolution is 1920x1200. I have Parallels graphics set to 'More space' for the retina display.

I want to set the resolution higher to make it full screen and have nothing stretched out. How can this be done? It's running inside a window now and that looks fine, but I want to use the full screen.

Expect PECL for PHP 7

Posted: 21 Jul 2021 08:03 AM PDT

I just upgraded to PHP 7.0.3, but there is no support for expect. Does anyone know if is it possible to bypass the installation issue? It says:

root@portal:/home# pecl install expect-0.3.3.tgz   pecl/expect requires PHP (version >= 4.0.0, version <= 5.99.99), installed version is 7.0.3-5+deb.sury.org~trusty+1  No valid packages found  install failed  

I searched around the internet, but I did not find any package with this PHP version. It was working fine on the previous installed version, 5.5.

ssh and sudo but no $DISPLAY

Posted: 21 Jul 2021 07:26 AM PDT

Usually I do this on ssh for getting a X application using sudo su

ssh -X server  

OKI login

xauth list $DISPLAY  

which returns to me

server/unix:10  MIT-MAGIC-COOKIE-1  blablablablabla  

Then I do

sudo su  xauth add server/unix:10  MIT-MAGIC-COOKIE-1  blablablablabla  

And after running an X application..I get it, it is correct.

The problem is on Centos7, I do

xauth list $DISPLAY  

And it returns nothing. I try to add MIT magic cookies given by

xauth list  

But of course it doesn't work. The normal X-forwarding via ssh, without sudo works.

The settings of sshd are the same on 3 servers:

  1. slackware WORKS
  2. hpux WORKS
  3. centos7 NOT WORKING

How to check how many lanes are used by the PCIe card?

Posted: 21 Jul 2021 08:06 AM PDT

PCI Express slots on the motherboard can be wider then the number of lanes connected. For example a motherboard can have x8 slot with only x1 lane connected.

On the other hand, you can insert a card using only for ex. 4 lanes to a x16 slot on the motherboard, and they will negotiate to use only those x4 lanes.

How to check from the running system how many lanes are used by the inserted PCIe cards?

No comments:

Post a Comment