Monday, November 22, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


virtual machine doesn't use allocated disk space

Posted: 22 Nov 2021 06:04 AM PST

I am running manjaro in an Oracle VirtualBox to test a virgin install of a set of softwares. I am getting an error that there is no more disk space on a particular download, however, when I set up the vm in the VirtualBox Manager, I am allocating it plenty of space (> 100GB). I have tried changing this from dynamic allocation to a fixed partition, but this did not solve the issue.

When I run lsblk, this is the output:

NAME  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS  loop0   7:0    0 130.6M  1 loop /run/miso/sfs/livefs  loop1   7:1    0 581.9M  1 loop /run/miso/sfs/mhwdfs  loop2   7:2    0   1.5G  1 loop /run/miso/sfs/desktopfs  loop3   7:3    0 702.8M  1 loop /run/miso/sfs/rootfs  sda     8:0    0   134G  0 disk   sr0    11:0    1   2.9G  0 rom  /run/miso/bootmnt  

So to me it looks like the 134gb partition needs to be mounted?

I run sudo fdisk -l to see where it is:

Disk /dev/sda: 134.01 GiB, 143895691264 bytes, 281046272 sectors  Disk model: VBOX HARDDISK     Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes      Disk /dev/loop0: 130.6 MiB, 136945664 bytes, 267472 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes      Disk /dev/loop1: 581.94 MiB, 610209792 bytes, 1191816 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes      Disk /dev/loop2: 1.47 GiB, 1582903296 bytes, 3091608 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes      Disk /dev/loop3: 702.77 MiB, 736907264 bytes, 1439272 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes    

I am running the installs from my $HOME directory (which in this case is /home/manjaro), so I try sudo mount /dev/sda /home/manjaro, and this is the output:

mount: /home/manjaro: wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error.  

Let me know your thoughts. Thanks.

Alacritty Desktop Entry doesn't show on GNOME 41.1 / Fedora 35

Posted: 22 Nov 2021 05:37 AM PST

I followed this guide on how to add a Desktop Entry for Alcritty with GNOME and it worked correctly.

Recently, after updating some dependencies, I noticed it disappeared from the GNOME Applications Menu. After looking through the dnf history, I found out that orca was upgraded to 41.0-2, wireplumber to 0.4.5-3 and wireplumber-libs to 0.4.5-3.

I tried changing Exec to an absolute path - nothing. I tried changing the icon to PNG instead of SVG - again, nothing.

This is my current Alacritty.desktop file:

[Desktop Entry]  Type=Application  TryExec=alacritty  Exec=alacritty  Icon=Alacritty  Terminal=false  Categories=System;TerminalEmulator;    Name=Alacritty  GenericName=Terminal  Comment=A fast, cross-platform, OpenGL terminal emulator  StartupWMClass=Alacritty  Actions=New;    X-Desktop-File-Install-Version=0.26    [Desktop Action New]  Name=New Terminal  Exec=alacritty  

How to disable fingerprint authentication when laptop lid is closed?

Posted: 22 Nov 2021 05:29 AM PST

I recently managed to make fingerprint authentication work on my laptop, thanks to the Goodix Linux Development discord community and the github users Infinytum and Michael Teuscher on the driver/538d branch on https://github.com/infinytum/libfprint/tree/driver/538d.

But after enabling fingerprint for login with fprintd-enroll and for sudo access with sudo pam-auth-update I noticed a problem:

Whenever I am using an external monitor to work, and the lid is closed, I have to wait for the fingerprint authentication to time out, before being able to type the sudo password, which causes a delay of several seconds:

username@host:~/ron/libfprint$ sudo ls  Place your finger on the fingerprint reader  Place your finger on the reader again  Place your finger on the reader again  Place your finger on the reader again  Verification timed out  [sudo] password for username:  

How can I disable fingerprint authentication when the laptop lid is closed, so I can type the sudo password without waiting for the fingerprint to time out?

Accounting with pam_radius

Posted: 22 Nov 2021 04:40 AM PST

How can Implement accounting on a unix system using pam_radius ? pam_radius configuration is easy for authentication.

