Wednesday, February 9, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Web pages load slowly, if at all, despite fast download speeds

Posted: 09 Feb 2022 12:01 PM PST

I recently switched from Windows to Void Linux. I did not have this problem in Windows. Sometimes, seemingly at random, certain websites fail to load on every browser I try. This only happens on my Void Linux laptop.

With my limited networking and troubleshooting skills, I have come to the conclusion that this is a problem with my DNS servers, however, changing them did not fix the issue.

My problem seems to be the same as this question, and indeed, I am also completely unable to play music on soundcloud, and usually CDN's are broken for me as well.

This is as far as my troubleshooting techniques can take me. I desperately need help in debugging this issue.

neomutt + neovim

Posted: 09 Feb 2022 11:55 AM PST

using: ubuntu 18.04, neomutt 20171215, neovim v0.6.0. i am new to neovim and neomutt

nvim is the default editor in my neomutt. When i compose an email the text appears justified, and after i send the email the text looks fine. But if i view the same message in evolution (or i assume another desktop client) the line length and wrapping are lost, and i assume this is what the recipient sees, ie a mess of words

I have these lines in my nvim/init.vim:

set wrap linebreak nolist                                                         set number                                                                        setl fo=aw2tq                                                                     set colorcolumn=80   

is there some way to ensure the message looks sensible to the recipient and the paragraph formatting is not lost? I think when i was using vim instead of nvim i didnt have this issue

Is there a "hostname -I" alternative that works on most Unix-like systems?

Posted: 09 Feb 2022 11:32 AM PST

I am writing a Bash script that requires the internal/private IP address. On a Linux system I normally use the hostname -I command. However, this does not work on some other Unix-like systems, most notably MacOS. Is there any command that does return the private IP address, that is present on most (if not all) Unix-like systems?

Cannot create custom partitions on a rhel 8 installation

Posted: 09 Feb 2022 11:23 AM PST

I am trying to install RHEL 8 on an older server that had been running CentOs 7 and can't seem to do custom partitions even though it will install if I allow it to create the partitions. Every time I try to do a custom install I get the error message: /boot file system cannot be type lvmlv. raid0 may not have enough space.

I did an automatic install and logged in to see how the disk was partitioned:

> md126p1     1.1M   biosboot  > md126p2       1G   linux filesystem  > md126p3       1T   LVM  

I tried repurposing the existing partitions created by the automatic install to the new installation. I tried deleting all partitions and repartitioning it using the same sizes. I even tried to use fdisk from a Slackware installation DVD to rewrite the partitons so that the RHEL installation wouldn't see the data from the old install. However, I got failed to write disklable. Operation not permitted.

I have 4 disks configured as a Raid 5 in the BIOS. And, as I said, it is an older server that does not support efi.

I can always do an automatic install and use lvm to create the additional partitions. But, I would like to figure out how to do this during the installation process.

Syntax Error near unexpected token `fi' in shell script

Posted: 09 Feb 2022 11:07 AM PST

This is my code, which is pretty simple and only has 5 lines

if [ grep 'String to search' /data/directory1/*.log ]   then  echo "message when IF is successful" | mail -s 'Config Server Disconnect' myemail@gmail.com  else  echo "check"  fi  

But i'm continously getting the error line 6: syntax error near unexpected token `fi' Can someone please tell what's the error ? and what do i do fix it .

When i run the grep and mail commands separately then they are successful, but not in the shell script file

Can I use only ALSA to select the sound card?

Posted: 09 Feb 2022 11:02 AM PST

If I select from alsamixer the nvidia sound card it doesn't work at all and I can't change the items value: enter image description here

Some info:

cat /proc/asound/cards   0 [PCH            ]: HDA-Intel - HDA Intel PCH                        HDA Intel PCH at 0xf3310000 irq 31   1 [NVidia         ]: HDA-Intel - HDA NVidia                        HDA NVidia at 0xf3080000 irq 17  
Kernel: 5.10.0-11-amd64   Distro: Debian GNU/Linux 11 (bullseye)   

