Monday, August 9, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Passing arguments into a glob pattern within a script

Posted: 09 Aug 2021 09:34 AM PDT

I have a script called get_numbers.sh, which I want to use to extract data from .pdf files labelled sequentially by date, using pdfgrep.

Let me simplify my problem to what I believe are its essentials:

The .pdfs are named file-07-01.pdf, file-07-02.pdf, ..., file-07-31.pdf, where the numbers correspond to the month and day of the data in the file.

I can enter a shell command like pdfgrep -i "Total Number:" file-07-{01..12}.pdf

and I get exactly what I want, the appropriate text from each file for the dates 07-01 to 07-12.

I want to make a script for this, where all I have to do is enter the start and end dates as well as the month. This was my first go:

    #!/usr/bin/bash        if [ "$#" -eq 3 ]      then          START_DAY=$1           END_DAY=$2          MONTH=$3      else          echo "INCORRECT USAGE:"          exit 1      fi             pdfgrep -i "Total Number:" file-$MONTH-{$START_DAY..$END_DAY}.pdf  

But doing bash get_numbers.sh 01 12 07 gives me the error message

pdfgrep: Could not open file-07-{01..12}.pdf

Looking around, I've realized that you have to be careful when doing this, because the script will interpret file-$MONTH-{$START_DAY..$END_DAY}.pdf as a literal string rather than a glob. I've tried to modify this, by making this a variable, or putting double quotes around it, but it doesn't change the result. What am I missing?

Is it safe to login to my account and do work thorough root prompt instead of desktop? [closed]

Posted: 09 Aug 2021 09:40 AM PDT

I power on and go to maintenance(ctrl+D).

Is it safe(security wise)?

Would it negatively affect my hardware in someway(battery etc.)?

Reason-My laptop is very slow to boot up.

  • It takes time when ubuntu and manufacturer's logo shows up.
  • OS is in sda8.
  • sda1 to 7 is 900GB, does this matter?
  • And I want to remove this bottleneck and the only way I found was this.

Ubuntu Server

I also wanna look into Ubuntu server. Does it consume less RAM than Desktop one and does it provides faster login?

I am able to do my work by logging in my user account from root prompt(no more su after login) happily.

Thank you

Adding a command to break long lines into shorter ones to an ed script

Posted: 09 Aug 2021 09:24 AM PDT

I frequently have long lines in my ed document which I would like to split into separate lines of max length. I found this command which achieves this:

fold -s -w80 file  

Split very long lines

I can apply this command also from within ed as follows:

!fold -s -w80 %  

However, when I add this command to my ed script, which comprises the following lines,

g/\(''\|''\)/s//"/g  g/\("\|"\)/s//"/g  g/\('\|'\)/s//'/g  g/\*/s///g  g/^#.*: /s///g  g/^  */s///  g/  *$/s///  g/   */s// /g  e !uniq %  e !fold -s -w80 %  # g/^$/d  w  Q  

I get an error. I would like to know the reason for the error and a way if circumventing it.

How to stop a process permanently for every session?

Posted: 09 Aug 2021 08:49 AM PDT

I have a laptop with minimal resources and this process, "gnome-software", takes up huge space in RAM. I have to kill it every time.

Is there permanent way to stop this process?

Search File A with Terms from File B and save output to individual TXT files based off search term from File B

Posted: 09 Aug 2021 09:49 AM PDT

FILE-A has 100,000 lines. FILE-B is 50 search terms. I'm looking to complete the search of FILE-A (CSV or TXT) with the various terms from FILE-B (CSV or TXT) .... AND (here is the kicker) Save the results in individual TXT files based off the search terms in FILE-B.

Example:

FILE-A

123  45678  1239870  2349878  39742366876  41967849  789  910  2378  6723  

FILE-B

1  2  23  78  

Results = "1.txt" with all matching lines from FILE-A, "2.txt" with all lines matching from FILE-A. "23.txt", "78.txt" and so on. So if FILE-B has 50 search terms, I would end up with 50 TXT files, named with the search term, assuming at least one hit with said term from FILE-A.

I have searched using "fgrep -f FILE-B.txt FILE-A.csv >> output.txt" This puts all of the search terms from FILE-B found in FILE-A into one "output.txt". Looking to seperate them into individual txt files.

Disable passwords when using ssh

Posted: 09 Aug 2021 08:12 AM PDT

I have found lots of answered questions on this subject, both here on SE, and elsewhere. But I'm still stuck.