But I confused to find a way for accounting.

In accounting we send some AVP's to 1813 port of radius server. However how can I do this method on pam_radius ?

For example I have following config on /etc/pam.d/radius :

auth        sufficient      pam_radius_auth.so  account     sufficient      pam_radius_auth.so  session     sufficient      pam_radius_auth.so  password    sufficient      pam_radius_auth.so  

And test my config with pamtester :

pamtester radius ali authenticate  Password:   pamtester: successfully authenticated  

Radius server already running and authentication was successful.

But where is accounting on pam_radius module ?

How to get ifstat outputs in python?

Posted: 22 Nov 2021 04:37 AM PST

Trying to get the values from ifstat -i wlx88366cfd0226 command in a Python script. I have tried this but not getting its output.

The full code is:

import subprocess  import time  import argparse    parser = argparse.ArgumentParser(description='Display WLAN signal strength.')  parser.add_argument(dest='interface', nargs='?', default='wlx88366cfd0226',                      help='wlan interface (default: wlx88366cfd0226)')  args = parser.parse_args()    print ('\n---Press CTRL+Z or CTRL+C to stop.---\n')    while True:      cmd = subprocess.Popen('ifstat -i wlx88366cfd0226' , shell=True,                             stdout=subprocess.PIPE) #bytes        # print "cmd.stdout",cmd.stdout      for line in cmd.stdout:          print (line)          time.sleep(1)  

The code output is nothing.

When I run ifstat in the terminal I got this:

      enp3s0         wlx88366cfd0226     KB/s in  KB/s out   KB/s in  KB/s out      0.00      0.00      0.59      0.63      0.00      0.00      0.61      0.18      0.00      0.00      0.37      0.29      0.00      0.00      1.20      1.08      0.00      0.00     14.23     11.12      0.00      0.00      1.85      1.78  

When I run ifstat -i wlx88366cfd0226 in the terminal I got this:

redhwan@redhwan:~$ ifstat -i wlx88366cfd0226   wlx88366cfd0226     KB/s in  KB/s out      0.18      0.34      1.38      4.58      1.39      0.99  

I find the interface in my case: wlx88366cfd0226 from,

redhwan@redhwan:~$ iwconfig  wlx88366cfd0226  IEEE 802.11AC  ESSID:"Hlab_linksys"  Nickname:"<WIFI@REALTEK>"            Mode:Managed  Frequency:5.785 GHz  Access Point: C4:41:1E:E5:86:F6               Bit Rate:867 Mb/s   Sensitivity:0/0              Retry:off   RTS thr:off   Fragment thr:off            Power Management:off            Link Quality=95/100  Signal level=74/100  Noise level=0/100            Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0            Tx excessive retries:0  Invalid misc:0   Missed beacon:0    enp3s0    no wireless extensions.    lo        no wireless extensions.  

What is wrong with my code?

please help?

How to stop the gnome-keyring on Slackware?

Posted: 22 Nov 2021 04:28 AM PST

My syslog is full of those messages

Nov 22 13:14:36 virtuale-2 gnome-keyring-daemon[2413]: couldn't create socket directory: /root/.cache/keyring-CI8ZC1: Permission denied  Nov 22 13:14:36 virtuale-2 gnome-keyring-daemon[2413]: couldn't bind to control socket: /root/.cache/keyring-CI8ZC1/control: Permission denied  Nov 22 13:14:40 virtuale-2 gnome-keyring-daemon[2421]: couldn't create socket directory: /root/.cache/keyring-LQDED1: Permission denied  Nov 22 13:14:40 virtuale-2 gnome-keyring-daemon[2421]: couldn't bind to control socket: /root/.cache/keyring-LQDED1/control: Permission denied  

The process didn't exist!

pgrep -a keyr  pgrep -a gnome  

Impossible to find from where it came

grep -irl gnome-keyring-daemon /etc  

How to stop it?

Capture output of systemd-run --scope to journal

Posted: 22 Nov 2021 03:32 AM PST

