Monday, December 13, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Merge (not concatenate) a video file with audio file

Posted: 13 Dec 2021 06:55 AM PST

I have a video file and an audio file.

Video file: video.mp4

  1. It has video
  2. It has audio

Audio file: background.mp3

  1. It only has audio.

My OS: Ubuntu 16.04. I also have vlc

After searching a lot on web, I am mostly getting solutions to concatenate. I want to merge and not concatenate. In the merged output I want audio of both video.mp4 and background.mp3

I tried this command: ffmpeg -i video.mp4 -i background.mp3 -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -strict -2 output.mp4

The above command was able to do the job to some extent. But the output.mp4 had problems. The background.mp3 audio was too loud, to such an extent that the audio of video.mp4 was not audible. Also the output.mp4 did not complete till end, that is, duration of output.mp4 was less than video.mp4

What is going on with my ethernet interface?

Posted: 13 Dec 2021 06:54 AM PST

I bought a laptop this year, not via this website but from a vendor on Amazon. I cannot connect to the internet via cable and I'm afraid that my network interface is not working correctly for some unknown to me reason.

My environment: Ubuntu Desktop 20.04 LTS (the problem was present on Windows as well - the OS that that laptop was shipped to me). I can connect through the same cable from another laptop. WiFi works fine on this laptop.

I ran ip l to identify the name of the interface in question and got the following output:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  2: enp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000      link/ether 18:c0:4d:0f:14:0d brd ff:ff:ff:ff:ff:ff  3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group   

I've trimmed the last line of the output in order to avoid doxing the details of my wireless interface. Having identified the name of the interface in question as enp3s0 I then proceeded further with my investigation and ran

sudo ethtool enp3s0  

which returned the following output (irrespectively of the cable being plugged in or not).

Settings for enp3s0:  Cannot get device settings: No such device      Supports Wake-on: pumbg      Wake-on: d      Link detected: no  

I've tried also

sudo ethtool -p enp3s0 15  

and got the following output (irrespectively of the cable being plugged in or not):

Cannot identify NIC: Operation not supported  

My question is what is going on with my ethernet interface?

Can I clone a branch of an unrelated remote repo into a branch of my git repo, and keep it updated?

Posted: 13 Dec 2021 06:59 AM PST

