Tuesday, May 3, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Which command should I use as root to spawn a process with overridden numieric uid/gid/groups?

Posted: 03 May 2022 12:56 PM PDT

Which command (available in distro repositories) should I use start a shell with specified numeric uid, gid and groups? Typically su is used to change from root to other user, but it tries to look up groups by names, which may not exist when external filesystems, namespaces and Docker containers are in use.

I expect it to be a simple app that just does setgroups(2), setgid(2), setuid(2) and execve(2), without any /etc/passwd or nsswitch. It is easy to implement such a program in C, but maybe something standard and distro-available is used for this use case?

Find all binaries that require root privilege in a freshly installed Ubuntu 20.04 LTE

Posted: 03 May 2022 12:48 PM PDT

I am currently looking for the simplest way to find all binary files in /usr/bin and /usr/sbin directories that require a root privilege to run, which means I should run them using sudo or by being root only, for example, tcpdump. I have a freshly installed Ubuntu 20.04 LTE so I don't have any other additional binary files. Every single answer would help and is much appreciated :).

How do I start a Docker container in custom network namespace?

Posted: 03 May 2022 12:32 PM PDT

How do I make docker run to setns to the network namespace of my choice when starting a container? I want something like --net host mode, but aiming to the namespace of Docker server itself.

Or should I nsenter(1) from within the container started with --net host? Can it be done without making the container overly privileged?

Using perl to print average of columns

Posted: 03 May 2022 11:41 AM PDT

I need a perl script that will print the average of a specific column in a file.

So far, I can do this on the command line with the code below

perl -lane '$total += $F[4]; END{print $total/$.}' file.txt  

The output is 50.6363

In this code, I am taking column 4 and printing the average of it. This command works when I type it on the command line but will not work when I put it in a script. If possible, I would also like to reduce the output to only displaying 2 digits after the decimal but I am unsure of how to go about that.

can something like --rsync-path be done with scp?

Posted: 03 May 2022 11:28 AM PDT

scp is handy sometmes because of its -3 feature. Systems here are configured to disallow root login, however sudo is configured to allow certain folks to pass --rsync-path=sudo\ rsync. i'd like to know if something similar is possible to enable admin access via scp? Perhaps some clever -o arg, or perhaps somehow invoke scp via ssh?

Finding max row with highest value for a particular country in a csv file

Posted: 03 May 2022 11:18 AM PDT

I have a .csv file with entries like

    Location,Indicator,Period,First Tooltip      Afghanistan,Malaria incidence (per 1 000 population at risk),2018,29      Afghanistan,Malaria incidence (per 1 000 population at risk),2017,27      Afghanistan,Malaria incidence (per 1 000 population at risk),2016,26      Afghanistan,Malaria incidence (per 1 000 population at risk),2015,15      Afghanistan,Malaria incidence (per 1 000 population at risk),2002,104      Afghanistan,Malaria incidence (per 1 000 population at risk),2001,92      Afghanistan,Malaria incidence (per 1 000 population at risk),2000,96      Algeria,Malaria incidence (per 1 000 population at risk),2018,0      Algeria,Malaria incidence (per 1 000 population at risk),2017,0      Algeria,Malaria incidence (per 1 000 population at risk),2013,0  

I want to write a shell script that gives a country name as the argument to the shell
script returns and output like :
./scrip.sh Afghanistan
For Afghanistan, the year is 2002; the rate is 104 per 1,000
Basically, for that country, pick the line with max Tooltip and then parse it to produce
the above output.

My thoughts:
I am not sure how to do this using a shell script.
There are two parts here one is selecting the max, and then once we have that line
split it over, find out the numerical values and print it out.
Any hints or ideas on how to procees

Is DEBIAN_FRONTEND=noninteractive redundant with apt-get -yqq?

Posted: 03 May 2022 08:44 AM PDT

I'm a noob in both Docker and Linux and studying a Dockerfile from a shared project I work on. Something I don't understand-- at the top of the Dockerfile we have:

# Never prompts the user for choices on installation/configuration of packages  ENV DEBIAN_FRONTEND=noninteractive  

But then in a whole series of later Docker RUN commands, I see that -yqq is appended to all the apt-get commands: apt-get {install,update,upgrade} -yqq .... Since -yqq is supposed to automatically answer questions for apt-get and make it silent, I'm confused as to whether it's redundant. But I'm having a hard time finding straightforward answers, so here are some questions:

  • Does apt-get directly read the value of DEBIAN_FRONTEND and set options accordingly?
  • Are -y and -qq redundant for one or more of apt-get {install,update,upgrade} if DEBIAN_FRONTEND=noninteractive is set?

Delete line in each text files if the first field value is greater than 400

Posted: 03 May 2022 10:07 AM PDT

I have a large number of txt files. the format of each txt files is similar to this

200 0.2 0.1 0.5 0.4  500 0.4 0.9 0.9 0.1  

I am trying to delete each line in each txt file that has the first field value greater than 400. So the above file should only contain this now:

200 0.2 0.1 0.5 0.4  

Code

for file in *.txt; do           echo "$(awk '{ if ($1 < 401) print }' *.txt)" > tmp && mv tmp *.txt   done   rm -f tmp   

but this doesn't work as it moves all the files to the next text file.

choosing a striping number for lvcreate

Posted: 03 May 2022 08:42 AM PDT

