Sunday, October 17, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


swap files instead of cp with temp file?

Posted: 17 Oct 2021 10:10 AM PDT

There is this famous entry level programming exercise where you're asked to swap two variables. The obvious solution is to use a third, ephemeral variable. But if your language has something like tuples, you can write a very simple helper function that returns its arguments in reversed order:

def swap(a: Int, b: Int): (Int, Int) = (b, a)  val (two, one) = swap(1, 2) // => (2, 1)  

I wonder if the same is possible for file operations on Linux. If e.g. I have a configuration that I want to exchange depending on the situation, is there a command that takes two filenames and swaps their contents?
For example, imagine file a.txt has the content "Hello" while b.txt reads "World". After calling what I'd call swap here, I would expect a.txt to contain "World" and b.txt "Hello".

The issue is way harder to research than I originally thought because swap partitions dominate all search results.

restoring using timeshift with an encrypted disk from a fresh live usb install

Posted: 17 Oct 2021 09:57 AM PDT

if you're using the live usb (this is specific to pop!_os 21.04, but i think it would apply to ubuntu etc) and you do a fresh reinstall, would you need to boot into the new system to get access to the newly created /etc/fstab file (and crypttab file?), and if not, how do you access it from the live usb after the fresh install? would you simply unencrypt the drive, mount, and then grab a copy there?

or another way to go about it would be to use a copy of /etc/fstab (and /etc/crypttab ?) from a timeshift snapshot and edit it. then simply restore the edited /etc/fstab (and /etc/crypttab? ) with timeshift.

this question is in response to the following answer: https://unix.stackexchange.com/a/636712/497219

Grub2 menu that is maintenance free

Posted: 17 Oct 2021 09:34 AM PDT

Following on the "maintenance free" question here, I know there are ways to automatically generate grub2 menu entries, but I need to manually edit/add them from time to time, like

  • to a live-Linux system, or
  • when adding a new ISO boot entry (that exists on another disk).

Almost all grub2 intro docs use the form of

set root=(hd2,gpt7)

which I know will fail in my case, as I need to shuffle my HDs around between my machines from time to time, and the above format will surely break when that happens.

Despite the likelihood that I can't specify my root fs with a UUID (and failed here too), I don't want to use UUID either, because when I format a partition (when installing a new OS), that partition's UUID will change.

So what are the better options?

  1. Foremost, the GPT partition label is the best candidates, as I can make sure they are unique throughout all my machines, even when I shuffle my HDs around. However, there seems to be problem doing that: "I'm unable to mount the device using PARTLABEL".
    But, it should be promising, as I can see

Since 4.20, there's also support for PARTLABEL <github.com/torvalds/linux/blob/v4.20/init/do_mounts.c>, which I think is really convenient. Perhaps update the answer. – equaeghe Jan 20

  1. Second best would be PARTUUID. However, there are some confusing/conflicting answers floating on the Internet.
    • Here it says the format is PARTUUID=SSSSSSSS-PP, but it doesn't give an example what exactly it looks like,
    • the next answer gives an example but it says the format is root=PARTUUID=666c2eee-193d-42db-a490-4c444342bd4e

So, would using PARTLABEL or PARTUUID possible with the latest grub2?

sudo /etc/sudoers is world writable

Posted: 17 Oct 2021 09:23 AM PDT

I did pkexec chmod 555 /etc/sudoers.d" does not work for me due to pkexec having a permission promblem, get the PID of the shell you are running pkexec in suing "echo $$" then log in another shell and do a " pkttyagent --process XXX" with the XXX replaced with the PID of the other shell.

After I do that, it said Not Authorized, I usually just switch to the root sudo su - without any password. How I can solve this issue with Linux Fedora 7.9v ? Thank you.

How to undo/fix autoremove's change to initramfs-tools? (Causes error in Whonix)

Posted: 17 Oct 2021 08:43 AM PDT

I executed sudo apt autoremove to free space in boot. I realized in hindsight that there are better ways to free space.

I don't notice any problems on my host os, but when I start Whonix KVM it shows me an error message about being unable to find the command for initramfs-tools. I have to press any key to continue booting Whonix. I don't notice any problem while using Whonix, but I'm not experienced enough to understand what kind of issues the error message could cause.

What I've tried:

Restarting the computer.

sudo apt install initramfs-tools  

It says it's already installed and up to date.

sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils libguestfs-tools genisoimage virtinst libosinfo-bin virt-manager  

It says they're already installed and up to date.

