Sunday, July 11, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How do I reduce memory latency?

Posted: 11 Jul 2021 10:28 AM PDT

My environment is OpenVZ, using the 3.10.0-1160.21.1.vz7.174.13 GNU/Linux kernel.

When executing vzstat, I am seeing the lat(ms) is very high (going to assume this means latency in miliseconds):

enter image description here

This in turn seems to be causing kswapd to be working overtime (and resulting in sub-par performance).

My question is - what should I be doing to decrease the memory latency? Is it just a case of adding more physical RAM? Memory usage is as follows:

[root@nyjvz2 ~]# free -h                total        used        free      shared  buff/cache   available  Mem:           125G         78G        659M        2.6G         46G         43G  Swap:           31G         25G        6.1G  [root@nyjvz2 ~]#  

Can I use Overlayfs on Debian?

Posted: 11 Jul 2021 10:24 AM PDT

I'm running on Debian stable buster, and I'm trying to manually mount some directories using overlayfs.

I installed the package fuse-overlayfs. But when I run the command $ mount -t overlayfs ... I get the error

unknown filesystem type 'overlayfs'  

Is it not possible to use overlayfs?

I can see that overlayfs is not listed in /proc/filesystems.

Note: I am running Linux kernel 5.10 installed from backports. I don't know if that makes a difference.

How to download alpine linux packages over tor

Posted: 11 Jul 2021 09:56 AM PDT

In Debian, one can install apt-transport-tor, which allows packages to be downloaded over tor (to prevent an observer from seeing what packages you are installing). Is there an equivalent in Alpine Linux, or a way to configure apk to work through a SOCKS5 proxy?

can't open vscode on kali linux as super user or root

Posted: 11 Jul 2021 09:54 AM PDT

I installed vs code on kali linux and when I tried openning it with command code this massage would appear.

You are trying to start Visual Studio Code as a super user which isn't recommended. If this was intended, please specify an alternate user data directory using the `--user-data-dir` argument.  

I tried this method

sudo code --user-data-dir="~/.vscode-root"  

but no luck

SSH to remote server works, scp and rsync DO NOT

Posted: 11 Jul 2021 09:42 AM PDT

I've been using rsync from some bash scripts to upload some files to a remote server with a fairly basic rsync command:

rsync -avruz /bin {user}@{targetIP}:/~  

recently it stopped working, both from inside bash and when executed in a terminal. If I add the -vvvv and --progress flags I can see that it hangs just after the ssh connection is established, before files get transferred. The last output from rsync is: checking charset.

I can successfully connect to the remote server via ssh without error, it's only rsync and scp that don't work. I can also rsync locally just fine.

Things I've tried:

  • Rebooting server and client
  • Removing and reinstalling ssh keys
  • Reinstalling ssh and rsync on both server and client machines

This one is a real head scratcher, I'm not sure where to go from here. Any insight into this problem would be greatly appreciated! TIA

How to install java on linux (pop os)

Posted: 11 Jul 2021 09:37 AM PDT

I am transferring Operating systems, and I am a java programmer, so I'm trying to install java on my computer, but when I tried to install it, it wouldn't recognize the javax.swing library.

My question: how can I correctly install java to program.

How find out through terminal that if any system command uses specific system call internally?

Posted: 11 Jul 2021 09:41 AM PDT

I am new to linux.I want to that how to find out through terminal that if any system command uses specific system call internally? Suppose hard linking is to be performed . So "ln" command uses li nk() system call internally. Likewise rm command uses unlink() system call.

What is an encrypted LVM?

Posted: 11 Jul 2021 09:26 AM PDT

If I install Debian, I can choose to set up the disk using an encrypted LVM. But what exactly does this set up? Is just the partition table encrypted, or are all files on all partitions encrypted?

Curl error (56): Failure when receiving data from the peer

Posted: 11 Jul 2021 09:27 AM PDT

Now I want to update my operation system like this:

dnf udpate  

but shows this error:

Total download size: 69 M  Is this ok [y/N]: y  Downloading Packages:        The downloaded packages were saved in cache until the next successful transaction.      You can remove cached packages by executing 'dnf clean packages'.      Error: Error downloading packages:        Curl error (56): Failure when receiving data from the peer for http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=$infra [Recv failure: Connection reset by peer]  

