Thursday, April 8, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


continue: only meaningful in a `for', `while', or `until' loop

Posted: 08 Apr 2021 10:52 AM PDT

I have a loop that checks for certain criteria for whether or not to skip to the next iteration (A). I realized that if I invoke a function (skip) that calls continue, it is as if it is called in a sub-process for it does not see the loop (B). Also the proposed workaround that relies on eval-uating a string does not work (C).

# /usr/bin/bash env    skip()  {      echo "skipping : $1"      continue     }    skip_str="echo \"skipping : $var\"; continue"    while read -r var;  do      if [[ $var =~  ^bar$  ]];      then          # A          #        echo "skipping : $var"          #        continue          # B          #        skip "$var" #  continue: only meaningful in a `for', `while', or `until' loop          # C          eval "$skip_str"      fi      echo "processed: $var"  done < <(cat << EOF   foo  bar  qux  EOF          )  

Method C:

$ source ./job-10.sh  processed: foo  skipping :   processed: qux  

Also see:

Do functions run as subprocesses in Bash?

PS1: could someone remind me why < < rather than < is needed after done?

PS2: no tag found for while hence for

Read from another file

Posted: 08 Apr 2021 10:51 AM PDT

I have one shell script, but I want to read variable for number of files and where to insert files read from conf.txt file. How can I do that?

What can I configure or enable to determine why systemd took a "stop" action on a service?

Posted: 08 Apr 2021 11:01 AM PDT

We have a systemd service unit that starts a third-party agent; call it "service c". The service unit functions correctly -- at least, as far as I can tell! After a patching cycle, systemd starts this service unit (as expected) but then it turns around and stops the service unit about two seconds after it successfully started it. I have every reason to believe that the service started successfully the first time. When I log in after the reboot, I can see that the service is indeed not running; at that point, I can start the service unit manually (systemctl start service-c) and it starts the service as expected.

I would like to find out why systemd thinks it should be stopping the service unit. What can I configure or enable to determine why systemd took the "stop" action?

I am aware of the systemd LogLevel option and have already set it to "debug", up from the default of "info".

A similar idea is to set Environment=SYSTEMD_LOG_LEVEL=debug in the service unit file, but I don't particularly need the service debugged, but rather systemd itself.

The service unit configuration is:

# /etc/systemd/system/service-c.service  [Unit]  Description=service c  After=network-online.target local-fs.target    [Service]  Type=forking  ExecStart=/local-path/start.service-c  ExecStop=/local-path/stop.service-c  Restart=on-failure    [Install]  WantedBy=multi-user.target  

... and the evidence is:

$ systemctl status service-c  ● service-c.service - service c     Loaded: loaded (/etc/systemd/system/service-c.service; enabled; vendor preset: disabled)     Active: inactive (dead) since Wed 2021-04-07 17:49:30 EDT; 14h ago    Process: 3162 ExecStop=/local-path/stop.service-c (code=exited, status=0/SUCCESS)    Process: 1319 ExecStart=/local-path/start.service-c (code=exited, status=0/SUCCESS)   Main PID: 1478 (code=exited, status=0/SUCCESS)  

Since this has been an ongoing issue, after the last reboot I instrumented the "stop" wrapper script to log the process parent tree (using pstree -a -A -l -p -s $$)); that log file shows:

04/07/2021 17:49:19  stop.service-c:  systemd,1 --switched-root --system --deserialize 22    `-stop.service-c,3162 /local-path/stop.service-c        `-pstree,3178 -a -A -l -p -s 3162  

... where PID 3162 corresponds to systemd's invocation of the stop script. This looks to me like systemd is calling the ExecStop for the service.

systemd stops this service about two seconds after it has finished starting; the agent's log file has these timestamps:

04/07/2021 17:49:12  start.service-c:  Starting agent  04/07/2021 17:49:17  start.service-c:  startup success  04/07/2021 17:49:19  stop.service-c:  Executing from /agent/home as user  

... ending in ...

04/07/2021 17:49:30  stop.service-c:  Finished with RC=0  

... which corresponds to systemd's 17:49:30 timestamp for being "dead".

The "Restart=on-failure" directive would restart the service, but systemd tells me that the service started successfully:

Apr 07 17:49:10 hostname systemd[1]: Starting service c...  Apr 07 17:49:17 hostname systemd[1]: Started service c.  

Since the service started cleanly, and since there's no attempt made by systemd to restart the service, I don't think the Restart parameter is coming into play.

Perhaps interesting, there's no corresponding "Stopping service c..." log from journalctl (as there is when I manually stop the service), yet evidence points to systemd calling the ExecStop.

I am currently running systemd 219.

Kali Linux arm64 vs amd64

Posted: 08 Apr 2021 10:32 AM PDT

I have a Raspberry PI 4 fully decked out and was wondering which version of kali Linux to get I know the offensive-security version using arm64, but a lot of programs I want to download say title:amd64 is not installable, so not really sure if I should just go from the kali.org website and download the official version, or just stick with the offensive-security version, and find workarounds.

Cannot write to Custom Log file /var/log/test.log

Posted: 08 Apr 2021 10:26 AM PDT

I'm trying to implement a custom PAM via SSHD. I've added a logger file to the program which stores logs in /var/log/test.log .But, logs are not being printed into the file while running the custom PAM via SSHD but are getting printed when running the custom PAM via SU (Terminal). I've given 777 permissions to the log file and also changed the user/group as syslog/adm for the log file. Can anyone help me out!!

Can't start Debian 10 on new ThinkPad T15g Gen 1

Posted: 08 Apr 2021 09:58 AM PDT

