Tuesday, March 8, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


extract and compare block of text

Posted: 08 Mar 2022 12:38 AM PST

I have a data gethered in one file organised in blocks

---- BLOCK ONE ----  some data  another data  more data  more data  -------------------    ---- BLOCK two ----  some data  another data  -------------------    ---- BLOCK THREE ----  some data  another data  more data  -------------------  

and so one. togethere around 2000 blocks.

I need to extract those blocks which have less then 4 entries (data lines). Any idea how to do it (perl prefered ; )

Cannot install network manager

Posted: 08 Mar 2022 12:35 AM PST

I am having problems installing network manager on Ubuntu 20.04.4 LTS focal. I installed something called snap network manager to restore connectivity but it is causing problems with emulator software I have. When I run: systemctl start NetworkManager I get an error Unit NetworkManager.service not found same for when using commands such as sudo systemctl stop network-manager. I tried installing it the classic way sudo apt-get install network manager but I get an error The following packages have unmet dependencies: network-manager: Depends: libnm0 (= 1.22.10-1ubuntu1) but 1.22.10-1ubuntu2.3 is to be installed ... Unable to correct problems, you have held broken packages admitdly I initially deleted network manager myself using the purge command, st**pid I know but I was trying to fix a different problem. Please help :)

16gb USB drive showing 115GB | Removable volume not mounted yet | Kali Linux

Posted: 08 Mar 2022 12:28 AM PST

I have a 16GB USBdrive but its showing now 115GB USB drive, I'm unable to access it. in desktop it has a icon with named

enter image description here

umount /dev/sdb1 shows not mounted yet

how to format and make this drive correct

df -hT not showing drive

fdisk -l showing drive

enter image description here

Thank You

No thumbnails in GNOME files on a Guix system

Posted: 07 Mar 2022 11:57 PM PST

GNOME Files (Nautilus) fails to generate thumbnails on an up-to-date Guix system, which is a known outstanding issue. Small empty files just go to ~/.cache/thumbnails/fail/gnome-thumbnail-factory. While this is being debugged and fixed, is there another way to browse files with thumbnails being displayed?

Install Yum/Dnf in a Virtualenv

Posted: 08 Mar 2022 12:06 AM PST

I've created a Virtualenv (with python3.6) and want to install yum/dnf package in that environment. Is there any way to do that? As import dnf or import yum giving me error in that environment -> ModuleNotFoundError: No module named 'dnf', ModuleNotFoundError: No module named 'yum' respectively.

Can no longer ssh after local OS update/reinstall: "no matching host key type found. Their offer: ssh-rsa,ssh-dss"

Posted: 07 Mar 2022 10:54 PM PST

There's a Linux server I ssh into. I needed to update my local Linux OS via a fresh OS reinstall. I saved my old ~/.ssh and copied it back. But now, when I try to ssh into the server, I get this:

"Unable to negotiate with [server's IP] port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss"

When I do "ssh -Q key", the result includes both "ssh-rsa" and "ssh-dss".

The server IS old and very possibly out-of-date, but I have no control over that.

How to delete such a file in linux

Posted: 07 Mar 2022 10:11 PM PST

How do I delete such a file,

1 '2 3' 4 5

in linux. None of the methods I've used have worked.

What's the difference between direct and indirect mounting using autofs?

Posted: 07 Mar 2022 08:44 PM PST

I know you have to use /- /etc/auto.name in /etc/auto.master.d/name.autofs for direct mounting and for indirect mounting you can just specify any mount point for example /name in .autofs file. Conceptually I don't understand the difference between two types of mounting.

Reply on same interface as incoming, but with dynamic IP addresses

Posted: 07 Mar 2022 07:45 PM PST

I have a system with two network interfaces, both of which are connected to the internet with different IP addresses. I would like responses to incoming requests to be sent over the same interface that they were received at.

The public IP addresses of my network interfaces change every 24 hours due to the nature of German internet providers. This is the main difference to the similar question Reply on same interface as incoming?, whose responses all rely on defining IP rules based on the IP address of the interface.

Can I configure an IP rule that will choose the routing table based on the interface rather than its IP address? Ideas that I have had so far but that I have not managed to apply successfully yet are to use the iif or oif options or to set an fwmark using iptables mangle.

Ansible modify the ansible configuration file through Playbook

Posted: 07 Mar 2022 07:34 PM PST

I want to modify the ansible configuration file through Playbook ,Will subsequent play make the configuration file effective