when I ping the domain using this command:

[root@izbp19pke6x0v6ruecuy1yz .acme.sh]# ping mirrorlist.centos.org  PING mirrorlist.centos.org (147.75.69.225) 56(84) bytes of data.  64 bytes from packet04.centos.org (147.75.69.225): icmp_seq=1 ttl=47 time=259 ms  64 bytes from packet04.centos.org (147.75.69.225): icmp_seq=2 ttl=47 time=259 ms  64 bytes from packet04.centos.org (147.75.69.225): icmp_seq=3 ttl=47 time=259 ms  ^C  --- mirrorlist.centos.org ping statistics ---  3 packets transmitted, 3 received, 0% packet loss, time 2001ms  rtt min/avg/max/mdev = 259.591/259.672/259.786/0.594 ms  

the ping tell me the domain accessable. why the curl tell that error? I am searching from internet but no one talk about this problem. what should I do to avoid this error?

Error in kali linux [closed]

Posted: 11 Jul 2021 09:22 AM PDT

tar -xvf discord-0.0.15.tar.gz -C opt  

After executing the command, I am getting:

tar: opt: Cannot open: No such file or directory  tar: Error is not recoverable: exiting now  

Could not get nonce, let's try again when using acme

Posted: 11 Jul 2021 08:22 AM PDT

When I am using this command to generate a certificate on CentOS 7.6:

acme.sh --issue --dns dns_cf  -d poemhub.top -d *.poemhub.top -k ec-256  

shows this error:

[Sun Jul 11 23:09:28 CST 2021] Using CA: https://acme.zerossl.com/v2/DV90  [Sun Jul 11 23:09:29 CST 2021] Multi domain='DNS:poemhub.top,DNS:*.poemhub.top'  [Sun Jul 11 23:09:29 CST 2021] Getting domain auth token for each domain  [Sun Jul 11 23:09:30 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:31 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:31 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:31 CST 2021] Could not get nonce, let's try again.  [Sun Jul 11 23:09:34 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:35 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:35 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:35 CST 2021] Could not get nonce, let's try again.  [Sun Jul 11 23:09:39 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:39 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:39 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:39 CST 2021] Could not get nonce, let's try again.  [Sun Jul 11 23:09:44 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:44 CST 2021] Create new order error. Le_OrderFinalize not found.   [Sun Jul 11 23:09:44 CST 2021] Please add '--debug' or '--log' to check more details.  [Sun Jul 11 23:09:44 CST 2021] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh  

where is going wrong and what should I do to fix it? what I have tried to upgrade the newest version of acme.sh:

[root@izbp19pke6x0v6ruecuy1yz poemhub.top_ecc]# acme.sh --upgrade  [Sun Jul 11 23:09:19 CST 2021] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 35  [Sun Jul 11 23:09:21 CST 2021] Already uptodate!  [Sun Jul 11 23:09:21 CST 2021] Upgrade success!  

Information of new user won´t show in terminal

Posted: 11 Jul 2021 08:44 AM PDT

I created a new user and logged in successfully on my ubuntu 20.04 machine.

When I logged in as root the terminal looks like this:

root@ubuntu-s-1vcpu-1gb-fra1-01:~#

When I login with my "mynewuser" account I only see a $, nothing more. I want to display the same information as before:

mynewuser@ubuntu-s-1vcpu-1gb-fra1-01:~

This was how I created my new user:

mkdir -p /home/mynewuser/.ssh  touch /home/mynewuser/.ssh/authorized_keys  echo "publickey" > /home/mynewuser/.ssh/authorized_keys  useradd -d /home/mynewuser mynewuser  usermod -aG sudo mynewuser  chown -R mynewuser:mynewuser /home/mynewuser/  chmod 700 /home/mynewuser/.ssh  chmod 644 /home/mynewuser/.ssh/authorized_keys  

Did I miss anything?

Remove lines exhibiting a unique STRING

Posted: 11 Jul 2021 09:47 AM PDT

I have a text file with approx. 12 millions of lines, each composed of 4 fields (column 1, 2, 3 and 4)

Most lines have a unique STRING in column 2 and I would like to remove them. The entire text file is SORTED according column 2 (smaller to greater); lines with identical STRING in column 2 are always consecutive.

