Monday, August 16, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


centos to rockylinux migration failed & broke all the OS version detection, and dnf and yum

Posted: 16 Aug 2021 11:18 AM PDT

I tryied to rebuild dnf base after running the failed migration script (CentOS 8)

it started but then it failed with "Unable to detect release version (use '--releasever' to specify release version)"

I saw the os-release & redhat-release was cleared to "", nothing.

I must try to make version detectable again to run a dnf makecache & dnf update to fix all of it but it cannot be done see below

the dnf issues

dnf makecache  Unable to detect release version (use '--releasever' to specify release version)  Extra Packages for Enterprise Linux Modular $releasever - x86_64                                                                                              127 kB/s |  76 kB     00:00      Errors during downloading metadata for repository 'epel-modular':    - Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=x86_64&infra=$infra&content=$contentdir (IP: 2a05:d014:10:7803:f774:4d7c:e277:a457)    - Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=x86_64&infra=$infra&content=$contentdir (IP: 2a05:d01c:c6a:cc01:269:da52:9ae1:43e6)  Error: Failed to download metadata for repo 'epel-modular': Cannot prepare internal mirrorlist: Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=x86_64&infra=$infra&content=$contentdir (IP: 2a05:d014:10:7803:f774:4d7c:e277:a457)  

the migration process followed :

wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh  --2021-08-16 20:03:42--  https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh  Résolution de raw.githubusercontent.com (raw.githubusercontent.com)… 185.199.110.133, 185.199.109.133, 185.199.108.133, ...  Connexion à raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443… connecté.  requête HTTP transmise, en attente de la réponse… 200 OK  Taille : 37406 (37K) [text/plain]  Sauvegarde en : « migrate2rocky.sh.2 »    migrate2rocky.sh.2                              100%[=====================================================================================================>]  36,53K  --.-KB/s    ds 0,01s       2021-08-16 20:03:42 (2,83 MB/s) — « migrate2rocky.sh.2 » sauvegardé [37406/37406]  bash ./migrate2rocky.sh -r  

Goal : retrieve a working centOS8 without reinstalling it all

File loses linefeeds after reading from file

Posted: 16 Aug 2021 11:09 AM PDT

I have this bash script

inputFile='input.txt'    outputFile='output.txt'  touch $outputFile    contents=$(cat ${inputFile})  echo ${contents} >> ${outputFile}  

I read from the input file and output the contents to another file.

When I open the output file, all lines are contiguous, without linefeed.

When I do the file command on the input file I see this

ASCII text  

and when I do the same for the output file I see

ASCII text, with very long lines  

How do I solve that?

How to convert text file from lower-case to upper case and save as new file

Posted: 16 Aug 2021 11:03 AM PDT

Please would someone be able to explain how I can convert all the lower case characters in a text file to upper case and then save it as a new file? My file is called NewFile.txt and contains 500 lines of random characters.

Why is the string format for VLC not working for my snapshots?

Posted: 16 Aug 2021 10:52 AM PDT

I wanted the snapshots to have the $t prefix (video file title) but I get no prefix at all, all I get is _2021-08-16-13h02m51s847.png. Am I doing something wrong here?

  • OS: Debian Bullseye

  • Vlc version: 3.0.16

  • video type: hevc encoded in mkv container.

My prefix setting:

enter image description here

Intermittent boot anomaly: has anybody heard of a system's screen going back to the startup image, a minute or so after the Gnome desktop comes up?

Posted: 16 Aug 2021 10:52 AM PDT

This is a weird one.

I have a new System76 Meerkat, running POP, and (intermittently, seemingly at random, maybe once out of 10 system startups), a minute or so after the Gnome desktop appears, the screen reverts to the System76 startup screen, at which point, the only thing it appears to respond to is the power button (which appears to simply initiate a normal power-down).

It either happens within the first few minutes after the Gnome desktop appears, or it doesn't happen at all. It has happened while the system was completely idle, and it has happened while I was navigating the settings screen. And it has never happened twice in a row.

For all I know, the Gnome desktop (and any open applications) might still be there, and might still be responsive to keyboard and mouse activity, but simply hidden behind that startup screen.

