Thursday, July 22, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Vagrant: Generate Ansible inventory without running a playbook?

Posted: 22 Jul 2021 10:41 AM PDT

I'm using Vagrant to set up a small group of virtual machines. Because of limitations in the way vagrant handles Ansible provisioning, I'd like to run my playbooks by hand after vagrant up is complete...but I still want vagrant to generate an Ansible inventory for the cluster.

I tried setting up a config.vm.provision section without specifying an ansible playbook, like this:

Vagrant.configure("2") do |config|        [...]      config.vm.provision :ansible do |ansible|      ansible.compatibility_mode = "2.0"      ansible.groups = {        "ceph_servers" => Array.new(num_ceph) { |machine_id| "ceph#{machine_id+1}" },        "nfs_servers" => Array.new(num_nfs) { |machine_id| "nfs#{machine_id+1}" },        "clients" => Array.new(num_clients) { |machine_id| "client#{machine_id+1}" },      }    end  end  

But that fails with:

There are errors in the configuration of this machine. Please fix  the following errors and try again:    ansible remote provisioner:  * `playbook` file path must be set.  

Is there any way to instruct the provisioner to generate the inventory without running a playbook? Or is the only solution to create a minimal playbook to keep the provisioner happy?

php exec/shell_exec behavior CLI vs CGI

Posted: 22 Jul 2021 10:31 AM PDT

I am trying to use php to run some system commands and am getting a behaviour that I don't fully understand. If the php script is run from the command line I get the results I expect. But running it through apache yields mixed results.

For example, I have this simple little php script:

<?php  $res = shell_exec("ps -ef");  echo $res;  ?>  

If I run it from the command line I get the full list of processes as I would expect to see if I had run "ps -ef" directly. However if I run the script through apache, I get a smaller set of processes, most of which are apache-owned, although there are also a few root-owned processes and one that is owned by my regular user. Trying to use other commands gets similar behavior; it works when I run it in CLI mode (e.g. "php test.php"), but not when I pull up the php script in apache. It also doesn't seem to matter which user is running it in CLI mode (I've tested it with root and with my personal user account). It seems like some sort of permissions issue, although it's seemingly not an executable issue since in the example of "ps -ef" I get results in both cases.

I am running on CentOS 8, using apache 2.4.37 and php 8.0.8.

What am I missing?

Thanks,

Gavin

Why do I get umask 022 as default in my main user instead of the 0002 one?

Posted: 22 Jul 2021 10:22 AM PDT

I'm using Fedora 34 (Workstation Edition) —although I've seen this same behaviour on a Debian Buster machine, and I'm trying to understand why the users that I am creating are getting the umask 0002 by default, whereas my main user gets 0022 instead.

If I do id and umask with my main user, I get the following output:

mikelalejobr@fedora:~$ id  uid=1000(mikelalejobr) gid=1000(mikelalejobr) groups=1000(mikelalejobr),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023  mikelalejobr@fedora:~$ umask  0022  

Now, I create a new user and I change its password:

mikelalejobr@fedora:~$ sudo useradd myNewUserUmask  mikelalejobr@fedora:~$ sudo passwd myNewUserUmask  

Finally I log in as the new user and issue an umask command:

[myNewUserUmask@fedora mikelalejobr]$ cd  [myNewUserUmask@fedora ~]$ id  uid=1003(myNewUserUmask) gid=1003(myNewUserUmask) groups=1003(myNewUserUmask) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023  [myNewUserUmask@fedora ~]$ umask  0002  

Checking /etc/bashrc, there's the following condition:

    if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then         umask 002      else         umask 022      fi  

If I run the following script in my main account, I get:

mikelalejobr@fedora:~$ if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then echo "Umask 002"; else echo "Umask 022"; fi  Umask 002  

The same that in the freshly created account:

[myNewUserUmask@fedora ~]$ if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then echo "Umask 002"; else echo "Umask 022"; fi  Umask 002  

I haven't changed any files like /etc/bashrc nor /etc/profile, and I've tried logging in as the newTestUserUmask using the GDM to check if that could be "the issue", but with no luck.

So, what am I missing here?

Thank you in advance

Install libgnome-games-support > 1.7.1 to compile gnome-mines

Posted: 22 Jul 2021 10:01 AM PDT

I'm trying to compile gnome mines. for that I am doing meson compile. This is the error I am getting

The Meson build system  Version: 0.53.2  Source dir: gnome-mines  Build dir: gnome-mines/compile  Build type: native build  Project name: gnome-mines  Project version: 40.0  C compiler for the host machine: ccache cc (gcc 9.3.0 "cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0")  C linker for the host machine: cc ld.bfd 2.34  Vala compiler for the host machine: valac (valac 0.48.6)  Host machine cpu family: x86_64  Host machine cpu: x86_64  Found pkg-config: /usr/bin/pkg-config (0.29.1)  Run-time dependency glib-2.0 found: YES 2.64.6  Run-time dependency gee-0.8 found: YES 0.20.3  Run-time dependency gtk+-3.0 found: YES 3.24.20  Run-time dependency librsvg-2.0 found: YES 2.48.9  Dependency libgnome-games-support-1 found: NO found 1.6.1 but need: '>= 1.7.1'  Found CMake: /usr/bin/cmake (3.16.3)  Run-time dependency libgnome-games-support-1 found: NO (tried cmake)    meson.build:27:0: ERROR: Invalid version of dependency, need 'libgnome-games-support-1' ['>= 1.7.1'] found '1.6.1'.    A full log can be found at /home/carlos/gitrepos/github/gnome/gnome-mines/compile/meson-logs/meson-log.txt    

I tried doing without success

apt install libgnome-games-support-1-dev    apt-cache madison libgnome-games-support-1-dev  libgnome-games-support-1-dev |    1.6.1-1 |  ...    

How can I install libgnome-games-support > 1.7.1 ?

How to connect a Picocluster running Ubuntu 18.04 to the internet?

Posted: 22 Jul 2021 09:55 AM PDT

I have a Picocluster 5H (5 Jetson Nano)

The nodes are connected up and pre-configured with 10.1.10.[240,241,242,243,244] addresses, they can talk to each other

But the cluster is not connected to the internet (I want to do git pull, docker pull etc)

I connected a USB wireless dongle to one of the node. With that, the jetson nano (10.1.10.241) has been added/issued the IP 192.168.0.25

I am able to ssh/sftp from the Jetson with the USB wireless dongle to my main development box 192.168.0.24

However, I cannot ping/connect to the internet (even with IP address of the external host)

I believe I need to setup at least the following

  1. DNS
  2. Route table so that any non 10.* should be routed through some gateway IP

I have tried reading some of the suggestion on Stack Exchange but not being a network engineering, I get lost in the technical description.

The following is the ifconfig and route -n dump from the Jetson Nano computer. It is running Ubuntu 18.04

