Saturday, April 17, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


write a carriage return to a file in cloud shell

Posted: 17 Apr 2021 10:09 AM PDT

I have a file which is havig '\n' at the end of each record of a given file. I would like to have '\r\n' at the end of each record.

I tried below but upon checking on notepad++.. see same line seperator '\n' only.

awk '{printf "%s\r\n", $0}' /home/vikrant_singh_rana/line_sep_file.csv >> new_test.csv  

Using dbus-monitor correctly

Posted: 17 Apr 2021 10:01 AM PDT

I've written a tiny golang application to test dbus signals on session dbus. This app emits a signal (a random uint32 every 5 seconds) but I don't see anything on dbus-monitor. The problem is I'm not sure using dbus-monitor correctly or not. Here is D-Feet screenshot:

enter image description here

And here is my dbus-monitor command:

dbus-monitor --session "type='signal',sender='a.b.c',interface='a.b.c.Random',path='/a/b/c',member='rnd'"  

mDNS working in chromium but not firefox, tools to investigate?

Posted: 17 Apr 2021 09:48 AM PDT

visitng the webrtc.io's trickle ICE page on my linux (ArchLinux) in different browsers I get inconsistent results. I seek advice on how to investigate the perceived differences.

  • chromium browser yields a *.local mDNS address that is pingable: ping a1be7d5f-3ddd-4d99-9196-48e945df1013.local resolves to the the ipv4 of eth0
  • firefox browser also yields a *.local mDNS address that is sadly not pingable: ping b72d4967-7f44-4c40-83f0-32b1466903a2.local does not resolve to any ipv4-address.

On the system I have the following services running:

  • avahi-daemon.service
  • avahi-dnsconfd.service

which I assume to be necessary. Also the content of the /etc/nsswitch.conf is this:

$ grep hosts: /etc/nsswitch.conf  hosts: files mdns4_minimal mymachines myhostname resolve [!UNAVAIL=return] dns  

The core of this question is if

  • a) firefox is defective (because it provides a mdns-hostname that cannot be resolved to an ipv4 address)
  • b) how I can check if the mdns system avahi is setup correctly?
  • c) which tools and commands are used for this?

Granting Permission to use TTY Ports

Posted: 17 Apr 2021 09:49 AM PDT

I'm trying to grant permission to my user account to use a couple of tty devices so that I don't need to use sudo to interact with them. These are the properties on the ports in question.