For improved traceability, accountability, etc., I want certain applications to be supervised by systemd and have their output collected in the journal. I know that this all happens automatically when I use systemd-run's service mode, but due to dependence on the calling environment, this is sometimes not possible.

I have tried using systemd-run and systemd-cat together, but have found that it sadly fails to capture the unit metadata. I know I could theoretically dump the environment variables to a file with env before starting the process and then pass that as EnvironmentFile= to systemd-run, but that seems like a hack. It also fails if there is other data in the execution environment than variables that are needed, such as file descriptors, although that's a relatively rare requirement, as shell pipes, the most common type of shared file descriptor, can usually be replaced with temporary named pipes or files.

I'm not unwilling to use the hacky approach; I'm just wondering if there is a "known good" alternative to it

match a part of a string and print the whole string

Posted: 22 Nov 2021 05:42 AM PST

A command on my Ubuntu system prints the following output and I'm saving the output into a variable $problem_dbs:

tacservices/e43ccb05-5b0a-4403-950b-9c91ed3f3694 unresponsive agent z1 10.213.197.77 tac-nightly-test tacservices/54be8202-2304-462e-8574-1aef379160d9 failing z1 10.213.204.228 tac-Trip-test  

I want to search and print the string that starts with 'tac-*':

tac-nightly-test  tac-Trip-test  

I've tried:

echo $problem_dbs | sed -n -e 's/^.*\(tac-\)/\1/p'  

but it only prints tac-Trip-test

Am I missing something?

Deny access to only one user to a file

Posted: 22 Nov 2021 03:34 AM PST

I recently had this question at a test for a Linux certification. How do you do this?

  1. Copy file /etc/fstab to /tmp/fstab_bck and make sure it's owned by root and group is root.

    I know how to do this.

  2. Make sure user X does not have access.

  3. Make sure user Y has access to view. Make sure that all other newly created users have access to view this file.

Execute POST request from Alpine container

Posted: 22 Nov 2021 04:05 AM PST

I want to execute a POST request with custom headers over HTTPS from a pod in our kubernetes cluster, which is running openjdk11-jre with alpine as base image (adoptopenjdk/openjdk11:jre-11.0.11_9-alpine to be exact).

With this image curl or wget are not available and nc doesn't support HTTPS. I already tried to achieve something with jrunscript which comes with the jre but was only able to send a GET with cat('https://example.com').

Of course one way would be to copy an executable or a compiled Java class into the pod, over which I could send the request but I'd prefer a one-liner that is ready to go.

How to add mega repo in Arch Linux

Posted: 22 Nov 2021 05:14 AM PST

How can I add the Mega repository to Arch Linux?

Already add this in my pacman.conf

[DEB_Arch_Extra]  SigLevel = Required TrustedOnly  Server = https://mega.nz/linux/MEGAsync/Arch_Extra/$arch  

But I am getting this error:

❯ nocorrect sudo pacman -Syyu  [sudo] password for scarlet:  error: DEB_Arch_Extra: signature from "MegaLimited <support@mega.co.nz>" is unknown trust  :: Synchronizing package databases...   kde-unstable                                                     122.0 KiB  74.2 KiB/s 00:02 [#######################################################] 100%   gnome-unstable                                                    45.0   B   109   B/s 00:00 [#######################################################] 100%   core                                                             136.5 KiB   136 KiB/s 00:01 [#######################################################] 100%   extra                                                           1569.9 KiB   716 KiB/s 00:02 [#######################################################] 100%   community                                                          5.8 MiB  1737 KiB/s 00:03 [#######################################################] 100%   multilib                                                         148.2 KiB   136 KiB/s 00:01 [#######################################################] 100%   archzfs                                                           14.1 KiB  16.4 KiB/s 00:01 [#######################################################] 100%   DEB_Arch_Extra                                                     3.1 KiB  2.51 KiB/s 00:01 [#######################################################] 100%  error: DEB_Arch_Extra: signature from "MegaLimited <support@mega.co.nz>" is unknown trust  error: failed to synchronize all databases (invalid or corrupted database (PGP signature))                                                            /17.4s  

My system:

❯ uname -a  Linux lenovo 5.15.3-arch1-1 #1 SMP PREEMPT Thu, 18 Nov 2021 22:23:08 +0000 x86_64 GNU/Linux                                                            /0.1s  

What I have tried:

Point out my mistake while converting TIFF to PNG/JPG

Posted: 22 Nov 2021 04:01 AM PST

This is a input tiff image, which I want to convert to JPG/PNG.

enter image description here

As general rule of thumb, I always use following command to convert between 2 image formats (mainly JPG to PNG ). convert input.jpg out.png

But:

convert input.tiff out.png  

produces following image. Could you point out why convert TIF to PNG is not working properly. Is this something to do with colorspace/compressions?

enter image description here

Just in case: $identify input.tiff gives

input.tiff TIFF 640x480 640x480+0+0 8-bit YCbCr 619120B 0.000u 0:00.000  

Execute single command with write caching disabled

Posted: 22 Nov 2021 04:32 AM PST

Whenever I write a large file to a USB drive, write caching makes it very difficult to track process. I can disable it in various ways like cat 1000000 > /proc/sys/vm/dirty_bytes which solves the problem. However then I also have to re-enable the old setting (or reboot).

How can I tell my system to bypass the dirty bytes entirely for a single write command? For example, something like:

DIRTYBYTES=nope pv file.bin > /dev/sdb1  

Or

pv file.bin | cache_buster > /dev/sdb1  

To clarify: The current behavior of pv file.bin > /dev/sdb1 is that the meter shoots to 100% immediately, and then the command hangs waiting for the USB to actually finish writing. Instead, I want to modify the command and make the meter gradually increase at about the correct write rate of the USB drive, without altering the dirty bytes etc settings in such a way that the next command will also bypass the cache.

Ensure only one instance of script is running?

Posted: 22 Nov 2021 05:32 AM PST

Code:

if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then exit; fi  

Original source of the code: https://forum.rclone.org/t/continuous-syncing/12377/2

I don't understand how this code inside a bash scrip ensure only one instance of the bash script is running.

I understand the part pidof -x $(basename $0) retrieve the process ID of the script but I don't understand what the part -o %PPID used for.

Question: Do anyone know how the code working?

Why do I get the error "... version `Qt_5.8' not found ..." when trying to run "4k Video Downloader"?

Posted: 22 Nov 2021 05:36 AM PST

Summary

1. I've just installed the 32-bit version of the "4k Video Downloader" package into /opt/4kvideodownloader/

using the instructions at

https://www.click4infos.com/install-4k-video-downloader/

The main steps that I followed on that webpage are 4 and 8. As instructed, I have put the downloaded and unzipped directories and files in

/opt/4kvideodownloader/

2. a) But when I run 4kvideodownloader, I get the following error:

$ /opt/4kvideodownloader/4kvideodownloader-bin  /opt/4kvideodownloader/4kvideodownloader-bin:  /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not found  (required by /opt/4kvideodownloader/4kvideodownloader-bin)  /opt/4kvideodownloader/4kvideodownloader-bin:  /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not found  (required by /opt/4kvideodownloader/libQt5Script.so.5)  /opt/4kvideodownloader/4kvideodownloader-bin:  /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not found  (required by /opt/4kvideodownloader/libQt5Widgets.so.5)  /opt/4kvideodownloader/4kvideodownloader-bin:  /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not found  (required by /opt/4kvideodownloader/libQt5Xml.so.5)  $  

b) Also, "$ konsole" will no longer launch from a terminal, but gives similar output to the above ("a)"). See Full Details "6.".

3. I wondered if doing step "8" of the "www.click4infos.com" instructions at "1." above has caused the problem. Step 8 says

Add the program libraries to the system;

$ sudo ldconfig /opt/4kvideodownloader/

4. My Question:

I'm out of my depth with this, so could you tell me what is wrong, and what I need to do to make 4kvideodownloader run OK (and make "konsole" launch as it did before)?

Full Details

5. I downloaded the 32-bit 4kvideodownloader from

