Friday, May 14, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to install Arch Linux [closed]

Posted: 14 May 2021 10:06 AM PDT

I want to dual-boot Arch linux with Windows 10. I 've seen many guides on the internet but I am having some trouble. Can anyone provide me with a step by step guide? Thanks in advance!

What would be the Zsh equivalent to : ${VAR:=value}

Posted: 14 May 2021 10:11 AM PDT

In the traditional Bourne Shell (sh), if one wants to make sure that, at some point in the script, a variable has been set and at least it has some specific default value, one can use this construct:

: ${VAR:=defaultValue}  

What would be the equivalent for a Zsh script?

Thanks.

Edit: I mean, in case there is a Zsh specific way for doing this. Instead of just doing the true command (:).

Could not find the program 'android-studio' error

Posted: 14 May 2021 09:57 AM PDT

I am using manjaro OS KDE plasma on my raspberry pi 4b 8gb ram edition. So now i am installing android studio. I download snapshot of android studio from https://aur.archlinux.org/packages/android-studio/

the file is in .desktop format

[and then I tick on executable option in permissions from properties and then when I run it it show this]

Thanks

downloading a large batch of files from google drive

Posted: 14 May 2021 09:49 AM PDT

please would it be possible to have a piece of advice on the following :

given a public link to Google Drive : for example :

https://drive.google.com/file/d/1qhMG1T3Mwb7ZHSrcEsFGO9SMUKfaqxYv/view?usp=sharing  

how can i use gdrive, rclone, curl, or wget in order to automatically download the file from the command line on a server account ? (we have many files on google drive). thanks a lot !

-- bogdan

Can't install package mod_ssl on Linux CentOS

Posted: 14 May 2021 10:39 AM PDT

I need to install a application on a VPS Linux CentOS. But i'm having problems with mod_ssl:

When I run the command to install the app, it shows this warning:

Package 1:mod_ssl-2.4.6-97.el7.centos.x86_64 is obsoleted by ea-apache24-mod_ssl-2.4.46-6.12.1.cpanel.x86_64 which is already installed  

And after:

Error: Package: filemaker_server-19.2.1-23.x86_64 (/filemaker_server-19.2.1-23.x86_64)         Requires: mod_ssl         Available: 1:mod_ssl-2.4.6-95.el7.centos.x86_64 (base)             mod_ssl = 1:2.4.6-95.el7.centos         Available: 1:mod_ssl-2.4.6-97.el7.centos.x86_64 (updates)             mod_ssl = 1:2.4.6-97.el7.centos  

If I try to install mod_ssl with yum install mod_ssl, it shows that:

No package mod_ssl available.  Error: Nothing to do  

I am really stuck here. Someone can help me?

My repo list:

CentOS-Base.repo       CentOS-Media.repo        CentOS-Vault.repo          dedi.repo          mysql-community.repo  CentOS-CR.repo         CentOS-SCLo-scl.repo     CentOS-x86_64-kernel.repo  EA4.repo           mysql-community-source.repo  CentOS-Debuginfo.repo  CentOS-SCLo-scl-rh.repo  cPAddons.repo              epel.repo          UL_hostgator_br.repo  CentOS-fasttrack.repo  CentOS-Sources.repo      cpanel-plugins.repo        epel-testing.repo  ul.repo  

When I yum search for mod_ssl:

mod_gnutls.x86_64 : GnuTLS module for the Apache HTTP server  

String of strings as input parameter

Posted: 14 May 2021 09:52 AM PDT

Say I have a function that can take multiple strings as input, like for example ls.

Further say that I have two folders with spaces in them like test 1 and test 2.

By calling ls "test 1" "test 2" ls will list the contents of both folders for me.

Now say that the folders I want to list are in a string themselves like this: folders="\"test 1\" \"test 2\"".

Finally I want to call ls with this variable as input parameters, how do I do that? I have tried ls $folders which returns:

ls: cannot access '"test': No such file or directory  ls: cannot access '1"': No such file or directory  ls: cannot access '"test': No such file or directory  ls: cannot access '2"': No such file or directory  

I.e. it splits up the strings as separate parameters even though the quotation marks should keep them together. What are my options to solve this? The parameters could be provided in an array instead if that is easier to work with.

Play 2 different sounds through 2 different sinks/audio outputs on Ubuntu 20.10

Posted: 14 May 2021 09:22 AM PDT

I have 2 audio sinks on my raspberry pi (running Ubuntu 20.10). One is my monitor with build in speakers (hdmi) and a headphone jack. I have 2 applications running (Firefox and Rhythmbox) and I want the audio coming from Firefox to go through sink x and the audio from Rhythmbox to go through sink y

This answer here says: Setting PulseAudio playback device before playback

By default, PulseAudio will attempt to remember where each application's output was directed the last time it was used, and keep using that output device for it until told otherwise. If there is no record of previous use, the fallback device is used.

But is this even correct? By default they both go through 1 sink. In PulseAudio I have a dropdown to select to which audio-output each source (FF or RB) goes. When I change this manually this works fine. But every time I reboot I have to manually change that the audio coming from FF has to go through another sink and, as said, by default they both go through 1 sink. The answer states that PulseAudio remembers where each applciation's output was redirected to and yet this gets reset or something....

How can I make this change permanent? Or is there a script that I can use that sets the correct application to the correct sink at startup or something?

Tini Linux CorePlus - image is not fit to display and fix resolution

Posted: 14 May 2021 09:09 AM PDT