Spread in the text file, I regularly have 2, 3, 4 or 5 consecutive lines with the same STRING in column 2. These are the lines that I would like to keep in the final text file:

column1 column2 column3 column4    WT 1 ILS G    WT 2 DSG E            WT 3 WYT S   . . . .    WT 106  AAA X    WT 106  BBB Y    . . . .    WT 2704 CCC X    WT 2704 DDD Y   WT 2704 EEE X    . . . .    WT 87520 FFF X    WT 87520 GGG X    WT 87520 HHH X    WT 87520 III Y    . . . .        

What I would I like to achieve:

column1 column2 column3 column4    WT 106  AAA X    WT 106  BBB Y    WT 2704 CCC X    WT 2704 DDD Y   WT 2704 EEE X    WT 87520 FFF X    WT 87520 GGG X    WT 87520 HHH X    WT 87520 III Y    

Thanks in advance for your time and help. Best,

Laurent

How can I view complete zsh history?

Posted: 11 Jul 2021 08:43 AM PDT

I am using zsh on MacOS BigSur. If I write history, I get the last 15 commands. How can I view the complete history?

Getting an array into a parallel bash script

Posted: 11 Jul 2021 10:42 AM PDT

I'm having a bit of difficulty understanding parallel procedures. Atm I'm trying to mass wipe hard drives, so have created a script, however it won't run in parallel.

for i in "${!wipe[@]}"; do         dd if=/dev/zero of=/dev/${wipe[$i]} &  wait   

The dd zeros the disks but it does this one after the other so when doing 8 disks, can be very time consuming. Thanks

How to create a Cron Job in Linux C7 using Webmin

Posted: 11 Jul 2021 07:39 AM PDT

I was wondering if someone can help me, please. I am trying to set up a Cron job using Webmin in Linux, C7. I've included this string:

sh /home/user/domains/url/public_html/cron/vtigercron.sh  

But, I can't get it to fire. I see workflows stuck in queue, but no going anywhere. I did it this way once with a different domain. Could someone please tell me what it is I'm doing wrong?. Thanks in advance.

load driver with insmode get :disagrees about version of symbol module_layout

Posted: 11 Jul 2021 07:33 AM PDT

I compiled simple drive for Linux kernel for ARM system:

$ uname -a

Linux CR5 4.4.171-cr5 #2 Tue Mar 10 11:49:00 CET 2020 armv7l GNU/Linux  

To compile i used the config file from the up ruining system located at:

/proc/config.gz

i downloaded a vanilla kernel, checkout to tag 4.4.5, replace the config file ,compile the kernel, and then compile the drive with the tool-chine for arm

gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabi The drive contain simple code

    #include <linux/module.h>      #include <linux/kernel.h>        int init_module(void) {          printk(KERN_INFO "Hello world.\n");          return 0;      }        void cleanup_module(void) {          printk(KERN_INFO "Goodbye world.\n");      }  

i used insmod to load the driver but the err message to terminal is:

insmod: ERROR: could not insert module test_module.ko: Invalid module format

at the dmesg i get this message

test_module: disagrees about version of symbol module_layout

However, when i compere between running module in the system with my module with readelf -a

The ELF Header are the same and the File Attributes are the same.

what can i check more? Maybe the module loading was blocked by kernel? how can i check that? some one hes a lead for my what i can do next?

p.s

  • simple c program is ruining fine, so i guess the tool-chine is fine
  • insmod -f not work as well

Thanks

why could not access stackoverflow in terminal but works fine in browser

Posted: 11 Jul 2021 08:30 AM PDT

When I using this command in my terminal,shows this error:

[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/BlackHole% curl https://stackoverflow.com/  curl: (35) OpenSSL SSL_connect: Connection reset by peer in connection to stackoverflow.com:443   

but in the browser I can access the website, what should I do to fix this problem? the terminal did not have proxy setting.

[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/retire% env|grep proxy  [dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/retire%   

I am retest it and ping works:

[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/retire% ping www.stackoverflow.com  PING stackoverflow.com (151.101.129.69) 56(84) bytes of data.  64 bytes from 151.101.129.69 (151.101.129.69): icmp_seq=1 ttl=51 time=247 ms  64 bytes from 151.101.129.69 (151.101.129.69): icmp_seq=2 ttl=51 time=248 ms  ^C  --- stackoverflow.com ping statistics ---  3 packets transmitted, 2 received, 33.3333% packet loss, time 2002ms  rtt min/avg/max/mdev = 247.380/247.825/248.270/0.445 ms  [dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/retire% curl www.stackoverflow.com  curl: (56) Recv failure: Connection reset by peer  [dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/retire%   

Capturing parameters sed

Posted: 11 Jul 2021 08:19 AM PDT

I am trying to replace occurences in bunch of html files. I want to update the files with the new subdomain name.

old urls look like this :

https://123.olddomain.com/wp-content/

New ones should look like that :

https://newdomain.com/static/123.newdomain.com/wp-content/

I have tried in the folowing expression to update all subdomains html files at once

sudo find . -type f -exec sed -i 's+https:\/\/\([0-9]\).olddomain.com\/wp-content\/+https:\/\/newdomain.com\/static\/$1.newdomain.com\/wp-content\/+g' {} +  

$1 does not seem to capture my rexpression [0-9]

Thanks for any suggestion.

How to remove "" in output list?

Posted: 11 Jul 2021 07:30 AM PDT

I used a command to get a list of IP from EC2.

The result so far i got is a list like this:

[      "172.31.11.7",      "172.31.48.141",      "172.31.64.201",      "172.31.64.149",      "172.31.64.148",      "172.31.64.111"  ]  

I want to get result as:

172.31.11.7  172.31.48.141  172.31.64.201  172.31.64.149  172.31.64.148  172.31.64.111  

How can i do that?

How to escape new line characters for json?

Posted: 11 Jul 2021 07:43 AM PDT

I have a file that contains new line characters.
I am posting the file via curl to a server that would parse it as json.
It rejects the request due to the new line characters.
But when I do:

$(echo "$MY_DATA" | sed 's/$//' | tr -d '\n\r')    

It works but the new line characters are gone.
How can I escape the text so that it keeps the new line characters?
I tried tr '\n' '\\n' and sed 's/\n/\\n/g and neither approach worked

parse colon separated value pairs

Posted: 11 Jul 2021 07:50 AM PDT

I've written a script that converts nmcli --mode multiline dev wifi into json but I'm finding it's inconsistent (breaks when results have a space), long, and hard to read.

I'm wondering if it is possible to pipe the results directly into jq. The output looks like:

*:                                         SSID:                                   VIDEOTRON2255  MODE:                                   Infra  CHAN:                                   11  RATE:                                   54 Mbit/s  SIGNAL:                                 69  BARS:                                   ▂▄▆_  SECURITY:                               WPA1 WPA2  *:                                      *   SSID:                                   VIDEOTRON2947  MODE:                                   Infra  CHAN:                                   6  RATE:                                   54 Mbit/s  SIGNAL:                                 49  BARS:                                   ▂▄__  SECURITY:                               WPA1 WPA2  

I'm looking to generate something like this:

[{      "network": "VIDEOTRON2255",      "mode": "Infra",      "chan": "11",      "rate": "54 Mbit/s",      "signal": "69",      "bars": "▂▄▆_",      "security": "WPA1 WPA2"  },  {      "network": "VIDEOTRON2947",      "mode": "Infra",      "chan": "6",      "rate": "54 Mbit/s",      "signal": "49",      "bars": "▂▄__",      "security": "WPA1 WPA2"  }]  

Yes, I did ask a related question earlier. This is the first script I wrote based on Gilles answer, it worked for some of the values but not security or rate which have spaces.

Upload to youtube using shell script

Posted: 11 Jul 2021 07:07 AM PDT

I've searched the youtube API but still not clear whether this is possible.
I have a shell script that uses FFMPEG to convert a video. After being converted I want to have the video automatically uploaded to a preauthorized youtube account. Can any shell script gurus tell me if this is possible?

Redirect stdout of a Windows command line program under wine

Posted: 11 Jul 2021 10:40 AM PDT

I run a Windows command line program (that I can not make accessible) with wine. It apparently writes something to stdout and I'm trying to capture that output, but I can't redirect it.

No matter if I redirect stdout or stderr to a file, the program output is still printed on the console and is not written to the file. When I redirect stderr, the wine output goes away, but the program's output is stilled printed on screen.

wine program.exe > out   # File is empty, program output printed on screen  wine program.exe 2> out  # Wine output gets redirected to file, program output still printed on screen  

If I redirect both, the output is neither printed on screen nor written to the file.

Edit: On Windows, behavior is similar, but when redirecting both, everything is still printed on screen.

Here are some examples with the complete output.

$ wine program.exe  fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.  fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.    output by program.exe    fixme:msvcrt:__clean_type_info_names_internal (0x100aaa54) stub  

When I try to redirect the output, this happens:

$ wine program.exe > out 2>&1  $ cat out  fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.  fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.  fixme:msvcrt:__clean_type_info_names_internal (0x100aaa54) stub  

I.e., the program's console output is completely missing. The program still works fine and writes some files it's supposed to write. As a check, I did the same with pngcrush, and I get what I'd expect. Without redirection:

$ wine pngcrush_1_8_10_w32.exe test.png out.png  fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.  fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.     | pngcrush-1.8.10   |    Copyright (C) 1998-2002, 2006-2016 Glenn Randers-Pehrson   |    Portions Copyright (C) 2005 Greg Roelofs   | This is a free, open-source program.  Permission is irrevocably   | granted to everyone to use this version of pngcrush without   | payment of any fee.   | Executable name is pngcrush_1_8_10_w32.exe   | It was built with   bundled libpng-1.6.26   | and is running with bundled libpng-1.6.26   |    Copyright (C) 1998-2004, 2006-2016 Glenn Randers-Pehrson,   |    Copyright (C) 1996, 1997 Andreas Dilger,   |    Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,   | and bundled zlib-1.2.8.1-motley, Copyright (C) 1995 (or later),   |    Jean-loup Gailly and Mark Adler,   | and using "clock()".   | It was compiled with gcc version 4.8.0 20121015 (experimental).      Recompressing IDAT chunks in test.png to out.png     Total length of data found in critical chunks            =    431830     Critical chunk length, method   1 (ws 15 fm 0 zl 4 zs 0) =    495979     Critical chunk length, method   2 (ws 15 fm 1 zl 4 zs 0) >    495979     Critical chunk length, method   3 (ws 15 fm 5 zl 4 zs 1) =    495354     Critical chunk length, method   6 (ws 15 fm 5 zl 9 zs 0) =    457709     Critical chunk length, method   9 (ws 15 fm 5 zl 2 zs 2) >    457709     Critical chunk length, method  10 (ws 15 fm 5 zl 9 zs 1) =    451813     Best pngcrush method        =  10 (ws 15 fm 5 zl 9 zs 1) =    451813       (4.63% critical chunk increase)       (4.63% filesize increase)    CPU time decode 4.407583, encode 17.094248, other 4294967296.000000, total 17.180143 sec  

With redirection:

$ wine pngcrush_1_8_10_w32.exe test.png out.png > out 2>&1  $ cat out  fixme:winediag:start_process Wine Staging 1.9.23 is a testing version containing experimental patches.  fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.     | pngcrush-1.8.10   |    Copyright (C) 1998-2002, 2006-2016 Glenn Randers-Pehrson   |    Portions Copyright (C) 2005 Greg Roelofs   | This is a free, open-source program.  Permission is irrevocably   | granted to everyone to use this version of pngcrush without   | payment of any fee.   | Executable name is pngcrush_1_8_10_w32.exe   | It was built with   bundled libpng-1.6.26   | and is running with bundled libpng-1.6.26   |    Copyright (C) 1998-2004, 2006-2016 Glenn Randers-Pehrson,   |    Copyright (C) 1996, 1997 Andreas Dilger,   |    Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,   | and bundled zlib-1.2.8.1-motley, Copyright (C) 1995 (or later),   |    Jean-loup Gailly and Mark Adler,   | and using "clock()".   | It was compiled with gcc version 4.8.0 20121015 (experimental).      Recompressing IDAT chunks in test.png to out.png     Total length of data found in critical chunks            =    431830     Critical chunk length, method   1 (ws 15 fm 0 zl 4 zs 0) =    495979     Critical chunk length, method   2 (ws 15 fm 1 zl 4 zs 0) >    495979     Critical chunk length, method   3 (ws 15 fm 5 zl 4 zs 1) =    495354     Critical chunk length, method   6 (ws 15 fm 5 zl 9 zs 0) =    457709     Critical chunk length, method   9 (ws 15 fm 5 zl 2 zs 2) >    457709     Critical chunk length, method  10 (ws 15 fm 5 zl 9 zs 1) =    451813     Best pngcrush method        =  10 (ws 15 fm 5 zl 9 zs 1) =    451813       (4.63% critical chunk increase)       (4.63% filesize increase)    CPU time decode 4.339310, encode 17.137527, other 4.294083, total 17.182100 sec  

What could be the cause of that not working for the other program?

wine stdout stderr io-redirection

Difference between "none" and "swap" as a mountpoint for swap in fstab?

Posted: 11 Jul 2021 08:13 AM PDT

I've seen that sometimes the entry for the swapfile in fstab is specified as "none" for the mount point and sometimes as "swap" instead. For example:

/swapfile none swap defaults 0 0    /swapfile swap swap defaults 0 0  

The fsrtab man page says that "none" should be used, but Red Hat's documentation uses "swap" instead.

What is the difference between those two?

8 independants mono channel on 7.1 sound card, but possibility to play sound on 8 channels simultaneously

Posted: 11 Jul 2021 09:03 AM PDT

For a personal sound project with a raspberry PI 3 and an USB 7.1 channel sound card, I need to use the sound card as 8 independents mono channels, to play different mono sounds on specifics channel. And sometime 2 or more mono sounds car be played (mixed) in the same time on a given channel. I finally found the way to do that in my .asoundrc configuration file :

pcm_slave.usbsoundcard {  pcm "hw:1"  rate 44100  channels 8  periods 128  period_time 0  period_size 1024  buffer_time 0  buffer_size 4096  }    pcm.ch1 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 0 ]  }    pcm.ch2 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 1 ]  }    pcm.ch3 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 6 ]  }    pcm.ch4 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 7 ]  }    pcm.ch5 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 2 ]  }    pcm.ch6 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 3 ]  }    pcm.ch7 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 4 ]  }    pcm.ch8 {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 5 ]  }  