To use the monitor speakers can I use only ALSA?

If I start pulseaudio I can use them.

# pactl list short sources  1   alsa_output.pci-0000_00_1b.0.analog-stereo.monitor  module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED  2   alsa_input.pci-0000_00_1b.0.analog-stereo   module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED  5   alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED  # pactl list short sinks  1   alsa_output.pci-0000_00_1b.0.analog-stereo  module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED  4   alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2 module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED  

On pasystray I can simply select the sink GP106 High Definition Audio Controller ... but sometimes it doesn't work.

When PA is running if I select the HDA nvidia sound card with alsamixer is the same as before.

Tracking down symbols used by library in binary ELF as listed in memory map

Posted: 09 Feb 2022 10:20 AM PST

I have an application written in C++ that crashed during exit. The reason for the crash is understood, there are references to different versions of the same library mixed inside the executable. This is a mistake we are trying to track down so to help us do that we are hoping we can make use of the memory map dump created when the executable crashed.

These are the relevant sections of the memory map:

7ffff5bc7000-7ffff5ccc000 r-xp 00000000 00:38 2348051668                 /devel/utility/release/lib64/libUtils.so  7ffff5ccc000-7ffff5ecc000 ---p 00105000 00:38 2348051668                 /devel/utility/release/lib64/libUtils.so  7ffff5ecc000-7ffff5ece000 r--p 00105000 00:38 2348051668                 /devel/utility/release/lib64/libUtils.so  7ffff5ece000-7ffff5ed2000 rw-p 00107000 00:38 2348051668                 /devel/utility/release/lib64/libUtils.so  
7fbbf73c3000-7fbbf73ee000 r--p 00000000 00:31 2235616792                 /devel/utility/v6.6/lib64/libUtils.so  7fbbf73ee000-7fbbf7462000 r-xp 0002b000 00:31 2235616792                 /devel/utility/v6.6/lib64/libUtils.so  7fbbf7462000-7fbbf747e000 r--p 0009f000 00:31 2235616792                 /devel/utility/v6.6/lib64/libUtils.so  7fbbf747e000-7fbbf747f000 ---p 000bb000 00:31 2235616792                 /devel/utility/v6.6/lib64/libUtils.so  7fbbf747f000-7fbbf7481000 r--p 000bb000 00:31 2235616792                 /devel/utility/v6.6/lib64/libUtils.so  7fbbf7481000-7fbbf7483000 rw-p 000bd000 00:31 2235616792                 /devel/utility/v6.6/lib64/libUtils.so  

These sections show that different parts of the same executable are linked to different versions of the library on the filesystem. I have the matching core dump file as well and my question is:

Is it possible to determine which symbols in the executable code were linked at runtime to each version of the library from this memory mapping? Or maybe there is a way to do this from the executable itself?

This executable makes direct use of the code on libUtils.so but also links other libraries that themselves may use libUtils.so. It is our guess that one of these is linking to the v6.6 instance instead of the release instance and we are trying to track it down.

An ldd -rv of the executable shows both listed but not enough to figure out where they came from. We know the release version came from direct compilation and linking of the executable but we are trying to track down where the v6.6 instance got pulled in.

Trimmed down output of ldd -rv:

    **/devel/utililty/release/lib64/libUtils.so (0x00007f0576b29000)**      liblog4cplus-1.1.so.9 => /lib64/liblog4cplus-1.1.so.9 (0x00007f0575fcb000)      libsigc-2.0.so.0 => /lib64/libsigc-2.0.so.0 (0x00007f0575b8e000)      libGL.so.1 => /lib64/libGL.so.1 (0x00007f057479a000)      libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f057457e000)      libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f0574276000)      libm.so.6 => /lib64/libm.so.6 (0x00007f0573f73000)      libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0573d5d000)      libc.so.6 => /lib64/libc.so.6 (0x00007f057399a000)      libboost_thread-mt.so.1.53.0 => /lib64/libboost_thread-mt.so.1.53.0 (0x00007f0573782000)      libboost_system-mt.so.1.53.0 => /lib64/libboost_system-mt.so.1.53.0 (0x00007f057357e000)      **libUtils.so => /devel/utility/v6.6/lib64/libUtils.so (0x00007f05730a1000)**  