I get a different html page using Ctrl+u and curl

Posted: 08 Mar 2022 12:08 AM PST

When I go to a this web-page (https://imgur.com/user/Ultraruben/submitted for example) and press Ctrl+u, I get one web-page. When I try to extract the html through the command line with curl <url> or curl -L <url> I get another. lynx -dump <url> doesn't work either (no javascript).

I need to get through the command line (with whatever tool that works) the same I get through my browser with Ctrl+u.

This is what I got through the browser: https://justpaste.it/42ci1 And this is with curl: https://justpaste.it/9oy3g

Cannot umount /dev bind-mount

Posted: 08 Mar 2022 12:51 AM PST

I made a script which (tries to) duplicate my live disk /dev/sdb to a second disk /dev/sda, one rsync per partition (full script).

Last step is to install grub on /dev/sda. The method I use is something like :

  1. mount /dev/sda root partition on /mnt/root1
  2. bind-mount {/dev,/sys/,/proc} on /mnt/root1 :
# mount -o bind /sys  /mnt/root1/sys  # mount -o bind /proc /mnt/root1/proc  # mount -o bind /dev  /mnt/root1/dev  
  1. run chrooted update-grub and grub-install on /dev/sda :
chroot /mnt/root1 update-grub  chroot /mnt/root1 grub-install /dev/sda  
  1. umount the 3 bind-mounts :
# umount /mnt/root1/sys  # umount /mnt/root1/proc  # umount /mnt/root1/dev    

However, the /mnt/root1/dev umount fails :

# umount  /mnt/root1/dev   umount: /mnt/root1/dev: target is busy.  

Note: the mount command gives for /dev and /mnt/root1/dev :

udev on /dev type devtmpfs (rw,nosuid,relatime,size=8131896k,nr_inodes=2032974,mode=755,inode64)  udev on /mnt/root1/dev type devtmpfs (rw,nosuid,relatime,size=8131896k,nr_inodes=2032974,mode=755,inode64)  

My questions are : How is it a bind-mount can be busy ? Is there a workaround ?

Edit: I was able to umount (in fact hiding the fact it is mounted, if I understand the man page) /mnt/root1/dev with umount --lazy, but it looks incorrect to me.

Configure zsh to display my stdin in green

Posted: 08 Mar 2022 12:56 AM PST

I wanted a simple way of displaying errors in red, and inputs in green in zsh. I found this response, that works well, but it doesn't implement the input color. I'm not really a unix developper, so I tried some things, but it doesn't work. How can I change the input color to green using this method or a similar one?

Here's what I actually have in my .zshrc:

setcolor()  {      case "$1" in      red)          tput setaf 1          ;;      normal)          tput sgr0          ;;      green)          tput setaf 2          ;;      esac  }    # make standard error red  rederr()  {      while read -r line      do          setcolor $errorcolor          echo "$line"          setcolor normal      done  }    errorcolor=red    errfifo=${TMPDIR:-/tmp}/errfifo.$$  mkfifo $errfifo  # to silence the line telling us what job number the background job is  exec 2>/dev/null  rederr <$errfifo&  errpid=$!  disown %+  exec 2>$errfifo  

EC2 Redhat - Multiple IP

Posted: 07 Mar 2022 08:52 PM PST

I have one VPC with two Subnets (SubnetA and SubnetB).
My team wants to have multiple IPs assigned to the Instance, each from one subnet.
The Instance already have one Private IP (from SubnetA, Primary one) when I launched it, then I attached another Private IP from another SubnetB via the Console Attach network Interface option.
I can see both of the IPs in the console under Managed IP Address option.
I rebooted the Instance, and I was expecting to see both of the IPs when I do ifconfig, but I can see only the Primary one.

To cross-check if the Private IP is actually attached to the Instance, I queried Instance Metadata using the following commands :

  • curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/02:14:46:91:bc:34/local-ipv4s
  • curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/02:1d:2a:75:ax:04/local-ipv4s

I can see both of the IPs in the output for the above two commands respectively.

I checked the status of NETWORKMANAGER systemctl status NetworkManager It was stopped

I started the Service and enabled NetworkManager automatically at boot time, using following commands:
systemctl start NetworkManager
systemctl enable NetworkManager

Then I checked the output of ifconfig

This time it showed me both of the MAC addresses, with the only difference for the second one I was not able to see the IP address. So basically the interface is up, so the underlying device is found. There is no IP address associated with this interface.