I already have a support ticket open on this.

what is the difference between == and -eq in an if statement? [duplicate]

Posted: 16 Aug 2021 10:23 AM PDT

Having the following for simplicity:

while      echo -n "Does the command include flag(s)? (Y/N): "      read option      echo "option: '${option}'"        # Is mandatory use `==` and NOT `-eq`      if [[ $option -eq "y" || $option -eq "n" || $option -eq "Y" || $option -eq "N" ]]; then        echo "Valid option"        break;      else        echo "Invalid option"      fi    do :; done  

If an input of a number is applied it works how is expected: Invalid option appears, but when any character is used how input always Valid option appears and it is not correct, but if is used (observe now == is used and not -eq)

while      echo -n "Does the command include flag(s)? (Y/N): "      read option      echo "option: '${option}'"        # Is mandatory use `==` and NOT `-eq`      if [[ $option == "y" || $option == "n" || $option == "Y" || $option == "N" ]]; then        echo "Valid option"        break;      else        echo "Invalid option"      fi    do :; done  

All work how is expected from the beginning.

So what is the difference between == and -eq in an if statement?

How to search a paticular Tag present in s3 file

Posted: 16 Aug 2021 10:24 AM PDT

Tried searching a particular tag for eg in a s3 file which contains many thousands of records using

sed 's/<FIND>*/' s3filepath.txt  

Now its throwing an err saying

sed: -e expression #1, char:24: unterminated s' Command  

Can someone guide me how to extract data from a huge file with that tag.

What is the mechanism behind shutdown on long-hold off power button, as opposed to quick press?

Posted: 16 Aug 2021 10:24 AM PDT

It is possible to control the behaviour of the power button using the 'HandlePowerKey' option in logind.conf. This is set to 'suspend'. A simple tap of the power button works as expected, suspending the OS. However, a long hold of the button seemingly overrides it and shuts down the computer. How does this occur?

Reason I am asking, is it appears that a script in /lib/systemd/system-sleep does not execute correctly on long-hold power.

Linux doesnt display prompt after using dd command on my custom block device

Posted: 16 Aug 2021 09:37 AM PDT

I have written a Linux block driver for a custom hardware device on my embedded system. The driver works fine but if I run a command (such as dd if=/dev/zero of=/dev/nvme bs=1M count=16), then after it completes I dont get a prompt displayed. I have to press the return key. Does anyone know what is causing this issue? Thanks

ppp between two machines over serial without a modem with login

Posted: 16 Aug 2021 09:17 AM PDT

I have a problem similar to this with difference I have a getty (actually "agetty") over the serial line I need to use.

To recap:

  • I have a Linux SBC connected over null-modem serial line to a Server (ubuntu).
  • The SBC has a systemd-controlled agetty on that serial line which is "debugging UART".
  • I cannot (read: "I was unable to") disable agetty because RootFS is a SquashFS (ro).
  • I can access target (SBC) computer via other means (adb shell).
  • I want to get a ppp link between the two machines.

I tried several strategies but:

  • if agetty still "owns" the serial line Target system will never see any input.
  • if I try to start pppd from a "live" terminal over the seial line (after logging in with picocom) apparently nothing works.

I did not (yet) attempt using "chat" simply because I don't really know how to use it.

Any Ready-to-use recipe would be most welcome.

gathering all files inside specific occurrences of directory recusrively

Posted: 16 Aug 2021 09:27 AM PDT

I have a project that has a lot of directories which contain files with extension .strings.

These files are localizations in several languages.

For example, I may have 3 files with the same name, like MyView.strings but each file is inside a localization directory like en.lproj, it.lproj or pt-PT.lproj. There are hundreds of these directories inside the project structure.

I am creating a bash script to list the directories where all these files are, by language.

Example: I would like to scan the directory structure and find all en.lproj directories the structure may have and list the full path of all files inside these directories.

For that matter, a command like that will do the trick on the terminal window

find . -type d -name "en.lproj" -print    

but how do I store the result of such a command to an array that I can enumerate later, inside a bash script?

I have tried this

result=($(find . -type d -name "en.lproj" -print))  