With this config file, I can play what I want on the channel I want, and I can play multiple sound in same time on each independent channel if needed with commands like this:

aplay -D plug:ch3 sound1_mono.wav &  aplay -D plug:ch3 sound2_mono.wav &  # sound 2 mixed with sound 1 on channel 3  aplay -D plug:ch7 sound3_mono.wav &  aplay -D plug:ch8 sound4_mono.wav &  

etc...

But I want to add another possibility. I want to add a virtual channel named "all", which must route the played sound on ALL 8 mono channels. The final goal is to configure Asterisk pbx system configured as intercom to use this channel : when called, Asterisk will autoanswer, and I want voice routed (mixed) on all 8 channels of the sound card.

I naively tried that :

pcm.all {  type dmix  slave usbsoundcard  ipc_key 1001  bindings [ 0 1 2 3 4 5 6 7 ]  }  

But it doesn't work. For testing I also play a mono sound on the 'all' virtual channel. If I do : aplay -D plug:all sound5_mono.wav The sound is correctly played on all channel ch1... ch8 where no other wav file is played. But on channel where a sound is already played, can't hear sound5_mono. wav but I have crackling noices

How can I write my. asoundrc file to have it working ? What I want to do is a kind of audio multiroom : play differents mono file on each channel ch1.... ch8 in differents room, and when I call the raspberry with a SIP phone, voice is played (mixed) in all rooms.