UIO instance of a device-tree subnode

Posted: 09 Feb 2022 09:59 AM PST

I have the following device-tree node which is auto generated by Xilinx PetaLinux in a proper dtsi file (which cannot be modified):

axi_dma_0: dma@a0000000 {          #dma-cells = <1>;          clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_s2mm_aclk";          clocks = <&misc_clk_0>, <&misc_clk_0>, <&misc_clk_0>;          compatible = "xlnx,axi-dma-7.1", "xlnx,axi-dma-1.00.a";          interrupt-names = "s2mm_introut";          interrupt-parent = <&gic>;          interrupts = <0 89 4>;          reg = <0x0 0xa0000000 0x0 0x10000>;          xlnx,addrwidth = <0x28>;          xlnx,include-sg ;          xlnx,sg-length-width = <0x1a>;          dma-channel@a0000030 {              compatible = "xlnx,axi-dma-s2mm-channel";              dma-channels = <0x1>;              interrupts = <0 89 4>;              xlnx,datawidth = <0x20>;              xlnx,device-id = <0x0>;          };      }  

To give access to the whole AXI DMA hardware from UIO, the following code can be used from another custom file that PetaLinux accounts for:

&axi_dma_0 {      compatible = "generic-uio";      linux,uio-name = "axi_dma";  };  

What I would like to do is to give UIO access only to the dma-channel sub-node instead of the whole AXI DMA. To do this I tried something this:

&axi_dma_0 {      dma-channel@a0000030 {          compatible = "generic-uio";          linux,uio-name = "axi_dma_s2mm";      };  };  

Or adding reg space declaration to dma-channel subnode:

&axi_dma_0 {      dma-channel@a0000030 {          reg = <0x0 0xa0000030 0x0 0x28>;          compatible = "generic-uio";          linux,uio-name = "axi_dma_s2mm";      };  };  

Among others... I cannot make it to create the /dev/uioX file.. What is wrong or what am I missing to make it work, or understand why it is not possible (if so) ?

Explanation of pipeline containing egrep, tr and expand

Posted: 09 Feb 2022 11:48 AM PST

Can someone explain the following pipeline to me?

I am trying to filter a list of ports in services so that only the unique port names are listed out. What exactly do expand and tr do, and what does the regular expression used with egrep do?

expand regexAufgabe | egrep -v '^#|^$' | tr -s ' ' | cut -d ' ' -f2 | cut -d / -f2 | sort | uniq  

/git: permission denied

Posted: 09 Feb 2022 09:35 AM PST

I couldn't find a solution to this error so I reinstalled the OS, that takes me 30 minutes and I was expecting it to solve the problem, but it persists. Whenever I try a git init in any empty repository I get /git: permission denied. Which doesn't tell me anything.

Then only files I've copied after reinstalling Manjaro Cinnamon 21.2.2-220123-linux515 are the ones I keep in the Sync directory where I have my dotfiles. In the dotfiles I have some git configuration but I don't think that would be causing the issue.

Why is Zorin OS so full of bugs?

Posted: 09 Feb 2022 09:31 AM PST

I have Zorin OS 16, x64, with X11 windowing system, and I am using full disk encryption by the way, and am using a Dell Latitude E5450 laptop.

I really love few things about the OS, and some of the benefits of using Linux, but I am experiencing various annoying glitches and crashes, and I was wandering why, and should I switch to Ubuntu instead? Here are some of the issues I have been experiencing:

Bootloader menu not intuitive and some options disabled - leading to erasing windows by accident instead of making a dual-boot.  Not being able to cut/copy/paste files from desktop to a different drive  Not being able to open files on another drive in wine applications  Can't change file view type (list, large, details, etc.) per folder, but for the entire file manager  There is no filetype column to sort by  Only 2 types of viewes - list and icons, although this is nod a bug but a poor design  Drag and drop to the taskbar doesen't work  Can't copy paste to other drive, need to drag drop in window  Desktop lost icons and right click not working either, after saving 20-30 files on desktop  Firefox sometimes crashes the OS and need shut down with PC button  Firefox tab made the system unresponsive and needed Shut down with PC button  Wine app Notepad++ and possibly other non wine apps constantly generate .bak files that often persist even after closing the document and get in my way all the time  Wine app Notepad++ - "find" window tabs are broken "Ctrl+F" (although still useable)  Text editor froze for a time after initiating save operation on a small text file "Ctrl+S"  OS unresponsive to all clicks or "Alt+Tab", only mouse cursor is moving. Resolved after ~30 sec  QBittorrent is unresponsive when I open torrent file with open with from browser and in some cases needs to be closed and the action done again  Firefox window was small and unresponsive after update, opening w 6 tabs. Needed to close it and wait a minute for it to close  After automatically openning last tabs (6 tabs) firefox is in a window mode and button highlighting is offsetted from the mouse cursor by a significant ammount, thus one needs to point to the left and top of the desired location. Fixed after maximizing the window manually  Blobby volley game arrows don't react always  Wine app notepad++ has 2 icons on taskbar  Annoying .bak files being created all the time  Default video player seekbar stopped moving with the cursor, authough sliding on it still moves the video, just the seek bar does not reflect it  VLC player won't start and when started via the special icon on the right of the task bar, won't play video files  Touch pad stopped working, had to do with the knob and restart the OS  

And those are just the most, and this is in the span of a month or so, so everyday there is something new to annoy me. This is not normal for Linux, right?

Select first n words of each line of a file

Posted: 09 Feb 2022 10:30 AM PST

Using sed or awk, I want to select the first n words of each line of a file.

I have a file with three lines, say

one two three four  one two three four  one two three four  

and I want the output file to be the first, say, two words of each sentence:

one two  one two  one two  

Why Aptitude package manager is not as popular as APT?

Posted: 09 Feb 2022 09:21 AM PST

Let me admit that my opinion in the question may be wrong. (Aptitude may be actually popular by users than APT, unfortunately I did not find robust data about usage.) But, wherever I see, let's say, official documentations, manpages, installation instructions, tutorials and videos, I mostly see the mention of APT. Aptitude, on the other hand, has a very few mentions.

When tried to see some technical comparisons, I almost always came across the argument that Aptitude is better than APT. It's dependency resolver is more robust than APT and it represents information in beautiful way. APT lacks some of these features.

Even it has these plus points, Aptitude is not shipped by default on any Debian/Ubuntu based distros, and is not mentioned anywhere either. Also, whatever technical comparisons and mentions of Aptitude I found on internet, are very old. (Almost 6 to 10 years old..!) It seems that very very few people advocate Aptitude nowadays.

So my question is, why more and more people are endorsing and promoting APT and not Aptitude ? What are some technical constraints of Aptitude ? In the end, distribution vendors may have some genuine reasons for this thing.

Does anyone know ?

After reinstalling NetworkManager internet connection is not working. Only dhclient usb0 works. VPN connection says it's connected but it's not

Posted: 09 Feb 2022 11:02 AM PST

I had a problem with dropping internet and vpn connection on ubuntu 20.04. Because of that i decided to reinstall network manager according to this anwser.

I executed following commands

sudo apt-get purge network-manager  sudo apt-get update  sudo apt-get autoremove  sudo apt-get upgrade  sudo apt-get install network-manager  sudo apt install ubuntu-desktop  

then rebooted the system and after that i can't connect to the internet. My modem is Android device with tethering enabled (internet connection has been working properly before executing commands that i listed above). Connection is visible on the ubuntu GUI (top right corner) and is named "USB Ethernet Connected". Despite of that internet is not working.

I found that i can execute dhclient usb0 and after that internet is working properly but i have to do it every time i boot up the system. Also i can't connect to VPN network (there is no error, GUI says it's connected but servers available only in VPN network are not accessible).