https://downloads2.4kdownload.com/app/4kvideodownloader_4.3_i386.tar.bz2

6. Launching "konsole" from a terminal worked fine before installing 4kvideodownloader. But now, I get an error similar to the one that occurs when running 4kvideodownloader, as follows:

$ konsole  konsole: /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not  found (required by /opt/4kvideodownloader/libQt5Widgets.so.5)  konsole: /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not  found (required by /opt/4kvideodownloader/libQt5DBus.so.5)  konsole: /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5: version `Qt_5.8' not  found (required by /opt/4kvideodownloader/libQt5Xml.so.5)  $  

7. I'm wondering if the error at "2.a)" in the Summary, namely "version `Qt_5.8' not found" is a red herring. This is because I THOUGHT I'd seen a library name relating to 4kvideodownloader of something like libQt5Core.so.5.6 somewhere on my filesystem. I believe that the appended ".6" is the so-called "minor number".

So wouldn't this suggest that the libraries supplied with the 4kvideodownloader installation are Qt version 5.6 (ie correct), and not 5.8?

8. /opt/4kvideodownloader/ contains

$ ls -1 --indicator-style=slash --group-directories-first /opt/4kvideodownloader    audio/  doc/  imageformats/  platforminputcontexts/  platforms/  translation/  xcbglintegrations/  4kvideodownloader-bin  4kvideodownloader.sh  libavcodec.so.56  libavformat.so.56  libavutil.so.54  libcrypto.so.1.0.0  libicudata.so.52  libicui18n.so.52  libicuuc.so.52  libmp3lame.so.0  libportaudio.so.2  libQt5Concurrent.so.5  libQt5Core.so.5  libQt5DBus.so.5  libQt5Gui.so.5  libQt5Script.so.5  libQt5ScriptTools.so.5  libQt5Widgets.so.5  libQt5XcbQpa.so.5  libQt5Xml.so.5  libssl.so.1.0.0  libswresample.so.1  libswscale.so.3  libx264.so.148  $  

9. The config files related to "ldconfig" are as follows:

$ ls -1 --indicator-style=slash --group-directories-first /etc/ld.so.conf*    /etc/ld.so.conf    /etc/ld.so.conf.d:  atlas.conf  fakeroot-i386-linux-gnu.conf  i386-linux-gnu.conf  libc.conf  zz_amd64-biarch-compat.conf  zz_x32-biarch-compat.conf  $  

All the above files (in this entry "9.") have old modification dates, so it appears that they have not been modified/created as a result of running ldconfig.

10. A website says that the following tells me what my version of Qt is:

$ qmake --version  QMake version 2.01a  Using Qt version 4.8.7 in /usr/lib/i386-linux-gnu  $  

How to setup Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter (rev 31) in Arch Linux?

Posted: 22 Nov 2021 03:27 AM PST

How to install this WiFi adapter in Arch Linux: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter (rev 31)?

Please help as I can't connect to wireless right now...

Is a `preloaded library` warning from `rkhunter` a reason to worry?

Posted: 22 Nov 2021 05:30 AM PST

[17:16:52] Checking for preloaded libraries                [ Warning ]  [17:16:53] Warning: Found preloaded shared library: /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so    ########    #ls /usr/lib/arm-linux-gnueabihf/libarmmem-*  /usr/lib/arm-linux-gnueabihf/libarmmem-aarch64.so  /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so  /usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so      /usr/lib/arm-linux-gnueabihf/libarmmem-v8l.so  

And I have zero idea what that means. I have installed rkhunter on a dirty system so the file hashes are not reliable but that doesn't sound relevant to the above warning.

how to rename files in directorys using unix?

Posted: 22 Nov 2021 05:03 AM PST

How can I rename file with in subdirectories?

I have this sample:

001a      abc001.tif      abc002.tif      abc003.tif  002a      abcd001.tif      abcd002.tif      abcd003.tif  

I want to rename each file in all subdirectories 001 - 00 x and not rename the directory itself. I want to rename the files sequentially starting with 0001 each folder of images start with 1.