I have a local repo with some code in it in different branches. There happens to exist a git repo out in the world that has the same software, but a disconnected git history. (I don't think it matters, but I know for sure that that repo uses a different branch naming scheme than mine, so there are no conflicts.)

I want to clone a specific branch of that remote repo into a new, matching branch of my local repo, and subsequently be able to update it with git pull.

Is this possible, and if so... how?

Shell script to count the number of different vowels in a text file

Posted: 13 Dec 2021 06:54 AM PST

I'm working on a script that should take a given text file and figure out how many characters, vowels, and how many of each vowel is present. The first part was easy but I'm having problems with the loop. My understanding is that the myString count becomes the loop count. Each time it reads a character it goes through the if/elif statements and when it matches a vowel, it increases the value of that vowel's corresponding variable by 1.

Shellcheck.net doesn't like my lines but I'm not understanding why:

Line 22:  ((va=++))  ^-- SC1105 (error): Shells disambiguate (( differently or not at all. For subshell, add spaces around ( . For ((, fix parsing errors.    ^-- SC2030 (info): Modification of va is local (to subshell caused by (..) group).        va=0  ve=0  vi=0  vo=0  vu=0  i=0  while (( i++ < ${#myString} )); do  char=$(expr substr "$myString" "$i" 1)  if   [ "$char" -eq "a" ]; then  ((va=++))  elif [ "$char" -eq "e" ]; then  ((ve=++))  elif [ "$char" -eq "i" ]; then  ((vi=++))  elif [ "$char" -eq "o" ]; then  ((vo=++))  elif [ "$char" -eq "u" ]; then  ((vu=++))  fi  done  echo $vi  

read_passphrase being called on SSH key even though SSH key is not protected by password

Posted: 13 Dec 2021 06:18 AM PST

I have a staging server and a production server, and I run identical Bitbucket Pipelines, where I send some commands over SSH. Unfortunately, my pipeline for the production always fails with:

Host key verification failed.  

I've tried everything, folder permissions, recreating the keys, nothing works.

Finally with adding -v to my ssh call, I think I'm a step closer, but still lost.

On my staging server, I see something like this:

debug1: Host '$STAGING_SERVER' is known and matches the RSA host key.     debug1: Found key in /root/.ssh/known_hosts:4     debug1: ssh_rsa_verify: signature correct  

and the rest of the build follows flawlessly.

On my production server, however, I see the following:

debug1: Host '$PRODUCTION_SERVER' is known and matches the RSA host key.  debug1: Found key in /root/.ssh/known_hosts:5  debug1: read_passphrase: can't open /dev/tty: No such device or address  debug1: permanently_drop_suid: 0  ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory  Host key verification failed.  

So it would look like the key is found on my production server, but for some reason on the production server read_passphrase is being called. I've just created a new id_rsa and id_rsa.pub key, with no password, so why the heck is my production server trying to call . As far as I know, my sshd_configs on both servers are identical, but maybe I missed something?

Another way of looking at it is that ssh_rsa_verify is called immediately on the staging server, while on the production server read_passphrase is called.

Any help here would be greatly appreciated, this is driving me crazy!

nmap & ssl-enum-ciphers

Posted: 13 Dec 2021 05:59 AM PST

I am trying to check for the offered ciphers with nmap:

$ nmap -Pn --script ssl-enum-ciphers host1.example.org -p 443  Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-13 14:52 CET  Nmap scan report for host1.example.org (129.132.65.51)  Host is up (0.0070s latency).    PORT    STATE SERVICE  443/tcp open  https  | ssl-enum-ciphers:   |   TLSv1.3:   |     ciphers:   |       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A  |       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A  |       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A  |       TLS_AKE_WITH_AES_128_CCM_SHA256 (ecdh_x25519) - A  |     cipher preference: server  |_  least strength: A    Nmap done: 1 IP address (1 host up) scanned in 1.39 seconds  

It's working fine but for a single case:

  • Fedora 35 (host1.example.org) from macOS
$ nmap -Pn --script ssl-enum-ciphers host1.example.org -p 443  Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-13 14:52 CET  Nmap scan report for host1.example.org (129.132.65.51)  Host is up (0.0070s latency).    PORT    STATE SERVICE  443/tcp open  https  | ssl-enum-ciphers:   |   TLSv1.3:   |     ciphers:   |       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A  |       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A  |       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A  |       TLS_AKE_WITH_AES_128_CCM_SHA256 (ecdh_x25519) - A  |     cipher preference: server  |_  least strength: A    Nmap done: 1 IP address (1 host up) scanned in 1.39 seconds  
  • Fedora 35 (host1.example.org) from Fedora 35 (host2.example.org)
$ nmap -Pn --script ssl-enum-ciphers host1.example.org -p 443  Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.  Starting Nmap 7.91 ( https://nmap.org ) at 2021-12-13 14:55 CET  Nmap scan report for host1.example.org (129.132.65.51)  Host is up (0.013s latency).    PORT    STATE SERVICE  443/tcp open  https    Nmap done: 1 IP address (1 host up) scanned in 0.35 seconds  
  • Same machines other direction. Fedora 35 (host2.example.org) from Fedora 35 (host1.example.org)
$ nmap -Pn --script ssl-enum-ciphers host2.example.org -p 443  Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.  Starting Nmap 7.91 ( https://nmap.org ) at 2021-12-13 14:56 CET  Nmap scan report for host2.example.org (138.201.94.172)  Host is up (0.013s latency).  Other addresses for host2.example.org (not scanned): 2a01:4f8:c17:cbd8::2    PORT    STATE SERVICE  443/tcp open  https  | ssl-enum-ciphers:   |   TLSv1.2:   |     ciphers:   |       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 2048) - A  |       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 2048) - A  |       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A  |       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A  |       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A  |     compressors:   |       NULL  |     cipher preference: client  |_  least strength: A    Nmap done: 1 IP address (1 host up) scanned in 0.65 seconds  

I don't really get why both Fedora machines give a result from macOS but not when scanning from host1.example.org to host2.example.org when both should be configured in the same way.

How can I debug the proble

Front Panel Not Working - ALC 4080 - Archlinux

Posted: 13 Dec 2021 05:38 AM PST

I built a system with MSI Z690 MAG Tomahawk DDR4. It has ALC4080 codec. I found similar problems on google.

Output of aplay -L

    null      Discard all samples (playback) or generate zero samples (capture)  samplerate      Rate Converter Plugin Using Samplerate Library  speexrate      Rate Converter Plugin Using Speex Resampler  jack      JACK Audio Connection Kit  oss      Open Sound System  pipewire      PipeWire Sound Server  pulse      PulseAudio Sound Server  speex      Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)  upmix      Plugin for channel upmix (4,6,8)  vdownmix      Plugin for channel downmix (stereo) with a simple spacialization  hdmi:CARD=PCH,DEV=0      HDA Intel PCH, HDMI 0      HDMI Audio Output  hdmi:CARD=PCH,DEV=1      HDA Intel PCH, HDMI 1      HDMI Audio Output  hdmi:CARD=PCH,DEV=2      HDA Intel PCH, HDMI 2      HDMI Audio Output  hdmi:CARD=PCH,DEV=3      HDA Intel PCH, HDMI 3      HDMI Audio Output  hdmi:CARD=PCH,DEV=4      HDA Intel PCH, HDMI 4      HDMI Audio Output  hdmi:CARD=PCH,DEV=5      HDA Intel PCH, HDMI 5      HDMI Audio Output  hdmi:CARD=PCH,DEV=6      HDA Intel PCH, HDMI 6      HDMI Audio Output  hdmi:CARD=PCH,DEV=7      HDA Intel PCH, HDMI 7      HDMI Audio Output  hdmi:CARD=PCH,DEV=8      HDA Intel PCH, HDMI 8      HDMI Audio Output  hdmi:CARD=PCH,DEV=9      HDA Intel PCH, HDMI 9      HDMI Audio Output  hdmi:CARD=PCH,DEV=10      HDA Intel PCH, HDMI 10      HDMI Audio Output  usbstream:CARD=PCH      HDA Intel PCH      USB Stream Output  hdmi:CARD=HDMI,DEV=0      HDA ATI HDMI, HDMI 0      HDMI Audio Output  hdmi:CARD=HDMI,DEV=1      HDA ATI HDMI, HDMI 1      HDMI Audio Output  hdmi:CARD=HDMI,DEV=2      HDA ATI HDMI, HDMI 2      HDMI Audio Output  hdmi:CARD=HDMI,DEV=3      HDA ATI HDMI, HDMI 3      HDMI Audio Output  hdmi:CARD=HDMI,DEV=4      HDA ATI HDMI, HDMI 4      HDMI Audio Output  hdmi:CARD=HDMI,DEV=5      HDA ATI HDMI, HDMI 5      HDMI Audio Output  usbstream:CARD=HDMI      HDA ATI HDMI      USB Stream Output  default:CARD=Audio      USB Audio, USB Audio      Default Audio Device  sysdefault:CARD=Audio      USB Audio, USB Audio      Default Audio Device  front:CARD=Audio,DEV=0      USB Audio, USB Audio      Front output / input  surround21:CARD=Audio,DEV=0      USB Audio, USB Audio      2.1 Surround output to Front and Subwoofer speakers  surround40:CARD=Audio,DEV=0      USB Audio, USB Audio      4.0 Surround output to Front and Rear speakers  surround41:CARD=Audio,DEV=0      USB Audio, USB Audio      4.1 Surround output to Front, Rear and Subwoofer speakers  surround50:CARD=Audio,DEV=0      USB Audio, USB Audio      5.0 Surround output to Front, Center and Rear speakers  surround51:CARD=Audio,DEV=0      USB Audio, USB Audio      5.1 Surround output to Front, Center, Rear and Subwoofer speakers  surround71:CARD=Audio,DEV=0      USB Audio, USB Audio      7.1 Surround output to Front, Center, Side, Rear and Woofer speakers  iec958:CARD=Audio,DEV=0      USB Audio, USB Audio      IEC958 (S/PDIF) Digital Audio Output  iec958:CARD=Audio,DEV=1      USB Audio, USB Audio #1      IEC958 (S/PDIF) Digital Audio Output  usbstream:CARD=Audio      USB Audio      USB Stream Output  

I have a speaker connected to the rear audio panel and everythink works fine. But when I plug a headphone to the front panel, speakers keep working and no audio from headphones. I made some research found out that front panel actually works using a aplay command.

I tested with this command below.

aplay -D plughw:Audio,1 /usr/share/sounds/alsa/Front_Left.wav

If I use the command above on the terminal I can have a sound with my headphones plugged in to the front panel.

Anyone know how to solve this issue ? Note: OS: Arch Linux

Is there a difference between these two Linux server commands?

Posted: 13 Dec 2021 05:23 AM PST

When starting, restarting an apache server is there a difference between the following commands?

sudo service apache2 restart    sudo service apache2 stop  sudo service apache2 start  

AND

sudo systemctl restart apache2    sudo systemctl stop apache2  sudo systemctl start apache2  

I'm just learning a little bit about Linux servers by playing around with the LAMP stack, but I want to know why certain guides use one syntax and other guides the other.

How do I cut power from USB ports when the laptop is suspended?

Posted: 13 Dec 2021 05:20 AM PST

I have a laptop that's always connected to a USB powered cooling fan. When I had windows as the OS, that fan stopped working, on Ubuntu all USB ports are providing power when suspended. Is there a way to cut off power from the USB ports when it's suspended?

Another solution I thought of would be to hibernate instead of suspending, but I don't seem to have that option.

I don't even know where to start to solve this, any idea?

Skype test call fails

Posted: 13 Dec 2021 04:59 AM PST

I installed Devuan Chimaera on new hardware and as the result Skype no longer works. I can start skypeforlinux and test both audio and video successfully. But the Skype test call fails. I do not hear my voice.

I do not have a desktop environment. I have pavucontrol installed but not pulseaudio. I closed my tor browser but it didn't help. I have Firefox-ESR installed. I have plenty of bandwidth and and a reliable wifi connection

Delete files in debian-based did not free up space

Posted: 13 Dec 2021 06:34 AM PST

I am using linux deepin 20.03 that based on debian 10.10 on my laptop. Some days before, I deleted some files (at least 60GB) from my partition with rm command. But theirs space didn't free up. Are there any way for solve this?

enter image description here

Here is my content size:

enter image description here

Here is result of df command:

enter image description here

Here is my .Trash-1000 and lost+found properties:

enter image description here

I have rebooted my laptop several times and the problem persists.

Socks Proxy Connection Iptables Settings

Posted: 13 Dec 2021 05:12 AM PST

i hope someone could help me because i can't get any further:

I have the follwing Setup:

System 1: PC Windows (192.168.240.2) System 2: PC Ubuntu (192.168.240.3)

On the Ubuntu System i opened a ssh connection to a vpn provider,

localport on the Ubuntu System is 5080 remote Port of the VPN Provider is 3128 (http Proxy):

ssh -N -oUserKnownHostsFile=perfect_privacy_known_hosts -L 5080:127.0.0.1:3128 -v pp1989124@erfurt.perfect-privacy.com

If i use Firefox with with Foxy Proxy on the Ubuntu System and connect to localhost:5080, the traffic goes trough the ssl tunnel to the vpn provider an everhting works fine.

Now i want to connect from my Windows Client via Ubuntu Client to VPN Provider. So i made the same, on the Window Client i put in foxy Proxy the IP Address of the Ubuntu Client 192.168.240.3 and the port 5080. But this won't work (i think because the ssh tunnel on the ubuntu clients listen on localhost and not 192.168.240.3)

What will i have to do to make it works

Best regards sangul

If we use the Windows 10 or 11 Linux subsystem, is it as if we boot up Linux?

Posted: 13 Dec 2021 05:25 AM PST

That is, if we have Windows 10 or 11 and then use the Linux subsystem, such as Ubuntu, would we be using the binaries as if we create a bootable Linux PC?

So if we have Windows 10 or 11, and we create a Linux subsystem, such as Ubuntu, then while we are using that Linux Bash or Zsh command prompt, does it use the same binaries if we install

  1. Ruby, gcc, cc, and
  2. even the GPU drivers
  3. any Crypto mining executable such as xmrig, t-rex

as if we just create a bootable Linux drive or USB drive and boot up from there? Actually, Ruby or gcc or cc might be no problem, but if it is the GPU drivers, won't that conflict with Windows native GPU drivers?

How to get filename if the data is available

Posted: 13 Dec 2021 06:17 AM PST

My input files are file_1.txt, file_2.txt, file_3.txt and so on. These files contains data such as

$ head log_file_reset_*.txt  ==> file_1.txt <==  Test #1  data    Test #2  data    Test #3    Test #4  data    ==> file_2.txt <==  Test #1    Test #2  data    Test #3    Test #4  data      ==> file_3.txt <==  Test #1  data    Test #2  data    Test #3    Test #4  

The code I have right now to get the sequence number behind Test only if the data available under each Test from the input file is:

#!/bin/bash  #################################################################################################  CWD=$(pwd)        for j in {1..5}             do  sed -n '      /^Test #/ {        s///        =        p      }      $=    ' file_$j.txt \  | paste - - \  | awk -F '\t' '      NR > 1 && $1 - prevLine > ($2 ? 2 : 0) {print prev}       {prevLine = $1; prev = $2}    ' >> 1_val.txt  

The output i get from this code which is stored in 1_val.txt:

1_val.txt  1  2  4  2  4  1  2  

May i know how the code can be modified in order to get the filename (just the number) of the data listed in 1_val.txt and store it in another file called 2_val.txt?

The expected output:

2_val.txt  1  1  1  2  2  3  3  

Prune search tree if file is found

Posted: 13 Dec 2021 04:37 AM PST

I need to search a rather big directory hierarchy for regular files with names matching a particular filename globbing pattern. The hierarchy is so big (both very deep and with some enormous directories) that it would take far too long to take a naive approach:

find /top/dir -type f -name 'pattern'  

(Where pattern is some pattern like *proj*.tgz.)

Due to the nature of the directory structure, I know I could introduce an optimization to prune the search tree if find found a file in a directory. For example, finding one or several files in a particular directory would mean that I wouldn't need to examine any of the subdirectories of that specific directory for other matches.

Since applying -prune to a regular file isn't doing the right thing, I can't just do

find /top/dir -type f -name 'pattern' -prune  

Question: How do I avoid searching the subdirectories of the directory that contains the file(s) that matches the pattern?

Installed Plymouth theme, boot now hangs after grub menu with no details [Manjaro]

Posted: 13 Dec 2021 06:58 AM PST

I decided I wanted to get my hands a little dirty and make a custom Plymouth boot theme. I basically just copied one of the defaults and changed some of the parameters and added my own image.

Now on boot, I get to grub but after selecting Manjaro the screen goes to boot but hangs with the cursor in the top left staying solid. Not able to type or hop into console with CTRL+ALT+F2. I have access to the drive because I'm dual-booted with Win11 so could potentially edit files on my linux partition. I also could get a new live boot USB to try to repair, but not sure if any of these are the right way to fix this.

Does anyone have any suggestions on how I could approach fixing this?


Manjaro XFCE on Razer Blade RTX 2070 but intel CPU is what handles display (laptop)

Linux Kernel 15.7?? the most recent stable for manjaro.

EDIT: Thanks to a little push from Bravo I have access to the partition from my Tails USB I carry around. Still have no idea how I should go about removing Plymouth. Gonna try and dive into some documentation.

Migrating user IMAP files/data to another hard drive/server

Posted: 13 Dec 2021 06:56 AM PST

Due to a machine crash, I need to move my mail server to another host. This includes user IMAP, but as the old server is not accessible I can't just drag and drop in an imap client application like Thunderbird. Rather, I have the old hard drive, and am trying to move the file structure to the new /home partition. I have not yet had success.

I have copied (cp -pr) the old file structure wholesale onto the new server/drive. However, the imap client isn't recognizing the old folder structure or the old messages anywhere but the inbox. The file structure has a '~mail' directory under ~home, and in that are the folders containing the email. What do I need to copy, and where, to ensure that the users can access their imap data on the new server? Running CentOS 8 with Sendmail and Dovecot.

[spamtrap_003@davinci ~mail]$ ls -la  total 90496  drwxr-xr-x.  4 spamtrap_003 spamtrap_003     4096 Dec  8 14:05  .  drwx------.  6 spamtrap_003 spamtrap_003      213 Dec  8 11:46  ..  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003      562 Apr  5  2013  Carolingia  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003      620 Jun  8  2014 'Deleted Messages'  -rw-r--r--.  1 spamtrap_003 spamtrap_003      580 Dec  8 14:05  dovecot.list.index.log  -rw-r--r--.  1 spamtrap_003 spamtrap_003       24 Dec  8 14:05  dovecot.mailbox.log  -rw-r--r--.  1 spamtrap_003 spamtrap_003        8 Dec  8 14:05  dovecot-uidvalidity  -r--r--r--.  1 spamtrap_003 spamtrap_003        0 Dec  8 14:05  dovecot-uidvalidity.61b101e2  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003  6672436 May 25  2021  Drafts  -rw-r--r--.  1 spamtrap_003 spamtrap_003  6902202 May 24  2021  Fitbit  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003   639800 Dec  8 12:45  ham  drwxrwxrwx. 20 spamtrap_003 spamtrap_003     4096 Dec  8 14:06  .imap  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003   149895 Nov 20  2014  PSL.iPad  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003    28823 Jan 21  2013  Rayburn  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003   195356 Sep 10  2014  RenStore  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003  6245982 May 25  2021  Sent  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003    45228 Oct 12  2015 'Sent Messages'  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003 71725052 Aug 17 08:51  spam  -rw-r--r--.  1 spamtrap_003 spamtrap_003      102 Apr  9  2021  .subscriptions  -rw-r--r--.  1 spamtrap_003 spamtrap_003       11 Dec  8 14:05  subscriptions  drwxr-xr-x.  6 spamtrap_003 spamtrap_003      121 Dec  8 14:06  .Trash  -rwxrwxrwx.  1 spamtrap_003 spamtrap_003      603 Apr 13  2021  Trash  

The .imap subdirectory shows as follows:

[spamtrap_003@davinci .imap]$ ls -la  total 28  drwxrwxrwx. 20 spamtrap_003 spamtrap_003 4096 Dec  8 14:06  .  drwxr-xr-x.  4 spamtrap_003 spamtrap_003 4096 Dec  8 14:05  ..  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019 Carolingia  drwxrwxrwx.  2 spamtrap_003 spamtrap_003    6 Dec  8 14:05  cur  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019 'Deleted Messages'  -rw-rw-rw-.  1 spamtrap_003 spamtrap_003   40 Dec  8 14:05  dovecot.index.log  -rw-rw-rw-.  1 spamtrap_003 spamtrap_003 3748 Dec  8 14:06  dovecot.list.index.log  -rw-r--r--.  1 spamtrap_003 spamtrap_003   24 Apr  9  2021  dovecot.mailbox.log  -rw-rw-rw-.  1 spamtrap_003 spamtrap_003   51 Dec  8 14:05  dovecot-uidlist  -rw-r--r--.  1 spamtrap_003 spamtrap_003    8 Apr  9  2021  dovecot-uidvalidity  -r--r--r--.  1 spamtrap_003 spamtrap_003    0 Apr  9  2021  dovecot-uidvalidity.607089eb  drwxr-xr-x.  2 spamtrap_003 spamtrap_003   31 Dec  8 14:06  dovecot-uidvalidity.61b101e2  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 May  3  2021  Drafts  drwxr-xr-x.  2 spamtrap_003 spamtrap_003   58 Apr  9  2021  Fitbit  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Apr 11  2021  ham  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Aug 25 17:08  INBOX  drwxrwxrwx.  2 spamtrap_003 spamtrap_003    6 Dec  8 14:05  new  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019  PSL.iPad  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019  Rayburn  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019  RenStore  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Aug 26 08:11  Sent  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019 'Sent Messages'  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Aug 17 08:40  spam  drwxr-xr-x.  2 spamtrap_003 spamtrap_003   31 Dec  8 14:06  subscriptions  drwxrwxrwx.  2 spamtrap_003 spamtrap_003    6 Dec  8 14:05  tmp  drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Jul  5 22:30  Trash  

Could it be the permissions on the Dovecot index files?

The old and new both use Dovecot. I don't have the version for the old one; when it was running it had CentOS 7, fairly well updated. The new one is 2.3.8. The configuration for storage and mail folder type should be the same: {mail_location = mbox:~/~mail:INBOX=/var/spool/mail/%u} The new and old users are not necessarily the same (UID and GID), though the names match. I have, for one box, changed the owner for all files in and under $HOME/~mail to be owned by that user, to no avail.

EDIT 13Dec21: I have determined that it is NOT a permissions/ownership problem. I was able to create a new folder via my imap client (Thunderbird), and it showed properly. I then examined the ownership and permissions of the created files and directories and duplicated them in an existing folder. This did not work; the folder still wouldn't show. Next is examining and possibly doing surgery to the actual dovecot index files that are created, since clearly it's not like I'm going to lose anything more.

How to use unison-jz inside a bash script?

Posted: 13 Dec 2021 04:52 AM PST

unison-jz works well on a bash command-line but not inside a script. It seems that inside the script, it falls back to the regular unison command. Can someone tell me how to use unison-jz inside a bash script?


I had the unison version conflict that is described in #583058 and the proposed solution for ubuntu works fine on an interactive shell.

However, I want to do the same from inside a bash script:

#!/bin/bash  unison profile_name -sshargs '-i ~/.ssh/privatekey'  

This is a MWE version of the script.sh (in reality the script is more copmlex, but I checked this MWE and it shows the same faulty behaviour). When I invoke this script from the same command line as before (but also from another shell), it seems that inside the script, the regular unison version is used instead of the snapped unison-jz (which is used when invoking from the interactive shell). Hence, the syncing fails with the same Fatal error as before, saying "This can happen because you have different versions of Unison installed on the client and server machines", which I had fixed with the above approached.

How can I make the shell script use the snapped unison-jz version instead of unison?

Both client and server use bash shell on ubuntu (client: 20.04, server: 18.04).


What I've done on the command-line:

  1. Install snap:

    sudo snap install --devmode unison-jz

  2. Add this line to my unison profile file:

    servercmd = /snap/bin/unison-jz.unison -ui text

  3. Comment out line 19 in /etc/ssh/ssh_config so that is looks like

    # Include /etc/ssh/ssh_config.d/*.conf

  4. Execute unison:

    unison profile_name -sshargs '-i ~/.ssh/privatekey'

This works fine from an interactive bash shell.

How to replace lines which has no data with the previous line's data

Posted: 13 Dec 2021 06:18 AM PST

Input

Time      Value  Flag  06:15:10  49.95  Actual  00:00:00  0.00  NoValue  06:22:50  49.94  Actual  06:23:00  49.93  Actual  06:23:10  49.93  Actual  06:23:20  49.93  Actual  06:23:30  49.93  Actual  06:24:40  49.92  Actual  00:00:00  0.00  NoValue  

I have to replace the lines contains "NoValue". Time will be replaced with last recorded time with the increment of 10s (10seconds) Value will be replaced with last recorded time Flag will be replaced with Actual

My result will be displayed as,

Time      Value  Flag  06:15:10  49.95  Actual  06:15:20  49.95  Actual  06:22:50  49.94  Actual  06:23:00  49.93  Actual  06:23:10  49.93  Actual  06:23:20  49.93  Actual  06:23:30  49.93  Actual  06:24:40  49.92  Actual  06:24:50  49.92  Actual  

Recover overwritten partition table of LUKS drive

Posted: 13 Dec 2021 05:22 AM PST

I decided to edit the question fundamentally as I found out what happend.
So long story short:
Attempted to format an sdcard with the LUKS drive connected, but closed. (following [1])
I had some trouble getting it to work and at one point I obviously (bash_history) issued
sudo parted -s /dev/sdb mklabel gpt with /dev/sdb being the LUKS drive.
The drive now shows as /dev/sdb only.

So do I have any chance to recover the origin partition table? I am sure the device had only one partition covering the complete drive.

Many thanks in advance Leo
[1]: How to create a mkfs.ext4 file system on an SD card that can be written to by anyone?

Is it possible to set serial speed for an early kernel boot log to a MMIO UART?

Posted: 13 Dec 2021 06:49 AM PST

I have a UART that is displayed in a Linux boot log as:

AMDI0020:01: ttyS5 at MMIO 0xfedca000 (irq = 4, base_baud = 3000000) is a 16550A  

I want to enable Linux kernel boot log to this UART port. To do this I add kernel boot parameter:

console=uart,mmio32,0xfedca000,115200n8  

In result for some reason the log is getting split in two parts (I've even checked this with the oscilloscope):

  • first part of the boot log goes at the speed of 3000000
  • second part of the boot log goes at the speed of 115200

Presumably the split is happening exactly at the point of ttyS5 initialization.

I thought that the whole point of writing

console=uart,mmio32,0xfedca000,115200n8  

instead of

console=ttyS5,115200n8  

is to get working UART before the actual driver initialization.

But for some reason the uart,mmio32,0xfedca000,115200n8 parameter doesn't set speed at the beginning.

Is it possible to set serial speed for an early kernel boot log to a MMIO UART?

Just in case my OS is:

~$ lsb_release -a  No LSB modules are available.  Distributor ID: Ubuntu  Description:    Ubuntu 18.04.4 LTS  Release:        18.04  Codename:       bionic  ~$ uname -a  Linux ermak-Diesel 5.4.0-65-generic #73~18.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux  

Raspbian restart network without reboot

Posted: 13 Dec 2021 05:05 AM PST

When I am using raspbian with a 4g USB modem, sometimes the network goes down and there is no option to bring back the network unless I reboot the raspbian.

In such cases, I try:

service networking restart  

with a cron every hour; this doesn't work.

I tried also ifdown -a && ifup -a -- not much better.

The thing is, when I execute these commands in a terminal, I get no output.

What is the solution to bring network as if I rebooted?

root@raspberrypi:/home/pi# ifconfig -a  eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 192.168.0.100  netmask 255.255.255.0  broadcast 192.168.0.255          inet6 fe80::48f5:e07c:1544:2d24  prefixlen 64  scopeid 0x20<link>          ether b8:27:eb:38:6e:29  txqueuelen 1000  (Ethernet)          RX packets 23902  bytes 8949877 (8.5 MiB)          RX errors 0  dropped 17  overruns 0  frame 0          TX packets 30039  bytes 6388288 (6.0 MiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536          inet 127.0.0.1  netmask 255.0.0.0          inet6 ::1  prefixlen 128  scopeid 0x10<host>          loop  txqueuelen 1  (Boucle locale)          RX packets 20996  bytes 8495857 (8.1 MiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 20996  bytes 8495857 (8.1 MiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          ether b8:27:eb:6d:3b:7c  txqueuelen 1000  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 0  bytes 0 (0.0 B)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  

Glitchy Debian Install screen - both standard and graphical

Posted: 13 Dec 2021 06:06 AM PST

I've been trying to install Debian and I've done the following in order to try to fix this:

Both Standard and Graphical install methods have the problem:

  1. Changed USB drives.
  2. Added the fb=false parameter to boot
  3. Tried Testing build (stretch) and Stable build.
  4. Added nomodeset to the boot parameters
  5. Tried both normal and graphical install (screenshots attached)

My computer is an HP Probook 440 G2 with a core i5 and Intel HD 4400 Graphics running in UEFI mode. I need it UEFI mode since Legacy BIOS (and MBR drive partitioning) is unacceptable

Anything else I can try to get it working?

What is the correct way to view your CPU speed on Linux?

Posted: 13 Dec 2021 05:23 AM PST

I found two commands to output information about my CPU: cat /proc/cpuinfo and lscpu. /proc/cpuinfo shows that my CPU speed is 2.1 Ghz, whereas lspcu says it is 3167 Mhz. Which one is correct?

This is my exact output from cat /proc/cpuinfo about my processor speed:

model name  : Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz  

And this is from lscpu:

CPU MHz:               3225.234  

(For some reason, lscpu outputs differently every time, varying between 3100 and 3300 MHz)

Make `column` use a single space as column separators in output

Posted: 13 Dec 2021 05:23 AM PST

$ echo 'a b' | column -t   a  b  

There are 2 spaces between a and b in the output. How can I make column use only one space for separation when possible?

EDIT 2: Changed data to include more cases

$ cat data   1 2 b  20 12.5 something  300 12.8 as  600 16 asrgty  1200 4.9 srty  1800 33.5 sry  10000 1.5 sty  200000 1.5 sty  $ column -t < data  1       2     b  20      12.5  something  300     12.8  as  600     16    asrgty  1200    4.9   srty  1800    33.5  sry  10000   1.5   sty  200000  1.5   sty  $  column -t -s '' < data  1 2 b  20 12.5 something  300 12.8 as  600 16 asrgty  1200 4.9 srty  1800 33.5 sry  10000 1.5 sty  200000 1.5 sty  $ column -t -s ' ' < data  1       2     b  20      12.5  something  300     12.8  as  600     16    asrgty  1200    4.9   srty  1800    33.5  sry  10000   1.5   sty  200000  1.5   sty  $ column -t < data | sed -re 's/  / /g'  1    2   b  20   12.5 something  300   12.8 as  600   16  asrgty  1200  4.9  srty  1800  33.5 sry  10000  1.5  sty  200000 1.5  sty  $ column -t < data | sed -re 's/  / /'  1      2     b  20     12.5  something  300    12.8  as  600    16    asrgty  1200   4.9   srty  1800   33.5  sry  10000  1.5   sty  200000 1.5   sty  

Expected

1      2    b  20     12.5 something  300    12.8 as  600    16   asrgty  1200   4.9  srty  1800   33.5 sry  10000  1.5  sty  200000 1.5  sty  

Note: Please don't give sed hacks that work for this specific case. Questions on SE should be useful to others and not limited to highly specific data formats.

'ps' arguments to display PID, PPID, PGID, and SID collectively

Posted: 13 Dec 2021 05:22 AM PST

I tried ps with different kinds of switches e.g. -A, aux, ef, and so forth but I cannot seem to find the right combination of switches that will tell me the Process ID (PID), Parent Process ID (PPID), Process Group ID (PGID), and the Session ID (SID) of a process in the same output.

How do I write a retry logic in script to keep retrying to run it upto 5 times?

Posted: 13 Dec 2021 05:22 AM PST

I want to write logic in shell script which will retry it to run again after 15 sec upto 5 times based on "status code=FAIL" if it fails due to some issue.

Key mappings in Linux

Posted: 13 Dec 2021 05:23 AM PST

What do people mean when they point out that the "keys are not properly mapped" in a Linux installation when working on the command line?

Isn't the default installation OK? What extra/specific mappings are needed?

I also was told that for my Mac where my Home and End and Ctrl keys do not do what I expected.

What exactly is POSIX?

Posted: 13 Dec 2021 06:46 AM PST

I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group

The Open Group is most famous as the certifying body for the UNIX trademark, and its publication of the Single UNIX Specification technical standard, which extends the POSIX standards and is the official definition of a UNIX system.

If the official definition of a UNIX system is an extension of POSIX, then what exactly is POSIX? ,,, It surely seems to be a touchstone of the UNIX world, but I don't know how it fits into the overall picture.

Colorizing your terminal and shell environment?

Posted: 13 Dec 2021 05:21 AM PST

I spend most of my time working in Unix environments and using terminal emulators. I try to use color on the command line, because color makes the output more useful and intuitive.

What options exist to add color to my terminal environment? What tricks do you use? What pitfalls have you encountered?

Unfortunately, support for color varies depending on terminal type, OS, TERM setting, utility, buggy implementations, etc.

Here are some tips from my setup, after a lot of experimentation:

  1. I tend to set TERM=xterm-color, which is supported on most hosts (but not all).
  2. I work on a number of different hosts, different OS versions, etc. I use everything from macOS X, Ubuntu Linux, RHEL/CentOS/Scientific Linux and FreeBSD. I'm trying to keep things simple and generic, if possible.
  3. I do a bunch of work using GNU screen, which adds another layer of fun.
  4. Many OSs set things like dircolors and by default, and I don't want to modify this on a hundred different hosts. So I try to stick with the defaults. Instead, I tweak my terminal's color configuration.
  5. Use color for some Unix commands (ls, grep, less, vim) and the Bash prompt. These commands seem to use the standard "ANSI escape sequences". For example:

    alias less='less --RAW-CONTROL-CHARS'  export LS_OPTS='--color=auto'  alias ls='ls ${LS_OPTS}'  

I'll post my .bashrc and answer my own question Jeopardy Style.

No comments:

Post a Comment