Wednesday, September 8, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to disable auto print result in php

Posted: 08 Sep 2021 10:48 AM PDT

I'm using a PHP Trader (trader_bbands) library to do some analysis but after execution the result auto printing and not assigning to variable.

  $closes = array(112.82, 117.32, 113.49, 112, 115.355, 115.54, 112.13, 110.34, 106.84, 110.08, 111.81, 107.12, 108.22, 112.28);  $time_period = 5;  $upper_deviation_multiplier = 2.0;  $lower_deviation_multiplier = 2.0;    $ma_type = TRADER_MA_TYPE_SMA;                      $result = trader_bbands($closes, $time_period, $upper_deviation_multiplier, $lower_deviation_multiplier, $ma_type);  

Result auto printing/echo

array(3) {    [0]=>    array(10) {      [4]=>      float(118.025)      [5]=>      float(118.401)      [6]=>      float(116.739)      [7]=>      float(117.153)      [8]=>      float(118.563)      [9]=>      float(116.676)      [10]=>      float(113.996)      [11]=>      float(113.114)      [12]=>      float(112.577)      [13]=>      float(113.892)    }    [1]=>    array(10) {      [4]=>      float(114.197)      [5]=>      float(114.741)      [6]=>      float(113.703)      [7]=>      float(113.073)      [8]=>      float(112.041)      [9]=>      float(110.986)      [10]=>      float(110.24)      [11]=>      float(109.238)      [12]=>      float(108.814)      [13]=>      float(109.902)    }    [2]=>    array(10) {      [4]=>      float(110.369)      [5]=>      float(111.081)      [6]=>      float(110.667)      [7]=>      float(108.993)      [8]=>      float(105.519)      [9]=>      float(105.296)      [10]=>      float(106.484)      [11]=>      float(105.362)      [12]=>      float(105.051)      [13]=>      float(105.912)    }  }  

But i want to assign it to variable and not printing directly.

How to get a keycode from my mouse's side button?

Posted: 08 Sep 2021 10:27 AM PDT

In my .bashrc, I would like to add this line :

xmodmap -e "keycode 135 = Return"  

where the keycode number is the one from my mouse's side button.

To find a keycode from the keyboard, I use xev, which gives me, for instance:

(the line that contains "keycode 135" is the one that matters)

 KeyPress event, serial 38, synthetic NO, window 0x6400001,           root 0x7c3, subw 0x0, time 30530179, (-489,479), root:(1047,479),           state 0x0, keycode 135 (keysym 0xff0d, Return), same_screen YES,           XKeysymToKeycode returns keycode: 36 "   XLookupString gives 1 bytes: (0d) " "   XmbLookupString gives 1 bytes: (0d) "           XFilterEvent returns: False  

However, for a mouse, it doesn't show the keycode:

ButtonRelease event, serial 38, synthetic NO, window 0x6400001,      root 0x7c3, subw 0x0, time 30661669, (35,100), root:(1571,100),      state 0x0, button 8, same_screen YES  

How to get a keycode from my mouse's side button, to use the command xmodmap, to simulate a keyboard's key press from a mouse button? (for instance, pressing the side button would be as if I would press "a" on keyboard - and would show "a" in a text editor)

What does "total" mean in the "ls -l" output? [duplicate]

Posted: 08 Sep 2021 09:45 AM PDT

I noticed that when I execute the "ls -l" command, some output entries appear. The first one "total some_number", according to the Linux Bible book, shows the total amount of disk space used by the files in the list; the others show file type, file permissions, hard links, owner, group, file size... I want to understand better the meaning of "total" in this output. I've tried doing some tests and I've searched on the official gnu's project web page about the output of the ls command. According to this source, "total" is followed by the amount of disk space (depending on how many blocks are allocated), measured in KByte, used by the files in the current directory where the command is executed.

If let's say I have an empty directory and I do "mkdir newdir newdir1", after I execute "ls -l", I notice that, on my system, "total 8" appears. According to what is said on the gnu's web page, this happens because each of the directories has a size of 4096 byte, in the size column of the ls -l output. Thus, for each directory only one block is allocated, because, on my system, I guess that the block size is 4096 bytes. If I create a new file with the vim command and I insert some text in there so that the file size of the file itself goes to 4096 bytes (ls -l output), now I can see "total 12" in the output of the "ls -l" command. This makes sense. Now, If I insert one more character inside the file just created, I notice that the size goes to 4097. Now "ls -l" shows "total 16". Again, it makes sense, because the system needed another block for the file to store the new character added to it. If we add a symbolic link to the file inside the current directory, the "total" remains the same, anyway. So, can I deduce that symbolic links does not require block allocation? So I think "total", for directories, is calculated by considering 4096 bytes listed in the ls -l output, and not the real size of a directory (4096 refers only to meta-information about the directory). According to this, I also think that "total" doesn't take into account the contents of a directory.

I want someone expert to tell me if I am right with what I've written above.

Concept of "non-portable" in uname command [duplicate]

Posted: 08 Sep 2021 10:03 AM PDT