This command, when I run it only works on the main folder and not the sub folders. What do I need to change to get it to run recursively on each subdirectory and have each dir start with 1.

for file in $path/*.tif; do         mv -v "${file}" "$path/$(printf "%04d" ${num}).tif"         num=$(( ${num} + 1 ))  done  

The operating system that i am using is OSX

I a looking to drop abc form the the file name. This is just an example. Not every file will start with abc.

I tryed this, it renames but dose not start at one in each sub dir. What can i change to get it to start at one?

num=0  for file in */*.tif; do      echo mv -v "${file}" "$(printf "%04d\n" $num).tif"      (( num++ ))  done  

Cutting off the value of a variable

Posted: 22 Nov 2021 03:39 AM PST

I had wrote a simple script with should read a list of URL string from a file into a variable and prepare it for the future processing.

Content of the dl.txt file:

https://some-url.com/site1  https://some-url.com/site2    and so on...  

Script:

#!/bin/bash    IFS="\n"    while read -a line; do      rl=.${line}        echo -e "\n"      echo $rl      echo -e "\n"    #   for a in ${line}; do  #       echo -e $a  #   done  done <<< $(cat "./dl.txt")  

As the result, the each from the read strings is beeing cut to exactly 10 characters from the begining.

Any idea how to solve it ?

java.net.connectException: Connection Refused by apache

Posted: 22 Nov 2021 05:19 AM PST

Recently we have updated our OS from RHEL 6.10 to RHEL 8.4. After the installation of RHEL 8.4, we installed our application which uses Apache internally. Please note that our application is constantly functioning on RHEL 6.10. When we try to start the services in RHEL 8.4, we are getting a "Connection Refused" error. Please find below error,

enter image description here

Internally, we have redirected the apache port to "8443". But if we check the Listening port, it still uses 80 port only.

enter image description here

Moreover, we have added the below command, and we got "Success" as a result of that same. this also didn't help us to solve the error.

firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8443

Please let us know the workaround solution.

How to re-attach to docker -it after detached?

Posted: 22 Nov 2021 04:09 AM PST

I am running spark from focker docker.io/bitnami/spark:3-debian-10. I can attach to it with

docker exec -it mycontainer bash  

and run some long lasting command. Then I can detach with Ctrl-P, Ctrl-Q.

Now, how to reattach to this very same command? If I issue

docker attach mycontainer  

how can it decide, whether attach to spark startup script or to my command I ran when I was doing exec?

If I issue this command, I am entering unknown console, where I see nither signs of my program, nor spark. I can't stop anything with Ctrl-C and I can't detach again with Ctrl-P, Ctrl-Q. I can only stop container from parallel terminal.

What I am doing wrong?

Does FSCK repair / mark bad sectors as it scans and, is it possible to resume a scan from an offset?

Posted: 22 Nov 2021 05:05 AM PST

System: macOS 10.14.6

Overview:

One of the HDD in the system was giving issues and I suspected the old disk was dying. I wanted to check for bad sectors on it. It uses the Mac OS Extended (Journaled) filesystem. So I started a scan of the disk with fsck_hfs:

bash-3.2# fsck_hfs -S -E /dev/disk0  

But even after more than 12-13 hours overnight it had only scanned around 66% of the 1TB drive:

** /dev/rdisk0 (NO WRITE)    Scanning entire disk for bad blocks    Scanning offset 6615812001408 of 1000204886016 (66%)  

and I had to interrupt it as the system was needed.

Doubts:

  1. Does FSCK mark the bad sectors as it scans for it (or does it do it only do this after the scan is complete?)

  2. If the first case is true, is there any option to resume scanning from the offset specified in the status message (i.e from block 6615812001408)?

  3. Is there any better system tools to scan disks for bad sectors which supports resume if the operation has to be interrupted?

Batch set MP4 create date metadata from filename

Posted: 22 Nov 2021 05:11 AM PST

On a Linux system, I have a bunch of MP4 files named like 20190228_155905.mp4 but with no metadata. I've previously had a similar problem with some jpg's which I solved manually with

exiv2 -M"set Exif.Photo.DateTimeOriginal 2018:09:18 20:11:04" 20180918_201104.jpg  