Is it possible to send a HEREDOC over ssh to a remote host from inside a script running locally?

Posted: 11 Jul 2021 10:26 AM PDT

I essentially want to run a script on machine A which will SSH into machine B, execute commands on B, and return the output to machine A.

So I am creating a csh script to do this, hopefully, if it's possible.

For instance, this solution from this answer works from command line:

ssh user@host << 'ENDSSH'  ls -l  ENDSSH  

I can verify it is running the ls on the remote and not locally.

However I want to be able to do this within the backticks, inside my csh script running locally. Would that be possible?

I know it is possible to SSH in and run a script that is on the remote, but that is not my case.

I have also heard it is possible to send a second script stored locally over the SSH (which I also have not figured out), but I like the idea of having all of the commands inside the original script, hence the HEREDOC.

I know it is a pretty particular question, but if there is a way, it would be very cool to know how.

Things that don't work

1)

`ssh user@host<<'ENDSSH'`  `echo "ls -l"`  `echo "ENDSSH"`  

This gives the error:

stty: standard input: Invalid argument. stty: standard input: Invalid argument. Warning: Command not found

And then it runs ls -l locally, and then it tried to run ENDSSH locally and of course fails with command not found.

2)

`ssh user@host<<'ENDSSH'`  echo "ls -l"  echo "ENDSSH"  