I'm using the latest Whonix KVM version 16.0.3.1

On updating to Debian 11 Applications Menu is missing and seeing error on attempting to add

Posted: 17 Oct 2021 08:22 AM PDT

On upgrading from Debian 10 to 11 and my application menu is no longer present. On attempting to add it I see the below message:

Plug-in "Applications Menu" unexpectedly left the panel, do you want to restart it?    The plug-in restarted more than once in the last 60 seconds. If you press Execute the panel will try to restart the plug-in otherwise it will be permanently removed from the panel.  

On clicking 'execute' the message repeats. On click 'remove' the message disappears but the applications menu does not appear.

I found the below thread on the XFCE forums where the OP has the same issue as me, however no solution is provided. My sources list does not contain any testing repos.

https://forum.xfce.org/viewtopic.php?id=14612

Bad: Kali linux window problems

Posted: 17 Oct 2021 07:52 AM PDT

I have a problem with my Kali Linux machine that's really weird. Basically, I can't right-click on my desktop, I can't alt+tab to other windows, I can't close a tab, I can't access the window settings and I can't even see any program properly everything seems weird. The problem is not about resolution I have checked that already. I'm thinking some package is responsible for this issue. Everything was working perfectly yesterday and today I open the machine and I find this problem. If anyone knows how to fix this, please help me. Thanks.

enter image description here

Copying windows csv file data to Unix server file

Posted: 17 Oct 2021 07:40 AM PDT

I have this Unix server at work where resides a script which picks up a file on that same server and process each row. I believe we receive those files from data providers, which SFTP the files to us. The file is showing with a CSV extension.

However when I copy paste some sample rows from outside my local environment which is Windows, the rows produce Data Quality errors. I am sure this is not due to the content. It probably has to do with the CR LF end of lines off of my Windows environment pasting into a UNIX file; however, when I convert my sample rows written inside Notepad++ to Unix end of line LF and then paste it into that server file to be processed by the script, the script fails on those rows.

So I am not sure what to do and where to find the issue. What could be the reason?

Pcre2grep multiline regular expression

Posted: 17 Oct 2021 06:46 AM PDT

I'm trying to create a regular expression to match the first html of a text file with this content:

garbage  garbage  §<html class="test1">  <div>test</div></html>§  garbage  garbage  §<html class="test2>  <div>test</div></html>§  garbage  garbage  §<html class="test3">  <div>test</div></html>§  garbage  garbage  

first I tried something similar on regex101.com

<html.*?html>  

with PCRE2 and single line mode and it works ok. Then I tried it on Windows with Notepad++ with "dot matches new line" option enabled, it works ok there too.

Now I'm trying to do the same on Arch Linux with pcre2grep, i've tried with this regular expression:

pcre2grep -o '(?s)<html.*?html>' test.txt  

but it doesn't work and I don't know why because from what i have understood the "(?s)" modifier should enable the PCRE2_DOTALL. How can i create an equivalent regular expression with pcre2grep ?

How many partitions can be created for linux on GPT?

Posted: 17 Oct 2021 07:42 AM PDT

I know it's up to 128 for windows OS. Does the same limit apply to Linux? So this limit is actually a limit of GPT?

Overview of amdgpu clock and temperature

Posted: 17 Oct 2021 06:43 AM PDT

I remember there was some sysfs/procfs (or maybe debugfs?) file that provided formatted textual overview of GPU temperature, clock and some more information. I can't remember path to the file and I also can't find it. What is the path?

The contents of the file were in Name of parameter: value Unit format and it included nearly all interesting information – temp, core&mem frequencies, usage percentage, and also some other things.

I was using Linux 5.x with amdgpu driver.

How to persist the contents of the X11 (copy) clipboard on closing e.g. Vim to paste its contents later?

Posted: 17 Oct 2021 09:38 AM PDT

If I copy to X11 (copy) clipboard in Vim using "+y, I can only paste contents as long as Vim is open. The reason is as follows:

From Ubuntu Wiki: ClipboardPersistence:

The problem happens because Xorg takes a conservative approach to copying. It copies only a reference to the original data when the user performs a select or copy. It doesn't go and retrieve the actual data from the source program until the user requests a paste. It saves a lot of unneeded transfer of data this way, at the expense of having no way of retrieving data from a closed program that hasn't saved its clipboard somewhere else.

I.e. after exiting Vim, X11 cannot retrieve data from it anymore, since the reference is invalid.