but as far as I can see, the DateTimeOriginal is only for images, not videos. Videos that do have metadata have a Xmp.video.MediaCreateDate field that seems like what I want. I guess it contains a Unix timestamp, so I'd need a way to get the date from the filename, convert it to a Unix timestamp and set that value to Xmp.video.MediaCreateDate. Is that all correct? Or am I overcomplicating things?

Edit: If I wasn't clear, I want to set creation date metadata on mp4 files using its filename that contains the date, so that programs can sort all my media files by their metadata

Why should parent process wait (to terminate) until all of its child process terminates?

Posted: 22 Nov 2021 04:08 AM PST

I know there is no enforcement for the parent process to wait until all its child process terminates. However it's a convention followed. Furthermore, I know that if parent process terminates before it's child process terminates, then the child process become orphan and it will be adopted by init process. But what I don't understand is, what is the problem if the child process becomes orphan and gets adopted by the init process. Why should it be attached to the parent process itself until it terminates?

tcpdump -i any doesn't work on FreeBSD

Posted: 22 Nov 2021 06:19 AM PST

How to listen all interfaces on FreeBSD with tcpdump

> tcpdump -i any  tcpdump: any: No such device exists  (BIOCSETIF failed: Device not configured)  

(I would like to listen ICMP)

Cron Authentication Failure error in Linux?

Posted: 22 Nov 2021 03:25 AM PST

I was bogged with an error "Authentication Failure" for all of my cron jobs in Linux Ubunutu.

root@Test:~# tail -f /var/log/syslog | grep cron  Dec 11 16:38:01 Test cron[14861]: Authentication failure  Dec 11 16:38:01 Test cron[14861]: Authentication failure  Dec 11 16:38:09 Test cron[14957]: (CRON) INFO (pidfile fd = 3)  Dec 11 16:38:09 Test cron[14957]: (CRON) INFO (Skipping@reboot jobs -- not system startup)  Dec 11 16:39:01 Test cron[14957]: Authentication failure  

I try everything but didn't want work , I m using LDAP. Did someone had the same problem ?

Telnet connection had been closed by a foreign host

Posted: 22 Nov 2021 03:23 AM PST

The client PC IP: 10.49.46.5/24 and the server PC IP: 10.49.46.2/24 are two computers linked to the same network. When I try to create an interactive communication between these two computers using the command telnet, I get the following:

[root@xxx:~]# telnet 10.49.46.2  Trying 10.49.46.2...  Connected to 10.49.46.2.  Escape character is '^]'.    Connection closed by foreign host.  [root@xxx:~]#  

The server xinetd.conf are as follows:

    defaults      {              instances               = 60              log_type                = SYSLOG authpriv              log_on_success          = HOST PID EXIT              log_on_failure          = HOST ATTEMPT              cps                     = 25 30      }  includedir /etc/xinetd.d  

The server telnet.config are as follows:

service telnet  {          flags           = REUSE          socket_type     = stream          wait            = no          user            = root          server          = /usr/sbin/telnetd          log_on_failure  += USERID          instances       = 10          disable         = no  }  

The TCPWrapper hosts.allow are:

telnetd: /etc/telnetd.hosts  tfdpd: /etc/tftpd.hosts  sshd: /etc/sshd.hosts  

The TCPWrapper hosts.deny are:

ALL:ALL  

NOW:

  1. I checked ssh and it is running on port 22.
  2. I checked /var/log/message and had found that the command xinetd starts and then exits the telnet immediately.
  3. I checked that iptables do not drop telnet package using the command: iptables -L

Would you please help me figure out what is the problem and how can I fix it?

Why I should avoid loops in shells? [duplicate]

Posted: 22 Nov 2021 05:33 AM PST

The following link recommends against using loops in shells.

bash variables in for loop range

Why is this? Here is an example loop I just happened to be looking at when I came across that answer:

find /etc/postinstall -name '*.sh' | while read script  do    echo Running $script ...    $script    mv $script $script.done  done  

No comments:

Post a Comment