I have a storage unit that holds 84 SAS SSD's. It has two [scsi] controllers that connect the disk storage unit to a linux host server. Currently the automated storage setup created a virtual (as opposed to linear) storage array having two disk pools each of 42 disks, and then a volume is created on each of them. The two volumes show up as /dev/sdb and /dev/sdc. I vgcreate and lvcreate on those two block devices.

my question is what stripe number should be used for optimal performance based on what I have described? Should it be 2 because of 2 controllers? Or 84 because there is 84 total disks? Or some other number?

How can I replace a character on a specific line in the whole file?

Posted: 03 May 2022 12:55 PM PDT

I have a large file which contains hundreds of English phrases in the following form:

\phrase  {.   .    .     *     *   }  {I shoul-d've stayed home.}  {aɪ ʃʊd‿əv ˈsteɪd ˈhoʊm.} <- only replace on this line    \phrase  { .   .   *  }  {Did you eat?}  {dɪdʒjʊʷˈit? ↗} <- only replace on this line    \phrase  { *    .  *    .    *  .  .    .     *   .  }  {Yeah, I made some pas-ta if you're hun-gry.}  {ˈjɛə, aɪ ˈmeɪd səm ˈpɑ stəʷɪf jər ˈhʌŋ gri.} <- only replace on this line  

It's a LaTeX .tex file. I would like to replace all r characters in each phonetic transcription (by phonetic transcription I mean every third line after the \phrase line) with the ɹ symbol (hex code U+0279).

Doing it by hand in Emacs is cumbersome for me. I was wondering if there is a way to target those lines somehow and do the replacement automatically.

All r characters have to be replaced with ɹ, there is no exception, but only in the phonetic transcription, leave the r as-is in the English/non-phonetic text.

Is it possible to do that somehow by using a script or something? There are no line breaks in my document so the transcription is alway the third line after \phrase. Thank you!

Why the rtsp stream can be opened in smplayer gui instead of cli?

Posted: 03 May 2022 11:16 AM PDT

The rtsp url for my home ip camera is such format rtsp://admin:xxxx@192.168.1.80:554/cam/realmonitor?channel=1&subtype=0.I can open it with SMPlayer's gui window. Why can't it be open with SMPlayer's cli?

smplayer  rtsp://admin:xxxx@192.168.31.80:554/cam/realmonitor?channel=1&subtype=0  

enter image description here

/usr/bin/mpv --no-config --no-quiet --terminal --no-msg-color --input-ipc-server=/tmp/smplayer-mpv-44c1 --msg-level=ffmpeg/demuxer=error --no-fs --hwdec=no --sub-auto=fuzzy --no-input-default-bindings --input-vo-keyboard=no --no-input-cursor --cursor-autohide=no --no-keepaspect --wid=69206033 --monitorpixelaspect=1 --osd-level=1 --osd-scale=1 --osd-bar-align-y=0.6 --sub-ass --embeddedfonts --sub-ass-line-spacing=0 --sub-scale=1 --sub-font=Arial --sub-color=#ffffffff --sub-shadow-color=#ff000000 --sub-border-color=#ff000000 --sub-border-size=0.75 --sub-shadow-offset=2.5 --sub-font-size=50 --sub-bold=no --sub-italic=no --sub-margin-y=8 --sub-margin-x=20 --sub-codepage=ISO-8859-1 --sub-pos=100 --volume=55 --cache=auto --screenshot-template=cap_%F_%p_%02n --screenshot-format=jpg --screenshot-directory=/home/debian/Pictures/smplayer_screenshots --audio-pitch-correction=yes --volume-max=110 --ytdl --term-playing-msg=MPV_VERSION=${=mpv-version:}  INFO_VIDEO_WIDTH=${=width}  INFO_VIDEO_HEIGHT=${=height}  INFO_VIDEO_ASPECT=${=video-params/aspect}  INFO_VIDEO_FPS=${=container-fps:${=fps}}  INFO_VIDEO_FORMAT=${=video-format}  INFO_VIDEO_CODEC=${=video-codec}  INFO_AUDIO_FORMAT=${=audio-codec-name}  INFO_AUDIO_CODEC=${=audio-codec}  INFO_AUDIO_RATE=${=audio-params/samplerate}  INFO_AUDIO_NCH=${=audio-params/channel-count}  INFO_LENGTH=${=duration:${=length}}  INFO_DEMUXER=${=current-demuxer:${=demuxer}}  INFO_SEEKABLE=${=seekable}  INFO_TITLES=${=disc-titles}  INFO_CHAPTERS=${=chapters}  INFO_TRACKS_COUNT=${=track-list/count}  METADATA_TITLE=${metadata/by-key/title:}  METADATA_ARTIST=${metadata/by-key/artist:}  METADATA_ALBUM=${metadata/by-key/album:}  METADATA_GENRE=${metadata/by-key/genre:}  METADATA_DATE=${metadata/by-key/date:}  METADATA_TRACK=${metadata/by-key/track:}  METADATA_COPYRIGHT=${metadata/by-key/copyright:}  INFO_MEDIA_TITLE=${=media-title:}  INFO_STREAM_PATH=${stream-path}   --audio-client-name=SMPlayer --term-status-msg=STATUS: ${=time-pos} / ${=duration:${=length:0}} P: ${=pause} B: ${=paused-for-cache} I: ${=core-idle} VB: ${=video-bitrate:0} AB: ${=audio-bitrate:0}   rtsp://admin:xxxx@192.168.31.80:554/cam/realmonitor?channel=1    [ffmpeg/demuxer] rtsp: method DESCRIBE failed: 404 Not Found  [lavf] avformat_open_input() failed  Failed to recognize file format.  Exiting... (Errors when loading file)  

