Friday, May 28, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Change permission or encrypt files

Posted: 28 May 2021 09:03 AM PDT

Is it better security-wise to protect your files by encrypting or changing permissions (like 600)?

Kernel-ml-devel installed on Centos 8 Stream but the packages is not considered as kenel-devel replacement

Posted: 28 May 2021 08:40 AM PDT

I have an issue, Thanks in Adance, I am long time Ubuntu user, using fedora since last year, but a newbie for Centos,

I installed centos 8 stream in my auxiliary laptop, after using fedora I feel dnf is more handy than apt, I really want an ubuntu lts equivalent of dnf based distros, so I chose Centos stream. My wifi card wont work with old kernel ( the default that shipped in the centos iso ) and I installed the kernel-ml-5.12.6 package from elrepo and every thing worked,

The issue I am facing is I couldn't use virtualbox as it depends on kernel-devel package and even though I have installed the equivalant kernel-ml-devel pakage from elrepo, still VirtualBox is looking for kernel-devel package.

Any solution is highly appreciated.

WARNING: The vboxdrv kernel module is not loaded. Either there is no module           available for the current kernel (5.12.6-1.el8.elrepo.x86_64) or it failed to           load. Please try load the kernel module by executing as root               dnf install akmod-VirtualBox kernel-devel-5.12.6-1.el8.elrepo.x86_64             akmods --kernels 5.12.6-1.el8.elrepo.x86_64 && systemctl restart vboxdrv.service             You will not be able to start VMs until this problem is fixed.  
Installed Packages  Name         : kernel-ml-devel  Version      : 5.12.6  Release      : 1.el8.elrepo  Architecture : x86_64  Size         : 53 M  Source       : kernel-ml-5.12.6-1.el8.elrepo.src.rpm  Repository   : @System  From repo    : @commandline  Summary      : Development package for building kernel modules to match the kernel  URL          : https://www.kernel.org/  License      : GPLv2  Description  : This package provides kernel headers and makefiles sufficient to build modules               : against the kernel package.  

Transmission rewrites colons in directory names to underscores

Posted: 28 May 2021 08:45 AM PDT

Transmission appears to replace colons : in (the parent) directory name with the underscore _ character for added torrents. How to disable this behavior?

for instance:

Wikipedia: en-2020-01Wikipedia_ en-2020-01


version 3.00 (bb6b5a062e)

W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:7

Posted: 28 May 2021 08:26 AM PDT

Error while running "sudo apt-get update"

 xyz@xyz:~$ sudo apt-get update  Hit:1 https://dl.winehq.org/wine-builds/ubuntu focal InRelease  Hit:2 http://packages.microsoft.com/repos/code stable InRelease                             Hit:3 http://archive.canonical.com/ubuntu focal InRelease                                   Hit:4 http://ppa.launchpad.net/maarten-fonville/android-studio/ubuntu focal InRelease  Hit:5 http://archive.ubuntu.com/ubuntu focal InRelease  Hit:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease  Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]  Hit:8 http://ppa.launchpad.net/ubuntuhandbook1/lives/ubuntu focal InRelease  Get:9 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]  Hit:10 http://dl.google.com/linux/chrome/deb stable InRelease  Fetched 214 kB in 6s (37.1 kB/s)  Reading package lists... Done  W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:7  W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:7  

How to fix "qemu-system-x86_64: symbol lookup error: /lib/x86_64-linux-gnu/libvirglrenderer.so.0: undefined symbol: drmPrimeHandleToFD"?

Posted: 28 May 2021 07:40 AM PDT

I want to run qemu on Debian Buster, and have therefore installed the qemu-system-x86_64 package.

The issue is that when I run:

qemu-system-x86_64 \      -m 128M \      -cpu kvm64,+smep,+smap \      -kernel vmlinuz \      -initrd initramfs.cpio.gz \      -hdb flag.txt \      -snapshot \      -nographic \      -monitor /dev/null \      -no-reboot \      -append "console=ttyS0 kaslr kpti=1 quiet panic=1" \  

I get the following error:

qemu-system-x86_64: symbol lookup error: /lib/x86_64-linux-gnu/libvirglrenderer.so.0: undefined symbol: drmPrimeHandleToFD  

How can I fix this error?

According to apt, I've the latest version of libvirglrenderer0 and there are no versions available in debian-backports.

Versions:

qemu-system-x86/stable,stable,now 1:3.1+dfsg-8+deb10u8 amd64 [installed]  libvirglrenderer0/stable,now 0.7.0-2 amd64 [installed]  

Debian:

uname -a  Linux debian-parallels 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux  