So I tried both of the options to associate IP:

Assign an IP address manually:
sudo ifconfig ens6 w.x.y.z

Or contact the DHCP server, if it exists, and let it provides an IP address for the interface:
sudo dhclient -v ens6

Both of them worked and I can see both of the IPs under inet.

The last problem was I have to do this every time I reboot the Instance. So I was trying to add a permanent route using the following command:

sudo /sbin/route add default gw 1xx.xx.2xx.193
Here the IP is the second IP from the SubnetB, but I am getting the error : SIOCADDRT: Network is unreachable

To solve the above problem what I did is, I was already having a file with
/etc/sysconfig/network-scripts/ifcfg-ens5 with details for Primary IP, I added one more file
/etc/sysconfig/network-scripts/ifcfg-ens6 with the necessary details for secondary IP

This is what I referred.

Rebooted and it is working.

But I am not able to ping the secondary IP. I think I have to add one more Gateway from the second subnet but not sure about this.

What else needs to be done so that I can route traffic, ping, ssh using the Secondary IP.

Please refer to my VPC Subnet CIDRS:

Subnet A: 1.7.2.128/26 Subnet B: 1.7.2.192/26

Output of ip route: enter image description here

Update:

Today when I started the server I am able to ping the Secondary IP(200),but not the Primary one(136), from one of my test Instance. Also, ssh is done using Primary IP.

How to receive a file from router to pc

Posted: 08 Mar 2022 12:32 AM PST

Here what I try to do; from my router (root@192.168.1.1). I want to SCP a file on my PC and copy it to my router.

So, if I'm already in ssh remote: root@openwrt: SCP root@mypc? What is my PC, home/username?

How do I set a timeout for PackageKit's yum backend?

Posted: 07 Mar 2022 11:57 PM PST

I have a configuration running where I am using the Cockpit user interface together with Packagekit (using the cockpit-packagekit RPM). Sometimes, the host system will not have access to the internet, but still have a working DNS (the default route leads nowhere). When that happens and I open the Cockpit interface, PackageKit starts up in the background and locks the Yum for a very long time. I am trying to upload a locally built RPM separately to the machine at the same time (yum install --disablerepo=* file.rpm), but cannot install it because PackageKit holds a lock:

(...)  Another app is currently holding the yum lock; waiting for it to exit...    The other application is: PackageKit      Memory :  32 M RSS (347 MB VSZ)      Started: Mon Mar  7 15:10:01 2022 - 30:12 ago      State  : Sleeping, pid: 10384  (...)  

I am unable to find out where to configure a timeout for this, Yum itself seems to have a lower timeout and I cannot find where to configure PackageKit's Yum backend to add a timout.

I want to script the installation of the locally built RPM, so logging in as root and killing PackageKit manually is not a viable option.

ping: option requires an argument -- 'c'

Posted: 08 Mar 2022 12:39 AM PST

''''

    #!/bin/bash        interface=$1      ip=$2      packet=$3        if [[ "$1" == "-h" ]]      then            echo "Perform ping command and get an automated result"            echo "Perform like   ./ping_lan.sh Interface IP Packet "            echo "Example: ./ping_lan.sh eno1 192.168.7.4 10"      exit      fi        ping -I $interface -q $ip -c $packet >> ping_summary.txt  

''''

The above is the code line. I am getting the error of argument requires an argument. I tried to replace -c with --c. I am trying to note the port number for LAN.

What is this error mean? Why am I getting this error? How should I avoid this error ?

After using bash -x script_name: So I tried running the script with bash -x your_script
Output I got is: '''

    + result=1      + interface=wlan0      + ip=192.168.0.1      + packet=5      + ping -I wlan0 -q 192.168.0.1 -c 5      ++ grep -o '[0-9]\+ packets transmitted' ping_summary.txt      ++ grep -o '[0-9]\+'      + transmit=5      ++ grep -o ', [0-9]\+ received' ping_summary.txt      ++ grep -o '[0-9]\+'      + receive=5      ++ grep -o ', [0-9]\+% packet loss' ping_summary.txt      ++ grep -o '[0-9]\+'      + packet_loss=0      + cat ping_summary.txt      WiFi_net_test.sh: line 15: summary.txt: Permission denied      + rm ping_summary.txt      + [[ 5 -ne 5 ]]      + [[ 5 -ne 5 ]]      + [[ 0 -ne 0 ]]      + exit 0  

'''

Unable to exit from my openvpn

Posted: 08 Mar 2022 12:11 AM PST