We use mercurial at work, and we have a script (which is outside my control) to clone a repo on my local machine to another location on this same machine. The script does something like this:

$ hg clone ssh://user@<local-machine>//<local-repo-location> <local-destination-location>  user@<local-machine>'s password:  

It requests a password, which breaks the script.

I have created rsa keypair, and copied the public-key to ~/.ssh/id_rsa.pub and ~/.ssh/authorized_keys, and also to ~/.ssh/authorized_keys2 (after reading a post elsewhere). I have set the permissions for these three files to 640.

Even connecting to my local machine using ssh also requests the password:

$ ssh user@<local-machine>  user@<local-machine>'s password:  

I'm trying to configure my local machine such that no password is requested, for both the ssh and repo clone operations. I have asked a colleague to do the same and in his case, no password is requested. Is this a local configuration problem?

ubuntu multiple monitor issues

Posted: 09 Aug 2021 09:32 AM PDT

This issue has only happened recently. Before, my setup was great. I was able to have 2 external monitors and have my laptop's lid closed. But now, when I have the monitors connected and working with my docking station, if I close the laptop (because I just want to use the 2 external monitors) everything freezes. I see the mouse on the monitor sometimes but that is it, everything else is black and not responsive.

I am running Ubuntu 20.04. I have uninstalled and reinstalled Displaylink (I am using a pluggable docking station). I deleted the monitor.xml files (this helped a little so that both monitors would connect properly). From what I have seen, my Nvidia card is "prime". I have tried installing the right drivers but that hasn't made a difference. (NVIDIA GeForce RTX 2070)

Here is what the logs look like, but I have not been able to make progress with it:

10:41:53 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:53 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:53 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:53 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:53 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:53 gdm-session-wor: gkr-pam: unable to locate daemon control file  10:41:45 kernel: overlayfs: missing 'lowerdir'  10:41:45 kernel: aufs aufs_fill_super:918:mount[1962]: no arg  10:41:43 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:43 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:43 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:43 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:43 kernel: evdi: [E] evdi_painter_connect:856 Edid length too small  10:41:43 wpa_supplicant: nl80211: Failed to create a P2P Device interface p2p-dev-wlp0s20f3  10:41:43 wpa_supplicant: nl80211: Failed to create a P2P Device interface p2p-dev-wlp0s20f3  10:41:43 wpa_supplicant: Failed to create interface p2p-dev-wlp0s20f3: -22 (Invalid argument)  10:41:43 wpa_supplicant: nl80211: kernel reports: Attribute failed policy validation  10:41:40 kernel: ucsi_ccg 0-0008: ucsi_ccg_init failed - -110  10:41:40 kernel: ucsi_ccg 0-0008: ucsi_ccg_init failed - -110  10:41:40 kernel: ucsi_ccg 0-0008: i2c_transfer failed -110  10:41:40 kernel: nvidia-gpu 0000:01:00.3: i2c timeout error e0000000  10:41:39 kernel:   10:41:39 kernel: integrity: Problem loading X.509 certificate -65  10:41:39 kernel: integrity: Problem loading X.509 certificate -65  10:41:39 kernel: integrity: Problem loading X.509 certificate -65  10:41:39 kernel: x86/cpu: SGX disabled by BIOS    

Lap top get off when I separate charger

Posted: 09 Aug 2021 08:34 AM PDT

I brought my lenovo-ideapad-320 to repair shop and changed my keyboard. now when I separate my charger ,the lap top get off and doesn't get on without charger. may is it related to long time being off?

if using while loops in bash is bad...what should I do, then?

Posted: 09 Aug 2021 09:38 AM PDT

I guess this may be a naive question but I can't get my head around so I felt like asking... I was searching for some solution to a problem, when I found this very interesting post about why is using [while|for] loops in bash considered bad practice. There is a very good explanation in the post (see the chosen answer) but I can't find anything that solves the issues that are discussed.

I searched extensively: I googled (or duckduckgo-ed) how to read a file in bash and all the results I am getting point towards a solution that, according to the above-mentioned post, is absolutely non-bash style and something that should be avoided. In particular, we have this:

while read line; do    echo $line | cut -c3  done  

and this:

for line in `cat file`; do    foo=`echo $line | awk '{print $2}'`    echo whatever $foo  done  

that are indicated as very bad examples of shell scripting. At this point I am wondering, and this is the actual question: if the posted while loops should be avoided because they are bad practice and whatever...what am I supposed to do, instead?

