Monday, March 29, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


can't shutdown or reboot because 'User user2 is logged in on tty2'; but nobody is logged in on tty2

Posted: 29 Mar 2021 01:50 PM PDT

When, as user1 I try to shutdown now or reboot. i get the following message along with an error code 1:

User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  User user2 is logged in on tty2.  Please retry operation after closing inhibitors and logging out other users.  

however user2 had logged-in on tty2 and logged-out about an hour back. Why then am I getting the above message? What could be causing this and how do I rectify it?

I can't see where is all of my disk memory

Posted: 29 Mar 2021 01:47 PM PDT

I have a disk partition where the Linux/Ubuntu system is installed. It was orginally made to posses 254 GB, but currently it's just 194 GB. I've got no idea what have happened recently that I can't see all of it now. I suspect that is has something with using docker recently or external hard drive, because I recently change name of it and I don't know why but my system started to iterating new External Disk whit each system restart and hold in folder /home/media. Anyway I should somehow check where is all the left memory or the disk analyzer doesn't see all folders and I don't know how to run it as root. To illustrate the problem these are screen shots: enter image description here

What is wrong with my udev rule?

Posted: 29 Mar 2021 01:43 PM PDT

I want to execute a script on connecting a specific keyboard. Here's my attempt and the data I've gathered.

After cooking it down, this is the minimal problem I am still having:

/etc/udev/rules.d/99-kinesis-testing-high-number.rules:

ACTION=="add", RUN+="/bin/sh -c '/bin/echo UDEV > /tmp/layout_kinesis.log'"  

Reload and trigger:

 sudo udevadm control --reload-rules && sudo udevadm trigger  

Nothing happens in the file /tmp/layout_kinesis.log upon connecting a USB device.

What is wrong with this minimal rule?

Ubuntu 20.04.

Below are details of how I got there:


lsusb gives me Bus and Device (002 and 048):

$ lsusb  Bus 002 Device 008: ID 046d:c52b Logitech, Inc. Unifying Receiver  Bus 002 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)  Bus 002 Device 010: ID 045e:0b12 Microsoft Corp.   Bus 002 Device 048: ID 05f3:0007 PI Engineering, Inc. Kinesis Advantage PRO MPC/USB Keyboard  Bus 002 Device 047: ID 05f3:0081 PI Engineering, Inc. Kinesis Integrated Hub  

From there, udevadm gives me attributes:

$ sudo udevadm info --attribute-walk /dev/bus/usb/002/048    Udevadm info starts with the device specified by the devpath and then  walks up the chain of parent devices. It prints for every device  found, all possible attributes in the udev rules key format.  A rule to match, can be composed by the attributes of the device  and the attributes from one single parent device.      looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1.2':      KERNEL=="2-1.1.2"      SUBSYSTEM=="usb"      DRIVER=="usb"      ATTR{devpath}=="1.1.2"      ATTR{bcdDevice}=="0320"      ATTR{devnum}=="48"      ATTR{bMaxPower}=="64mA"      ATTR{bMaxPacketSize0}=="8"      ATTR{quirks}=="0x0"      ATTR{tx_lanes}=="1"      ATTR{bNumInterfaces}==" 2"      ATTR{idProduct}=="0007"      ATTR{speed}=="12"      ATTR{bConfigurationValue}=="1"      ATTR{configuration}==""      ATTR{busnum}=="2"      ATTR{bDeviceClass}=="00"      ATTR{maxchild}=="0"      ATTR{bNumConfigurations}=="1"      ATTR{idVendor}=="05f3"      ATTR{ltm_capable}=="no"      ATTR{bDeviceSubClass}=="00"      ATTR{avoid_reset_quirk}=="0"      ATTR{bmAttributes}=="a0"      ATTR{urbnum}=="427"      ATTR{bDeviceProtocol}=="00"      ATTR{removable}=="fixed"      ATTR{version}==" 1.10"      ATTR{rx_lanes}=="1"      ATTR{authorized}=="1"      looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1':      KERNELS=="2-1.1"      SUBSYSTEMS=="usb"  ...  

And so, my resulting udev rule in /etc/udev/rules.c/90-kinesis-advantage.rules:

SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="05f3", ATTR{idProduct}=="0007", RUN+="/bin/echo aaa >> /tmp/layout_kinesis.log"  

Then reload the rules:

$ sudo udevadm control --reload-rules && sudo udevadm trigger  

And monitor the output file:

$ tail -f /tmp/layout_kinesis.log  

But disconnecting and reconnecting the keyboard gives no reaction.


I've tried matching the parent as well, but got no luck:

SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="05f3", RUN+="/bin/sh -c 'echo aaa >> /tmp/layout_kinesis.log'"  