awk based solution for summing the rows of multiple files

Posted: 03 May 2022 09:51 AM PDT

I have several files which look like

file1.dat:

1 1  1 3 4  5 9 10 11  

file2.dat:

3 0  8 9 0  3 9 2 4  

typically with many more rows (with each row containing one less column than the previous row). I devised a hybrid bash/awk script to sum the rows of each file, e.g. using the above as an example:

out.dat:

4 1  9 12 4  8 18 12 15  

The script works as expected but is quite slow. Well over 30 minutes for 100 files each with 10000 rows on my machine. The script seems to spend most of the time collecting the nth row from all the files. Is there a way to perform my operation simply by passing file*.dat to the awk command (see below)?

#!/bin/bash  ROWS=$1; shift  OUT_FILE=$1; shift  IN_FILE=("$@")    for i in `seq 1 1 ${ROWS}`; do      # Get ith row from all input files      for j in "${IN_FILE[@]}"; do          tail -n+${i} ${j} | head -1 >> "temp.dat"      done      # Sum the rows       awk '{for (j=1;j<=NF;j++) a[j]+=$j} END {for (j in a) printf a[j] " "}' temp.dat >> ${OUT_FILE}      echo >> ${OUT_FILE}      rm temp.dat  done  

Script usage based on the above example: ./RowSums.sh 3 out.dat file*.dat

How to substact or sum 12 depending on the last and following line using awk?

Posted: 03 May 2022 11:25 AM PDT

I have this data:

##sequence-region Q75T13 1 641  Q75T13,UniProtKB,Chain,1,641,.,.,.,ID  Q75T13,UniProtKB,Topological domain,1,60,.,.,.,Note=Cytoplasmic  Q75T13,UniProtKB,Transmembrane,61,85,.,.,.,Note=Helical  Q75T13,UniProtKB,Topological domain,86,641,.,.,.,Note=Lumenal      ##sequence-region Q9BRR3 1 403  Q9BRR3,UniProtKB,Chain,1,403,.,.,.,ID  Q9BRR3,UniProtKB,Topological domain,1,22,.,.,.,Note=Lumenal  Q9BRR3,UniProtKB,Transmembrane,23,43,.,.,.,Note=Helical  Q9BRR3,UniProtKB,Topological domain,44,259,.,.,.,Note=Cytoplasmic    ##sequence-region Q96FM1 1 250  Q96FM1,UniProtKB,Topological domain,120,135,.,.,.,Note=Cytoplasmic  Q96FM1,UniProtKB,Transmembrane,136,156,.,.,.,Note=Helical  Q96FM1,UniProtKB,Topological domain,157,169,.,.,.,Note=Lumenal  Q96FM1,UniProtKB,Transmembrane,170,190,.,.,.,Note=Helical  Q96FM1,UniProtKB,Topological domain,191,250,.,.,.,Note=Lumenal  

And I was wondering what the awk code would look like for:

The rows that have the word lumenal, if in the previous row it has the word transmembrane, subtract -12 in column 4 and print the row with the word lumenal. If the row with the word lumenal has the word "transmembrane" in the next row, add +12 in column 5 and print the row with the word lumenal. The final file would be:

Q75T13,UniProtKB,Topological domain,74,641,.,.,.,Note=Lumenal  Q9BRR3,UniProtKB,Topological domain,1,34,.,.,.,Note=Lumenal  Q96FM1,UniProtKB,Topological domain,145,169,.,.,.,Note=Lumenal  Q96FM1,UniProtKB,Topological domain,157,181,.,.,.,Note=Lumenal  Q96FM1,UniProtKB,Topological domain,179,250,.,.,.,Note=Lumenal  

Can someone help me? I am a little bit stuck. I am trying with awk and grep

Understanding linux Ethernet devices

Posted: 03 May 2022 09:03 AM PDT

I have a small, embedded, completely self cross-compiled installation on a mips SoC.

SoC is based on a Mediatek MT7628 sporting a Wifi interface (2.4MHz only), a 100Mbps Ethernet MAC and an internal 5port Ethernet switch (one of the ports is connected to MAC).

I compiled Ethernet device driver (mtk-eth.ko) as installable module.

