Tuesday, May 18, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


why does forwarding X11 over reverse ssh tunnel not work properly

Posted: 18 May 2021 10:31 AM PDT

I have a host which I want to access through reverse ssh and I also want to forward X11. So I did this on the remote host: ssh -X -R 43022:localhost:22 usr@myhost -p 2222 and I can connect fine with ssh -X -p 43022 usr@localhost from myhost but the X11 forwarding doesn't seem to work:

$ xeyes  Error: Can't open display:  

why is that?

gmail + mutt + isync: how to archive and delete mail

Posted: 18 May 2021 10:25 AM PDT

I want to switch from Thunderbird to (Neo)mutt, because I would like to read my mail in a terminal (offline). I have a gmail account and just can't figure out how to setup Mutt properly.

I have setup isync in a way that syncs:

  • gmail's "Inbox" to a local "Inbox" folder
  • "[Gmail]/All Mail" to a local "Archive" folder and
  • "[Gmail]/Trash" to a local "Trash" folder

This seems to work.

I usually read my email in the local Inbox and want to keep it clean. After reading a message, I want to either archive it or delete it. And I would like to have a simple keybinding for each of these two actions. So for example:

  • pressing "A" should remove a message from the inbox, but leave it in my archive
  • pressing "D" should remove a message from the inbox and from the archive, but should put in Trash

Deleting a message from Trash should permanently delete a message. And of course this should be reflected in gmails web application and on my android phone.

The following lines are in my neomuttrc file.

set mbox   = "+archive"  set trash  = "+trash"  unset move  bind index D delete-message  bind index A purge-message  

Now, when archiving a message with "A", it's marked as deleted in my inbox in Neomutt and after syncing the mailbox and running isync the message also disappears from my Inbox in Thunderbird, but I can still see it in the inbox in gmails web app and in the inbox on my phone. I don't understand way. Any ideas?

Deleting from my Inbox in Mutt seems to work (it just needs two runs of isync, which I do understand). But deleting messages from Trash in Mutt, does not delete these message from the Trash in the web app or on my phone. I don't get that either. Again, any ideas?

Well, any help is highly appreciated. Thanks in advance!

Can't boot the Linux - Kernel panic - not syncing - Any help appreciated

Posted: 18 May 2021 10:20 AM PDT

Info: I have Kali on dual boot with windows, and the Kali partition is encrypted (you can see in the terminal "please unlock crypto...").

I had some issues with a package called libc6, while installing my laptop software for controlling the brightness, and rgb, and other things on my asus laptop... so after troubleshooting that I found that I should apt --fix-broken to fix the package that was installed incorrectly.

So I did. Meanwhile the --fix-broken thingie, had it's own issues that after completing made me not able to run anything. I couldn't re-run the terminal, or anything really.

So i thought maybe reboot will fix it. Which lead to this screen you see here: Kernel panic mode

If you can't see the image here is what it looks like:

Begin: Running /scripts/init-bottom ... done.  Not activating Mandatory Access Control as /sbin/tomoyo-init does not exist.  Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100  CPU: 7 PID: 1 Comm: run-init Tainted: G       E       5.10.0-kali7-amd6 #1 Debian 5.10.28-1kali1  Hardware name: ASUSTeK COMPUTER INC. ROG Strix G531GU_G531GU, BIOS G531GU.309 04/29/2020  Call Trace:  dump_stack+0x6b/0x83  do_exit.cold+0xb3/0xb3  do_group_exit+0x33/0xa0  __x64_sys_exit_group+0x14/0x20  do_syscall_64+0x33/0x80  entry_SYSCALL_64_after_hwframe+0x44/0xa9  RIP: 0033:0x7f4f2f200699  Code: 00 4c 8b ...  RSP: 002b: 00007ffc56e73ffB EFLAGS: 00000246 ORIG_RAX: 0000000000000e7  

So now I got no idea how to boot it. I got no idea how to access it from like liveCD to change some stuffs as per other threads I found on internet, since the HDD is encrypted.

Was wondering, is there any tool or USB image that can run on the boot, that will at least give me access to the terminal? I know it's kinda dumb since imo the kernel is not even running properly, but I just want to avoid re-installing everything from scratch, because it was highly customized and full of data Linux.