I've just received a ThinkPad T15g Gen 1 fresh from the factory. It has:

  • Processor: Intel i7-10875H vPro (2,30 GHz, 8 cores)
  • Graphics processor: Nvidia GeForce RTX 2080 Super with Max-Q design (8 GB GDDR6 256) My goal is to have a dual boot with Windows (for gaming) and Linux (for everything else). So on Windows I go to the disk partition manager (type diskmgmt.msc on the Run dialogue launched with Windows Key + R) and create a large partition with free space ready for Linux to install there. Next in UEFI I disable:
  • Secure Boot
  • Windows UEFI Firmware Update
  • OS optimizer defaults
  • Intel TXT feature Then I install the latest Debian 10.9 (Buster) for the amd64 architecture. The problems I describe below occur with either the default small installation image or with the larger DVD-1 image for the complete installation image. In the installation process I ask for Gnome and XFCE and lightdm as the display manager. However, when the installation is done and I ask to start the newly installed Debian OS, I end up with a blinking and solitary cursor in a blank screen. From there I cannot even get to a terminal as the Ctrl+Alt+F[1-12] keybindings don't work.

Next I shut down and on reboot I ask in Grub to go into Recovery mode. There I see the OS loading but it stops on a line saying thunderbolt: control channel stopped'. For some reason, hittingEnterI am prompted to "give root password for maintenance". I oblige with the hope of updating (maybe some driver is missing?) butapt updatereturnsCould not resolve deb.debian.org. And yet, the laptop is connected to an ethernet cable and the installation process used the web without any problems whatsoever. The message repeats if I used other mirrors. So I don't know why Debian doesn't recognize the internet connection even though it is connected. Next as root I ask for the log of the booting process (journalctl -xb). I see two noticeable failures there because they're marked in red, one to do with nouveau' and the other withbluetooth`. I think the first one looks like the main culprit for failing to log in. In particular, it says something like this:

nouveau: detected PR support, will not use DSM  nouveau: enabling device (0006 -> 0007)  nouveau: unknown  chipset (164000a1)  nouveau: probe of 0000:01:00.0 failed with error -12  

As for bluetooth, the log says something along these lines:

bluetooth hcio: Direct firmware load for intel/ibt-19-0-4.sfi failed with error -2  