I've just installed a debian machine on a google cloud platform. Now I have a debian server and a windows client. I can ssh from my client to my server in a "vanilla" way. After that I've installed an openvpn server on the debian. At this moment I can connect the 2 machines via openvpn.

But now start all my problems. If I establish the vpn, I'm able to talk with between the 2 devices, but not with any others!

If I'm vpn connected my client stops to talk with the rest of the net.

172.16.0.1 server 172.16.0.2 client

On server side

    # netstat -nr -f inet      Kernel IP routing table      Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface      0.0.0.0         10.138.0.1      0.0.0.0         UG        0 0          0 ens4      10.138.0.1      0.0.0.0         255.255.255.255 UH        0 0          0 ens4      172.16.0.0      0.0.0.0         255.255.255.0   U         0 0          0 tun0        # cat  /proc/sys/net/ipv4/ip_forward  1          # iptables -S      -P INPUT ACCEPT      -P FORWARD ACCEPT      -P OUTPUT ACCEPT      -A INPUT -p udp -m udp --dport 1194 -j ACCEPT      -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT      -A FORWARD -s 10.8.0.0/24 -j ACCEPT  

what do I miss? if you need any other infos pleas let me know. Thank you

Here is my client OpenVPN configuration file:

client  dev tun  proto udp  remote xxx.hopto.org 1194  resolv-retry infinite  nobind  persist-key  persist-tun  remote-cert-tls server  auth SHA512  cipher AES-256-CBC  ignore-unknown-option block-outside-dns  block-outside-dns  verb 3  <ca>  -----BEGIN CERTIFICATE-----  xxx  -----END CERTIFICATE-----  </ca>  <cert>  -----BEGIN CERTIFICATE-----  xxx  -----END CERTIFICATE-----  </cert>  <key>  -----BEGIN PRIVATE KEY-----  xxx  -----END PRIVATE KEY-----  </key>  <tls-crypt>  -----BEGIN OpenVPN Static key V1-----  xxx  -----END OpenVPN Static key V1-----  </tls-crypt>  

Mic is muted under sysdefault but works with sof-hda-dsp

Posted: 07 Mar 2022 11:09 PM PST

On a freshly installed Arch on a Lenovo laptop I was lacking sound. I installed various alsa-* to no avail:

$ alsamixer  Cannot open sound card '0'.  

until linux-firmware enabled my sound output.

Now for the input. To test it I installed audacity and tried recording. The default setting is sysdefault and that flatlines. Only after I switch to sof-hda-dsp: (hw:0.7) does the mic record.

The problem: trying to do a voice call over slack my mic is muted. In alsamixer none of the fields displays the MM for muted.

How to diagnose the issue?

# dmesg | grep -i audio  [    0.071084] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)  [    3.237759] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100  [    3.237778] sof-audio-pci-intel-tgl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver  [    3.237789] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)  [    3.237959] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100  [    3.238027] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])  [    3.244776] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode  [    3.277543] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 5  [    3.277549] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now  [    3.277556] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 2  [    3.279786] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:0:0-b678a  [    3.279792] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:20:0 Kernel ABI 3:18:0  [    3.279796] sof-audio-pci-intel-tgl 0000:00:1f.3: warn: FW ABI is more recent than kernel  [    3.279803] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30  [    3.373891] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:0:0-b678a  [    3.373895] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:20:0 Kernel ABI 3:18:0  [    3.373897] sof-audio-pci-intel-tgl 0000:00:1f.3: warn: FW ABI is more recent than kernel  [    3.385887] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:20:0 Kernel ABI 3:18:0  [    3.385891] sof-audio-pci-intel-tgl 0000:00:1f.3: warn: topology ABI is more recent than kernel  [    3.402264] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC257: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker  [    3.402268] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)  [    3.402269] snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)  [    3.402270] snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0  [    3.402271] snd_hda_codec_realtek ehdaudio0D0:    inputs:  [    3.402272] snd_hda_codec_realtek ehdaudio0D0:      Mic=0x19  [    3.445322] snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten  [    3.445329] snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten  [  116.371743] snd_hda_codec_realtek ehdaudio0D0: didn't find PCM for DAI Digital Codec DAI  [  116.371746] snd_hda_codec_realtek ehdaudio0D0: ASoC: error at snd_soc_dai_startup on Digital Codec DAI: -22  [  116.371779] snd_hda_codec_realtek ehdaudio0D0: didn't find PCM for DAI Digital Codec DAI  [  116.371780] snd_hda_codec_realtek ehdaudio0D0: ASoC: error at snd_soc_dai_startup on Digital Codec DAI: -22  [  124.968935] snd_hda_codec_realtek ehdaudio0D0: didn't find PCM for DAI Digital Codec DAI  [  124.968941] snd_hda_codec_realtek ehdaudio0D0: ASoC: error at snd_soc_dai_startup on Digital Codec DAI: -22  [  124.969014] snd_hda_codec_realtek ehdaudio0D0: didn't find PCM for DAI Digital Codec DAI  [  124.969016] snd_hda_codec_realtek ehdaudio0D0: ASoC: error at snd_soc_dai_startup on Digital Codec DAI: -22  