What does meaning of non-portable in the uname info. I was reading manual of uname command by info uname and saw, -i and -p options says: non-portable. I want to know what does it exactly mean ? I mean explicitly "non-portable", not "unknown". Please search non-portable in manual to better understand.

Safely configuring `iptables` on a remote system?

Posted: 08 Sep 2021 09:38 AM PDT

I want to configure a complex ip-tables configuration on a system that is only accessible via ethernet.

What are the best practices for recovering from the inevitable typos? For example, this question: Configure iptables on remote server without locking me up

Ideally:

  • I'd like to have a 1 minute 'recovery' that would automatically remove recent rules.
    • However, I couldn't find a quick way to delete line number ranges across both INPUT and NAT line tables.

Are the "INPUT" rules in the above link sufficient to protect against all iptables mess-ups (eg, with NAT)

How to block a brute force ssh only using bash?

Posted: 08 Sep 2021 09:24 AM PDT

I currently have to write a script that blocks an IP for x minutes if it failed to log in SSH more than 10 times within 10seconds.

So far I have something like this :

#/bin/bash       for z in grep "Invalid\|Failed" /var/log/auth.log | awk '{ print $NF }' | sort | uniq       do       hits=grep "Invalid\|Failed" /var/log/auth.log* | grep $z | wc -l        blocked=grep $z /etc/hosts.deny | wc -l       if [ $hits -gt 10 -a $blocked -eq 0 ]       then            echo "sshd : $z" >> /etc/hosts.deny       fi       done  

So this is what I used, but it only blocks the IP after a certain amount of failed attempts, I need to add the unblock part and the failed attempt within a certain period of time. It's something for school they asked us to not use Fail2Ban.

Edited to remove the third party thing, thanks for pointing this out, I'm pretty new to all this sorry. Thanks!

How can I generate .out file within a shell script?

Posted: 08 Sep 2021 08:38 AM PDT

I wasn't sure how to word this question but basically I have been using a shell script to process sam data. Here's the shell script.

nano picard_SortandIndex_from_sam.sh    for A in *sam; do ls $A; picard SortSam I=$A O=$A".bam" SO=coordinate CREATE_INDEX=TRUE; done   

And this is the command I run where I get only one .out file for all the sam files processed.

nohup sh picard_SortandIndex_from_sam.sh > picard_SortandIndex_from_sam5_26_21.out &  

Is there a way to generate .out files within my "picard_SortandIndex_from_sam.sh" script so I can have a summary file for each sam file processed? I tried to put > $A".out" in there but it didn't work...

Many thanks!

manipulating wayland inside scripts

Posted: 08 Sep 2021 08:05 AM PDT

I am running Ubuntu 21.04 on a Lenovo Thinkpad X1 Tablet. On Ubuntu 20.10 I had a series of bash scripts I would run to set up different xorg and xinput configurations depending on what external monitors were attached, rotating the desktop relative to physical device and turning on and off touch. My scripts would use xrandr and xinput. For example

#!/bin/bash    xrandr --fb 3720x1200 --output DP-1-2 --mode 1920x1200;  xrandr --output eDP-1 --mode 2160x1440 --right-of DP-1-2 --scale 0.8333x0.8333;  dconf write /org/gnome/desktop/interface/text-scaling-factor  "0.75";  dconf write /org/gnome/desktop/interface/cursor-size "10";  dconf write /org/gnome/desktop/interface/scaling-factor "1";  dconf write /org/gnome/shell/extensions/dash-to-dock/preferred-monitor "2";    xinput --set-prop "Wacom HID 5115 Pen stylus" "Wacom Rotation" 0;  xinput set-prop "Wacom HID 5115 Finger touch" "Device Enabled" 1;  gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll true;  gsettings set org.gnome.desktop.peripherals.mouse natural-scroll true;  

How do I script wayland to do similar things? I would like the following functionality:

  • turn on and off touch
  • rotate touch input, stylus input and desktop on screen
  • create large desktop encompassing more than one monitor
  • scale each screen's resolution with respect to desktop resolution so each monitor's height is exactly the height of desktop
  • control which monitors are "to left" or "to right" of others on the desktop

Most of the wayland manipulation instructions I have found seem to involve changing grub and then rebooting. I created these scripts so I could change things on the fly: like when I undock from my desk monitor and go to a meeting, I want to turn touch off, rotate the desktop so I am in portrait mode not landscape, etc. I do not want to have reboot to make these changes.

Why does variable assignment not work in bash terminal? [closed]

Posted: 08 Sep 2021 10:35 AM PDT

I'm new to bash environment and I try to understand the difference between a bash terminal and a bash script file. As far as I see, your terminal is running on bash just like executing a bash file. Hence there shouldn't be any difference between what you can do in a bash file and a bash terminal. But then how come simple statement like:

variable=value  

does not work in the terminal.

How to add closing XML tags with sed

Posted: 08 Sep 2021 08:46 AM PDT

I have the following example in the XML doc:

<meta name=Originator content="text/html; charset=iso-8859-6">  <meta name=ProgId content=Word.Document>  <meta name=Generator content="Microsoft Word 15"/>  

While running the following sed command:

'/./{H;$!d} ; x ; s@<meta\([^/>]*\)>@<meta\1/>@g'  

I'm obtaining the following result:

<meta name=Originator content="text/html; charset=iso-8859-6">  <meta name=ProgId content=Word.Document/>  <meta name=Generator content="Microsoft Word 15"/>  

Where the closing slash is missing for the first example due to the slash between text and html.

If however I modify my sed command to:

'/./{H;$!d} ; x ; s@<meta\([^>]*\)>@<meta\1/>@g'  

Then I have double slash on the third example:

<meta name=Originator content="text/html; charset=iso-8859-6"/>  <meta name=ProgId content=Word.Document/>  <meta name=Generator content="Microsoft Word 15"//>  

Any idea on how to cover both of those cases?

building Debian package fails after even a minor change to code

Posted: 08 Sep 2021 09:45 AM PDT

I am able to build Debian package make using following procedure:

apt-get source make  cd make-*  dpkg-buildpackage --build=binary --no-sign  

But as soon as I make any change to the code, even changing one character in a string, then the build fails during the tests:

1 Test in 1 Category Failed (See .diff* files in work dir for details) :-(    make[4]: *** [Makefile:1373: check-regression] Error 1  make[4]: Leaving directory '/mnt/src/deb/MAKE/make-dfsg-4.2.1/debian/build-make-guile'  make[3]: *** [Makefile:1114: check-am] Error 2  make[3]: Leaving directory '/mnt/src/deb/MAKE/make-dfsg-4.2.1/debian/build-make-guile'  make[2]: *** [Makefile:820: check-recursive] Error 1  make[2]: Leaving directory '/mnt/src/deb/MAKE/make-dfsg-4.2.1/debian/build-make-guile'  dh_auto_test: error: cd debian/build-make-guile && make -j8 check VERBOSE=1 returned exit code 2  make[1]: *** [debian/rules:50: override_dh_auto_test] Error 255  make[1]: Leaving directory '/mnt/src/deb/MAKE/make-dfsg-4.2.1'  make: *** [debian/rules:24: build] Error 2  dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2  

I have pasted the full output here

How can I build the package with custom changes ?

detect if DHCPOFFER has been received

Posted: 08 Sep 2021 10:34 AM PDT

The Linux box with DHCP client does not know beforehand if it is connected to access or trunk port, so it has to determine it somehow. So I'm thinking of the following:

  1. have the box send a DHCPDISCOVER using untagged frames
  2. if it fails to receive a DHCPOFFER message, try tagged frames

This assumes that there should be a process running in parallel with the dhcp client, and the process has to be able to:

  • determine if the client has not received DHCPOFFER message
  • configure Ethernet interface as vlan tagged and possibly restart dhcp client

I'm not sure if isc-dhcp or dnsmasq already have such capabilities, so I'm thinking of writing such a daemon. The problem for me is how to determine the DHCPOFFER packet.

Am I over complicating the problem, and there is easier solution?

Make nautilus use default kde plasma color scheme

Posted: 08 Sep 2021 09:20 AM PDT

I am currently working with the KDE Plasma window manager and switched my default file manager to nautilus. Functionally everything works, but aesthetically it looks not very pleasing. Is it possible to make nautilus use KDE Plasma's default color scheme?

Connecting to SFTP with PcManFM

Posted: 08 Sep 2021 09:22 AM PDT

When I run pcmanfm 'sftp://user@machine', it gives me a 'Operation not supported' error. I think I'm just missing some software for mounting sftp connection into the file system, but I have no idea what it is. Simply running sftp user@machine works as expected, but I'd like to be able to see the file system from pcmanfm, just like you can with KDE's dolphin.

I'm fairly certain that this is possible since when I was searching for an answer to this problem, I found some people asking about this, however I didn't find any actual solutions to this problem. Any idea how to resolve it?

tc traffic shaping with HTB and CQB causes packet transmission gap inconsistencies

Posted: 08 Sep 2021 08:56 AM PDT

I am sorry if this is duplicate of https://serverfault.com/q/1076769/822163. I created that first and then realized the Linux and Unix stack exchange is the right place. Problem: When the tc HTB or CQB is used to do traffic shaping, first two packet that are sent after some time gap are sent back to back as recorded in the pcap log. I have a intermediate computer with ubuntu 18.4 with network forwarding enabled. I run the tc with HTB to shape the traffic to have constant bitrate output on egress port. Client requests the chunks with variable sizes from the sever. Server sends the chunk transfer encoded data with gap of 200ms between each chunk to client. With my setup having the intermediate computer, These packets are passed through the traffic shaper on intermediate computer to obtain fixed bitrate of 500kbps. As I disable offload (TSO and GRO) each n bytes are split into frames by pcap. Most of 1448B packets have time gap close to 24.224ms which is expected at 500kbps

Issue: Although the frames arrive in the sequence, their time gap of arrival is not consistent. Second large packet (1448B) after gap of 200ms always comes almost back to back with first packet. Last packet in chunk ( 654B) arrives with delay (24.224ms instead of 10.464ms in example in the picture attached) Screen shot of the timings Timing gaps between the packets.

TC command with HTB:

tc qdisc del dev eno1 root 2> /dev/null > /dev/null  tc qdisc add dev eno1 root handle 1:0 htb default 2  tc class add dev eno1 parent 1:1 classid 1:2 htb rate 500kbit ceil 500kbit burst 10 cburst 10 prio 2  tc filter add dev eno1 protocol ip parent 1:0 u32 match ip dst 192.168.2.103 flowid 1:2  

If I am not doing any mistake in calculation I think the issue could be due to the token handling in tc that I am using for trafic shaping. I think the tokens are accumulated in the idle time and when the next packet is received it sends the two packets back to back. from third packet token consumtion rate settles down. If this is what is happenning, I would like to know if there is a way to avoid using the accumulated tokens for second packet in the chunk.

I tried various options in tc command I also tried using CQB - command below Reference : https://lartc.org/lartc.html#AEN2233

Observation: reducing the burst = 10 slightly increases the gap between first and second packet. tc With CQB:

tc qdisc del dev eno1 root 2> /dev/null > /dev/null  tc qdisc add dev eno1 root handle 1: cbq avpkt 5000 bandwidth 10mbit  tc class add dev eno1 parent 1: classid 1:1 cbq rate 500kbit allot 5000 prio 5 bounded isolated  tc class add dev eno1 parent 1:1 classid 1:10 cbq rate 500kbit allot 5000 prio 1 avpkt 5000 bounded  tc class add dev eno1 parent 1:1 classid 1:20 cbq rate 500kbit allot 5000 avpkt 5000 prio 2  tc filter add dev eno1 protocol ip parent 1:0 u32 match ip dst 192.168.2.103 flowid 1:10  tc filter add dev eno1 parent 1: protocol ip prio 13 u32 match ip dst 0.0.0.0/0 flowid 1:20  

Further: As per suggestion from http://linux-ip.net/articles/hfsc.en/ I tried HFSC (referred ). I need help with HFSC here. Here is the script that I used

tc qdisc del dev eno1 root 2> /dev/null > /dev/null  tc qdisc add dev eno1 root handle 1: hfsc  tc class add dev eno1 parent 1: classid 1:1 hfsc sc rate 1000kbit ul rate 1000kbit  tc class add dev eno1 parent 1:1 classid 1:10 hfsc sc rate 1000kbit ul rate 1000kbit  tc class add dev eno1 parent 1:1 classid 1:20 hfsc sc rate 10000kbit ul rate 10000kbit  tc class add dev eno1 parent 1:10 classid 1:11 hfsc sc umax 1480b dmax 53ms rate 400kbit ul rate 1000kbit  tc class add dev eno1 parent 1:10 classid 1:12 hfsc sc umax 1480b dmax 30ms rate 100kbit ul rate 1000kbit  tc filter add dev eno1 protocol ip parent 1:0 u32 match ip dst 192.168.2.103 flowid 1:11  

output of my

tc class show eno1  

Output:

class hfsc 1:11 parent 1:10 sc m1 0bit d 23.4ms m2 400Kbit ul m1 0bit d 0us m2 1Mbit   class hfsc 1: root   class hfsc 1:1 parent 1: sc m1 0bit d 0us m2 1Mbit ul m1 0bit d 0us m2 1Mbit   class hfsc 1:10 parent 1:1 sc m1 0bit d 0us m2 1Mbit ul m1 0bit d 0us m2 1Mbit   class hfsc 1:20 parent 1:1 sc m1 0bit d 0us m2 10Mbit ul m1 0bit d 0us m2 10Mbit   class hfsc 1:12 parent 1:10 sc m1 394672bit d 30.0ms m2 100Kbit ul m1 0bit d 0us m2 1Mbit  

I am not sure what does it mean by

ul m1 0bit d 0us

where as In my tc command I have

sc umax 1480b dmax 53ms

After running this script I try to ping 192.168.1.102. I get few ping responses and then the ARP

who has 192.168.2.100

kicks in where 192.168.2.100 is ip address of ip forwarding port where I am running tc.

The command is mostly copied from http://linux-ip.net/articles/hfsc.en/ I have just added route

tc filter add dev eno1 protocol ip parent 1:0 u32 match ip dst 192.168.2.103 flowid 1:11

It would be great if someone could help to fix the umax and dmax issue.

EFI Boot list and EFI Boot Manager timeout setting not working

Posted: 08 Sep 2021 09:45 AM PDT

How can I change the 'timeout' setting of the EFI boot manager? I am trying to dual-boot Windows 8 and Ubuntu and I would like to be able to choose one or the other OS at my machine boot time.

I already tried to use sudo efibootmgr -t 10 from within Ubuntu, but that didn't work for me as I don't see a list to choose from when my computer loads but boots directly to grub.

Here are more details:

$ efibootmgr -v  BootCurrent: 0000  Timeout: 10 seconds  BootOrder: 0000,0002  Boot0000* debian        HD(13,GPT,007a058a-8e5e-45df-8d97-6575b66b5355,0x1afa9000,0x113000)/File(\EFI\debian\grubx64.efi)  Boot0002* Windows Boot Manager  HD(13,GPT,007a058a-8e5e-45df-8d97-6575b66b5355,0x1afa9000,0x113000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................    $ bootctl status  systemd-boot not installed in ESP.  System:       Firmware: n/a (n/a)    Secure Boot: disabled     Setup Mode: user    Current Boot Loader:        Product: n/a       Features: - Boot counting                 - Menu timeout control                 - One-shot menu timeout control                 - Default entry control                 - One-shot entry control                 - Support for XBOOTLDR partition                 - Support for passing random seed to OS                 - Boot loader sets ESP partition information            ESP: n/a           File: `-n/a    Random Seed:   Passed to OS: no   System Token: not set         Exists: no    Available Boot Loaders on ESP:            ESP: /efi (/dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355)           File: `-/EFI/BOOT/bootx64.efi    Boot Loaders Listed in EFI Variables:          Title: debian             ID: 0x0000         Status: active, boot-order      Partition: /dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355           File: `-/EFI/debian/grubx64.efi            Title: Windows Boot Manager             ID: 0x0002         Status: active, boot-order      Partition: /dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355           File: `-/EFI/Microsoft/Boot/bootmgfw.efi    Boot Loader Entries:          $BOOT: /efi (/dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355)    0 entries, no entry could be determined as default.  

Is it because of the systemd-boot not installed in ESP?

UPDATE:

Here is my status after carrying out the tasks in Peter's answer.

$ efibootmgr -v  BootCurrent: 0000  Timeout: 6 seconds  BootOrder: 0001,0000,0002  Boot0000* debian        HD(13,GPT,007a058a-8e5e-45df-8d97-6575b66b5355,0x1afa9000,0x113000)/File(\EFI\debian\grubx64.efi)  Boot0001* Linux Boot Manager    HD(13,GPT,007a058a-8e5e-45df-8d97-6575b66b5355,0x1afa9000,0x113000)/File(\EFI\systemd\systemd-bootx64.efi)  Boot0002* Windows Boot Manager  HD(13,GPT,007a058a-8e5e-45df-8d97-6575b66b5355,0x1afa9000,0x113000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................    $ bootctl status  System:       Firmware: n/a (n/a)    Secure Boot: disabled     Setup Mode: user    Current Boot Loader:        Product: n/a       Features: - Boot counting                 - Menu timeout control                 - One-shot menu timeout control                 - Default entry control                 - One-shot entry control                 - Support for XBOOTLDR partition                 - Support for passing random seed to OS                 - Boot loader sets ESP partition information            ESP: n/a           File: `-n/a    Random Seed:   Passed to OS: no   System Token: set         Exists: yes    Available Boot Loaders on ESP:            ESP: /efi (/dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355)           File: `-/EFI/systemd/systemd-bootx64.efi (systemd-boot 245.4-4ubuntu3.1)           File: `-/EFI/BOOT/bootx64.efi (systemd-boot 245.4-4ubuntu3.1)    Boot Loaders Listed in EFI Variables:          Title: Linux Boot Manager             ID: 0x0001         Status: active, boot-order      Partition: /dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355           File: `-/EFI/systemd/systemd-bootx64.efi            Title: debian             ID: 0x0000         Status: active, boot-order      Partition: /dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355           File: `-/EFI/debian/grubx64.efi            Title: Windows Boot Manager             ID: 0x0002         Status: active, boot-order      Partition: /dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355           File: `-/EFI/Microsoft/Boot/bootmgfw.efi    Boot Loader Entries:          $BOOT: /efi (/dev/disk/by-partuuid/007a058a-8e5e-45df-8d97-6575b66b5355)    0 entries, no entry could be determined as default.    $ cat "$(bootctl -x)/loader/loader.conf"  #timeout 3  #console-mode keep  default f1439fc415644fedb2360e6691283080-*    timeout 5  console-mode max  editor yes  auto-entries yes  auto-firmware yes  random-seed-mode always    $ bootctl status | grep f1439fc415644fe | wc        0       0       0  

So Peter,

  • where does the default f1439fc415644fedb2360e6691283080-* comes from in the /loader/loader.conf file and what does it means? And what did you mean when you put default Windows there?
  • and most importantly, I now can see that EFI Boot list/menu, just it has Windows Boot Manager and the Reboot into firmware your mentioned, but it doesn't have the Linux / debian menu that I want. what I'm missing?

Installing PREEMPT_RT kernel on Ubuntu 20.04

Posted: 08 Sep 2021 08:06 AM PDT

I am trying to install a PREEMPT_RT kernel for my ubuntu distribution as this is a requirement for a robot I am working on. But no matter what I do I get errors when compiling the kernel. I've included the error messages in the question, and I have provided links for full terminal outputs. I am not very expreienced with linux, so I have been following setup-guides from the manufacturer with the following steps:

curl -SLO https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.6.19.tar.xz  curl -SLO https://www.kernel.org/pub/linux/kernel/projects/rt/5.6/older/patch-5.6.19-rt12.patch.xz    xz -d linux-5.6.19.tar.xz  xz -d patch-5.6.19-rt12.patch.xz    tar xf linux-5.6.19.tar  cd linux-5.6.19  patch -p1 < ../patch-5.6.19-rt12.patch    make oldconfig  

In the configuration I simply select Fully Preemptible Kernel (RT) (PREEMPT_RT_FULL) for the preemption model, and leave all the other settings at their default.

fakeroot make -j4 deb-pkg  

dpkg-buildpackage: error: fakeroot -u debian/rules clean subprocess returned exit status 1 make2: *** [scripts/Makefile.package:77: deb-pkg] Error 1 make: *** [Makefile:1429: deb-pkg] Error 2

All terminal output here

If I instead try to use

sudo make -j4 deb-pkg  

make3: *** [debian/rules:6: build] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2 make2: *** [scripts/Makefile.package:77: deb-pkg] Error 2 make: *** [Makefile:1429: deb-pkg] Error 2

All termial output here

When that didn't work I tried following the steps given in the answer to this question

curl -SLO https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.6.19.tar.gz  curl -SLO https://www.kernel.org/pub/linux/kernel/projects/rt/5.6/older/patch-5.6.19-rt12.patch.gz  tar xvzf linux-5.6.19.tar.gz  cd linux-5.6.19  gzip -cd ../patch-5.6.19-rt12.patch.gz | patch -p1 --verbose  make menuconfig  

patch, menuconfig

make -j4  sudo make modules_install -j4  

sudo make modules_install -j4 sed: can't read modules.order: No such file or directory make: *** [Makefile:1316: modinst] Error 2

make

sudo make modules -j4  sudo make modules_install -j4  

When I use the make modules command it compiles for a long time and it terminates successfully, but once again when I run modules_install I get an error message:

cp: cannot stat 'modules.builtin': No such file or directory make: *** [Makefile:1317: modinst] Error 1

I am at a loss for what to try next. I have tried different kernel versions and different operating systems (Ubuntu 18.04 and 20.04), and I get the same error in all of them. The instructions I have been given seems so clear and direct, so I'm wondering if I'm doing something wrong, or if there is some hardware incompatibilites or something of that nature? For reference I am currently running Ubuntu 20.04.02, kernel 5.8.0-53-generic, hardware. Does anyone have any Idea what may cause this issue?

PS: this is my first question on this site, feedback on question format is appreciated (too much/to little/ relevance of information etc.) I just added all the information the terminal gave me, not sure what is or isn't useful

Definition and usage of Kernel/Linux DTS file with more than one MIPI DSI Display panel

Posted: 08 Sep 2021 09:33 AM PDT

I actually need some help of defining the kernel/linux DTS file and use it together with the uboot videoargs.

In use is the 5.4.47 uboot and kernel/linux from a NXP imx8m YOCTO project.

In uboot I already can use 5 different MIPI DSI display panels and a HDMI adapter from nxp. To configure the displays type in uboot, I use the video_link environment variable. This works fine for me and can easily be extended and configured. To get this work my uboot DTS looks like this:

#include <dt-bindings/usb/pd.h>  #include "imx8mm.dtsi"    / {      model = "My own board";      compatible = "fsl,imx8mm-evk", "fsl,imx8mm";            .      .      .            dsi_host: dsi-host {          compatible = "samsung,sec-mipi-dsi";          status = "okay";      };          01_panel {          compatible = "mydisplay,01_display";          pinctrl-names = "default";          pinctrl-0 = <&pinctrl_mipi_dsi_en>;          reset-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;          dsi-lanes = <4>;          video-mode = <2>;   /* 0: burst mode                       * 1: non-burst mode with sync event                       * 2: non-burst mode with sync pulse                       */          panel-width-mm = <67>;          panel-height-mm = <121>;          status = "okay";            port {              01_from_dsim: endpoint {                  remote-endpoint = <&dsim_to_01>;              };          };      };        02_panel {          compatible = "mydisplay,02_display";          pinctrl-names = "default";          pinctrl-0 = <&pinctrl_mipi_dsi_en>;          reset-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;          dsi-lanes = <4>;          video-mode = <2>;   /* 0: burst mode                       * 1: non-burst mode with sync event                       * 2: non-burst mode with sync pulse                       */          panel-width-mm = <67>;          panel-height-mm = <121>;          status = "okay";            port {              02_from_dsim: endpoint {                  remote-endpoint = <&dsim_to_02>;              };          };      };        .      .      .  };    .  .  .    &mipi_dsi {      status = "okay";        port@1 {          dsim_to_adv7535: endpoint {              remote-endpoint = <&adv7535_from_dsim>;          };      };        port@2 {          dsim_to_01: endpoint {              remote-endpoint = <&01_from_dsim>;          };      };        port@3 {          dsim_to_02: endpoint {              remote-endpoint = <&02_from_dsim>;          };      };            .      .      .  };  

Now I want to use the same displays in kernel/linux, of course. I first tried the same DTS structure like above from uboot DTS file. I also used the following configuration of the kernel/linux DTS:

#include "imx8mm.dtsi"    / {      model = "My own board";      compatible = "fsl,imx8mm-flunder", "fsl,imx8mm";      reserved-memory {          #address-cells = <2>;          #size-cells = <2>;          ranges;            rpmsg_reserved: rpmsg@0xb8000000 {              no-map;              reg = <0 0xb8000000 0 0x400000>;          };      };            .      .      .  };    .  .  .    &mipi_dsi {    status = "okay";        port@1 {          dsim_to_adv7535: endpoint {              remote-endpoint = <&adv7535_from_dsim>;          };      };        panel@0 {          compatible = "mydisplay,01_display";          pinctrl-names = "default";          reg = <0>;          pinctrl-0 = <&pinctrl_mipi_dsi_en>;          reset-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;          dsi-lanes = <4>;          video-mode = <2>;   /* 0: burst mode                          * 1: non-burst mode with sync event                          * 2: non-burst mode with sync pulse                          */          panel-width-mm = <62>;          panel-height-mm = <110>;          status = "okay";      };        panel@1 {          compatible = "mydisplay,02_display";          pinctrl-names = "default";          reg = <0>;          pinctrl-0 = <&pinctrl_mipi_dsi_en>;          reset-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;          dsi-lanes = <4>;          video-mode = <2>;   /* 0: burst mode                          * 1: non-burst mode with sync event                          * 2: non-burst mode with sync pulse                          */          panel-width-mm = <62>;          panel-height-mm = <110>;          status = "okay";      };  };    .  .  .  

The second variant ends in the usage of the panel 0, while the kernel boots. But in both variants I was not able to tell the kernel/linux, from the uboot side, which display I want to use.

As boot- or videoargs from uboot side I tested many variants without any success.

A short example list you can see here:

video=imx-drm:720x1280@60  primary_display=imx-drm  video=DSI-1:dev=01,720x1280@60  video=mxcfb0:dev=ldb,01_panel,if=RGB24  video=mxcfb0:dev=mipi_dsi,01_panel,if=RGB24  video=DSI-1:dev=01_panel  video=mxcfb0:dev=mipi_dsi,720x1280M@60,if=RGB24  video=mxcfb0:dev=ldb,720x1280M@60,if=RGB24  video=DSI-1:720x1280@60  

In my opinion the first configuration, like I use in uboot, is the correct one, but I end in the questions:

  • How is the correct configuration of the kernel/linux DTS file for more than one MIPI DSI Display?

  • How can I tell the Kernel while booting which display it has to use?

Why can't I see new NIC with nmtui on CentOS 8 and how to resolve?

Posted: 08 Sep 2021 08:09 AM PDT

In a nuthsell:

I cannot see my newly added NIC with nmtui on CentOS 8. How to resolve it?

Detail:

I've installed a CentOS 8 VM on VirtualBox.

Usually I configure two NICs during the installation:

  • One as NAT so it can connect to the outside network
  • The other as Host Only so I can access it with internal IP

I didn't use Bridged network for I don't want to expose those VMs to the outside world.

It works well for all my VMs.

But when installing a new server I forgot to set a second NIC on VirtualBox during the OS installation, so I added a new NIC in VirtualBox after the installation.

Now I'm able to see the the newly added NIC with both "ip addr" :

[root@cent8-4 ~]# ip addr  1: lo: ...  2: enp0s3: /*My working NIC*/ <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000      link/ether 08:00:27:de:33:18 brd ff:ff:ff:ff:ff:ff      inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3         valid_lft 84236sec preferred_lft 84236sec      inet6 ...  3: enp0s8: /*The newly added NIC*/ <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000      link/ether 08:00:27:a7:c7:56 brd ff:ff:ff:ff:ff:ff  4: virbr0: ...  5: virbr0-nic: ...  

and "nmcli device":

[root@cent8-4 ~]# nmcli device  DEVICE      TYPE      STATE         CONNECTION  enp0s3      ethernet  connected     enp0s3  /*My working NIC*/  virbr0      bridge    connected     virbr0  enp0s8      ethernet  disconnected  --      /*The newly added NIC*/  lo          loopback  unmanaged     --  virbr0-nic  tun       unmanaged     --  

Note that enp0s3 is the NIC which I've configured during the installation, while enp0s8 is the one that I added after the installation.

But when I use nmtui to configure the IP address of the newly added NIC, I just can't see it in "Edit a connection" screen:

enter image description here

Neither can I see it in "Activate a connection" screen:

enter image description here

So how can I make nmtui recognize this new NIC?

Some articles say that I have to use "auto enp0s8" to initialize the NIC, but it seems that CentOS 8 doesn't have that tool:

[root@cent8-4 network-scripts]# auto enp0s8  bash: auto: command not found...  

error ffmpeg Cannot open display :0.0+0,0, error 1. :0.0+0,0: Input/output error

Posted: 08 Sep 2021 09:01 AM PDT

Hello I get this error when i want to capture my screen on linux with ffmpeg ubuntu 16:04 :

the command i'am using :

$ ffmpeg -f x11grab -r 15 -s 1920x1080 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0      ffmpeg version 4.1.1-0york1~16.04 Copyright (c) 2000-2019 the FFmpeg developers        built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609        configuration: --prefix=/usr --extra-version='0york1~16.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared        libavutil      56. 22.100 / 56. 22.100        libavcodec     58. 35.100 / 58. 35.100        libavformat    58. 20.100 / 58. 20.100        libavdevice    58.  5.100 / 58.  5.100        libavfilter     7. 40.101 /  7. 40.101        libavresample   4.  0.  0 /  4.  0.  0        libswscale      5.  3.100 /  5.  3.100        libswresample   3.  3.100 /  3.  3.100        libpostproc    55.  3.100 / 55.  3.100      [x11grab @ 0x5611f156e540] Cannot open display :0.0+0,0, error 1.      :0.0+0,0: Input/output error  

Best way to cancel all the SLURM jobs from shell command output

Posted: 08 Sep 2021 10:47 AM PDT

I submitted lots of SLURM job script with debug time limit (I forgot to change the time for actual run). Now they are all submitted at the same time, so they all start with job ID 197xxxxx. Now, I can do

squeue -u $USER | grep 197 | awk '{print $1}'   

to print the job ID's I want to delete. But how do I use scancel command on all these ID's. The output from the above shell command would look like

19726664  19726663  19726662  19726661  19726660  19726659  19726658  19726657  19726656  19726655  19726654  19726653  19726652  19726651  19726650  

with yum how can you remove a package but not remove its dependencies at the same time?

Posted: 08 Sep 2021 08:40 AM PDT

Today if I do $ yum remove packageA I am greeted with:

Removing:  packageA                        noarch                 3.5.1.b37-15                                 @yumFS                 293 k  Removing for dependencies:   packageB                      noarch                 3.5.1.b125-7                                 @yumFS                  87 M  ..  Is this ok?  

I would like to remove packageA without removing packageB (etc) is this possible?

Does pkill kill itself (and its parent processes) last?

Posted: 08 Sep 2021 08:48 AM PDT

I'm writing a bash script that kills a bunch of processes selected by certain criteria and then quits. The only problem is that those criteria apply to the script and its parent processes (bash, sshd) itself, so in order to avoid killing the script before it has done its work, I first get the matching processes with ps, then filter out the script and its parents with sed and finally kill the remaining processes with kill.

Now I'm wondering whether I could simplify this to a single pkill call, but obviously that can only work if pkill is guaranteed to kill itself and its parent processes last if they occur in the list of processes to kill.

Is there such a guarantee implemented into pkill?

Delete all fail2ban bans in Ubuntu Linux

Posted: 08 Sep 2021 09:45 AM PDT

How can I delete all fail2ban bans in Ubuntu? I tried everything but I don't get it.

I just want to delete all bans - but I don't know any IP adresses.

How to allow users to mount windows shares

Posted: 08 Sep 2021 08:07 AM PDT

Our company uses both Windows and Linux. Each user has access to many Windows Shares, e.g. \\machine1\A, \\machine2\B, etc.

In Ubuntu, how to allow non-root users accessing those shares?

Is there a way to access those without mounting?

If mounting is required, how to allow non-root users to mount network shares to their home folders? They should be able to mount \\machine1\A to /home/user/somefolder/ but cannot change the mounting of local drives.

Linux Mint MATE: Disable encrypted volume password dialog

Posted: 08 Sep 2021 10:02 AM PDT

I'm running the MATE edition of Linux Mint on my laptop. I have an external USB disk with a LUKS container on it. The USB disk is connected to the laptop's docking station.

Whenever I connect the laptop to the docking station, MATE pops up a window which says, "Enter a password to unlock the volume" along with a text field and options to forget the password immediately, remember until logout, or remember forever. (Not "don't show me this popup again," which is what I would prefer.)

Under normal use, I want to have this external USB disk unmounted and idle. I have a cron job which unlocks the disk via a key file, mounts the partition, and runs an automated backup. I don't want this partition to be mounted all the time, nor do I want it to be accessible to my ordinary (non-privileged) user account.

Is there any way to tell gvfs (or whatever is doing this) to please stop showing me the "enter password" dialog every time I dock my laptop to the docking station?

How do I loop through only directories in bash?

Posted: 08 Sep 2021 10:33 AM PDT

I have a folder with some directories and some files (some are hidden, beginning with dot).

for d in *; do   echo $d  done  

will loop through all files and directories, but I want to loop only through directories. How do I do that?

No comments:

Post a Comment