The Tiny Linux CorePlus install set my display resolution to:

Monitors: 1   0: +default 1024/271x768/203+0+0  default  

I install on boot this:

Xvesa.tcz  aterm.tcz  wbar.tcz  wifi.tcz  iw.tcz  pci-utils.tcz  firmware-atheros.tcz  firmware-ipw2100.tcz  firmware-ipw2200.tcz  firmware-iwimax.tcz  firmware-iwl8000.tcz  firmware-iwl9000.tcz  firmware-iwlwifi.tcz  firmware-marvel.tcz  firmware-myri10ge.tcz  firmware-netxen.tcz  firmware-openfwwf.tcz  firmware-ralinkwifi.tcz  firmware-rtlwifi.tcz  firmware-ti-connectivity.tcz  firmware-ueagle-atm.tcz  firmware-vxge.tcz  firmware-zd1211.tcz  tc-install-GUI.tcz  mc.tcz  firefox.tcz  Xorg-7.7.tcz  Xorg-7.7-3d.tcz  xvid.tcz  hackedbox.tcz  

The lspci show me this:

00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)  00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 0c)  00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 0c)  00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)  00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)  00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)  00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)  00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)  00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)  00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03)  00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)  00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)  00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)  00:1d.2 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)  00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)  00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)  00:1f.0 ISA bridge: Intel Corporation 82801HM (ICH8M) LPC Interface Controller (rev 03)  00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)  00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 03)  02:04.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b6)  02:04.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 02)  10:00.0 Network controller: Broadcom Limited BCM4311 802.11b/g WLAN (rev 01)  18:00.0 Ethernet controller: Broadcom Limited NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)  

How can I change this to a large resolution?

How to restrict the access/activation times for a service/socket with systemd?

Posted: 14 May 2021 08:54 AM PDT

I have a simple systemd service that is activated by system socket.

It's as simple as that (a little simplified):

$ systemctl cat example.socket   # /usr/lib/systemd/system/example.socket  [Unit]  Description=Example Server socket    [Socket]  ListenStream=80  Accept=true    [Install]  WantedBy=sockets.target  $ systemctl cat example@.service   # /usr/lib/systemd/system/example@.service  [Unit]  Description=Example Server    [Service]  StandardInput=socket  StandardOutput=socket  StandardError=journal  ExecStart=/usr/libexec/example  User=example  

Now what I want is to implement a basic access restriction by time. I.e. I want to limit the time a day the socket/service can be activated/reached from the outside, so it's only available at certain times a day, e.g.

I know I can use systemctl edit to override the options, but I did not found an option to set, actually. I looked through the man page regarding system sockets and the only options regarding times are TriggerLimitIntervalSec or so, which do not do what I want.

To compare this, the little oldish tool xinetdx, which can do the same i.e. listen on a socket and start a process (server) on demand has an option called access_times, which can be used to specify when a service should be available. But using this as another tool (/dependency) is not a thing I'd like. I'd aim for an integrated way into systemd.

I need awk/sed command by comparing two files and p [closed]

Posted: 14 May 2021 08:55 AM PDT

1-comparing two files , if column 1,4,5,6 are matching , (but column 2 is unique) , then print the word in column 2 from the two files.. an output txt file of two columns , the first column shows the unique words from file 1, column 2 shows the unique word from file2.

also if possible add another code that does same except instead of printing the unique words, replace the the unique word from first file column's 2 ..to the word in file 2 in the same column using the same requirements.

What does it mean when unattended-upgrades reports [package on hold]?

Posted: 14 May 2021 08:53 AM PDT

I'm running a raspberry pi with unattended-upgrades installed and configured. Today I got a mail report with the following content:

Unattended upgrade result: All upgrades installed    Packages with upgradable origin but kept back:   linux-libc-dev  

My config is as follows:

/etc/apt/apt.conf.d/50unattended-upgrades  Unattended-Upgrade::Origins-Pattern {          "origin=Debian,codename=${distro_codename},label=Debian";          "origin=Debian,codename=${distro_codename},label=Debian-Security";  };    Unattended-Upgrade::Package-Blacklist {    };      Unattended-Upgrade::Mail "MYMAILADDRESS";  Unattended-Upgrade::Sender "SENDERADDRESS";    Unattended-Upgrade::Remove-Unused-Dependencies "true";    Unattended-Upgrade::Automatic-Reboot "true";    

So far I only found articles explaining how you can prevent packages from being updated by putting them into the Package-Blacklist field. That, however, is empty in my config. So why is the package linux-libc-dev held back from being upgraded? Is there another configuration that I'm not aware of and which might cause this? Does it relate to the Origins-Pattern that I've configured?

Thanks for any advice in advance!

Ubuntu & Virtualbox cannot see USB Devices

Posted: 14 May 2021 08:18 AM PDT

I am running Ubuntu 20.04 LTS with VirtualBox 6.1.22, I can see USB Devices in the Ubuntu file manager, but I cannot see the device in the Windows 10 Virtual OS.

I have tried the USB Device settings for the VM to no avail.

How do I fix this?

Start WSL2 with a specific user and distro?

Posted: 14 May 2021 08:17 AM PDT

What arguments do I need to pass to WSL2 to start it with a specific distro logging in as a specific user?

In Linux you login to the TTY or you have a login screen, but in WSL it just throws you in there with whatever the default user.

I want to use different users for different purposes with their own .bashrc.

pxe boot pass variable to submenu