What caused the ethernet mac address to change after an update of my linux system?

Posted: 08 Mar 2022 12:43 AM PST

I recently updated my machine and after a reboot I discovered that my ethernet mac address had changed. The router settings for that machine were no longer implemented as it was viewed as a different machine. This doesn't happen for every update, so I'm wondering which package update could have caused this? And is it possible to ensure that the mac address remains static even if w/e package caused this is updated?

I'm running arch btw 🤣

`kate -n new.txt %u` in Dolphin service menu saves one level up

Posted: 07 Mar 2022 08:55 PM PST

When creating a new Dolphin service menu to create a new text file using Kate (given there is no shortcut for that like for folders and that the menu option is rather hidden under multiple clicks as said here), using a desktop file like this

[Desktop Entry]  Type=Service  Icon=kate  Actions=new-file  ServiceTypes=KonqPopupMenu/Plugin,inode/directory  X-KDE-Priority=TopLevel    [Desktop Action new-file]  Name=New text file  Icon=kate  Exec=kate %u  

Kate creates the file not within the selected directory, but at the same path as that directory, one level up than expected: selecting folder /PATH/TO/MY_DIRECTORY and using the context menu service, the text file is ready to be saved at /PATH/TO instead of /PATH/TO/MY_DIRECTORY.

The same happens with Exec=kate -n new.txt %u, as the file is created and saved.

How to make Kate save or offer to save within the selected directory?

How to do it inside the selected folder?

Interface with apipa (i..e. 169.254.x.x)

Posted: 08 Mar 2022 12:06 AM PST

I have a ubuntu machine with two interfaces (eth0 and eth1). Eth0 interface has a dhcp address and eth1 has apipa (169.254.x.x) address. eth1 is not connected and eth0 is connected to a local network. From my desktop, which is also connected to the same network, i can ping 169.254.x.x address and can do scp, etc.

How this is possible? No routing is enabled.

Ubuntu 18.04 mysql Installation error: Error: dpkg: dependency problems prevent configuration of mysql-server

Posted: 07 Mar 2022 11:03 PM PST

I'm on Ubuntu 18.04, I'm installing Mysql,

i typed:

sudo apt-get install mysql-server

i received this with an error at the end:

Reading package lists... Done  Building dependency tree         Reading state information... Done  mysql-server is already the newest version (5.7.28-0ubuntu0.18.04.4).  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.  2 not fully installed or removed.  After this operation, 0 B of additional disk space will be used.  Do you want to continue? [Y/n] y  Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ...  /var/lib/dpkg/info/mysql-server-5.7.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory  dpkg: error processing package mysql-server-5.7 (--configure):   installed mysql-server-5.7 package post-installation script subprocess returned error exit status 127  dpkg: dependency problems prevent configuration of mysql-server:   mysql-server depends on mysql-server-5.7; however:    Package mysql-server-5.7 is not configured yet.    dpkg: error processing package mysql-server (--configure):   dependency problems - leaving unconfigured  No apport report written because the error message indicates its a followup error from a previous failure.                            Errors were encountered while processing:   mysql-server-5.7   mysql-server  E: Sub-process /usr/bin/dpkg returned an error code (1)  

Additional Information:

When i typed: apt-cache policy mysql-common I got this response:

mysql-common:    Installed: 1:10.4.11+maria~bionic    Candidate: 1:10.4.11+maria~bionic    Version table:   *** 1:10.4.11+maria~bionic 100          100 /var/lib/dpkg/status       1:10.3.21+maria~bionic 500          500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages          500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages          500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages          500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages          500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages          500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages       1:10.3.20+maria~bionic 500          500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages          500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages          500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages          500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages          500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages          500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages       1:10.3.14+maria~bionic 500          500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main ppc64el Packages          500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main amd64 Packages          500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main arm64 Packages       5.8+1.0.4 500          500 http://fr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages          500 http://fr.archive.ubuntu.com/ubuntu bionic/main i386 Packages  