Finally, I try my luck with startx, which returns Fatal server error: (EE) Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices (EE) I think this is all folks!! As I said earlier, my main suspect is the Nvidia card and the unknown chipset (164000a1) that nouveau can't handle. I don't understand why it would matter though, because in the UEFI, in the option for Graphics device, the hybrid graphics option is on. So I understand that the integrated Intel graphic runs by default. The alternative is `Discrete graphics', which I understand to mean that the super Nvidia graphics takes over for every single graphic job. Any ideas or tips for handling this situation will be very much appreciated as I can't carry on with my work until I install Debian!!!!!! Help, please!!!!

Bash for loop with string var containing spaces

Posted: 08 Apr 2021 10:55 AM PDT

In my directory I have two files with space, foo bar and another file. I also have two files without space, file1 and file2.

The following script works:

for f in foo\ bar another\ file; do file "$f"; done  

This script also works:

for f in 'foo bar' 'another file'; do file "$f"; done  

But the following script doesn't work:

files="foo\ bar another\ file"  for f in $files; do file "$f"; done  

Not even this script works:

files="'foo bar' 'another file'"  for f in $files; do file "$f"; done  

But, if the files do not contain space, the script works:

files="file1 file2"  for f in $files; do file "$f"; done  

Thanks!

Edit

Code snippet of my script:

while getopts "i:a:c:d:f:g:h" arg; do    case $arg in      i) files=$OPTARG;;      # ...    esac  done    for f in $files; do file "$f"; done  

With files without spaces, my script works. But I would like to run the script passing files with spaces as argument in one of these ways:

./script.sh -i "foo\ bar another\ file"  ./script.sh -i foo\ bar another\ file  ./script.sh -i "'foo bar' 'another file'"  ./script.sh -i 'foo bar' 'another file'  

How to write udev rule to avoid: Webcam: device is a keyboard

Posted: 08 Apr 2021 09:05 AM PDT

My USB webcam sometimes gets identified as a keyboard and - I'm assuming - therefore won't work. A reboot often fixes this, but it's annoying, so I was wondering if there was another way.

Please say if this is an XY problem - I'm seeing nonsense from udev (webcam device is a keyboard), so I'm assuming it's a udev problem but it may not be. I'm just trying to get the webcam to work reliably! Perhaps udev is just about naming things and that the problem is deeper?

Here's the syslog lines that occur after plugging in the webcam:

Apr  8 16:56:21 meowko kernel: [561385.593298] usb 1-2.1: new high-speed USB device number 78 using xhci_hcd  Apr  8 16:56:23 meowko kernel: [561387.935896] usb 1-2.1: New USB device found, idVendor=046d, idProduct=085c, bcdDevice= 0.16  Apr  8 16:56:23 meowko kernel: [561387.935902] usb 1-2.1: New USB device strings: Mfr=0, Product=2, SerialNumber=1  Apr  8 16:56:23 meowko kernel: [561387.935905] usb 1-2.1: Product: C922 Pro Stream Webcam  Apr  8 16:56:23 meowko kernel: [561387.935908] usb 1-2.1: SerialNumber: 80ADA8BF  Apr  8 16:56:23 meowko kernel: [561387.937534] uvcvideo: Found UVC 1.00 device C922 Pro Stream Webcam (046d:085c)  Apr  8 16:56:23 meowko kernel: [561387.939350] input: C922 Pro Stream Webcam as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1:1.0/input/input230  Apr  8 16:56:24 meowko mtp-probe: checking bus 1, device 78: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1"  Apr  8 16:56:24 meowko mtp-probe: bus: 1, device: 78 was not an MTP device  Apr  8 16:56:24 meowko systemd-udevd[1153237]: controlC1: Process '/usr/sbin/alsactl -E HOME=/run/alsa -E XDG_RUNTIME_DIR=/run/alsa/runtime restore 1' failed with exit code 99.  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) config/udev: Adding input device C922 Pro Stream Webcam (/dev/input/event28)  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) C922 Pro Stream Webcam: Applying InputClass "libinput keyboard catchall"  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) Using input driver 'libinput' for 'C922 Pro Stream Webcam'  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) systemd-logind: got fd for /dev/input/event28 13:92 fd 107 paused 0  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) C922 Pro Stream Webcam: always reports core events  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "Device" "/dev/input/event28"  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "_source" "server/udev"  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: is tagged by udev as: Keyboard  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: device is a keyboard  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: device removed  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1:1.0/input/input230/event28"  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) XINPUT: Adding extended input device "C922 Pro Stream Webcam" (type: KEYBOARD, id 27)  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "xkb_model" "pc105"  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "xkb_layout" "gb"  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (WW) Option "xkb_variant" requires a string value  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (WW) Option "xkb_options" requires a string value  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: is tagged by udev as: Keyboard  Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: device is a keyboard  Apr  8 16:56:24 meowko gnome-shell[1047764]: Window manager warning: Overwriting existing binding of keysym 31 with keysym 31 (keycode a).  ...various versions of last line (don't think relevant?)...  Apr  8 16:56:24 meowko mtp-probe: checking bus 1, device 78: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1"  Apr  8 16:56:24 meowko mtp-probe: bus: 1, device: 78 was not an MTP device  

Running: udevadm info -ap /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1 gives:

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1':      KERNEL=="1-2.1"      SUBSYSTEM=="usb"      DRIVER=="usb"      ATTR{bNumConfigurations}=="1"      ATTR{configuration}==""      ATTR{quirks}=="0x42"      ATTR{busnum}=="1"      ATTR{ltm_capable}=="no"      ATTR{bDeviceSubClass}=="02"      ATTR{avoid_reset_quirk}=="0"      ATTR{urbnum}=="130"      ATTR{serial}=="80ADA8BF"      ATTR{bMaxPower}=="500mA"      ATTR{removable}=="unknown"      ATTR{speed}=="480"      ATTR{idProduct}=="085c"      ATTR{tx_lanes}=="1"      ATTR{bMaxPacketSize0}=="64"      ATTR{bDeviceProtocol}=="01"      ATTR{version}==" 2.00"      ATTR{bmAttributes}=="80"      ATTR{devnum}=="78"      ATTR{rx_lanes}=="1"      ATTR{authorized}=="1"      ATTR{idVendor}=="046d"      ATTR{bConfigurationValue}=="1"      ATTR{devpath}=="2.1"      ATTR{maxchild}=="0"      ATTR{product}=="C922 Pro Stream Webcam"      ATTR{bDeviceClass}=="ef"      ATTR{bNumInterfaces}==" 4"      ATTR{bcdDevice}=="0016"      looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-2':      KERNELS=="1-2"      SUBSYSTEMS=="usb"      DRIVERS=="usb"      ATTRS{speed}=="480"      ATTRS{maxchild}=="4"      ATTRS{tx_lanes}=="1"      ATTRS{bNumConfigurations}=="1"      ATTRS{bConfigurationValue}=="1"      ATTRS{avoid_reset_quirk}=="0"      ATTRS{bDeviceSubClass}=="00"      ATTRS{product}=="USB2.0 Hub"      ATTRS{bDeviceProtocol}=="01"      ATTRS{bmAttributes}=="e0"      ATTRS{devpath}=="2"      ATTRS{urbnum}=="336"      ATTRS{quirks}=="0x0"      ATTRS{bNumInterfaces}==" 1"      ATTRS{authorized}=="1"      ATTRS{version}==" 2.00"      ATTRS{bcdDevice}=="0288"      ATTRS{removable}=="removable"      ATTRS{idProduct}=="3431"      ATTRS{devnum}=="68"      ATTRS{bDeviceClass}=="09"      ATTRS{bMaxPacketSize0}=="64"      ATTRS{idVendor}=="2109"      ATTRS{configuration}==""      ATTRS{rx_lanes}=="1"      ATTRS{ltm_capable}=="no"      ATTRS{bMaxPower}=="100mA"      ATTRS{busnum}=="1"        looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':      KERNELS=="usb1"      SUBSYSTEMS=="usb"      DRIVERS=="usb"      ATTRS{idProduct}=="0002"      ATTRS{authorized_default}=="1"      ATTRS{bDeviceProtocol}=="01"      ATTRS{bConfigurationValue}=="1"      ATTRS{bNumConfigurations}=="1"      ATTRS{speed}=="480"      ATTRS{avoid_reset_quirk}=="0"      ATTRS{version}==" 2.00"      ATTRS{ltm_capable}=="no"      ATTRS{tx_lanes}=="1"      ATTRS{serial}=="0000:00:14.0"      ATTRS{quirks}=="0x0"      ATTRS{busnum}=="1"      ATTRS{bMaxPacketSize0}=="64"      ATTRS{bmAttributes}=="e0"      ATTRS{bcdDevice}=="0504"      ATTRS{bMaxPower}=="0mA"      ATTRS{bDeviceSubClass}=="00"      ATTRS{product}=="xHCI Host Controller"      ATTRS{devnum}=="1"      ATTRS{idVendor}=="1d6b"      ATTRS{authorized}=="1"      ATTRS{maxchild}=="16"      ATTRS{bNumInterfaces}==" 1"      ATTRS{rx_lanes}=="1"      ATTRS{devpath}=="0"      ATTRS{configuration}==""      ATTRS{bDeviceClass}=="09"      ATTRS{urbnum}=="32052"      ATTRS{removable}=="unknown"      ATTRS{interface_authorized_default}=="1"      ATTRS{manufacturer}=="Linux 5.4.0-66-generic xhci-hcd"      looking at parent device '/devices/pci0000:00/0000:00:14.0':      KERNELS=="0000:00:14.0"      SUBSYSTEMS=="pci"      DRIVERS=="xhci_hcd"      ATTRS{class}=="0x0c0330"      ATTRS{numa_node}=="-1"      ATTRS{dma_mask_bits}=="64"      ATTRS{revision}=="0x31"      ATTRS{local_cpus}=="ff"      ATTRS{driver_override}=="(null)"      ATTRS{device}=="0xa12f"      ATTRS{consistent_dma_mask_bits}=="64"      ATTRS{subsystem_vendor}=="0x1028"      ATTRS{dbc}=="disabled"      ATTRS{broken_parity_status}=="0"      ATTRS{ari_enabled}=="0"      ATTRS{enable}=="1"      ATTRS{msi_bus}=="1"      ATTRS{local_cpulist}=="0-7"      ATTRS{vendor}=="0x8086"      ATTRS{subsystem_device}=="0x06e4"      ATTRS{d3cold_allowed}=="1"      ATTRS{irq}=="133"      looking at parent device '/devices/pci0000:00':      KERNELS=="pci0000:00"      SUBSYSTEMS==""      DRIVERS==""    

I'm on Linux 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux.

Thanks in advance!

FreeBSD doesn't boot from the secondary master IDE disk

Posted: 08 Apr 2021 09:01 AM PDT

I've installed FreeBSD-7.4 on a 2000 make PC* When the disk is connected to the primary IDE socket, the OS boots perfectly. When the same disk is connected to the secondary IDE socket, it only boots the first section, which greets you with a menu with 7 options like "1. Boot FreeBSD [default]" "3. Boot FreeBSD in Safe Mode", etc.

I select the default 1st option and it boots for a while more and then it says

Trying to mount from ufs:/dev/ad0s1a  freebsd manual root filesystem specification:  <fstype>:<device> [options]   Mount <device> using filesystem <fstype>                                  eg. ufs:/dev/da0s1a    ?               List valid disk boot devices    <empty line>    Abort manual input  

and drops into a useless mountroot prompt. Typing ? gives

List of GEOM managed disk devices:    ufsid/5c922e4292c8e9fa ufsid/5c922e435b48afb7   ufsid/5c922e4343d7ab4b ufsid/5c922e44e470015a   ufsid/5c922e424bf39462 ad2s1g ad2s1f ad2s1e   ad2s1c ad2s1b ad2s1a ad2s1 ad2  

entering mount ufsid/5c922e4292c8e9fa and trying with all other devices, returns

Trying to mount root from mount ufsid/5c922e4292c8e9fa, etc, i.e. not giving any helpful information at all.

A similar problem has been posted at mixed IDE/SATA disks and boot troubles but it didn't help; it's just similar.

If I unplug the 40-pin ribbon IDE cable from the IDE2 (= secondary) socket and plug it into the IDE1 socket, then everything returns back to normal. This problem is confined to the case where the disk is used as secondary master IDE disk by being connected to the IDE2 socket.

Actually, I've had this problem first when I tried to access a second IDE disk from the primary IDE disk on which the same FreeBSD is installed.

When I did mount /dev/ad1* /mnt/mydisk ad1* being various options ad1s1 , ad1s1a, ad1s1b all of them consistently returned mount: /dev/ad1s1: Operation not permitted I suppose it couldn't mount the second IDE disk because there was problem in the secondary master IDE connection. I guess this problem might be fixed from the Bios settings. There a many Bios settings related to the primary and secondary IDE disks, like "Mode: LBA, Large, Auto" but I don't know what does what and I don't want to try random settings to fix this by chance.

How to boot from the secondary master IDE and/or how to use a second IDE disk in FreeBSD?

  • PC specs: PII 400Mhz, Gigabyte Intel 440BX MoBo, 512MB RAM, 16MB RAM graphics card, 15GB Ouantum Fireball IDE harddisk, Award Bios with the 2002 firmware

Tomcat unable to execute VBoxManage: NS_ERROR_FAILURE (0x80004005)

Posted: 08 Apr 2021 09:00 AM PDT

Today I've seen an issue similar to this one: VBoxManage: won't start virtuals machines NS_ERROR_FAILURE (0x80004005) but in a completely different inexplicable context I can describe here.

In a distribution based on Ubuntu 20.04, I was able to issue this command from a normal user:

$ whoami  my-user-name  $ VBoxManage startvm --type headless my.app-name  

But I was not able to execute the same command from Java, specifically from Tomcat9, from the same user:

ProcessBuilder pb = new ProcessBuilder("bash", "-c", "whoami"); // my-user-name  Process p = pb.start();    ProcessBuilder pb = new ProcessBuilder("bash", "-c", "VBoxManage ...");  Process p = pb.start();  

In this last case I was obtaining this error:

VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine  

Note that I was also able to issue that command successfully from an emergency tty console, or from any other non-interactive shells, but not from Java executed by the Tomcat process.

Everyone on the Internet just suggests to reinstall VirtualBox but this is a completely irrelevant solution for this case (also because I tried multiple times reinstalling Tomcat or VirtualHost without changing anything).

Any troubleshooting tip?

How do I send signal to all processes in a cgroup?

Posted: 08 Apr 2021 08:07 AM PDT

kill $(< /sys/fs/cgroup/freezer/<name>/tasks ) works, but looks clumsy, produces a warning if cgroup is empty and may hit command line length limit.

pkill -F does not accept cgroup tasks file as a valid pidfile.

There seems to be no dedicated tool like cgkill.

What should I use (apart from a fully fledged containers like LXC) to make forced cgroup termination more reliable and self-documenting? Ideally it should also do the { SIGTERM, then wait, then freeze, then SIGKILL, then thaw } routine.

I'm getting this error again & again whenever I run this command. Anyone knows the solution?

Posted: 08 Apr 2021 07:48 AM PDT

yum list updates

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.     2. Reconfigure the baseurl/etc. for the repository, to point to a working      upstream. This is most often useful if you are using a newer      distribution release than is supported by the repository (and the      packages for the previous distribution release still work).     3. Run the command with the repository temporarily disabled          yum --disablerepo=<repoid> ...     4. Disable the repository permanently, so yum won't use it by default. Yum      will then just ignore the repository until you permanently enable it      again or use --enablerepo for temporary usage:            yum-config-manager --disable <repoid>      or          subscription-manager repos --disable=<repoid>     5. Configure the failing repository to be skipped, if it is unavailable.      Note that yum will try to contact the repo. when it runs most commands,      so will have to try and fail each time (and thus. yum will be much      slower). If it is a very temporary problem though, this is often a nice      compromise:            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true  

Debian 10 Graphical Install Cannot Modify Partition

Posted: 08 Apr 2021 07:40 AM PDT

I have an old server that I am trying to install Debian 10 on but it won't allow me to delete the partition from the Disk?

There were some partitions that it did allow me to delete and I am currently left with one remaining lvm

RAID1 device #126 - 950 GB Linux Software RAID Array    >          2 GB       FREE SPACE    >   #3   948 GB   K   lvm  

When I try to delete it though it fails with the error

No modifications can be made to the partition #3 of device RAID1 device #126 for the following reasons  In use by LVM volume group cl  

How can I delete this partition?

netstat -lnp outputing results without PID

Posted: 08 Apr 2021 09:45 AM PDT

After using netstat -lnp I wonder how comes some of the result don't show any PID/Program name? Should I be worried? See below:

Active Internet connections (only servers)  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name      tcp        0      0 127.0.0.1:33223         0.0.0.0:*               LISTEN      31952/dart            tcp        0      0 127.0.0.1:5037          0.0.0.0:*               LISTEN      13351/adb             tcp        0      0 127.0.0.1:41741         0.0.0.0:*               LISTEN      -                     tcp        0      0 127.0.0.1:5939          0.0.0.0:*               LISTEN      -                     tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                     tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -                     tcp        0      0 127.0.0.1:5433          0.0.0.0:*               LISTEN      -                     tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      -                     tcp        0      0 127.0.0.1:5434          0.0.0.0:*               LISTEN      -                     tcp6       0      0 ::1:33223               :::*                    LISTEN      31952/dart            tcp6       0      0 127.0.0.1:63342         :::*                    LISTEN      1061/java             tcp6       0      0 ::1:631                 :::*                    LISTEN      -                     tcp6       0      0 127.0.0.1:8599          :::*                    LISTEN      1061/java             tcp6       0      0 :::25                   :::*                    LISTEN      -                     tcp6       0      0 127.0.0.1:6942          :::*                    LISTEN      1061/java             udp        0      0 224.0.0.251:5353        0.0.0.0:*                           26664/chrome          udp        0      0 224.0.0.251:5353        0.0.0.0:*                           26664/chrome          udp        0      0 224.0.0.251:5353        0.0.0.0:*                           26705/chrome --type   udp        0      0 127.0.0.53:53           0.0.0.0:*                           -                     udp        0      0 0.0.0.0:68              0.0.0.0:*                           -                     udp        0      0 0.0.0.0:631             0.0.0.0:*                           -                     raw6       0      0 :::58                   :::*                    7           -                     

I have identified some of them:

  • Port _621: Printing
  • Port 5939: Teamviewer
  • Port 5433 and 5434: PostgresQL

How to avoid xsel sending text to clipboard with space/Enter at the end

Posted: 08 Apr 2021 07:58 AM PDT

I am trying to answer this other question: Command/script to start a terminal, enter text but don't execute.... I want to start the terminal and add specific text to it without executing, thus allowing me to copy some other variable text to it before executing. It's like when pasting sudo apt install mpv into terminal without space at the end: the command will not start, but allow for example to add other programs to be installed.

I have come close to a solution with xsel, which can send a command to terminal with a shortcut.

The commands to be used can be something like

bash -c "xsel -ib <<< 'MY_TEXT'"  

or

bash -c "xsel -p <<< 'MY_TEXT'"  

Thus, I can send that text to clipboard with one shortcut, open terminal with another shortcut, then paste what xsel has copied to clipboard.

The problem is that the xsel command sends to clipboard the text with a space or Enter at the end

enter image description here

It's MY_TEXT instead of MY_TEXT

It's like the difference between sudo apt install mpv which automatically runs the installation command and sudo apt install mpv that waits for me to press enter.

Core Dump file cannot be find on Linux system

Posted: 08 Apr 2021 08:49 AM PDT

1

I looked at the similar topic for issue when trying to find Core Dumped file but none of the solutions seem to work for me. Can someone help me in debugging. My application generates output in log tail that it failed because of core dump but that file is not being generated anywhere and that information is not preserved in the log file.

Linux System:

NAME="Red Hat Enterprise Linux Server" VERSION="7.8 (Maipo)" ID="rhel" ID_LIKE="fedora" As mentioned I tried several ways from the given link:

ulimit

ulimit -c  unlimited    cat /proc/sys/kernel/core_pattern  |/usr/share/apport/apport %p %s %c %d %P %E  

folder apport does not exist when I check it

I tried also to modify /proc/sys/kernel/core_pattern with a string starting with /tmp

echo "/tmp/cores/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern  /proc/sys/kernel/core_pattern: Read-only file system  

will this work if I run as root since I do not have that access currently?

Core Dump file also does not exist from the directory where I run my app.

I tried find as well on entire system:

find / -name 'core*'      find / -name '*apport*'  

I also checked different folders:

ls /var/cache/abrt  ls: cannot access /var/cache/abrt: No such file or directory  ls /var/crash  ls: cannot access /var/crash: No such file or directory  ls /var/spool/abrt  ls: cannot access /var/spool/abrt: No such file or directory  cat /var/log/apport.log  cat: /var/log/apport.log: No such file or directory  

No result in:

ls /var/lib/systemd/coredump/  

For the following solution: To remedy the problem, we need to make sure apport writes core dump files for non-package programs as well. To do so, create a file named ~/.config/apport/settings with the following contents: [main] unpackaged=true

cd ~/.config/apport/  cd: /opt/front/arena/.config/apport/: No such file or directory  

For the solution: If you're missing core dumps for binaries on RHEL and when using abrt, make sure that /etc/abrt/abrt-action-save-package-data.conf contains ProcessUnpackaged = yes

cd /etc/abrt  cd: /etc/abrt: No such file or directory  

I think I am running out of options. Thanks

Calculating specific average

Posted: 08 Apr 2021 08:45 AM PDT

I have a log with a long variable string and I am trying to get min, max and average from a number.

String examples

date time from Time: 100 ms to status code:   date time Time: 1050 ms status code IP  date time IP Time: 2 ms status code destination  

"Time: * ms" is constant in every line but the field location is changing. I would need that ms number max, min and average.

How do I find out if a device is supported by Debian?

Posted: 08 Apr 2021 09:16 AM PDT

I couldn't install Debian on my laptop, because "No Ethernet card was detected". I'm hoping to try installation again when the driver is supported by Debian officially, but how do I find out when it is ready?

Currently I can find only https://wiki.debian.org/DeviceDatabase/PCI and https://www.debian.org/releases/buster/amd64/ch02s01.en.html but I don't see much relevant information there.

(the Ethernet card is Intel Corporation Ethernet Connection (13) I219-V (rev 20))

Command/script to start a terminal, enter text but don't execute (wait for text to be written, pasted etc)

Posted: 08 Apr 2021 10:38 AM PDT

I often

  1. write commands in the terminal that I don't know by heart, and then

  2. paste some path or file name from clipboard, before pressing Enter.

I thought that it would be fun to do the first part with one shortcut and then just paste, achieving the above with key actions.


Based on this answer under "How to assign a certain keyboard shortcut to paste specific item?" I have added to a shortcut bash -c "xsel -ib <<< 'MY_COMMAND'" which sends a command to clipboard. But oddly, when pasting that in terminal the command is automatically executed, because a space or Enter is present at the end:

enter image description here

how to sum first N numbers of a line

Posted: 08 Apr 2021 07:29 AM PDT

i have a file with a client name like client1.txt with first line represents the salary of client per month, second line represents the costs that he have per month.

> 80  >> 12 10 19 20 18 16 18 7 9 3 7 11  

then i have to calculate the sum of the first 6 numbers of second line which represents the emergency fond(EF). then i want to put the value of emergency fond (EF) and the number of months that client 1 can acheieve the EF with his salary in a new line. (a third line in his file client.txt)

> 80   >> 22 10 19 20 18 16 18 7 9 3 7 11  >>> 89 5  

that s how client1.txt need to look after i run the program. and the file client1.txt is giving as parameter.

Reading TTY does not work with cat

Posted: 08 Apr 2021 07:34 AM PDT

I have a /dev/ttyUSB6 device (modem) which I was able writing to and reading from like so:

stty -F /dev/ttyUSB6 speed 9600 line 0 -brkint -imaxbel -echo  echo "ATI" > /dev/ttyUSB6  cat /dev/ttyUSB6  

cat would give me here the response to my sent string ATI.

However, after upgrading the kernel from 3.x to 5.x this does not work anymore. If I execute the commands above I get stuck on cat forever, it won't return a response. BUT if I open another terminal and run cat /dev/ttyUSB6 on it and on another terminal I concurrently execute echo "ATI > /dev/ttyUSB6 I get the response on the terminal where cat is running.

What am I missing here? Is there a kernel config parameter I missed to set/unset to get previous behaviour?

mariadb fails to start on raw drive filesystem

Posted: 08 Apr 2021 07:51 AM PDT

I have a Debian 10 machine having it's large virtual drive formatted without a partition. It comes up as /dev/sdb in a df. The instance of mariadb had been in /var/lib/mysql as standard for Debian 10, but I frequently fill the root filesystem up with Bin logs due to replication. I am moving it to my large /dev/sdb filesystem to alleviate this problem.

In moving it to the mount point of /dev/sdb (/usr/www1/), I created a mysql directory matching the permissions exactly and "rsync -avzh" the files to this new /usr/www1/mysql directory and change the datadir in the mariadb server conf file. When I attempt to start it, I get the following logged error

2021-04-07 15:26:28 0 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 30 "Read-only file system")  2021-04-07 15:26:28 0 [ERROR] Aborting  

The common solution I've seen is to add an alias to apparmor which I did, but on closer examination, the MariaDB profile for apparmor is empty and has comments to suggest apparmor no longer tracks permissions for mariadb due to it providing very little value, but creates too many problems for mariadb users (or something to that effect). The change didn't help, but that suggested that this isn't my problem.

I've double checked the permissions repeatedly and even tried tightening and loosening permissions with the same results.

I'm now concerned that since the drive is not formatted with a conventional partition, that mariadb will not start on a drive formatted in this fashion and sees it as read-only. The system does not see it as read-only as shown in this lsblk:

NAME   MAJ:MIN RM    SIZE RO TYPE MOUNTPOINT  sda      8:0    0     75G  0 disk   ├─sda1   8:1    0    512M  0 part /boot/efi  ├─sda2   8:2    0   58.5G  0 part /  ├─sda3   8:3    0     16G  0 part [SWAP]  └─sda4   8:4    0 1007.5K  0 part   sdb      8:16   0      1T  0 disk /usr/www1  sr0     11:0    1   14.1M  0 rom    

Is it possible that mariadb uses a different method of checking the file system it is going to start on, and misinterprets it as read-only. Do I need to rebuild this drive with a partition before it can work with mariadb?

Edit to add requested information:

/etc/fstab entry for mount:

/dev/sdb /usr/www1 ext3 defaults,errors=remount-ro 0 1  

This filesystem has worked for our apache2 serving horrendous numbers of pages this year so it would seem that most software doesn't see it as read-only. It was quite by accident that it ended up formatted this way. I hadn't used linux before putting up these servers and followed a cookbook that must have been for USB drives.

apparmor log had normal entries but no DENIED messages. It always starts with 5 messages about redirections that must be standard. It is in syslog.

Wifi Not Found Fedora 33

Posted: 08 Apr 2021 10:08 AM PDT

I upgraded my Fedora 32 to Fedora 33 and lost my WiFi. Says Wifi Adapters Not Found

bash-5.0# lspci -knn | grep Net -A2  03:00.0 Network controller [0280]: Intel Corporation Wireless 8265 / 8275 [8086:24fd] (rev 78)      Subsystem: Intel Corporation Dual Band Wireless-AC 8265 [8086:1010]      Kernel modules: iwlwifi, wl    # dmesg | egrep -i "iwl|firmware"  [    0.184654] Spectre V2 : Enabling Restricted Speculation for firmware calls  [    0.516378] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored  [    3.694241] [Firmware Bug]: No valid trip found  [    5.654544] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)  [   26.770862] iwlwifi 0000:03:00.0: enabling device (0000 -> 0002)  [   26.773171] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-36.ucode failed with error -2  [   26.773185] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-35.ucode failed with error -2  [   26.773196] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-34.ucode failed with error -2  [   26.773224] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-33.ucode failed with error -2  [   26.773243] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-32.ucode failed with error -2  [   26.773258] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-31.ucode failed with error -2  [   26.773269] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-30.ucode failed with error -2  [   26.773279] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-29.ucode failed with error -2  [   26.773291] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-28.ucode failed with error -2  [   26.773302] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-27.ucode failed with error -2  [   26.773313] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-26.ucode failed with error -2  [   26.773324] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-25.ucode failed with error -2  [   26.773335] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-24.ucode failed with error -2  [   26.773346] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-8265-23.ucode failed with error -2  [   26.901477] iwlwifi 0000:03:00.0: loaded firmware version 22.361476.0 8265-22.ucode op_mode iwlmvm  [   26.901559] iwlwifi 0000:03:00.0: Direct firmware load for iwl-debug-yoyo.bin failed with error -2  [   27.172729] iwlwifi 0000:03:00.0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230  [   27.231103] iwlwifi 0000:03:00.0: base HW address: d4:6d:6d:9e:a0:52  [   27.310244] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'  [   27.987541] Bluetooth: hci0: Minimum firmware build 1 week 10 2014  [   28.054367] Bluetooth: hci0: Found device firmware: intel/ibt-12-16.sfi  [   28.398831] iwlwifi 0000:03:00.0 wlp3s0: renamed from wlan0  [   29.614273] Bluetooth: hci0: Waiting for firmware download to complete  [   29.614558] Bluetooth: hci0: Firmware loaded in 1590392 usecs  [   29.661485] Bluetooth: hci0: Firmware revision 0.1 build 50 week 12 2019  [  488.919600] iwlwifi 0000:03:00.0: No beacon heard and the time event is over already...  [  506.024996] iwlwifi 0000:03:00.0: No beacon heard and the time event is over already...  

I have tried installing broadcom-wl but seems not to work. I am not sure what to do.

Insert Zero Before and After a data point

Posted: 08 Apr 2021 08:42 AM PDT

I need a script that inserts a zero before and after each data point. I am trying to do this in Ubuntu.

Example:

1  2  3  4  5  

What I need:

0  1  0  0  2  0  0  3  0  0  4  0  0  5  0  

Why I can't connect to postgres in docker?

Posted: 08 Apr 2021 09:38 AM PDT

I used docker-compose from this project. Both docker containers were launched successfully.

kshnkvn@kshnkvn-vb:~$ docker ps  CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                    NAMES  10fafbab73dc        openpoiservice_gunicorn_flask   "/ops_venv/bin/gunic…"   23 minutes ago      Up 22 minutes       0.0.0.0:5000->5000/tcp   openpoiservice_gunicorn_flask_1  a66fe5691455        kartoza/postgis:11.0-2.5        "/bin/sh -c /docker-…"   23 minutes ago      Up 22 minutes       5432/tcp                 openpoiservice_psql_postgis_db_1  

But when trying to check the service for functionality - he could not connect to the database. I tried to do it manually:

kshnkvn@kshnkvn-vb:~$ docker exec -it 10fafbab73dc /bin/bash  root@10fafbab73dc:/deploy/app# psql -h localhost -U gis_admin-gis  psql: could not connect to server: Connection refused      Is the server running on host "localhost" (127.0.0.1) and accepting      TCP/IP connections on port 5432?  could not connect to server: Cannot assign requested address      Is the server running on host "localhost" (::1) and accepting      TCP/IP connections on port 5432?  root@10fafbab73dc:/deploy/app#   

Strange, checked just in case that the type of container network is the bridge:

kshnkvn@kshnkvn-vb:~$ docker network ls  NETWORK ID          NAME                         DRIVER              SCOPE  81001dac99c0        bridge                       bridge              local  8e65fb4ef6f8        host                         host                local  94ce4e1605ef        none                         null                local  a3f48ac3facc        openpoiservice_default       bridge              local  e3d4286df013        openpoiservice_poi_network   bridge              local    

Checked postgres launch logs:

kshnkvn@kshnkvn-vb:~$ docker logs a66fe5691455  Add rule to pg_hba: 0.0.0.0/0  Add rule to pg_hba: replication replicator   Setup master database  psql: could not connect to server: No such file or directory      Is the server running locally and accepting      connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?  2020-02-08 13:50:20.675 UTC [25] LOG:  listening on IPv4 address "127.0.0.1", port 5432  2020-02-08 13:50:20.683 UTC [25] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  2020-02-08 13:50:20.756 UTC [37] LOG:  database system was interrupted; last known up at 2020-02-08 13:35:17 UTC  2020-02-08 13:50:21.830 UTC [48] postgres@postgres FATAL:  the database system is starting up  psql: FATAL:  the database system is starting up  2020-02-08 13:50:22.726 UTC [37] LOG:  database system was not properly shut down; automatic recovery in progress  2020-02-08 13:50:22.730 UTC [37] LOG:  redo starts at 0/21CCC50  2020-02-08 13:50:22.730 UTC [37] LOG:  invalid record length at 0/21CCC88: wanted 24, got 0  2020-02-08 13:50:22.730 UTC [37] LOG:  redo done at 0/21CCC50  2020-02-08 13:50:22.867 UTC [25] LOG:  database system is ready to accept connections                                List of databases     Name    |   Owner   | Encoding | Collate |  Ctype  |   Access privileges     -----------+-----------+----------+---------+---------+-----------------------   gis       | gis_admin | UTF8     | C.UTF-8 | C.UTF-8 |    postgres  | postgres  | UTF8     | C.UTF-8 | C.UTF-8 |    template0 | postgres  | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +             |           |          |         |         | postgres=CTc/postgres   template1 | postgres  | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +             |           |          |         |         | postgres=CTc/postgres  (4 rows)    postgres ready  Setup postgres User:Password  Creating superuser gis_admin  ALTER ROLE  Creating replication user replicator  ALTER ROLE  gis db already exists                                List of databases     Name    |   Owner   | Encoding | Collate |  Ctype  |   Access privileges     -----------+-----------+----------+---------+---------+-----------------------   gis       | gis_admin | UTF8     | C.UTF-8 | C.UTF-8 |    postgres  | postgres  | UTF8     | C.UTF-8 | C.UTF-8 |    template0 | postgres  | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +             |           |          |         |         | postgres=CTc/postgres   template1 | postgres  | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +             |           |          |         |         | postgres=CTc/postgres  (4 rows)    2020-02-08 13:50:24.785 UTC [25] LOG:  received smart shutdown request  2020-02-08 13:50:24.799 UTC [25] LOG:  background worker "logical replication launcher" (PID 58) exited with exit code 1  2020-02-08 13:50:24.801 UTC [53] LOG:  shutting down  2020-02-08 13:50:24.838 UTC [25] LOG:  database system is shut down  Postgres initialisation process completed .... restarting in foreground  2020-02-08 13:50:25.842 UTC [148] LOG:  listening on IPv4 address "0.0.0.0", port 5432  2020-02-08 13:50:25.842 UTC [148] LOG:  listening on IPv6 address "::", port 5432  2020-02-08 13:50:25.850 UTC [148] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  2020-02-08 13:50:25.880 UTC [150] LOG:  database system was shut down at 2020-02-08 13:50:24 UTC  2020-02-08 13:50:25.887 UTC [148] LOG:  database system is ready to accept connections    

It looks like the postgre started on ip 0.0.0.0

I looked at what ip are used by the docker ip addr show command. Tried to reconnect using this ip:

psql: could not connect to server: Connection refused      Is the server running on host "172.17.0.1" and accepting      TCP/IP connections on port 5432?  root@10fafbab73dc:/deploy/app# psql -h 172.17.255.255 -U gis_admin-gis  psql: could not connect to server: Connection timed out      Is the server running on host "172.17.255.255" and accepting      TCP/IP connections on port 5432?  

What can I try to do to connect the script to the database?

Host configured with both resolvconf and dnsmasq, restarting dnsmasq keeps pointing to old servers

Posted: 08 Apr 2021 07:39 AM PDT

I have an Ubuntu 16.04.2 LTS host. It is configured to use dnsmasq for DNS forwarding, rather than use resolv.conf populated with nameservers. The configuration is standard wherein resolv.conf just has:

nameserver 127.0.0.1  search redacted.searchfield.com  

The host's configured /etc/resolv.dnsmasq has 4 nameservers configured. When I restart the dnsmasq service, it points to 3 nameservers that were configured on the host at one time (but no longer), and writes them automatically to /var/run/dnsmasq/resolv.conf, ignoring the 4 defined nameservers in /etc/resolv.dnsmasq.

I can get the service to properly read the correct nameservers if I enter the four of them in /var/run/dnsmasq/resolv.conf and leave the dnsmasq service running. However, if I restart the service it just points to these 3 old nameservers again.

Is this cached somewhere? I'm not using nscd here. I'm wondering if maybe the resolvconf service is causing an issue, and should not be run alongside dnsmasq?

Apply Colors to Terminal Output to highlight URL & Others

Posted: 08 Apr 2021 10:53 AM PDT

I am looking for a way to apply colors to highlight URLs (http://....) and IP @ in the output of a terminal command.

Example would be with a wget command for example where I would like to be able to output URLs in a particular color so that it is easier to read.

Best would be to be able to do the same for IP@ and other important info to standout.

I have been struggling with this for a while and not able to find a solution.

I use iTerm 2 on MAC with oh-my-zsh

No way to record a live stream to WebM using ffmpeg?

Posted: 08 Apr 2021 09:03 AM PDT

I'm streaming from an mp4 source and so far I've managed to save clips as ogg (video: libtheora, audio: flac), but I'd like to save them in the WebM format. Unfortunately, WebM demands libvorbis for audio and when I try to do that:

$ ffmpeg -t 60 -rtsp_transport udp -i rtsp://192.168.1.142/video.mp4 -vcodec libvpx -acodec libvorbis -f webm test.webm  ffmpeg version 0.10.5 Copyright (c) 2000-2012 the FFmpeg developers    built on Oct  4 2012 19:17:43 with gcc 4.7.2 20120921 (Red Hat 4.7.2-2)    configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect    libavutil      51. 35.100 / 51. 35.100    libavcodec     53. 61.100 / 53. 61.100    libavformat    53. 32.100 / 53. 32.100    libavdevice    53.  4.100 / 53.  4.100    libavfilter     2. 61.100 /  2. 61.100    libswscale      2.  1.100 /  2.  1.100    libswresample   0.  6.100 /  0.  6.100    libpostproc    52.  0.100 / 52.  0.100  [rtsp @ 0xc62ec0] Estimating duration from bitrate, this may be inaccurate  Input #0, rtsp, from 'rtsp://192.168.1.142/video.mp4':    Metadata:      title           : QStream      comment         : QStreaming Media    Duration: N/A, start: 0.000000, bitrate: N/A      Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr, 90k tbn, 30 tbc      Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s  File 'test.webm' already exists. Overwrite ? [y/N] y  w:640 h:480 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:  [libvpx @ 0xc60b60] v1.0.0  [libvorbis @ 0xc61da0] Unable to set CBR to 128000: not supported  [libvorbis @ 0xc61da0] oggvorbis_encode_init failed  Output #0, webm, to 'test.webm':    Metadata:      title           : QStream      comment         : QStreaming Media      Stream #0:0: Video: vp8, yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 200 kb/s, 90k tbn, 30 tbc      Stream #0:1: Audio: vorbis, 8000 Hz, 1 channels, s16, 128 kb/s  Stream mapping:    Stream #0:0 -> #0:0 (mpeg4 -> libvpx)    Stream #0:1 -> #0:1 (pcm_mulaw -> libvorbis)  Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height  

The only way I found to encode audio in a WebM file using ffmpeg is here, but that requires two passes, so I can't do it with a live stream. Any clues?

No comments:

Post a Comment