Posted: 14 May 2021 07:40 AM PDT

I'm using RHEL 8 and I currently have the ability to install a single image the LAN. I'm trying to expand our options such that we can select from several images. I'd like to have a top level menu where I can select image A,B,C. Then it would call a submenu and pass in the selected imaged. The menus and submenus work but I cannot figure out how to pass a variable from the top level menu to the lower menu. For example if I want to pass image A into the submenu this is what I've tried..

BUILD="A"  append pxelinux.cfg/Config BUILD="$BUILD"  

Then in the submenu

menu being  menu title BUILD="$BUILD"  

When I boot the system it does not show the variable it just prints

BUILD="$BUILD"  

So my question is am I passing in the variable correctly? How do I display the variable in the menu?

Listing CPU Cores For Multiple CPU Packages

Posted: 14 May 2021 10:18 AM PDT

I need to get CPU cores and details per CPU core. I use cat /proc/cpuinfo command an it works. But I need to get information for multiple CPU packages. I have only single CPU package. How would the output look like in this situation?

Example CPU setup: 2 CPU packages: CPU package1: Core i7-2000 (4 physical, 8 logical cores), CPU package2: Core i7-3000 (4 physical, 8 logical cores), total 8 physical, 16 logical cores.

Example 1:

processor   : 0  .   other info for same core  model name  : Intel(R) Core(TM) i7-2000  .  .   other cores for same CPU package  .  processor   : 7  .   other info for same core  model name  : Intel(R) Core(TM) i7-2000  .  processor   : 8  .   other info for same core  model name  : Intel(R) Core(TM) i7-3000  .  .   other cores for same CPU package  .  processor   : 15  .   other info for same core  model name  : Intel(R) Core(TM) i7-3000  

or Example 2:

processor   : 0  .   other info for same core  model name  : Intel(R) Core(TM) i7-2000  .  .   other cores for same CPU package  .  processor   : 7  .   other info for same core  model name  : Intel(R) Core(TM) i7-2000  .  processor   : 0  .   other info for same core  model name  : Intel(R) Core(TM) i7-3000  .  .   other cores for same CPU package  .  processor   : 7  .   other info for same core  model name  : Intel(R) Core(TM) i7-3000      OS: Debian-like Linux, Kernel: 4.19  

Why does my USB flash disk contiune heating while it is unmounted?

Posted: 14 May 2021 08:03 AM PDT

I am using Debian-Buster Linux. I am using a USB flash disk to mount when it is needed. Then I unmounted it without unplugging it. However, it continues to heat up(like it is being used) while it is unmounted. Why does it contiune to heat up? How can I prevent this problem?

Is there any reason to avoid sourcing the shell's configuration file?

Posted: 14 May 2021 08:52 AM PDT

I recently read an answer here that included the following advice:

However, as a rule, ⚠️you should not source ~/.zshrc. Depending on what's in your dotfiles, this can lead to all sorts of problems.

I asked the OP for an example of why this could be a problem and was told:

Because it's been sourced already when your shell started up and the order in which commands are run can matter. As a simple example, put ls() { command ls -x "$@" }; alias ls='ls -AF' into your .zshrc file, restart your shell, then source ~/.zshrc. Now you get an error zsh: defining function based on alias ls'. And that's only a fairly innocuous example. Things can get much more hairy than that

That does sound plausible, although I couldn't reproduce that error with zsh. Despite its plausibility, I am having trouble imagining a situation where this could cause any serious issues and those issues would not also occur when opening a clean new session. Worst case scenario I can think of is getting an error message, and I don't even know how to make that happen either.

So, is there good reason to avoid manually sourcing a shell's rc file after making changes to it so that the changes are imported into the current shell session?

I know I have been doing this with bash for many years: I will regularly add a function, or make a change to my ~/.bashrc and then . ~/.bashrc to source it. Are there really cases where that could cause any serious problem? I suppose we can find some edge cases, but are those enough to justify such an empathetic warning? Perhaps there's something specific to zsh that I haven't encountered as a bash user?

I am interested in answers covering any bourne-family shell (bash, sh, zsh, ksh etc.).

Replace Nth line after match

Posted: 14 May 2021 07:40 AM PDT

let's say, I have this file with five hundred lines of text.

one  two  three  four  five  six  seven  eight  nine  ten  .  .  .  five-hundred  

If I wanted to replace the fifth line after match with some string, I would just do this:

sed '/two/{n;n;n;n;n;s/.*/MODIFIED/}' inputfile  

output:

one  two  three  four  five  six  MODIFIED  eight  nine  ten  .  .  .  five-hundred  

But what if I want to replace the 60th line after match? I don't want to write 'n' sixty times.

I tried playing around with x, h/H, g/G, and ranges, but I can't still get my desired output.

awk dynamic string matching

Posted: 14 May 2021 07:58 AM PDT

I have two files - (a) one from which I get a name and the file in which the name occurs and (b) the actual file on which I want to match the name and get two words before and after it.

Snapshot of first file

Ito 65482.txt  David Juno Ilrcwrry Hold 73586.txt  David Jones 73586.txt  Jacob FleUchbautr 73586.txt  

The name is a string separated by spaces as above.

Snapshot of file 65482.txt (it contains garbled OCR text)

nose just brnukiiitt tip tinwallfin the golden   path of Ito etmlmbimiiit tlmmgli the trees   Butt It as tie not intra and plcturosiiiicness   limit wo were of m that is not altogether We   and hunting and llslilng In plenty anti lit lIly   