EDIT: I see that I am already having comments/questions addressing the exact issue with the while loop, so I feel like to widen the question a bit. Basically, what I am understanding is that I need to dig deeper into bash commands, and that is the real thing that I should do. But, when one searches around, it looks like people are, in the general case, using and teaching bash in an improper way (as per my google-ing).

Why does a command called by its name behave differently when it is called by full path?

Posted: 09 Aug 2021 07:36 AM PDT

I wanted to use kill --verbose ... in a bash script but I got the error kill: -verbose: invalid signal specification. This was weird as it worked fine in fish. My investigation has lead me to this weird behaviour:

$ which kill  /usr/bin/kill  $ sleep 5 & kill --verbose $!  [1] 33730  bash: kill: -verbose: invalid signal specification  ... wait for sleep to finish ...   [1]+  Done                    sleep 5  $ sleep 5 & /usr/bin/kill --verbose $!  [1] 33964  sending signal 15 to pid 33964  [1]+  Terminated              sleep 5  

What is going on? Why does kill not recognise the --verbose flag, but /usr/bin/kill does, when which kill == /usr/bin/kill?

Adding second IP to RHEL 8 virtual machine

Posted: 09 Aug 2021 08:09 AM PDT

I have an existing RHEL8 virtual machine used for running httpd and a single virtualhost. I need to add a second IP/virtual host and am running into an issue. My understanding is that NetworkManager still parses network-scripts.

The existing IP is configured as:

[user@box]# cat /etc/sysconfig/network-scripts/ifcfg-ens3   TYPE=Ethernet  PROXY_METHOD=none  BROWSER_ONLY=no  BOOTPROTO=none  DEFROUTE=yes  IPV4_FAILURE_FATAL=no  NAME=ens3  UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx  DEVICE=ens3  ONBOOT=yes  IPADDR=xxx.xxx.xxx.111  PREFIX=24  GATEWAY=xxx.xxx.xxx.2  DNS1=xxx.xxx.1.1  ZONE=drop  

I created a second script set up with the new IP:

[user@box]# cat /etc/sysconfig/network-scripts/ifcfg-ens4   TYPE=Ethernet  PROXY_METHOD=none  BROWSER_ONLY=no  BOOTPROTO=none  DEFROUTE=yes  IPV4_FAILURE_FATAL=no  NAME=ens4  UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx  DEVICE=ens4  ONBOOT=yes  IPADDR=xxx.xxx.xxx.222  PREFIX=24  GATEWAY=xxx.xxx.xxx.2  DNS1=xxx.xxx.1.1  ZONE=drop  

I then restarted NetworkManager with

systemctl restart NetworkManager  

But I'm not seeing the new device named ens4 listed, just the existing IP (ens3)

[user@box]# ip addr  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00      inet 127.0.0.1/8 scope host lo         valid_lft forever preferred_lft forever  2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000      link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff      inet xxx.xxx.xxx.111/24 brd xxx.xxx.xxx.255 scope global noprefixroute ens3         valid_lft forever preferred_lft forever  

Device ens3 works fine.

The existing bridge from the host machine works since device ens3 works fine (I can view site content, ssh to machine, ect). So I'm not super sure this is a VM host setup issue.

What step(s) am I missing to add a second IP to RHEL8? Is the process different when the server is virtual?

Linux 4.19: apply devicetree overlay on live system

Posted: 09 Aug 2021 06:58 AM PDT

Is it possible to apply a devictree overlay on a live system? We have an embedded system that has some optional hardware. We would like to load the devicetree information after Linux booted.

Reqaon for this: our additional hardware uses a I2C bus to configure itself created by another component on an SPI bus. Unfortunate, the communication between our cpu and optional hardware is going over SPI.

Since a devicetree is "worked off" in chronological order, we cannot "go back" to the SPI bus after initializing our I2C bus.

I already tried to mount configfs, did not work and is not recommended in prouction environments.

Thanks in advance

jq merge values of same key into an array?

Posted: 09 Aug 2021 09:45 AM PDT

I have a SQL resultset exported as JSON, in the form of 1:1 mappings in an array.

e.g.