9303 0 crw--w---- 1 root tty 238, 1 Apr 17 12:32 /dev/ttyTHS1  25951 0 crw-rw---- 1 root dialout 188, 0 Apr 17 12:32 /dev/ttyUSB0  25952 0 crw-rw---- 1 root dialout 188, 1 Apr 17 12:32 /dev/ttyUSB1  25953 0 crw-rw---- 1 root dialout 188, 2 Apr 17 12:32 /dev/ttyUSB2  25954 0 crw-rw---- 1 root dialout 188, 3 Apr 17 12:32 /dev/ttyUSB3  25955 0 crw-rw---- 1 root dialout 188, 4 Apr 17 12:32 /dev/ttyUSB4`  

When I check the groups that my user account belongs to, I see both the dialout and tty groups there.

But when I try to run minicom

minicom -d /dev/USB1

I get a permission denied error. IF I do the same thing with sudo it works fine. What am I missing that will allow me to access the ports without using sudo (I'm avoiding granting permissions to everyone).

Thanks.

rEFInd manual stanza for GParted live

Posted: 17 Apr 2021 09:39 AM PDT

I downloaded GParted live archive and extracted it to /dev/sda4. The GParted guide explains installation with grub, but since I'm not using grub I wanted to give it a shot adding a manual entry to rEFInd. This is the pratition tree.

NAME        MOUNTPOINT    LABEL         SIZE TYPE FSTYPE  sda                                   111.8G disk   ├─sda1                    Recovery      499M part ntfs  ├─sda2                                   99M part vfat  ├─sda3                                   16M part   ├─sda4                    ARCH_202104  16.1G part vfat  └─sda5                    Data         95.1G part ntfs  sdb                                   931.5G disk   ├─sdb1                                    1M part   ├─sdb2                                   15M part   ├─sdb3                    Main        833.8G part ntfs  └─sdb4      /mnt/ArchData              97.7G part ext4  nvme0n1                               931.5G disk   ├─nvme0n1p1                              16M part   ├─nvme0n1p2               Main M.2      433G part ntfs  └─nvme0n1p3 /             Arch        494.6G part ext4  

rEFInd is installed on sda2 and GParted is on sda4(ARCH_202104) and in refind.conf I've added an entry like so:

menuentry "GParted Live" {      icon     /EFI/refind/icons/os_linux.png      volume   "ARCH_202104"      loader   /live/vmlinuz      initrd   /live/initrd.img      options  "root=/dev/sda4 rw add_efi_memmap"     }  

Restarting and booting from that new entry in rEFInd yields the error Invalid loader file. Error not found while loading. And it yanks me back to rEFInd loader. In the end I let rEFInd scan for new entries itself, it adds it correctly and I can boot GParted, but when I add the stanza manually it's not working. I want to know what was the mistake I made?

Assign var from conditional right-hand side (sub)expression

Posted: 17 Apr 2021 09:49 AM PDT

Looking for a way to keep variables on the left-hand side while assigning to them and I haven't found a concise way yet.

  [[ "${selections[@]}" =~ "${package}" ]] && is_pkg_selected=true || is_pkg_selected=false    test_package_loaded $package && is_pkg_installed=true || is_pkg_installed=false      # ideal would be like...    is_pkg_selected=$([[ "${selections[@]}" =~ "${package}" ]])    is_pkg_installed=$(test_package_loaded $package && true || false)  

Any ideas? It's very hard to read vars with multiple lines together.

Scripts run on RaspberryPi running Raspbian so would prefer the most sh method possible.

NFTables - How to set up simple ip and port forwarding?

Posted: 17 Apr 2021 08:36 AM PDT

I am trying to set up a port forwarding proxy using a Raspberry Pi 4 with NFTables. I want to duplicate the simple port forwarding capabilities of a cheap home nat router. This a component of a larger remote admin application I am working on.

I can get it to redirect ports on the host itself using redirect. But I cannot get it to forward anything beyond the host.

I have routing enabled. But I would also like it to work from within the lan. I don't think this is a factor.

Looking at journalctl, it appears my rule is getting triggered. But the browser never brings up the page.

  • port 80 is redirecting to a web app running locally on 8088 and this works
  • port 81 is supposed to forward to the admin screen on a printer
  • port 82 is trying to forward to an external web site

Log and config are below.

# nft list ruleset  table inet filter {      chain input {          type filter hook input priority 0; policy drop;          ct state established,related accept          ct state invalid drop          iifname "lo" accept          ip protocol icmp accept          ip6 nexthdr ipv6-icmp accept          tcp dport { 22, 22222 } ct state new log prefix "[nftables] New SSH Accepted: " accept          tcp dport { 80, 443, 8088 } accept          pkttype { host, broadcast, multicast } drop          log prefix "[nftables] Input Denied: " flags all counter packets 0 bytes 0 drop      }      chain forward {          type filter hook forward priority 0; policy drop;      }      chain output {          type filter hook output priority 0; policy accept;      }  }  table ip nat {      chain prerouting {          type nat hook prerouting priority -100; policy accept;          tcp dport 80 log prefix "redirect to 8088 " redirect to :8088          tcp dport 81 log prefix "redirect to printer " dnat to 192.168.10.10:80          tcp dport 82 log prefix "redirect to web " dnat to 104.16.154.36:80      }  }  
  • redirect 80 to 8088 works
  • forward to printer and web do not work
Apr 17 11:10:14 douglas kernel: redirect to 8088 IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=31385 DF PROTO=TCP SPT=50112 DPT=80 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:10:14 douglas kernel: redirect to 8088 IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=61197 DF PROTO=TCP SPT=50114 DPT=80 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:10:14 douglas kernel: redirect to 8088 IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=54046 DF PROTO=TCP SPT=50116 DPT=80 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:10:21 douglas kernel: redirect to printer IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=47402 DF PROTO=TCP SPT=34746 DPT=81 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:10:21 douglas kernel: redirect to printer IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=63679 DF PROTO=TCP SPT=34748 DPT=81 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:10:21 douglas kernel: redirect to printer IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=54190 DF PROTO=TCP SPT=34750 DPT=81 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:10:22 douglas kernel: redirect to printer IN=wg0 OUT= MAC= SRC=100.127.128.2 DST=100.127.128.5 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=63680 DF PROTO=TCP SPT=34748 DPT=81 WINDOW=64860 RES=0x00 SYN URGP=0   Apr 17 11:23:41 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=11399 DF PROTO=TCP SPT=41742 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:23:41 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=40570 DF PROTO=TCP SPT=41744 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:23:41 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=51625 DF PROTO=TCP SPT=41746 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:23:42 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=40571 DF PROTO=TCP SPT=41744 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:38:00 douglas kernel: redirect to printer IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=40691 DF PROTO=TCP SPT=59904 DPT=81 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:38:00 douglas kernel: redirect to printer IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=39080 DF PROTO=TCP SPT=59906 DPT=81 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:38:01 douglas kernel: redirect to printer IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=35008 DF PROTO=TCP SPT=59908 DPT=81 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:38:01 douglas kernel: redirect to printer IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=39081 DF PROTO=TCP SPT=59906 DPT=81 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:39:27 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=22876 DF PROTO=TCP SPT=42000 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:39:27 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=15527 DF PROTO=TCP SPT=41998 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0   Apr 17 11:39:27 douglas kernel: redirect to web IN=eth0 OUT= MAC=dc:a6:32:ab:9c:76:f4:6d:04:63:aa:7d:08:00 SRC=192.168.10.20 DST=192.168.10.32 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=58787 DF PROTO=TCP SPT=42002 DPT=82 WINDOW=64240 RES=0x00 SYN URGP=0     

Search pattern between tags in html

Posted: 17 Apr 2021 09:02 AM PDT

I need to get value from a tag with specific title.

I have this command.

sed -n 's/title="view quote">\(.*\)<\/a>/\1/p' index.html  

This is part of index.html and i need that 'Everything in life is luck'

<a title="view quote" href="https://www.brainyquote.com/quotes/donald_trump_106578" class="oncl_q">  <img id="qimage_106578" src="./Donald Trump Quotes - BrainyQuote_files/donaldtrump1.jpg" class="bqphtgrid" alt="Everything in life is luck. - Donald Trump">  </a>  </div>  <a href="https://www.brainyquote.com/quotes/donald_trump_106578" class="b-qt qt_106578 oncl_q" title="view quote">Everything in life is luck.</a>  <a href="https://www.brainyquote.com/quotes/donald_trump_106578" class="bq-aut qa_106578 oncl_a" title="view author">Donald Trump</a>  </div>  <div class="qbn-box">  <div class="sh-cont">  <a href="https://www.brainyquote.com/share/fb/106578" aria-label="Share this quote on Facebook" class="sh-fb sh-grey" target="_blank" rel="nofollow"><img src="./Donald Trump Quotes - BrainyQuote_files/facebook-f.svg" alt="Share on Facebook" class="bq-fa"></a><a href="https://www.brainyquote.com/share/tw/106578?ti=Donald+Trump+Quotes" aria-label="Share this quote on Twitter" class="sh-tw sh-grey" target="_blank" rel="nofollow"><img src="./Donald Trump Quotes - BrainyQuote_files/twitter.svg" alt="Share on Twitter" class="bq-fa"></a><a href="https://www.brainyquote.com/share/li/106578?ti=Donald+Trump+Quotes+-+BrainyQuote" aria-label="Share this quote on LinkedIn" class="sh-tw sh-grey" target="_blank" rel="nofollow"><img src="./Donald Trump Quotes - BrainyQuote_files/linkedin-in.svg" alt="Share on LinkedIn" class="bq-fa"></a>  </div>  </div>  <div class="qll-dsk-kw-box">  <div class="kw-box">  <a href="https://www.brainyquote.com/topics/life-quotes" class="qkw-btn btn btn-xs oncl_klc" data-idx="0">Life</a>  <a href="https://www.brainyquote.com/topics/luck-quotes" class="qkw-btn btn btn-xs oncl_klc" data-idx="1">Luck</a>  <a href="https://www.brainyquote.com/topics/everything-quotes" class="qkw-btn btn btn-xs oncl_klc" data-idx="2">Everything</a>  </div>  </div>  </div>  <div id="qpos_1_2" class="m-brick grid-item boxy bqQt r-width" style="position: absolute; left: 623px; top: 2px;">  <div class="clearfix">  <div class="qti-listm">  <a title="view quote" href="https://www.brainyquote.com/quotes/donald_trump_119339" class="oncl_q">  <img id="qimage_119339" src="./Donald Trump Quotes - BrainyQuote_files/donaldtrump1(1).jpg" class="bqphtgrid" alt="The first thing the secretary types is the boss. - Donald Trump">  </a>  </div>  <a href="https://www.brainyquote.com/quotes/donald_trump_119339" class="b-qt qt_119339 oncl_q" title="view quote">The first thing the secretary types is the boss.</a>  <a href="https://www.brainyquote.com/quotes/donald_trump_119339" class="bq-aut qa_119339 oncl_a" title="view author">Donald Trump</a>  </div>  <div class="qbn-box">  <div class="sh-cont">  <a href="https://www.brainyquote.com/share/fb/119339" aria-label="Share this quote on Facebook" class="sh-fb sh-grey" target="_blank" rel="nofollow"><img src="./Donald Trump Quotes - BrainyQuote_files/facebook-f.svg" alt="Share on Facebook" class="bq-fa"></a><a href="https://www.brainyquote.com/share/tw/119339?ti=Donald+Trump+Quotes" aria-label="Share this quote on Twitter" class="sh-tw sh-grey" target="_blank" rel="nofollow"><img src="./Donald Trump Quotes - BrainyQuote_files/twitter.svg" alt="Share on Twitter" class="bq-fa"></a><a href="https://www.brainyquote.com/share/li/119339?ti=Donald+Trump+Quotes+-+BrainyQuote" aria-label="Share this quote on LinkedIn" class="sh-tw sh-grey" target="_blank" rel="nofollow"><img src="./Donald Trump Quotes - BrainyQuote_files/linkedin-in.svg" alt="Share on LinkedIn" class="bq-fa"></a>  </div>  </div>  

And i need all this vlaues to fill in array in bash. Expected output from here is ['Everything in life is luck','The first thing the secretary types is the boss.']. But i need all quotes which are in index.html so i need selector to get all quotes to array.

Implementing nginx as an ssh proxy server to monitor connections to an application running in unix

Posted: 17 Apr 2021 07:31 AM PDT

I am trying to set up Nginx on our core server to proxy all ssh connections to the server and monitor all activities performed by privileged users who connect via ssh (from putty or other apps)to an application (Core banking app) on the core Unix server. Please, can anyone advise on how to? Thanks.

Symlink to python exec and the python exec have different sys paths. This causes ModuleNotFoundError

Posted: 17 Apr 2021 07:30 AM PDT

My project structure is :

$ tree . -L 2  .  ├── venv  │   ├── bin  │   ├── include  │   ├── lib  │   ├── lib64 -> lib  │   ├── pip-selfcheck.json  │   └── pyvenv.cfg  ├── py -> /path/to/project/venv/bin/python3  ├── README.md  ├── req.txt  └── source      └── sym.py  

I have a symlink, py pointing to the actual location of the python executable in the venv. This is to ensure that my python executable isn't hardcoded in the scripts, and can be quickly deployed anywhere, while still including a shebang.

Now, when I call the symlink, py vs the actual python executable, /path/to/project/venv/bin/python3, the sys.path value changes. The following is executed in the folder: /path/to/project/source/:

$ ls -l ../py  lrwxrwxrwx. 1 som cms-script-admins 45 Apr 17 19:39 ../py -> /path/to/project/venv/bin/python3    $ cat sym.py  import sys  print(sys.path)      $ ../py sym.py  ['/path/to/project/source', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/usr/local/lib64/python3.6/site-packages', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages']    $ /path/to/project/venv/bin/python3 sym.py  ['/path/to/project/source', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/path/to/project/venv/lib64/python3.6/site-packages', '/path/to/project/venv/lib/python3.6/site-packages']  

As you can see, based on whether the sym-link is executed or the direct exec is called, the sys paths are changing.

For example, the symlink includes /usr/lib/python3.6/site-packages but the actual executable in the venv includes /path/to/project/venv/lib/python3.6/site-packages.

How do I fix this?

When I try to import selenium, I get:

$ ../py  >>> import selenium  Traceback (most recent call last):    File "<stdin>", line 1, in <module>  ModuleNotFoundError: No module named 'selenium'  

Raspberry Pi AP hostapd not working with WPA

Posted: 17 Apr 2021 07:31 AM PDT

I'm trying to make an AP out of my Raspberry Pi and I have a strange problem.

I have installed hostadp and dnsmasq

When I set an open network everything works but when I try to add a passphrase, only one client connects (Huawei android phone). Other clients keep associating and dissociating and on the client side I get authentication error.

hostapd.conf looks like this:

ssid=Network  wpa=1  auth_algs=1  wpa_pairwise=TKIP  rsn_pairwise=CCMP  wpa_key_mgmt=WPA-PSK  wpa_passphrase=* some * passphrase *  

I tried different values for wpa key and nothing works. dnsmasq is working, and for one client that can connect everything works fine.

Any ideas?

Thanks in advance!

Blurry fonts in Google Chrome/Chromium in Linux after switching to a new 27" QHD monitor

Posted: 17 Apr 2021 06:37 AM PDT

On my previous 1080p monitor 24" fonts in Google Chrome looked great however on my new 27" QHD monitor fonts are extremely blurry.

I've been Googling for a solution for quite some time and I couldn't find anything.

Google Chrome Before

Google Chrome After

unable to upgrade or fix either (Kali)

Posted: 17 Apr 2021 10:03 AM PDT

┌──(istiak㉿kali)-[~]  └─$ sudo apt-get upgrade  [sudo] password for istiak:   Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  You might want to run 'apt --fix-broken install' to correct these.  The following packages have unmet dependencies:   nodejs : Depends: libnode72 (= 12.21.0~dfsg-1) but it is not installed  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).  

When I try fix

┌──(istiak㉿kali)-[~]  └─$ sudo apt --fix-broken install                                                                                                                                  100 ⨯  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  Correcting dependencies... Done  The following packages were automatically installed and are no longer required:    libjs-highlight.js nodejs-doc xdg-desktop-portal-gtk  Use 'sudo apt autoremove' to remove them.  The following additional packages will be installed:    nodejs  The following packages will be upgraded:    nodejs  1 upgraded, 0 newly installed, 0 to remove and 56 not upgraded.  Need to get 0 B/24.6 MB of archives.  After this operation, 119 MB of additional disk space will be used.  Do you want to continue? [Y/n] y  (Reading database ... 339678 files and directories currently installed.)  Preparing to unpack .../nodejs_14.16.1-deb-1nodesource1_amd64.deb ...  Unpacking nodejs (14.16.1-deb-1nodesource1) over (12.21.0~dfsg-1) ...  dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb (--unpack):   trying to overwrite '/usr/share/doc/nodejs/api/cli.json.gz', which is also in package nodejs-doc 12.21.0~dfsg-1  dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)  Errors were encountered while processing:   /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb  E: Sub-process /usr/bin/dpkg returned an error code (1)  

When I install the debian package.

┌──(istiak㉿kali)-[~]  └─$ sudo dpkg -i /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb  [sudo] password for istiak:   (Reading database ... 339678 files and directories currently installed.)  Preparing to unpack .../nodejs_14.16.1-deb-1nodesource1_amd64.deb ...  Unpacking nodejs (14.16.1-deb-1nodesource1) over (12.21.0~dfsg-1) ...  dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb (--install):   trying to overwrite '/usr/share/doc/nodejs/api/cli.json.gz', which is also in package nodejs-doc 12.21.0~dfsg-1  dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)  Processing triggers for man-db (2.9.4-2) ...  Errors were encountered while processing:   /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb  

/etc/apt/

┌──(istiak㉿kali)-[/etc/apt]  └─$ ls  apt.conf.d   preferences.d  sources.list~   trusted.gpg  auth.conf.d  sources.list   sources.list.d  trusted.gpg.d  

I didn't find anything called sources.d. And, sources.list.d is a directory where I have google-chrome.list nodesource.list.

sources.list :

# See https://www.kali.org/docs/general-use/kali-linux-sources-list-  repositories/  deb http://http.kali.org/kali kali-rolling main contrib non-free    # Additional line for source packages  # deb-src http://http.kali.org/kali kali-rolling main contrib non-free  

os-release :

┌──(istiak㉿kali)-[/etc/apt]  └─$ cat /etc/os-release        PRETTY_NAME="Kali GNU/Linux Rolling"  NAME="Kali GNU/Linux"  ID=kali  VERSION="2021.1"  VERSION_ID="2021.1"  VERSION_CODENAME="kali-rolling"  ID_LIKE=debian  ANSI_COLOR="1;31"  HOME_URL="https://www.kali.org/"  SUPPORT_URL="https://forums.kali.org/"  BUG_REPORT_URL="https://bugs.kali.org/"  

I tried by cleaning(sudo apt clean) also. I am not sure what to do now..? I am unable to install npm for the reason. But, I am able to update properly... You may notice I am using Kali. Version is 2020.1. And, I am not expert nor intermediate. I have some ideas of Linux.

I found some questions similar to my question but, no answers worked for me.

  1. dpkg: error processing archive

  2. error processing package mysql-community-server during apt-get upgrade

  3. Errors were encountered while processing: /var/cache/apt/archives/apport_2.20.1-0ubuntu2.6_all.deb

I was reading the documentation. When I print out :grep -v '#' /etc/apt/sources.list | sort -u.

My outputs literally match ups.

From Documentation :

deb http://http.kali.org/kali kali-rolling main non-free contrib  

My output(I had added it earlier also. I think I had updated branch after reading some answers in Unix SE or askubuntu ~ I actually forgot.) :

deb http://http.kali.org/kali kali-rolling main contrib non-free  

"I think it may not be the problem".

You did an off-line install (such as missing a network connection during installation).

You have switched your branch.

Using a different (hardcoded) mirror.

I had actually lost my network connection lot of times while installing something. From that documentation, I print out two command also.

cat /etc/apt/sources.list  

I had earlier give the output of it also.

sudo apt-cdrom add  

Actually I don't have any cdrom that's why it returns error.

E: Failed to mount the cdrom. E: No CD-ROM could be auto-detected or found using the default mount point.

Using awk to print part of one column plus additional columns

Posted: 17 Apr 2021 08:16 AM PDT

Good day.

Using only Linux OS tools, how would you convert the following text from this:

cat latest.csv  apsga,alp1acscf0001vm001oam001p1n004v001,192.7.129.7,UVP  apsga,alp1acscf0001vm001oam001p1n004v002,192.7.129.8,UVP  apsga,alp1acscf0001vm002oam001p1n004v001,192.7.129.9,UVP  apsga,alp1acscf0001vm003oam001p1n004v001,192.7.129.10,UVP  apsga,alp1acscf0001vm004cif001p1n004v001,192.7.129.11,UVP  apsga,alp1acscf0001vm004cif001p1n004v002,192.7.129.12,UVP  apsga,alp1acscf0001vm005cif001p1n004v001,192.7.129.13,UVP  

I managed to get the following result:

cat latest.csv`|awk -F',' '{print $2, $3}'|awk '{ $1 = substr($1,1,21); print $1","$2}'  alp1acscf0001vm001oam,192.7.129.7  alp1acscf0001vm001oam,192.7.129.8  alp1acscf0001vm002oam,192.7.129.9  alp1acscf0001vm003oam,192.7.129.10  alp1acscf0001vm004cif,192.7.129.11  alp1acscf0001vm004cif,192.7.129.12  alp1acscf0001vm005cif,192.7.129.13  