How can I overcome this "limitation" of X11 to paste the X11 (copy) clipboard after Vim has exited, e.g. using a clipboard manager?

Ultimately, what I want is behavior similar to:

Freedesktop's ClipboardManager specification comes to the rescue. Gnome settings daemon, the component of Ubuntu that handles all copying and pasting by default, conforms by allowing applications to explicitly request to save their clipboard contents in a safe place. Applications conform by requesting a save before they exit. Everything gets squared away before a quit and we don't lose any data.

clipmenu was recommended, but it's not available as a Debian package. Futhermore,autocutsel didn't persisted the clipboard on exit using autocutsel -selection PRIMARY -fork or autocutsel -selection CLIPBOARD -fork.

Squid deny_info https not working

Posted: 17 Oct 2021 06:31 AM PDT

I have squid proxy server configured on centos 8 and working fine i have blocked some sites through squid when anyone access to blocked url it simply show the page browser cant open the page. I just want to ERROR_ACCESS. here is below my configuration.

acl localnet src 200.200.200.0/24  acl localnet src 172.30.0.0/16    acl SSL_ports port 443  acl Safe_ports port 80      # http  acl Safe_ports port 21      # ftp  acl Safe_ports port 443     # https  acl Safe_ports port 70      # gopher  acl Safe_ports port 210     # wais  acl Safe_ports port 1025-65535  # unregistered ports  acl Safe_ports port 280     # http-mgmt  acl Safe_ports port 488     # gss-http  acl Safe_ports port 591     # filemaker  acl Safe_ports port 777     # multiling http  acl CONNECT method CONNECT    http_access deny !Safe_ports    http_access deny CONNECT !SSL_ports    http_access allow localhost manager  http_access deny manager    acl badsite url_regex "/etc/squid/block"  http_access deny badsite all  deny_info ERR_ACCESS_DENIED badsite    http_access allow localnet  http_access allow localhost    http_access deny all    http_port 3128  cache_dir ufs /var/spool/squid 100 16 256    coredump_dir /var/spool/squid    refresh_pattern ^ftp:       1440    20% 10080  refresh_pattern ^gopher:    1440    0%  1440  refresh_pattern -i (/cgi-bin/|\?) 0 0%  0  refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880  refresh_pattern .       0   20% 4  

debian create tasksel for installing docker

Posted: 17 Oct 2021 09:07 AM PDT

On debian 11. I create descs file to install docker. Before this I create docker repo and gpg so when I install the from command apt install docker-ce docker-ce-cli containerd.io it works but when I trying to install with tasksel it does not install anything the tasksel is:

Section: laptop  Description: Install docker    Install docker  key:  Packages: list   docker-ce   docker-ce-cli   containerd.io  

and when i run dry # tasksel -t install i get:

dockerdebconf-apt-progress -- apt-get -q -y -o APT::Install-Recommends=true -o APT::Get::AutomaticRemove=true -o Acquire::Retries=3 install docker-ce-cli containerd.io docker-ce  What I missing?  

LC_ALL: cannot change locale (en_US.utf-8)

Posted: 17 Oct 2021 10:05 AM PDT

I know this question has been asked before but none of the answers worked out for me.

I use Arch Linux and KDE with the linux-zen kernel and I have set my locale to en_US.utf-8.

Whenever I open Konsole I get:

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf-8)  

How can I fix this?

Here is my /etc/environment:

#  # This file is parsed by pam_env module  #  # Syntax: simple "KEY=VAL" pairs on separate lines  #    LANG=en_US.utf-8  LC_ALL=C  

I have also set LC_ALL to C in my .bashrc.

fish shell alias only in specific directory

Posted: 17 Oct 2021 07:43 AM PDT

I am using fish and am working on a project with a script that's frequently invoked for build tasks called x.py. I'd like to create an alias that maps x to ./x.py. However, I only want this to apply inside that specific directory.

The fish documentation gives a fairly detailed explanation on how to make various kinds of aliases/functions/etc, but I can't find anything on how to make them directory specific.

Any help would be much appreciated

Sorting filenames with a number of '-' delimiters

Posted: 17 Oct 2021 09:00 AM PDT

I want to sort a set of files with the same number of '-' delimiters in each filename (with -n for numeric sorting).

Here is an example list