[    {      "subject": "Accounting",      "level": "A Level"    },    {      "subject": "Accounting",      "level": "IB"    },    {      "subject": "Accounting",      "level": "University"    },    {      "subject": "Accounting",      "level": "GCSE"    },    {      "subject": "Accounting",      "level": "Mentoring"    },    {      "subject": "Accounting",      "level": "13 Plus"    },    {      "subject": "Accounting",      "level": "11 Plus"    },  etc.....  

I would like to coalesce the levels into a single subject key like so:

[     "Accounting": ["A Level", "IB", "University"],     "Foo": ["Foo Intro", "Foo Basics", "Intermediate Foo"]   ]  

Note: no anonymous objects

How can I achieve this with jq?

Setting variables using getopts [duplicate]

Posted: 09 Aug 2021 09:47 AM PDT

I would like to use getopts for parsing arguments to bash functions.

while getopts ${shortopts} arg; do  

But am encountering problems in setting variable values. Calling myfunc -v8 or myfunc -v 8 sets vb to the expected value of 8.

myfunc -v 8  vb, arg:   ;  OPTARG: 8  vb: 8  

But running the command again with myfunc -v 21 gives

myfunc -v 21  vb: 1  

Here is what I have done to handle the options

myfunc  {    local vb=1      local arg    local shortopts="Vuhv:"      while getopts ${shortopts} arg; do      case ${arg} in        # ........................................................        ("V")          printf "%s\n" "V01 Jul 2021 Wk27"          return          ;;        ("u")          printf "%s\n" "-V, -u, -h"          return          ;;        ("h")          printf "%s\n" "Prints status returned by getopt."          printf "%s\n" "-V  Displays version"          printf "%s\n" "-u  Displays usage"          printf "%s\n" "-h  Displays help."          printf "%s\n" "-v, -vNUM  Sets verbosity level."            printf "%s\n" "Example: getopt-status --"          return          ;;        ("v")          vb="$OPTARG"           printf '%s\n' "vb, arg: $arg  ;  OPTARG: $OPTARG"          ;;        :)          echo "Current argument value, OPTARG: -$OPTARG" >&2          echo "Must supply an argument to -$OPTARG" >&2          ;;        ?)          printf "%s\n" "Invalid option, OPTARG: $OPTARG"          ;;      esac    done      echo "vb: $vb"    }  

How to evalute multiple arguments in a alias?

Posted: 09 Aug 2021 09:51 AM PDT

I am trying to create a simple alias that uses the argument with the full path

On the command line, I can type command "$(pwd)/my_file". It works. so I tried to create an alias in the following way:

alias command='command "$(pwd)/my_file"'  

This alias didn't work though. The CLI interprets as if $(pwd) and my_file were separated arguments... I tried to use the eval command to turn my command into a single one

alias command="eval 'command' '$(pwd)/$1'"  

However, it keeps waiting for an input argument instead of taking my initial argument...

If you wanna try out what I mean, substitute command for the evince (a popular PDF viewer) and my_file for any PDF file.

In my case, $(pwd) is /home/tapyu/Downloads/, and my_file is recap.pdf. I know that evince is treating it as a separated argument because it pops up two windows: The first one opens recap.pdf properly. The second is an empty window with a warning "Error opening file, /home/tapyu/Downloads/ is a directory."

Thank you in advance.

PS: My problem is not "how to give the full path to a command", my problem is "how to handle inputs argument in an alias in order to solve this kind of situation". So don't wanna alternatives to give the full path, I wanna know why my alias is not working.

Is there any way to prevent someone from running a shell as root?

Posted: 09 Aug 2021 08:59 AM PDT

This is a question I've pondered for a long time and thought was impossible.

Is it possible to prevent administrators of a machine from bypassing the audit capabilities of sudo or doas? For instance, running sudo su - and having a root shell?

I suppose the real question is, is there a way to audit root's activity on a machine?

Awk: isolate a block of code, then iterate through multiple blocks (if they exist)

Posted: 09 Aug 2021 09:50 AM PDT

Can awk † find the nth iteration of a "{" and return everything up to the next "}" character?

† I've been assuming awk is the correct tool for this job. Other ideas are welcome.

I need to isolate blocks of text in hundreds of files. Some files have only one block, but others contain dozens.

sample:

$ cat samp2.txt  //////////////////////////////////  // North Carolina office  // satellite branch  //////////////////////////////////     {     first   "John"     last    "Doe"     address "163 Main Street"     age     "25"     gender  "male"     }  

It may be best to > the current block into a temp file so the script can operate on it before addressing the next. They'll end up in separate files anyway.

I suspect awk can be given an index to find the nth match. The bash script can manage the loop and iteration.

I've gotten close

$ awk '/\{/{flag=1;next}/\}/{flag=0}flag' samp2.txt      first   "John"     last    "Doe"     address "163 Main Street"     age     "25"     gender  "male"  

However, since the above operates on the entire file it doesn't work for files containing more than one block (e.g. below). Irrespective of how many blocks in any file, I need every block separated to be processed individually.

Some files contain comments, but many do not--with no standard. I discard them, but the inconsistency means comments can't be relied upon for tracking where we are. The only given is the curly braces (and the line separation).

The text is always newline-separated, but not always a blank line between blocks. The data pairs vary, so this can't be a simple grep 5 lines and proceed solution.

$ cat samp3.txt   //GROUP1  {  first       "John"  address     "124 Main Street"  last    "Jones"  special     "supervisor"  age "35"  gender      "male"  }    //The fourth group  {  first       "John"  address     "125 Main Street"  last    "Jacob"  age "30"  gender      "male"  }  {  first       "John"  address     "523 Main Street"  last    "Jingle"  age "40"  gender      "male"  }  

My above awk statement runs through all groups, mashing them all into one large paragraph.

$ awk '/\{/{flag=1;next}/\}/{flag=0}flag' samp3.txt  first       "John"  address     "124 Main Street"  last    "Jones"  special     "supervisor"  age "35"  gender      "male"  first       "John"  address     "125 Main Street"  last    "Jacob"  age "30"  gender      "male"  first       "John"  address     "523 Main Street"  last    "Jingle"  age "40"  gender      "male"  

I need to tell awk to look for the nth "{" and then dump to the nth "}" separately, like this instead:

first       "John"  address     "124 Main Street"  last    "Jones"  special     "supervisor"  age "35"  gender      "male"   (awk exits, bash script does its thing)    first       "John"  address     "125 Main Street"  last    "Jacob"  age "30"  gender      "male"   (awk exits, bash script does its thing)    first       "John"  address     "523 Main Street"  last    "Jingle"  age "40"  gender      "male"   (awk exits, bash script does its thing)     [etc]  

The intent is similar to a non-greedy regex match of the nth "{ .+ }" .
With that, there may be a perl solution that's smarter?

TIA.

EDITS: I apologize for what must feel like shifting goalposts; I really botched this at first. Everyone's input has helped me isolate my question to what I really need. Thank you for that.


I've found a few SE questions that seem similar, but if these contain my solution I'm not well-versed enough in awk to see the connection.

How VirtualBox NAT network is one-direction only?

Posted: 09 Aug 2021 08:41 AM PDT

When a VM in VirtualBox uses NAT networking, it is able to communicate with the host, but the host is not able to communicate with (e.g., ping) the VM. How is it possible? Is it some iptables setup?

Looking at ip a of the VM I see eth0 10.0.2.15/24. On my host, there is no interface in that network. Then, I wonder, how is communication even possible? And why it's one-direction only?

Another question, I think it's related (if not, let me know, I'll create another post): On the host I have a docker container running, connected to the default docker0 bridge. Its IP is 172.17.0.2. I want to ping it from the same VM that I mentioned above (Virtualbox, NAT). Since the VM also has docker installed, it also has the docker0 bridge with the same network CIDR as docker0 on my host. Then, I use the following ping: ping -I eth0 172.17.0.2. This should force the traffic to go through VM's eth0, which, as I understand has a connection with my host (since I can ping my host freely). All the packets are lost. Why is that?

how to start openvpn client in Fedora 34 via systemd?

Posted: 09 Aug 2021 08:41 AM PDT

So I'm having issues starting openvpn client in Fedora 34.

This is what I'm getting on the terminal

[root@mybox ~]# systemctl start openvpn-client@default  Job for openvpn-client@default.service failed because the control process exited with error code.  See "systemctl status openvpn-client@default.service" and "journalctl -xeu openvpn-client@default.service" for details.  [root@mybox ~]# systemctl status openvpn-client@default  × openvpn-client@default.service - OpenVPN tunnel for default       Loaded: loaded (/usr/lib/systemd/system/openvpn-client@.service; disabled; vendor preset: disabled)       Active: failed (Result: exit-code) since Mon 2021-08-09 18:35:01 AEST; 1s ago         Docs: man:openvpn(8)               https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage               https://community.openvpn.net/openvpn/wiki/HOWTO      Process: 3970 ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config default.conf (code=exited, status=1/FAILURE)     Main PID: 3970 (code=exited, status=1/FAILURE)          CPU: 23ms    Aug 09 18:35:01 mybox systemd[1]: Starting OpenVPN tunnel for default...  Aug 09 18:35:01 mybox openvpn[3970]: Options error: In [CMD-LINE]:1: Error opening configuration file: default.conf  Aug 09 18:35:01 mybox openvpn[3970]: Use --help for more information.  Aug 09 18:35:01 mybox systemd[1]: openvpn-client@default.service: Main process exited, code=exited, status=1/FAILURE  Aug 09 18:35:01 mybox systemd[1]: openvpn-client@default.service: Failed with result 'exit-code'.  Aug 09 18:35:01 mybox systemd[1]: Failed to start OpenVPN tunnel for default.  [root@mybox ~]#  

my config files are located in

root@mybox client]# ls -al  total 12  drwxr-x---. 1 root openvpn   60 Aug  9 03:47 .  drwxr-xr-x. 1 root root      60 Aug  9 03:47 ..  -rw-r--r--. 1 root openvpn 1818 Dec  8  2020 ca.crt  -rw-------. 1 root openvpn   23 Dec  8  2020 .credentials  -rw-r--r--. 1 root openvpn  535 Aug  9 03:55 default.conf  [root@mybox client]# pwd  /etc/openvpn/client  