Visudo syntax error when editing a sudoers file

Posted: 28 May 2021 08:43 AM PDT

I am adding this file

cat /etc/sudoers.d/myuser    myuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl start compose-service, /usr/bin/systemctl status compose-service  

where compose-service is a custom systemd service I have created / enabled.

However the visudo command informs me there is a syntax error (on line 1)

Is something wrong with the statement above?

Working on Ubuntu 20.04

Why is Debian not booting with a GUI, but instead to the tty1 console, despite AMD drivers being installed

Posted: 28 May 2021 07:27 AM PDT

As the title might already suggest, I currently have a problem where my newly installed Debian doesn't start with any GUIs, despite me clearly selecting them in the installation process. Interestingly, I already have the AMD drivers installed, even the non-free ones. But despite that, I can't execute "startx" successfully, as it says that it can't find /dev/dri/card0, and after that, it tells me that it can't run in framebuffer mode.

I know that this might not be enough to debug the problem, but I am very new to the whole Linux ecosystem, so I don't have any idea what exactly would help. So, if you need more details, please tell me so in the comments so that I can provide them.

My hardware specs:

  • Graphics card: AMD RX 5700
  • CPU: AMD Ryzen 9 3900X
  • Disk space: 500 GB
  • RAM: 32 GB

I should maybe add that I selected the sddm display manager and KDE and Gnome whilst installing Debian.

Can someone please erxplain to me how to fix Kali Linux's apt update command? I have already done the common fixes!

Posted: 28 May 2021 07:49 AM PDT

apt update is not working in Kali Linux. When i give this command

┌──(root  💀kali)-[~]  └─# apt update  

keep getting this message

Get:1 http://mirrors.jevincanders.net/kali kali-rolling InRelease [30.5 kB]  Reading package lists... Done                                  E: Release file for http://http.kali.org/kali/dists/kali-rolling/InRelease is not valid yet (invalid for another 5h 4min 42s). Updates for this repository will not be applied.  

Can someone please explain to me what i am doing wrong? By the way i have tried to correct the problem by the usual channels so this is a different kind of a problem i think.. Thanks B

PIPESTATUS variable is empty

Posted: 28 May 2021 07:48 AM PDT

I'm working on a Linux server and noticed that the PIPESTATUS array variable is always empty. I'm on bash v4.1.2(1)-release

$ echo $BASH_VERSION  4.1.2(1)-release  $ false | true | false  $ echo ${PIPESTATUS[@]} # returns nothing (empty)  

What could be the reason? I checked online forums including stack exchange but didn't find a good answer

Redirect single file or directory using bubblewrap

Posted: 28 May 2021 07:31 AM PDT

I was wondering how one would use bubblewrap (bwrap) to redirect a single directory or file on Linux, while still allowing access to all other files?

For example, if I wanted to make Firefox conform to the XDG spec, I might do something like:

bwrap \    --bind $HOME/.config/mozilla $HOME/.mozilla \    --bind / / \    /usr/bin/firefox;      

Obviously, I tried the above with no luck.

If anyone has the solution, I'd appreciate the help a lot. The mess of non-XDG-compliant directories in my home directory is driving me insane.

Wallpaper with a calendar

Posted: 28 May 2021 07:59 AM PDT

I was thinking about how they do a wallpaper that displays a calendar and highlight today's day, like when you just install an OS and has the deafult wallpaper that also shows the machine system information, but without beeing an app because that could make the the calendar app stop working all day and save a bit of the machine resources, anyone know how they do it? And if it's not much work explain it to me?

Debian: Harware Limitations for Third Monitor

Posted: 28 May 2021 07:11 AM PDT

I have one laptop with both HDMI and VGA ports. I connected two external monitors. However, I can activate any combination of two monitors simultaneously, yet never all three together: in the settings it says "Changes cannot be applied", "this could be due to hardware limitations". Output from xrandr:

Screen 0: minimum XXX, current XXX, maximum XXX

LVDS-1 connected (normal left inverted right x axis y axis)

a bounch of lines with all resolutions

VGA-1 connected primary XXX left (normal left inverted right x axis y axis) XXXmm x XXXmm

  a bounch of lines with all resolutions  

HDMI-1 connected XXX left (normal left inverted right x axis y axis) XXXmm x XXXmm

  a bounch of lines with all resolutions  

a bounch of lines with a number of other "ports-XXX disconnected"

Any help would be greatly appreciated.

Unix file matching logic

Posted: 28 May 2021 08:00 AM PDT

I have a project requirement in which I need to read file1 from top to bottom and match column 2 of it with column 3 of file2. Both files are tab delimited.