but because the paths contain spaces, the array is broken on that spaces, and I was expecting result to be an array where each line is a path, containing or not spaces.

I am on macOS BigSur.

Ubuntu: server is doing nothing, but memory is full

Posted: 16 Aug 2021 10:59 AM PDT

My server is actually on this state:

enter image description here

I am executing htop as root, so I'd see everything. Sorting by MEM%, I see al processes under 1%. And this even in tree view).

But what does it mean when memory bar is 100% green and also the swap file is 100% red?

Odd Issue with Sessions Originating form NATed Network

Posted: 16 Aug 2021 08:48 AM PDT

I am having an odd Apache issue where one device of two devices on the same remote network will timeout at 60 seconds. I have been able to ext3end that to two minutes by setting TimeOut to 120 seconds, but the second device still loosing connection with the server. A get a generic 'Could not open the page as the server stopped responding' (Safari).

My test is to load a simple page (php script that only prints date) on my desktop and on my iPad Pro. I wait exactly 60 seconds and refresh the iPad and I get the error. This result can be replicated on many end-user networks.

My first thought was Apache needed to maintain a session for each entity on the remote network as Apache would see them originating from the same IP, but mod_session did not have any affect.

The target server is an AWS Instance running Centos 7, Apache 2.4 (fully patched) and PHP 5.6.4. (I know, there is a project underway to update to Apache 7.X).

I will note that this was not happening on a Centos 6 server running Apache 2.2, and the existing environment only has 4 or less users as it is a development environment.

Any help would be greatly appreciated.

Settings:

httpd.conf:

Timeout 300
KeepAlive On

Prefork settings:

 StartServers       8<br>   MinSpareServers    5<br>   MaxSpareServers   20<br>   ServerLimit      256<br>   MaxClients       256<br>   MaxRequestsPerChild  4000<br>   MaxConnectionsPerChild 0<br>  

Why does not Debian upgrade to Bookworm, even that sources.list defines 'testing'?

Posted: 16 Aug 2021 08:52 AM PDT

After Debian 11 "bullseye" was released on August 14th, 2021, the Debian 12 "bookworm" is now the official "testing" distribution.

Why is my Debian still on bullseye, instead of automatically updating to bookworm, even my sources all point to "testing"?

Details of the steps I performed:

sudo apt update  

and got several messages like:

E: Repository 'http://ftp.cz.debian.org/debian testing InRelease' changed its 'Codename' value from 'bullseye' to 'bookworm'   N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.  Do you want to accept these changes and continue updating from this repository? [y/N]  

This is expectable. I accepted all questions with 'yes'. Then I did

sudo apt upgrade  sudo apt autoremove  sudo apt full-upgrade  

several times in a row, so all these commands now say:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.  

My /etc/os-release still shows bullseye after the upgrade:

user@debian:~$ cat /etc/os-release | grep VERSION  VERSION_ID="11"  VERSION="11 (bullseye)"  VERSION_CODENAME=bullseye  

The testing distribution is correctly recognized as bookworm using distro-info command:

user@debian:~$ distro-info --testing  bookworm  

I use these sources all the time (both before upgrade and after the upgrade):