I would like the end result to look like this:

ALP1A/alp1acscf0001v,UUID,192.7.129.7,SSH2,alp1acscf0001vm001oam  ALP1A/alp1acscf0001v,UUID,192.7.129.8,SSH2,alp1acscf0001vm001oam  ALP1A/alp1acscf0001v,UUID,192.7.129.9,SSH2,alp1acscf0001vm002oam  ALP1A/alp1acscf0001v,UUID,192.7.129.10,SSH2,alp1acscf0001vm003oam  ALP1A/alp1acscf0001v,UUID,192.7.129.11,SSH2,alp1acscf0001vm004cif  ALP1A/alp1acscf0001v,UUID,192.7.129.12,SSH2,alp1acscf0001vm004cif  ALP1A/alp1acscf0001v,UUID,192.7.129.13,SSH2,alp1acscf0001vm005cif  

Thanks in advance,

Bjoern

Sata III hard drives not recognized by ECS motherboard caused data corruption of hard drives

Posted: 17 Apr 2021 08:59 AM PDT

I connected two new sata hard drives to my ECS G31T-M9 motherboard. They are mechanical SATA III hdd's 500 GB and 1 TB respectively.

Issues started to happen with this 500 GB drive first, the motherboard eventually wouldn't detect it, so an immediate solution appeared by swapping the sata ports between drives, this solved the problem during an arbitrary time period, running fron one week to months, this problem sometimes appered after power surges but sure not the only cause.