Desired output in the format

Ito path of etmlmbimiiit tlmmgli   

i.e. Two words before and after the match.

#!/bin/bash  fPath='/Users/haimontidutta/Research/IIITD/Aayushee/Code/Source-Code/Thesis/src/ReputedPersonDetection/data/OutputofNERFinal_v1a.txt'  echo "Enter Script"    while IFS=' ' read -ra arr  do    fname="${arr[${#arr[@]}-1]}"   #echo $fname   name=""   for((idx=0; idx<$[${#arr[@]}-1]; ++idx))   do    name=$name" ${arr[idx]}"   done   #echo $name    filepath='/Users/haimontidutta/Research/IIITD/Aayushee/Code/Source-Code/Thesis/src/ReputedPersonDetection/data/final/'$fname   #echo $fName   #echo $filepath     #Extract window around name   awk -v nm="$name" '{       for(i=1;i<=NF;i++)       {         #print $i          if($i~$nm)         {          print nm OFS  $(i-2) OFS $(i-1) OFS $(i+1) OFS $(i+2); exit;        }}}' $filepath  done < $fPath  

I am able to extract the name and filepath, but in the awk statement the dynamic matching of the name is failing and the window cannot be obtained.

How do I do this?

How to edit a JSON file using shell?

Posted: 14 May 2021 10:33 AM PDT

I have seen answers to a question like this before, but am not sure how to apply it in this situation, thus the question. I am building a shell script app that messes with a json file.

{    "property1" : true,    "list" : [      {        "id" : 1,        "name" : "APP1"      },      {        "id" : 2,        "name" : "APP2"      }    ],    "property2" : false  }  

I need to use shell script to read the App Name and remove its parent object from list. Basically I need to remove the object with name APP1 from the list using shell. Editing JSON structure is not an option. Sudo access is provided

Ezjail network in aws ec2 instance

Posted: 14 May 2021 09:43 AM PDT

I am trying to connect a jail to the internet in a aws ec2 instance. I am able to create the jail and execute a console inside, the problem is that the jail does not have any connection to the outside.

This are the steps to create the jail:

echo 'cloned_interfaces="lo1"' >> /etc/rc.conf  service netif cloneup  ezjail-admin create jail 'lo1|127.0.1.1,xn0|172.31.36.57'  cp /etc/resolv.conf /usr/jails/jail/etc  ezjail-admin console -f jail  

After that if I try any installation using pkg:

The package management tool is not yet installed on your system.  Do you want to fetch and install it now? [y/N]: y  Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly, please wait...  pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly/Latest/pkg.txz: No address record  Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly.  Consider changing PACKAGESITE.    

See output of the host ifconfig:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384      options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>      inet6 ::1 prefixlen 128      inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1      inet 127.0.0.1 netmask 0xff000000      groups: lo      nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>  xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9001      options=503<RXCSUM,TXCSUM,TSO4,LRO>      ether 06:26:aa:da:23:d2      inet6 fe80::426:aaff:feda:23d2%xn0 prefixlen 64 scopeid 0x2      inet 172.31.36.56 netmask 0xfffff000 broadcast 172.31.47.255      inet 172.31.36.57 netmask 0xffffffff broadcast 172.31.36.57      media: Ethernet manual      status: active      nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>  lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384      options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>      inet6 fe80::1%lo1 prefixlen 64 scopeid 0x3      inet 127.0.1.1 netmask 0xffffffff      groups: lo      nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>    

I think the second IP i give to the interface is not valid.

Do you know what would be the way to get connectivity from the jail?

Why is PAM broken after installing nis?

Posted: 14 May 2021 09:06 AM PDT

I'm a Software Engineer with some system admin experience currently trying to setup some Linux infrastructure at a new workplace which previously only had Windows infrastucture. For Political reasons I can't simply integrate with the current Active Directory setup and have to start from scratch. I am using Debian.

I'm currently trying to setup kerbos, ldap, nfs and nis. I believe I've set up the server correctly and that everything is working there as I've tested logging in with kerberos and the nis client has been talking to the server also I can mount the NFS drives.

Since installing nis on the client I am no longer able to login not even with the root account unless I launch in recovery mode.

I have been trying to fix this for a day and a half and I'm out of ideas.

Here is what I think the issue is as pam is outputting to /var/log/auth.log

lightdm: PAM (other) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) no module name supplied  lightdm: PAM (other) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: pam_unix(lightdm-greeter:session): session opened for user lightdm by (uid=0)  systemd-logind[667]: New session c1 of user lightdm.  systemd: PAM (other) illegal module type: passwd:  systemd: PAM pam_parse: expecting return value; [...compat]  systemd: PAM (other) illegal module type: group:  systemd: PAM pam_parse: expecting return value; [...compat]  systemd: PAM (other) illegal module type: shadow:  systemd: PAM pam_parse: expecting return value; [...compat]  systemd: PAM (other) illegal module type: gshadow:  systemd: PAM pam_parse: expecting return value; [...files]  systemd: PAM (other) no module name supplied  systemd: PAM (other) illegal module type: hosts:  systemd: PAM pam_parse: expecting return value; [...files]  systemd: pam_unix(systemd-user:session): session opened for user lightdm by (uid=0)  lightdm: PAM (lightdm) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (lightdm) no module name supplied  lightdm: PAM (lightdm) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) no module name supplied  lightdm: PAM (other) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (lightdm) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (lightdm) no module name supplied  lightdm: PAM (lightdm) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) no module name supplied  lightdm: PAM (other) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: pam_krb5(lightdm:auth): user billy authenticated as billy@PROPACK  lightdm: PAM (lightdm) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (lightdm) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (lightdm) no module name supplied  lightdm: PAM (lightdm) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) illegal module type: passwd:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: group:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: shadow:  lightdm: PAM pam_parse: expecting return value; [...compat]  lightdm: PAM (other) illegal module type: gshadow:  lightdm: PAM pam_parse: expecting return value; [...files]  lightdm: PAM (other) no module name supplied  lightdm: PAM (other) illegal module type: hosts:  lightdm: PAM pam_parse: expecting return value; [...files]  