Same problem as above, except it only displays ls -l and ENDSSH as text. Makes sense...since the HEREDOC portion failed.

3) 3-5 aren't exactly what I asked about, but still trying just to get even the basic case working.

`ssh user@host ls-l`   

This returns total: Command not found. Yeah, I have no clue where that's coming from.

4)

`cat ./test.csh | ssh user@host`  

Also returns the same as attempt #1

5)

`cat ./test.csh | ssh -t user@host`  

Same as #1 and 4.

I am beginning to exhaust other solutions from stackoverflow/Ubuntu/serverfault...etc. Most people ask about how to run their script on a remote from command line, not how to run commands on a remote from a locally running script.

Edit

Well I think I have part of the problem figured out. With case 3 from above for example, what happens is ls -l runs locally, and the first part of the output is then sent over SSH as a command.

I noticed this because I tried ssh user@host $CMD, with $CMD set to "whoami". The output was username: Command not found, and then I realized the total is from the ls output. Still not sure about how to solve this, though

Difficult to find application installed in linux

Posted: 11 Jul 2021 10:07 AM PDT

I am new to linux, used to use windows. I am trying to convert to linux and I really love it. I am trying Ubuntu 14.10.

I have a question about how to find the installed applications easily in Linux. You know in windows, after I installed an application, I can always find it in the "all application" list. Even no, I can always try to search for its folder from the bottom.

However, I am trying two DE, Unity and Gnome 3.12, and it seems that it's more difficult to do this. For example, I've just installed Anaconda3. After installation, it does not show up in the launcher nor the "all application list". I tried to search "Anaconda" or "Spyder" but hits nothing. It looks like it's also impossible to open the file manager to show all folders in the partition on which ubuntu is installed. I can open a terminal and "cd /" and then search it? But that's text interface.

So my questions are: Are there any way to find an installed application easily. Is there something like the file manager in windows that can show all the folders in the linux partition or in the whole harddisk?

XBMC crash after selecting "play". Ubuntu 14.04 and 13.0 gotham. Link to crashlog

Posted: 11 Jul 2021 08:05 AM PDT

I have a brand new machine with fresh install of Ubuntu 14.04 and I'm trying to run Gotham 13.0 on it. I've already added the restricted multimedia codecs (just in case) to Ubuntu.

 sudo apt-get install ubuntu-restricted-extras  

As well as Unrestricted LibavCodec

sudo apt-get install libavcodec-extra  

My graphics is AMD/ATI Tahiti (Radeon HD 7970) with a core i7.

Here's the XBMC crashlog: http://xbmclogs.com/show.php?id=209365

Here's what's happening: I just download the appropriate PPA's etc. through the XBMC wiki.

sudo add-apt-repository ppa:team-xbmc    sudo apt-get update    sudo apt-get install xbmc  

The first time I installed it on this machine, I went through installed Fusion and ran the Hub wizard Template/Setup. Everythings seems good, but when I select Al Jazeera, for example, I click "watch live", and then I get the "working" scroll in the bottom right for few seconds, and then the entire program force closes. The same happens with " The Daily Show" "Youtube" "UsTv Now" etc. I completly uninstalled XBMC

sudo apt-get purge xbmc xbmc-standalone  

and started over. This time only installing one add on and trying it out. Still I get the same results. The music add-ons work though. I have this posted a few days on XBMC forums, and no replies yet. I'm not sure if this is an Ubuntu or XBMC issue ,at this point. enter image description here

No comments:

Post a Comment