Monday, October 25, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


systemd-analyze critical-chain doesn't show start time

Posted: 25 Oct 2021 10:05 AM PDT

I am running systemd-analyze critical-chain foo.service to try and determine at what time a service finished initializing. However, for some services I find it doesn't display the '@' time, e.g.:

$ systemd-analyze critical-chain foo.service   The time after the unit is active or started is printed after the "@" character.  The time the unit takes to start is printed after the "+" character.    foo.service +144ms  └─another.service @800ms    └─someother.service @483ms +188ms    

In this situation how do I work out the time at which foo.service starts?

Why isn't "Permission denied" in stderr?

Posted: 25 Oct 2021 10:03 AM PDT

I have a command: mywritercmd -f /tmp/test 2>&1 > log.txt I run in a bash terminal, the command returns error: could not open output file "/tmp/test": Permission denied

Nevertheless, this error message isn't written in the log.txt file, it stays empty...

Why?

I'd have guessed this message should go to stderr and then in the file but somehow it isn't.

Is setting cgroup_enable=cpuset necessary in this case?

Posted: 25 Oct 2021 10:00 AM PDT

I am setting up a raspberry pi based cluster using kubeadm and containerd as the CRI. I have 8GB nodes and I have installed Ubuntu 20.04 on them. I need to setup cgroups and the various instructions in various places is confusing me. I have seen the following to be setup in /boot/firmware/cmdline.txt.

cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 swapaccount=1

Currently cat /proc/cgroups is giving me the following output

#subsys_name    hierarchy       num_cgroups     enabled  cpuset  8       1       1  cpu     4       43      1  cpuacct 4       43      1  blkio   7       43      1  memory  0       51      0  devices 10      43      1  freezer 3       2       1  net_cls 2       1       1  perf_event      5       1       1  net_prio        2       1       1  pids    6       48      1  rdma    9       1       1  

From the above I have 2 questions:

I believe this indicates that cpuset is already enabled and I believe that doing cgroup_enable=cpuset is unnecessary. Also memory cgroup is disabled and not set so the 2 memory commands are needed. Am I correct?

Moreover, I am finding conflicting guidance on swapaccount=1. Since swap is turned off for me anyway, is there a need to enable swap accounting?

Debian 11 + Teams - sharing screen not working

Posted: 25 Oct 2021 09:20 AM PDT

Using Debian 11 + teams ... screen sharing is not working ...

any ideas ?

sudo: PAM authentication error: Failure setting user credentials

Posted: 25 Oct 2021 09:19 AM PDT

I am not able to run sudo command. Every time i run with sudo I get the PAM error, Failure setting user credentials.

> sudo su   [sudo] password for userX:   sudo: PAM authentication error: Failure setting user credentials  

Here is the error with screenshot

enter image description here

I tried looking for hints in man access.conf i could not find anything. Any leads would be helpful

bash: "Syntax error near unexpected token 'elif'"

Posted: 25 Oct 2021 09:01 AM PDT

hour=0  min=1  sec=0          while [ $hour -ge 0 ]; do                   while [ $min -ge 0 ]; do                           while [ $sec -ge 0 ]; do                                   echo -ne "$hour:$min:$sec\033[0K\r"                                   let "sec=sec-1"                                   sleep 1                           done                           sec=59                           let "min=min-1"                   done                   min=59                   let "hour=hour-1"           done    filename1=test1.txt.gpg  filename2=test2.txt.gpg    if [ ! -f $filename1 ]; then  echo "test1.txt.gpg not found, critical error"  rm test2.txt.gpg  elif [ ! -f $filename2 ];  echo "test2.txt.gpg not found, critical error"  rm test1.txt.gpg  else [[ -f $filename1 || $filename2 ]];  echo "test1.txt.gpg & test2.txt.gpg found...decrypting..."  fi  

The first half of the code is meant to set a countdown timer, when the countdown is finished the script should check to see if two files are in there. If one of the files are missing, then the other file should be deleted and an error message is returned. If both files are deleted, then an error message is returned. If both files are present, the script continues to decrypt them (using gpg) and then combine the two files (this portion has not been implemented yet).

Currently I've been running into an issue with line 10 and 12 giving the error main.sh: line 10: syntax error near unexpected token `elif'. I'm guessing it's due to the way I have the condition set up, but I'm not sure at this point. Any help with this would be appreciated.

What is the easiest way to learn shell scripts with language that understandable for Linux software?

Posted: 25 Oct 2021 08:56 AM PDT

strststrong textrong textstrong textong text[1]: https://Linux.com

UI to manage users exist in mysql database

Posted: 25 Oct 2021 08:45 AM PDT

I am totally new to the frontend coding, I have a mysql database at the backend and looking for few reference through which i can build a simple UI which can connect to the mysql db > fetch the users and has ability to modify it. The end goal is to containerized the ui.

Any existing solutions or reference links are appreciated, Thank You!!

I found this https://www.youtube.com/watch?v=xTHJ4gGycb0 but doesn't satisfy my requirement.

Change default SFTP directory in Cygwin

Posted: 25 Oct 2021 08:41 AM PDT

On a Windows server, I've installed OpenSSH via Cygwin to mainly connect via SFTP. I would like to change the default directory for the SFTP server. When I log via ssh to this server, my entry point is in /home/mquser. I would like to set the default directory for SFTP in /home/mquser/ftproot. I tried to add to my sshd_config the following part, but when I login via SFTP I keep always goint to /home/mquser instead of /home/mquser/default

Subsystem sftp internal-sftp  Match Group mqm      ForceCommand internal-sftp       ChrootDirectory /home/mquser/ftproot  

Software RAID Issues with Missing Drive from Boot

Posted: 25 Oct 2021 08:36 AM PDT