Symptoms evolved rapidly affecting both drives and reaching to the point where one or both partitions were instantaneosuly unmounted by the OS without apparent reason and almost every mount attempt will be followed by an authomatical system unmount action.

Note to this is that the problem seems to only affect the sata drives as I also have an Ide drive connected and never seemed to have any problem.

The system running arch linux and all partitions contained ext4 file systems, so according to fsck this wasn't related to any errors inside the file systems because all error reports if any were unconsistent with this forced unmounts.

This reached to a point where all the sata hdds won't load on the bios no matter what I tried, this final issue risen all the red flags, so I disconected all the sata drives and connected them to a different motherboard, a biostar P4m89-m7b.

The biostar immediately recognized the drives so I spend some days backing up and recovering the data. I succesfully recovered all the files and nodes from the 500 GB drive but the partition was corrupted, the main superblock was missing and e/s errors were continuosly reported to system logs though luckly ddrescue only detected one error on the drive containing only 512 KB or so.

I momentanously suspended all the tests in this drive untill I check that indeed all my files are there and the 1 GB drive is still up for testing.

All that happened burnt out all my confidence on the first motherboard, the ecs one, but I'm still wandering what could have caused all this trouble.

Could it be that the PSU is failing? it's a generic 500W power supply and I attached to it just three hdd's and some external periferals, including speakers and printer.