If I boot without the module (I actually renamed it so udevd doesn't manage to install it "automatically") I don't have an Ethernet device, exactly as expected:

# ip a  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00      inet 127.0.0.1/8 scope host lo         valid_lft forever preferred_lft forever  3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000      link/ether b8:d8:12:64:b9:a0 brd ff:ff:ff:ff:ff:ff      inet 192.168.7.130/24 brd 192.168.7.255 scope global noprefixroute wlan0         valid_lft forever preferred_lft forever  

So far nothing strange. Next I manually install the module:

# modprobe mtk-eth  [ 6591.429607] mtk_soc_eth 10100000.ethernet: generated random MAC address 0a:90:77:c7:1d:f3  [ 6591.461683] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5  [ 6591.659810] libphy: dsa slave smi: probed  [ 6591.674778] mt7628-esw 10110000.esw: nonfatal error -122 setting MTU on port 0  [ 6591.693746] mt7628-esw 10110000.esw lan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY] (irq=POLL)  [ 6591.728356] mt7628-esw 10110000.esw: configuring for fixed/mii link mode  [ 6591.736381] DSA: tree 0 setup  [ 6591.751095] mt7628-esw 10110000.esw: Link is Up - 100Mbps/Full - flow control off  [ 6595.094324] mt7628-esw 10110000.esw: port 0 link changed 0x1  # ip a  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00      inet 127.0.0.1/8 scope host lo         valid_lft forever preferred_lft forever  3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000      link/ether b8:d8:12:64:b9:a0 brd ff:ff:ff:ff:ff:ff      inet 192.168.7.130/24 brd 192.168.7.255 scope global noprefixroute wlan0         valid_lft forever preferred_lft forever  4: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000      link/ether 0a:90:77:c7:1d:f3 brd ff:ff:ff:ff:ff:ff  5: lan@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop qlen 1000      link/ether 0a:90:77:c7:1d:f3 brd ff:ff:ff:ff:ff:ff  

This gives me two devices: the expected eth0, an unexpected lan@eth0 but still no connection. This is right because I have no DHCP client running (WiFi is handled separately by IWD).

Starting the DHCP client gives me connection:

# dhcpcd -b eth0  dhcpcd-9.4.0 starting  sandbox unavailable: seccomp  DUID 00:01:00:01:c7:92:bc:8f:b8:d8:12:64:b9:a2  dhcp_vendor: No such process  sandbox unavailable: seccomp  forked to background, child pid 850  [ 6671.439622] mtk_soc_eth 10100000.ethernet eth0: configuring for fixed/mii link mode  [ 6671.447753] mtk_soc_eth 10100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx  # ip a  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00      inet 127.0.0.1/8 scope host lo         valid_lft forever preferred_lft forever  3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000      link/ether b8:d8:12:64:b9:a0 brd ff:ff:ff:ff:ff:ff      inet 192.168.7.130/24 brd 192.168.7.255 scope global noprefixroute wlan0         valid_lft forever preferred_lft forever  5: lan@if4: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop qlen 1000      link/ether 0a:90:77:c7:1d:f3 brd ff:ff:ff:ff:ff:ff  6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000      link/ether 9a:cf:60:d9:2e:a1 brd ff:ff:ff:ff:ff:ff      inet 192.168.7.106/24 brd 192.168.7.255 scope global dynamic noprefixroute eth0         valid_lft 43191sec preferred_lft 37791sec  

Notice only "standard" eth0 actually gets an IP address and "auxiliary" interface changed name lan@eth0 -> lan@if4.

What is this second "device"? What is its purpose and how am I supposed to use it (IFF I'm supposed to use it). Notice also bringing down eth0 actually seems to act on "auxiliary" device:

# ip l set eth0 down  [ 8558.176702] mtk_soc_eth 10100000.ethernet eth0: Link is Down  # ip a  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00      inet 127.0.0.1/8 scope host lo         valid_lft forever preferred_lft forever  3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000      link/ether b8:d8:12:64:b9:a0 brd ff:ff:ff:ff:ff:ff      inet 192.168.7.130/24 brd 192.168.7.255 scope global noprefixroute wlan0         valid_lft forever preferred_lft forever  5: lan@if4: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop qlen 1000      link/ether 0a:90:77:c7:1d:f3 brd ff:ff:ff:ff:ff:ff  6: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast qlen 1000  

Attempt to remove the mtk-eth module results in Kernel error:

# rmmod mtk-eth  [ 6634.791361] ------------[ cut here ]------------  [ 6634.796077] WARNING: CPU: 0 PID: 841 at drivers/net/phy/phylink.c:1151 0x80302674  [ 6634.809938] RTNL: assertion failed at drivers/net/phy/phylink.c (1151)  [ 6634.819931] Modules linked in: mtk_eth(-) des_generic libdes cbc ecb algif_skcipher hmac sha512_generic sha1_generic md5 md4 algif_hash af_alg mt7603e mt76 mac80211 sha256_generic libsha256 ehci_platform ohci_platform ohci_hcd ehci_hcd cfg80211 rfkill usbcore libarc4 usb_common  [ 6634.848585] CPU: 0 PID: 841 Comm: rmmod Not tainted 5.8.0 #2  [ 6634.857694] Stack : 80450000 80410e8c 804493fc 864d1d24 00000000 00000000 00000000 00000000  [ 6634.869806]         00000000 00000000 00000000 00000000 00000000 00000001 864d1cd0 80490000  [ 6634.881851]         864d1d68 00000000 00000000 ffff00fe 00000038 8025e724 00000006 876d5e58  [ 6634.890364]         7fca7028 7fca706c 7fca7070 7fca7074 8041e310 80490000 80000000 00000009  [ 6634.905154]         80467cc0 7fc3e284 00420000 004f0950 80495220 32cc152e 08072098 80500000  [ 6634.917055]         ...  [ 6634.919556] Call Trace:  [ 6634.919579] [<8025e724>] 0x8025e724  [ 6634.931103] [<8000abf4>] 0x8000abf4  [ 6634.934661] [<8000abfc>] 0x8000abfc  [ 6634.938196] [<8001d990>] 0x8001d990  [ 6634.955157] [<80302674>] 0x80302674  [ 6634.958716] [<80302674>] 0x80302674  [ 6634.968796] [<80302674>] 0x80302674  [ 6634.975843] [<8001da04>] 0x8001da04  [ 6634.979408] [<80302674>] 0x80302674  [ 6634.989141] [<80158110>] 0x80158110  [ 6634.996066] [<c00b10c4>] 0xc00b10c4  [ 6634.999625] [<c00b12c4>] 0xc00b12c4  [ 6635.009387] [<802c9c5c>] 0x802c9c5c  [ 6635.016419] [<802c991c>] 0x802c991c  [ 6635.019974] [<802c9dc0>] 0x802c9dc0  [ 6635.029705] [<802c86e0>] 0x802c86e0  [ 6635.036620] [<8007849c>] 0x8007849c  [ 6635.040176] [<800bc5a4>] 0x800bc5a4  [ 6635.049933] [<8002ec50>] 0x8002ec50  [ 6635.056920] [<8000f14c>] 0x8000f14c  [ 6635.060492]   [ 6635.068472] ---[ end trace a60217f8a7ca79c8 ]---  [ 6635.076697] ------------[ cut here ]------------  [ 6635.084835] WARNING: CPU: 0 PID: 841 at drivers/net/phy/phylink.c:1030 0x80301a4c  [ 6635.095828] RTNL: assertion failed at drivers/net/phy/phylink.c (1030)  [ 6635.105831] Modules linked in: mtk_eth(-) des_generic libdes cbc ecb algif_skcipher hmac sha512_generic sha1_generic md5 md4 algif_hash af_alg mt7603e mt76 mac80211 sha256_generic libsha256 ehci_platform ohci_platform ohci_hcd ehci_hcd cfg80211 rfkill usbcore libarc4 usb_common  [ 6635.134359] CPU: 0 PID: 841 Comm: rmmod Tainted: G        W         5.8.0 #2  [ 6635.145331] Stack : 80450000 80410e80 804493fc 864d1d14 00000000 00000000 00000000 00000000  [ 6635.157222]         00000000 00000000 00000000 00000000 00000000 00000001 864d1cc0 80490000  [ 6635.169427]         864d1d58 00000000 00000000 ffff00fe 00000038 8025e724 00000006 876d5e58  [ 6635.181471]         7fca7028 7fca706c 7fca7070 7fca7074 8041e310 80490000 80000000 00000009  [ 6635.190097]         80467cc0 0000007c 00420000 004f0950 80495220 32cc152e 08072098 80500000  [ 6635.204965]         ...  [ 6635.207470] Call Trace:  [ 6635.207493] [<8025e724>] 0x8025e724  [ 6635.221955] [<8000abf4>] 0x8000abf4  [ 6635.225509] [<8000abfc>] 0x8000abfc  [ 6635.229045] [<8001d990>] 0x8001d990  [ 6635.241166] [<80301a4c>] 0x80301a4c  [ 6635.244725] [<80301a4c>] 0x80301a4c  [ 6635.248258] [<80301a4c>] 0x80301a4c  [ 6635.262154] [<8001da04>] 0x8001da04  [ 6635.265718] [<c00af0c0>] 0xc00af0c0  [ 6635.269251] [<80406134>] 0x80406134  [ 6635.282048] [<80301a4c>] 0x80301a4c  [ 6635.285608] [<80302690>] 0x80302690  [ 6635.289142] [<80158110>] 0x80158110  [ 6635.301514] [<c00b1120>] 0xc00b1120  [ 6635.305074] [<c00b12c4>] 0xc00b12c4  [ 6635.308611] [<802c9c5c>] 0x802c9c5c  [ 6635.321116] [<802c991c>] 0x802c991c  [ 6635.324673] [<802c9dc0>] 0x802c9dc0  [ 6635.328209] [<802c86e0>] 0x802c86e0  [ 6635.341418] [<8007849c>] 0x8007849c  [ 6635.344976] [<800bc5a4>] 0x800bc5a4  [ 6635.348511] [<8002ec50>] 0x8002ec50  [ 6635.361159] [<8000f14c>] 0x8000f14c  [ 6635.364729]   [ 6635.366243] ---[ end trace a60217f8a7ca79c9 ]---  [ 6635.380166] ------------[ cut here ]------------  [ 6635.385575] WARNING: CPU: 0 PID: 841 at lib/refcount.c:28 0xc00b1258  [ 6635.397959] refcount_t: underflow; use-after-free.  [ 6635.406183] Modules linked in: mtk_eth(-) des_generic libdes cbc ecb algif_skcipher hmac sha512_generic sha1_generic md5 md4 algif_hash af_alg mt7603e mt76 mac80211 sha256_generic libsha256 ehci_platform ohci_platform ohci_hcd ehci_hcd cfg80211 rfkill usbcore libarc4 usb_common  [ 6635.434814] CPU: 0 PID: 841 Comm: rmmod Tainted: G        W         5.8.0 #2  [ 6635.445430] Stack : 80450000 80410e80 804493fc 864d1d44 00000000 00000000 00000000 00000000  [ 6635.457327]         00000000 00000000 00000000 00000000 00000000 00000001 864d1cf0 80490000  [ 6635.469233]         864d1d88 00000000 00000000 ffff00fe 00000038 8025e724 00000006 876d5e58  [ 6635.481410]         7fca7028 7fca706c 7fca7070 7fca7074 8041e310 80490000 80000000 00000009  [ 6635.489923]         8043f744 0000007c 00420000 004f0950 80495220 32cc152e 08072098 80500000  [ 6635.504762]         ...  [ 6635.507267] Call Trace:  [ 6635.507290] [<8025e724>] 0x8025e724  [ 6635.521960] [<8000abf4>] 0x8000abf4  [ 6635.525515] [<8000abfc>] 0x8000abfc  [ 6635.529050] [<8001d990>] 0x8001d990  [ 6635.541211] [<c00b1258>] 0xc00b1258  [ 6635.544767] [<c00b1258>] 0xc00b1258  [ 6635.548302] [<c00b1258>] 0xc00b1258  [ 6635.562011] [<8001da04>] 0x8001da04  [ 6635.565574] [<c00af0c0>] 0xc00af0c0  [ 6635.569108] [<80406134>] 0x80406134  [ 6635.579120] [<c00b1258>] 0xc00b1258  [ 6635.588795] [<c00b12c4>] 0xc00b12c4  [ 6635.593036] [<802c9c5c>] 0x802c9c5c  [ 6635.596590] [<802c991c>] 0x802c991c  [ 6635.600126] [<802c9dc0>] 0x802c9dc0  [ 6635.615364] [<802c86e0>] 0x802c86e0  [ 6635.618920] [<8007849c>] 0x8007849c  [ 6635.628652] [<800bc5a4>] 0x800bc5a4  [ 6635.635599] [<8002ec50>] 0x8002ec50  [ 6635.639157] [<8000f14c>] 0x8000f14c  [ 6635.649356]   [ 6635.650891] ---[ end trace a60217f8a7ca79ca ]---  

but system seems functional and even Ethernet works (if I reload the module).

I would like to understand a bit better what's really happening.

Documentation pointers and explanations welcome.

open with ... causes one program to appear multiple times

Posted: 03 May 2022 12:55 PM PDT

I have a: fresh installation of Linux mint 20 cinnamon a week ago (luv it)
and i have 3d ays ago installed okular for pdfs.

My Problem: when i want to open a file, that is unknown to the system with open with...
then i get the weird behavior of many okular's to choose from. Please see picture below: Many Okulars popping up

I installed okular from the standard 'Software Manager' it is version 4:19.12.3-2ubuntu1. Found out it is a KDE Graphic Module. And I looked up odd behavior of open with...

My question: How can I only show one okular in the choose Program tray of open with... ?

I want:

Okular to appear only once in the "Open with..."- list.

I think the okular options are getting more (kind of funny).
Thanks in advance

Failed to show the preferences dialog GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown

Posted: 03 May 2022 11:09 AM PDT

I'm encountering issue with USB Live persistence Kali linux. I've installed it correctly and everything works fine initially. But after running it, the upper panel sometimes disappears. When opening the panel from Application->Setting->Panel, I encounter the following error:

Failed to show the preferences dialog  GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown:  The name org.xfce.Panel was not provided by any .service files  

SSH Fails at "kex_exchange_identification"

Posted: 03 May 2022 09:15 AM PDT

I'm trying to connect over ssh to an Ubuntu 18.04 VM running in VMWare on my local machine. Local machine has openssh server up and running.

Apple's default ssh binary fails connecting to VMs in VMWare as documented here. So, I installed ssh with homebrew and am attempting to use that instead.

On running ssh, it fails to connect and spits out the error:

kex_exchange_identification: write: Broken pipe  

Running with verbose flags shows the following:

$ /usr/local/bin/ssh -vvv dev@[ip]  OpenSSH_8.0p1, OpenSSL 1.1.1d  10 Sep 2019  debug1: Reading configuration data /Users/[username]/.ssh/config  debug1: /Users/[username]/.ssh/config line 1: Applying options for *  debug1: /Users/[username]/.ssh/config line 8: Applying options for *  debug1: /Users/[username]/.ssh/config line 11: Ignored unknown option "usekeychain"  debug1: Reading configuration data /usr/local/etc/ssh/ssh_config  debug2: resolve_canonicalize: hostname [ip] is address  debug2: ssh_connect_direct  debug1: Connecting to [ip] port 22.  debug1: Connection established.  debug1: getpeername failed: Invalid argument  debug1: identity file /Users/[username]/.ssh/id_rsa type 0  debug1: identity file /Users/[username]/.ssh/id_rsa-cert type -1  kex_exchange_identification: write: Broken pipe  

My ~/.ssh/config file contains the following:

Host *      ServerAliveInterval 300      ServerAliveCountMax 2      TCPKeepAlive no      IPQoS=throughput      AddKeysToAgent yes      IgnoreUnknown UseKeychain      UseKeychain yes      IdentityFile ~/.ssh/id_rsa  

I've tried restarting the ssh server on the VM to no avail. I haven't been able to find any information about the kex_exchange_identification error online.

Thanks for any and all help!

Ubuntu 18.04 VM in emergency/maintenance mode due to failed corrupted raided disk

Posted: 03 May 2022 12:29 PM PDT

I have a VM which has an attached raided device with fstab entry:

/dev/md127 /mnt/blah ext4 nofail 0 2  

The raided disks are corrupted and during startup the unit entered emergency/maintence mode, which means only the local host user could exit this mode and start it up normally. During normal startup the following occurred in syslog:

systemd-fsck[1272]: /dev/md127 contains a file system with errors, check forced.  systemd-fsck[1272]: /dev/md127: Inodes that were part of a corrupted orphan linked list found.  systemd-fsck[1272]: /dev/md127: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.  systemd-fsck[1272]: #011(i.e., without -a or -p options)  systemd-fsck[1272]: fsck failed with exit status 4.  systemd-fsck[1272]: Running request emergency.target/start/replace  systemd[1]: systemd-fsck@dev-md127.service: Main process exited, code=exited, status=1/FAILURE  systemd[1]: systemd-fsck@dev-md127.service: Failed with result 'exit-code'.  systemd[1]: Failed to start File System Check on /dev/md127.  systemd[1]: Dependency failed for /mnt/blah.  systemd[1]: Dependency failed for Provisioner client daemon.  

My guess is that the OS goes to emergency/maintenance mode because of the corrupt raided disks:

systemctl --state=failed    UNIT                           LOAD   ACTIVE SUB    DESCRIPTION                                              ● systemd-fsck@dev-md127.service loaded failed failed File System Check on /dev/md127  

What i want is for the VM to startup regardless of whether the raided drives are corrupt/unmountable, so it shouldn't go to emergency/maintenance mode. I followed these posts to attempt at disabling emergency/maintenance mode:

I had to first create the directory local-fs.target.d in /etc/systemd/system/, which felt wrong. I then created a nofail.conf in /etc/systemd/system/local-fs.target.d/nofail.conf containing:

[Unit]  OnFailure=  

After loading that drop file, I was able to confirm that the drop file was found by local-fs.target:

sudo systemctl status local-fs.target   ● local-fs.target - Local File Systems     Loaded: loaded (/lib/systemd/system/local-fs.target; static; vendor preset: enabled)    Drop-In: /etc/systemd/system/local-fs.target.d             └─nofail.conf     Active: active since Tue 2019-01-08 12:36:41 UTC; 3h 55min ago       Docs: man:systemd.special(7)  

BUT, after rebooting, the VM still ended up in emergency/maintenance mode. Have i missed something? Does the nofail.conf solution not work with raided disks?


EDIT: I was able to get a print out of the logs when the system booted to emergency mode (sorry it's a screenshot since i don't have access to the host and had to ask the owner for it):

enter image description here

Here's the output from systemctl for systemd-fsck@dev-md127:

 sudo systemctl status --no-pager --full systemd-fsck@dev-md127   ● systemd-fsck@dev-md127.service - File System Check on /dev/md127      Loaded: loaded (/lib/systemd/system/systemd-fsck@.service; static; vendor preset: enabled)      Active: failed (Result: exit-code) since Thu 2019-01-10 12:05:44 UTC; 2h 57min ago        Docs: man:systemd-fsck@.service(8)     Process: 1025 ExecStart=/lib/systemd/systemd-fsck /dev/md127 (code=exited, status=1/FAILURE)    Main PID: 1025 (code=exited, status=1/FAILURE)     systemd[1]: Starting File System Check on /dev/md127...   systemd-fsck[1025]: /dev/md127 contains a file system with errors, check forced.   systemd-fsck[1025]: /dev/md127: Inodes that were part of a corrupted orphan linked list found.   systemd-fsck[1025]: /dev/md127: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.   systemd-fsck[1025]:         (i.e., without -a or -p options)   systemd-fsck[1025]: fsck failed with exit status 4.   systemd-fsck[1025]: Running request emergency.target/start/replace   systemd[1]: systemd-fsck@dev-md127.service: Main process exited, code=exited, status=1/FAILURE   systemd[1]: systemd-fsck@dev-md127.service: Failed with result 'exit-code'.   systemd[1]: Failed to start File System Check on /dev/md127.  

As i pointed out earlier, i have nofail set in /etc/fstab. Now the questions are:

  1. What is the dependency in the failed dependency in the screenshot?
  2. If fsck fails on /dev/md127, why does it enter emergency mode and how do i disable that?

EDIT 2:

A couple of other things i can add are:

  1. the vm is a kvm vm
  2. it's a software raid

Kind regards, Ankur

How do I modify my conda env variable in my terminal prompt?

Posted: 03 May 2022 09:46 AM PDT

I would like to customize my terminal prompt. Normally when a conda environment is activated the name of the environment is prepended to the PS1 string. I would like to customize this a bit more but have not been able to figure it out.

If I add changeps1: false to my .condarc file the terminal prompt is not modified when I activate a new environment. I can then modify the environment variable in my .bash_profile for example:

PS1+="\[${cyan}\]<$(basename $CONDA_DEFAULT_ENV)> ";

This returns the name of the environment colored how I would like surrounded by carrots, however this only works after I run source .bash_profile activating the environment has no effect, which is not unexpected.

My question is how to I update the prompt when activating the environment, or is there a better way of go about this?

This is related to this question

And this example profile However those do not directly address the issue that I am running into of the prompt not changing when activating environments

Show keyboard layout on XFCE

Posted: 03 May 2022 11:06 AM PDT

How to show the GUI of keyboard layout on XFCE? like Gmome or MATE (see the picture)

enter image description here

How can I test if nginx configuration files are valid within a Bash script?

Posted: 03 May 2022 12:39 PM PDT

  • Ubuntu 16.04
  • Bash version 4.4.0
  • nginx version: nginx/1.14.0

How can I test the Nginx configuration files in a Bash script? At the moment I use -t when I'm in a shell:

$ sudo nginx -t  nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  nginx: configuration file /etc/nginx/nginx.conf test is successful  

But I would like to do this in a script?

What is the `-KILL` option in `pkill` command

Posted: 03 May 2022 09:14 AM PDT

I have found a way to logout any user by using the command line. By executing the command pkill -KILL -u <username>, I can now log myself out from the session I have entered.
My question is that why there is no description about -KILL switch or option available neither in man pkill nor in pkill --help.
I am using Ubuntu Mate 16.04. Thanck you very much in advance.

Copy between tmux sessions without including line numbers

Posted: 03 May 2022 11:01 AM PDT

When I try to copy and paste between tmux sessions or windows, one problem is that I usually have line numbers displayed when using Vim and tmux copies the line numbers:enter image description here

Is there any way to avoid this?

How to export and migrate NetworkManager settings to new system?

Posted: 03 May 2022 09:24 AM PDT

How to export and migrate NetworkManager settings to new system?

Use cases are:

  • reinstalling a machine
  • moving network configuration from laptop to desktop system (or vice-versa)

All settings should be migrated, that includes:

  • default and custom network connections
  • wifi connections with passwords
  • VLAN configurations
  • VPN configurations (with keys if possible)

I checked on Arch wiki and it there is nothing on migration, so I'm asking you guys and gals here.

su -l root permission denied

Posted: 03 May 2022 12:00 PM PDT

I have centos7 as a virtual box on windows 7. Besides root, I created another user "john" during that time. Some time later, I forgot my root password and reset it my going to single user prompt. Since then whenever I login as "john" I am not able to do su -l root. I get permission denied. I logged in as root and changed sudoer file with the following:

root ALL=(ALL) ALL  admin ALL=/bin/su  Defaults: admin rootpw  john ALL=(ALL) ALL  

I then added john to wheel group and updated /etc/pam.d/su with:

auth required pam_wheel.so use_uid  

Also,I am not able to do su -l john when I am logged in as "root". Any help here is appreciated.

/var/log/secure shows:

Mar 6 .... localhost su: PAM(other) no module name supplied  Mar 6 .....localhost su: PAM(other) illegal module type: @include  Mar 6 .....localhost su: PAM pam_parse: expecting return value: [...common-session]  

Manny

Rewrapping the passphrase makes encryption disappear

Posted: 03 May 2022 10:01 AM PDT

I was exploring the possibility of changing the login password of ecryptfs. In this system (Ubuntu 14.04 LTS) the login password for ecryptfs and that for the Linux user are the same. My ecryptfs-utils is version 104-0ubuntu1.14.04.4.

Admittedly, I always found the terminology password/passphrase used in ecryptfs-related pieces a bit confusing. I took some courage from this post on Ask Ubuntu where 'rewrapping' is suggested. To that end, I did run the command ecryptfs-rewrap-passphrase /home/.ecryptfs/$USER/.ecryptfs/wrapped-passphrase. There I was presented with the typical sequence of Old wrapping passphrase + New wrapping passphrase + New wrapping passphrase (again).

Whatever the 'wrapping passphrase' may mean, I thought to be playing safe by typing in the login password for all three questions. The thinking was 'Is that wrong? It'll protest. Is that right? It won't change anything'.

I then got the error

Error: Unwrapping passphrase failed [-2]  Info: Check the system log for more information from libecryptfs  

and the encryption has disappeared!

For example, launching ecryptfs-unwrap-passphrase gives stat: No such file or directory. Effectively, ~\.ecryptfs and ~\.Private are now dangling symlinks. The target location /home/.ecryptfs/user/.ecryptfs is gone.

I also fear problems upon rebooting because the GUI may be looking for an encrypted directory, a problem that I am raising elsewhere on AskUbuntu, though that is not because of my doing. (Addition: after rebooting and a couple of dialogue windows about system issues to report, I could gain access to the GUI again.)

What are the possibilities to restore encryption (with ecryptfs) in this situation?

Kali Linux: cannot login to desktop

Posted: 03 May 2022 10:05 AM PDT

I was running Kali Linux 2.0 Sansa. I did the Kali Linux apt-get update && apt-get upgrade

To upgrade to Kali 2.0 rolling edition now I cannot log in The user name and password still work because if I do Ctrl+alt+f3. They work on the command line.

But in GUI it just loop over and over, keeps on asking for user name and password.

Where is the .xsession file in linux mint?

Posted: 03 May 2022 09:05 AM PDT

I would like to know how I can use start up scripts in .xsession in order to change the look of my Desktop, I assumed .xsession was in my home directory so I performed at my home directory: ls -a to list all the hidden files, that start with a dot, but there was no .xsession file. So, I searched the whole file system beginning from the root with:

ls -Ra / | grep .xsession  

but unfortunately it did not find this .xsession file either.

Have backticks (i.e. `cmd`) in *sh shells been deprecated?

Posted: 03 May 2022 10:53 AM PDT

I've seen this comment many times on Unix & Linux as well as on other sites that use the phrasing "backticks have been deprecated", with respect to shells such as Bash & Zsh.

Is this statement true or false?

No comments:

Post a Comment