There is my ifconfig

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255          ether 02:42:25:93:e5:82  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 0  bytes 0 (0.0 B)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    docker_gwbridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 172.19.0.1  netmask 255.255.0.0  broadcast 172.19.255.255          inet6 fe80::42:c3ff:fe60:668a  prefixlen 64  scopeid 0x20<link>          ether 02:42:c3:60:66:8a  txqueuelen 0  (Ethernet)          RX packets 495  bytes 47231 (47.2 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 520  bytes 80963 (80.9 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    enp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          ether 4c:ed:fb:95:c7:9f  txqueuelen 1000  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 0  bytes 0 (0.0 B)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536          inet 127.0.0.1  netmask 255.0.0.0          inet6 ::1  prefixlen 128  scopeid 0x10<host>          loop  txqueuelen 1000  (Local Loopback)          RX packets 5192  bytes 487445 (487.4 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 5192  bytes 487445 (487.4 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 192.168.42.109  netmask 255.255.255.0  broadcast 192.168.42.255          inet6 fe80::e097:241:56b:9a3a  prefixlen 64  scopeid 0x20<link>          ether 92:28:29:5f:bf:6c  txqueuelen 1000  (Ethernet)          RX packets 5  bytes 1058 (1.0 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 249  bytes 32661 (32.6 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth05b6c07: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::782e:6ff:fe4a:bdb9  prefixlen 64  scopeid 0x20<link>          ether 7a:2e:06:4a:bd:b9  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 48  bytes 6509 (6.5 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth0ba13b0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::1cc9:c1ff:fef2:b783  prefixlen 64  scopeid 0x20<link>          ether 1e:c9:c1:f2:b7:83  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 47  bytes 6425 (6.4 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth0c2d06c: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::286c:9dff:fe62:d6b8  prefixlen 64  scopeid 0x20<link>          ether 2a:6c:9d:62:d6:b8  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth0e104e0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::ac61:95ff:feb6:f31b  prefixlen 64  scopeid 0x20<link>          ether ae:61:95:b6:f3:1b  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth1b2a54a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::8c1c:f4ff:fec1:3097  prefixlen 64  scopeid 0x20<link>          ether 8e:1c:f4:c1:30:97  txqueuelen 0  (Ethernet)          RX packets 495  bytes 54161 (54.1 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 519  bytes 80611 (80.6 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth1e723d5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::c463:b3ff:fe4e:992c  prefixlen 64  scopeid 0x20<link>          ether c6:63:b3:4e:99:2c  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth20ad462: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::7cf1:a6ff:fe67:bd5  prefixlen 64  scopeid 0x20<link>          ether 7e:f1:a6:67:0b:d5  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth2b1261a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::2091:6eff:fe36:6915  prefixlen 64  scopeid 0x20<link>          ether 22:91:6e:36:69:15  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth3575eea: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::94f8:e5ff:fed1:3f13  prefixlen 64  scopeid 0x20<link>          ether 96:f8:e5:d1:3f:13  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth48f5a22: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::d8e6:fcff:fe3f:c003  prefixlen 64  scopeid 0x20<link>          ether da:e6:fc:3f:c0:03  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth4f510a3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::a870:e1ff:feb9:9cca  prefixlen 64  scopeid 0x20<link>          ether aa:70:e1:b9:9c:ca  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 77  bytes 10671 (10.6 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth6ca5384: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::80ce:94ff:fe2f:8c8e  prefixlen 64  scopeid 0x20<link>          ether 82:ce:94:2f:8c:8e  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth7249d81: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::5c70:7fff:fe9d:54a4  prefixlen 64  scopeid 0x20<link>          ether 5e:70:7f:9d:54:a4  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth875ed12: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::1047:dfff:fef6:d885  prefixlen 64  scopeid 0x20<link>          ether 12:47:df:f6:d8:85  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    veth88216b5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::98bf:c5ff:fe8f:ef44  prefixlen 64  scopeid 0x20<link>          ether 9a:bf:c5:8f:ef:44  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6098 (6.0 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    vetha5da662: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::9c6d:36ff:fefa:4fdc  prefixlen 64  scopeid 0x20<link>          ether 9e:6d:36:fa:4f:dc  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    vethb219fc4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::a427:5ff:fe2a:de36  prefixlen 64  scopeid 0x20<link>          ether a6:27:05:2a:de:36  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    vethb58896f: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::80e9:50ff:fe61:aee7  prefixlen 64  scopeid 0x20<link>          ether 82:e9:50:61:ae:e7  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 48  bytes 6509 (6.5 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    vethdceb1ac: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet6 fe80::387d:c8ff:fea5:4926  prefixlen 64  scopeid 0x20<link>          ether 3a:7d:c8:a5:49:26  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 44  bytes 6115 (6.1 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  

There is my /etc/network/interfaces file (originally after reinstallation of network manager it was empty but i added it in the mean time)

# This file describes the network interfaces available on your system  # and how to activate them. For more information, see interfaces(5).    # The loopback network interface  # auto lo  # iface lo inet loopback    # The primary network interface  # auto usb0  # iface usb0 inet dhcp    

There is my netplan configuration (only /etc/netplan/01-network-amanger-all.yaml is there)

# Let NetworkManager manage all devices on this system  network:    version: 2    renderer: NetworkManager  

and /etc/NetworkManager/NetworkManager.conf

[main]  plugins=ifupdown,keyfile    [ifupdown]  managed=true    [device]  wifi.scan-rand-mac-address=no    [keyfile]  unmanaged-devices=*,except:type:wifi,except:type:wwan,except:type:ethernet  

I would like to have working internet after booting up the computer and working VPN connection. I would be glad for any explanations why it stopped working, what can i do and where i can read more about network configuration in Ubuntu.

EDIT #1

It seems that executing below commands fixed internet connection on system boot but VPN is still not working.

apt install resolvconf  systemctl enable systemd-resolved.service  service systemd-resolved start  

EDIT #2

After executing sudo apt-get install --reinstall ubuntu-desktop and rebooting the machine VPN configuration can be edited and I can connect to VPN but i can't access any server by it's DNS name.

EDIT #3

Issue has been resolved following this tutorial

Rename file by moving middle string to end of the file

Posted: 09 Feb 2022 11:26 AM PST

I have some data files and I wish to rename them for my pipeline.

The files look like this:

{unique_ids}_{experiment_condition}_L{3_digit_number}.txt  

I need to rename them so the experiment condition flag will appear at the end of the file, before the extension as follows:

{unique_ids}_L{3_digit_number}_{experiment_condition}.txt  

Length of unique_ids and experiment_codition is not fixed.

Example:

ghad312fd2_Mb_L002.txt becomes ghad312fd2_L002_Mb.txt.

Thank You!

Extract lines from one file containing words listed in another file

Posted: 09 Feb 2022 10:05 AM PST

I have two files, file1.txt and file2.txt.

In file1.txt I have 4 thousand lines of single string words and in file2.txt I have 498 sentences.

I want to grep file2 with the contents in file1 and if that string from file1 is found in file2 print the match.

I have tried grep -f and grrp -Ff, but all it does it print the contents of the files.

file1.txt

something  somthingelse  maybe  ok  yes  

file2.txt

Hello there how are you  Here is another line ok  Nothing to see here maybe  Nope not here  yes   

Expected output

Here is another line ok  Nothing to see here maybe  yes         wc -l file1.txt file2.txt   4000 file1.txt    498 file2.txt   4498 total  

partitioning, subpartitions

Posted: 09 Feb 2022 10:52 AM PST

A hard drive with multiple partitions gets dd'ed onto a partition of a second hard drive (partition big enough to fully contain the first hard drive). Is it possible to access the data on the second drive - and if, how?

Edit: For clarification - I guess a better term for the problem would be "nested partition(s)": enter image description here Which also led me to this answer: Is there a way to allow nested partition tables? - my use case would be similar to the last paragraph, and probably a solution would be to use device mapper. But it seems there is no "easier" way to access the data.

Debian doesn't show wifi connection

Posted: 09 Feb 2022 11:12 AM PST

I installed debian on an old Toshiba laptop and did everything through LAN. But now I saw that wifi is totally missing. Searching online I found that my output of pci -nn | grep -i network might be useful:

06:02.0 Network controller [0280]: Intel Corporation PRO/Wireless 2200BG [Calexico2] Network Connection [8086:4220] (rev 05)  

I tried to re-install wireless-tools and firmware-iwlwifi and network-manager but nothing works, help me please.
Thanks in advance.

Zeroing bytes to linux dos not working with LVM(XFS) volume

Posted: 09 Feb 2022 09:28 AM PST

I'm running a CenOS7 on VirtualBox and need to reduce the VDI file. Firstble I need clean the free space using zerofree,trim, dd, etc...

I tried to use both (DD and FSTRIM) to clean IT but after a few tentatives the VDI file continues with a huge difference.

Any light about why does not working?

System Info's:

Zabbix/PostgressDB server  FS: xfs  Volume: LVM  

host disk infos

commands used at the guest:

  • dd if=/dev/zero of=/storage/zerofile bs=4096k; rm -f /storage/
  • fstrim -av

command used at the host

  • modifyhd 'file.vdi' --compact
  • Optimize-VHD 'file.vdi' -Mode Full

vdi file info

Unable to exclude lines containing ^M from grep

Posted: 09 Feb 2022 09:24 AM PST

I have the following file from which I want to extract only Removed '2022-01-30_01-00-05', at the end.

Removing '2022-01-30_01-00-05'...    0.46% complete (00:03:45 remaining)^M  5.49% complete (00:00:17 remaining)^M 24.90% complete (00:00:06 remaining)^M 60.56% complete (00:00:01 remaining)^M 82.12% complete (00:00:00 remaining)^M 82.39% complete (00:00:01 remaining)^M 84.24% complete (00:00:01 remaining)^M 86.48% complete (00:00:01 remaining)^M 88.58% complete (00:00:01 remaining)^M 89.66% complete (00:00:01 remaining)^M101.08% complete (00:00:00 remaining)^M104.62% complete (00:00:00 remaining)^M                                                                                ^MRemoved '2022-01-30_01-00-05'  

I've tried dos2unix but it didn't work.

I've tried these variations, below, but when I less output they either don't remove the ^M characters, or the whole line is captured:

tr -d $'\r' < /file | grep "Removed" > output  tr -d '^M' < /file | grep "Removed" > output  tr -d ^M < /file | grep "Removed" > output  sed 's/\r//g' < /file | grep "Removed" > output  

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

Posted: 09 Feb 2022 12:00 PM PST

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

I test for screen tearing with this video.

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

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

how can I call a script with spaces in a variable in zsh?

Posted: 09 Feb 2022 09:52 AM PST

this works as expected in bash:

> t="ls -l"  > $t #== ls -l  > "$t" #== "ls -l"  ls -l: command not found  

But in zsh I got this:

> t="ls -l"  > $t #== "ls -l"  ls -l: command not found  

How can I force the shell to parse the variable value again like bash does?

gpg: keyserver receive failed: Server indicated a failure

Posted: 09 Feb 2022 11:33 AM PST

This error has arise when I add gns repository and try to use this command:

#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F88F6D313016330404F710FC9A2FD067A2E3EF7B  

the error is:

gpg: keyserver receive failed: Server indicated a failure  

Fingerprint reader on Asus Zenbook

Posted: 09 Feb 2022 10:05 AM PST

So I have ZorinOS installed on my ASUS ZenBook UX330UA-AH54, however, FingerprintGUI shows my fingerprint sensor (Elantech I think) as an unknown device. Is there any custom software or fixes that can be used to get my laptop to pickup the fingerprint sensor?

Bash shell launched by forkpty() spawns child processes that ignore SIGINT. Why and how do I ensure SIGINT is not ignored?

Posted: 09 Feb 2022 11:02 AM PST

I have a C program that uses forkpty to execute a bash shell. I'm finding that the programs launched by this shell are launched with SIGINT ignored, so when I send a Ctrl-C to the shell they never close.

example:

int masterFd;  char* args[] = {"/bin/bash", "-i", NULL };  int procId = forkpty(&masterFd, NULL, NULL,  NULL);  if( procId == 0 ){    execve( args[0], args, NULL);  }  else {     // Simple code that reads from standard in and writes to masterFd.       // I also register for Ctrl-C and write it to masterFd if caught  }  

Other control characters seem to make it through, ctrl-D, ctrl-? etc. However, whenever I look at the status of a process launched by the new bash shell it appears as if SIGINT is masked out.

MyShell:# sleep 1000    StandardTerm:#  ps -ef | grep sleep  root    26611  19278  0  17:44  pts/1   00:00:00 sleep 1000  root    26613  32376  0  17:44  pts/1   00:00:00 grep sleep    StandardTerm:# grep Sig proc/26611/status  SigQ:    0/256428  SigPnd:  0000000000000000  SigBlk:  0000000000000000  SigIgn:  0000000000010006   <- THE 6 IS THE PROBLEM  SigCgt:  0000000180000000  

SigIgn has the 2 bit set, which means 2 (SIGINT) is ignored. if I do the exact same thing, but run sleep (or cat a giant file or whatever) in a standard terminal, this bit is cleared. What am I doing when I launch my pty bash that is causing it to create grandchildren programs with SIGINT ignored?

Moreover, if I send a SIGINT signal to the process

StandardTerm:# kill -2 26611  

nothing happens. What's strange is when I send the same command to the bash shell I forkpty'ed IT works, because that bash shell is not ignoring SIGINT.

Edited sudoers file with text editor - now can't run sudo

Posted: 09 Feb 2022 11:01 AM PST

I now know that I should never try to edit the etc/sudoers file with a regular text editor. However, minutes before I learned this, I saved a new user name in the file with Sublime Text. Now when I run sudo cat sudoers for example, I get the following error:

>>> /etc/sudoers: syntax error near line 1  <<<  sudo: parse error in /etc/sudoers near line 1  sudo: no valid sudoers sources found, quitting  

How can I get out of this quandary?

How do I test if an item is in a bash array?

Posted: 09 Feb 2022 12:05 PM PST

Help for a simple script

#!/bin/bash    array1=(  prova1  prova2  slack64  )    a="slack64"  b="ab"    if [ $a = $b ]  then        echo "$a = $b : a is equal to b"  else        echo "$a = $b: a is not equal to b"  fi  

This script simply doesn't work, I want a script which check if slack64 is present in a list(i use an array),and simply give me, yes is present,or no. I don't know how to compare an array with a single variable.

How to stop the loop bash script in terminal?

Posted: 09 Feb 2022 09:23 AM PST

For example,

#!/bin/bash  while :  do      sl  done  

How to terminate this bash script?

Get path of current script when executed through a symlink

Posted: 09 Feb 2022 11:21 AM PST

I have a utility consisting of a couple of directories with some bash scripts and supporting files that will be deployed to several machines, possibly in a different directory on each machine. The scripts need to be able to reference paths relative to themselves, so I need to be able to get the path to the file that's currently being executed.

I am aware of the dirname $0 idiom which works perfectly when my script is called directly. Unfortunately there is a desire to be able to create symlinks to these scripts from a totally different directory and still have the relative pathing logic work.

An example of the overall directory structure is as follows:

/   |-usr/local/lib   |  |-foo   |  |  |-bin   |  |  |  |-script.sh   |  |  |-res   |  |  |  |-resource_file.txt   |-home/mike/bin   |  |-link_to_script (symlink to /usr/local/lib/foo/bin/script.sh)  

How can I reliably reference /usr/local/lib/foo/res/resource_file.txt from script.sh whether it is invoked by /usr/local/lib/foo/bin/script.sh or ~mike/bin/link_to_script?

No comments:

Post a Comment