BTW if it's related to the PSU why I had no troubles with the remaining ide hard drive?

It's a very intriguing mystery i search for answers so I preciate any comment.

Edit: this was the output in journalctl during unmounts blk_update_request: I/O error, dev sda, sector 15488728 op 0x0:(READ) flags 0x80700 phys_seg 8 prio class 0

Unix/Linux running multiple commands on an ssh

Posted: 17 Apr 2021 08:25 AM PDT

I'm attempting to ssh onto a server then find todays files then grep within those files. But I'm getting an error.

What am I missing here?

ssh server.name find /dir1/subdir/filelist* -maxdepth 1 type f -mtime 0 -exec grep 'pattern' {} \;  

I'm getting: find: missing argument to `-exec'

How to make systemd service start at boot

Posted: 17 Apr 2021 08:35 AM PDT

I installed the Nix package manager on XUbuntu 20.04. It added a nix-daemon service. I would like to start the nix-daemon service on boot. If I type the following commands the service runs and works fine until I halt the machine, but after a reboot the service is not running, and I need to run these commands again.

It seems that systemd disables the service or forgets that it was enabled. How can I tell systemd to enable the service and leave it enabled?

$ sudo systemctl status nix-daemon  Unit nix-daemon.service could not be found.  
$ sudo systemctl enable nix-daemon  
$ sudo systemctl status nix-daemon  ● nix-daemon.service - Nix Daemon       Loaded: loaded (/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/lib/systemd/system/nix-daemon.service; enabled; vendor preset: enabled)      Drop-In: /etc/systemd/system/nix-daemon.service.d               └─override.conf       Active: inactive (dead)  TriggeredBy: ● nix-daemon.socket  
$ sudo service nix-daemon start  ● nix-daemon.service - Nix Daemon       Loaded: loaded (/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/lib/systemd/system/nix-daemon.service; enabled; vendor preset: enabled)      Drop-In: /etc/systemd/system/nix-daemon.service.d               └─override.conf       Active: active (running) since Fri 2021-04-16 04:35:15 BST; 2s ago  TriggeredBy: ● nix-daemon.socket     Main PID: 55329 (nix-daemon)        Tasks: 5 (limit: 9091)       Memory: 13.8M       CGroup: /system.slice/nix-daemon.service               └─55329 nix-daemon --daemon    Apr 16 04:35:15 wayfire systemd[1]: Started Nix Daemon.  Apr 16 04:35:15 wayfire nix-daemon[55329]: warning: unknown setting 'experimental-features'  Apr 16 04:35:15 wayfire nix-daemon[55329]: warning: unknown setting 'keep-derivarions'  