More info: The package that the software required was 3.2 of glibc6 and my Linux had 3.1 installed, so I download deb package and installed it like every other with dkpg -i. I thought what's the worst that can happen... and it did :D *

Copying a file and verifying it went well

Posted: 18 May 2021 10:26 AM PDT

How would you write two UNIX commands where the first one would copy the file passwd under /bin directory to your current working directory under the name changepasswd and then the second command should produce a single line output to verify the successful copying of the file.

How to insert subsequent lines from input file at the end of each line of another file?

Posted: 18 May 2021 10:33 AM PDT

I have two files with log output. I need to join them the way I described below

First file

Line 1  Line 2  Line 3  

Second File

Need to be placed at the end of Line 1  Need to be placed at the end of Line 2  Need to be placed at the end of Line 3  

Expected result:

Line 1 Need to be placed at the end of Line 1  Line 2 Need to be placed at the end of Line 2  Line 3 Need to be placed at the end of Line 3  

I know how append text/input file using sed but in case of file it will insert all contents of a file so it's not what I am looking for. Any help appreciated:)

Seeking terminal program with search and clear-text-from-last-command features

Posted: 18 May 2021 09:58 AM PDT

Is there a terminal program that can: a) Search within the console text, and b) Delete (or clear) console output up to and including your last command?

Curious about Linux reconfiguration on multiple systems

Posted: 18 May 2021 09:57 AM PDT

I'm new here obviously but I've been a lurker for a long time. Figured it was time to start asking…

Anyway I'm curious what programs/scripts exist for Linux to streamline setting up my system again once I get everything configured the way I like it. Say I mess the system up, I'd like to be able to reload quicker than having to do a base install and meticulously reinstall/reconfigure all my programs. Should I just make a disk image? Or is there another tool that would work better? I hope I'm expressing myself clearly enough. Thank you for taking the time to read my question! All your answers are greatly appreciated!!

Compare content of two folders/disks (including timestamps,permissions)

Posted: 18 May 2021 09:51 AM PDT

I have two directories on two different hard drives and want to check if the content is really exactly the same. From what I read I can use diff -rq dir1 dir2 to check if files are missing or differ.

-q,--brief
report only when files differ

-r,--recursive
recursively compare any subdirectories found

However as far as I see diff does not check if the permissions or timestamps differ. Is there another parameter for diff or other tool where it is possible to check that as well?

While loop issue (not reading the last line )

Posted: 18 May 2021 10:01 AM PDT

hello i have below issue in the while loop , it is not reading last line .

      while IFS= read -r line    do         echo $line    done<file_ref_col_master.txt    

input file

FILE_ID~col_POS~COL_START_POS~COL_END_POS~datatype~delimitted_ind~col_format~columnlength  5~4~~~char~Y~\"[a-z]+@gmail.com\"~100  5~1~~~char~Y~[0-9]+~100  

current output

sh -x  sample1.sh  + dos2unix /test/data/infa_shared/dev/SrcFiles/datawarehouse/poc_anjali/file_ref_col_master.txt  dos2unix: converting file /test/data/infa_shared/dev/SrcFiles/datawarehouse/poc_anjali/file_ref_col_master.txt to Unix format ...  + n=0  + IFS=  + read -r line  + echo FILE_ID~col_POS~COL_START_POS~COL_END_POS~datatype~delimitted_ind~col_format~columnlength  FILE_ID~col_POS~COL_START_POS~COL_END_POS~datatype~delimitted_ind~col_format~columnlength  + IFS=  + read -r line  + echo '5~4~~~char~Y~\"[a-z]+@gmail.com\"~100'  5~4~~~char~Y~\"[a-z]+@gmail.com\"~100  + IFS=  + read -r line    

Sorting and copying files

Posted: 18 May 2021 09:55 AM PDT

I am newbie here, please be patient.

I have a directory containing thousands of files. Filename always start with 1 or 2 letter and have 4 character before underscore "_". The number of files for each pattern can be different, the part of file name after underscore changes.

Sample:

Parentdir:  ->AA01_*.pdf   ->AA01_*.html  ->AA01_*.txt  ...  ->ZZ99_*.pdf  ->ZZ99_*.html  ->ZZ99_*.txt  ...  ->A001_*.pdf  ->A001_*.html  ->A001_*.txt  ...  ->Z999_*.pdf  ->Z999_*.html  ->Z999_*.txt  

I would like to run a command that would create new directories using only letters from file-name and populate them with files starting with these letters. If there is a file with the same name in the destination directory (updated file in the source dir), I'd like to keep most recent one. so:

New dir/files:  ->AA    AA01_*.pdf    AA01_*.html    AA01_*.txt  ...  ->ZZ    ZZ99_*.pdf    ZZ99_*.html    ZZ99_*.txt  ...  ->A    A001_*.pdf    A001_*.html    A1001_*.txt  ...  ->Z    Z999_*.pdf    Z999_*.html    Z999_*.txt    

Can this be accomplished?

Thanks!

Difference between "kernel image" and "disk image"

Posted: 18 May 2021 09:13 AM PDT

I'm trying to boot Ubuntu on the gem5 simulator. The gem5 simulator expects 2 binaries to boot from: a "disk image" and a "kernel image". When I've booted Linux with QEMU or installed Linux on a computer, I've only needed a single iso. My questions:

  • What's the difference between a "kernel image" and a "disk image"?
  • Why would a system need both? Doesn't the "disk image" containing the distro also contain a "kernel image"?

How to count the number of times connected to a URL

Posted: 18 May 2021 09:12 AM PDT

I am recently doing a project using Linux and I am very new at this and I just can't find the exact answer for my problem. The questions I need to answer are: **Some of the records we suspect may be present in the ISP logs include connections to a website with 'dal' in the URL.

  1. We need to know how many times he connected with this site.
  2. How many websites visited have 'dal' in their URL.
  3. How many are web mail, or email sites? ** The example code is from a set of log entries and this is just a bit of the code as there is a lot of entries.

*utdppp35.utdallas.edu - - [31/Aug/1995:22:43:42 -0400] "GET /ksc.html HTTP/1.0" 304 0 utdppp35.utdallas.edu - - [31/Aug/1995:22:43:43 -0400] "GET /images/ksclogo-medium.gif HTTP/1.0" 304 0 utdppp35.utdallas.edu - - [31/Aug/1995:22:43:43 -0400] "GET /images/NASA-logosmall.gif HTTP/1.0" 304 0 utdppp35.utdallas.edu - - [31/Aug/1995:22:43:43 -0400] "GET /images/MOSAIC-logosmall.gif HTTP/1.0" 304 0 utdppp35.utdallas.edu - - [31/Aug/1995:22:43:43 -0400] "GET /images/USA-logosmall.gif HTTP/1.0" 304 0 utdppp35.utdallas.edu - - [31/Aug/1995:22:43:45 -0400] "GET /images/WORLD-logosmall.gif HTTP/1.0" 304 0 cdale-1.midwest.net - - [31/Aug/1995:23:07:55 -0400] "GET /software/winvn/winvn.html HTTP/1.0" 200 9630 cdale-1.midwest.net - - [31/Aug/1995:23:07:56 -0400] "GET /software/winvn/bluemarb.gif HTTP/1.0" 200 4441 cdale-1.midwest.net - - [31/Aug/1995:23:07:56 -0400] "GET /software/winvn/winvn.gif HTTP/1.0" 200 25218 cdale-1.midwest.net - - [31/Aug/1995:23:07:57 -0400] "GET /software/winvn/wvsmall.gif HTTP/1.0" 200 13372 cdale-1.midwest.net - - [31/Aug/1995:23:08:02 -0400] "GET /images/KSC-logosmall.gif HTTP/1.0" 200 1204 cdale-1.midwest.net - - [31/Aug/1995:23:08:02 -0400] "GET /images/MOSAIC-logosmall.gif HTTP/1.0" 200 363 cdale-1.midwest.net - - [31/Aug/1995:23:08:07 -0400] "GET /images/USA-logosmall.gif HTTP/1.0" 200 234 cdale-1.midwest.net - - [31/Aug/1995:23:08:09 -0400] "GET /images/WORLD-logosmall.gif HTTP/1.0" 200 669 cust59.max3.dallas.tx.ms.uu.net - - [31/Aug/1995:23:32:01 -0400] "GET /facts/faq04.html HTTP/1.0" 200 27063 cust59.max3.dallas.tx.ms.uu.net - - [31/Aug/1995:23:32:07 -0400] "GET /images/ksclogosmall.gif HTTP/1.0" 200 3635 cust59.max3.dallas.tx.ms.uu.net - - [31/Aug/1995:23:32:07 -0400] "GET /images/faq.gif HTTP/1.0" 200 263 utdppp43.utdallas.edu - - [31/Aug/1995:23:42:49 -0400] "GET /shuttle/missions/sts-68/ksc-srl-image.html HTTP/1.0" 200 1404 utdppp43.utdallas.edu - - [31/Aug/1995:23:43:57 -0400] "GET /shuttle/missions/sts-68/images/ksc-upclose.gif HTTP/1.0" 200 86984 utdppp43.utdallas.edu - - [31/Aug/1995:23:45:04 -0400] "GET /shuttle/missions/sts-68/images/ksc.gif HTTP/1.0" 200 *