These are the contents of default.conf

[root@mybox client]# cat default.conf   client  remote usa.my-vpn-server-here.com 1194 udp  remote usa.my-vpn-server-here.com 443 tcp-client    comp-lzo adaptive  ca /etc/openvpn/client/ca.crt  dev tun  tls-client  script-security 2  cipher AES-256-CBC  mute 10    route-delay 5  redirect-gateway def1  resolv-retry infinite  persist-key  persist-tun  remote-cert-tls server  mssfix    auth-user-pass /etc/openvpn/client/.credentials  auth-nocache  

This is the systemd service.

I added " --verbose 9 --log /var/log/openvpn.log" in the hope I will be getting something in the log. BUT /var/log/openvpn.log doesn't exists even after running "systemctl start". I also run "systemctl daemon-reload" after editing the service file.

[Unit]  Description=OpenVPN tunnel for %I  After=syslog.target network-online.target  Wants=network-online.target  Documentation=man:openvpn(8)  Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage  Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO    [Service]  Type=notify  PrivateTmp=true  WorkingDirectory=/etc/openvpn/client  ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config %i.conf  CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE  LimitNPROC=10  DeviceAllow=/dev/null rw  DeviceAllow=/dev/net/tun rw  ProtectSystem=true  ProtectHome=true  KillMode=process    [Install]  WantedBy=multi-user.target  