EDIT:

Contents of the /etc/systemd/system/nix-daemon.service that was created by the installer (I didn't modify it):

[Unit]  Description=Nix Daemon  RequiresMountsFor=/nix/store  RequiresMountsFor=/nix/var  ConditionPathIsReadWrite=/nix/var/nix/daemon-socket    [Service]  ExecStart=@/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/bin/nix-daemon nix-daemon --daemon  KillMode=process    [Install]  WantedBy=multi-user.target  

There is no /etc/default/nix file.

$ systemctl get-default  graphical.target  

Ubuntu - when I plug in my headphone, my keyboard layout is reset to default, how can I stop it

Posted: 17 Apr 2021 09:08 AM PDT

I set my keyboard layout to a customized one, with setxkbmap. It is started with "Autostart Application"(~/.config/autostart) and is working fine.

But when I plug in my Jabra headphone, it is reset to default US QWERTY one. I want to stop that.

I see another post

How to set xinput properties triggered by udev device connection?

Prevent keyboard layout reset when USB keyboard is plugged in

but the best answer assumes that the OP just plugs in another new keyboard; I think this is a wrong assumption and this is definitely not my case.

I understand it is an udev problem, and a quite bad bug. Ubuntu 18.04.

Using udevadm monitor, I see these lines when Jabra headphone is plugged in:

monitor will print the received events for:  UDEV - the event which udev sends out after rule processing  KERNEL - the kernel uevent    KERNEL[514.356707] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2 (usb)  KERNEL[514.360571] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0 (usb)  KERNEL[514.384326] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1 (sound)  KERNEL[514.384427] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1/pcmC1D0p (sound)  KERNEL[514.384485] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1/pcmC1D0c (sound)  KERNEL[514.384542] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1/controlC1 (sound)  KERNEL[514.384584] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0 (usb)  KERNEL[514.384616] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.1 (usb)  KERNEL[514.384645] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.1 (usb)  KERNEL[514.384675] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.2 (usb)  KERNEL[514.384701] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.2 (usb)  KERNEL[514.384730] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3 (usb)  KERNEL[514.387245] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B (hid)  KERNEL[514.387575] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/input/input18 (input)  KERNEL[514.444127] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/input/input18/event6 (input)  KERNEL[514.444169] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/input/input18/input18::mute (leds)  KERNEL[514.444318] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/usbmisc/hiddev0 (usbmisc)  KERNEL[514.444375] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/hidraw/hidraw1 (hidraw)  KERNEL[514.444438] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B (hid)  KERNEL[514.444473] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3 (usb)  KERNEL[514.444510] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2 (usb)  UDEV  [514.967946] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2 (usb)  UDEV  [514.970785] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0 (usb)  UDEV  [514.971920] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.1 (usb)  UDEV  [514.972737] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.2 (usb)  UDEV  [514.973022] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3 (usb)  UDEV  [514.973854] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1 (sound)  UDEV  [514.974449] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.1 (usb)  UDEV  [514.975643] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.2 (usb)  UDEV  [514.976113] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B (hid)  UDEV  [514.976909] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/usbmisc/hiddev0 (usbmisc)  UDEV  [514.979273] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/hidraw/hidraw1 (hidraw)  UDEV  [514.980161] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1/pcmC1D0c (sound)  UDEV  [514.980666] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/input/input18 (input)  UDEV  [514.980736] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1/pcmC1D0p (sound)  KERNEL[514.980866] change   /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1 (sound)  UDEV  [514.983803] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/input/input18/input18::mute (leds)  UDEV  [515.017334] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B/input/input18/event6 (input)  UDEV  [515.019498] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3/0003:0B0E:0305.000B (hid)  UDEV  [515.020828] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.3 (usb)  UDEV  [515.790142] add      /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1/controlC1 (sound)  UDEV  [515.792199] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0 (usb)  UDEV  [515.794039] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2 (usb)  UDEV  [515.796084] change   /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2:1.0/sound/card1 (sound)  

And after it, with xinput list, I see:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]  ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]  ⎜   ↳ HP HP USB 1000dpi Laser Mouse             id=8    [slave  pointer  (2)]  ⎜   ↳ Chicony HP Business Slim Keyboard Consumer Control    id=13   [slave  pointer  (2)]  ⎜   ↳ PS/2 Generic Mouse                        id=18   [slave  pointer  (2)]  ⎣ Virtual core keyboard                     id=3    [master keyboard (2)]      ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]      ↳ Power Button                              id=6    [slave  keyboard (3)]      ↳ Sleep Button                              id=7    [slave  keyboard (3)]      ↳ Chicony HP Business Slim Keyboard         id=10   [slave  keyboard (3)]      ↳ Chicony HP Business Slim Keyboard System Control  id=11   [slave  keyboard (3)]      ↳ Chicony HP Business Slim Keyboard         id=12   [slave  keyboard (3)]      ↳ Integrated_Webcam_FHD: Integrat           id=14   [slave  keyboard (3)]      ↳ Integrated_Webcam_FHD: Integrat           id=15   [slave  keyboard (3)]      ↳ Dell WMI hotkeys                          id=16   [slave  keyboard (3)]      ↳ AT Translated Set 2 keyboard              id=17   [slave  keyboard (3)]      ↳ Chicony HP Business Slim Keyboard Consumer Control    id=19   [slave  keyboard (3)]      ↳ GN Netcom A/S Jabra EVOLVE LINK MS        id=9    [slave  keyboard (3)]    