If a record matches, I have to write full record from file 1 to new file3 and if it doesn't match, I have to write the same record into error file (file4). File1 and file2 contain 500-510 records. Need to start reading file1 from start and find the value of column 2 in column 3 of file2 (full scan from top to bottom if required).

file1

ZZA 01  LIST18  ZZY 02  LIST38  UTW 80  LIST100  OOP 11  LIST56  

file2

A1  21138   99999   LIST18  W1  20223   99999   LIST44  Z9  20355   99999   LIST56  O9  21002   21154   LIST11  

file3

ZZA 01  LIST18  OOP 11  LIST56  

file4

ZZY 02  LIST38  UTW 80  LIST100  

Problem trying to replace Ubuntu with Mint

Posted: 28 May 2021 08:15 AM PDT

I have tried replacing Ubuntu with Linux Mint. I made a file (installed.list) using apt list --installed > installed.list. It created a file with the installed packages. After that, I installed linux Mint alongside Ubuntu. Then I copied the /home folder (including the dotfiles) to Mint. I tried installing the packages again from the installed.list file using sudo apt install $(cut -d'/' -f1 installed.list). I get this error E: Unable to locate package and it's name for every package I try to install.

Output:

Reading package lists... Done  Building dependency tree         Reading state information... Done  Package snapd is not available, but is referred to by another package.  This may mean that the package is missing, has been obsoleted, or  is only available from another source    Package libgc1 is not available, but is referred to by another package.  This may mean that the package is missing, has been obsoleted, or  is only available from another source  However the following packages replace it:    libgc1c2:i386 libgc1c2    Package virtualbox-6.1 is not available, but is referred to by another package.  This may mean that the package is missing, has been obsoleted, or  is only available from another source    E: Unable to locate package Listing...  E: Unable to locate package 4kvideodownloader  E: Unable to locate package bsdextrautils  E: Unable to locate package code  E: Unable to locate package jdk-16  E: Unable to locate package libcdio19  E: Unable to locate package libdav1d4  E: Unable to locate package libdav1d4  E: Unable to locate package libdns-export1110  E: Unable to locate package libdvdread8  E: Unable to locate package libebml5  E: Unable to locate package libedataserver-1.2-25  E: Unable to locate package libffi8ubuntu1  E: Unable to locate package libffi8ubuntu1  E: Unable to locate package libfm-qt7  E: Package 'libgc1' has no installation candidate  E: Unable to locate package libgnustep-base1.27  E: Unable to locate package libgpaste13  E: Unable to locate package libhandy-1-0  E: Unable to locate package libhfstospell11  E: Unable to locate package libhogweed6  E: Unable to locate package libhogweed6  E: Unable to locate package libicu67  E: Unable to locate package libicu67  E: Unable to locate package libilmbase25  E: Unable to locate package libjson-c5  E: Unable to locate package liblibreoffice-java  E: Unable to locate package libmatroska7  E: Unable to locate package libmetacity3  E: Unable to locate package libmetrics-any-perl  E: Unable to locate package libmutter-7-0  E: Unable to locate package libnettle8  E: Unable to locate package libnettle8  E: Unable to locate package libnma-common  E: Unable to locate package libnsl-dev  E: Unable to locate package libnsl2  E: Unable to locate package libnsl2  E: Unable to locate package libnss-nis  E: Unable to locate package libnss-nis  E: Unable to locate package libnss-nisplus  E: Unable to locate package libnss-nisplus  E: Unable to locate package libopenexr25  E: Unable to locate package liborcus-parser-0.15-0  E: Unable to locate package libplacebo72  E: Unable to locate package libpoppler102  E: Unable to locate package libpoppler102  E: Unable to locate package libprotobuf-lite23  E: Unable to locate package libprotobuf23  E: Unable to locate package libqpdf28  E: Unable to locate package libqt5qmlmodels5  E: Unable to locate package libqt5qmlworkerscript5  E: Unable to locate package libreoffice-style-yaru  E: Unable to locate package libsrt1-gnutls  E: Unable to locate package libtepl-5-0  E: Unable to locate package libtest-metrics-any-perl  E: Unable to locate package libx264-160  E: Unable to locate package libx264-160  E: Unable to locate package libx265-192  E: Unable to locate package libx265-192  E: Unable to locate package libx86emu3  E: Unable to locate package linux-headers-5.8.0-50  E: Unable to locate package linux-headers-5.8.0-53  E: Unable to locate package microsoft-edge-beta  E: Unable to locate package rpcsvc-proto  E: Package 'snapd' has no installation candidate  E: Unable to locate package ubuntu-wallpapers-groovy  E: Package 'virtualbox-6.1' has no installation candidate  E: Unable to locate package vivaldi-stable  E: Unable to locate package wps-office  E: Unable to locate package zoom    