/home/flora/edvart/docs/schimmel-01.png  /home/flora/edvart/docs/schimmel-02.png  /home/flora/edvart/docs/schimmel-03.png  /home/flora/edvart/docs/schimmel-04.png  /home/flora/edvart/docs/schimmel-05.png  /home/flora/edvart/docs/schimmel-06.png  /home/flora/edvart/docs/schimmel-07.png  /home/flora/edvart/docs/schimmel-08.png  /home/flora/edvart/docs/schimmel-09.png  /home/flora/edvart/docs/schimmel-10.png  /home/flora/edvart/docs/schimmel-11.png  /home/flora/edvart/docs/schimmel-12.png  /home/flora/edvart/docs/schimmel-13.png  

Here is the code I am using

for fl in "$@"; do     fnme=${fl##*/}     ftyp=${fl##*.}       fdir=${fl%/*}     fnam=${fnme%.*}       nf=$( echo "$fnam" | awk -F '-' '{print NF}')     ifld=$(( nf + 1 ))       find "$fdir" -type f -name "${fnam}-*.png"  |       sort -znt '-' -k "$ifld"n  |     while IFS= read -r flimg     do       echo "$flimg"     done  done  

But when I try with the first three files being-1, -2, -3, the result is still not sorted numerically

/home/flora/edvart/docs/schimmel-04.png  /home/flora/edvart/docs/schimmel-05.png  /home/flora/edvart/docs/schimmel-06.png  /home/flora/edvart/docs/schimmel-07.png  /home/flora/edvart/docs/schimmel-08.png  /home/flora/edvart/docs/schimmel-09.png  /home/flora/edvart/docs/schimmel-10.png  /home/flora/edvart/docs/schimmel-11.png  /home/flora/edvart/docs/schimmel-12.png  /home/flora/edvart/docs/schimmel-13.png  /home/flora/edvart/docs/schimmel-1.png  /home/flora/edvart/docs/schimmel-2.png  /home/flora/edvart/docs/schimmel-3.png  

Cannot send packets to raspberry pi from WSL2 via tcpreplay

Posted: 17 Oct 2021 07:07 AM PDT

I am trying to send packets from my pcap file to my raspberry pi. I am using WSL2 box on my Windows laptop to send the packets over wifi.

WSL2 can ping the raspberry pi

--- 192.168.1.79 ping statistics ---  240 packets transmitted, 239 received, 0.416667% packet loss, time 239444ms  rtt min/avg/max/mdev = 3.469/38.258/621.335/103.481 ms  

Wireshark confirms:

enter image description here

but when I run tcpreplay

sudo tcpreplay -i eth0 -K /home/barry/pcaps/HomeWifi.pcap  

I do not get any output on Wireshark. The Pi does not receive the packets, despite WSL2 output:

$ sudo tcpreplay -i eth0 -K HomeWifi.pcap  File Cache is enabled    quit  ^C User interrupt...  sendpacket_abort  Actual: 60297 packets (69710756 bytes) sent in 35.94 seconds  Rated: 1939345.8 Bps, 15.51 Mbps, 1677.45 pps  Statistics for network device: eth0          Successful packets:        60296          Failed packets:            0          Truncated packets:         0          Retried packets (ENOBUFS): 0          Retried packets (EAGAIN):  0  

I am confused as to why the ping works, yet tcpreplay does not. Is there a fix?

ifconfig of WSL2

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 172.25.168.66  netmask 255.255.240.0  broadcast 172.25.175.255          inet6 fe80::215:5dff:fe5e:97d0  prefixlen 64  scopeid 0x20<link>          ether 00:15:5d:5e:97:d0  txqueuelen 1000  (Ethernet)          RX packets 238947  bytes 343765801 (343.7 MB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 267814  bytes 285573706 (285.5 MB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536          inet 127.0.0.1  netmask 255.0.0.0          inet6 ::1  prefixlen 128  scopeid 0x10<host>          loop  txqueuelen 1000  (Local Loopback)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 0  bytes 0 (0.0 B)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  

sshd: what are the practical effects of setting "UsePAM no"

Posted: 17 Oct 2021 08:28 AM PDT

in /etc/ssh/sshd_config, PAM is enabled by default on Debian 10:

UsePAM yes  

In a situation when I don't want to allow login with password or kerberos, and only want to allow SSH key authentication, does it still have any advantage to enable PAM in sshd? Or, would it simplify the process and perhaps make it more secure, if UsePAM is set to no?

What would be the practical effects of disabling PAM in sshd? Would I notice any difference?

In KDE Konsole edit color scheme - what are color1, color2,...color8?

Posted: 17 Oct 2021 09:43 AM PDT

New to KDE, trying to figure out how to edit color scheme for Konsole. I did a bit of looking around.

Questions

  1. What is Faint Color Column used for?
  2. Is intense color used for bold style?
  3. What is Color 1...Color 8 used for?

Force A2DP sink (wireless bluetooth headset is connected already)

Posted: 17 Oct 2021 10:01 AM PDT

Running on Debain 10 buster, with KDE plassa 5 * KDE Frameworks 5.54.0 * Qt 5.11.3 (built against 5.11.3) * The xcb windowing system

I'm using wh1000mx3, which succeeded to pair but not able to chose the A2DP profile automatically. Usually the HSP/HFP profile appear. Moreover, the profile randomly succeed (1 of 15 attempts) or when the Bluetooth device is forgotten.

I'm using the "gdm session" and the solution from official detain A2DP page is relevant. https://wiki.debian.org/BluetoothUser/a2dp

The solution on this web didn't help as well. Error when trying to connect to bluetooth speaker: `org.bluez.Error.Failed` How to force A2DP sink when wireless bluetooth headset is connected?

Please assist :)

Thanks,

sec_user

Getting "ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value" Error using mariadb

Posted: 17 Oct 2021 09:46 AM PDT

While creating a haproxy_check user in MariaDB I am getting error ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value, what I need to do?

Running scripts/commands from a host system in a chroot environment.

Posted: 17 Oct 2021 08:03 AM PDT

First of all, I have inside an android Operating System a chroot environment created using Linux Deploy. I am able to access it from Android using a terminal emulator and root permission. I would like to run a script inside it. However, when trying to run the script, or even normal shell commands, it doesn't executes and returns this error:

"No such file or directory"

So, I am wondering, is it there a way to execute, from the host within a chroot environment, commands/scripts? Has the problem to do with the proper setting of the environment PATH variable?

I am able to execute ls command within the chroot environment but when printing with the -la argument it doesn't even show the . and .. directories. Could someone explain why is this happening and how could we overcome this issue?

P.D.: I've posted this issue in unix/linux stack exchange because I thought it concerns more to it. However, if you recommend me to also post it in stackoverflow or any other, I am open to do so.

How to process an x-column text file to get a y-column one?

Posted: 17 Oct 2021 09:52 AM PDT

I have a text file:

a   aa  aaa     b   bb  bbb     c   cc  ccc  d   dd  ddd     e   ee  eee     f   ff  fff  g   gg  ggg     h   hh  hhh     i   ii  iii  j   jj  jjj  

How can I process it and get a 2 column file like this:

a   aa  aaa b  bb  bbb  c   cc  ccc d  dd  ddd  e   ee  eee f  ff  fff  g   gg  ggg h  hh  hhh  i   ii  iii j  jj  jjj  

Or a three column file like this:

a   aa  aaa  b   bb  bbb  c   cc  ccc  d   dd  ddd  e   ee  eee  f   ff  fff  g   gg  ggg  h   hh  hhh  i   ii  iii  j   jj  jj  

I prefer to get awk solution but other solutions are welcomed too.

Openvpn client and server cannot ping each other(Connection established)

Posted: 17 Oct 2021 09:01 AM PDT

I have setup OpenVPN client and server between two VPS. I have a client and server setup, server using 10.8.0.1 and 10.8.0.2 IPs in tun interface, and client using 10.8.0.6 and 10.8.0.5 in tun interface. (vps1 is the client and vps2 is the server.) The client can ping server tun IP 10.8.0.1 but not any other IPs. From the server I'm not able to ping to any of the tun IPs or client tun IPs.

server conf:

port 1194  proto udp  dev tun0    ca ca.crt  cert server.crt  key server.key  tls-server  dh dh2048.pem  server 10.8.0.0 255.255.255.0  ifconfig-pool-persist ipp.txt    keepalive 10 120    comp-lzo  user nobody  group nobody  persist-key  persist-tun    verb 3  

client conf:

client  dev tun  proto udp  remote 198.168.XXX 1194  nobind  tun-mtu 1500  persist-key  persist-tun  keepalive 14 120  ca ca.crt  cert client.crt  key client.key  comp-lzo  verb 3  

As per the logs connection is setup successfully,

Jun  9 13:25:28 vps2 openvpn[6484]: MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)  Jun  9 13:25:28 vps2 openvpn[6484]: MULTI: Learn: 10.8.0.6 -> vps1.xxx/xxxxx:33012  Jun  9 13:25:28 vps2 openvpn[6484]: MULTI: primary virtual IP for vps1.xxx/xxxxx:33012: 10.8.0.6  Jun  9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 PUSH: Received control message: 'PUSH_REQUEST'  Jun  9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 send_push_reply(): safe_cap=940  Jun  9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 SENT CONTROL [vps1.xxx]: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5' (status=1)  

And tunnels are established at both ends:

Server

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00            inet addr:10.8.0.1  P-t-P:10.8.0.2  Mask:255.255.255.255            UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1            RX packets:5 errors:0 dropped:0 overruns:0 frame:0            TX packets:28 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:100            RX bytes:420 (420.0 b)  TX bytes:1968 (1.9 KiB)  

Client

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00            inet addr:10.8.0.6  P-t-P:10.8.0.5  Mask:255.255.255.255            UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1            RX packets:0 errors:0 dropped:0 overruns:0 frame:0            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:100            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)  