If I were to manually start openvpn using the value in "ExecStart", I do not get any error.

[root@mybox client]# /usr/sbin/openvpn --suppress-timestamps --nobind --config default.conf --verb 9 --log /var/log/openvpn.log  WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.  ^C[root@mybox client]# /usr/sbin/openvpn --suppress-timestamps --nobind --config default.conf  WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.  DEPRECATED OPTION: --cipher set to 'AES-256-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-256-CBC' to --data-ciphers or change --cipher 'AES-256-CBC' to --data-ciphers-fallback 'AES-256-CBC' to silence this warning.  OpenVPN 2.5.3 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jun 18 2021  library versions: OpenSSL 1.1.1k  FIPS 25 Mar 2021, LZO 2.10  TCP/UDP: Preserving recently used remote address: [AF_INET]24.123.153.76:1194  UDP link local: (not bound)  UDP link remote: [AF_INET]24.123.153.76:1194  [my-vpn-server-here.com] Peer Connection Initiated with [AF_INET]24.123.153.76:1194  WARNING: You have specified redirect-gateway and redirect-private at the same time (or the same option multiple times). This is not well supported and may lead to unexpected results  TUN/TAP device tun0 opened  net_iface_mtu_set: mtu 1500 for tun0  net_iface_up: set tun0 up  net_addr_v4_add: 24.123.0.47/16 dev tun0  Initialization Sequence Completed  

Any ideas what can be wrong? Thanks!


UPDATE1:

  1. As a test, I copied the fedora config (certificate + .conf + credentials) files to Manjaro live USB. I installed openvpn via pacman and I had no issues starting OpenVPN via systemd.
  2. As a another test, I copied the .service file from Manjaro live USB into my Fedora setup and replaced the Fedora openvpn-client@.service and still cannot start OpenVPN via systemd.

Cannot scroll terminal on Ubuntu Server 20.04.2

Posted: 09 Aug 2021 08:10 AM PDT

I've installed Ubuntu Server 20.04 in a Samsung PC (NOT VM), but i cannot scroll up and down, and without a mouse i do not know how to do.