installed.list:

Listing...  4kvideodownloader/now 4.15-1 amd64 [installed,local]  a11y-profile-manager-indicator/groovy,now 0.1.11-0ubuntu4 amd64 [installed,automatic]  accountsservice-ubuntu-schemas/groovy,groovy,now 0.0.7+17.10.20170922-0ubuntu1 all [installed,automatic]  accountsservice/groovy-updates,groovy-security,now 0.6.55-0ubuntu13.2 amd64 [installed,automatic]  acl/groovy,now 2.2.53-8 amd64 [installed,automatic]  acpi-support/groovy,now 0.143 amd64 [installed,automatic]  acpid/groovy,now 1:2.0.32-1ubuntu1 amd64 [installed,automatic]  activity-log-manager/groovy,now 0.9.7-0ubuntu27 amd64 [installed,automatic]  adcli/groovy-updates,groovy-security,now 0.9.0-1ubuntu1.2 amd64 [installed,automatic]  adduser/groovy,groovy,now 3.118ubuntu2 all [installed,automatic]  adium-theme-ubuntu/groovy,groovy,now 0.3.4-0ubuntu4 all [installed,automatic]  adwaita-icon-theme/groovy,groovy,now 3.38.0-1ubuntu1 all [installed,automatic]  aisleriot/groovy,now 1:3.22.9-1 amd64 [installed,automatic]  alsa-base/groovy,groovy,now 1.0.25+dfsg-0ubuntu5 all [installed,automatic]  alsa-topology-conf/groovy,groovy,now 1.2.3-1 all [installed,automatic]  alsa-ucm-conf/groovy-updates,groovy-updates,now 1.2.2-1ubuntu5.2 all [installed,automatic]  alsa-utils/groovy,now 1.2.3-1ubuntu1 amd64 [installed,automatic]  amd64-microcode/groovy,now 3.20191218.1ubuntu1 amd64 [installed,automatic]  anacron/groovy,now 2.3-29 amd64 [installed,automatic]  apg/groovy,now 2.2.3.dfsg.1-5 amd64 [installed,automatic]  app-install-data-partner/groovy,groovy,now 19.04 all   

NOTE:There are more but it's almost 220.000 characters.

Original Post here.

Usb DIsk Shows"unrecognised disk label" Unable to do dd, partition or reformat

Posted: 28 May 2021 07:21 AM PDT

A Complete Noob here!

I am having trouble using my Pendrive in my arch system. It does not mount. When I opened GParted I noticed it is taking longer to load and Pendrive was named /dev/sdd in spite of /dev/sda. And it was showing an error flag. The error is: /dev/sdd: unrecognised disk label When I tried to format it. It is taking forever, so I canceled the process.

On using sudo mke2fs -n /dev/sdd it is showing output as:

mke2fs 1.46.2 (28-Feb-2021)  Creating filesystem with 3779198 4k blocks and 946560 inodes  Filesystem UUID: 8f872a08-2d03-442e-ac1a-6aef3d5e0b69  Superblock backups stored on blocks:           32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208  

So I manually did to all superblocks:

sudo e2fsck -b 32768 /dev/sdd

Yet this did not fix my problem. I don't care about the data in that Pendrive. I just want to get it fixed. Please Help me

Thank You

AWK: how can I remove repeated header lines from CSV?

Posted: 28 May 2021 08:49 AM PDT

Dealing with the csv produced by the concatenation of several CSVs, I am looking for the possibility to remove repeats of the header lines (present in the each concatunated CSV being identical among them). here is my CSV contained repeats of the first line:

ID(Prot),   ID(lig),    ID(cluster),    dG(rescored),   dG(before), POP(before)  1000,   lig40,  1,  0.805136,   -5.5200,    79  1000,   lig868, 1,  0.933209,   -5.6100,    42  1000,   lig278, 1,  0.933689,   -5.7600,    40  1000,   lig619, 3,  0.946354,   -7.6100,    20  1000,   lig211, 1,  0.960048,   -5.2800,    39  1000,   lig40,  2,  0.971051,   -4.9900,    40  1000,   lig868, 3,  0.986384,   -5.5000,    29  1000,   lig12,  3,  0.988506,   -6.7100,    16  1000,   lig800, 16, 0.995574,   -4.5300,    40  1000,   lig800, 1,  0.999935,   -5.7900,    22  1000,   lig619, 1,  1.00876,    -7.9000,    3  1000,   lig619, 2,  1.02254,    -7.6400,    1  1000,   lig12,  1,  1.02723,    -6.8600,    5  1000,   lig12,  2,  1.03273,    -6.8100,    4  1000,   lig211, 2,  1.03722,    -5.2000,    19  1000,   lig211, 3,  1.03738,    -5.0400,    21  ID(Prot),   ID(lig),    ID(cluster),    dG(rescored),   dG(before), POP(before)  10V1,   lig40,  1,  0.513472,   -6.4600,    150  10V1,   lig211, 2,  0.695981,   -6.8200,    91  10V1,   lig278, 1,  0.764432,   -7.0900,    70  10V1,   lig868, 1,  0.787698,   -7.3100,    62  10V1,   lig211, 1,  0.83416,    -6.8800,    54  10V1,   lig868, 3,  0.888408,   -6.4700,    44  10V1,   lig278, 2,  0.915932,   -6.6600,    35  10V1,   lig12,  1,  0.922741,   -9.3600,    19  10V1,   lig12,  8,  0.934144,   -7.4600,    24  10V1,   lig40,  2,  0.949955,   -5.9000,    34  10V1,   lig800, 5,  0.964194,   -5.9200,    30  10V1,   lig868, 2,  0.966243,   -6.9100,    20  10V1,   lig12,  2,  0.972575,   -8.3000,    10  10V1,   lig619, 6,  0.979168,   -8.1600,    9  10V1,   lig619, 4,  0.986202,   -8.7800,    5  10V1,   lig800, 2,  0.989599,   -6.2400,    20  10V1,   lig619, 1,  0.989725,   -9.2900,    3  10V1,   lig12,  7,  0.991535,   -7.5800,    9  ID(Prot),   ID(lig),    ID(cluster),    dG(rescored),   dG(before), POP(before)  10V2,   lig40,  1,  0.525767,   -6.4600,    146  10V2,   lig211, 2,  0.744702,   -6.8200,    78  10V2,   lig278, 1,  0.749015,   -7.0900,    74  10V2,   lig868, 1,  0.772025,   -7.3100,    66  10V2,   lig211, 1,  0.799829,   -6.8700,    63  10V2,   lig12,  1,  0.899345,   -9.1600,    25  10V2,   lig12,  4,  0.899606,   -7.5500,    32  10V2,   lig868, 3,  0.903364,   -6.4800,    40  10V2,   lig278, 3,  0.913145,   -6.6300,    36  10V2,   lig800, 5,  0.94576,    -5.9100,    35  

To post-process this CSV I need to remove repetitions of the header line

ID(Prot),   ID(lig),    ID(cluster),    dG(rescored),   dG(before), POP(before)  

keeping the header only in the begining of the fused csv (on the first line!).I have tried to use the following awk one-liner which is looking for the 1st line and then remove its repeates

 awk '{first=$1;gsub("ID(Prot)","");print first,$0}' mycsv.csv > csv_without_repeats.csv  

however it did not recognize the header line, meaning that the pattern was not defined correctly.

How my AWK code could be corrected supposed that further it should be piped to sort in other to sort the lines after the filtering of the repeats ?

awk '{first=$1;gsub(/ID(Prot)?(\([-azA-Z]+\))?/,"");print first,$0}' | LC_ALL=C sort -k4,4g input.csv > sorted_and_without_repeats.csv  

Cleanest way to disable ipv6 on ubuntu 18.04 across multiple machines?

Posted: 28 May 2021 08:01 AM PDT

I have to disable ipv6 on 100+ servers. Obviously I don't want to edit grub of every server by hand, and don't want to play around with sed or other crazy stuff.

I tried to do this:

mkdir -p /etc/default/grub.d/  echo 'GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} ipv6.disable=1"' >> /etc/default/grub.d/disable-ipv6.cfg  

But now my machine won't boot! I need a proper, clean, portable solution to disable ipv6 on ubuntu 18.04 :(

OpenSSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

Posted: 28 May 2021 08:23 AM PDT

I am trying to connect to a ip port using wget:

wget https://VCB-ETT-P67:9001/api/DB/dpc  

Showing error as It is getting connected but showing ssl connection issue

Resolving vcb-ett-p67 (vcb-ett-p67)... 10.33.9.67  Connecting to vcb-ett-p67 (vcb-ett-p67)|10.33.9.67|:9001... connected.    OpenSSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol  Unable to establish SSL connection.  

Your database files were created by PostgreSQL version 13

Posted: 28 May 2021 07:20 AM PDT

OS is openSUSE Tumbleweed. Previously I had PostgreSQL 13 installed. I just removed it by:

> sudo zypper rm 'postgres*'    > sudo zypper rr PostgreSQL    > sudo rm -rf /usr/local/var/postgres  

Then I install PostgreSQL 12 by instructions here:

> sudo zypper addrepo http://download.opensuse.org/repositories/server:database:postgresql/openSUSE_Tumbleweed/ PostgreSQL    > sudo zypper ref    > sudo zypper in -f postgresql postgresql-server postgresql-contrib    > sudo zypper in -f postgresql-plperl postgresql-plpython postgresql-pltlc    > sudo systemctl enable postgresql    > sudo systemctl start postgresql  

But the database status is faulty:

> sudo systemctl status postgresql.service    [sudo] password for root:    ● postgresql.service - PostgreSQL database server       Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)       Active: failed (Result: exit-code) since Thu 2021-05-27 23:08:43 EDT; 2h 10min ago      Process: 1576 ExecStart=/usr/share/postgresql/postgresql-script start (code=exited, status=1/FAILURE)          CPU: 21ms    May 27 23:08:43 localhost systemd[1]: Starting PostgreSQL database server...  May 27 23:08:43 localhost postgresql-script[1576]:  Your database files were created by PostgreSQL version 13.  May 27 23:08:43 localhost postgresql-script[1576]:  Could not find executables for this version.  May 27 23:08:43 localhost postgresql-script[1576]:  Please install the PostgreSQL server package for version 13.  May 27 23:08:43 localhost systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE  May 27 23:08:43 localhost systemd[1]: postgresql.service: Failed with result 'exit-code'.  May 27 23:08:43 localhost systemd[1]: Failed to start PostgreSQL database server.    

For some reason, whatever I try, I cannot get rid of these status errors:

Your database files were created by PostgreSQL version 13.

Could not find executables for this version.

Please install the PostgreSQL server package for version 13.

How can I install PostgreSQL 12 and get rid of PostgreSQL 13 database files?

Shutdown and reboot privileges

Posted: 28 May 2021 08:18 AM PDT

While I tried 'reboot' through normal user (non-root), it went through. I tried 'shutdown' through same user, it also went through after scheduling the shutdown.

But when i tried sudo shutdown through same user, it didnt work.

error:

[rj@localhost ~]$ sudo shutdown  [sudo] password for rj:   rj is not in the sudoers file.  This incident will be reported.  

Questions - How come a normal user do reboot or shutdown? Is it not a security concern ?

Question - if 'shutdown' is working, than why not 'sudo shutdown' ?

Request to pls explain.

I cannot update my system with `pacman`

Posted: 28 May 2021 09:19 AM PDT

Trying to update my system, I get the error: failed to prepare transaction (could not satisfy dependencies).

This is what I get:

~> sudo pacman -Syu  :: Synchronising package databases...   gremlins is up to date   system is up to date   world is up to date   galaxy-gremlins is up to date   galaxy is up to date   lib32 is up to date   extra is up to date   community is up to date   multilib is up to date  :: Starting full system upgrade...  :: Replace libcanberra-pulse with gremlins/libcanberra? [Y/n] n  resolving dependencies...  looking for conflicting packages...  error: failed to prepare transaction (could not satisfy dependencies)  :: installing expat (2.4.1-1) breaks dependency 'expat=2.3.0' required by lib32-expat  :: installing libcap (2.50-1) breaks dependency 'libcap=2.49' required by lib32-libcap  :: installing libelf (0.185-1) breaks dependency 'libelf=0.184' required by lib32-libelf  :: installing libcanberra (0.30+2+gc0620e4-4) breaks dependency 'libcanberra=0.30+2+gc0620e4-3' required by libcanberra-pulse  

I then try to remove the package expat, but I get the message: "Attention: There are forbidden packages in the removal list!"

I looked at this web page, but here they can uninstall the problematic package, while I cannot, since expat is part of core.

What should I do at this point?

Xfce: Tab Key No Longer Navigates Within Some Dialog Windows

Posted: 28 May 2021 07:42 AM PDT

Xfce 4.10

For example, zenity --question invokes an austere zenity question dialog window with default verbiage and two buttons, but, with focus on said window, pressing the Tab key does not visually appear to move the internal focus (as evidenced by a faint, dashed rectangle) to either of the two buttons.

This just started happening recently and I've been unable to find a solution - any ideas for smarter searches appreciated!

Why can I suddenly not access my command line history?

Posted: 28 May 2021 07:49 AM PDT