After trying online I got roughly 40,000 entries for part 1.1 and 5,000 for 1.2 now this is where I know I am wrong as this doesn't seem right.

Anyone can help on what commands should I use?

Docker network/racadm issue

Posted: 18 May 2021 10:17 AM PDT

I have an ubuntu 20.04 docker container that I use to run racadm (I know this is already my first mistake but racadm actually runs fine on the container). This works for my whole team and worked for me fine until I recently rebuilt my macbook. Since I rebuilt my macbook when I try to run racadm against any dell machine I get:

ERROR: Unable to connect to RAC at specified IP address.  

That is with the default bridged network mode. If I run my container with --network host it works as expected.

I am using a VPN to connect to these machines so I thought it was just a network routing issue but that doesn't appear to be the case because I can actually ping the machine address in bridge network or host network mode, I can telnet to it, etc. It seems that racadm is the only issue.

This is all happening on a production network and the docker container contains some sensitive data so there may be some information I cannot provide unfortunately but will do my best.

Does anyone know why this could be happening? Do I need to add some route from my host into the container? Is it potentially a firewall issue?

Partitions and the mounting points

Posted: 18 May 2021 09:18 AM PDT

An extract from a book-

Linux organizes attached storage as block devices, you can move to the /sys/block/ directory and list its contents. Among the contents will be a directory called sda/. (Remember that sda stands for Storage Drive A.) That's the first drive used by your system on boot:

Change to the sda/ directory and run ls. Among its contents, you'll probably see files with names like sda1, sda2, and sda5. Each of these represents one of the partitions created by Linux to better organize the data on your drive.

On my Ubuntu machine, the below partitions are shown for sda-

enter image description here

Running df -h | grep sda gives

enter image description here

As seen, /dev/sda5 is mounted on '/' and /dev/sda1 on /boot/efi.

Why is there no mounting point for partition sda2?

What happened with file descriptor and exec?

Posted: 18 May 2021 09:08 AM PDT

I have one parent process and i create with fork 2 children like this.

    for(int i=0;i<2;i++) // loop will run n times (n=2)     {           pid = fork();         if(pid == 0)         {                  printf("[son] pid %d from [parent] pid %d\n",getpid(),getppid());                  execl("merge","merge",fifo1[i],fifo2[i],"2",NULL);                  exit(0);         }     }  

The fifos are named pipes.I call execl and on the merge executable i open the named pipes like this.

if ( (readfd = open(argv[1], O_RDONLY )) < 0) {      perror("server: can't open read fifo");  }  server(readfd);  

i also writing something from the parent to the children like this.(i have opened the fds previosly i didnt write it here).

for(int =0;i<2;i++){     n = strlen(word);  if (write(fd_write[i], word, n) != n){      perror("client: filename write error");  }  

}