I'm not quite sure why this is. It all started after installing the nis package on the client however I don't think nis is the issue as it is talking to the server fine judging by the output from systemctl status nis

systemd[1]: Starting LSB: Start NIS client and server daemons....  nis[1348]: Setting NIS domainname to: domain.  nis[1348]: Starting NIS services: ypbind.  systemd[1]: Started LSB: Start NIS client and server daemons..  

I also uninstalled nis (Since installing nis was when this started), rebooted and the problem still exists.

I've checked the dependencies for nis and I can't see why any of them would have caused this to happen. I believe that pam is parsing my /etc/nsswitch.conf file which you can see below if needed.

passwd:         compat files systemd nis  group:          compat files systemd nis  shadow:         files  gshadow:        files    hosts:          files mdns4_minimal [NOTFOUND=return] dns  networks:       files    protocols:      db files  services:       db files  ethers:         db files  rpc:            db files    netgroup:       nis  

Please let me know if there is any other information you need to help debug this issue.

Edit:

/etc/pam.d/other contents:

#  # /etc/pam.d/other - specify the PAM fallback behaviour  #  # Note that this file is used for any unspecified service; for example  #if /etc/pam.d/cron  specifies no session modules but cron calls  #pam_open_session, the session module out of /etc/pam.d/other is  #used.  If you really want nothing to happen then use pam_permit.so or  #pam_deny.so as appropriate.    # We fall back to the system default in /etc/pam.d/common-*  #     @include common-auth  @include common-account  @include common-password  @include common-session  

/etc/pam.d/lightdm contents:

#%PAM-1.0    # Block login if they are globally disabled  auth      requisite pam_nologin.so    # Load environment from /etc/environment and ~/.pam_environment  session      required pam_env.so readenv=1  session      required pam_env.so readenv=1 envfile=/etc/default/locale    @include common-auth    -auth  optional pam_gnome_keyring.so    @include common-account    # SELinux needs to be the first session rule. This ensures that any  # lingering context has been cleared. Without out this it is possible  # that a module could execute code in the wrong domain.  # When the module is present, "required" would be sufficient (When SELinux  # is disabled, this returns success.)  session  [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close    session  required        pam_limits.so  session  required        pam_loginuid.so  @include common-session    # SELinux needs to intervene at login time to ensure that the process  # starts in the proper default security context. Only sessions which are  # intended to run in the user's context should be run after this.  session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open  # When the module is present, "required" would be sufficient (When SELinux  # is disabled, this returns success.)    -session optional        pam_gnome_keyring.so auto_start    @include common-password  

I just deleted everything in my home directory. How? And why are some files still there?

Posted: 14 May 2021 09:18 AM PDT

Never thought this would happen to me, but there you go. ¯\_(ツ)_/¯

I ran a build script from a repository inside the wrong directory without looking at the source first. Here's the script Scripts/BuildLocalWheelLinux.sh:

cd ../Dependencies/cpython  mkdir debug  cd debug  ../configure --with-pydebug --enable-shared  make  cd ../../..    cd ..  mkdir -p cmake-build-local  cd cmake-build-local  rm -rf *  cmake .. -DMVDIST_ONLY=True -DMVPY_VERSION=0 -DMVDPG_VERSION=local_build  make -j  cd ..    cd Distribution  python3 BuildPythonWheel.py ../cmake-build-local/[redacted]/core.so 0  python3 -m ensurepip  python3 -m pip install --upgrade pip  [more pip install stuff]  python3 -m setup bdist_wheel --plat-name manylinux1_x86_64 --dist-dir ../dist  cd ..  cd Scripts  

The dangerous part seems to be

mkdir -p cmake-build-local  cd cmake-build-local  rm -rf *  

But thinking about it, it actually seems like it couldn't possibly go wrong.

The way you're supposed to run this script is cd Scripts; ./BuildLocalWheelLinux.sh. When I ran it the first time, it showed an error on the very last line (as I learned afterwards). I was in a hurry, so I though "maybe the docs are outdated, I'll try running from the project root instead. So I ran ./Scripts/BuildLocalWheelLinux.sh. Suddenly, vscodes theme and zoom level changed, my zsh terminal config was reset, terminal fonts were set to default, and I Ctrl+C'd once I realized what was happening.

There are some files remaining, but there's no obvious pattern to them:

$ ls -la  total 216  drwx------ 27 felix   felix   4096 May 12 18:08 .  drwxr-xr-x  3 root    root    4096 Apr 15 16:39 ..  -rw-------  1 felix   felix  12752 Apr 19 11:07 .bash_history  -rw-r--r--  1 felix   felix   3980 Apr 15 13:40 .bashrc  drwxrwxrwx  7 felix   felix   4096 May 12 18:25 .cache  drwx------  8 felix   felix   4096 May 12 18:26 .config  drwx------  3 root    root    4096 Apr 13 21:40 .dbus  drwx------  2 felix   felix   4096 Apr 30 12:18 .docker  drwxr-xr-x  8 felix   felix   4096 Apr 15 13:40 .dotfiles  -rw-------  1 felix   felix   8980 Apr 13 18:10 examples.desktop  -rw-r--r--  1 felix   felix    196 Apr 19 15:19 .gitconfig  -rw-r--r--  1 felix   felix     55 Apr 16 13:56 .gitconfig.old  -rw-r--r--  1 felix   felix   1040 Apr 15 13:40 .gitmodules  drwx------  3 felix   felix   4096 May  6 10:10 .gnupg  -rw-r--r--  1 felix   felix   1848 May  5 14:24 heartbeat.tcl  -rw-------  1 felix   felix   1610 Apr 13 20:36 .ICEauthority  drwxr-xr-x  5 felix   felix   4096 Apr 21 16:39 .ipython  drwxr-xr-x  2 felix   felix   4096 May  4 09:35 .jupyter  -rw-------  1 felix   felix    161 Apr 27 14:23 .lesshst  drwx------  3 felix   felix   4096 May 12 18:08 .local  -rw-r--r--  1 felix   felix    140 Apr 29 17:54 minicom.log  drwx------  5 felix   felix   4096 Apr 13 18:25 .mozilla  drwxr-xr-x  2 felix   felix   4096 Apr 13 18:10 Music  drwxr-xr-x  6 felix   felix   4096 May 12 17:16 Nextcloud  -rw-r--r--  1 felix   felix     52 Apr 16 11:43 .nix-channels  -rw-------  1 felix   felix   1681 Apr 20 10:33 nohup.out  drwx------  3 felix   felix   4096 Apr 15 11:16 .pki  -rw-------  1 felix   felix    946 Apr 16 11:43 .profile  drwxr-xr-x  2 felix   felix   4096 Apr 13 18:10 Public  drwxr-xr-x  2 felix   felix   4096 May 12 18:08 .pylint.d  -rw-------  1 felix   felix   1984 May 12 18:06 .pythonhist  -rw-r--r--  1 felix   felix   2443 Apr 19 13:40 README.md  drwxr-xr-x 13 felix   felix   4096 May 12 18:08 repos  drwxr-xr-x  6 felix   felix   4096 Apr 19 11:08 snap  drwx------  3 felix   felix   4096 May  5 15:33 .ssh  drwxr-xr-x  5 felix   felix   4096 Apr 26 17:39 .stm32cubeide  drwxr-xr-x  5 felix   felix   4096 May  5 15:52 .stm32cubemx  drwxr-xr-x  2 felix   felix   4096 Apr 23 11:44 .stmcube  drwxr-xr-x  2 felix   felix   4096 Apr 13 18:10 Templates  drwxr-xr-x  3 felix   felix   4096 Apr 19 11:57 test  drwxr-xr-x  2 felix   felix   4096 Apr 13 18:10 Videos  -rw-------  1 felix   felix  14313 May 12 10:45 .viminfo  -rw-r--r--  1 felix   felix    816 Apr 15 13:40 .vimrc  drwxr-xr-x  3 felix   felix   4096 Apr 16 12:08 .vscode  -rw-r--r--  1 felix   felix   2321 Apr 19 18:47 weird_bug.txt  -rw-r--r--  1 felix   felix    162 Apr 15 13:40 .xprofile  

.config is gone, as well as some standard XDG dirs like Pictures and Desktop, but .bashrc is still there. .nix-channels is still there, but .nix-defexpr was nuked.

So, this leads me to two questions:

  1. What went wrong? I'd like to fix this build script and make a PR to prevent this from happening in the future.
  2. What order were the files deleted in? Obviously not in alphabetical order, but * expands in alphabetical order, so something else is going on here, it seems.

How do I investigate or fix random IO HDD & system freezes on linux?

Posted: 14 May 2021 08:01 AM PDT

My home desktop system is Ubuntu 18.04.1 with kernel regularly updated, currently 5.3.0. From time to time, mostly when browsing but not necessarily, the system becomes slow on IO: - hdd LED constantly on - system slow on all disk request. E.g. console login or ls ~/ takes minutes - system fast on other things (mouse moves, virtual console switching) - iotop shows multiple apps 99% waiting for IO - iostat shows high wrqm, low wrkb/s

after a few minutes the system goes into a complete freeze, I only can make a hard reboot

What can I do to investigate the problem better? What scheduler would you recommend? If it's a single app killing my hdd, is there a way to disallow it to do so?

Update: The disk is HDD, i.e. a spinning disk. The apps showing IO waits are just all doing IO really. No swapping, there is enough memory. No relevant lines in syslog, I'll see /var/log/messages on the next occurrence

How should I run a cron command which has forever loop?

Posted: 14 May 2021 10:18 AM PDT

I have a script that have "while true" loop. And I want to run that script from cron on every minute, so that when the process is killed (or is failed - no matter why) cron will run the script again.

But when I'm checking the ps -aef --forest there is my process runned by /usr/sbin/CROND -n. This wasn't be bad for cron or system? Or maybe I should do it differently?

OpenVPN error status: 2, and can't connect to internet while using

Posted: 14 May 2021 10:00 AM PDT