user@debian:~$ grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/*  /etc/apt/sources.list:  /etc/apt/sources.list:deb http://ftp.cz.debian.org/debian/ testing main contrib non-free  /etc/apt/sources.list:deb-src http://ftp.cz.debian.org/debian/ testing main contrib non-free  /etc/apt/sources.list:  /etc/apt/sources.list:deb http://security.debian.org testing-security main contrib non-free  /etc/apt/sources.list:deb-src http://security.debian.org testing-security main contrib non-free  /etc/apt/sources.list:  /etc/apt/sources.list:deb http://deb.debian.org/debian testing-updates main contrib non-free  /etc/apt/sources.list:deb-src http://deb.debian.org/debian testing-updates main contrib non-free  /etc/apt/sources.list:  grep: /etc/apt/sources.list.d/*: No such file or directory  

can't get service to run on Rock64 SBC

Posted: 16 Aug 2021 08:28 AM PDT

I have a python script that displays the current IP address and time to a LCD screen attached to my device (Rock64 SBC).

The python script runs fine on it's own.

from subprocess import check_output  from time import sleep  from datetime import datetime  from RPLCD.i2c import CharLCD  lcd = CharLCD('PCF8574', 0x27, auto_linebreaks=False)  lcd.clear()  def get_ip():      cmd = "hostname -I | cut -d\' \' -f1"      return check_output(cmd, shell=True).decode("utf-8").strip()  while True:      lcd_line_1 = datetime.now().strftime('%b %d  %H:%M:%S')      lcd_line_2 = "IP " + get_ip()        lcd.home()      lcd.write_string(f'{lcd_line_1}\r\n{lcd_line_2}')      sleep(10)  

Then the service code for lcd.service is this:

[Unit]  Description=LCD IP Display  After=multi-user.target    [Service]  Type=simple  ExecStart=/bin/sh -c "python3 /home/rock64/pi/lcd_ip.py"  WorkingDirectory=/home/rock64/pi  Restart=always  User=rock64    [Install]  WantedBy=multi-user.target  

systemctl status lcd.service displays:

● lcd.service - LCD IP Display     Loaded: loaded (/etc/systemd/system/lcd.service; disabled; vendor preset: enabled)     Active: failed (Result: exit-code) since Mon 2021-08-16 10:07:11 CDT; 18min ago   Main PID: 2181 (code=exited, status=1/FAILURE)    Aug 16 10:07:11 rock64 systemd[1]: lcd.service: Service hold-off time over, scheduling restart.  Aug 16 10:07:11 rock64 systemd[1]: lcd.service: Scheduled restart job, restart counter is at 10.  Aug 16 10:07:11 rock64 systemd[1]: Stopped LCD IP Display.  Aug 16 10:07:11 rock64 systemd[1]: lcd.service: Start request repeated too quickly.  Aug 16 10:07:11 rock64 systemd[1]: lcd.service: Failed with result 'exit-code'.  Aug 16 10:07:11 rock64 systemd[1]: Failed to start LCD IP Display.  

How can I troubleshoot this?

How are i2c driver modules exposing their devices in Linux?

Posted: 16 Aug 2021 08:28 AM PDT

I am really new to kernel drivers, but want to learn about Linux system programming in general. I am also reading a good book at the moment, but I don't really get behind how I am supposed to communicate with the I2C devices.

I am currently trying to get a heart rate sensor to work with the Raspberry Pi 4. Namely the MAX30102. I luckily found a Linux driver module in the kernel, which wasn't present in the Raspberry Pi kernel by default, but I could recompile the kernel successfully and load the module.

$ find /sys/ -name "max30102"  /sys/bus/i2c/drivers/max30102  /sys/module/regmap_i2c/holders/max30102  /sys/module/industrialio/holders/max30102  /sys/module/max30102  /sys/module/kfifo_buf/holders/max30102  

I am assuming the device to be present at /sys/bus/i2c/devices/i2c-1. By running

$ i2cdetect -y 1       0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  00:          -- -- -- -- -- -- -- -- -- -- -- -- --   10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --   20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --   30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --   40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --   50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --   60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --   70: -- -- -- -- -- -- -- --                           

you can see that the device is successfully detected at address 0x57, which also corresponds to the address specified at the top of the driver module description of the kernel. So far so good, but wouldn't that have also worked without the driver?

I don't really know how much the driver actually does. I have already got a temperature sensor to work for which I only had to load the w1 module for the one-wire bus and assign a certain pin to it. Afterwards I could read the values from a file located in /sys/bus/w1/.... So the whole driver took care of reading out the value from the sensor and I am assuming that the driver for the heart rate sensor does the same, but I can't see the LED blinking or find any data in the corresponding device folder. The sensor has a special interrupt pin, which I have connected to GPIO pin 4 of the Pi according to this guide for Python. The mentioned script works and reads out values from the sensor, but I neither have an idea how to tell the kernel driver to use that pin now so I can use it in a C program, nor am I sure if the internal pullup resistors are set automatically.

I could proceed now using this guide about the I2C interface of the kernel. But this would feel like writing my own driver, which I could do, but would take me a few weeks at least. So am I supposed to communicate with the device using this API or shouldn't the device work out-of-the-box? From the driver module code it looks like it takes care of everything, but I am missing a documentation for it. For experienced users it is probably clear how to use that driver and I guess therefore there isn't a documentation, but I have no idea how to proceed.

Audio and Video Play pauses Rapidly

Posted: 16 Aug 2021 08:38 AM PDT

While playing a video in any browser or in any of my laptop player, the video play-pauses automatically and very rapidly. This problem used to exist earlier when I used windows. thinking it's a OS problem I replace windows with Ubuntu. But the problem still exists. the only difference I see is during the problem while in windows the touchpad stopped working. Here in ubuntu during the troubling time the mousepad works, but the keyboard stops working properly. I couldn't diagnose this properly in windows but in Ubuntu.To test I opened the text file to check any keystroke. but nothing. I ran the xev command and evtest and found the following result printing hundreds of times.

KeymapNotify event, serial 37, synthetic NO, window 0x0,  keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0            0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0       FocusOut event, serial 37, synthetic NO, window 0x3200001,  mode NotifyGrab, detail NotifyAncestor    FocusIn event, serial 37, synthetic NO, window 0x3200001,  mode NotifyUngrab, detail NotifyAncestor        Output of evtest on my keyboard (repeating automatically forever):    Event: time 1629127359.793124, -------------- SYN_REPORT ------------  Event: time 1629127359.832714, type 4 (EV_MSC), code 4 (MSC_SCAN), value a2  Event: time 1629127359.832714, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0  Event: time 1629127359.832714, -------------- SYN_REPORT ------------  Event: time 1629127359.879717, type 4 (EV_MSC), code 4 (MSC_SCAN), value a2  Event: time 1629127359.879717, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1  Event: time 1629127359.879717, -------------- SYN_REPORT ------------  Event: time 1629127359.918939, type 4 (EV_MSC), code 4 (MSC_SCAN), value a2  Event: time 1629127359.918939, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0  

Please help me understand the above as I'm fairly new to linux, further pls suggest me ways I can diagnose this further and solve

Where to put script in pam.d file?

Posted: 16 Aug 2021 09:03 AM PDT

I'm trying to add a script that will take a picture when someone unlocks my machine, as per this question. Right now, I have fprint setup so that I can unlock using my fingerprint - the line auth sufficient pam_fprintd.so is in /etc/pam.d/system-auth (as well as /etc/pam.d/sudo, /etc/pam.d/lightdm, /etc/pam.d/lightdm-autologin, for convenience).

I have written a script that does this, and I found this question and answer useful - basically add the line session optional pam_exec.so /path/script.sh to /etc/pam.d/system-auth.

However, this takes a picture every time my authentication is required/used. This is a bit of overkill for me, and I want to avoid this.

Where/how can I add pam_exec.so /path/script.sh such that everytime I unlock, the script runs?

Also, is there a reasonably simplified resource explaining how pam.d works on Arch based systems? The Arch wiki and this page are alright, but are missing some points I feel.

Rsyslog - Parsing audit.log / omprog change log value

Posted: 16 Aug 2021 10:37 AM PDT

I'm trying to parse audit.log with rsyslog by using a bash script in order to transform the hex part of proctitle to ascii. However I do not get ressults: the file audit_ascii.log do not have lines with "proctitle" values. I tested the script and it is working fine so I guess the problem comes from my rsyslog.conf.

rsyslog.conf:

$InputFileName /var/log/audit/audit.log  $InputFileTag tag_auditd:  $InputFileStateFile log_audit  $InputFileSeverity info  $InputFileFacility local6  $InputRunFileMonitor    if $msg contains "msg=audit" then {  action(type="omprog" binary="/bin/bash /opt/bin/hex2ascii.sh" output="/var/log/audit/audit_ascii.log")  

hex2ascii

    #!/bin/bash      read log            hasHex=$(echo $log | egrep "msg=audit" | egrep "type=PROCTITLE" | egrep -v '"' | wc -c)            if [ ${hasHex} -gt 0 ];      then          part1=$(echo $log | cut -d"=" -f1-3)                part2=$(echo $log | cut -d"=" -f4)          part2=$(echo $part2 | xxd -r -p )          echo $part1 >> /var/log/audit/verif.txt           #echo "${part1}=${part2}\n" >> /var/log/audit/audit_ascii.log          log="${part1}=${part2}\n"      #else          #echo $log >> /var/log/audit/audit_ascii.log                    fi  

Make the regex find any word that contains at least one lower case letter

Posted: 16 Aug 2021 09:58 AM PDT

How to fix this regex so it finds any word that contains at least one lower case letter grep -E -e '^[S][a-z]+, [^S][a-z]+' People.txt. The regex I am using know is to search for the second name that stars with capital S followed by comma and then space and then the first name that starts with any letter other than S. I want to fix this regex so it can also find a name like thisSbBBB, PaUU. I am using grep in the terminal of MacBook

Smith(second name) Paul(first name)

Text file

Smith, Paul  SbBBB, PaUU  Pau, Smi  Smi, Smi  SA, PA    

The output of the regex

Smith, Paul  SbBBB, PaUU  

Is there a way to check what newline characters your operating system uses?

Posted: 16 Aug 2021 09:14 AM PDT

I'm trying to run this open source bash script and it is not working because it is assuming I am running linux when it is parsing inputs. Actually, I'm running cygwin on a Windows machine. There is a spot in the script where it sets the $IFS to \n, which leaves behind a \r which causes errors because it can't match exact strings.

It would be easy to modify my local version of the script, but how would I fix this so it works on any OS? If I could run some command to get the newline characters, then i could assign them to $IFS.


For some additional context, the code that's dealing with newlines is this:

IFS=\n  # Word splitting is intended here  # shellcheck disable=2046  set -- $(printf '%s\n' "$_response" | jq -r '      .error,      .access_token,      .token_type,      .expires_in,      .refresh_token,      .scope')  IFS=$oifs    [ "$1" = "null" ] && ...  

That test ends up comparing "null\r" to "null".

Skipping files when using grep

Posted: 16 Aug 2021 10:40 AM PDT

How can I modify the following bash code to make it select files by a certain numeric value ? For instance selcnt=3 would search the pattern every third file, selcnt=5 would search the pattern every fifth file, etc.

grep -r -l "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}" |    while read f; do      echo -e $(tput setaf 46)"==> $f <==\n"$(tput sgr0)      grep -ni "${ictx[@]}" -e "$ptrn" -- "$f"      echo ""    done  

The intention is to speed up the search process, but keeping the output sectioned one file at a time. One way to spped the process would be for different runs processing different files, for instance, by skipping files.

Run 1: Start from file 1 and skipping two files;   Run 2: Start from file 2 and skipping two files;    Run 3: Start from file 2 and skipping two files.     

As first attempt I have used

ist=1; isk=2  grep --null -r -l "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}"  |    sed -z '${ist}~${isk}!d'  |    while IFS= read -rd '' fl; do      printf '%s\n\n' "${grn}==> $fl <==${sgr}"      grep -ni "${ictx[@]}" -e "$ptrn" -- "$fl"    done  

But I am getting the error

sed: -e expression #1, char 0: unmatched `{'  

Left Alt+tab and Left Ctrl+Left Shift+tab is not working on my external keyboard

Posted: 16 Aug 2021 09:31 AM PDT

I have been using the EXTERNAL keyboard for the Linux Mint desktop.
Recently Left Alt+tab ( to switch between the currently opened windows ) and LeftCtrl+LeftShift + tab ( to go to the previous tab in chrome ) stopped working.

Note: If I use the Right ( Cntrl, Shift, alt ) keys for the above combination it works fine. And Left ( Cntrl, Shift, alt ) are working (not for the above combinations )

If there is a way to fix it, let me know.
Thanks in advance :D

Edit:
Output for following Commands

xev

KeyPress event, serial 39, synthetic NO, window 0x6000001,      root 0x6a7, subw 0x0, time 1488504, (163,-9), root:(748,290),      state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,      XLookupString gives 0 bytes:       XmbLookupString gives 0 bytes:       XFilterEvent returns: False    KeyPress event, serial 39, synthetic NO, window 0x6000001,      root 0x6a7, subw 0x0, time 1488512, (163,-9), root:(748,290),      state 0x11, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,      XLookupString gives 0 bytes:       XmbLookupString gives 0 bytes:       XFilterEvent returns: False    KeyRelease event, serial 39, synthetic NO, window 0x6000001,      root 0x6a7, subw 0x0, time 1490120, (163,-9), root:(748,290),      state 0x15, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,      XLookupString gives 0 bytes:       XFilterEvent returns: False    KeyRelease event, serial 39, synthetic NO, window 0x6000001,      root 0x6a7, subw 0x0, time 1490144, (163,-9), root:(748,290),      state 0x14, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,      XLookupString gives 0 bytes:       XFilterEvent returns: False  

setxkbmap -print

xkb_keymap {      xkb_keycodes  { include "evdev+aliases(qwerty)" };      xkb_types     { include "complete"  };      xkb_compat    { include "complete"  };      xkb_symbols   { include "pc+us+inet(evdev)" };      xkb_geometry  { include "pc(pc105)" };  };  

How to get rid of Konsole toolbar

Posted: 16 Aug 2021 08:29 AM PDT

It happened to me after an update to Konsole.

How can I remove the icons in the red box below?

There is a Show Menubar checkbox on context menu, I'm wondering why lack of Show toolbox checkbox made such a pain in ass.

enter image description here

How to get a fuzzy xdg-open with fzf in zsh?

Posted: 16 Aug 2021 10:42 AM PDT

THE QUESTION

I've been trying to use fzf to bind a shortcut (preferebly Ctrl + o) to interactively search a file and pipe it to xdg-open in zsh. Many shortcuts are already part of the fzf utility, as long as you source the file located in fzf/shell/key-bindings.zsh. There, you'll find snippets for binding Ctrl + r to fuzzy search your command history and Ctrl + t to fuzzy complete your current command line. Here's what the first shortcut looks like in fzf's source code:

# CTRL-R - Paste the selected command from history into the command line  fzf-history-widget() {    local selected num    setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null    selected=( $(fc -rl 1 | perl -ne 'print if !$seen{(/^\s*[0-9]+\**\s+(.*)/, $1)}++' |      FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) )    local ret=$?    if [ -n "$selected" ]; then      num=$selected[1]      if [ -n "$num" ]; then        zle vi-fetch-history -n $num      fi    fi    zle reset-prompt    return $ret  }  zle     -N   fzf-history-widget  bindkey '^R' fzf-history-widget  

Of course, its behavior is a bit different from the behavior I want since it pastes the selected result to the command line instead of piping it directly to a command. The following bash script, though, has precisely the behavior I expected and running it does a much better job at explaining it than myself.

bind -x '"\C-o": file="$(fzf --height 40% --reverse)" && [ -f "$file" ] && xdg-open "$file"'  

I've also found this fish function with the same behavior, but fish's syntax is very different from POSIX compliant shells like zsh and bash so I don't know how helpful of reference that can be.

Now then, does anyone know to bind Ctrl + o to an interactive fzf search that pipes its result directly to xdg-open in zsh?

Thanks in advance!


THE ANSWER

Here's a working script, which I wrote based on this Stack Overflow answer.

fuzzy-xdg-open() {    local output    output=$(fzf --height 40% --reverse </dev/tty) && xdg-open ${(q-)output}    zle reset-prompt  }    zle -N fuzzy-xdg-open  bindkey '^o' fuzzy-xdg-open  

Download data from DropBox to remote server (via scp)

Posted: 16 Aug 2021 10:02 AM PDT

I'm trying to transfer some large, gzipped files from a collaborator's DropBox to a remote server. Is there a way to do this with scp? Or is there a preferred method?

Thank you in advance!

How to boot UEFI image from PXE?

Posted: 16 Aug 2021 11:02 AM PDT

I would like to load Memtest86 image file from PXE. Unfortunately, their ISO file on site contains old version of Memtest, which load automatically with this config:

DEFAULT menu.c32  PROMPT 0  #MENU BACKGROUND moon800.jpg  #MENU RESOLUTION 800 600  #MENU MARGIN 20    MENU TITLE In The Moon Network    LABEL memtest  MENU LABEL Memtest86 7.3  KERNEL memdisk  INITRD /iso/Memtest86-7.3.iso  APPEND iso raw  ...  

Is it possible to boot this image as UEFI?

PCI Passthrough KVM with vfio-pci giving EINVAL on PCI Probe

Posted: 16 Aug 2021 09:04 AM PDT

I am attempting to attach PCIe devices in passthrough to my KVM domain. I have two devices in one IOMMU group (#28):

03:00.0 PCI bridge: Texas Instruments XIO2001 PCI Express-to-PCI Bridge  04:00.0 Multimedia audio controller: Texas Instruments TMS320C6414 TMS320C6415 TMS320C6416  

and lspci -n values:

03:00.0 0604: 104c:8240  04:00.0 0401: 104c:a106  

I am running Ubuntu 14.04. I have:

  • Installed KVM, set up domains, ensured KVM and vfio-pci modules are loaded
  • Set intel_iommu=on on the kernel command line and verified it is enabled with dmesg
  • kvm-ok prints acceleration is all set, VT-d is supported on the chipset
  • Verified that the 03:00.0 device does not have a driver currently listed under ls -l /sys/bus/pci/devices/0000\:03\:00.0/

So I do this to bind the devices to vfio-pci:

# echo "104c a106" > /sys/bus/pci/drivers/vfio-pci/new_id  # echo "104c 8240" > /sys/bus/pci/drivers/vfio-pci/new_id  

Then:

root@tupac:~# echo "0000:03:00.0" > /sys/bus/pci/drivers/vfio-pci/bind   bash: echo: write error: No such device  

However, the multimedia controller appears AOK:

root@tupac:~# ls -l /sys/bus/pci/drivers/vfio-pci/  total 0  lrwxrwxrwx 1 root root    0 Feb 24 13:07 0000:04:00.0 -> ../../../../devices/pci0000:00/0000:00:02.2/0000:03:00.0/0000:04:00.0  --w------- 1 root root 4096 Feb 24 13:05 bind  lrwxrwxrwx 1 root root    0 Feb 24 13:07 module -> ../../../../module/vfio_pci  --w------- 1 root root 4096 Feb 24 13:15 new_id  --w------- 1 root root 4096 Feb 23 19:47 remove_id  --w------- 1 root root 4096 Feb 23 19:43 uevent  --w------- 1 root root 4096 Feb 24 13:07 unbind  

03:00.0 (which is a PCIe to PCI adapter) is not showing up under vfio-pci's devices. Likewise when attempting to use the kvm managed configuration I get:

virsh # start rivendell  error: Failed to start domain rivendell  error: Failed to bind PCI device '0000:03:00.0' to vfio-pci: No such device  

and under syslog I get what I believe to be the PCIe EINVAL code:

Feb 23 19:46:46 tupac kernel: [  214.159625] vfio-pci: probe of 0000:03:00.0 failed with error -22  

What is causing this? Is this some issue with the presence of the PCI bus in the system behind the adapter?

Get wine to honor system fontconfig settings (subpixel antialiasing, slight hinting)

Posted: 16 Aug 2021 08:47 AM PDT

A freshly compiled Wine-1.7.51 works almost fine, but it does not honor the system's (Gnome's) fontconfig settings. Specifically, it ignores subpixel rendering (using greyscale antialiasing if the system uses greyscale or RGB, and no antialiasing otherwise). It also ignores the hinting setting (None, Slight, Medium, Full). I don't know which it defaults to, but it always looks the same.

Wine is built using the system fontconfig / freetype, which works fine, and supports RGB subpixel antialiasing and slight hinting (which is what I want). This is not one of the old bytecode interpreter or lcd filter issues with freetype, my system freetype is fine for me. I also tried multiple fonts; I know wine might override the settings for certain default fonts.

I remember there was "one wierd trick" to get wine to use the right settings, but I forgot what it was (it was probably either a small source code change, or a custom fontconfig XML file that got loaded via environment variable). Any ideas?

No comments:

Post a Comment