I have tried SO MANY solutions, from desintalling mysql, installing mariadb, seeing different solutions on stackOverflow.. and didnt get to put my finger on the error exactly.

Really appreciate the help i have been stuck with this for a while...

Two default gateways with different metric on CentOS 7 box - how?

Posted: 07 Mar 2022 10:04 PM PST

I'm begging for help here. Been spending hours researching how to solve what seemed like a simple problem:

On a CentOS 7.6 host with two network interfaces on two different networks, how to have two default gateways with a set metric to favour one of these interfaces. Can't do it. Would anybody please tell me what I'm missing before I have no hair left?

  • First, I've tried using the METRIC=xxx setting in /etc/sysconfig/network-scripts-/ifcfg-<interface> files based on some advice found on the web. Obviously if that ever was supported, it's no longer. Next.

  • Then I've tried using policy-based routing following the tons of documentation that can be found online. Unfortunately very few mention adding metric values.

So, the full details (sorry it's long but I don't want to skip anything):

  • This machine has two active interfaces enp10s4f0 (IP 10.149.247.23, prefix /24) and enp2s0f0 (IP 10.149.160.21, prefix /24).

  • It has two gateways: 10.149.247.254 and 10.149.160.254. I want 10.149.160.254 to be the "best" gateway, therefore with the lower metric. I also want to avoid asymetric routing.

  • I can reach my goal of having different metrics on gateways by means of entering routes with

    ip route add default ... dev ... metric  

    but I want it to be persistent.

  • So I've created two routing tables in /etc/iproute2/rt_tables:

    247 enp10s4f0table    160 enp2s0f0table  

    And I've made the following rule and route files in /etc/sysconfig/network-scripts:

    route-enp10s4f0:    10.149.247.0/24 dev enp10s4f0 src 10.149.247.23 table enp10s4f0table    default via 10.149.247.254 dev enp10s4f0 metric 110 table enp10s4f0table      rule-enp10s4f0:    from 10.149.247.23/32 table enp10s4f0table  to 10.149.247.23 table enp10s4f0table      route-enp2s0f0:    10.149.160.0/24 dev enp2s0f0 src 10.149.160.21 table enp2s0f0table    default via 10.149.160.254 dev enp2s0f0 table enp2s0f0table      rule-enp2s0f0:    from 10.149.160.21/32 table enp2s0f0table  to 10.149.160.21 table enp2s0f0table    
  • Then I've used the proper incantations:
    yum install NetworkManager-config-routing-rules    systemctl enable NetworkManager-dispatcher.service    systemctl start NetworkManager-dispatcher.service    
    ... and reboot.

Obviously the configuration is read and processed properly but the metric is not applied to the 10.149.247.254 gateway:

# ip route show table enp10s4f0table  default via 10.149.247.254 dev enp10s4f0 metric 110  10.149.247.0/24 dev enp10s4f0 scope link src 10.149.247.23    # ip route show table enp2s0f0table  default via 10.149.160.254 dev enp2s0f0    # ip rule show  0: from all lookup local  32762: from all to 10.149.160.21 lookup enp2s0f0table  32763: from 10.149.160.21 lookup enp2s0f0table  32764: from all to 10.149.247.23 lookup enp10s4f0table  32765: from 10.149.247.23 lookup enp10s4f0table  32766: from all lookup main  32767: from all lookup default    

But:

# ip route show  default via 10.149.247.254 dev enp10s4f0 proto static metric 100  default via 10.149.160.254 dev enp2s0f0 proto static metric 102  10.149.160.0/24 dev enp2s0f0 proto kernel scope link src   10.149.160.21 metric 102  10.149.247.0/24 dev enp10s4f0 proto kernel scope link src   10.149.247.23 metric 100  192.168.2.0/24 dev enp10s4f1 proto kernel scope link src   192.168.2.14 metric 101  