Chicony HP Business Slim Keyboard is my USB keyboard that I want to set layout, and GN Netcom A/S Jabra EVOLVE LINK MS is the headphone.

Linux Mint - Gnome Maps and Connectivity Check

Posted: 17 Apr 2021 10:09 AM PDT

I recently installed Linux Mint 19.1 (Tessa) on a desktop with a wired connection behind a highly restrictive (ingress and egress) firewall. The only way to the Internet is through a proxy server that is allowed to transit the aforementioned firewall. I understand that Linux Mint 19.1 (Tessa) is derived from Ubuntu 18.04 LTS (Bionic).

Linux Mint 19.1 (Tessa) related issues:

1) Daemon "systemd-resolved" reported the error every five minutes, "Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP."

2) Daemon "NetworkManager" reported the error every five minutes, "info connectivity: (eno1) timed out."

3) Gnome Maps loaded but was unusable and reported the errors "Maps is offline!" and "Maps need an active internet connection to function properly."

For comparison, Linux Mint 18.0 (Sarah) behind the same restrictive firewall runs Gnome Maps without issue.

NetworkManager's Connectivity Check times out:

sudo nmcli networking connectivity check    Error: Timeout was reached.  

How to allow non-roots to connect to WiFi?

Posted: 17 Apr 2021 09:35 AM PDT

/etc/os-release says Debian GNU/Linux 9 (stretch)

/proc/version says Linux version 4.4.132+ (jenkins@fdc-06) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) ) #1 SMP

sudo /sbin/wpa_supplicant -v prints wpa_supplicant v2.4

I'm setting thses permissions in /etc/wpa_supplicant/wpa_supplicant.conf config file.

Tried both ways, the documented one:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=linaro  

and another one I've found after reading source code of that supplicant:

ctrl_interface=/var/run/wpa_supplicant  ctrl_interface_group=linaro  

Neither of them works:

$ ls -la /var/run/wpa_supplicant  ls: cannot open directory '/var/run/wpa_supplicant': Permission denied  $ sudo ls -la /var/run/wpa_supplicant  srwxrwx---  1 root root   0 Mar 22 19:24 wlan0  

Both owner and group is root despite what's written in the config.

Worked OK just a few months ago, with Linux 4.4.71+.

How to set the permissions on that UNIX socket?

P.S. Some context: this is embedded system running on ARM SoC. I'm consuming that control interface programmatically, i.e. I need my software, running under normal user account, control Wi-Fi: connect, disconnect, set passwords, etc. There's no Linux desktop nor X-windows running.

Update: as advised in the comments, adding more context. This is custom made embedded device based on RK3288, running Linux kernel, minimal set of systemd services (wpa_supplicant is among them), and a single application I've developed. Users interact with my app using a touchscreen, and through the network (but first they need to connect somehow). There's no X window or Wayland, no desktop, no mouse or keyboard.

How to write Docker logs to a file in real time (à la `tail -f`)

Posted: 17 Apr 2021 09:43 AM PDT

I docker that output logs stdout stderr, which can be viewed using:

docker logs -f $LOGS_CONTAINER_ID  

I also added 'sed', which puts the container id on each line:

docker logs -f $LOGS_CONTAINER_ID | sed "s/^/$LOGS_CONTAINER_ID /"  

If I run it, I get something like:

container112 error 10:20:10 problem  container112 info 10:20:09 not problem  container112 error 10:20:01 problem  

where "container112" is $LOGS_CONTAINER_ID.

SO FAR SO GOOD. Now I want to output the above command to a file (log.out), so I wrote the following command:

docker logs -f $LOGS_CONTAINER_ID | sed "s/^/$LOGS_CONTAINER_ID /" >> log.out  

What happens is that it writes the logs to log.out, but it doesn't get new logs (if I open a new session and run tail -f log.out, I don't get output). So I also tried:

tail -f $(docker logs -f $LOGS_CONTAINER_ID | sed "s/^/$LOGS_CONTAINER_ID /") >> log.out  

But it also didn't work. What is the problem?

What is the difference between the "...", '...', $'...', and $"..." quotes in the shell?

Posted: 17 Apr 2021 06:22 AM PDT

Sometimes I see shell scripts use all of these different ways of quoting some text: "...", '...', $'...', and $"...". Why are there so many different kinds of quote being used?

Do they behave differently or affect what I can do inside them?

Configuring Kensington Slimblade in Linux

Posted: 17 Apr 2021 09:39 AM PDT

I just got a Kensigton Slimblade Trackball and I'm trying to configure it. I'm adapting it from my old Logitech Marble configuration.

I want the configuration to be:

  • Left-Bottom: Left click
  • Left-Top: Backward
  • Right-Top: Right click and ball scroll lock
  • Right-Bottom: Middle click

The configuration I could set until now is:

  • Left-Bottom: Left click
  • Left-Top: Middle click
  • Right-Top: Right click and ball scroll lock
  • Right-Bottom: Backward

This is my configuration script:

xinput set-int-prop "Kensington Kensington Slimblade Trackball" "Evdev Middle Button Emulation" 8 1       xinput set-button-map "Kensington Kensington Slimblade Trackball" 1 2 8 4 5 6 7     xinput set-int-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation" 8 1  xinput set-int-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation Button" 8 8  xinput set-int-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation Axes" 8 6 7 4 5  xinput set-int-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation Timeout" 16 300  

Before running this script, xev reports button numbers as:

Left-Bottom: 1, Left-Top: 2, Right-Top: 8, Right-Botom: 3  

After running this script:

Left-Bottom: 1, Left-Top: 2, Right-Top: 8, Right-Botom: 8  