The client also able to ping and ssh to server via the gateway IP

root@vps1:~# ping 10.8.0.1  PING 10.8.0.1 (10.8.0.1) 56(84) bytes of data.  64 bytes from 10.8.0.1: icmp_seq=1 ttl=64 time=72.6 ms  64 bytes from 10.8.0.1: icmp_seq=2 ttl=64 time=72.6 ms  64 bytes from 10.8.0.1: icmp_seq=3 ttl=64 time=72.7 ms  ^C  --- 10.8.0.1 ping statistics ---  3 packets transmitted, 3 received, 0% packet loss, time 2002ms  rtt min/avg/max/mdev = 72.666/72.691/72.726/0.221 ms    root@vps1:~# ssh 10.8.0.1  root@10.8.0.1's password:  

But not able to ping the opnevpn ip's from server and client.

root@vps1:~# ping 10.8.0.2  PING 10.8.0.2 (10.8.0.2) 56(84) bytes of data.  ^C  --- 10.8.0.2 ping statistics ---  3 packets transmitted, 0 received, 100% packet loss, time 2000ms    root@vps1:~# ping 10.8.0.5  PING 10.8.0.5 (10.8.0.5) 56(84) bytes of data.  

Use a script for a telnet session

Posted: 17 Oct 2021 07:07 AM PDT