I've already tested Shit+PageUp, Ctrl+Shift+PageUp or ArrowUp, Shift+Fn+PageUp or arrowup but nothing. I cannot find anything around Than you

On GNOME, make the current window take the whole screen

Posted: 09 Aug 2021 07:13 AM PDT

I am looking for a way to cause the current window on GNOME 3 to take the whole screen. It should be in a form of a script, not a Qt or Python application.

I have installed and tried xdotool but it is not working for me either with the windowsize option or even by using the F11 key (pressing it on many systems will have the desired effect). Only help works.

Getting IPv4/IPv6 dual stack servers to bind to 0.0.0.0 instead of :: on machines where ipv6 is disabled?

Posted: 09 Aug 2021 08:01 AM PDT

I have a Linux (Ubuntu Groovy) server that is booted with kernel option ipv6.disable=1 so IPv6 is not available.

I also have some braindead dual stack software that I cannot change that wants to bind to ::, which of course fails. Can I somehow configure the OS to make this server bind to 0.0.0.0 and use IPv4 instead?

Can't boot without a liveUSB

Posted: 09 Aug 2021 08:53 AM PDT

I'm coming from Ubuntu, and am somewhat new to Arch-based Linux.

I installed an Arch-based Linux yesterday.

Everything went smooth until when I wanted to boot.

First, my PC didn't recognize the EFI bootloader. And then I had to boot to a LiveUSB.

On the LiveUSB screen when I chose Detect EFI Bootloaders it showed 2 files. Bootx64.efi and Grubx64.efi.

When I click on either of them it tells me Not a valid root device.

When I press the E button on that screen I see that the root and chain loader is not correct.

It's something like this:

Root={$2}  Chainloder{1}  

When I change these to

Root={(hd1,gpt2)}  Chainloader={(hd1,gpt1)/efi/Manjaro/grubx64.efi}  

System boots successfully.

I checked with Gparted and my EFI partition is flagged as boot. I don't know what is it that I'm missing.

Now my question is, how can I make this change permanent and boot without the liveUSB?

I appreciate any help, thanks ahead

/etc/network/interfaces - difference between auto and allow-hotplug

Posted: 09 Aug 2021 09:26 AM PDT

I am running Debian 9.13. I tried to check what is the difference between auto eth1 and allow-hotplug eth1 in /etc/network/interfaces. I have eth1 networking interface connected via USB. I tried rebooting, running systemctl restart networking and plugging/unplugging and it seems that main difference between allow-hotplug and auto is that if interface is marked as auto, command systemctl restart networking fails when eth1 is not connected. This leads to the conclusion that allow-hotplug is in fact preferable in all cases maybe except situation where I know that interface won't go away (lo, built-in interfaces).

Is it correct? Is there any other difference?

Linux Mint - Frontend process, what is it?

Posted: 09 Aug 2021 08:54 AM PDT

when I run top command in my console after fresh start, I have a frontend process that uses a lot of CPU.

Does anyone know what it is? Or how to check where it comes from?

frontend task

Why do the command cvt and gtf give different frequency values

Posted: 09 Aug 2021 08:01 AM PDT

I am trying to setup a xrandr mode line for a X display but in attempting to find the appropriate parameters, I note there are two different calculation programs (see below).

Why the difference in values?

Which set should I use for a NON-CRT display?

 $ gtf 1600 1200 60          # 1600x1200 @ 60.00 Hz (GTF) hsync: 74.52 kHz; pclk: 160.96 MHz          Modeline "1600x1200_60.00"  160.96  1600 1704 1880 2160  1200 1201 1204 1242  -HSync +Vsync     $  cvt 1600 1200 60   # 1600x1200 59.87 Hz (CVT 1.92M3) hsync: 74.54 kHz; pclk: 161.00 MHz   Modeline "1600x1200_60.00"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsync  

Password: chsh: PAM: Authentication failure

Posted: 09 Aug 2021 09:07 AM PDT

Trying to run

RUN chsh -s /bin/bash www-data   

(dockerfile) i tried to change it to /bin/zsh but still doesn't work. Docker file is too long, there is the offical repository with the file https://hub.docker.com/r/alexcheng/magento2/~/dockerfile/

Result :

  Password: chsh: PAM: Authentication failure  The command '/bin/sh -c chsh -s /bin/bash www-data' returned a non-zero code: 1  

/etc/passwd

/etc/passwd