Also tried to remove sh out and tried this, but nope: RUN+="/bin/echo aaa >> /tmp/layout_kinesis.log"


The last add entry in udevadm monitor -e is:

UDEV  [51347.305368] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2:1.1/0003:05F3:0007.003C/input/input112/event6 (input)  ACTION=add  DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2:1.1/0003:05F3:0007.003C/input/input112/event6  SUBSYSTEM=input  DEVNAME=/dev/input/event6  SEQNUM=26402  USEC_INITIALIZED=51347305171  ID_INPUT=1  ID_INPUT_KEY=1  ID_VENDOR=05f3  ID_VENDOR_ENC=05f3  ID_VENDOR_ID=05f3  ID_MODEL=0007  ID_MODEL_ENC=0007  ID_MODEL_ID=0007  ID_REVISION=0320  ID_SERIAL=05f3_0007  ID_TYPE=hid  ID_BUS=usb  ID_USB_INTERFACES=:030101:030000:  ID_USB_INTERFACE_NUM=01  ID_USB_DRIVER=usbhid  ID_PATH=pci-0000:00:1d.0-usb-0:1.1.2:1.1  ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_1_2_1_1  XKBMODEL=pc105  XKBLAYOUT=us  XKBVARIANT=  XKBOPTIONS=  BACKSPACE=guess  LIBINPUT_DEVICE_GROUP=3/5f3/7:usb-0000:00:1d.0-1.1  MAJOR=13  MINOR=70  DEVLINKS=/dev/input/by-path/pci-0000:00:1d.0-usb-0:1.1.2:1.1-event /dev/input/by-id/usb-05f3_0007-event-if01  TAGS=:power-switch:  

So I tried this, because of some recollection I had:

ACTION=="add", ENV{ID_SERIAL}=="05f3_0007", RUN+="/bin/echo aaa >> /tmp/layout_kinesis.log"  

Still nothing.


udevadm test shows that run is populated, at least (this output with the ENV{ID_SERIAL} version just above):

$ udevadm test $(udevadm info -q path -n /dev/bus/usb/002/062)  # ... the end here:  Reading rules file: /etc/udev/rules.d/90-kinesis-advantage.rules  Reading rules file: /lib/udev/rules.d/90-libgpod.rules  Reading rules file: /lib/udev/rules.d/90-libinput-fuzz-override.rules  Reading rules file: /lib/udev/rules.d/90-nm-thunderbolt.rules  Reading rules file: /lib/udev/rules.d/90-pulseaudio.rules  Reading rules file: /lib/udev/rules.d/95-cd-devices.rules  Reading rules file: /lib/udev/rules.d/95-dm-notify.rules  Reading rules file: /lib/udev/rules.d/95-upower-csr.rules  Reading rules file: /lib/udev/rules.d/95-upower-hid.rules  Reading rules file: /lib/udev/rules.d/95-upower-hidpp.rules  Reading rules file: /lib/udev/rules.d/95-upower-wup.rules  Reading rules file: /lib/udev/rules.d/96-e2scrub.rules  Reading rules file: /lib/udev/rules.d/97-hid2hci.rules  Reading rules file: /lib/udev/rules.d/99-systemd.rules  Invalid inotify descriptor.  DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1.2  DEVNAME=/dev/bus/usb/002/062  DEVTYPE=usb_device  DRIVER=usb  PRODUCT=5f3/7/320  TYPE=0/0/0  BUSNUM=002  DEVNUM=062  MAJOR=189  MINOR=189  ACTION=add  SUBSYSTEM=usb  ID_VENDOR=05f3  ID_VENDOR_ENC=05f3  ID_VENDOR_ID=05f3  ID_MODEL=0007  ID_MODEL_ENC=0007  ID_MODEL_ID=0007  ID_REVISION=0320  ID_SERIAL=05f3_0007  ID_BUS=usb  ID_USB_INTERFACES=:030101:030000:  ID_VENDOR_FROM_DATABASE=PI Engineering, Inc.  ID_MODEL_FROM_DATABASE=Kinesis Advantage PRO MPC/USB Keyboard  ID_PATH=pci-0000:00:1d.0-usb-0:1.1.2  ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_1_2  USEC_INITIALIZED=51523126321  run: '/bin/echo aaa >> /tmp/layout_kinesis.log'  Unload module index  Unloaded link configuration context.  

Use of dpkg --print-architecture to control build in a makefile

Posted: 29 Mar 2021 01:19 PM PDT

I am trying to figure out some work around to use dpkg --print-architecturein a makefile. No responses to my previous query on gnustep, so I'll try again with my last failed work around. From everything that I have read, I would be led to believe that the following should work. But it doesn't and I suspect there is something really basic I am missing. It appears that TARGETS is never set. There are some messages to that effect, and they do not match up with what I believed was going on but was obviously mistaken about. Has anyone played with this?