[OK, I do have a third interface enp10s4f1 but this one has DEFROUTE=no and no GATEWAY= in its ifcfg file so I haven't mentioned it so far]

See?

  • No metric 110 on the default via 10.149.247.254 dev enp10s4f0... line.
  • And the result is the exact opposite to what I'm trying to achieve: enp10s4f0's default gateway has a lower metric than enp2s0f0's

I can confirm this by tracerouting to a host outside of these two networks, packets do get out through 10.149.247.254

I'm stuck at this point. Can't figure it out. Please kindly help if you can.

How to significantly lower a video file size with ffmpeg without quality loss?

Posted: 07 Mar 2022 11:48 PM PST

I see there are videos on youtube with 1080p resolution that are more than 10 minutes long and only 50-60 mb in size.

I have a video only 3 minutes long and only 720p resolution but unable to bring it down below 90mb in size.

I checked another answer here on reducing size. Tried changing bitrate using ffmpeg -i input.mp4 -b 1000000 output.mp4

also tried ffmpeg -i input.mp4 -vcodec libx265 -crf 20 output.mp4 Tried changing -crf between 18 to 24, used both libx264,265 but it all resulted in nearly same output size, sometimes it even got bigger instead of smaller.

Why the output of "column" is misaligned with a ANSI colored input?

Posted: 08 Mar 2022 12:22 AM PST

I'm working on a commandline that retrieve some data (curl), extract the relevant fields (awk) and format it (column).

It work nice, although it's very ugly (but all my script begin from a "too long and ugly" one-liner) but when I try to have some colour column goes wrong.

This is the plain (reduced) version that work:

curl "http://webservices.rm.ingv.it/fdsnws/event/1/query?lat=42.35&lon=13.4&maxradius=5.0&starttime=2016-01-01T00:00:00&endtime=2016-12-31T23:59:59&minmag=5&format=text&orderby=time-asc" 2>/dev/null  \   | awk 'BEGIN { FS= "|"; OFS= "|" }  {print  $1, $2, $5, $10, $11, $13}' \   | column -t -s '|'  

Now, I want to underline some fields, and then add some ANSI escape code in awk:

curl "http://webservices.rm.ingv.it/fdsnws/event/1/query?lat=42.35&lon=13.4&maxradius=5.0&starttime=2016-01-01T00:00:00&endtime=2016-12-31T23:59:59&minmag=5&format=text&orderby=time-asc" 2>/dev/null  \   | awk 'BEGIN { FS= "|" ; OFS= "|" }  \       $13~/Rieti/||/Perugia/ {$13="\033[1;31m"$13"\033[0m"} \       $11~/[0-9]+/ && $11 > 5.8 {$11="\033[1;33m"$11"\033[0m"}        {print  $1, $2, $5, $10, $11, $13 }' \   | column -t -s '|'  

Now, the alignment is wrong (see the picture).

enter image description here

Why? And how can I fix it?

UPDATE

I already saw the question Issue with column command and color escape codes but does not solve my problem because his answers are applied and work in the case of a fully colored line.

In my case I can't apply or adapt the answers (or I'm not able to) because:

  1. The problem is circumscribed to the case where the column $11 is colored, regardless of the subsequent column.
  2. I can't see a good or elegant way to add color code after column.
    If I send column's output to awk for the test I don't know how to instruct awk to separate the fields correctly (if the fields were separated by more space I could use a regex but in some cases the separation is by a single space, and awk would not know how to recognize spaces between words and spaces as Fields Separators).