I have a problem with my script. It seems my password is wrong.

#!/usr/bin/expect    set ip [lindex $argv 0]  spawn telnet $ip  set timeout 10  expect "Login:"  send "administrator\r"  expect "Password:"  send "123456"  send "\r"  

It says, login incorrect. But it works, when i use cmd on Windows to telnet to my phone, it works with "administrator" and 123456 as password. I don't know why in my script, I could not log on successfully.

I have to use this script to downgrade/upgrade my phones.

Combining options in find command

Posted: 17 Oct 2021 07:43 AM PDT

Using the find command is there a way to combine options:

i.e.

find . -type fd -name "somefile"  

Although -type ignores the second option; I'm looking to find only files or directories.

How do I enable sound in this fresh Arch install?

Posted: 17 Oct 2021 09:32 AM PDT

I'm following the Arch Beginner's Guide.

I have Arch running. Now I'm working on the post-installation instructions, one of the first parts of which is to unmute the speakers. This is where my problem is.

First, I installed alsamixer

pacman -S alsa-utils  

Then this

amixer sset Master unmute  

I get this error:

amixer: Unable to find simple control 'Master',0  

I don't know how to proceed.

EDIT:

# cat/proc/asound/cards  0 [MID]: Hda-Intel - HDA Intel MID           HDA Intel MID at 0xf7e14000 irq 63  1 [PCH]: Hda-Intel - HDA Intel PCH           HDA Intel PCH at 0xf7e10000 irq 59     # amixer -c1 sset Master unmute  Simple mixer control 'Master',0  Capabilities: pvolume pvolume-joined pswitch pswitch-joined  Playback channels: Mono  Limits: Playback 0 - 87  Mono: Playback 60 [69%] [-20.25dB] [on]    # speaker-test -c 2    speaker-test 1.9.27.2    Playback device is default  Stream parameters are 48000Hz, S16_LE, 2 channels  Using 16 octaves of pink noise  ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave  Playback open error: -2, No such file or directory  

How to define 'tab' delimiter with 'cut' in Bash?

Posted: 17 Oct 2021 08:47 AM PDT

Here is an example of using cut to break input into fields using a space delimiter, and obtaining the second field:

cut -f2 -d' '

How can the delimiter be defined as a tab, instead of a space?

No comments:

Post a Comment