CPU=`dpkg --print-architecture`    amd64_TARGETS = one two  arm64_TARGETS = two  armhf_TARGETS = one    define SET_TARGETS =   TARGETS   = $$($(1)_TARGETS)  endef    $(eval $(call SET_TARGETS,$(CPU)))    .PHONY: all  all: $(TARGETS)      echo all $(TARGETS)    one:      echo do one    two:      echo do two  

Postfix delivery problem, status=bounced (mail forwarding loop for jeff@example.com), is this the solution?

Posted: 29 Mar 2021 01:38 PM PDT

I think I've diagnosed a problem with my Postfix mail server, now I just need help implementing the fix.

I am a "league member" at a sports website with 11 other people and when someone makes a post on said website, it sends a notification email to all members. I have not received any of these emails for 2+ years now, so I decided to investigate and this is what I found.

The message in my mail.log is:

Mar 29 12:26:51 mymailserver postfix/pipe[12545]: 669553800406: to=<jeff@example.com>, relay=dovecot, delay=0.41, delays=0.35/0/0/0.06, dsn=5.4.6, status=bounced (mail forwarding loop for jeff@example.com)

So after a lot of searching and not much success, there are two obscure pages online that mention this behavior in my context.

  1. postfix.nabble.com

You mail is bounced because it contains a Delivered-To: header with the address of the recipient.

  1. howtoforge.com

In order to avoid the loop issue you have to enable in /etc/postfix/main.cf the following statement. header_checks = regexp:/etc/postfix/header_checks Then, add the following line in /etc/postfix/header_checks /^Delivered-To: .*/ IGNORE Then, rebuild the hash table and reload the postfix configuration: [snip]

So I temporarily changed my email address at the website in question to a throwaway gmail account and made a post on the website so I could see the headers, and they do appear to include an extra Delivered-To header before my Postfix has had a chance to add it's own, thus causing the forwarding loop. Headers here at pastebin.com, the extra header is on line 47.

First question, do you think the extra Delivered-To header is the reason for the mail forwarding loop?

If so, the article at howtoforge.com above has instructions for a fix, but I'm wondering if there is a better way? It seems a little hacky to me, and also seems like every guide online would include this info given it should be included on every installation.

The howtoforge.com fix would look like this in my environment:

# vim /etc/postfix/main.cf  > header_checks = regexp:/etc/postfix/header_checks    # vim /etc/postfix/header_checks  > /^Delivered-To: .*/ IGNORE    # postmap /etc/postfix/header_checks  # service postfix restart  # service postfix status  

If that's not the correct fix, I'd be open to any and all suggestions.

How to detect is specific command uses specific directory or not?

Posted: 29 Mar 2021 12:18 PM PDT

I want to detect is specific command uses specific directory or not.

I can detect all commands that use specific directory with this command:

dpkg-query -S DIRECTORY

But:

  • This command cannot detect args.
  • This command cannot detect specific command.

Redirect (.*)/ or (.*)/index.html to \1 (301)

Posted: 29 Mar 2021 12:17 PM PDT

I had URLs in my page such as http://example.com/foo/bar/index.html, which could also be referred to as http://example.com/foo/bar/.

I replaced that resource with http://example.com/foo/bar.html, but I don't want to expose the trailing ".html", so I'd like any of the above to be redirected (permanently; 301) to http://example.com/foo/bar, which is the most generic form of URL I know of.

But, those URLs might have trailing stuff such ass "#..." or "?..." which I want to keep.

And then I'd still like to be able to provide the resource differently (in some cases), so I then test different suffixes (I try the requested name literally, then the .html extension, then a dir of the same name, then fallback to the parent dir, then fallback to the home page).

I have the following in etc/nginx/conf.d/server.conf:

server  {  [...]      index     index.html      rewrite     ^(/.*)/(index\.html)?([#?].*)?$ $1$3 permanent;      try_files   ${uri} ${uri}.html ${uri}/ ${uri}/.. /index.html =404;  [...]  }  

What I'd expect:

<http://example.com/foo/bar>            200  <http://example.com/foo/bar.html>       200  <http://example.com/foo/bar/>           301 + redirection  <http://example.com/foo/bar/index.html> 301 + redirection  

What I'm getting:

<http://example.com/foo/bar>            200  <http://example.com/foo/bar.html>       200  <http://example.com/foo/bar/>           301 + curl hangs  <http://example.com/foo/bar/index.html> 301 + curl hangs  

For "bar/[index.html]", curl -iL hangs after printing 301 and the correct new Location.

How should I configure nginx to achieve the behavior I want?

Check if Docker Command Returns 0

Posted: 29 Mar 2021 11:38 AM PDT

I am working on a script to map all virtual nics (vethXXXXX) on the host to the containers the belong to. To do this I'm trying to cat all /sys/class/net/iflink and ifindex files in the container and match them to the values of the virtual nic's iflink and ifindex values. In other words:

cat /sys/class/net/vethabc/iflink equals container a /sys/class/net/eth0/if link

Here is what I have thus far

#!/bin/bash    containerId=""  app=""    declare -a containerApp  declare -a allVeths  declare -a allContainers    mapfile -t allContainers < <(docker container ls | awk 'NR>1 { print $1" "$2 }')  mapfile -t veth_array < <( ifconfig | awk -F ":" "/veth/ { print $1 }" )    for c in ${!allContainers[@]};  do      mapfile -t containerApp < <(echo "${allContainers[$c]}" | tr ' ' '\n')      i=0      while [ $i -lt ${#containerApp[@]} ];      do          containerId=${containerApp[$i]}          i=$((i+1))          app=${containerApp[$i]}          i=$((i+1))      done        printf '\n%s\t%s\n' "$containerId" "$app"        for d in $(docker container exec -it $containerId ls /sys/class/net);      do          if [ "$d" = "lo" ];          then              continue;          fi            printf '\t%s\t%s\n' "$containerId" "/sys/class/net/$d"        done  done  

For a container which has nic's the output will look like

f1e42e686ec4    hazelcast/hazelcast:3.12          f1e42e686ec4    /sys/class/net/eth0          f1e42e686ec4    /sys/class/net/eth1          f1e42e686ec4    /sys/class/net/lo  

but for those without, the output is

14d4dab83dea    traefik:1.7.10          14d4dab83dea    /sys/class/net/OCI          14d4dab83dea    /sys/class/net/runtime          14d4dab83dea    /sys/class/net/exec          14d4dab83dea    /sys/class/net/failed:          14d4dab83dea    /sys/class/net/exec          14d4dab83dea    /sys/class/net/failed:          14d4dab83dea    /sys/class/net/container_linux.go:367:          14d4dab83dea    /sys/class/net/starting          14d4dab83dea    /sys/class/net/container          14d4dab83dea    /sys/class/net/process          14d4dab83dea    /sys/class/net/caused:          14d4dab83dea    /sys/class/net/exec:          14d4dab83dea    /sys/class/net/"ls":          14d4dab83dea    /sys/class/net/executable          14d4dab83dea    /sys/class/net/file          14d4dab83dea    /sys/class/net/not          14d4dab83dea    /sys/class/net/found          14d4dab83dea    /sys/class/net/in          14d4dab83dea    /sys/class/net/$PATH:          14d4dab83dea    /sys/class/net/unknown  

I'm not sure how to check if $(docker container exec -it $containerId ls /sys/class/net) will return a list of directories or the error that the ls command cannot be found. I've tried adding an if statement and checking if the docker container exec command returns 0 but that resulted in

ce2fd006555e    portainer/agent:latest  vethlink.sh: line 27: [: too many arguments  

for every container tested.

any thought or suggestions are welcome

Call for a HereDoc inside a Bash Shell loop?

Posted: 29 Mar 2021 01:29 PM PDT

Regarding this post How to include python script inside a bash script , I get used to work with python HereDoc. However, I want to include that python HereDoc inside a for loop, and so, it needs to be idented but it does not seem to be recognized by Visual Studio starting in blue color from the first HereDoc. Also python is blank because it is not written yet, but I wanna know if it is possible to call for a HereDoc inside a Bash Shell Loop.

datarange=$(LC_ALL="POSIX" seq -f %.15g 0.5 0.25 5.5 | sed '/\./!s/$/.0/')   for i in $datarange  do      cp -r MovableFiles/mode-1 D$i      cp -r MovableFiles/mode-4 D$i      echo -n CWD:; /bin/pwd       cd $PBS_O_WORKDIR      echo -n CWD:; /bin/pwd       cd D$i      cd mode-1      echo -n CWD:; /bin/pwd       # changes input files for mode-1      python3 - << HERE            HERE        cd mode-4      echo -n CWD:; /bin/pwd       # changes input files for mode-4      python3 - << HERE              HERE  done  

What I want to do is a loop over the input files on "MovableFiles", moving them to directories D$i and changing a specific line on the fly (regarding the $i number), but I tend to do the text-change in Python3 so that's why I need a HereDoc or any other way to use Python3 inside a loop.

Debian buster upgrade renamed all interfaces to renameX

Posted: 29 Mar 2021 10:39 AM PDT

Prior to upgrade they were named like:

iface ens2f0  iface ens2f1  

from original install. Now they are like:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 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  2: rename2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000  link/ether 00:1e:67:7c:84:2b brd ff:ff:ff:ff:ff:ff  3: eno0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000  link/ether 00:1e:67:7c:84:2c brd ff:ff:ff:ff:ff:ff  4: rename4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000  link/ether 00:1e:67:7c:84:2d brd ff:ff:ff:ff:ff:ff  5: rename5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000  link/ether 00:1e:67:7c:84:2e brd ff:ff:ff:ff:ff:ff  

They are Intel gigabit I350 adapters, so from lshw I have:

           *-network:0 DISABLED              description: Ethernet interface              product: I350 Gigabit Network Connection              vendor: Intel Corporation              physical id: 0              bus info: pci@0000:02:00.0              logical name: rename2              version: 01              serial: 00:1e:67:7c:84:2b              size: 1Gbit/s              capacity: 1Gbit/s              width: 32 bits              clock: 33MHz              capabilities: pm msi msix pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation              configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.4.0-k duplex=full firmware=1.48, 0x800006e7 latency=0 link=no multicast=yes port=twisted pair speed=1Gbit/s              resources: irq:26 memory:d0960000-d097ffff ioport:2060(size=32) memory:d09b0000-d09b3fff memory:d0aa0000-d0abffff memory:d0a80000-d0a9ffff         *-network:1 DISABLED              description: Ethernet interface              product: I350 Gigabit Network Connection              vendor: Intel Corporation              physical id: 0.1              bus info: pci@0000:02:00.1              logical name: eno0              version: 01              serial: 00:1e:67:7c:84:2c              size: 1Gbit/s              capacity: 1Gbit/s              width: 32 bits              clock: 33MHz              capabilities: pm msi msix pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation              configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.4.0-k duplex=full firmware=1.48, 0x800006e7 latency=0 link=no multicast=yes port=twisted pair speed=1Gbit/s              resources: irq:39 memory:d0940000-d095ffff ioport:2040(size=32) memory:d09a0000-d09a3fff memory:d0a60000-d0a7ffff memory:d0a40000-d0a5ffff         *-network:2 DISABLED              ...  

I have installed firmware-linux-nonfree in case it was an firmware issue, but it worked fine on Debian Stretch. I don't understand how the logical names are/should be created here. I guess I could configure int rename2 as a static IP and just use it? Why is one named eno0 now? All four interfaces show disabled in lshw.

Make error(linux) [closed]

Posted: 29 Mar 2021 10:09 AM PDT

I start to install the WiFi driver:

tar -xvf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.bz2  cd DPO_MT7601U_LinuxSTA_3.0.0.4_20130913   sudo apt-get install build-essential linux-headers-generic  

When typing "make" the error is:

make -C tools  make[1]: Entering directory '/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools'  gcc -g bin2h.c -o bin2h  make[1]: Leaving directory '/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools'  /DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools/bin2h  cp -f os/linux/Makefile.6 /DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/Makefile  make -C /lib/modules/5.10.0-kali3-amd64/build SUBDIRS=/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux modules  make[1]: *** /lib/modules/5.10.0-kali3-amd64/build: No such file or directory.  Stop.  make: *** [Makefile:395: LINUX] Error 2  

When typing "make install" the error is:

make -C /DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux -f Makefile.6 install  make[1]: Entering directory '/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux'  rm -rf /etc/Wireless/RT2870STA  mkdir /etc/Wireless/RT2870STA  cp /DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/RT2870STA.dat /etc/Wireless/RT2870STA/.  install -d /lib/modules/5.10.0-kali3-amd64/kernel/drivers/net/wireless/  install -m 644 -c mt7601Usta.ko /lib/modules/5.10.0-kali3-amd64/kernel/drivers/net/wireless/  install: cannot stat 'mt7601Usta.ko': No such file or directory  make[1]: *** [Makefile.6:560: install] Error 1  make[1]: Leaving directory '/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux'  make: *** [Makefile:503: install] Error 2  

How to solve these errors, what to do?

What decides the password account to mount a disk?

Posted: 29 Mar 2021 01:15 PM PDT

I am running Debian on different machines (Debian Buster, same installation in all machines). I am using internal and external HDD. Some disks are encrypted others no.

When I mount a disk, some machines ask me for the user password to mount the disk (Sudoer account). Other machines ask me for the root/ Admin password (even if I am in a sudoer account). Even one machine asked me for another sudoer account's password (link). Some machines do not ask for password to mount the disk (only for the decryption password for encrypted disks).

Where is the configuration file where decides what account's password to use?

Editing text file via awk command

Posted: 29 Mar 2021 12:29 PM PDT

I am very newbie about on that command, so far I tried few things with that but I failed every time..

I have a text file (MWE) like below:

26 6 2020 09:06:23.300          277.430             50.131    20654.698008  26 6 2020 09:05:23.322          277.153             50.000    20493.667799  

What I want to do with this text file? Let me explain that!

  1. First of all, I want to re-arrange that file with respect to the date/month/year/hour/minute/second format. But all the other data related with the dates must be re-arranged again with respect to the dates. Is it possible to that via awk command?
  2. Second of all, I want to arrange the text file to see an output like that given below (basically I want to change blank lines with ';' character):
26;6;2020;09;05;23;277.153;50.000;20493.667799  26;6;2020;09;06;23;277.430;50.131;20654.698008  

It can be seen above also the timing delimiters has changed from ':' to ';' and .timing removed directly. Right now I am removing the split second via MS Excel (just copy+paste and edit). If there is also shorter way to do that I would love to learn!

Thanks in advance!

Best regards,

CD using GitLab, Bash script is not working

Posted: 29 Mar 2021 12:26 PM PDT

I am working with CI, CD but unfortunately I messed up with shell scripting. On my gitlab-ci.yml file I called a bashscript at the time on deploy. But unfortunately whenever I want to pull using the command the response is failed. For this bash script my response is

#!/bin/bash    # Get server list   set -f  string=$DEPLOY_SERVER_IP  array=(${string//,/ })    # Iterate servers for deploy and pull last commit   for i in "${!array[@]}"; do    echo "Deploy project on server ${array[i]}"    ssh bitnami@${array[i]} " ssh-agent bash && ssh-add keys/relation-fe && cd htdocs/relation-fe/ && git pull origin master "  done  

my response is something like this

Executing "step_script" stage of the job script  $ which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )  /usr/bin/ssh-agent  $ eval $(ssh-agent -s)  Agent pid 21206  $ mkdir -p ~/.ssh  $ echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa  $ chmod 600 ~/.ssh/id_rsa  $ [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config  $ bash .gitlab-deploy-prod.sh  Deploy project on server 1.2.3.4  Could not open a connection to your authentication agent.  Cleaning up file based variables  ERROR: Job failed: exit status 1  

SO how could I solve the error? the error shows that gitlab was successful to access my server but at the time of running the ssh-agent and adding the keys by ssh-key the script cannot execute the commands. Well error comes from here. I'm confused with the bash script and shell script thing. So I cannot figure out the error from my script. I was able to create a file on my git push but I cannot pull things after authenticating with the ssh-key can any one help me with this?

awk hostname and ip address from log files when the column numbers are different

Posted: 29 Mar 2021 01:49 PM PDT

This is my sample file. Actual data has way more data in it.

wolf@linux:~$ more log*  ::::::::::::::  log1.csv  ::::::::::::::  hostname,sn,type,ip,random  abc,a11,zzz,192.168.168.168,rrr  def,e16,yyy,192.168.168.169,fff  ghi,k16,yyy,192.168.168.170,ggg  ::::::::::::::  log2.csv  ::::::::::::::  hostname,sn,ip,random  abc,a11,192.168.168.168,rrr  def,e16,192.168.168.169,fff  ghi,k16,yyy,192.168.168.170,ggg  wolf@linux:~$   

Certain data such as hostname is always located in the 1st column. So, it's easy to get them with awk -F, '{print $1}'

wolf@linux:~$ awk -F, '{print $1, $4}' log*  hostname ip  abc 192.168.168.168  def 192.168.168.169  ghi 192.168.168.170  hostname random  abc rrr  def fff  ghi 192.168.168.170  wolf@linux:~$   

The problem is data such IP Address is located in different column depending on the data in the log files.

How do I use grep to get only column for hostname & IP?

wolf@linux:~$ awk -F, '/def/ {print $1, $4}' log*  def 192.168.168.169  def fff  wolf@linux:~$   

.

wolf@linux:~$ awk -F, '/def/ {print $1, $3}' log*  def yyy  def 192.168.168.169  wolf@linux:~$   

Desired Output

def 192.168.168.169  def 192.168.168.169  

FIFO number of processes,sustained growth

Posted: 29 Mar 2021 12:53 PM PDT

Excuse me,I have a fifo question,please help me thank you!

why the fifo thread_num limit 2 , but number of processes,sustained growth when one process end, two processes start,and then got 3 processes.

sustained growth 2n-1

#!bin/bash  #exec clear file  mkdir -p xxx  thread_num=2     [ ! -p tmp ] && mkfifo tmp  exec 9<>tmp     for ((i=0;i<$thread_num;i++)); do      echo >&9  done  echo "================start sh===================="  for i in  `cat shfiles.txt`;  do          read -u 9          {                                       sh $i                  mv $i xxx/                  echo >&9          } &  done  wait  exec 9>&-  rm tmp  echo "=================done===================="  exit 0  

The format of encrypted password in `/etc/shadow`

Posted: 29 Mar 2021 11:18 AM PDT

I see a hashed passphrase like the following in /etc/shadow. I don't quite understand its format.

$y$j9T$F5Jx5fExrKuPp53xLKQ..1$X3DX6M94c7o.9agCG9G317fhZg9SqC.5i5rd.RhAtQ7  

It is made of four parts as shown below. According to crypt(5), y means yescrypt.

https://manpages.debian.org/unstable/libcrypt-dev/crypt.5.en.html

- y  - j9T  - F5Jx5fExrKuPp53xLKQ..1  - X3DX6M94c7o.9agCG9G317fhZg9SqC.5i5rd.RhAtQ7  

What is the meaning of the last three parts?

streaming split/merge command?

Posted: 29 Mar 2021 01:47 PM PDT

Does a streaming version of split exist somewhere in Linux?

I'm trying to back up a large amount of data via SSH, but SSH's single threaded encryption is limiting the transfer. This machine doesn't have hardware AES support so I'm using ChaCha encryption, but the cpu is still not keeping up with the network.

So I thought I could solve this by splitting the data stream in two, and sending each over a separate SSH connection, and then merging the streams together at the destination. That way the encryption load can be shared over multiple cpu cores. This looked like a general enough idea that it should already exist, but I can't find it.

edit: for some numbers, I'm backing up data from an old computer, a few hundred GB over a gigiabit wired network. I'm copying an image from a partition, as that is faster than doing individual file access on the spinning rust drive, so technically it is random access data, but it is too large to treat it as such. I tried compressing it, but that doesn't help a lot. The data isn't very compressible.

So what I'm looking for is a split (and corresponding merge) that will split a stream of binary data into multiple streams (probably splitting by fixed chunks).

Poor I/O utilisation with rsync, RAID6 and ext4

Posted: 29 Mar 2021 11:07 AM PDT

I noticed poor I/O utilization when rsync'ing from an external HDD (connected with USB 3.0) to a RAID6 (4 HDDs) with ext4. iostat shows that reading from the USB HDD happens for most part at 110 MB/s (that's in line with specs). iostat also shows that for about 50% of the time, nothing is written to the RAID. At some point writing to the RAID starts and soon after reading from the USB HDD stops (0 MB/s). This goes on for a few seconds, then reading from the USB resumes and writing to the RAID stops. It seems like a write cache is blocking. How do I debug this issue?

System is Ubuntu 18.04, kernel 4.15.0-136-generic

Is there a way to get around linux gnu-screen stuff character limit?

Posted: 29 Mar 2021 10:19 AM PDT

I have a Minecraft server attached to a Screen in my linux server. I use Python to push data to the Minecraft server via Screen Stuff. I have noticed that if I put too many characters in screen stuff, it tends to not push the data into the screen.

For example, the following works just fine. It pushes the text to the Minecraft screen: screen -r Minecraft -p0 -X stuff 'Some random text etc etc, contents are not relevant ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^M'

Adding 100 or so more characters causes the contents to not be sent and no error messages are produced that I can tell: screen -r Minecraft -p0 -X stuff 'Some random text etc etc, contents are not relevant-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^M'

This seems to suggest there is a character limit within screen's stuff command. Assuming so, is there an alternative for this that would allow for more characters? I occasionally have extremely long commands to push to the screen that go above the 700-800ish character limit I am observing. Perhaps putting the text into a file and passing that along for the screen to run somehow?

Nvidia drivers won't work on linux mint

Posted: 29 Mar 2021 10:32 AM PDT

My nvidia drivers won't work. They worked just fine before my last update. I have been trying to get them to work again but with no success.

if I run:

nvidia-settings

I get this error:

ERROR: NVIDIA driver is not loaded

if I run:

nvidia-smi

I get this error:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

I tried to install the default drivers using: sudo ubuntu-drivers autoinstall, which installs the 390 version. However i read somewhere that this driver isn't compatible with the more up to date linux kernel.

Then i tried installing the ppa and a more updated nvidia driver (after purging the old nvidia packages)

sudo apt-get remove --purge '^nvidia-.*'  sudo add-apt-repository ppa:graphics-drivers/ppa  sudo apt-get install nvidia-driver-430  

But this won't work as well. I actually read that this drivers don't support my graphics card. Is there anything i can do to get my card working again?

My card is a GeForce GT 635M and am using Linux Mint Ulyssa

Is the "dpkg -L" command uisng "/var/lib/dpkg/info"?

Posted: 29 Mar 2021 12:09 PM PDT

When I explored the /var folder, I found the /var/lib/dpkg/info folder, which interested me.

I made a package with the name kgdeb, and I looked for a file that had the kgdeb name. I found it, and this file name was kgdeb.list. I looked at this file using Vim, and saw that it contained the output of the dpkg -L kgdeb command.

Now, I want to know: Is the dpkg -L command using /var/lib/dpkg/info?

Skip password prompt and pass password to ssh-add in script

Posted: 29 Mar 2021 11:17 AM PDT

I'm trying to write a script that automatically unlocks all of my rsa keys with ssh-add on Arch Linux.

I use pass to store my passwords (encrypted with gpg keys) and I'm trying to pass its input to ssh-add as follows:

rsa_dir=~/.ssh  cd $rsa_dir  ls -1 id_rsa* |  grep -v '.pub' |  while read file; do    # example: file == id_rsa_github -> keyname == rsa/github    key_name=${file/id_rsa_/rsa/}    # pass will prompt (only once) for the master password, then print out the request password to stdout    pass $key_name | ssh-add $file  done  

However, it gives an error:

ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory  

But if I just run ssh-add $file, it prompts for a password and works fine. I don't want to use the default ssh-askpass to get the password. I need to use my own script.

Can someone please help me?

Remove spaces till the end of each line for each line in a file

Posted: 29 Mar 2021 11:01 AM PDT

I am trying to remove the spaces from each line till the last word for each line in a file.

Example input file:

808 0    C01124       Amazon            45/234Birch         00             YYY  808 0    C01184       Flipkart          45/234Lotus         01             YYY  808 0    C01186       PrimeTime         45/23XCCCCH         08             YYY  808 0    C01125       DMART             5/23PPPPPPP         09             YYY  

The format is somewhat like the above, with uneven spaces and the last word always being 'YYY'. My requirement is: there are spaces after the YYY that I want to preserve, but I want to remove all the other spaces.

Desired output:

8080C01124Amazon45/234Birch00YYY  8080C01184Flipkart45/234Lotus01YYY  8080C01186PrimeTime45/23XCCCCH08YYY  8080C01125DMART5/23PPPPPPP09YYY  

I have tried using sed and tr commands, but it becomes a huge mess and all the lines become just one line. I want to segregate like above but I am not able to come to the requirement. How can I do it?

LibreOffice.org: Create new file from the command line

Posted: 29 Mar 2021 01:00 PM PDT

I love my command line. I love that I can type:

emacs non-existing-file.txt  

and then emacs will start editing a file, that does not exist yet, but if I save it, it will be called non-existing-file.txt.

I am also quite fond of LibreOffice.org, but I have been unable to find a way to do the same trick, as I can with emacs:

lowriter non-existing.odt  

will open LibreWriter, but it will not create the file. Instead it will complain that the file does not exist.

Is there a way that I from the command line can tell lowriter that I want to start a new file in this dir called non-existing.odt?

How to edit a text file without a text editor?

Posted: 29 Mar 2021 01:16 PM PDT

I found myself in a situation, where I needed to connect to a remote machine there were no text editors installed (no vi or nano).

The only way to edit text files is to use echo and cat.

Can you please share your experience, of how would you edit text files in such a situation? Perhaps there is a way to pipe a file to local vim.

Update: To clarify, the question is more just a theoretical case. A couple of times I had to debug pods in a k8 cluster with very minimal setup. So you may need to update some configs.

Ubuntu External Monitor Only Shows Mouse Cursor

Posted: 29 Mar 2021 11:04 AM PDT

I am new to Ubuntu and installed 18.04.04 as a dual boot with Windows 10 on an Alienware Laptop. When I connect it to an LG 34UM88 34" Ultrawide Monitor, I only see a black screen with the mouse cursor.

I tried installing drivers with: sudo ubuntu-drivers autoinstall but that didn't seem to fix it.

Any thoughts on what steps I might be able to take to configure this? When I contacted LG they said drivers should already be on Windows 10 -- but what about Ubuntu? It seems like the LG drivers might not be recognized, but I don't know how to make that happen.

thread dump of Java using Kill -3

Posted: 29 Mar 2021 01:01 PM PDT

I used to take thread dumps using:

kill -3 `pidof java`  

This will create thread dumps in catalina.out ; how to get those output to a file rather than in catalina.out. Usually kill command won't output it to stdout or stderr so we cannot get it from redirecting script to a log or using exec in at the begining; so is there any way to do it ?

Split tmux windows with same keys as in Emacs?

Posted: 29 Mar 2021 12:04 PM PDT

In emacs, you split a window with C-x 2 (one above the other) or C-x 3 (one next to the other).

How can I get the same key bindings in tmux?

Also, once a window is split, in emacs you cycle through them with C-x o. Can I configure tmux to use the same key?

No comments:

Post a Comment