The only thing I can see is that if I move the reset color code from the assignment to the print block the first row was better spaced, like the plain output version (see below, the \033[0m underlined in second commandline): enter image description here

Then, how can we fix it? There is another way, more elegant, to colorize as I did?

(I know, I can do it better with some lines of perl, but I'm curious about this problem)

Debian8(jessie) doesn't detect bluetooth

Posted: 07 Mar 2022 09:03 PM PST

when i use hcitool dev

sudo hcitool dev  Devices:  

rfkill list

0: acer-wireless: Wireless LAN          Soft blocked: no          Hard blocked: no  1: acer-bluetooth: Bluetooth          Soft blocked: no          Hard blocked: no  2: phy0: Wireless LAN          Soft blocked: no          Hard blocked: no  

My kernel:3.16.0-4-amd64

lsmod | grep -i blue  bluetooth             374429  6 bnep,btusb  6lowpan_iphc           16588  1 bluetooth  rfkill                 18867  6 cfg80211,acer_wmi,bluetooth  crc16                  12343  2 ext4,bluetooth  

dmesg:

dmesg | grep -i firmware  [    0.166480] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored  [    9.257608] [Firmware Bug]: battery: (dis)charge rate invalid.  [   10.691014] psmouse serio1: elantech: assuming hardware version 3            (with firmware version 0x550f01)  [   11.742351] [Firmware Bug]: ACPI(PEGP) defines _DOD but not _DOS  

for bluetooth

dmesg | grep -i blue  [   11.300428] Bluetooth: Core ver 2.19  [   11.300445] Bluetooth: HCI device and connection manager initialized  [   11.300452] Bluetooth: HCI socket layer initialized  [   11.300454] Bluetooth: L2CAP socket layer initialized  [   11.300464] Bluetooth: SCO socket layer initialized  [   84.877650] Bluetooth: BNEP (Ethernet Emulation) ver 1.3  [   84.877653] Bluetooth: BNEP filters: protocol multicast  [   84.877658] Bluetooth: BNEP socket layer initialized  

bluetooth status:

bluetooth.service - Bluetooth service   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)   Active: active (running) since Вт 2016-03-29 19:11:14 MSK; 1h 21min ago   Docs: man:bluetoothd(8)   Main PID: 1470 (bluetoothd)   Status: "Running"   CGroup: /system.slice/bluetooth.service         └─1470 /usr/lib/bluetooth/bluetoothd     мар 29 19:11:14 debian bluetoothd[1470]: Bluetooth daemon 5.23   мар 29 19:11:14 debian bluetoothd[1470]: Starting SDP server   мар 29 19:11:14 debian bluetoothd[1470]: Bluetooth management interface      1...d   Hint: Some lines were ellipsized, use -l to show in full.  

output for lspci -knn | grep Net -A2; lsusb:

02:00.0 Ethernet controller [0200]: Broadcom Corporation NetLink BCM57785 Gigabit Ethernet PCIe [14e4:16b5] (rev 10)      Subsystem: Acer Incorporated [ALI] Device [1025:0647]      Kernel driver in use: tg3  --  03:00.0 Network controller [0280]: Qualcomm Atheros AR9462 Wireless Network Adapter [168c:0034] (rev 01)      Subsystem: Foxconn International, Inc. Device [105b:e052]      Kernel driver in use: ath9k  Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub  Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  Bus 001 Device 004: ID 1bcf:2c18 Sunplus Innovation Technology Inc.   Bus 001 Device 005: ID 0489:e04e Foxconn / Hon Hai   Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub  Bus 003 Device 003: ID 0000:0538    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  

output modinfo:

alias:          usb:v0489pE04Ed*dc*dsc*dp*ic*isc*ip*in*  

modprobe

sudo modprobe ath3k - doesn't say anything  

for in:

for i in /etc/modprobe.d/*; do echo $i; cat $i | grep ath3k; done  /etc/modprobe.d/ath3k.conf  blacklist ath3k  /etc/modprobe.d/bumblebee.conf  /etc/modprobe.d/dkms.conf  /etc/modprobe.d/fbdev-blacklist.conf  /etc/modprobe.d/intel-microcode-blacklist.conf  /etc/modprobe.d/modesetting.conf  

P.S. if it help... notebook - Acer aspire v3-571g

How to repack an img file extracted from a device firmware?

Posted: 07 Mar 2022 08:08 PM PST

I've got a DVR and forgot its password. Tried to telnet it, got credentials from internet (I guess they are the same for many resellers since the manufacturer is probably the same), JTR'd password. But this has awaken my curiosity, and now I just want to mess with firmware for the fun of it. I've tried to put a custom logo since it's a really stupid one, and possibly change languages of menus so other people from my family can also operate it.

Firmware comes as a binary file. Unzipped it to 4 .img files.

  • custom-x.cramfs.img
  • logo-x.cramfs.img
  • romfs-x.cramfs.img
  • user-x.cramfs.img

I couldn't get to mount them since there was some header bytes added to those images by mkimage, as I was told by some blog posts.

file command output of one of these images (logo):

logo-x.cramfs.img: u-boot legacy uImage, linux, Linux/ARM, Standalone Program (gzip), 40960 bytes, Fri Jul  4 06:04:30 2014, Load Address: 0x00770000, Entry Point: 0x00780000, Header CRC: 0xBC5511F0, Data CRC: 0xC6BFF7D1  

After stripping the 64 bytes of data with dd I can get to mount it, and access files. Stuck trying to add some garbage files just to generate a different image file. How would I proceed about repacking the mounted img after doing changes/adding files? And how should I re-add the 64 bytes of data I've stripped?

Any helpful thoughts are appreciated.

No comments:

Post a Comment