I use ksh (version: sh (AT&T Research) 2020.0.0) on Ubuntu 20.04, and I use vi command line editing mode (set -o vi). This has worked fine for years, but recently I have noticed some oddities, and finally this morning it stopped working altogether.

  • I can see commands are no longer being saved in ~/.sh_histfile as of this morning
  • In the past, all commands I entered could be found by scrolling up with Esck or eg. searching with Esc/.
  • A while ago, this seemed to change to only remembering successful commands (which is a nuisance).

I haven't made any changes to my configuration yesterday (I think), but command line history works for the root user.

Permissions on ~/.sh_histfile are 600, and HISTFILE is not set, either for my normal user or root.

Any idea what has gone wrong - and of course how to fix it? Ideally I want to get back to the situation when anything I wrote on the command line and finished with Enter would be saved to ~/.sh_histfile.

Edit

The following variables are set:

$ set  _=export  COMP_CWORD=0  COMP_KEY=0  COMP_POINT=0  COMP_TYPE=0  COMP_WORDBREAKS=$'"\'@><=;|&(:'  DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus'  DISPLAY=localhost:11.0  ENV=/home/jan.andersen/.kshrc  FCEDIT=/usr/bin/ex  HISTCMD=1  HOME=/home/jan.andersen  IFS=$' \t\n'  JOBMAX=0  KSH_VERSION=.sh.version  LANG=en_US.UTF-8  LESS=X  LINENO=1  LOGNAME=jan.andersen  MAILCHECK=600  MOTD_SHOWN=pam  OLDPWD=/home/jan.andersen  OPTIND=1  PATH=/home/jan.andersen/.local/bin:/usr/local/glassfish5/bin:/usr/local/glassfish5/glassfish/bin:/usr/local/texlive/2019/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games  PPID=3887  PS1=$'\'$ \''  PS2='> '  PS3='#? '  PS4='+ '  PWD=/home/jan.andersen  RANDOM=18082  SECONDS=17131.589  SHELL=/usr/bin/ksh  SHLVL=1  SH_OPTIONS=astbin=/opt/ast/bin  SSH_TTY=/dev/pts/1  TERM=xterm-256color  TMOUT=0  USER=jan.andersen  XDG_RUNTIME_DIR=/run/user/1000  XDG_SESSION_CLASS=user  XDG_SESSION_ID=10  XDG_SESSION_TYPE=tty  

The local profile contains only default stuff and a coule of lines at the end, that I've added:

$ cat .profile  # ~/.profile: executed by the command interpreter for login shells.  # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login  # exists.  # see /usr/share/doc/bash/examples/startup-files for examples.  # the files are located in the bash-doc package.    # the default umask is set in /etc/profile; for setting the umask  # for ssh logins, install and configure the libpam-umask package.  #umask 022    # if running bash  if [ -n "$BASH_VERSION" ]; then      # include .bashrc if it exists      if [ -f "$HOME/.bashrc" ]; then          . "$HOME/.bashrc"      fi  fi    # set PATH so it includes user's private bin if it exists  if [ -d "$HOME/bin" ] ; then      PATH="$HOME/bin:$PATH"  fi    # set PATH so it includes user's private bin if it exists  if [ -d "$HOME/.local/bin" ] ; then      PATH="$HOME/.local/bin:$PATH"  fi    #eval $(ssh-agent -s)  #ssh-add ~/.ssh/id_rsa  export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR}/ssh-agent.socket  

sed command to replace last occurrence of a word in a file with the content of another file

Posted: 28 May 2021 08:24 AM PDT

  1. macOS sed command to replace last occurrence of a word in a file
  2. Replace with the content from another file
  3. Replace only the last occurrence, means only once.
  4. The word can be a substring abchello or helloabc
  5. There can be trailing whitespace or newline after the word

sample_file_path = "/Users/saurav/sample.text" sample_file_path_1 = "/Users/saurav/sample1.text"

sample.txt:

hello  hi  hello  ok  

sample1.txt:

I  am   doing  great  

Expected output (sample.txt):

hello  hi  I  am   doing  great  ok  

Need to use file path variable

centos7 repartition issue

Posted: 28 May 2021 09:05 AM PDT

I need to give more space to centos-root from centos-home.

I umounted /home, after

lvremove /dev/mapper/centos-home  

then,

lvextend -L 500G /dev/mapper/centos-root  

and final

mount /home    

The issue is that now the ls command from /home gives me:

ls: cannot open directory .: Input/output error.  

I have already tried with xfs_repair /dev/mapper/centos-home, but the result is xfs_repair: cannot open /dev/mapper/centos-home: Device or resource busy

Any other ideas. I don't want to reinstall the operating system.

Thanks a lot!