I recently installed openVPN and configured it with my client1.ovpn file:

client    dev tun    proto udp    remote 10.8.0.1 1194    resolv-retry infinite    nobind    user nobody  group nogroup    persist-key  persist-tun    key-direction 1    cipher AES-128-CBC  auth SHA256    comp-lzo    verb 3    script-security 2  up /etc/openvpn/update-resolv-conf  down /etc/openvpn/update-resolv-conf  

my server.conf file:

port 1194    proto udp    dev tun    ca ca.crt  cert server.crt  key server.key     dh dh2048.pem    server 10.8.0.0 255.255.255.0    ifconfig-pool-persist ipp.txt    push "redirect-gateway def1 bypass-dhcp"    push "dhcp-option DNS 208.67.222.222"  push "dhcp-option DNS 208.67.220.220"    keepalive 10 120    tls-auth ta.key 0 # This file is secret  key-direction 0    cipher AES-128-CBC   # AES  auth SHA256    comp-lzo    user nobody  group nogroup    persist-key  persist-tun    status openvpn-status.log    verb 3  

When I do the command

sudo openvpn --config client1.ovpn  

I get this error in the terminal:

Sat Aug 12 21:57:10 2017 OpenVPN 2.3.10 x86_64-pc-linux-gnu [SSL   (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Jun 22 2017  Sat Aug 12 21:57:10 2017 library versions: OpenSSL 1.0.2g  1 Mar 2016,   LZO 2.08  Sat Aug 12 21:57:10 2017 Control Channel Authentication: tls-auth   using INLINE static key file  Sat Aug 12 21:57:10 2017 Outgoing Control Channel Authentication:   Using 256 bit message hash 'SHA256' for HMAC authentication  Sat Aug 12 21:57:10 2017 Incoming Control Channel Authentication:   Using 256 bit message hash 'SHA256' for HMAC authentication  Sat Aug 12 21:57:10 2017 Socket Buffers: R=[212992->212992] S=[212992-  >212992]  Sat Aug 12 21:57:10 2017 NOTE: UID/GID downgrade will be delayed   because of --client, --pull, or --up-delay  Sat Aug 12 21:57:10 2017 UDPv4 link local: [undef]  Sat Aug 12 21:57:10 2017 UDPv4 link remote: [AF_INET]10.8.0.1:1194  Sat Aug 12 21:57:10 2017 TLS: Initial packet from   [AF_INET]10.8.0.1:1194, sid=640d1419 b8d9a3ee  Sat Aug 12 21:57:10 2017 VERIFY OK: depth=1, C=US, ST=CA, L=Los   Angeles, O=Fort-Funston, OU=Community, CN=Fort-Funston CA,   name=Server, emailAddress=fasching.ryan@gmail.com  Sat Aug 12 21:57:10 2017 Validating certificate key usage  Sat Aug 12 21:57:10 2017 ++ Certificate has key usage  00a0, expects   00a0  Sat Aug 12 21:57:10 2017 VERIFY KU OK  Sat Aug 12 21:57:10 2017 Validating certificate extended key usage  Sat Aug 12 21:57:10 2017 ++ Certificate has EKU (str) TLS Web Server   Authentication, expects TLS Web Server Authentication  Sat Aug 12 21:57:10 2017 VERIFY EKU OK  Sat Aug 12 21:57:10 2017 VERIFY OK: depth=0, C=US, ST=CA, L=Los   Angeles, O=Fort-Funston, OU=Community, CN=Ryan, name=Server,   emailAddress=fasching.ryan@gmail.com  Sat Aug 12 21:57:10 2017 Data Channel Encrypt: Cipher 'AES-128-CBC'   initialized with 128 bit key  Sat Aug 12 21:57:10 2017 Data Channel Encrypt: Using 256 bit message   hash 'SHA256' for HMAC authentication  Sat Aug 12 21:57:10 2017 Data Channel Decrypt: Cipher 'AES-128-CBC'   initialized with 128 bit key  Sat Aug 12 21:57:10 2017 Data Channel Decrypt: Using 256 bit message   hash 'SHA256' for HMAC authentication  Sat Aug 12 21:57:10 2017 Control Channel: TLSv1.2, cipher TLSv1/SSLv3   DHE-RSA-AES256-GCM-SHA384, 2048 bit RSA  Sat Aug 12 21:57:10 2017 [Ryan] Peer Connection Initiated with   [AF_INET]10.8.0.1:1194  Sat Aug 12 21:57:12 2017 SENT CONTROL [Ryan]: 'PUSH_REQUEST'   (status=1)  Sat Aug 12 21:57:12 2017 PUSH: Received control message:   'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS   208.67.222.222,dhcp-option DNS 208.67.220.220,route 10.8.0.1,topology   net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'  Sat Aug 12 21:57:12 2017 OPTIONS IMPORT: timers and/or timeouts   modified  Sat Aug 12 21:57:12 2017 OPTIONS IMPORT: --ifconfig/up options   modified  Sat Aug 12 21:57:12 2017 OPTIONS IMPORT: route options modified  Sat Aug 12 21:57:12 2017 OPTIONS IMPORT: --ip-win32 and/or --dhcp-  option options modified  Sat Aug 12 21:57:12 2017 WARNING: potential conflict between --remote   address [10.8.0.1] and --ifconfig address pair [10.8.0.6, 10.8.0.5] --   this is a warning only that is triggered when local/remote addresses   exist within the same /24 subnet as --ifconfig endpoints. (silence   this warning with --ifconfig-nowarn)  Sat Aug 12 21:57:12 2017 ROUTE_GATEWAY 10.15.65.1/255.255.255.0   IFACE=wlp1s0 HWADDR=d0:57:7b:09:c7:c0  Sat Aug 12 21:57:12 2017 TUN/TAP device tun1 opened  Sat Aug 12 21:57:12 2017 TUN/TAP TX queue length set to 100  Sat Aug 12 21:57:12 2017 do_ifconfig, tt->ipv6=0, tt-  >did_ifconfig_ipv6_setup=0  Sat Aug 12 21:57:12 2017 /sbin/ip link set dev tun1 up mtu 1500  Sat Aug 12 21:57:12 2017 /sbin/ip addr add dev tun1 local 10.8.0.6   peer 10.8.0.5  Sat Aug 12 21:57:12 2017 /sbin/ip route add 10.8.0.1/32 via 10.15.65.1  RTNETLINK answers: File exists  Sat Aug 12 21:57:12 2017 ERROR: Linux route add command failed:   external program exited with error status: 2  Sat Aug 12 21:57:12 2017 /sbin/ip route add 0.0.0.0/1 via 10.8.0.5  Sat Aug 12 21:57:12 2017 /sbin/ip route add 128.0.0.0/1 via 10.8.0.5  Sat Aug 12 21:57:12 2017 /sbin/ip route add 10.8.0.1/32 via 10.8.0.5  RTNETLINK answers: File exists  Sat Aug 12 21:57:12 2017 ERROR: Linux route add command failed:   external program exited with error status: 2  Sat Aug 12 21:57:12 2017 GID set to nogroup  Sat Aug 12 21:57:12 2017 UID set to nobody  Sat Aug 12 21:57:12 2017 Initialization Sequence Completed  

I also cannot connect to the internet while openvpn is in use in the terminal. It isn't until I hit crtl+c before I'm able to connect to the internet again.

After ctrl+c I get these errors as well:

^CSat Aug 12 21:57:56 2017 event_wait : Interrupted system call   (code=4)  Sat Aug 12 21:57:56 2017 /sbin/ip route del 10.8.0.1/32  RTNETLINK answers: Operation not permitted  Sat Aug 12 21:57:56 2017 ERROR: Linux route delete command failed:   external program exited with error status: 2  Sat Aug 12 21:57:56 2017 /sbin/ip route del 0.0.0.0/1  RTNETLINK answers: Operation not permitted  Sat Aug 12 21:57:56 2017 ERROR: Linux route delete command failed:   external program exited with error status: 2  Sat Aug 12 21:57:56 2017 /sbin/ip route del 128.0.0.0/1  RTNETLINK answers: Operation not permitted  Sat Aug 12 21:57:56 2017 ERROR: Linux route delete command failed:   external program exited with error status: 2  Sat Aug 12 21:57:56 2017 Closing TUN/TAP interface  Sat Aug 12 21:57:56 2017 /sbin/ip addr del dev tun1 local 10.8.0.6   peer 10.8.0.5  RTNETLINK answers: Operation not permitted  Sat Aug 12 21:57:56 2017 Linux ip addr del failed: external program   exited with error status: 2  Sat Aug 12 21:57:56 2017 SIGINT[hard,] received, process exiting  

I have been trying to find an answer to this question a lot on google already with no luck. What is causing this error of " ERROR: Linux route add command failed: external program exited with error status: 2" as well as being able to connect to the internet when using. Thanks.

How to find word with part of surrounding context using grep?

Posted: 14 May 2021 08:35 AM PDT

I want to use grep to determine how many characters should be displayed before and after what is being searched. For example I want to filter 'example' from the 'this is an example' line. By using grep example the result would be all the line containing the string, when what I hope to obtain is just "an example", two characters before the word example.

parse snmpwalk output to array

Posted: 14 May 2021 09:01 AM PDT

Im trying to get network interfaces by doing a snmpwalk, but cannot separate in array, the variable stores all in element 0

ifname=(\$(snmpwalk -Oqv -v2c -c comm xxx.xxx.xxx.xxx 1.3.6.1.2.1.2.2.1.2))

This is inside a heredoc

How can i do that?

How to get filenames when using find and sed

Posted: 14 May 2021 08:40 AM PDT

I am writing a script to apply sed on certain files and then list files that have been changed so that I know which have been modified.

This is how I am finding and then using sed:

find . -type f -a \( -name "*.txt" -o -name "*.git"\) -a -exec sed -i -e "s/"str1"/"str2"/g" {} +  

How do I print the file name of the changed files? I would like to print it in a sorted order so it's easier to read.

When using only sed we can do this:

sed -i 's/$pattern/$new_pattern/w changelog.txt' $filename  if [ -s changelog.txt ]; then    # CHANGES MADE, DO SOME STUFF HERE  else    # NO CHANGES MADE, DO SOME OTHER STUFF HERE  fi  

But how do I do this when using find and sed together? I checked the man page and tried a bunch of stuff but nothing worked.

What is the tun network interface for?

Posted: 14 May 2021 09:56 AM PDT

I noticed when running ifconfig that there is a network interface called tun0 and it has an ipv4 address. A bit of research shows that it is a tunneling device, but I don't really know how it's used, what's using it, and why it has an IP address.

I do have iptables enabled, and there seems to be some link between iptables and tun, if that helps.

No comments:

Post a Comment