Saturday, May 29, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to start with sudo privileges every time I run terminal with CTRL+ALT+T

Posted: 29 May 2021 04:55 PM PDT

I'm using Kali Linux and I want to start with sudo privileges every time I run the terminal using CTRL+ALT+T.

I tried this solution but it's not working:

is-there-a-way-to-stop-having-to-write-sudo-for-every-little-thing-in-linux

Is there a way to do it ?

Thanks in advance.

zip - difference between "." and "* .[^.]*" patterns

Posted: 29 May 2021 04:43 PM PDT

While recursively zipping a directory (including hidden files), is there any difference between:

zip ../foo.zip -r .  

and:

zip ../foo.zip -r * .[^.]*  

or are they exactly the same?

Second command, if i'm not wrong, matches all non-dot-files (first *) and then all files starting with . char, followed by any char but dot ([^.]) - so this excludes .. going to parent directory. I found * .[^.]* in some examples but i dont get the point of using it in place of a simple . if it acts exactly the same way.

Also in POSIX shell script, ShellCheck complains about * .[^.]* notation which should be replaced with ./* .[!.]*, and to me this is another good reason to not use it, if a simple . does the same job.

Wired internet works for few seconds on Debian

Posted: 29 May 2021 03:47 PM PDT

I recently changed my isp, and after that I started having some issues when connecting to the internet on my Debian 10. At first, I thought that it might be my ISPs fault, but the internet is working fine on Windows (Ive dual boot) and on my phone (wifi). On Debian, the internet works for few seconds, enought to load 1 page, but after that doesnt work anymore. I already tried to increase MTUs value, since looked like it helped others who had this problem, but didn't work for me. Also, i tested using my Laptop, which also has Debian 10 installed, it worked. I tested using cable and wifi.

Download file from URL with redirection, "?" and other symbols, from the command line

Posted: 29 May 2021 03:12 PM PDT

I mean to download eclipse-parallel-2021-03-R-linux-gtk-x86_64.tar.gz from URL https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2021-03/R/eclipse-parallel-2021-03-R-linux-gtk-x86_64.tar.gz&mirror_id=576, from the command line.

I tried (option -o to change file name)

curl -O -J -L -o "eclipse-parallel-2021-03-R-linux-gtk-x86_64b.tar.gz" "https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2021-03/R/eclipse-parallel-2021-03-R-linux-gtk-x86_64.tar.gz&mirror_id=576"

and also without -O -J. I got a file of 22Kb instead of the actual file ~320MB.

What is the correct way of doing this?

Setting ACLs correctly for -rw-r--r--+

Posted: 29 May 2021 03:17 PM PDT

I've been able to set the default ACL permissions for new files like so:

sudo setfacl -Rdm u:usernamehere:rwx /var/www/path/to/files  

This seems to give all new files a permission of:

-rw-r-----+  

I'm hoping to have new files get a permission of the following instead:

-rw-r--r--+  

If it makes any difference, I'm running CentOS.

Any help on this is much appreciated.

Thanks!

squashed then re-squashed give different size?

Posted: 29 May 2021 02:19 PM PDT

I extracted a firmware.bin using fmk mod kit and gave me 3 files: header.img , rootfs.img and footer.img now whenever I cat and repack all the files together in firmware2.bin again, it works and it upgrades the router. but when I unsquash the rootfs.img using this command unsquashfs rootfs.img into squashfs-root/ then I squash it again using mksquashfs rootfs-root/ squash_new.img -comp lzma -b 131072 "which it by the way the same compression method and block size as the original rootfs.img" but it gives me a less size comparing to the rootfs.img and the router gives me upgrade failed

here are the sizes of the 2 files

squash_new.img (9,945,088 bytes)

rootfs.img (9,945,232 bytes)

is there a problem with unsquashfs or mksquashfs?

because when I used a hex editor software, I noticed some entries are different although I have not changed anything.

EDIT someone suggested that the header.img file could contain the information about the rootfs.img file and any change could cause an upgrade failed issue unless I match it with the info inside the header.img , how would I edit the header.img file, I can't unsquash it, only view it as hex and all the text inside is rubbish.

Can I install another Linux distribution to an extra HDD without rebooting?

Posted: 29 May 2021 03:52 PM PDT

I have a computer with a Linux distribution installed on partitions in drive /dev/sda. I also have another physical drive, /dev/sdb.

I want to install Linux to the second physical drive - to later run either on the same computer or another one. I know the planned hardware configuration of the target machine, and I have an installer for my new Linux distribution (say on a third drive, /dev/sdc, or in an ISO I can mount etc.)

Can I perform the installation without rebooting? That is, other than in the usual way of booting from an installation medium?

If this question is too general, then - can I do so with Debian Buster/Devuan Beowulf?

Note: You may make any reasonable assumption about the system, but please state it explicitly.

There is any way to block specific apps on snap or flatpak so these can't be installed on my computer?

Posted: 29 May 2021 01:59 PM PDT

I want to prevent the installation of some really distracting apps on my computer. I can do this on Apt by modifying a configuration file. But I haven't managed to do the same on Snap or Flatpak. I need either one of those stores to install some applications since some applications I use have dependencies problems. I tried to search an answer on the store documentation but I didn't found anything. I'm not an expert on this area so any help is welcome.

How do I do the required route(s) for getting internet traffic to/from my client assigned public IPv4s on my L2TP server

Posted: 29 May 2021 01:47 PM PDT

I have a server running Ubuntu Server 20.04 which has two ethernet interfaces and is hosting the L2TP server (using accel-ppp).

'eno1' has a single public IPv4 address assigned.

'eno2' has access to a /26 public IPv4 block which I'd like to make use of from another location via an L2TP server. Details further down.

Now what I'm trying to do is make it so my router, at another location, can connect to the L2TP server and have a public facing IPv4 as well as a /27 public IPv4 routed to it from splitting the /26 public IPv4 mentioned earlier. For example, x.x.161.64/27.

While I can ping the IP of the router connected to the L2TP server, from the L2TP server, as well as any /27 IPv4 I assigned via the router's LAN, I can't figure out how to get a route to the internet or beyond presumably the L2TP server's own gateway IP (x.x.161.122).

eno1

IP address:  x.x.176.62 (public IPv4)  Subnet mask: 255.255.255.0  Gateway IP:  x.x.176.254  

eno2

IP address:  x.x.161.125 (public IPv4)  Subnet mask: 255.255.255.252 (split from what is actually a /26)  Gateway IP:  x.x.161.126  

My router assigned IP addresses, that's connecting to the L2TP server but aren't currently able to access the internet or go beyond x.x.161.122 (the L2TP server's gateway IP address - I believe) it seems.

x.x.161.121/30  x.x.161.64/27  

On this Ubuntu server I have accel-ppp installed and configured as an L2TP server. In /etc/accel-ppp.conf I have the following:

[modules]  log_file    pptp  l2tp    auth_mschap_v2  auth_mschap_v1  auth_pap    chap-secrets    ippool    pppd_compat    [core]  log-error=/var/log/accel-ppp/core.log  thread-count=4    [common]  single-session=replace    [ppp]  verbose=1  min-mtu=1280  mtu=1400  mru=1400  ipv4=require  ipv6=deny  ipv6-intf-id=0:0:0:1  ipv6-peer-intf-id=0:0:0:2  ipv6-accept-peer-intf-id=1  lcp-echo-interval=1  lcp-echo-failure=5  lcp-echo-timeout=120  unit-cache=1    [pptp]  verbose=1  #echo-interval=30  #ip-pool=pptp  #ipv6-pool=pptp  #ipv6-pool-delegate=pptp  ifname=pptp%d    [l2tp]  verbose=1  ifname=l2tp%d    [dns]  dns1=8.8.8.8  dns2=8.8.4.4    [client-ip-range]  disable    [ip-pool]  gw-ip-address=x.x.161.122  attr=Framed-Pool  x.x.161.121/30    [log]  log-file=/var/log/accel-ppp/accel-ppp.log  log-emerg=/var/log/accel-ppp/emerg.log  log-fail-file=/var/log/accel-ppp/auth-fail.log  copy=1  level=3    [pppd-compat]  verbose=1    [chap-secrets]  chap-secrets=/etc/ppp/chap-secrets  

Current ip route:

default via x.x.161.126 dev eno2 proto static  default via x.x.176.254 dev eno1 proto dhcp src x.x.176.62 metric 100  x.x.176.0/24 dev eno1 proto kernel scope link src x.x.176.62  x.x.176.254 dev eno1 proto dhcp scope link src x.x.176.62 metric 100  x.x.161.64/27 via x.x.161.121 dev l2tp0  x.x.161.121 dev l2tp0 proto kernel scope link src x.x.161.122  x.x.161.124/30 dev eno2 proto kernel scope link src x.x.161.125  

Current route:

Kernel IP routing table  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  default         x.x.161.126     0.0.0.0         UG    0      0        0 eno2  default         x.x.176.254     0.0.0.0         UG    100    0        0 eno1  x.x.176.0       0.0.0.0         255.255.255.0   U     0      0        0 eno1  x.x.176.254     0.0.0.0         255.255.255.255 UH    100    0        0 eno1  x.x.161.64      x.x.161.121     255.255.255.224 UG    0      0        0 l2tp0  x.x.161.121     0.0.0.0         255.255.255.255 UH    0      0        0 l2tp0  x.x.161.124     0.0.0.0         255.255.255.252 U     0      0        0 eno2  

Current ifconfig:

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet x.x.176.62  netmask 255.255.255.0  broadcast x.x.176.255          inet6 x:x:x:x::  prefixlen 56  scopeid 0x0<global>          inet6 fe80::d250:99ff:feda:91b6  prefixlen 64  scopeid 0x20<link>          ether d0:50:99:da:91:b6  txqueuelen 1000  (Ethernet)    eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet x.x.161.125  netmask 255.255.255.252  broadcast x.x.161.127          inet6 fe80::d250:99ff:feda:91b5  prefixlen 64  scopeid 0x20<link>          ether d0:50:99:da:91:b5  txqueuelen 1000  (Ethernet)    l2tp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1400          inet 198.244.161.122  netmask 255.255.255.255  destination x.x.161.121          ppp  txqueuelen 3  (Point-to-Point Protocol)  

How would I go about making it so, for example, the router IP address x.x.161.121 would be able to reach the internet and be reachable from the internet? Presumably it would need to somehow have a route to x.x.161.126, the gateway IP address of the entire original /26 IPv4 block.

If there's a simpler or different approach I should be taking please say. I don't want to do NAT as that I imagine defeats what I'm trying to do.

Hopefully I've been reasonably clear and provided plenty of details, if there's more details you need please ask. I've been trying to get my head round this for nearly two days. Playing around with changing routes is a little new to me. Thanks in advance for any assistance!

Linux 2.4, Non-Preemptible Kernel?

Posted: 29 May 2021 01:33 PM PDT

I know the difference between CPU bound and I\O bound and saw the following question in the book I am reading from:

Between these two which one will be affected (in terms of performance) when running under non-Preemptible kernel? related to both of them and try to understand why the other won't be affected.

Please Note: we are talking about non-Preemptible kernel, not user space.

But I was wondering why any of them will be affected at all, let's say I opened a word files which runs a single process A. It's clear that A is I\O bound. Now when a user types something in the keyboard process A runs in kernel mode, so instead of the usual case of just requesting input from OS and leaving we have to wait until the input is ready (since now in kernel mode ad process can't be stopped in middle).

But how this affects performance at all? Am I missing something?

And what about CPU bound?

Difference between command `command` vs command `builtin` in Shell Scripting

Posted: 29 May 2021 04:31 PM PDT

I understand the command command is specified in the latest POSIX standard and builtin is not. I also realize that both commands are regular builtins (i.e. they can be overwritten by user-defined functions). Some shells define builtin, but not all (e.g. dash does not). I want to understand why builtin was introduced in some shells.

To the best of my understanding, builtin will only return special and then regular built-ins, but command will return special built-ins, then regular built-ins, then commands on the path (and the -p switch can be used with command to specify it to use the shell-defined default $PATH in case the user has modified the $PATH).

For example, in mksh, I see the following:

(NOTE: mksh installed on Ubuntu 20.04 from repo http://archive.ubuntu.com/ubuntu focal/universe amd64 mksh amd64 58-1)

$ echo $KSH_VERSION  @(#)MIRBSD KSH R58 2020/03/27  $ which -a echo  /usr/bin/echo  /bin/echo  $ which -a printf  /usr/bin/printf  /bin/printf  $ type echo  echo is a shell builtin  $ type printf  printf is /usr/bin/printf  $ command echo 'Hello World!'  Hello World!  $ command printf 'Hello World!\n'  Hello World!  $ builtin echo 'Hello World!'  Hello World!  $ builtin printf 'Hello World!\n'  mksh: builtin: printf: not found  $ sudo cp /usr/bin/printf /usr/bin/printf.backup  $ sudo cp /bin/printf /bin/printf.backup  $ sudo rm /usr/bin/printf  $ sudo rm /bin/printf  rm: cannot remove '/bin/printf': No such file or directory  $ sudo cp /usr/bin/printf.backup ~/printf  $ echo $PATH | sed 's/:/\n/g'  /usr/local/sbin  /usr/local/bin  /usr/sbin  /usr/bin  /sbin  /bin  /usr/games  /usr/local/games  # ...remainder ommitted here for brevity  $ export PATH=~:$PATH  $ echo $PATH | sed 's/:/\n/g'  /home/my_username  /usr/local/sbin  /usr/local/bin  /usr/sbin  /usr/bin  /sbin  /bin  /usr/games  /usr/local/games  # ...remainder ommitted here for brevity  $ command printf 'Hello World!\n'  Hello World!  $ command -p printf 'Hello World!\n'  mksh: printf: inaccessible or not found  

Is my understanding correct? Or, do command and builtin do exactly the same thing (and if so, why was builtin introduced?)? Or, is there another subtle difference between command and builtin?

(I've tried searching for an answer on StackExchange, but haven't found anything, so if anyone can point me to a suitable answer I'd be much obliged.)

How to send emails to multiple recipients with each getting a different attachment using mail command from terminal?

Posted: 29 May 2021 02:32 PM PDT

Here is my scenario. I have a txt file. emailADD.txt. it contains email ids every line

abcd123@gmail.com  efgh123@gmail.com  jklm456@gmail.com  

And i have files in a folder

abc.pdf  def.pdf  hij.pdf  

and so on

i want a script to send email to the first id with the first attachment. then another email to second id with the second attachment and so on.

both email ids and the attachments will be stored in alphabetical order. the number of email ids and attachments stored will be equal.

Please suggest.

I have this idea from jesse_b but it doesn't involve different attachments to each email id.

#!/bin/bash  file=/location/of/emailAdd.txt    while       read -r email;       do        #printf '%s\n' 'Hello, world!' | sudo mail -s 'This is the email subject' "$email"      done < "$file"  

Renaming a file by passing an awk output on a *.tsv file

Posted: 29 May 2021 04:59 PM PDT

Have data and *.tsv file where data is described. Would like to use the description and rename the data accordingly.

Please have a look :

  • awk command to filter the tsv give this:

common_voice_en_22090684.mp3 four

common_voice_en_22090691.mp3 no

common_voice_en_22090696.mp3 one

  • go through the directory where the *.mp3 are:

for i in *.mp3 ; do echo $i

  • mv is command to rename the file and it takes two arguments (the file to change, and with what)

How to use awk (to read and use the description) and mv (to rename the existing files with the passed description? So, looking at the above example, the result would be :

four.mp3
no.mp3
one.mp3

It is not important to use the suggested commands. Any ideas, suggestions how to do this are most welcome!

4.19 kernel does not enter suspend/sleep and freezes system, but 4.9 works fine

Posted: 29 May 2021 02:56 PM PDT

The 4.9 kernel will be EOL in just a few years and Debian 9 (stretch) just next year. So, I'd like to move on.

Everything works perfectly on the 4.9 kernel on this macbook (MacBookPro8), including sleep/suspend.

However, each time I try the 4.19 kernel, the one used by Debian 10 by default, it never suspends correctly. When I close the lid on my laptop, the screen goes black/blank, but it doesn't suspend. What's more, I cannot do anything from this "resumed" empty screen; even ALT-CTL-F1 does not work. Only the power button is an option to reboot/restart the system. (I'm not sure how I'd do the ALT-PrtScr-REISUB on this mac keyboard.)

I looked in /var/log/syslog and I do not see it even attempting to suspend upon lid close. Perhaps one of the triggers in /proc/acpi/wakeup is not pushing it into suspend state?

I'm running 1.4.1 of pm-utils.

I have not tried the 5.x series of kernels, but I can only assume that they would have the same problem as 4.19.

I'd be willing to run 4.9 indefinitely, even after EOL, with all possible security holes and all, just to keep the suspend functionality, but I'd prefer not to.

Regardless, my question is: how can I get my macbook to suspend and resume using the 4.19 kernel?

Small update: I just tried 4.19 on my Dell laptop and suspend works perfectly. So, it's possible that it's something about the macbook hardware.

Using dd to create an image up to an specific sector

Posted: 29 May 2021 04:07 PM PDT

I have a 32GB SD Card that contains an Armbian installation for some pi gadget. I want to clone the content into a 16GB card. Using GParted, I shrank the partitions to be less than 16GB and here is the state of the SD Card as shown in fdisk. There are 2 partitions, one is the Armbian and the other one is an small FAT32 partition to share files with windows.

Disk /dev/sdk: 29,74 GiB, 31914983424 bytes, 62333952 sectors  Disk model: USB3.0 CRW-SD/MS  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  Disklabel type: dos  Disk identifier: 0x22563e30    Device     Boot    Start      End  Sectors  Size Id Type  /dev/sdk1           8192 25690111 25681920 12,3G 83 Linux  /dev/sdk2       25690112 26509311   819200  400M  b W95 FAT32  

Can you please tell me what would I need to do now to exactly clone what is on the card, including the boot partition? It is strange that the Armbian leaved 8129 sectors free, and calls it unpartitioned space, what is in that area?

If I do something like:

dd if=/dev/sdk of=/home/user/backup.iso  

It will create an image with size 32GB.... but I want it to be limited to the last sector of /dev/sdk2.

How to send curl request with post data imported from a file

Posted: 29 May 2021 02:20 PM PDT

I have a below curl command which works fine and I get the response back. I am posting json data to an endpoint which gives me response back after hitting it.

curl -v 'url' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: url' --data-binary '{"query":"\n{\n  data(clientId: 1234, filters: [{key: \"o\", value: 100}], key: \"world\") {\n    title\n    type\n    pottery {\n      text\n      pid\n      href\n      count\n      resource\n    }\n  }\n}"}' --compressed  

Now I am trying to read the binary data from temp.txt file outside but somehow it doesn't work and I get an error -

curl -v 'url' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: url' --data-binary "@/Users/david/Downloads/temp.txt" --compressed  

Below is the content I have in my temp.txt file -

Original "temp.txt" file

{    data(clientId: 1234, filters: [{key: "o", value: 100}], key: "world") {      title      type      pottery {        text        pid        href        count        resource      }    }  }  

This is the error I am getting -

.......  * upload completely sent off: 211 out of 211 bytes  < HTTP/1.1 500 Internal Server Error  < date: Fri, 28 May 2021 23:38:12 GMT  < server: envoy  < content-length: 0  < x-envoy-upstream-service-time: 1  <  * Connection #0 to host url left intact  * Closing connection 0  

Is there anything wrong I am doing?

Also if I copy the exact same content in the temp.txt file that I have in my original curl command with \n in it then it works fine.

Updated "temp.txt" file

Meaning if I keep the content like this in temp.txt file then it works fine from my second curl -

{"query":"\n{\n  data(clientId: 1234, filters: [{key: \"o\", value: 100}], key: \"world\") {\n    title\n    type\n    pottery {\n      text\n      pid\n      href\n      count\n      resource\n    }\n  }\n}"}  

It means I need to find a way to convert new lines to \n manually from temp.txt file before sending the curl request or is there any other way?

Shell-/Bash-Script to delete old backup files by name and specific pattern

Posted: 29 May 2021 04:05 PM PDT

every our backup files of a database are created. The files are named like this:

prod20210528_1200.sql.gz   pattern: prod`date +\%Y%m%d_%H%M`  

The pattern could be adjusted if needed.

I would like to have a script that:

  • keeps all backups for the last x (e.g. 3) days
  • for backups older than x (e.g. 3) days only the backup from time 00:00 shall be kept
  • for backups older than y (e.g. 14) days only one file per week (monday) shall be kept
  • for backups older than z days (e.g. 90) only one file per month (1st of each month) shall be kept
  • the script should rather use the filename instead of the date (created) information of the file, if that it possible
  • the script should run every day

Unfortunately, I have very little knowledge of the shell-/bash-script language. I would do something like this:

if (file < today - x AND date > today - (x + 1))  {    if (%H_of_file != 00 AND %M_of_file != 00)    {        delete file    }  }    if (file < today - y AND date > today - (y + 1))  {    if (file != Monday)    {        delete file    }  }    if (file < today - z AND date > today - (z + 1))  {    if (%m_of_file != 01)    {        delete file    }  }    Does this makes any sense for you?    Thank you very much!     All the best,  Phantom      

How to add a column to file that is matched to another column?

Posted: 29 May 2021 02:46 PM PDT

How to match the first column from file1 according to the numbers in the second column to the file 2?

file1

k002  25  k004  54  k003  23  

file2

25 h  23 j  54 hg  

desired output

k002 25 h  k003 23 j  k004 54 hg  

I have no idea how to do that and I did not found similar questions.

awk 'matching {print ... $1, $2}' file1 file2 > file_des  

Is it possible to force a program that ignores signals to quit on ctrl-C?

Posted: 29 May 2021 05:04 PM PDT

I have a program that ignores SIGINT but that I want to run in the foreground. I would like to find a way to force it to close on Ctrl-C. Is there any way to write a wrapper (that you'd call ./wrapper.sh my_program) that would force the misbehaving program to quit, potentially by detecting the ignored SIGINT and generating a SIGKILL?

This answer is the exact opposite of what I am looking for -- I would like to force a program that ignores a signal to quit on SIGINT.

Install GuixSD using an existing Linux system

Posted: 29 May 2021 02:27 PM PDT

I want to install Guix System Distribution (or GuixSD, or just Guix) alongside some other distros. The problem is, Guix doesn't recognise Realtek drivers, which are nonfree, so I can't use WiFi. I can install Guix with Ethernet, but it is very unstable, so I want to install it with my existing Debian (buster) installation so I can then add the Nonguix channel and install the drivers. Problem is, I don't really know how.

I'm pretty sure it includes installing Guix onto Debian, installing some packages, and strapping GuixSD onto the root (atleast, that's how NixOS does it, which Guix is inspired by) or it includes chrooting into the ISO.

I would appreciate any help possible.

System Info

# neofetch # some info was filtered    root@deblugo   ---------------   OS: Debian GNU/Linux 10 (buster) x86_64   Host: HP Notebook   Kernel: 4.19.0-16-amd64   Packages: 1624 (dpkg)   Shell: bash 5.0.3    CPU: Intel Celeron N3060 (2) @ 2.480GHz   GPU: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx   Memory: 1931MiB / 3803MiB     # lsb_release -a  No LSB modules are available.  Distributor ID: Debian  Description:    Debian GNU/Linux 10 (buster)  Release:    10  Codename:   buster    # uname -a  Linux deblugo 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux    # cat /etc/os-release  PRETTY_NAME="Debian GNU/Linux 10 (buster)"  NAME="Debian GNU/Linux"  VERSION_ID="10"  VERSION="10 (buster)"  VERSION_CODENAME=buster  ID=debian  HOME_URL="https://www.debian.org/"  SUPPORT_URL="https://www.debian.org/support"  BUG_REPORT_URL="https://bugs.debian.org/"  

How to get both the current working directory and the current process in the status line for tmux?

Posted: 29 May 2021 03:39 PM PDT

I would like to have two status lines with the first status line showing which directory the window is in and the second one showing which process is running in the window. Is this possible? I use bash but I am open to switching to another shell if it is easier to make this configuration.

If this is not possible with tmux or very hard to configure, is there any other tool I can use which can provide me this info? (Basically I want multiple tabs/windows open in terminal, with the dir and process info.)

Gcc not found : cannot compile c program in a Buildroot image for STM32MP

Posted: 29 May 2021 05:00 PM PDT

I'm trying to compile a C program with gcc in a image that I have made with buildroot for STM32mp157a-dk1, but I get:

$ gcc bl.c -o bl  -sh: gcc: not found  $  

LVM thin pool inactive and failed with: No data available

Posted: 29 May 2021 02:26 PM PDT

I am suffering in a problem due to a system crash, I am using LVM-THIN created in proxmox GUI, all lvs is inactive and the lvm seems broken and I saw it needs to fix manually in system log.

After google it, I've tried to use this command to fix the system.

lvconvert --repair data/data  

my vgs:

root@cn-hk1:~# vgs  VG   #PV #LV #SN Attr   VSize  VFree   data   3 456   0 wz--n- <8.41t <1.82t  

I can see some lv is active now:

  inactive          '/dev/data/vm-12966-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13005-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13011-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13014-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13017-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13038-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13059-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13060-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13071-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13081-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13082-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13088-disk-0' [20.00 GiB] inherit    inactive          '/dev/data/vm-13090-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13095-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13109-disk-0' [40.00 GiB] inherit    ACTIVE            '/dev/data/vm-13134-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13141-disk-0' [30.00 GiB] inherit    ACTIVE            '/dev/data/vm-13151-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13152-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13178-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13179-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13183-disk-0' [30.00 GiB] inherit    ACTIVE            '/dev/data/vm-13222-disk-0' [30.00 GiB] inherit    ACTIVE            '/dev/data/vm-13223-disk-0' [20.00 GiB] inherit    ACTIVE            '/dev/data/vm-13229-disk-0' [20.00 GiB] inherit  

but beyond that, I got this error :

root@cn-hk1:/dev/mapper# lvchange -ay /dev/data/vm-13090-disk-0  device-mapper: reload ioctl on  (253:4) failed: No data available  

in dmesg:

[   76.381436] device-mapper: ioctl: error adding target to table  [   76.398883] device-mapper: table: 253:93: thin: Couldn't open thin internal device  

And I go back to use thin_check command to check the metadata backup by lvconvert --repair, it shows me that:

root@cn-hk1:/dev/mapper# thin_check /dev/mapper/data-data_meta0  examining superblock  TRANSACTION_ID=930  METADATA_FREE_BLOCKS=4145151  examining devices tree    missing devices: [236, 347]      bad checksum in btree node (block 398964)    missing devices: [484, -]      parent key mismatch: parent was 484, but lowest in node was 1 (block 398963)  examining mapping tree    missing all mappings for devices: [1, 292]      bad checksum in btree node (block 27584)  

Any one can help? I am very appreciate it, thank you.

package configuration issue

Posted: 29 May 2021 01:16 PM PDT

Looking for pointers on a package configuration issue. This is a stripped down version of Debian 8 (ReadyNAS 6.10.3 running on a Netgear RN202 NAS).

I think the problem may have been triggered by installing the third-party RNXtras PHP7.2 app that upgrades the default PHP from 5.6 to 7.2. The combination worked fine when I first installed it a while back. But ReadyNAS (Debian) was upgraded on the box since then, and after doing a recent full wipe / install of ReadyNAS then reinstall of RNXtras PHP7.2, things went south: Both an uninstall and install of RNXtras PHP7.2 is failing now - as are other installs.

The primary symptom right now is this sort of thing:

# apt-get install git  ...  insserv: warning: script 'K01ddclient' missing LSB tags and overrides  insserv: Service nfs-common has to be enabled to start service nfs-kernel-server  insserv: Service rpcbind has to be enabled to start service nfs-kernel-server  insserv: exiting now!  update-rc.d: error: insserv rejected the script header  dpkg: error processing package nfs-kernel-server (--configure):   subprocess installed post-installation script returned error exit status 1  Setting up liberror-perl (0.17-1.1) ...  Setting up git-man (1:2.11.0-3~bpo8+1) ...  Setting up git (1:2.11.0-3~bpo8+1) ...  Errors were encountered while processing:   nfs-kernel-server  E: Sub-process /usr/bin/dpkg returned an error code (1)    # apt-cache policy nfs-kernel-server  nfs-kernel-server:    Installed: 1:1.2.8-9+deb8u1    Candidate: 1:1.2.8-9+deb8u1    Version table:   *** 1:1.2.8-9+deb8u1 500          500 http://security.debian.org jessie/updates/main armel Packages          100 /var/lib/dpkg/status       1:1.2.8-9 500          500 http://mirrors.kernel.org/debian jessie/main armel Packages    # apt-cache policy git  git:    Installed: 1:2.11.0-3~bpo8+1    Candidate: 1:2.11.0-3~bpo8+1    Version table:   *** 1:2.11.0-3~bpo8+1 500          500 https://repos.rnxtras.com/debian/rnx-rnos6 rnx-rnos6/main armel Packages          100 /var/lib/dpkg/status       1:2.1.4-2.1+deb8u10 500          500 http://security.debian.org jessie/updates/main armel Packages       1:2.1.4-2.1+deb8u6 500          500 http://mirrors.kernel.org/debian jessie/main armel Packages  

Also, similar errors for "apt-get remove", etc.

Perhaps this could be solved through package pinning, but not sure where to look.

Xubuntu 16 Plymouthd crashes on every boot

Posted: 29 May 2021 05:02 PM PDT

I get three crash errors with every boot-up. This is the first one.

enter image description here

I have tried

sudo chown -R $USER: /lib/plumouth  

and

audo apt-get install plumouth-x11  

and

dpkg-reconfigure Plymouth  

But none of these have solved the problem.

RTMP + FFMPEG streaming: how do I change a file on the fly?

Posted: 29 May 2021 03:04 PM PDT

I use ffmpeg for rtmp streaming for instance with a command like this:

ffmpeg -i file.mp4 ... rtmp://localhost/stream  

Sometime I need to replace file.mp4 with new_file.mp4. How do I do that without stutters and stopping the stream? I suppose I can't do sth like that:

mv new_file.mp4 file.mp4  

without killing the ffmpeg process :)

debian without dbus: login/systemd complains about failing to connect to d-bus after motd

Posted: 29 May 2021 02:07 PM PDT

I have barebones raspbian, i.e. basically Debian 8, with systemd and no X. I removed dbus with "apt-get remove dbus". It deinstalled cleanly, with no apparent programs depending on it. Now, whenever I login on the console after the motd I get this line:

Failed to get D-Bus connection: No such file or directory

What's the source of that message, and how can I make it stop? Must be something somewhere in /etc I can set, right?

It looks like systemd still thinks there is a dbus. There is still a dbus.service which I manually disabled with systemctl, just to be sure. It complained (inserv warning current start runlevel(s) (empty) of script dbus overrides LSB defaults ....) but, all my services do seem normal; I don't know for sure. Running "systemctl start anythinghere" as non-root produces the same error. So user-level privilege systemd, whatever it is called, appears to be the source but I don't have systemd-logind running on my system, and I don't understand how /bin/login is calling systemd.

Stable IPv6 address on Fedora

Posted: 29 May 2021 02:04 PM PDT

Unlike other systems, Fedora 25 workstation doesn't use stable IPv6 addresses, by default.

For example, with CentOS 7 or Fedora 23, a stable IPv6 is automatically configured (in an IPv6 enabled network where a IPv6 router is present) - i.e. one that is derived from the MAC-address.

That IPv6 address then can be used in an DNS AAAA-record.

In contrast to that, the IPv6 address of a Fedora 25 workstation system doesn't have any relation to its MAC address and doesn't seem to be stable.

How to configure deterministic and stable IPv6 addresses on Fedora 25?

Switchable graphics Intel + AMD Venus Pro

Posted: 29 May 2021 04:03 PM PDT

I'm using Manjaro Linux on my laptop with switchable graphic cards:

00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)    03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Venus PRO [Radeon HD 8850M / R9 M265X] (rev ff)  

Here's a screenshot of the drivers section of Manjaro Settings Manager:

Manjaro Settings Manager

The above shows that bumblebee's drivers are installed, but the daemon fails:

[luke@manjaro ~]$ sudo systemctl status bumblebeed  ● bumblebeed.service - Bumblebee C Daemon     Loaded: loaded (/usr/lib/systemd/system/bumblebeed.service; enabled; vendor preset: disabled)     Active: activating (auto-restart) (Result: exit-code) since pią 2015-09-18 16:22:55 CEST; 29s ago    Process: 1192 ExecStart=/usr/bin/bumblebeed (code=exited, status=1/FAILURE)   Main PID: 1192 (code=exited, status=1/FAILURE)    wrz 18 16:22:55 manjaro systemd[1]: bumblebeed.service: Unit entered failed state.  wrz 18 16:22:55 manjaro systemd[1]: bumblebeed.service: Failed with result 'exit-code'.  

During my trial-and-error I also tried to install video-catalyst driver (in window shown above). It ended miserably - after the initial startup the screen was full white. I switched to another TTY and deleted video-catalyst using mhwd.

My goal is to be able to play games on Steam. What can you recommend?

How can I swap my two screens, left to right?

Posted: 29 May 2021 04:45 PM PDT

I pressed something and accidentally swapped my two screens. My left one is actually considered as the right one, and vice versa. How can I swap them back?

Edit - Specifically, I'm using Gnome, though we might also want to keep this question generic.

Edit 2 - It appears that my driver isn't compatible with xrandr. I'm attaching log of /var/log/Xorg.0.log here

No comments:

Post a Comment