I have a 3-drive software raid1 (on RHEL 7) that I am trying to test the limits on. This system boots in legacy/mbr mode and does not support uefi. One of the problems I have encountered is; from a powered off state, if I remove a drive, the system will boot but just before you are prompted to log in, the system drops to an emergency shell. So that we are clear; the system gets past grub and starts x, then it drops after about 20 seconds of "thinking." (I also observed that /boot and /etc don't exist.)

I see that if I properly 'fail' the drive before rebooting, this isn't an issue. This only becomes and issue if the power is off and I remove a drive before powering on. (I see that this is a realistic scenario as, if I lose power and a drive becomes corrupt, then I would encounter this problem).

Is there a way to prevent the raid from failing to properly boot? Is it possible to have mdadm rebuild the raid1 so that the system can work in a degraded status (2 of 3 hard drives)?

Installing redmine 4.0.7-1 with apt in linux debian 11 (bullseye)

Posted: 25 Oct 2021 09:46 AM PDT

Redmine has typically been something I have been struggling with when it comes to install/upgrade it, owing to the need to work with gems/gemfiles, something I'm not too familiar with.

I have had an old version of Redmine working smoothly on my debian LAMP server, however with the recent release of Debian 11 (Bullseye) I decided to finally upgrade my debian version. However I get into the error below where Bundler cannot find rails (~> 5.2.2). However I have updated all my gems and my bundler version is: rails (6.1.4.1, 6.0.3.7).

Looking at some reported issued on the internet I only find a few things mentioning similar (indentical?) issues, like this bug report:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=969206

however there is no indication on how can I solve this issue.

As such, any help would be very much appreciated. Thank you in advance.

Below I am appending the printouts of my apt install logs, and also the list of all my installed gems.

501.0 # apt install redmine  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  redmine is already the newest version (4.0.7-1).  0 upgraded, 0 newly installed, 0 to remove and 901 not upgraded.  1 not fully installed or removed.  After this operation, 0 B of additional disk space will be used.  Do you want to continue? [Y/n]   Setting up redmine (4.0.7-1) ...  Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.  Could not find gem 'rails (~> 5.2.2)' in cached gems from rubygems repository https://rubygems.org/ or installed locally.  The source contains the following versions of 'rails': 6.0.3.7, 6.1.4.1  dpkg: error processing package redmine (--configure):   installed redmine package post-installation script subprocess returned error exit status 1  Errors were encountered while processing:   redmine  E: Sub-process /usr/bin/dpkg returned an error code (1)  
Installed GEMS

504.0 # gem list --local    *** LOCAL GEMS ***    actioncable (6.1.4.1, 6.0.3.7)  actionmailbox (6.1.4.1, 6.0.3.7)  actionmailer (6.1.4.1, 6.0.3.7)  actionpack (6.1.4.1, 6.0.3.7)  actionpack-action_caching (1.2.2, 1.2.1)  actionpack-xml_parser (2.0.1)  actiontext (6.1.4.1, 6.0.3.7)  actionview (6.1.4.1, 6.0.3.7)  activejob (6.1.4.1, 6.0.3.7)  activemodel (6.1.4.1, 6.0.3.7)  activerecord (6.1.4.1, 6.0.3.7)  activestorage (6.1.4.1, 6.0.3.7)  activesupport (6.1.4.1, 6.0.3.7)  addressable (2.8.0, 2.7.0)  arel (9.0.0)  atomic (1.1.101, 1.1.16)  awesome_nested_set (3.4.0, 3.0.0)  benchmark (0.1.1, default: 0.1.0)  bigdecimal (3.0.2, default: 2.0.0)  blankslate (3.1.3)  builder (3.2.4)  bundler (2.2.29, 2.2.5, default: 2.1.4)  cgi (0.2.0, default: 0.1.0)  coderay (1.1.3)  coffee-script (2.4.1)  coffee-script-source (1.12.2)  columnize (0.9.0)  concurrent-ruby (1.1.9, 1.1.6)  concurrent-ruby-edge (0.6.0)  connection_pool (2.2.5, 2.2.2)  crass (1.0.6, 1.0.2)  css_parser (1.10.0, 1.6.0)  csv (3.2.0, default: 3.1.2)  date (3.1.1, default: 3.0.0)  dbm (default: 1.1.0)  delegate (0.2.0, default: 0.1.0)  did_you_mean (1.5.0, default: 1.4.0, 1.2.1)  digest (3.0.0)  erubi (1.10.0, 1.9.0)  erubis (2.7.0)  etc (1.2.0, default: 1.1.0)  execjs (2.8.1, 2.7.0)  fcntl (default: 1.0.0)  fiddle (1.0.9, default: 1.0.0)  fileutils (1.5.0, default: 1.4.1)  forwardable (1.3.2, default: 1.3.1)  gdbm (default: 2.1.0)  getoptlong (0.1.1, default: 0.1.0)  globalid (0.5.2, 0.3.6)  hike (2.1.3, 1.2.1)  i18n (1.8.10, 1.8.8)  io-console (0.5.9, default: 0.5.6)  io-wait (0.1.0)  ipaddr (default: 1.2.2)  irb (1.3.7, default: 1.2.6)  jquery-rails (4.4.0, 4.3.5)  json (2.5.1, default: 2.3.0)  logger (1.4.3, default: 1.4.2)  loofah (2.12.0)  mail (2.7.1)  marcel (1.0.2, 1.0.1)  matrix (0.4.2, default: 0.2.0)  method_source (1.0.0)  mime-types (3.3.1)  mime-types-data (3.2021.0901, 3.2015.1120)  mimemagic (0.4.3, 0.3.5)  mini_mime (1.1.2, 1.0.2)  minitest (5.14.4, 5.13.0)  molinillo (0.8.0, 0.6.4)  multi_json (1.15.0, 1.14.1)  mutex_m (0.1.1, default: 0.1.0)  net-http-persistent (4.0.1, 3.1.0)  net-ldap (0.17.0, 0.16.1)  net-pop (0.1.1, default: 0.1.0)  net-protocol (0.1.1)  net-smtp (0.2.2, default: 0.1.0)  nio4r (2.5.8)  nokogiri (1.12.5 x86_64-linux, 1.11.7)  observer (0.1.1, default: 0.1.0)  open3 (0.1.1, default: 0.1.0)  openssl (2.2.0, default: 2.1.2)  ostruct (0.4.0, default: 0.2.0)  pkg-config (1.4.6, 1.4.4)  polyglot (0.3.5, 0.3.4)  power_assert (2.0.1, 1.1.7)  prime (0.1.2, default: 0.1.1)  pstore (0.1.1, default: 0.1.0)  psych (4.0.1, default: 3.1.0)  public_suffix (4.0.6, 3.0.3)  racc (1.5.2, default: 1.4.16)  rack (2.2.3, 2.1.4)  rack-openid (1.4.2)  rack-test (1.1.0, 0.7.0)  rails (6.1.4.1, 6.0.3.7)  rails-deprecated_sanitizer (1.0.4, 1.0.3)  rails-dom-testing (2.0.3)  rails-html-sanitizer (1.4.2)  rails-observers (0.1.5)  railties (6.1.4.1, 6.0.3.7)  rake (13.0.6, 13.0.3)  rbpdf (1.20.1)  rbpdf-font (1.19.1)  rdoc (6.3.2, default: 6.2.1.1)  readline (default: 0.0.2)  readline-ext (0.1.2, default: 0.1.0)  redcarpet (3.5.1)  reline (0.2.7, default: 0.1.5)  request_store (1.5.0)  rexml (3.2.5, default: 3.2.3.1)  rmagick (4.2.3)  roadie (4.0.0)  roadie-rails (2.2.0, 2.1.1)  rouge (3.26.1)  rss (0.2.9, default: 0.2.8)  ruby-i18n-months (1.0.0)  ruby-openid (2.9.2)  rubygems-update (3.2.29, 3.2.5)  sass (3.7.4)  sdbm (default: 1.0.0)  sdoc (2.2.0, 1.1.0)  singleton (0.1.1, default: 0.1.0)  sprockets (4.0.2, 3.7.2)  sprockets-rails (3.2.2, 3.2.1)  sqlite3 (1.4.2)  stringio (3.0.0, default: 0.1.0)  strscan (3.0.0, default: 1.0.3)  test-unit (3.4.8, 3.3.9)  thor (1.1.0, 1.0.1)  thread_safe (0.3.6)  tilt (2.0.10)  timeout (0.1.1, default: 0.1.0)  tracer (0.1.1, default: 0.1.0)  tzinfo (2.0.4, 1.2.6)  uri (0.10.1, default: 0.10.0)  webrick (1.7.0, default: 1.6.1)  websocket-driver (0.7.5, 0.6.3)  websocket-extensions (0.1.5)  xmlrpc (0.3.2, 0.3.0)  yaml (0.1.1, default: 0.1.0)  zeitwerk (2.4.2)  zlib (default: 1.1.0)  

How to install different versions of python on centOS 8?

Posted: 25 Oct 2021 08:51 AM PDT

I have python3.6 installed on CentOS Linux release 8.3

[fnord@fnord fnord]$ ls -ls /usr/bin/python*   0 lrwxrwxrwx  1 root root    9 Aug 31  2020 /usr/bin/python2 -> python2.7  12 -rwxr-xr-x  1 root root 8224 Aug 31  2020 /usr/bin/python2.7   0 lrwxrwxrwx. 1 root root   25 Jun 24  2020 /usr/bin/python3 -> /etc/alternatives/python3   0 lrwxrwxrwx  1 root root   31 Nov  4  2020 /usr/bin/python3.6 -> /usr/libexec/platform-python3.6   0 lrwxrwxrwx  1 root root   17 Nov  4  2020 /usr/bin/python3.6-config -> python3.6m-config   0 lrwxrwxrwx  1 root root   32 Nov  4  2020 /usr/bin/python3.6m -> /usr/libexec/platform-python3.6m   0 lrwxrwxrwx  1 root root   39 Nov  4  2020 /usr/bin/python3.6m-config -> /usr/libexec/platform-python3.6m-config   0 lrwxrwxrwx  1 root root   46 Nov  4  2020 /usr/bin/python3.6m-x86_64-config -> /usr/libexec/platform-python3.6m-x86_64-config   0 lrwxrwxrwx  1 root root   32 Mar 16  2021 /usr/bin/python3-config -> /etc/alternatives/python3-config  [fnord@fnord fnord]$ python3 --version  Python 3.6.8  [fnord@fnord fnord]$cat /etc/centos-release  CentOS Linux release 8.3.2011  

How would I install python3.7, python3.8,... on the same system?

Sort line based on the value of a column

Posted: 25 Oct 2021 09:43 AM PDT

I have to sort a thread dump which looks like this:

$ jstack -l 5213 | grep cpu     "Reference Handler" #2 daemon prio=10 os_prio=0 cpu=2.21ms elapsed=478.03s tid=0x00000000013bb800 nid=0x1465 waiting on condition  [0x00007f386cc0c000]  "Finalizer" #3 daemon prio=8 os_prio=0 cpu=1.30ms elapsed=478.03s tid=0x00000000013c6000 nid=0x1466 in Object.wait()  [0x00007f386cb0b000]  "Signal Dispatcher" #4 daemon prio=9 os_prio=0 cpu=0.31ms elapsed=478.03s tid=0x00000000013db000 nid=0x1467 runnable  [0x0000000000000000]  "C2 CompilerThread0" #5 daemon prio=9 os_prio=0 cpu=3042.89ms elapsed=478.02s tid=0x00000000013dd800 nid=0x1468 waiting on condition  [0x0000000000000000]  "C1 CompilerThread0" #8 daemon prio=9 os_prio=0 cpu=1840.51ms elapsed=478.02s tid=0x00000000013e0000 nid=0x1469 waiting on condition  [0x0000000000000000]  

The dump is pretty big so I'd like to sort it by the column "cpu" (either ascending or descending). It seems the sort command accepts the "k" parameter to indicate the column to used as criteria for sorting. "cpu" is the 5th column, so I've tried with:

$ jstack -l 5213 | grep cpu | sort -k 5  "ServerService Thread Pool -- 1" #26 prio=5 os_prio=0 cpu=10.86ms elapsed=753.24s tid=0x0000000002b68800 nid=0x1482 waiting on condition  [0x00007f385c33b000]  "Transaction Expired Entry Monitor" #131 daemon prio=5 os_prio=0 cpu=0.48ms elapsed=751.66s tid=0x00000000082ed000 nid=0x14eb in Object.wait()  [0x00007f3853826000]  "Transaction Reaper Worker 0" #133 daemon prio=5 os_prio=0 cpu=0.13ms elapsed=751.63s tid=0x00000000084d9000 nid=0x14ee in Object.wait()  [0x00007f3853523000]  

I see the order has changed yet it does not follow the criteria I'd expect ("cpu"). Any idea if a text like "cpu=value" can be used as criteria to sort or it needs to be combined with other commands? Thanks

Search for pattern and create file with the same name

Posted: 25 Oct 2021 09:16 AM PDT

Here's a simple line of my usage:

grep -i '"location_country":"country name"' file.txt >> sample.txt  

I'm searching a large file with multiple countries and what I would like to do is create a text file with the country name dynamically and store all matches from the same country into that file, which means country name.txt for every occurrence.

something like this

grep -i '"location_country":"(.+)"' file.txt >> \1.txt  

Example of data:

{"full_name":"name1","location_country":"united kingdom"}  {"full_name":"name2","location_country":"united states"}  {"full_name":"name3","location_country":"china"}  

So I need to create 3 separate text files with country names e.g. united kingdom.txt contains:

{"full_name":"name1","location_country":"united kingdom"}  

I'm already using bash scripting so I don't mind that, How could I achieve this? I am using a Linux machine.

Pooling storage across multiple devices?

Posted: 25 Oct 2021 08:05 AM PDT

Is it possible to pool storage across multiple (eg.) Raspberry Pi's into one store? For a simple example, say I have 12 Pi's, each Pi has 1TB of on a USB. Can I make a single storage on the network (using samba or something), that would appear as a single 12TB drive, and automatically distribute the data across the various drives as needed?

NFS filesystem 100% full - 'No space left on device' error, cannot remove or truncate files

Posted: 25 Oct 2021 09:23 AM PDT

I'm getting a No space left on device error when I try to remove or truncate a file on a Ubuntu server. This seems to be because the NFS filesystem is 100% full and all inodes are used.

Running df -T gives the following result:

Filesystem                   Type        1K-blocks         Used    Available Use% Mounted on  ...  rc-stor6-ib:/centers/cfce    nfs      228910395392 228910395392            0 100% /mnt/cfce-stor1  ...  

and df -i gives:

Filesystem                          Inodes    IUsed         IFree IUse% Mounted on  ...  rc-stor6-ib:/centers/cfce         27410037 27410037             0  100% /mnt/cfce-stor1  ...  

I don't have admin privileges, and so far I've tried multiple methods to manually remove some files to free up space. However, rm -f, mv * /tmp, truncate -s 0 and piping from /dev/null have all returned the No space left on device error, for example:

(base) rh476@CFCE2:~/WGCNA/project_wgcna$ rm -f brg_TOM_allsamples-block.1.RData   rm: cannot remove 'brg_TOM_allsamples-block.1.RData': No space left on device  

Is there anything else I can do to free up space and fix the issue?

How can I find the last 10 modified files

Posted: 25 Oct 2021 10:00 AM PDT

I'm in the root folder and need to find the last 10 modified files of just this folder. Every time I put -mtime like my lecturer said I get 10 days. I need the last 10 modified files, not the last 10 days worth. I have tried find -my time, my time piped with tail. I get a long list of every modified file of the last 10 days. I need just the last 10 modified files of the root directory.

Variable not accepting in awk while passing from a file

Posted: 25 Oct 2021 08:53 AM PDT

i reading the file line by line which is having input as xxyu: JHYU_IOPI and passing the same as variable to awk as below. I doing this to print the previous line of the matching pattern, i can achieve this via grep want to know where i did mistake over here.

can some one please correct me.

#!/bin/bash  while read i  do   awk '/$i/{print a}{a=$0}' ver_in.txt  done<in.txt  

Tried this also

#!/bin/bash  while read i  do   awk -v var="$i" '/var/{print a}{a=$0}' jil.txt  done<in.txt  

Editing the question for using awk after getting suggestion not to use sh read,my input and desired output are shown below.

Input file: xxx: rtyuiol ght: ertyjk

xxx: ertyuikl_fghjk  ght: ertyjk    xxx: qwertyujkl  ght: ertyjk    xxx: rtyuiol_123  ght: ertyjk    xxx: rtyuiol  ght: YUIOPO    xxx: rtyuiopfghj  ght: YUIOPO    xxx: dfghjkvbnm  ght: YUIOPO    xxx: qzdfghnbvfgh  ght: YUIOPO    xxx: qsxcvghuiokmnhgf  ght: YUIOPO  

expected output Have another file which contains the ght:(any text ) lines in that have to read that and compare with input file ,if ght:(any text) lines matches print the ght:(any text) followed by the previous line of ght:(any text)

ght: ertyjk  xxx: rtyuiol  xxx: ertyuikl_fghjk  xxx: qwertyujkl  xxx: rtyuiol_123  ght: YUIOPO  xxx: rtyuiol  xxx: rtyuiopfghj  xxx: dfghjkvbnm  xxx: qzdfghnbvfgh  xxx: qsxcvghuiokmnhgf  

how to use rtl8723bs bluetooth in linux 5.10

Posted: 25 Oct 2021 10:05 AM PDT

I have alpine edge (future 3.15) x86 on an HP Stream 7 5709 tablet (tl;dr: Bay Trail, Atom Z3735G), which has an onboard rtl8723bs which I'm already using for wifi and is working fine.

sl7alp:~$ uname -a  Linux sl7alp 5.10.72-1-lts #2-Alpine SMP Sat, 16 Oct 2021 06:04:30 +0000 i686 Linux  

(If you're trying to get wifi to work, alpine 3.14+ has the driver, but the included firmware file set is missing /lib/firmware/rtlwifi/rtl8723bs_nic.bin, but the corresponding one for bu is there and has the same contents as the bs one, but I digress.)

But how to get bluetooth to work, in a situtation like this where I need to add whatever kernel drivers I need because the stock set is too minimal for this purpose?

Besides the default modules of the edge's 5.10 kernel I've got the appropriate additional kernel module, with the seemingly relevant additional features turned on, built and installed:

CONFIG_SERIAL_DEV_BUS=m  CONFIG_BT_HCIUART_RTL=y  CONFIG_BT_HCIUART_3WIRE=y  CONFIG_SERIAL_DEV_CTRL_TTYPORT=y  

Subsequently, booting loads the relevant modules automatically:

sl7alp:~$ lsmod | grep serdev  serdev                 20480  1 hci_uart  sl7alp:~$ lsmod | grep hci_uart  hci_uart               49152  0  btrtl                  16384  1 hci_uart  btintel                24576  1 hci_uart  serdev                 20480  1 hci_uart  bluetooth             356352  3 btrtl,hci_uart,btintel  

I can see the dmesg output which would be for the relevant HS-UARTs:

[    1.062751] 80860F0A:00: ttyS1 at MMIO 0x50919000 (irq = 16, base_baud = 2764800) is a 16550A  [    1.079576] 80860F0A:01: ttyS2 at MMIO 0x5091b000 (irq = 17, base_baud = 2764800) is a 16550A  

But this doesn't automatically make the bluetooth device available; bluetoothctl does not list any controllers, and rfkill doesn't show any.

I found the (seemingly older ~ 4.x kernel era) third party repository https://github.com/lwfinger/rtl8723bs_bt and its remaining step is what I expect, some kind of initialization through the UARTs, and then telling the relevant piece of bluetooth driver infrastructure to attach to them, but using its ./start_bt.sh, it just errors out:

Using device /dev/ttyS1 for Bluetooth  Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5  Realtek Bluetooth :Realtek hciattach version 2.5  Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8  [...]  Realtek Bluetooth :3-wire sync pattern resend : 40, len: 8  Realtek Bluetooth ERROR: H5 sync timed out  

and I can't concoct a command line for btattach or the vanilla hciattach from bluez-deprecated that works any better than that.

More investigation:

I see that the ACPI-based device enumeration under /sys/devices has the bluetooth device as OBDA8723, under the first bay trail internal UART 80860F0A:00.

The h5 driver (bluetooth/hci_h5.c) provides an ACPI table with one entry for OBDA8723, and judging by the fact that system automatically decides to load the btrtl module, I expect that it is at least somewhat getting to where it needs to go to take effect.

However, sprinkling some extra pr_info()s around hci_h5, I can see that while the driver's main h5_init() runs when Bluetooth initially loads all the serdev drivers, its h5_btrtl_setup(), which it is referenced in the struct of function pointers passed with the ACPI table, never runs.

Oh darn:

And in fact serdev's function serdev_drv_probe() never even runs. Why?

From drivers/tty/serdev/Kconfig:

config SERIAL_DEV_CTRL_TTYPORT          [...]          depends on SERIAL_DEV_BUS != m  

What does LOADADDR=0x20008000 mean in linux kernel make command?

Posted: 25 Oct 2021 08:16 AM PDT

I'm learning about u-boot. using qemu model, I could (using qemu) load the Image on memory location I want and I could run the kernel booting using booti addr command. As you know in arm64, there is no uImage.
Then, when building linux kernel for arm (32 bit), what does make LOADADDR=0x20008000 uImage mean? We could load (from SD card or network) the uImage anywhere we want using u-boot shell anyway. Then, Does it mean that when we run bootm command, the u-boot program relocates the kernel image inside the uImage to 0x20008000? It's hard to find these information.

HDMI audio is pitch-shifted like chipmunk (AMD RX 500 series GPU: RX 570, RX 580, RX 590)

Posted: 25 Oct 2021 09:44 AM PDT

I am a Linux user and have installed a new Sapphire PULSE Radeon RX 580 8GB in my machine and am experiencing audio distortion in the HDMI output from the card. The Linux kernel AMDGPU video driver seems to work as expected for video, but a strange audio pitch-shifting problem (detailed below) persists across various Linux distributions (Fedora, Debian, Ubuntu, Arch Linux) installed freshly on two completely independent systems.

Another user has noted in the comments that (s)he can confirm the same issue on the following graphics cards:

  • XFX Radeon RX 590 Fatboy Core Edition 8GB
  • XFX Radeon RX 570 RS XXX Edition

Observations

When outputting sound through the HDMI port, all audio is pitch-shifted up, sounding like an Alvin and the Chipmunks cartoon. Depending on the application, either the playback speed is increased (to approx. 2x) to match the sped-up audio, or the playback speed is normal (1x) and the audio becomes choppy (quickly stutters on-and-off) to match it.

I have tested audio coming from many different applications and, other than fast playback to match audio vs. choppy audio to match playback described above, the sped-up audio issue is persistent across all of them. Here are a few examples:

  • System sounds: Plays approx. 2x speed
  • Mozilla Firefox (websites including YouTube, Facebook, and Yahoo News): Video plays approx. 2x speed to match audio
  • GNOME Videos (audio and video files): Plays approx. 2x speed; if there is video it speeds up to match audio
  • VLC Media Player (audio and video files): Plays at normal (1x) speed and audio is choppy
  • Battlefield 4 (running under Wine, installed via Lutris): Game play is at normal (1x) speed and audio is played at approx. 2x speed
  • GNOME Settings speaker test utility (under Settings >> Sound >> Output): Plays approx. 2x speed

Troubleshooting Steps I Have Tried

  • Install the graphics card on a completely different system and perform a fresh installation of various Linux distributions. Outcome: Same audio issue on both systems and all distros.

  • Disconnect the HDMI cable and connect a monitor via DisplayPort, then test the sound output through USB headphones. Outcome: No pitch-shifting issue, but audio exhibits crackling/fuzziness/distortion that varies in severity from intermittent to severe (unrecognizable audio).

  • Disable timer-based audio scheduling by editing /etc/pulse/default.pa as described here. Outcome: No noticeable effect (I then restored the file to its original state).

  • Remove the alsa-plugins-pulseaudio package as described here to see if the problem is with PulseAudio. Outcome: No noticeable effect (I then reinstalled the package).

  • Following the suggestion given by @dirkt in the comments, I played a known WAV file at various bitrates using aplay -t raw -r [bitrate] -f [sample format] [file name] and was able to get it to sound somewhat correct by forcing playback at half the actual bitrate of the file (e.g. for a 22050 Hz PCM, I specified -r 11025). I am not sure if this is a very useful result because essentially the file is being played at half speed and only sounds normal due to the 2x increase in speed from the pitch-shifting issue.

I have also done a lot of poking around the system (at my intermediate level of knowledge), but nothing stood out to me. I referred extensively to man pulse-cli-syntax to make use of pacmd but was not able to find a solution. In desperation, I called a friend who is an expert Linux user and regularly interfaces with hardware in Linux as part of his job. He generously spent 10 hours investigating this and was baffled. I don't think I could list all the things he tried, but he was mostly using Arch Linux to set up the sound devices from scratch. Most of his experiments involved the use of only ALSA (no PulseAudio) to minimize the number of "moving parts," though he did try a number of things with PulseAudio as well.

System Information

ALSA device listing (aplay -l) (Note: In this listing, card 0 is a USB headset I had connected for troubleshooting):

**** List of PLAYBACK Hardware Devices ****  card 0: Device [USB Audio Device], device 0: USB Audio [USB Audio]    Subdevices: 0/1    Subdevice #0: subdevice #0  card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]    Subdevices: 1/1    Subdevice #0: subdevice #0  

Note in the aplay -l output above that the device information is rather generic. In alsamixer I simply see Card: PulseAudio and Chip: PulseAudio, which I assume means that PulseAudio is handling all of the hardware specifics. Also in the above output, I expected to see four devices because this graphics card has two HDMI ports and two DisplayPort ports, but there are actually six; I do not know what the extra two HDMI devices are.

Partial output of alsa-info.sh --no-upload (part of the Alsactl output section has been omitted to satisfy the StackExchange character limit):

Please advise me if there is any sensitive information below so I can take it down.

!!################################  !!ALSA Information Script v 0.4.64  !!################################    !!Script ran on: Thu Jun 11 03:18:17 UTC 2020      !!Linux Distribution  !!------------------    Fedora release 32 (Thirty Two) NAME=Fedora ID=fedora PRETTY_NAME="Fedora 32 (Workstation Edition)" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:32" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/" SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=32 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=32 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" Fedora release 32 (Thirty Two) Fedora release 32 (Thirty Two)      !!DMI Information  !!---------------    Manufacturer:      Dell Inc.  Product Name:      OptiPlex 990  Product Version:   01  Firmware Version:  A18  Board Vendor:      Dell Inc.  Board Name:        0VNP2H      !!ACPI Device Status Information  !!---------------    /sys/bus/acpi/devices/INT3F0D:00/status      15  /sys/bus/acpi/devices/PNP0103:00/status      15  /sys/bus/acpi/devices/PNP0501:00/status      15  /sys/bus/acpi/devices/PNP0C0C:00/status      11  /sys/bus/acpi/devices/PNP0C0F:00/status      9  /sys/bus/acpi/devices/PNP0C0F:01/status      9  /sys/bus/acpi/devices/PNP0C0F:02/status      9  /sys/bus/acpi/devices/PNP0C0F:03/status      9  /sys/bus/acpi/devices/PNP0C0F:04/status      9  /sys/bus/acpi/devices/PNP0C0F:05/status      9  /sys/bus/acpi/devices/PNP0C0F:06/status      9  /sys/bus/acpi/devices/PNP0C0F:07/status      9      !!Kernel Information  !!------------------    Kernel release:    5.6.16-300.fc32.x86_64  Operating System:  GNU/Linux  Architecture:      x86_64  Processor:         x86_64  SMP Enabled:       Yes      !!ALSA Version  !!------------    Driver version:     k5.6.16-300.fc32.x86_64  Library version:      Utilities version:  1.2.2      !!Loaded ALSA modules  !!-------------------    snd_hda_intel      !!Sound Servers on this system  !!----------------------------    Pulseaudio:        Installed - Yes (/usr/bin/pulseaudio)        Running - Yes    Jack:        Installed - Yes (/usr/bin/jackd)        Running - No      !!Soundcards recognised by ALSA  !!-----------------------------     0 [HDMI           ]: HDA-Intel - HDA ATI HDMI                        HDA ATI HDMI at 0xd0b60000 irq 32      !!PCI Soundcards installed in the system  !!--------------------------------------    01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] [1002:aaf0]      Subsystem: Sapphire Technology Limited Device [1da2:aaf0]      !!Loaded sound module options  !!---------------------------    !!Module: snd_hda_intel      align_buffer_size : -1      bdl_pos_adj : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1      beep_mode : N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N      dmic_detect : Y      enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y      enable_msi : -1      id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)      index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1      jackpoll_ms : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0      model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)      patch : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)      pm_blacklist : Y      position_fix : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1      power_save : 1      power_save_controller : Y      probe_mask : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1      probe_only : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0      single_cmd : -1      snoop : -1      !!HDA-Intel Codec information  !!---------------------------  --startcollapse--    Codec: ATI R6xx HDMI  Address: 0  AFG Function Id: 0x1 (unsol 0)  Vendor Id: 0x1002aa01  Subsystem Id: 0x00aa0100  Revision Id: 0x100700  No Modem Function Group found  Default PCM:      rates [0x70]: 32000 44100 48000      bits [0x2]: 16      formats [0x5]: PCM AC3  Default Amp-In caps: N/A  Default Amp-Out caps: N/A  State of AFG node 0x01:    Power states:  D0 D3 CLKSTOP EPSS    Power: setting=D0, actual=D0, Clock-stop-OK  GPIO: io=0, o=0, i=0, unsolicited=0, wake=0  Node 0x02 [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital: Enabled    Digital category: 0x0    IEC Coding Type: 0x0  Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital    Control: name="IEC958 Playback Con Mask", index=0, device=0    Control: name="IEC958 Playback Pro Mask", index=0, device=0    Control: name="IEC958 Playback Default", index=0, device=0    Control: name="IEC958 Playback Switch", index=0, device=0    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x02  Node 0x04 [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital: Enabled    Digital category: 0x0    IEC Coding Type: 0x0  Node 0x05 [Pin Complex] wcaps 0x400381: Stereo Digital    Control: name="IEC958 Playback Con Mask", index=1, device=0    Control: name="IEC958 Playback Pro Mask", index=1, device=0    Control: name="IEC958 Playback Default", index=1, device=0    Control: name="IEC958 Playback Switch", index=1, device=0    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x04  Node 0x06 [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital: Enabled GenLevel    Digital category: 0x2    IEC Coding Type: 0x0  Node 0x07 [Pin Complex] wcaps 0x400381: Stereo Digital    Control: name="IEC958 Playback Con Mask", index=2, device=0    Control: name="IEC958 Playback Pro Mask", index=2, device=0    Control: name="IEC958 Playback Default", index=2, device=0    Control: name="IEC958 Playback Switch", index=2, device=0    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x06  Node 0x08 [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital: Enabled    Digital category: 0x0    IEC Coding Type: 0x0  Node 0x09 [Pin Complex] wcaps 0x400381: Stereo Digital    Control: name="IEC958 Playback Con Mask", index=3, device=0    Control: name="IEC958 Playback Pro Mask", index=3, device=0    Control: name="IEC958 Playback Default", index=3, device=0    Control: name="IEC958 Playback Switch", index=3, device=0    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x08  Node 0x0a [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital: Enabled    Digital category: 0x0    IEC Coding Type: 0x0  Node 0x0b [Pin Complex] wcaps 0x400381: Stereo Digital    Control: name="IEC958 Playback Con Mask", index=4, device=0    Control: name="IEC958 Playback Pro Mask", index=4, device=0    Control: name="IEC958 Playback Default", index=4, device=0    Control: name="IEC958 Playback Switch", index=4, device=0    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x0a  Node 0x0c [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital: Enabled    Digital category: 0x0    IEC Coding Type: 0x0  Node 0x0d [Pin Complex] wcaps 0x400381: Stereo Digital    Control: name="IEC958 Playback Con Mask", index=5, device=0    Control: name="IEC958 Playback Pro Mask", index=5, device=0    Control: name="IEC958 Playback Default", index=5, device=0    Control: name="IEC958 Playback Switch", index=5, device=0    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x0c  Node 0x0e [Audio Output] wcaps 0x221: Stereo Digital Stripe    Converter: stream=0, channel=0    Digital:    Digital category: 0x0    IEC Coding Type: 0x0  Node 0x0f [Pin Complex] wcaps 0x400381: Stereo Digital    Pincap 0x00000094: OUT Detect HDMI    Pin Default 0x585600f0: [N/A] Digital Out at Int HDMI      Conn = Digital, Color = Unknown      DefAssociation = 0xf, Sequence = 0x0    Pin-ctls: 0x40: OUT    Unsolicited: tag=00, enabled=0    Connection: 1       0x0e  --endcollapse--      !!ALSA Device nodes  !!-----------------    crw-rw----+ 1 root audio 116,  9 Jun 10 21:54 /dev/snd/controlC0  crw-rw----+ 1 root audio 116,  8 Jun 10 21:54 /dev/snd/hwC0D0  crw-rw----+ 1 root audio 116,  6 Jun 10 21:54 /dev/snd/pcmC0D10p  crw-rw----+ 1 root audio 116,  7 Jun 10 21:54 /dev/snd/pcmC0D11p  crw-rw----+ 1 root audio 116,  2 Jun 10 21:54 /dev/snd/pcmC0D3p  crw-rw----+ 1 root audio 116,  3 Jun 10 21:54 /dev/snd/pcmC0D7p  crw-rw----+ 1 root audio 116,  4 Jun 10 23:17 /dev/snd/pcmC0D8p  crw-rw----+ 1 root audio 116,  5 Jun 10 21:54 /dev/snd/pcmC0D9p  crw-rw----+ 1 root audio 116,  1 Jun 10 21:54 /dev/snd/seq  crw-rw----+ 1 root audio 116, 33 Jun 10 21:54 /dev/snd/timer    /dev/snd/by-path:  total 0  drwxr-xr-x. 2 root root  60 Jun 10 21:54 .  drwxr-xr-x. 3 root root 260 Jun 10 21:54 ..  lrwxrwxrwx. 1 root root  12 Jun 10 21:54 pci-0000:01:00.1 -> ../controlC0      !!ALSA configuration files  !!------------------------    !!System wide config file (/etc/asound.conf)    #  # Place your global alsa-lib configuration here...  #      !!Aplay/Arecord output  !!--------------------    APLAY    **** List of PLAYBACK Hardware Devices ****  card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 0: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]    Subdevices: 1/1    Subdevice #0: subdevice #0    ARECORD    **** List of CAPTURE Hardware Devices ****    !!Amixer output  !!-------------    !!-------Mixer controls for card HDMI    Card hw:0 'HDMI'/'HDA ATI HDMI at 0xd0b60000 irq 32'    Mixer name    : 'ATI R6xx HDMI'    Components    : 'HDA:1002aa01,00aa0100,00100700'    Controls      : 42    Simple ctrls  : 6  Simple mixer control 'IEC958',0    Capabilities: pswitch pswitch-joined    Playback channels: Mono    Mono: Playback [on]  Simple mixer control 'IEC958',1    Capabilities: pswitch pswitch-joined    Playback channels: Mono    Mono: Playback [on]  Simple mixer control 'IEC958',2    Capabilities: pswitch pswitch-joined    Playback channels: Mono    Mono: Playback [on]  Simple mixer control 'IEC958',3    Capabilities: pswitch pswitch-joined    Playback channels: Mono    Mono: Playback [on]  Simple mixer control 'IEC958',4    Capabilities: pswitch pswitch-joined    Playback channels: Mono    Mono: Playback [on]  Simple mixer control 'IEC958',5    Capabilities: pswitch pswitch-joined    Playback channels: Mono    Mono: Playback [on]      !!Alsactl output  !!--------------    --startcollapse--  state.HDMI {      control.1 {          iface CARD          name 'HDMI/DP,pcm=3 Jack'          value false          comment {              access read              type BOOLEAN              count 1          }      }      control.2 {          iface MIXER          name 'IEC958 Playback Con Mask'          value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.3 {          iface MIXER          name 'IEC958 Playback Pro Mask'          value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.4 {          iface MIXER          name 'IEC958 Playback Default'          value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access 'read write'              type IEC958              count 1          }      }      control.5 {          iface MIXER          name 'IEC958 Playback Switch'          value true          comment {              access 'read write'              type BOOLEAN              count 1          }      }      control.6 {          iface PCM          device 3          name ELD          value ''          comment {              access 'read volatile'              type BYTES              count 0          }      }      control.7 {          iface CARD          name 'HDMI/DP,pcm=7 Jack'          value false          comment {              access read              type BOOLEAN              count 1          }      }      control.8 {          iface MIXER          name 'IEC958 Playback Con Mask'          index 1          value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.9 {          iface MIXER          name 'IEC958 Playback Pro Mask'          index 1          value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.10 {          iface MIXER          name 'IEC958 Playback Default'          index 1          value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access 'read write'              type IEC958              count 1          }      }      control.11 {          iface MIXER          name 'IEC958 Playback Switch'          index 1          value true          comment {              access 'read write'              type BOOLEAN              count 1          }      }      control.12 {          iface PCM          device 7          name ELD          value ''          comment {              access 'read volatile'              type BYTES              count 0          }      }      control.13 {          iface CARD          name 'HDMI/DP,pcm=8 Jack'          value true          comment {              access read              type BOOLEAN              count 1          }      }      control.14 {          iface MIXER          name 'IEC958 Playback Con Mask'          index 2          value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.15 {          iface MIXER          name 'IEC958 Playback Pro Mask'          index 2          value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.16 {          iface MIXER          name 'IEC958 Playback Default'          index 2          value '0482000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access 'read write'              type IEC958              count 1          }      }      control.17 {          iface MIXER          name 'IEC958 Playback Switch'          index 2          value true          comment {              access 'read write'              type BOOLEAN              count 1          }      }      control.18 {          iface PCM          device 8          name ELD          value '10000c006972005f000000000000000011ee450044454e4f4e2d4156520f7f071507503d1ec05706015f7e03677e015f7e010000'          comment {              access 'read volatile'              type BYTES              count 52          }      }      control.19 {          iface CARD          name 'HDMI/DP,pcm=9 Jack'          value false          comment {              access read              type BOOLEAN              count 1          }      }      control.20 {          iface MIXER          name 'IEC958 Playback Con Mask'          index 3          value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.21 {          iface MIXER          name 'IEC958 Playback Pro Mask'          index 3          value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access read              type IEC958              count 1          }      }      control.22 {          iface MIXER          name 'IEC958 Playback Default'          index 3          value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'          comment {              access 'read write'              type IEC958              count 1          }      }        ***REMAINDER OF "Alsactl output" SECTION TRUNCATED DUE TO StackExchange CHARACTER LIMIT***    --endcollapse--      !!All Loaded Modules  !!------------------    amd_iommu_v2  amdgpu  br_netfilter  bridge  coretemp  crc32_pclmul  crc32c_intel  crct10dif_pclmul  dcdbas  drm  drm_kms_helper  e1000e  fat  fuse  ghash_clmulni_intel  gpu_sched  i2c_algo_bit  i2c_i801  iTCO_vendor_support  iTCO_wdt  intel_cstate  intel_powerclamp  intel_rapl_common  intel_rapl_msr  intel_rapl_perf  intel_uncore  ip6_tables  ip6table_filter  ip6table_mangle  ip6table_nat  ip6table_raw  ip6table_security  ip_set  ip_tables  ipt_REJECT  iptable_filter  iptable_mangle  iptable_nat  iptable_raw  iptable_security  irqbypass  kvm  kvm_intel  libcrc32c  llc  lpc_ich  mei  mei_hdcp  mei_me  mei_wdt  nf_conntrack  nf_conntrack_broadcast  nf_conntrack_netbios_ns  nf_conntrack_tftp  nf_defrag_ipv4  nf_defrag_ipv6  nf_nat  nf_nat_tftp  nf_reject_ipv4  nf_reject_ipv6  nf_tables  nf_tables_set  nfnetlink  nft_chain_nat  nft_ct  nft_fib  nft_fib_inet  nft_fib_ipv4  nft_fib_ipv6  nft_objref  nft_reject  nft_reject_inet  pcspkr  rfkill  serio_raw  snd  snd_hda_codec  snd_hda_codec_hdmi  snd_hda_core  snd_hda_intel  snd_hwdep  snd_intel_dspcfg  snd_pcm  snd_seq  snd_seq_device  snd_timer  soundcore  stp  sunrpc  ttm  tun  uinput  vfat  video  x86_pkg_temp_thermal  xt_CHECKSUM  xt_MASQUERADE  xt_conntrack      !!Sysfs Files  !!-----------    /sys/class/sound/hwC0D0/init_pin_configs:  0x03 0x185600f0  0x05 0x185600f0  0x07 0x185600f0  0x09 0x185600f0  0x0b 0x185600f0  0x0d 0x185600f0  0x0f 0x585600f0    /sys/class/sound/hwC0D0/driver_pin_configs:    /sys/class/sound/hwC0D0/user_pin_configs:    /sys/class/sound/hwC0D0/init_verbs:    /sys/class/sound/hwC0D0/hints:      !!ALSA/HDA dmesg  !!--------------    [    0.322550] ACPI: Added _OSI(Linux-Dell-Video)  [    0.322553] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)  [    0.322554] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)  --  [    5.091375] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)  [    5.091462] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)  [    5.096920] snd_hda_intel 0000:01:00.1: Force to non-snoop mode  [    5.110782] snd_hda_intel 0000:01:00.1: bound 0000:01:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])  [    5.111353] RAPL PMU: API unit is 2^-32 Joules, 3 fixed counters, 163840 ms ovfl timer  --  [    5.111355] RAPL PMU: hw unit of domain pp1-gpu 2^-16 Joules  [    5.111797] input: HDA ATI HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input11  [    5.111861] input: HDA ATI HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input12  [    5.111921] input: HDA ATI HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input13  [    5.111979] input: HDA ATI HDMI HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input14  [    5.112038] input: HDA ATI HDMI HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input15  [    5.112095] input: HDA ATI HDMI HDMI/DP,pcm=11 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input16  [    5.176237] kauditd_printk_skb: 70 callbacks suppressed    

How to set the timezone of a Linux host to BRT (Brasilia Time)?

Posted: 25 Oct 2021 10:05 AM PDT

I've a scenario that needs the timezone on the host to be BRT which is currently PST. I'm expecting the result of date to appear like Wed Jan 30 19:30:36 BRT 2020

I've checked the /etc/localtime which is currently linked to /usr/share/zoneinfo/America/Los_Angeles. I tried changing this to all of the following [*] one by one, but none of them are giving me BRT. I see either one or two hours less/more.

Am I missing anything here? or Is there any other way to set the timezone to BRT?

[*]

/usr/share/zoneinfo/Brazil/West  /usr/share/zoneinfo/Brazil/East  /usr/share/zoneinfo/Brazil/DeNoronha  /usr/share/zoneinfo/Brazil/Acre  

How can I make Linux use super instead of ctrl as the main modifier key?

Posted: 25 Oct 2021 09:19 AM PDT

My issue is that I use Ctrl as a modifier in my Vim mappings. I use Alt as a modifier in my TMUX mappings. And coming from the Mac, I've grown accustom to using Command (i.e. Super) as the modifier for general OS shortcuts.

I've seen several posts on remapping keys, and perhaps I don't understand what that means in Linux terms, but I'm NOT looking to press Super+N (ex: New window) and have that send Ctrl+N to Linux. Doing this would mean my OS shortcuts would be in the same Ctrl namespace as my Vim mappings, which introduces collisions.

Is there a way to force Linux to respond to Super+some command key for all the built-in defaults that would otherwise expect Ctrl+some command key?

In other words, can I force Linux to use Super instead of Ctrl?

How to find last n newest files for each of multiple directories

Posted: 25 Oct 2021 09:40 AM PDT

I am trying to find a ways how to find last n newest files for multiple directories.

The problem with that is that the directories are structured, but not really hierarchical placed, but they have specific names. Example:

./sensor  -./motion  --./2dMotion  ---./saved  ----./<name>.csv  ---./processed  ----./<name>.csv  --./3dMotion  ---./saved  ---./processed  -./temp  --./saved  ---./<name>.csv  --./processed  

The problem for me is the following: I can use -regex option in the find command, but that can give me only newest files after further commands for search filtering newest file, but that is only valid for the latest file regardless of the sensor that is used.

What am I trying to achieve is to create output in which the latest n files would be shown based on the time stamp.

How can I do that as simply as possible?

Command-line tool to get "click and drag" rectangle coordinates from the screen [duplicate]

Posted: 25 Oct 2021 08:01 AM PDT

I would like to execute a command-line command that activates "click and drag" mouse selection on a single local X11 screen.

The goal is to:

  • get the selected rectangle X and Y coordinates,
  • get the rectangle width and height,
  • output these values to stdout,
  • (optional) draw a selection border while dragging the mouse.

Reverse a hexadecimal number in bash

Posted: 25 Oct 2021 09:06 AM PDT

Is there a simple command to reverse an hexadecimal number?

For example, given the hexadecimal number:

030201  

The output should be:

010203  

Using the rev command, I get the following:

102030  

Update

$ bash --version | head -n1  GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)  $ xxd -version  xxd V1.10 27oct98 by Juergen Weigert  $ rev --version  rev from util-linux 2.20.1  

how to check if both parameters are set in bash? [closed]

Posted: 25 Oct 2021 08:56 AM PDT

Say I have a executable bash file script.sh.

I want to use it as

./script.sh p1 p2  

p1 and p2 are two necessary parameters for this command. If either one of them is missing, the command should fail.

So I need to check them before go on executing further in script.sh. How could I check both of them are set?

updated:

I tried this:

# this is a comment line  if [ -n "$1" ] || [ -n "$2" ]; then      then echo 'haha'  fi  

but got:

./_scp.sh: line 3: syntax error near unexpected token `then'  ./_scp.sh: line 3: `    then echo 'haha''  

How to launch shell script with double click in CentOS 7

Posted: 25 Oct 2021 08:19 AM PDT

I need to be able to execute an executable shell script (sh) with a double click. I set the executable flag on the permissions for the file, and yet when I double click on it, it opens in a text editor. I do not have any options in my UI under the files properties menu to use a custom command or anything. It only lists various applications which are installed. I just want it to execute, nothing more. How can I accomplish this?

Mysql database didn't connect through sqlyog or any other mysql software?

Posted: 25 Oct 2021 09:07 AM PDT

I can connect to a MySQL server through a browser and also I can show all database list through PuTTY. But when I try to use sqlyog or running the mysqldump command through PuTTY it shows this error:

ERROR NO:2003 cannot connect to mysql server on "****"

How I give these tools permission?

I use this command

mysqldump -h "1st IP Address" -u username -ppasswprd DB Name | mysql -h "2nd IP Address" -u username -ppasswprd DB Name  

I get that ERROR

mysqldump: Got error: 1130: Host '2nd IP Address' is not allowed to connect to this MySQL server when trying to connect  

How to check integrity to HDD with UDF format

Posted: 25 Oct 2021 08:05 AM PDT

I'm having problem with a USB external drive, which seem to be formatted with UDF and was being used for MAC and Windows (or at least that is what told).

When I attached the HDD to my Linux system the next are the dmesg entries:

[21784.312960] usb 2-1.2: new high-speed USB device number 5 using ehci-pci  **[21784.406283] usb 2-1.2: New USB device found, idVendor=1058, idProduct=1023**  [21784.406291] usb 2-1.2: New USB device strings: Mfr=1,Product=2,SerialNumber=3  [21784.406296] usb 2-1.2: Product: Elements 1023  **[21784.406299] usb 2-1.2: Manufacturer: Western Digital**  [21784.406303] usb 2-1.2: SerialNumber: <The serial number>  [21784.406815] scsi8 : usb-storage 2-1.2:1.0  [21785.403470] scsi 8:0:0:0: Direct-Access     WD       Elements 1023    2005 PQ: 0 ANSI: 4  [21785.404686] sd 8:0:0:0: Attached scsi generic sg2 type 0  [21785.409491] sd 8:0:0:0: [sdb] 1953519616 512-byte logical blocks: (1.00 TB/931 GiB)  [21785.410605] sd 8:0:0:0: [sdb] Test WP failed, assume Write Enabled  [21785.411723] sd 8:0:0:0: [sdb] Asking for cache data failed  [21785.411729] sd 8:0:0:0: [sdb] Assuming drive cache: write through  [21785.413600] sd 8:0:0:0: [sdb] Test WP failed, assume Write Enabled  [21785.414603] sd 8:0:0:0: [sdb] Asking for cache data failed  [21785.414609] sd 8:0:0:0: [sdb] Assuming drive cache: write through  **[21785.449997]  sdb: sdb1 < >**  [21785.452466] sd 8:0:0:0: [sdb] Test WP failed, assume Write Enabled  [21785.453503] sd 8:0:0:0: [sdb] Asking for cache data failed  [21785.453515] sd 8:0:0:0: [sdb] Assuming drive cache: write through  [21785.453524] sd 8:0:0:0: [sdb] Attached SCSI disk  

With that information the HDD seem to be OK. However I'm unable to identify the type of partition (some commands from Windows console show is UDF but I can't confirm with Linux counterparts)

Trying to get more information, the fdisk -l outputs:

Disk /dev/sdb: 1000.2 GB, 1000202043392 bytes  255 heads, 63 sectors/track, 121600 cylinders, total 1953519616 sectors  Units = sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  Disk identifier: 0x0bba88f0       Device Boot      Start         End      Blocks   Id  System  /dev/sdb1               0  1953519615   976759808    5  Extended  fdisk: unable to read /dev/sdb1: Inappropriate ioctl for device  

As the partition doesn't mount, tools like testdisk and fsck can't work here (well testdisk and photorec just freeze trying to read the HDD). And due the size of the disk the badblocks command takes a lot of time (and is still running).

I can't find many material about the UDF format (and I don't understand why a HDD use it when is ) and neither what to do when is unable to read any partition at all.

Any suggestion?

No comments:

Post a Comment