I hope the following information clarify my question

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 10.1.10.241  netmask 255.255.255.0  broadcast 10.1.10.255          inet6 fe80::4ab0:2dff:fe3d:1cff  prefixlen 64  scopeid 0x20<link>          ether 48:b0:2d:3d:1c:ff  txqueuelen 1000  (Ethernet)          RX packets 1862  bytes 117711 (117.7 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 568  bytes 29787 (29.7 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0          device interrupt 151  base 0x5000      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 1  (Local Loopback)          RX packets 1591  bytes 139099 (139.0 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 1591  bytes 139099 (139.0 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    rndis0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          ether f2:20:d0:21:db:4d  txqueuelen 1000  (Ethernet)          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    usb0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          ether f2:20:d0:21:db:4f  txqueuelen 1000  (Ethernet)          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    wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 192.168.0.25  netmask 255.255.255.0  broadcast 192.168.0.255          inet6 fe80::af66:4610:a74b:5387  prefixlen 64  scopeid 0x20<link>          ether 50:2b:73:e9:8d:e2  txqueuelen 1000  (Ethernet)          RX packets 2802  bytes 193082 (193.0 KB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 122  bytes 13496 (13.4 KB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  
Kernel IP routing table  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  0.0.0.0         10.1.10.1       0.0.0.0         UG    0      0        0 eth0  0.0.0.0         192.168.0.1     0.0.0.0         UG    20600  0        0 wlan0  10.1.10.0       0.0.0.0         255.255.255.0   U     0      0        0 eth0  169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0  192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan0  

Disabling core-dumps, when filesystem is almost full

Posted: 22 Jul 2021 09:47 AM PDT

We make good use of the core-dumps and don't want to disable them completely. At the same time, we don't want them to fill up the filesystem.

Can Linux be told to disable them automatically, when the filesystem, to which they would've been dumped, is above the specified threshold -- like 90%?

How to fix vim color scheme in other terminals?

Posted: 22 Jul 2021 09:43 AM PDT

The problem I'm dealing with right now is I don't like gnome-terminal. I've tried alacritty, konsole, st (currently in use), and they're all having the same issue – they break my vim color scheme. Here's what I mean by that: example In this screenshot, gnome-terminal is on the left, and st is on the right.

I'm using the same color profile in both terminal emulators, and I don't have .vimrc since I rarely use vim locally. Somehow gnome-terminal manages to maintain the right colors, although in both terminals vim color scheme in use is the default one.

I've tried searching for ways to solve this, the only thing that I found is to specify the $TERM variable to be xterm-256color, but it didn't help. Another thing that I've noticed is when I force gnome-terminal's vim to use the default color scheme with :colorscheme default, colors are the same as in st's vim.

Recently figured out that the closest to gnome-terminal's default color scheme is ron.

I'm actually lost and have no idea what to do with this. There's no point in editing .vimrc because I ssh a lot and it won't have any effect. It doesn't sound like a big problem, but these colors are quite distracting. Any help will be appreciated, thanks to everyone who has read this.

Some command outputs:

-- gnome-terminal:

:colorscheme  default    echo $TERM  xterm-256color  

-- st:

:colorscheme  default    echo $TERM  xterm-256color  

terminal is not terminating after executing the command

Posted: 22 Jul 2021 09:58 AM PDT

I'm trying to run the following command in a shell script

#!/bin/bash    yes | sudo $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses  

but the terminal is stuck in the following part below, however, it seems accept the license but the terminal didn't terminal so I can proceed with the other commands, any idea how I can overcome this issue knowing that, I can not intervene manually since this command is running in yml file in GitHub actions

 10.8 Open Source Software. In the event Open Source software is included with Evaluation Software, such Open Source software is licensed pursuant to the applicable Open Source software license agreement identified in the Open Source software comments in the applicable source code file(s) and/or file header as indicated in the Evaluation Software. Additional detail may be available (where applicable) in the accompanying on-line documentation. With respect to the Open Source software, nothing in this Agreement limits any rights under, or grants rights that supersede, the terms of any applicable Open Source software license agreement.  ---------------------------------------  Accept? (y/N): All SDK package licenses accepted  

No space left on device, space and inodes available on NTFS drive

Posted: 22 Jul 2021 09:40 AM PDT

When I try to make new directories (with mkdir) or files (even empty ones with touch) on an external NTFS hard drive that I use for personal backups, filesystem operations fail with No space left on device.

Here is what df has to say about space and inode usage of the drive:

$ df -it fuseblk  Filesystem        Inodes   IUsed     IFree IUse% Mounted on  /dev/sda1      156579976 3240128 153339848    3% /mnt/hd  $ df -ht fuseblk  Filesystem      Size  Used Avail Use% Mounted on  /dev/sda1       932G  786G  147G  85% /mnt/hd  

There appears to be still lots of space left. Since even making directories was a problem, at first I thought this was an inodes issue, but only 3% of the quota has been filled.

What else could be causing this problem?

installing manjaro on usb with rufus

Posted: 22 Jul 2021 09:31 AM PDT

i just tried to dual boot manjaro with windows 10. I downloaded 'manjaro-kde-21.0.7-210614-linux510' from manjaro website and tried to install it on USB via rufus with these settings:

Partition scheme --> MBR  Target system --> BIOS or UEFI  File System --> FAT32  cluster size --> 4096 bytes  

but I get:

Error: write error.  

I tried installing ubuntu 21.04 LTS with the same settings, it worked fine. It is worth mentioning that I tried installing another edition of manjaro(xfce), and again I got write error.

I would appreciate any help on this. thanks a lot.

Python - how to make decision based on a failed command (netmiko and try-except-else)

Posted: 22 Jul 2021 09:27 AM PDT

I am trying to create a test program which will log to Cisco ASA firewalls and collect some data. I run into a challenge. Some firewalls are single context some are multi-context, but connection is made on admin IP address to all of them. Once connected there is a command "changeto system" which will only be successful on multi-context firewalls. I was thinking to use try-except-else ....

    conn = ConnectHandler(device_type= "cisco_asa", ip=host[1],  username=u[host[3]], password=p[host[3]], secret=p[host[3]])      print(conn.find_prompt())      try:          output4 = conn.send_command(cmd_system)      except:          # not a multi-context firewall          for cmd in cmd_list_asa:                  CONTEXT_OUTPUT = open(chgnr + '__' + host[0] + '_' + d[cmd]+ '_' + testtype , "a")                  info = ("running .... " + host[0] + "......." + cmd)                  runcommand(info, cmd, CONTEXT_OUTPUT)                  CONTEXT_OUTPUT.close()      else:          #multi-context firewall          #collect SYSTEM context data          for cmd in cmd_list_asa:                  CONTEXT_OUTPUT = open(chgnr + '__' + host[0] + '_system_' + d[cmd]+ '_' + testtype , "a")                  info = ("running .... " + host[0] + "_system......." + cmd)                  runcommand(info, cmd, CONTEXT_OUTPUT)                  CONTEXT_OUTPUT.close()          #create context list and collect data          output3 = conn.send_command(cmd_contextlist)          list = re.findall("\"(.*?)\"",output3)          for fw in list:              cmd_change = ("changeto context " + fw)              output = conn.send_command(cmd_change)              for cmd in cmd_list_asa:                  CONTEXT_OUTPUT = open(chgnr + '__' + host[0] + '_' + fw + '__' + d[cmd]+ '_' + testtype , "a")                  info = ("running .... " + host[0] + "_" + fw + "......." + cmd)                  runcommand(info, cmd, CONTEXT_OUTPUT)                  CONTEXT_OUTPUT.close()  

the CONTEXT_OUTPUT is just a fancy way of dynamically generating filename. testype to differentiate between multiple runs and finally all what runcommand does it sends the command...conn.send_command(cmd).

As per my expectation if output4 command fails the except section should be executed if is successful should jump to the else section, but apparently even those firewalls which are not multicontext will run through the else section and skip except.

options with optional values using getopt

Posted: 22 Jul 2021 09:20 AM PDT

I have the following function and would like to look into how options with optional values can be set up using getopt.

Would like to have -w taking on default values

region -w -- "Text"  

And -w 1 that takes the optional numeric value.

region -w 1 -- "Text"  

The function is here

region ()  {    # Process command line options    shortopts="hw::"    longopts="help,version,warning:"      opts=$(getopt -o "$shortopts" -l "$longopts"  \              -n "$(basename $0)" -- "$@")    if [ $? -eq 0 ]; then      eval "set -- ${opts}"      while [ $# -gt 0 ]; do        case "$1" in        -h|-\?|--help)          printf "%s\n" "Todo."          shift          break          ;;        -w|--warning)          case "$2" in            "1") local -r warn="first";  shift 2  ;;              *) local -r warn="all";    shift 2  ;;           esac           local -r f=1           ;;        --)           local -r f=1           shift           break           ;;        esac      done    else      shorthelp=1 # getopt returned (and reported) an error.    fi        }  

How do I fix ndb-client error: can't read superblock on /dev/nbd2? (When mounting /dev/nbdX)

Posted: 22 Jul 2021 09:19 AM PDT

I'm trying setup a client that connect to a 500Gb ext4 disk on another machine running nbd server.

Server: raspberry pi 3: uname -r 4.19.66+  Client: raspberry pi 3: uname -r 5.10.17-v7+  

I've followed the information here [https://github.com/NetworkBlockDevice/nbd] and a lot of other sites - when I enter:

> sudo mount /dev/nbd2 /home/pi/Vols/nbd1-recipes/  mount: /home/pi/Vols/nbd1-recipes: can't read superblock on /dev/nbd2  

I notice ndb-server appears to be serving on default port - NOT ones specified in config file. (see last command port list)

This is how I've set up the server & client, it's probably something obvious to more experienced folk.

== rpi-C3 (192.168.1.14) server setup

> sudo apt-get update  > sudo apt-get install nbd-server  > sudo nano /etc/nbd-server/config   [generic]  # If you want to run everything as root rather than the nbd user, you  # may either say "root" in the two following lines, or remove them  # altogether. Do not remove the [generic] section, however.          user = nbd          group = nbd          includedir = /etc/nbd-server/conf.d          allowlist = true    # What follows are export definitions. You may create as much of them as  # you want, but the section header has to be unique.  [images]          exportname = /home/pi/media/500G_FAITH/images          port = 510029  [recipes]          exportname = /home/pi/media/500G_FAITH/recipes          port = 510030  [movie]          exportname = /home/pi/media/500G_FAITH/movies          port = 510031    > sudo modprobe nbd         # NOT nbd-server!  > lsmod | grep nbd  nbd                    40960  0    > sudo service nbd-server force-reload  # if already running  

== client side

> sudo apt-get install nbd-client     > sudo modprobe nbd  > nbd-client 192.168.1.14 -l  Negotiation: ..  images  recipes  movie    > sudo nbd-client 192.168.1.14 -N recipes /dev/nbd2  Negotiation: ..size = 0MB  Connected /dev/nbd2    > sudo nbd-client 192.168.1.14 -N movie /dev/nbd3  Negotiation: ..size = 0MB  Connected /dev/nbd3    > sudo nbd-client 192.168.1.14 -N images /dev/nbd1  Negotiation: ..size = 0MB  Connected /dev/nbd1    > dmesg | tail -n 10  [ 1417.883364] Buffer I/O error on dev nbd1, logical block 0, async page read  [ 1417.884614] block nbd1: Other side returned error (22)  [ 1417.884652] blk_update_request: I/O error, dev nbd1, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0  [ 1417.884673] Buffer I/O error on dev nbd1, logical block 0, async page read  [ 1417.885977] block nbd1: Other side returned error (22)  [ 1417.886016] blk_update_request: I/O error, dev nbd1, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0  [ 1417.886036] Buffer I/O error on dev nbd1, logical block 0, async page read  [ 1417.887276] block nbd1: Other side returned error (22)  [ 1417.888492] block nbd1: Other side returned error (22)  [ 1417.889751] block nbd1: Other side returned error (22)    > sudo nbd-client 192.168.1.14 -d /dev/nbd1 # thought it might be to do w/ nbd1  > sudo nbd-client 192.168.1.14 -N images /dev/nbd4  Negotiation: ..size = 0MB  Connected /dev/nbd4    > dmesg | tail -n 10  [ 1848.831897] block nbd4: Other side returned error (22)  [ 1848.833341] block nbd4: Other side returned error (22)  [ 1848.834651] block nbd4: Other side returned error (22)  [ 1848.836002] block nbd4: Other side returned error (22)    > lsblk -f  NAME        FSTYPE  LABEL         UUID                                 FSAVAIL FSUSE% MOUNTPOINT  sda                                                                                     ├─sda1      vfat    EFI           67E3-17ED                                             └─sda2      hfsplus time_box_2018 xxxxxxxx-363b-3284-88c4-03ce3493aeff  115.5G    94% /media/pi/time_box_2018  nbd2                                                                                    nbd3                                                                                    nbd4                                                                                    mmcblk0                                                                                 ├─mmcblk0p1 vfat    boot          5DE4-665C                             203.4M    19% /boot  └─mmcblk0p2 ext4    rootfs        xxxxxxxx-bbc2-4267-9fa0-099e10ef5bf0    4.1G    37% /    > dmesg | tail -n 10  [ 1848.836002] block nbd4: Other side returned error (22)  [ 1848.837430] block nbd4: Other side returned error (22)  [ 1848.838860] block nbd4: Other side returned error (22)  [ 1848.840224] block nbd4: Other side returned error (22)  [ 1848.841691] block nbd4: Other side returned error (22)  [ 1848.843077] block nbd4: Other side returned error (22)  [ 1848.844415] block nbd4: Other side returned error (22)  [ 2802.615037] block nbd3: Receive control failed (result -32)  [ 2802.625871] block nbd2: Receive control failed (result -32)  [ 2802.648444] block nbd4: Receive control failed (result -32)    > ls /home/pi/Vols/  nbd1-recipes/    rpi-C2-nbd-500G/ tbx2018/         time_box_2018/       > sudo mount /dev/nbd2 /home/pi/Vols/nbd1-recipes/  mount: /home/pi/Vols/nbd1-recipes: can't read superblock on /dev/nbd2.    > sudo parted -l  Model: Seagate BUP Slim SL (scsi)  Disk /dev/sda: 2000GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End     Size    File system  Name                  Flags   1      20.5kB  210MB   210MB   fat32        EFI System Partition  boot, esp   2      210MB   2000GB  2000GB  hfs+         time_box_2018      Error: /dev/nbd3: unrecognised disk label  Model: Unknown (unknown)                                                    Disk /dev/nbd3: 4096B  Sector size (logical/physical): 512B/512B  Partition Table: unknown  Disk Flags:     Error: /dev/nbd4: unrecognised disk label  Model: Unknown (unknown)                                                    Disk /dev/nbd4: 4096B  Sector size (logical/physical): 512B/512B  Partition Table: unknown  Disk Flags:     Error: /dev/nbd2: unrecognised disk label  Model: Unknown (unknown)                                                    Disk /dev/nbd2: 4096B  Sector size (logical/physical): 512B/512B  Partition Table: unknown  Disk Flags:     Model: SD SL08G (sd/mmc)  Disk /dev/mmcblk0: 7948MB  Sector size (logical/physical): 512B/512B  Partition Table: msdos  Disk Flags:     Number  Start   End     Size    Type     File system  Flags   1      4194kB  273MB   268MB   primary  fat32        lba   2      273MB   7948MB  7676MB  primary  ext4  

I've been trying to get them to talk for 2 days now!

One thing I did notice is that the port numbers in the config file don't seem to change the fact it's listening on he default port (10809)??

> sudo lsof -i -P -n | grep LISTEN  COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME  cnid_meta  312    root    3u  IPv6  11170      0t0  TCP [::1]:4700 (LISTEN)  afpd       324    root    3u  IPv4  11195      0t0  TCP *:548 (LISTEN)  sshd       426    root    3u  IPv4  12126      0t0  TCP *:22 (LISTEN)  sshd       426    root    4u  IPv6  12128      0t0  TCP *:22 (LISTEN)  dnsmasq    431 dnsmasq    5u  IPv4  12046      0t0  TCP *:53 (LISTEN)  dnsmasq    431 dnsmasq    7u  IPv6  12048      0t0  TCP *:53 (LISTEN)  nbd-serve 2026     nbd    3u  IPv6  20100      0t0  TCP *:10809 (LISTEN)  

I'd be very grateful for any pointers, or other resources that my be of help. Thanks in advance,

External command failed to finish. Command /usr/sbin/bootloader-config failed to finish in 600 seconds. There was no output from the command

Posted: 22 Jul 2021 09:16 AM PDT

I keep on getting this error when i install parrot os in virtual box

Delete spaces at the end of folder names

Posted: 22 Jul 2021 09:39 AM PDT

I had a NAS and I connected to it with the "afp" protocol. Now I connect to it with the "smb" protocol.

My problem is that I had folders with "spaces" at the end of the name (example = "Music" ) and since I use the SMB protocol, all my folders with spaces at the end of the name are not displayed anymore. On my computer (Mac) I can see all my folders except those.

My fear is that in my Music folder, there are potentially other folders with spaces at the end of the name. I don't know if this is feasible but would you have an idea of a script in bash that could help me solve this problem?

I tried:

 python3 -c 'import pathlib   for p in iter(pathlib.Path(".").rglob("*[ \t]")):    p.rename("/".join([str(p.parent),p.name.rstrip()]))'  

And

LC_ALL=C find . -depth -name '*[[:space:]]' -exec sh -x -c '    for f do      : mv -i "$f" "${f%"${f##*[![:space:]]}"}"    done' sh {} +  

No Changes.

How can i install linux os on my new windows laptop

Posted: 22 Jul 2021 09:10 AM PDT

I am so eager to start using linux on my new windows laptop. But I know no where to start.

Can picom be as fast as mutter?

Posted: 22 Jul 2021 08:19 AM PDT

I recently migrated from Windows to Linux Mint. I was very happy with the performance and then I decided to install bspwm. I installed picom as the compositor, but it was significantly lagger while scrolling than when I was inside Cinnamon. (In zathura reader as well as the terminal, I noticed significant lag). I searched about the compositor that gnome uses and found it was mutter. Without giving much thought, I replaced picom with mutter in the startup file. The performance was back, but no transparency or anything. I want to use picom as it has a nice configuration file, but no matter what changes I do to the config file, performance is still slower. It's not like bspwm is unusable, I was just thinking if it could be made more smoother. Any help would be appreciated. I'm sorry if this is a noob question.

Locking Gnome3 from pydbus doesn't return

Posted: 22 Jul 2021 08:04 AM PDT

Trying to lock the screen from python3 script, it works, but the script doesn't exit.

What should I change?

pydbus.SessionBus().get("org.gnome.ScreenSaver","/org/gnome/ScreenSaver").Lock()

Cifs share on Windows host disconnects, but can still be reached using smblient

Posted: 22 Jul 2021 08:18 AM PDT

My small home network includes a Wandboard running Arch Linux ARM which acts as a mini-NAS and a Windows 7 desktop. The Linux box mounts a cifs share hosted on the Windows 7 machine at boot. But after a certain amount of time the connection to the share is lost. I can cd to the mount point directory, but when I run ls I get the message: cannot open directory '.': Host is down. If I unmount the mount directory and try to remount the share, I get a mount error(2): No such file or directory error. (The mount line in fstab is: //192.xxx.x.xx/Work /mnt/Work cifs guest,users,credentials=/home/alarm/.smbcredentials,iocharset=utf8,vers=2.1 0 0)

However, I can connect to the share using smbclient. And if I reboot the Wandboard the share again mounts with no problem. But after a time it becomes inaccessible again.

I've tried several different things on the Windows machine, including enabling and disabling SMB v1 and trying all the possible settings for the NIC (Intel with the latest driver) and for Windows share permissions. But the problem must involve Linux, since the share remains available via smbclient and mounts with no problem when I reboot. I've updated samba and cifs-utils and tried enabling and disabling winbind. I'm not sure what else to try.

I've looked in the samba logs with log level 4 enabled, but I can't find anything obvious. I've tried to track accesses to the share in Windows by enabling auditing on it, but I don't see anything obvious there. (Full disclosure: I'm not an IT pro but a user who has spent a certain amount of time learning Linux)

Any help would be appreciated. I can provide any information anyone might need.

TIA Les

 - Arch Linux ARM version 5.7.2-1-ARCH   - samba v 4.12.3    - cifs-utils v 2.26   - mount.cifs v 6.10  

How to remove unknown characters from a folder name?

Posted: 22 Jul 2021 08:24 AM PDT

I have a Debian 10 machine which is used as a Share server (Samba Server). I go on my Mac, I create a folder Document.1 in the shared folder. When I go to my Linux Debian machine, I find myself with an unknown character (square with question marks) in place of the .. I want to use a script to remove these characters. I could do it by hand but I have a very large tree.

I don't know if I was clear enough, don't hesitate if you need more information.

Update : I also do it with spaces at the end of folder names (for example = Document1 )

I thank you in advance if you have a little idea of BASH script. Have a nice day.

root@debian:/home/ekip/Documents# ls -lb      total 20      drwxr-xr-x  3 ekip ekip 4096 juil. 21 09:33 deuxpoints      drwxr-xr-x 10 ekip ekip 4096 juil. 21 16:12 espace      drwxr-xr-x  2 ekip ekip 4096 juil. 22 16:47 script      drwxrwxrwx  2 ekip ekip 4096 juil. 22 15:14 TEST      -rw-r--r--  1 root  root    20 juil. 22 17:00 unicode.sh      root@debian:/home/ekip/Documents#  

Multithreading Prgram in C++

Posted: 22 Jul 2021 08:45 AM PDT

I am running the following multi-threaded C++ program:

#include <bits/stdc++.h>  #include <algorithm>  #include <ctime>  #include <ratio>  #include <chrono>  #include <thread>  using namespace std;    using ll = long long int;    ll oddsum,evensum;    void countodd(ll start, ll last){      cout<<"odd thread "<<this_thread::get_id()<<endl;      oddsum=0;      if(start&1)      {        }      else{          start++;      }      for(ll i=start;i <=last;i+=2)      {          oddsum+=i;      }  }    void counteven(ll start, ll last){      cout<<"even thread "<<this_thread::get_id()<<endl;      evensum=0;      if(start&1)      {          start++;      }      else{      }      for(ll i=start;i <=last;i+=2)      {          evensum+=i;      }  }    int main()  {      ll start = 1;      ll last = 10000000000LL;      cout<<"main thread "<<this_thread::get_id()<<endl;      auto startTime = chrono::high_resolution_clock::now();        thread t1(countodd, start, last);      thread t2(counteven, start, last);      t1.join();      t2.join();      // countodd(start, last);      // counteven(start, last);      auto endTime = chrono::high_resolution_clock::now();        auto time_span = chrono::duration_cast<chrono::duration<double>>(endTime-startTime);      cout<<time_span.count()<<endl;      cout<<oddsum<<" "<<evensum<<endl;      return 0;  }  

When I run this program in multi-threaded mode, the top command shows a.out to be using 200% CPU. When it is run in normal mode, it shows 100% CPU usage. But the run time of both the programs are the same.

Should the top command show two process for each thread?

UPDATE: So i compiled the program using -O2 flag(G++) and now i can see significant diffrence between my serial program and multithreaded program. whats the reason for this?

combining the two awk file

Posted: 22 Jul 2021 08:12 AM PDT

I am trying to detact the selfish node based on the ncr and energy equation.. I have already detacted the selfish node, but based on ncr and energy separately.. and I had a problem combining the two conditions (if the node's ncr is less than 30 and its energy is less than the threshold, it is classified as a node selfish)

This is the awk code for detecting the selfish node based on energy..

BEGIN {                    n=38           SelfishCounter=0;     Normalcounter=0;  }  {      # Trace line format: energy          event = $1          time = $2          if (event == "r" || event == "d" || event == "s"|| event == "f") {          node_id = $3          energy=$14          }          if (event=="N"){          node_id = $5          energy=$7          }      # Store remaining energy      finalenergy[node_id]=energy  }  END {      # finalenergy for each node            for (i in finalenergy) {         finalenergy[i]          totalenergy = 0          for (i = 0; i <= n; i = i + 1)            totalenergy += finalenergy[i]      }      ###compute average energy        threshold=totalenergy/n      ####output            for (i=0; i<n; i++) {               if(threshold >finalenergy[i]){      SelfishCounter++;       }  else if(threshold <finalenergy[i]){        Normalcounter++;  }          }  printf "number of selfish nodes:%d \n", SelfishCounter;          printf "number of normal nodes:%d \n", Normalcounter;                 }  

This is the awk code for detecting the selfish node based on NCR..I used the sh file with it

BEGIN {       ReqCounter=0;      RepCounter=0;      NCRCounter=0;      Normalcounter=0;      max_node = 0;  }         {action=$1;      if(action == "s" || action == "r" || action == "f")   {    if(($33 == "REQUEST") && ($5==node))      ReqCounter++;  if(($33 == "REPLY") && ($5==node))      RepCounter++;     }   }  END {       NCR= ((ReqCounter-(ReqCounter-RepCounter))/ReqCounter)*100;              if(NCR <= "30"){      NCRCounter++;       printf "SELFISH\n"; }  else{    Normalcounter++;    printf "NORMAL\n";}             # printf "The Node number is:%d \n", node;     # printf "The NCRis:%d \n", NCR;      #printf "REQUEST Count:%d \n", ReqCounter;      #printf "REPLY Count:%d \n", RepCounter;                    }  
  #!/bin/sh  i=0  SelfishNodes=0  NormalNodes=0  while [ $i -lt 38 ]  do  value=$(awk -v node=$i -f NCR.awk DSR.tr)  echo "Node" $i "is" $value  i=`expr $i + 1`   if [ "$value" = "SELFISH" ]      then      SelfishNodes=` expr $SelfishNodes + 1`   else      NormalNodes=`expr $NormalNodes + 1`   fi     done  echo "Total Number of Sefiish Nodes are:" $SelfishNodes  echo "Totl Number of Normal Nodes are:"$NormalNodes  

When I mix the two awk files shown above together

BEGIN {               n=38     SelfishCounter=0;     Normalcounter=0;     ReqCounter=0;     RepCounter=0;    }  {      # Trace line format: energy          event = $1          time = $2          if (event == "r" || event == "d" || event == "s"|| event == "f") {          node_id = $3          energy=$14         if(($33 == "REQUEST") && ($5 == node))          ReqCounter++;          if(($33 == "REPLY") && ($5 == node))      RepCounter++;            }           if (event=="N"){          node_id = $5          energy=$7          }                        # Store remaining energy      finalenergy[node_id]=energy  }  END {     NCR= ((ReqCounter-(ReqCounter-RepCounter))/ReqCounter)*100;         # finalenergy for each node            for (i in finalenergy) {         finalenergy[i]          totalenergy = 0          for (i = 0; i <= n; i = i + 1)            totalenergy += finalenergy[i]      }      ###compute average energy        threshold=totalenergy/n      ####output              if((threshold >finalenergy[i]) || (NCR <= 30)){      SelfishCounter++;       printf "SELFISH\n"; }  else{    Normalcounter++;    printf "NORMAL\n";}        }          }                 }  
#!/bin/sh  i=0  SelfishNodes=0  NormalNodes=0  while [ $i -lt 38 ]  do  value=$(awk -v node=$i -f energy-ncr.awk DSR.tr)  echo "Node" $i "is" $value  i=`expr $i + 1`   if [ "$value" = "SELFISH" ]      then      SelfishNodes=` expr $SelfishNodes + 1`   else      NormalNodes=`expr $NormalNodes + 1`   fi     done  echo "Total Number of Sefiish Nodes are:" $SelfishNodes  echo "Totl Number of Normal Nodes are:"$NormalNodes    

the following error appears

Node 33 is  awk: energy-ncr.awk:59:         }  awk: energy-ncr.awk:59:         ^ syntax error  awk: energy-ncr.awk:62: }  awk: energy-ncr.awk:62: ^ syntax error  Node 34 is  awk: energy-ncr.awk:59:         }  awk: energy-ncr.awk:59:         ^ syntax error  awk: energy-ncr.awk:62: }  awk: energy-ncr.awk:62: ^ syntax error  Node 35 is  awk: energy-ncr.awk:59:         }  awk: energy-ncr.awk:59:         ^ syntax error  awk: energy-ncr.awk:62: }  awk: energy-ncr.awk:62: ^ syntax error  Node 36 is  awk: energy-ncr.awk:59:         }  awk: energy-ncr.awk:59:         ^ syntax error  awk: energy-ncr.awk:62: }  awk: energy-ncr.awk:62: ^ syntax error  Node 37 is  Total Number of Sefiish Nodes are: 0  Totl Number of Normal Nodes are:38  

EDIT by Ed Morton: here are the OPs 2 first awk scripts formatted by gawk -o- so they have indentation, etc. that make the code much easier to understand:

Script 1:

BEGIN {          n = 38          SelfishCounter = 0          Normalcounter = 0  }    {          # Trace line format: energy          event = $1          time = $2          if (event == "r" || event == "d" || event == "s" || event == "f") {                  node_id = $3                  energy = $14          }          if (event == "N") {                  node_id = $5                  energy = $7          }          # Store remaining energy          finalenergy[node_id] = energy  }    END {          # finalenergy for each node          for (i in finalenergy) {                  finalenergy[i]                  totalenergy = 0                  for (i = 0; i <= n; i = i + 1) {                          totalenergy += finalenergy[i]                  }          }          ###compute average energy          threshold = totalenergy / n          ####output          for (i = 0; i < n; i++) {                  if (threshold > finalenergy[i]) {                          SelfishCounter++                  } else if (threshold < finalenergy[i]) {                          Normalcounter++                  }          }          printf "number of selfish nodes:%d \n", SelfishCounter          printf "number of normal nodes:%d \n", Normalcounter  }  

Script 2:

BEGIN {          ReqCounter = 0          RepCounter = 0          NCRCounter = 0          Normalcounter = 0          max_node = 0  }    {          action = $1          if (action == "s" || action == "r" || action == "f") {                  if (($33 == "REQUEST") && ($5 == node)) {                          ReqCounter++                  }                  if (($33 == "REPLY") && ($5 == node)) {                          RepCounter++                  }          }  }    END {          NCR = ((ReqCounter - (ReqCounter - RepCounter)) / ReqCounter) * 100          if (NCR <= "30") {                  NCRCounter++                  printf "SELFISH\n"          } else {                  Normalcounter++                  printf "NORMAL\n"          }          # printf "The Node number is:%d \n", node;          # printf "The NCRis:%d \n", NCR;          #printf "REQUEST Count:%d \n", ReqCounter;          #printf "REPLY Count:%d \n", RepCounter;  }  

Convert a date from DD-MM-YYYY to YYYY-MM-DD format in bash LINUX

Posted: 22 Jul 2021 09:30 AM PDT

Scenario:

I am fetching a date value from a file into a variable and it is in DD-MM-YYYY format by default. I have to substract this date from system date. Subtraction is giving incorrect result if I had both dates in DD-MM-YYYY format. So I read a bit on google and decided to format both dates as YYYY-MM-DD as this will give correct value after subtraction. I have System date formatted successfully in YYYY-MM-DD, but facing a hard time to convert the date obtained from the file to YYYY-MM-DD format.

Below solution works fine with single digit dates:

$ date -d $(sed "s/-/\//g" <<< '9-2-1832') +%Y-%m-%d  Output : 1832-09-02  

but when I try to convert date in double digits like below:

$ date -d $(sed "s/-/\//g" <<< '19-07-2021') +%Y-%m-%d  

I get output

Invalid date '19/07/2021'  

Where:

19 - is Date of a month  07 - is Month i.e. July in this case.  2021 - is Year  

Desired output as -> 2021-07-19

I am working on RH Linux with Date version as: date (GNU coreutils) 8.22

Please help to provide a solution for above problem.

No Wi-Fi Adapter Found Error On Pop-OS

Posted: 22 Jul 2021 09:25 AM PDT

So, I installed Pop-OS on my HP laptop, but when I went to connect the internet all I can do is enable Airplane Mode, and below that it says "No Wi-Fi Adapter Found" "Make sure you have a Wi-Fi adapter plugged and turned on." My question is, what does this mean, and how can I fix it.

Wi-Fi Adapter: 10ec:c821

uname -a: Linux pop-os 5.8.0-7642-generic #47~1614007149~20.19~82fb226-Ubuntu SMP Tue Feb 23 02:59:01 UTC x86_64 x86_64 x86_64 GNU/Linux

Laptop Model: HP Laptop 15-ef0xxx

USB device won't turn off on shutdown or suspend

Posted: 22 Jul 2021 08:56 AM PDT

I am communicating with a USB device (LED screen) serially, via ttyUSB0 (visible in /dev/ttyUSB0).

However, it will not power off on shutdown or on suspend. Only via the terminal command 'reboot' or if I close the software communicating with the device.

Does anyone know why? I've tried manipulating the settings in /sys/bus/usb/devices/usb1/power with little effect.

System: Debian 8 (Jessie)

Unvisible application content within VNC / XFCE

Posted: 22 Jul 2021 08:02 AM PDT

I do have a weird render issue of some applications that I'm running within a tigervnc session on a remote host where XFCE is started.

As you can see from the screenshot, while applications display correctly their content (e.g. file browser, visual studio code, ..), the matlab window does not show its content. I believe this is not a matlab related issue since If I run matlab through a "ssh -X" session on the same host, it is displayed properly.

It might be related, I have also seen that kind of rendering issue with matplotlib when triggering the pyplot.show(), the image is kind of transparent and we see the image to display mixed with the desktop background image.

enter image description here

If necessary, the xstartup script is

#!/bin/sh  # Start Xfce4 Desktop  [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup  [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources  vncconfig -iconic &  dbus-launch --exit-with-session xfce4-session &  

and the vncserver is ran with vncserver -SecurityTypes None -depth 32 -geometry 1680x1050 -cleanstale

Thank you very much for your help

installing Realtek 8821ce on RHEL 8

Posted: 22 Jul 2021 10:03 AM PDT

I am trying to install my wifi card driver on RHEL 8 for the 8821CE. I am temporarily using an 88XXau for a usb wifi adapter. I've been looking for a solution for a while and came across two main git repos:

https://github.com/lwfinger/rtlwifi_new/tree/rtw88

https://github.com/tomaspinho/rtl8821ce/

the rtw88 still doesn't support the 8821CE Card as far as I can tell.

I managed to install the /tomaspinho dkms module after editing the code and following the issues section to solve compilation problems related to kernel version:

https://github.com/tomaspinho/rtl8821ce/issues?q=centos

This basically involved changing some ifdef definitions to suit the old kernel that is using recent or backported code to my knowledge.

Now I am at a point where the dkms module installed correctly and I can see the module loaded in lsmod output, but the card is still not detected and I wonder what I can do from this point forward.

Thank you in advance for your help.

lsmod:

lsmod | grep 8821    8821ce               2023424  0  cfg80211              806912  2 88XXau,8821ce  

kernel:

uname -r   4.18.0-193.1.2.el8_2.x86_64  

dmesg:

dmesg | grep 8821    [    0.758821] pci_bus 0000:00: root bus resource [mem 0xfee00000-0xffffffff window]  [    3.187034] 8821ce: loading out-of-tree module taints kernel.  [    3.218784] rtl8821ce 0000:02:00.0: enabling device (0000 -> 0003)  [    3.248873] Modules linked in: crc32_pclmul(+) 8821ce(OE+) 88XXau(OE+) crc32c_intel amd_iommu_v2 gpu_sched i2c_algo_bit ttm hid_logitech_hidpp drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cfg80211 nvme drm ghash_clmulni_intel serio_raw r8169 nvme_core rfkill realtek pinctrl_amd hid_logitech_dj dm_mirror dm_region_hash dm_log dm_mod  [    3.248981]  ? rtw_chbw_to_freq_range+0x40/0x96 [8821ce]  [    3.249021]  ? rtw_is_dfs_ch+0x34/0x70 [8821ce]  [    3.249067]  ? rtw_regd_apply_flags+0xc9/0xda [8821ce]  [    3.249113]  rtw_wiphy_register+0x1e/0x20 [8821ce]  [    3.249159]  rtw_cfg80211_ndev_res_register+0x11/0x17 [8821ce]  [    3.249203]  rtw_os_ndev_register+0xf2/0x157 [8821ce]  [    3.249248]  rtw_os_ndevs_register+0x9e/0xce [8821ce]  [    3.249292]  rtw_os_ndevs_init+0x24/0x3a [8821ce]  [    3.249334]  rtw_drv_init+0x4f/0xac [8821ce]  [    3.249389]  rtw_drv_entry+0x48/0x1000 [8821ce]  [    3.249485] WARNING: CPU: 6 PID: 528 at /var/lib/dkms/rtl8821ce/v5.5.2_34066.20200325/build/os_dep/linux/os_intfs.c:1681 rtw_os_ndev_register+0x64/0x157 [8821ce]  [    3.249485] Modules linked in: crc32_pclmul(+) 8821ce(OE+) 88XXau(OE+) crc32c_intel amd_iommu_v2 gpu_sched i2c_algo_bit ttm hid_logitech_hidpp drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cfg80211 nvme drm ghash_clmulni_intel serio_raw r8169 nvme_core rfkill realtek pinctrl_amd hid_logitech_dj dm_mirror dm_region_hash dm_log dm_mod  [    3.249537] RIP: 0010:rtw_os_ndev_register+0x64/0x157 [8821ce]  [    3.249589]  rtw_os_ndevs_register+0x9e/0xce [8821ce]  [    3.249632]  rtw_os_ndevs_init+0x24/0x3a [8821ce]  [    3.249675]  rtw_drv_init+0x4f/0xac [8821ce]  [    3.249722]  rtw_drv_entry+0x48/0x1000 [8821ce]  [    3.258088] WARNING: CPU: 6 PID: 528 at /var/lib/dkms/rtl8821ce/v5.5.2_34066.20200325/build/os_dep/linux/os_intfs.c:3141 rtw_os_ndevs_register+0xa6/0xce [8821ce]  [    3.258090] Modules linked in: crct10dif_pclmul(+) crc32_pclmul 8821ce(OE+) 88XXau(OE+) crc32c_intel amd_iommu_v2 gpu_sched i2c_algo_bit ttm hid_logitech_hidpp drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cfg80211 nvme drm ghash_clmulni_intel serio_raw r8169 nvme_core rfkill realtek pinctrl_amd hid_logitech_dj dm_mirror dm_region_hash dm_log dm_mod  [    3.258154] RIP: 0010:rtw_os_ndevs_register+0xa6/0xce [8821ce]  [    3.258215]  rtw_os_ndevs_init+0x24/0x3a [8821ce]  [    3.258262]  rtw_drv_init+0x4f/0xac [8821ce]  [    3.258319]  rtw_drv_entry+0x48/0x1000 [8821ce]  [   10.280025] Bluetooth: hci0: rtl: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821  [   10.280028] Bluetooth: hci0: rtl: loading rtl_bt/rtl8821c_config.bin  [   10.283364] Bluetooth: hci0: rtl: loading rtl_bt/rtl8821c_fw.bin  [   21.489998]  dm_crypt amdgpu crct10dif_pclmul crc32_pclmul 8821ce(OE) 88XXau(OE) crc32c_intel amd_iommu_v2 gpu_sched i2c_algo_bit ttm hid_logitech_hidpp drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cfg80211 nvme drm ghash_clmulni_intel serio_raw r8169 nvme_core rfkill realtek pinctrl_amd hid_logitech_dj dm_mirror dm_region_hash dm_log dm_mod  

ifconfig(wlp4s0f3u2 is my usb wifi adapter):

ifconfig -a    eno1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          ether f8:b4:6a:b5:fb:23  txqueuelen 1000  (Ethernet)          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    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 6454  bytes 443527 (433.1 KiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 6454  bytes 443527 (433.1 KiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255          ether 52:54:00:74:aa:45  txqueuelen 1000  (Ethernet)          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    virbr0-nic: flags=4098<BROADCAST,MULTICAST>  mtu 1500          ether 52:54:00:74:aa:45  txqueuelen 1000  (Ethernet)          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    wlp4s0f3u2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 2312          inet 192.168.2.22  netmask 255.255.255.0  broadcast 192.168.2.255          inet6 fe80::e1d3:1071:71d9:6b63  prefixlen 64  scopeid 0x20<link>  .....  

I can see the card with this command, but I am not sure if it is due to the driver or not:

lshw -C network      *-network UNCLAIMED                description: Network controller         product: RTL8821CE 802.11ac PCIe Wireless Network Adapter         vendor: Realtek Semiconductor Co., Ltd.         physical id: 0         bus info: pci@0000:02:00.0         version: 00         width: 64 bits         clock: 33MHz         capabilities: cap_list         configuration: latency=0         resources: ioport:f000(size=256) memory:fe900000-fe90ffff  

Update Since I am trying different drivers, I am blacklisting them at /etc/modprob.d to make sure only one loads at a time, please let me know if this is enough

I opened an issue at rtw88(https://github.com/lwfinger/rtlwifi_new/issues/608), they confirm the firmware was missing and added that to the repo, but this created an new issue:

[   12.378158] rtw_8821ce 0000:02:00.0: Firmware version 24.5.0, H2C version 12  [   12.404834] rtw_8821ce 0000:02:00.0: rfe 2 isn't supported  [   12.404937] rtw_8821ce 0000:02:00.0: failed to setup chip efuse info  [   12.404939] rtw_8821ce 0000:02:00.0: failed to setup chip information  

Update 2 This has been resolved with rtw88 driver by lwfinger after his updates to the code base. the driver works as intended now for the 8821ce!

No sound in OBS from capturing destop audio

Posted: 22 Jul 2021 10:02 AM PDT

I'm using Archlinux with up to date soft. I have set desktop capture with sound in OBS, but the red volume range doesn't change at all, though I have played music in the browser, nor sound is recorded at all. If I add mic capturing it works. If I start and stop recording the video file doesn't have audio as well Here's the screen:

enter image description here

and obs logs:

Attempted path: share/obs/obs-studio/locale.ini  Attempted path: /usr/share/obs/obs-studio/locale.ini  Attempted path: share/obs/obs-studio/themes/Dark.qss  Attempted path: /usr/share/obs/obs-studio/themes/Dark.qss  info: CPU Name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz  info: CPU Speed: 2725.460MHz  info: Physical Cores: 4, Logical Cores: 8  info: Physical Memory: 32046MB Total, 22761MB Free  info: Kernel Version: Linux 5.1.15-arch1-1-ARCH  info: Distribution: "Arch Linux" Unknown  info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.20.5  info: Portable mode: false  Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg  Attempted path: /usr/share/obs/obs-studio/themes/Dark/no_sources.svg  QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_clicked()  QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_destroyed()  QMetaObject::connectSlotsByName: No matching signal for on_program_customContextMenuRequested(QPoint)  info: OBS 23.2.1-2 (linux)  info: ---------------------------------  info: ---------------------------------  info: audio settings reset:          samples per sec: 44100          speakers:        2  info: ---------------------------------  info: Initializing OpenGL...  info: Loading up OpenGL on adapter NVIDIA Corporation GeForce GTX 970M/PCIe/SSE2  info: OpenGL loaded successfully, version 3.2.0 NVIDIA 430.26, shading language 1.50 NVIDIA via Cg compiler  info: ---------------------------------  info: video settings reset:          base resolution:   1920x1080          output resolution: 1280x720          downscale filter:  Bicubic          fps:               60/1          format:            NV12          YUV mode:          601/Partial  info: NV12 texture support not available  info: Audio monitoring device:          name: Default          id: default  info: ---------------------------------  warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so'  libDeckLinkAPI.so: cannot open shared object file: No such file or directory  info: No blackmagic support  info: NVENC supported  info: FFMPEG VAAPI supported  info: VLC found, VLC video source enabled  info: ---------------------------------  info:   Loaded Modules:  info:     vlc-video.so  info:     text-freetype2.so  info:     rtmp-services.so  info:     obs-x264.so  info:     obs-transitions.so  info:     obs-outputs.so  info:     obs-libfdk.so  info:     obs-filters.so  info:     obs-ffmpeg.so  info:     linux-v4l2.so  info:     linux-pulseaudio.so  info:     linux-jack.so  info:     linux-decklink.so  info:     linux-capture.so  info:     linux-alsa.so  info:     image-source.so  info:     frontend-tools.so  info:     decklink-ouput-ui.so  info: ---------------------------------  info: ==== Startup complete ===============================================  info: All scene data cleared  info: ------------------------------------------------  info: pulse-input: Server name: 'pulseaudio 12.2'  info: pulse-input: Audio format: s16le, 48000 Hz, 6 channels  info: pulse-input: Started recording from 'alsa_output.usb-Creative_Technology_Ltd_SB_Omni_Surround_5.1_000000Hk-00.analog-surround-51.monitor'  info: pulse-am: Prevented feedback-loop in 'default'  info: Switched to scene 'Scene 2'  info: ------------------------------------------------  info: Loaded scenes:  info: - scene 'Scene 2':  info:     - source: 'Desktop Audio' (pulse_output_capture)  info:         - monitoring: monitor and output  info: ------------------------------------------------  Attempted path: share/obs/obs-studio/images/overflow.png  Attempted path: /usr/share/obs/obs-studio/images/overflow.png  info: adding 23 milliseconds of audio buffering, total audio buffering is now 23 milliseconds (source: Desktop Audio)    info: adding 23 milliseconds of audio buffering, total audio buffering is now 46 milliseconds (source: Desktop Audio)    qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 4692, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 4715, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 4725, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 4747, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 5023, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 5037, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 5040, resource id: 146800806, major code: 130 (Unknown), minor code: 3  info: ---------------------------------  info: [NVENC encoder: 'simple_h264_recording'] settings:          rate_control: CQP          bitrate:      0          cqp:          21          keyint:       250          preset:       hq          profile:      high          width:        1280          height:       720          2-pass:       false          b-frames:     2          GPU:          0    [h264_nvenc @ 0x5592daaf5640] Using global_quality with nvenc is deprecated. Use qp instead.  info: libfdk_aac encoder created  info: libfdk_aac bitrate: 128, channels: 2  info: ==== Recording Start ===============================================  info: [ffmpeg muxer: 'simple_file_output'] Writing file '/home/andrew/Pictures/2019-07-07 11-37-05.flv'...  [flv @ 0x55605eb64680] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.  [flv @ 0x55605eb64680] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 8830, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 8844, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 8847, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 8859, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9154, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9176, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9186, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9202, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9222, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9238, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9253, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9263, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9284, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9295, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9329, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9345, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9356, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9377, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 9388, resource id: 146800806, major code: 130 (Unknown), minor code: 3  info: [ffmpeg muxer: 'simple_file_output'] Output of file '/home/andrew/Pictures/2019-07-07 11-37-05.flv' stopped  info: Output 'simple_file_output': stopping  info: Output 'simple_file_output': Total frames output: 205  info: Output 'simple_file_output': Total drawn frames: 219  info: ==== Recording Stop ================================================  info: libfdk_aac encoder destroyed  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 10954, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 10972, resource id: 146800806, major code: 130 (Unknown), minor code: 3  qt.qpa.xcb: QXcbConnection: XCB error: 8 (BadMatch), sequence: 10975, resource id: 146800806, major code: 130 (Unknown), minor code: 3  info: ==== Shutting down ==================================================  info: Switched to scene '(null)'  info: pulse-input: Stopped recording from 'alsa_output.usb-Creative_Technology_Ltd_SB_Omni_Surround_5.1_000000Hk-00.analog-surround-51.monitor'  info: pulse-input: Got 5473 packets with 954139 frames  info: All scene data cleared  info: ------------------------------------------------  error: X Error: GLXBadDrawable, Major opcode: 152, Minor opcode: 26, Serial: 13246  error: Failed to make context current.  error: X Error: GLXBadDrawable, Major opcode: 152, Minor opcode: 26, Serial: 13248  error: Failed to make context current.  error: X Error: GLXBadDrawable, Major opcode: 152, Minor opcode: 26, Serial: 13250  error: Failed to make context current.  error: Failed to fetch parent window geometry!  error: X Error: BadDrawable (invalid Pixmap or Window parameter), Major opcode: 152, Minor opcode: BadLength (poly request too large or internal Xlib length error), Serial: 13252  error: X Error: GLXBadDrawable, Major opcode: 152, Minor opcode: BadAlloc (insufficient resources for operation), Serial: 13253  error: X Error: GLXBadDrawable, Major opcode: 152, Minor opcode: 26, Serial: 13255  error: Failed to make context current.  error: X Error: GLXBadDrawable, Major opcode: 152, Minor opcode: 26, Serial: 13257  error: Failed to make context current.  info: Freeing OBS context data  info: [Scripting] Total detached callbacks: 0  info: == Profiler Results =============================  info: run_program_init: 521.116 ms  info:  ┣OBSApp::AppInit: 2.79 ms  info:  ┃ ┗OBSApp::InitLocale: 0.794 ms  info:  ┗OBSApp::OBSInit: 406.532 ms  info:    ┣obs_startup: 1.109 ms  info:    ┗OBSBasic::OBSInit: 319.535 ms  info:      ┣OBSBasic::InitBasicConfig: 0.085 ms  info:      ┣OBSBasic::ResetAudio: 0.101 ms  info:      ┣OBSBasic::ResetVideo: 142.398 ms  info:      ┣OBSBasic::InitOBSCallbacks: 0.002 ms  info:      ┣OBSBasic::InitHotkeys: 0.028 ms  info:      ┣obs_load_all_modules: 90.765 ms  info:      ┃ ┣obs_init_module(decklink-ouput-ui.so): 0.668 ms  info:      ┃ ┣obs_init_module(frontend-tools.so): 57.176 ms  info:      ┃ ┣obs_init_module(image-source.so): 0.004 ms  info:      ┃ ┣obs_init_module(linux-alsa.so): 0.001 ms  info:      ┃ ┣obs_init_module(linux-capture.so): 0.221 ms  info:      ┃ ┣obs_init_module(linux-decklink.so): 0.103 ms  info:      ┃ ┣obs_init_module(linux-jack.so): 0.001 ms  info:      ┃ ┣obs_init_module(linux-pulseaudio.so): 0.001 ms  info:      ┃ ┣obs_init_module(linux-v4l2.so): 0 ms  info:      ┃ ┣obs_init_module(obs-ffmpeg.so): 0.678 ms  info:      ┃ ┃ ┗nvenc_check: 0.613 ms  info:      ┃ ┣obs_init_module(obs-filters.so): 0.008 ms  info:      ┃ ┣obs_init_module(obs-libfdk.so): 0.001 ms  info:      ┃ ┣obs_init_module(obs-outputs.so): 0.001 ms  info:      ┃ ┣obs_init_module(obs-transitions.so): 0.004 ms  info:      ┃ ┣obs_init_module(obs-x264.so): 0 ms  info:      ┃ ┣obs_init_module(rtmp-services.so): 0.108 ms  info:      ┃ ┣obs_init_module(text-freetype2.so): 0.005 ms  info:      ┃ ┗obs_init_module(vlc-video.so): 1.911 ms  info:      ┣OBSBasic::ResetOutputs: 0.08 ms  info:      ┣OBSBasic::CreateHotkeys: 0.022 ms  info:      ┣OBSBasic::InitService: 0.927 ms  info:      ┣OBSBasic::InitPrimitives: 0.181 ms  info:      ┗OBSBasic::Load: 8.247 ms  info: obs_hotkey_thread(25 ms): min=0.057 ms, median=0.214 ms, max=65.179 ms, 99th percentile=4.116 ms, 99.7484% below 25 ms  info: audio_thread(Audio): min=0 ms, median=0.185 ms, max=1.611 ms, 99th percentile=0.662 ms  info:  ┗receive_audio: min=0.007 ms, median=0.274 ms, max=1.542 ms, 99th percentile=0.46 ms, 0.185484 calls per parent call  info:    ┣buffer_audio: min=0 ms, median=0.001 ms, max=0.013 ms, 99th percentile=0.007 ms  info:    ┗do_encode: min=0.079 ms, median=0.269 ms, max=1.54 ms, 99th percentile=0.451 ms  info:      ┗encode(simple_aac_recording): min=0.076 ms, median=0.26 ms, max=0.442 ms, 99th percentile=0.419 ms  info: obs_graphics_thread(16.6667 ms): min=0.159 ms, median=1.387 ms, max=46.546 ms, 99th percentile=6.108 ms, 99.5008% below 16.667 ms  info:  ┣tick_sources: min=0.001 ms, median=0.013 ms, max=0.165 ms, 99th percentile=0.024 ms  info:  ┣output_frame: min=0.115 ms, median=0.554 ms, max=46.428 ms, 99th percentile=3.382 ms  info:  ┃ ┣gs_context(video->graphics): min=0.115 ms, median=0.548 ms, max=46.427 ms, 99th percentile=2.913 ms  info:  ┃ ┃ ┣render_video: min=0.01 ms, median=0.175 ms, max=2.029 ms, 99th percentile=0.749 ms  info:  ┃ ┃ ┃ ┣render_main_texture: min=0.006 ms, median=0.137 ms, max=0.727 ms, 99th percentile=0.217 ms  info:  ┃ ┃ ┃ ┣render_output_texture: min=0.001 ms, median=0.166 ms, max=1.514 ms, 99th percentile=0.305 ms, 0.182196 calls per parent call  info:  ┃ ┃ ┃ ┣render_convert_texture: min=0.001 ms, median=0.113 ms, max=0.706 ms, 99th percentile=0.357 ms, 0.182196 calls per parent call  info:  ┃ ┃ ┃ ┗stage_output_texture: min=0 ms, median=0.083 ms, max=1.045 ms, 99th percentile=0.827 ms, 0.182196 calls per parent call  info:  ┃ ┃ ┣gs_flush: min=0.001 ms, median=0.027 ms, max=2.978 ms, 99th percentile=0.077 ms  info:  ┃ ┃ ┗download_frame: min=0 ms, median=0.005 ms, max=0.01 ms, 99th percentile=0.01 ms, 0.182196 calls per parent call  info:  ┃ ┗output_video_data: min=0.14 ms, median=0.374 ms, max=2.579 ms, 99th percentile=2.108 ms, 0.178869 calls per parent call  info:  ┗render_displays: min=0.042 ms, median=0.796 ms, max=18.382 ms, 99th percentile=2.181 ms  info: video_thread(video): min=0.481 ms, median=1.197 ms, max=3.82 ms, 99th percentile=2.036 ms  info:  ┗receive_video: min=0.48 ms, median=1.194 ms, max=3.817 ms, 99th percentile=2.033 ms  info:    ┗do_encode: min=0.479 ms, median=1.193 ms, max=3.816 ms, 99th percentile=2.031 ms  info:      ┗encode(simple_h264_recording): min=0.476 ms, median=1.181 ms, max=3.81 ms, 99th percentile=1.802 ms  info: =================================================  info: == Profiler Time Between Calls ==================  info: obs_hotkey_thread(25 ms): min=25.087 ms, median=25.296 ms, max=90.241 ms, 92.1914% within ±2% of 25 ms (0% lower, 7.80856% higher)  info: obs_graphics_thread(16.6667 ms): min=3.436 ms, median=16.667 ms, max=46.557 ms, 98.6678% within ±2% of 16.667 ms (0.666112% lower, 0.666112% higher)  info: =================================================  info: Number of memory leaks: 0  

I have installed this version of sotware:

local/obs-studio 23.2.1-2  local/linux 5.1.15.arch1-  local/alsa-lib 1.1.9-1  local/alsa-plugins 1.1.9-2  local/alsa-tools 1.1.7-1  local/alsa-utils 1.1.9-1  local/lib32-alsa-lib 1.1.9-1  local/lib32-alsa-plugins 1.1.9-1  local/pulseaudio-alsa 2-4  local/zita-alsa-pcmi 0.3.2-1  local/lib32-libpulse 12.2-1  local/libcanberra-pulse 0.30+2+gc0620e4-2  local/pulseaudio 12.2-2  

Ubuntu server second network card is disabled

Posted: 22 Jul 2021 09:07 AM PDT

I have a physical server that has two network cards. One of them is on the motherboard (card A) and the other is a new one that I added by myself (card B). this command:

lshw -class network  

show that card A is active by default, no problem there. But card B is disabled, so I use:

sudo ifconfig  enp3s0 up  

to enabling card B. (enp3s0 is Card B logical name).

After this, I just want to set a static IP for card b. and for this purpose I used these commands:

ifconfig enp3s0 "My Ip" netmask 255.255.0 up  route add default gw "My Ip"  echo "nameserver 8.8.8.8"> /etc/resolve.conf  

then I ping google, and everything is fine. But, after a reboot Card B loose all the setting and become disabled again.

So I did some search and I did find out that I need to do some static Ip setting. I use

sudo nano /etc/network/interfaces   

to add static IP. and add this to interface file:

auto enp3s0  iface enp3s0 inet loopback  iface enp3s0  iface enp3s0 inet static  address "my ip"  netmask 255.255.255.0  gw "my ip"  dns-nameservers 8.8.4.4 8.8.8.8  

After reboot, this setting is there, but Card B is disabled again.

for sums up, my question is, how to enable second network card permanently and how to set static Ip for it?

P.S: I have some network setting so I can't reset the network.

No comments:

Post a Comment