I want to write something on the one child and someting ELSE ont the other but both the twoo children have the same file descriptor(read) 4 , and it`s like i write on the same named pipe.What am i doing wrong?

Directory with spaces in it as a variable [duplicate]

Posted: 18 May 2021 09:07 AM PDT

I made this script that watches one folder and copies any file added to that folder to another destination. It works as expected when the directories have no spaces. With spaces "~/Untitled Folder" becomes ~/Untitled and ~/Folder resulting in a "no such directory error". please help! How do I get the variable to work properly later in the script?

#!/bin/bash  clear  echo "Drag folder you want me to watch into this window, then press enter."    read WatchFolder   echo $WatchFolder  echo  echo "Drag backup destination into this window, then press enter"  read BUfolder  echo  touch "$BUfolder"/CopiedList.txt   cd $WatchFolder  lastCount=0           LoopCount=0  while true      do          LoopCount=$(expr $LoopCount + 1) ; echo $LoopCount #increment Loop count by one. Loopcount is echoed as progress feedback          Copied=($(cat "$BUfolder"/CopiedList.txt))          if [[ $(ls $WatchFolder | wc -l | sed 's/ //g') -gt 0 ]] && [[ $lastCount != $(ls $WatchFolder | wc -l | sed 's/ //g') ]] ## if watchfolder has more than zero files and the current count "$LoopCount" is greater than                then        ## previous count "$lastCount"                  for i in $WatchFolder/* ## This loop copies every file in the watch folder not listed in CopiedList.txt                       do                        if [[ ! ${Copied[@]} =~ $i ]]                        then                        cp  -n -R "$i" "$BUfolder"/ ; echo "Copying $i" ; echo $i >> "$BUfolder"/CopiedList.txt ## -n Stops cp from overwriting file. -R copies entire sub-tree of $BUfolder                        sleep .1  ## just a little pause to limit how much memory the script eats up                      fi                  done                fi                lastCount=$(ls $WatchFolder | wc -l | sed 's/ //g')  ##pass new file count to variable $lastCount                sleep 1 ## pause 1 second to save memory/cpu   done  

notify-send from fcrontab not displaying notification

Posted: 18 May 2021 08:52 AM PDT

Referenced these links with no success. Most of them seem to be ubuntu, gnome, and cron syntax specific.

  1. https://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab/346580#346580
  2. https://stackoverflow.com/questions/16519673/cron-with-notify-send
  3. How can I get an alert when my battery is about to die in Linux Mint?

Tried export display, dbus, full command path.

Running Arch Linux with dwm. Using fcron and fcrontab -e.

fcrontab

@ 5s /usr/local/shsc/battlow  

When I call the script explicitly it works as intended (/usr/shsc/battlow).

Script

#!/bin/sh    export DISPLAY=:0    battery_level=`acpi -b | grep -P -o '[0-9]+(?=%)'`  if [ $battery_level -le 100 ]; then      notify-send "Battery low" "Battery level is ${battery_level}%!"  fi  

Tried with and without the export DISPLAY=:0.

Verified display with

$ echo $DISPLAY  :0  
# systemctl status fcron  ● fcron.service - fcron periodical command scheduler       Loaded: loaded (/usr/lib/systemd/system/fcron.service; enabled; vendor preset: disabled)       Active: active (running) since Tue 2021-05-18 08:36:13 MST; 12min ago     Main PID: 8778 (fcron)        Tasks: 1 (limit: 18916)       Memory: 2.3M          CPU: 3.182s       CGroup: /system.slice/fcron.service               └─8778 /usr/bin/fcron -b    May 18 08:48:08 bar fcron[11367]: Job '/usr/local/shsc/battlow' started for user foo (pid 11372)  May 18 08:48:08 bar fcron[11367]: Job '/usr/local/shsc/battlow' completed  May 18 08:48:13 bar fcron[11383]: Job '/usr/local/shsc/battlow' started for user foo (pid 11388)  May 18 08:48:13 bar fcron[11383]: Job '/usr/local/shsc/battlow' completed  

how to understand <(echo) in this command line?

Posted: 18 May 2021 09:29 AM PDT

this line collapse file base on the first column.

awk '{if($1==x){i=i" "$2}else{if(NR>1){print i};i=$0};x=$1;y=$2}' test.cov <(echo)  

input:

1001  hisk01  1001  hisk02  1001  hisk03  1002  hisk04  1002  hisk05  1002  hisk06  1003  hisk07  1003  hisk08  

output:

1001 hisk01 hisk02 hisk03  1002 hisk04 hisk05 hisk06  1003 hisk07 hisk08  

It works, but I don't know how does the <(echo) work here. Could anyone please help me out?

Thanks

How to replace all instances of a string in file name and contents? [closed]

Posted: 18 May 2021 09:40 AM PDT

Was wondering if anyone could help me out,

I'm trying to replace a string in a project directory. The string is case sensitive and appears both as a single string and as a sub string.

I have tried using SED and replace but it messes with the imports and is not catching all of the instances.

sed -i -- 's/string1/string2/g' *    rename 's/string1/string2/' *  

Is there an easy one liner that could accomplish this?

Edit: output from the compilation states multiple missing imports so I think it is due to the file path being modified but neither of the commands modifying the folder structure.

OS: Linux

Edit 2: Incase anyone comes across this the issue was with some nested folders refusing to be renamed. Solved by manually renaming them.

Ansibile how to check if variable value has three options, ternary operator works only for two options

Posted: 18 May 2021 09:37 AM PDT

when mountpoint is /dev/backboot is >70% set to 'High' and if < 70% set to 'Normal' and if there is no such mountpoint atall then set to 'not availble'

below example works fine with two options, but i need three options can you suggest

  • name: get usage
    command: df -k | grep -i /dev/backboot | awk '{print $5}'
    register: usage

    here output of registered vlaue 'usage.stdout' is 67% for an example

  • name: Set the value
    set_fact:
    mspace: "{{ (usage.stdout | int < 80) | ternary('Normal','High') }}"

Is it possible to have separate initramfs images with different versions of the same DKMS module?

Posted: 18 May 2021 09:58 AM PDT

I'm wanting to have a setup where I can essentially have two versions of the NVIDIA driver kernel module installed at the same time. I want to go about this by having two initramfs images to boot from via GRUB; one with an old LTS kernel containing an older patched version of the NVIDIA driver (for special workloads), and one containing the latest kernel and driver (for general use). Is this possible to do, and if so, how could I go about doing this?

I'm running EndeavourOS (an arch-based distro), so I have tools like mkinitcpio at my disposal. Thanks in advance.

Pulseaudio loopback resample distortion

Posted: 18 May 2021 09:13 AM PDT

I have a rather complex PA setup, across two machines.

One, a desktop, does not run a pulse server. client.conf on that machine looks like this:

(Comments are not included)

autospawn = no  default-sink = Loop  default-server = remote_pulse:port  

It's running Arch Linux


The server is a raspberry pi with a HiFiBerry DAC+/ADC PRO on top.

default.pa creates a null-sink "Loop", and a module-loopback that directs all audio from "Loop" to the HiFiBerry's output sink.

Non-default lines of PA conf files:

Default.pa

load-module module-null-sink sink_name=Loop format=s24 rate=96000   load-module module-loopback sink=Loop adjust_time=1 latency_msec=50    load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;10.0.0.0/24  

Daemon.conf

high-priority = yes  nice-level = -11    realtime-scheduling = yes  realtime-priority = 9       resample-method = soxr-vhq  avoid-resampling = false    flat-volumes = no     default-sample-format = s24  default-sample-rate = 96000  

I have tried adding tsched=0 to module-detect and module-udev-detect, but that did not seem to change anything.


The problem:

Whenever resample-method is set to anything except trivial, there is a significant amount of distortion in any audio played from the "Loop" output.

(Trivial resampling may be causing a small amount of noise that I cannot hear...)

At best, it's an occasional clicking that periodically starts and stops. At worst, it's a horrible, crushed, "robotic" distortion.

When the same client is moved (manually, via pulsemixer) to the default output, all noise goes away. Thus, I'm fairly certain that this isn't a problem with the desktop.

All audio played directly through the HiFiBerry's alsa sink is fine.

CPU utilization stays below 30% each core, even when running many streams. The pi has 8G of ram. I doubt this has anything to do with system resources.


I have been trying to fix this for a while, but I have had no luck.

Does anyone know what could be causing this?

What else can I do to diagnose the problem?

Close recently opened process in .sh

Posted: 18 May 2021 09:29 AM PDT

I am new to Linux and trying to learn how to launch and close processes automatically. Eventually I would like to run this/a similar process with cron. Here, just testing "checking in" to google.

gcheck.sh looks like this:

#!/bin/bash/  export DISPLAY=:0  firefox --new-window https://google.com  

I have added execute permissions to gcheck.sh with sudo chmod a+x. I know that $$ will give the PID of the script, but how can I get and kill the PID of just opened firefox window (in case I have other firefox windows open)?

Thank you in advance!

Auto-Generate Timeout=0 on Grub, XCP-ng/Xen/CentOS

Posted: 18 May 2021 09:20 AM PDT

XCP-ng is a XenServer fork that runs on CentOS. XCP-ng 8.2 regenerates the GRUB file when changing the control domain memory allocation, which results in the server not automatically booting.

The GRUB file is: /boot/efi/EFI/xenserver/grub.cfg The line I want it to automatically generate with is set timeout=0 What information do I add to what file to accomplish this?

$ find / -name grub    /usr/lib/grub  /usr/share/grub  /usr/lib64/python2.7/site-packages/grub  /etc/bash_completion.d/grub  /etc/sysconfig/grub  /boot/grub      $ find / -name grub*cfg    /usr/bin/grub-syslinux2cfg  /usr/bin/grub-menulst2cfg  /etc/grub-efi.cfg  /etc/grub.cfg  /boot/efi/EFI/xenserver/grub.cfg  

How to install Overmind in Ubuntu?

Posted: 18 May 2021 10:28 AM PDT

First of all, I am a newbie in Linux, now that is out of the way: I am experiencing issues with Overmind installation.

After downloading the binary file I tried with the trinity of installations, but for it did not work, no configuration, the read me is the same as the one in GitHub which is next to no help for me. Attempted with package installers, but they don't recognize the binary files as such.

Extracted the contents and tried all kinds of stuff I read online but to no avail. I am sure I am missing something really simple, but apparently I can't figure out what.

i3 Screen Brightness Control using light

Posted: 18 May 2021 10:05 AM PDT

So i have recently started using i3 on my arch install. slowly i setup my config files with keybinds and all. About 2 days ago i install light ( to control screen brightness ) and it was working fine. but now suddenly i noticed that pressing the brightness keys did nothing. after trying the command light -S 100 in the terminal nothing happend. then i ran it as sudo and it worked. because the command suddenly needs to be run as sudo my keybind wont work. my keybinds for brightness control in my i3 config files are:

bindsym XF86MonBrightnessDown exec sudo light -U 10  bindsym XF86MonBrightnessUp exec sudo light -A 10  

is there anyway i can make light work without sudo? or im i stuck with using light as sudo in the terminal to control my screen brightness?

Dealing with Device-Mapper (Multipath) Failing paths

Posted: 18 May 2021 09:02 AM PDT

When a disk starts to die slowly multipath starts to Failing & Reinstating paths and this keeps forever.. (I'm using LSI-3008HBA card with SAS-JBOD not FC-Network)

Dmesg;

Sep 13 11:20:17 DEV2 kernel: sd 0:0:190:0: attempting task abort! scmd(ffff88110e632948)  Sep 13 11:20:17 DEV2 kernel: sd 0:0:190:0: [sdft] tag#3 CDB: opcode=0x0 00 00 00 00 00 00  Sep 13 11:20:17 DEV2 kernel: scsi target0:0:190: handle(0x0037), sas_address(0x5000c50093d4e7c6), phy(38)  Sep 13 11:20:17 DEV2 kernel: scsi target0:0:190: enclosure_logical_id(0x500304800929ec7f), slot(37)  Sep 13 11:20:17 DEV2 kernel: scsi target0:0:190: enclosure level(0x0001),connector name(1   )  Sep 13 11:20:17 DEV2 kernel: sd 0:0:190:0: task abort: SUCCESS scmd(ffff88110e632948)  Sep 13 11:20:18 DEV2 kernel: device-mapper: multipath: Failing path 130:240.  Sep 13 11:25:34 DEV2 kernel: device-mapper: multipath: Reinstating path 130:240.  

As you can see kernel aborted the mission and after that multipath failed. So I want to get rid of this problem via telling Multipath "do not Reinstate the path".
This method will keep dead the zombie disk.

How can I do that?

Usage of --remove-source-files option of rsync

Posted: 18 May 2021 10:19 AM PDT

From the manpage of rsync

--remove-source-files

This tells rsync to remove from the sending side the files (meaning non-directories) that are a part of the transfer and have been successfully duplicated on the receiving side.

  • Does it mean files on the sending side that are either part of the transfer or duplicated on the receiving side?

  • Can I also remove directories on the sending side?

Note that you should only use this option on source files that are quiescent.

  • What does "source files that are quiescent" mean?

If you are using this to move files that show up in a particular directory over to another host, make sure that the finished files get renamed into the source directory, not directly written into it, so that rsync can't possibly transfer a file that is not yet fully written.

  • What does this mean?

If you can't first write the files into a different directory, you should use a naming idiom that lets rsync avoid transferring files that are not yet finished (e.g. name the file "foo.new" when it is written, rename it to "foo" when it is done, and then use the option --exclude='*.new' for the rsync transfer).

  • What does this mean?

Starting with 3.1.0, rsync will skip the sender-side removal (and output an error) if the file's size or modify time has not stayed unchanged.

  • What does this mean?

Thanks.

How do I find the version of JQuery that is installed on a Linux web server?

Posted: 18 May 2021 10:00 AM PDT

All the methods I found on the Internet involved using a .jsp page and a web browser. I have Linux servers with no GUI desktops.

I do not want to use the web browser on a desktop to view a .jsp file on every web browser. I want to find out from the backend. This way I can use a script to find out on every server.

How do I find the version of JQuery that is installed on a Linux web server?

ssh-agent forwarding for a Vagrant VM

Posted: 18 May 2021 08:58 AM PDT

I'm currently looking at setting up a Vagrant environment on my Mac machine, so that I can run vagrant up and it will then install rbenv and ruby and all I need. Then I have a Bash script that will fetch all my repos from github.

The only thing is that my new vagrant vm has to now generate a ssh key and then link it to my Github account. This can be cumbersome. Especially since I would like to share my Vagrant file with all those that have access to our repos so that they could do the same.

So I thought I could try forwarding my hosts ssh to the VM so that the VM can forward my host ssh to Github. Following this article: Githubs walkthrough, I set my hosts ssh config:

Host localhost      ForwardAgent yes  

and set in my vagrant file

Vagrant.configure("2") do |config|    config.ssh.forward_agent = true    ...  end  

and when I log into my VM and run the following command I get this error:

$ ssh -T git@github.com`  Permission denied (publickey)  

Is there anyone that has tried a similar setup? The VM is a precise64 box.

EDIT:

env:

vagrant@precise64:~$ env  TERM=xterm-256color  SHELL=/bin/bash  SSH_CLIENT=10.0.2.2 53068 22  SSH_TTY=/dev/pts/0  LC_ALL=en_US  USER=vagrant  LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:  RBENV_ROOT=/opt/rbenv  SSH_AUTH_SOCK=/tmp/ssh-aDGJQD2812/agent.2812  MAIL=/var/mail/vagrant  PATH=/opt/rbenv/shims:/opt/rbenv/bin:/opt/rbenv/bin/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant_ruby/bin  PWD=/home/vagrant  SHLVL=1  HOME=/home/vagrant  LOGNAME=vagrant  SSH_CONNECTION=10.0.2.2 53068 10.0.2.15 22  LC_CTYPE=UTF-8  LESSOPEN=| /usr/bin/lesspipe %s  LESSCLOSE=/usr/bin/lesspipe %s %s  _=/usr/bin/env  

No comments:

Post a Comment