root:x:0:0:root:/root:/bin/zsh  daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin  bin:x:2:2:bin:/bin:/usr/sbin/nologin  sys:x:3:3:sys:/dev:/usr/sbin/nologin  sync:x:4:65534:sync:/bin:/bin/sync  games:x:5:60:games:/usr/games:/usr/sbin/nologin  man:x:6:12:man:/var/cache/man:/usr/sbin/nologin  lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin  mail:x:8:8:mail:/var/mail:/usr/sbin/nologin  news:x:9:9:news:/var/spool/news:/usr/sbin/nologin  uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin  proxy:x:13:13:proxy:/bin:/usr/sbin/nologin  www-data:x:33:33:www-data:/var/www:/bin/zsh  backup:x:34:34:backup:/var/backups:/usr/sbin/nologin  list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin  irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin  gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin  nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin  systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false  systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false  systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false  systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false  syslog:x:104:108::/home/syslog:/bin/false  _apt:x:105:65534::/nonexistent:/bin/false  messagebus:x:106:110::/var/run/dbus:/bin/false  uuidd:x:107:111::/run/uuidd:/bin/false  lightdm:x:108:114:Light Display Manager:/var/lib/lightdm:/bin/false  whoopsie:x:109:117::/nonexistent:/bin/false  avahi-autoipd:x:110:119:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false  avahi:x:111:120:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false  colord:x:112:123:colord colour management daemon,,,:/var/lib/colord:/bin/false  dnsmasq:x:113:65534:dnsmasq,,,:/var/lib/misc:/bin/false  hplip:x:114:7:HPLIP system user,,,:/var/run/hplip:/bin/false  kernoops:x:115:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false  pulse:x:116:124:PulseAudio daemon,,,:/var/run/pulse:/bin/false  rtkit:x:117:126:RealtimeKit,,,:/proc:/bin/false  saned:x:118:127::/var/lib/saned:/bin/false  usbmux:x:119:46:usbmux daemon,,,:/var/lib/usbmux:/bin/false  speech-dispatcher:x:120:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/false  administrator:x:1000:1000:Administrator,,,:/home/administrator:/bin/bash  pkoz:x:1001:1001:Paul K,,,,:/home/pkoz:/usr/bin/zsh  guest-eaqooc:x:999:999:Guest:/tmp/guest-eaqooc:/bin/bash  sshd:x:121:65534::/var/run/sshd:/usr/sbin/nologin  mysql:x:122:130:MySQL Server,,,:/nonexistent:/bin/false  

/etc/pam.d/chsh

    # accounts with special shells from changing them.  auth       sufficient   pam_shells.so    # This allows root to change user shell without being  # prompted for a password  auth            sufficient      pam_rootok.so  

Any ideas how to fix it?

Incorrect automatic time zone

Posted: 09 Aug 2021 07:04 AM PDT

I've noticed that the automatic time zone detection functionality of my GNOME 3 (Arch Linux) is not working correctly. My actual time zone is PST (UTC-08), but if I toggle on the "Automatic Time Zone" option in "All Settings -> Date & Time", it would detect me to be in EST (UTC-05).

Kernel: 4.9.11-1-ARCH

GNOME: 3.22.3-1

Output of timedatectl:

      Local time: Wed 2017-03-01 05:36:18 EST    Universal time: Wed 2017-03-01 10:36:18 UTC          RTC time: Wed 2017-03-01 10:36:18         Time zone: America/New_York (EST, -0500)   Network time on: yes  NTP synchronized: yes   RTC in local TZ: no  

Output of sudo hwclock --show: 2017-03-01 05:37:38.295861-0500 (Which is the current EST time)

Output of date: Wed Mar 1 05:39:07 EST 2017

I suspected it was something wrong about my IP address, but all online IP location finder websites I've tried tell me I'm in San Francisco (which is correct). Also, I'm running dual systems (Windows 10 & Arch), and one OS writing the hardware clock always results in the other OS having an incorrect time on the next boot; I just ignore it and let the OSes' internet time services correct it. Wrong time zone detection only began today.

I'm not sure how to approach this issue. Can anyone shed some light on what might be the cause?

How do you binarize a colored image?

Posted: 09 Aug 2021 06:34 AM PDT

My friend has an colored image with Chinese handwriting (basically by taking photo of or scanning what he wrote on a piece of white paper), and he would like me to convert it into a black and white binary image. Are there applications under Ubuntu that can accomplish that?

Here is an example image:

enter image description here

No comments:

Post a Comment