Font bug in Java apps on Arch Linux

Posted: 28 May 2021 07:04 AM PDT

SOAP UI

What happens with fonts in my JAVA apps? SOAP UI screen as example (see toolbox)... I have no idea where is the problem.

SYS: up-to-date ARCH LINUX.

$ archlinux-java status  Available Java environments:  java-7-openjdk  java-8-jdk (default)  java-8-jre/jre  java-8-openjdk  

Remove extra header lines from file, except for the first line

Posted: 28 May 2021 07:42 AM PDT

I have a file that looks like this toy example. My actual file has 4 million lines, about 10 of which I need to delete.

ID  Data1  Data2  1    100    100  2    100    200  3    200    100  ID  Data1  Data2  4    100    100  ID  Data1  Data2  5    200    200  

I want to delete the lines that look like the header, except for the first line.

Final file:

ID  Data1  Data2  1    100    100  2    100    200  3    200    100  4    100    100  5    200    200  

How can I do this?

Checking if a command is a built-in in ksh

Posted: 28 May 2021 08:11 AM PDT

How can I check if a command is a built-in command for ksh?

In tcsh you can use where; in zsh and bash you can use type -a; and in some modern versions of ksh you can use whence -av.

What I want to do is write an isbuiltin function that works in any version of ksh (including ksh88 and any other "old" versions of ksh) that behaves like this:

  1. Accept multiple arguments and check if each is built-in
  2. Return 0 (success) if all of the given commands are built-in
  3. At the first non-built-in command, stop checking, return 1 (failure), and print a message to stderr.

I already have working functions like this for zsh and bash using the aforementioned commands.

Here is what I have for ksh:

isbuiltin() {    if [[ "$#" -eq 0 ]]; then      echo "Usage: isbuiltin cmd" >&2      return 1    fi    for cmd in "$@"    do      if [[ $cmd = "builtin" ]]; then        #Handle the case of `builtin builtin`        echo "$cmd is not a built-in" >&2        return 1      fi      if ! whence -a "$cmd" 2> /dev/null | grep 'builtin' > /dev/null ; then        echo "$cmd is not a built-in" >&2        return 1      fi    done  }  

This function works for ksh93. However, it appears that ksh88's version of whence doesn't support the -a option, which is the option to make it display all occurrences. Without the ability to display all occurrences, I can only use whence -v, which does tell me whether a command is built-in but only if there isn't also an alias or function of the same name.

Question: Is there something else I can use in place of whence -av in ksh88?


Solution

Using the accepted answer (opening a subshell), here is my updated solution. Place the following in .kshrc:

isbuiltin() {    if [[ "$#" -eq 0 ]]; then      printf "Usage: isbuiltin cmd\n" >&2      return 1    fi    for cmd in "$@"    do      if (           #Open a subshell so that aliases and functions can be safely removed,           #  allowing `whence -v` to see the built-in command if there is one.           unalias "$cmd";           if [[ "$cmd" != '.' ]] && typeset -f | egrep "^(function *$cmd|$cmd\(\))" > /dev/null 2>&1           then             #Remove the function iff it exists.             #Since `unset` is a special built-in, the subshell dies if it fails             unset -f "$cmd";           fi           PATH='/no';           #NOTE: we can't use `whence -a` because it's not supported in older versions of ksh           whence -v "$cmd" 2>&1         ) 2> /dev/null | grep -v 'not found' | grep 'builtin' > /dev/null 2>&1      then        #No-op.  Needed to support some old versions of ksh        :      else        printf "$cmd is not a built-in\n" >&2        return 1      fi    done    return 0  }  

I have tested this with ksh88 in Solaris, AIX, and HP-UX. It works in all the cases I tested. I have also tested this with the modern versions of ksh in FreeBSD, Ubuntu, Fedora, and Debian.

rsyslog doesnt seem to write to log file, without restart after touch'ing the file

Posted: 28 May 2021 08:03 AM PDT

I have a separate file for logging local7 facility, and this file is touched and permissions set, from my installer. But sometimes I see that the logs are not being written to it (after I do a re-install) until I do rsyslog restart!

Is it mandatory to restart rsyslog if the log file is touched by another program/application ?

(since the installer is run as root, the log file's time-stamp will be changed due to touch - will this cause rsyslog to not write to the log file ?)

Use convert to grab a specific page from a PDF file?

Posted: 28 May 2021 09:08 AM PDT

I know I have done this before, so I'm sure it's possible, I just forget how to do it. There's a way to tell convert to grab a specific page of a PDF, and I'd like to keep the format of that page as PDF.

No comments:

Post a Comment