So AFAIK, xinput set-button-map changes button order. In this page, I learned that the 2nd value corresponds to the middle mouse button, and the 8th to the Thumb1 (normally related to backward function). So I thought I should just use number 3 as the 2nd element and 2 as the 8th element like this:

xinput set-button-map "Kensington Kensington Slimblade Trackball" 1 3 8 4 5 6 7 2  

but now the top-left button has right-click function and left-bottom is disabled. xev now reports

Left-Bottom: 1, Left-Top: 3, Right-Top: 2, Right-Botom: 8.   

Anyone knows how I set the configuration as I intend ? I'm using Ubuntu 16.04. Thanks.

install USB 3.0 express card under linux (Arch Linux) (tried adding kernel parameter intel_iommu=off pciehp.pciehp_force=1)

Posted: 17 Apr 2021 09:12 AM PDT

I'm trying to install a CSL USB 3.0 express card to my Arch Linux system.

However, when I do this, I get the following error message:

xhci_hcd 0000:05:00.0: xHCI host controller not responding, assume dead

xhci_hcd 0000:05:00.0: HC died; cleaning up

I googled and tried adding the following kernal parameters

intel_iommu=off  

Some sites also mention

iommu  

This unfortunately didn't help me anything.

I also tried to add:

pciehp pciehp_force=1  

And tried to do

sudo modprobe pciehp pciehp_force=1  

But Arch Linux complains that it doesn't find the kernel module pciehp.

I didn't find any information on how to install pciehp kernel module on Arch Linux. Some say, it is build into the kernel or something.

debug information:

kernel version: 4.16.6-1-ARCH

dmesg with debugging xhci_hcd enabled and with xhci_hcd greped

lspci -nn:

05:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720202 USB 3.0 Host Controller [1912:0015] (rev 02)  

dmesg (old without xhci_hcd-debugging and withouth grep

References to places with people working on the problem:

Linux mailing list:

Other sources:

pulseaudio does not start

Posted: 17 Apr 2021 08:11 AM PDT

System: Linux Mint Cinnamon 18.2 Sonja

After I had some struggle to connect my bluetooth mouse with my notebook (see here), the system does not recognize any sound devices. Neither my inbuilt loudspeaker nor my inbuilt microphone will be shown in "start / system_settings / hardware / sound / output | input". The sound-applet in the panel (task-bar) also will not be shown.

I already reinstalled pulseaudio, still it gives me following error back:

alpha@Pavilion ~ $ pulseaudio   E: [pulseaudio] main.c: Unknown command: module-bluetooth-policy  E: [pulseaudio] main.c: Failed to initialize daemon.  alpha@Pavilion ~ $ pulseaudio --start  E: [pulseaudio] main.c: Daemon startup failed.  

Has anyone an idea how to fix pulseaudio?

enter image description here

enter image description here

Oracle 11gR2 failed on CentOS 7

Posted: 17 Apr 2021 07:49 AM PDT

I am installing Oracle 11gR2 on CentOS 7. I have the packages installed, I have the kernel parameter set but still its not working. Here are the images. [Installation Image][1]

Package Query Result

Kernel Parameters

How to sharing Android VPN with Linux?

Posted: 17 Apr 2021 06:10 AM PDT

I have a rooted galaxy note5 with Android 7, and an Asus laptop with Ubuntu 16.04. I like to share my phone VPN connection with my laptop. I tried some apps like VPNTether,DF tethering fix, TetherNet, Pdanet+, etc. but they didn't work!

I think I could use the VPNTheter on windows 10 and it worked, but they don't work on Ubuntu!

Also I tested two Wi-Fi and USB cable methods.

Also I found this method but couldn't understand what it says in numbers 6 and 7 ?

  1.  You need a rooted device    2.  Make sure you have a VPN app, like OpenVPN or DroidVPN ( I use DroidVPN and its the best)    3.  Download Terminal Emulator    4.  Activate your hotspot and connect to your VPN    5.  Launch Terminal emulator and on the first line type "su" (without the quotes) and press enter      6. Copy and paste this to the Terminal Emulator. Make sure to paste to a new folder using Root Browser first and copy to T.E. in the exact format as shown below:    iptables -t filter -F FORWARD  iptables -t nat -F POSTROUTING  iptables -t filter -I FORWARD -j ACCEPT  iptables -t nat -I POSTROUTING -j MASQUERADE  ip rule add from 192.168.43.0/24 lookup 61  ip route add default dev tun0 scope link table 61  ip route add 192.168.43.0/24 dev wlan0 scope link table 61  ip route add broadcast 255.255.255.255 dev wlan0 scope link table 61      7. That's about it. Also, be sure to make a folder with Root Browser and paste the code there, as this resets after re-boot. It worked on my LG G3 on android 4.4.2  

Error in Remix OS during boot after update, i.e. menu.Ist

Posted: 17 Apr 2021 06:33 AM PDT

1. Installed Remix OS 3.0 With official supported tool i.e., RemixUSBTool. On Hard Drive Partition.

What Actually Happened ?

2. After Installing -> Working Normally -> Download Updates -> Reboot -> After Installing Updates -> Rebooted Again -> Got Following Error --->

find --set-root --ignore-floppies /menu.lst   error 15:File Not Found    Press any key to continue . . .  

Here's some more information (in case needed)

  • Triple-booted computer with Windows 10, Ubuntu 16.10 & This One.

  • Ubuntu stopped working after the above error. (But I fixed this with EasyBSD). Also, after that error, the RemixOS folder is inaccessible from Windows 10 (and from other OSes as well.)


So, does anybody have any solution for it?

(I've already tried a solution suggested on googlegroupchat, but it doesn't work for me.)

How can I calculate the size of a directory?

Posted: 17 Apr 2021 06:49 AM PDT

How to know the size of a directory? Including subdirectories and files.

No comments:

Post a Comment