Sunday, April 4, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


mdadm not showing RAID info on individual RAID array disks

Posted: 04 Apr 2021 11:00 AM PDT

I am testing the mdadm Linux tool in order to obtain metadata from each individual disk of a RAID array.

So I have created a RAID array on a IBM Server (model IBM X3400 Dumpster Server, a Xeon E5410 Quadcore) using its own RAID controller (Adaptec). The array was created via BIOS tool (Ctrl+A when booting), named "IBM ServeRAID Configuration Utility" (well, not a very detailed tool, rather basic, but enough for me, I would say).

The configuration data for this newly created array is:

  • RAID type: 5
  • 4 x 500GB Hard Disk
  • Chunk size (named strip size): 256 KB

System boots OK (using a common Ubuntu live distro), and now I can see a unpartitioned 1.3TB disk, as expected.

To test mdadm, I have extracted one of the 5x500GB disks, and plugged it (USB) on another computer running Ubuntu Linux (v20).

This is the output from fdisk :

$ sudo fdisk -l /dev/sdd  Disk /dev/sdd: 465.78 GiB, 500107862016 bytes, 976773168 sectors  Disk model: ASM1156-PM  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 33553920 bytes  

And this is the output from mdadm :

luis@xubuntu:~$ sudo mdadm --examine /dev/sdd  mdadm: No md superblock detected on /dev/sdd.  luis@xubuntu:~$ sudo mdadm --examine /dev/sdd1  mdadm: cannot open /dev/sdd1: No such file or directory  

What am I doing wrong?
Isn't mdadm supposed to yield metadata details (as shown here ) of the RAID Array on individual disks?
Maybe mdadm can not work with all RAID structures, and I am needing for another tool?

Of course, there are no partitions defined on `/dev/sdd' and so on, but I don't think they should be needed to get RAID details.

How to install plotnine Python package of Void Linux

Posted: 04 Apr 2021 10:55 AM PDT

I want to install Python package plotnine in Void Linux. I have been able to install many Python packages (e.g. numpy, scipy, matplotlib, pandas etc) from Void repositories. However, plotnine is not there in the repositories.

Pip is also not working.

How can I install plotnine Python package in Void Linux? Thanks for your help.

assign letters to jump forward and backward in bash

Posted: 04 Apr 2021 10:59 AM PDT

My default shell is tcsh. In my .cshrc file. I have bindkey -v, so that at the command line, the letters b and w jump backwards and forwards a word, respectively. I'd like to set up bash so that when I switch to that shell, it does the same thing. I've tried putting bindkey -v into .bashrc but bindkey is not recognized. Could somebody please explain how to mimic these tcsh key bindings in bash. Thanks!

How to change key mapping systemwide with xmodmap in Fedora?

Posted: 04 Apr 2021 10:26 AM PDT

I am working on making a python script that will allow me to hold alt or some other key in some windows like my IDE and allow me to swap the arrow keys with WASD or ESDF so that I don't need to move my left hand that far and can get back to typing quickly. So far, this is what I got:

def main():      alt_debounce = False        while 1:          if keyboard.is_pressed('alt'):              if alt_debounce is False:                  alt_debounce = True                  os.system("xmodmap -e \"keycode 25 = Up\" && xmodmap -e \"keycode 111 = w\"")                  print(True)          else:              if alt_debounce is True:                  alt_debounce = False                  os.system("setxkbmap -option")                  print(False)      if __name__ == '__main__':      main()  

So far, detecting when alt is held down works flawlessly, but I am having trouble modifying my keys. When I run the software, in my IDE the 'w' key stops working until I release it, while every other letter key works fine. In other software like Firefox or the Terminal, it just completely ignores my script, even if it is run from the terminal and not my IDE. Can someone help me figure out how to get this to work?

ethernet goes down after some time after boot

Posted: 04 Apr 2021 10:09 AM PDT

Am on debian 10 and the ethernet connection goes down after some time after boot.

Workaround: sudo systemctl restart networking

Note: Second computer with different motherboard network card that does this problem. Second computer was working till today :(.

Ethernet card:

04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

Kernel logs when happens:

Apr 4 12:46:13 kernel: [ 214.065598] SGI XFS with ACLs, security attributes, realtime, no debug enabled Apr 4 12:46:13 kernel: [ 214.078066] JFS: nTxBlock = 8192, nTxLock = 65536 Apr 4 12:46:13 kernel: [ 214.108306] QNX4 filesystem 0.2.3 registered.

/etc/network/interfaces:

source /etc/network/interfaces.d/*    auto lo  iface lo inet loopback    allow-hotplug enp4s0  auto enp4s0  iface enp4s0 inet manual    allow-hotplug br0  auto br0  iface br0 inet dhcp          pre-up { brctl addbr br0 && brctl addif br0 enp4s0; } || true          bridge_port enp4s0          bridge_stp off          bridge_fd 0          bridge_maxwait 0  

Whether my process is hung or running

Posted: 04 Apr 2021 10:06 AM PDT

I am running a heavy process on a Linux Machine with GPU. nvidia-smi shows 15GB/16GB used up. CPU utilization is around 70% and MEM around 98.5% but the tqdm progress bar of my process is not being updated for a while. How can I know whether it is actually running or is hung?

How do I mount a cdrom in plan9?

Posted: 04 Apr 2021 10:03 AM PDT

I was hoping to get some data from my linux host's disk onto a virtualized (gnome-boxes) plan9 (9front) installation. A straightforward way to do this with other operating systems is to package all the data in an iso image, and use the Devices&Shares menu to add that as a CD/DVD. But how do I now mount/access the data from this "CD" within the plan9 system?

How to compare user input to a variable

Posted: 04 Apr 2021 09:50 AM PDT

I want to make a bash script that asks for input but this doesn't work.

Echo "Enter code A1"  Read A1    if [[ "$A1" == "1" ]]  then      echo "Accepted"  else      echo "Sorry but that is wrong"  fi  

I am always getting the wrong string even if I answer 1

Translate VS Code Editor regular expression in to sed regular expression

Posted: 04 Apr 2021 10:13 AM PDT

How to translate from moderen editor regex to sed syntax?

Seasoned developer, but complete sed noob here, thank you for looking.

  • Working on Pop OS Linux 20.04 LTS
  • I "cook up" my regular expressions in VS Code as it matches real-time as you key in patterns, very handy!
  • Attempting to edit an XML with sed in my Dockerfile.
  • I have my pattern matching in VS Code, but for the life of me can't seem to find the right sed command syntax.
  • Rewritten my regex 3 different ways, process of elimination isn't working. Cannot find what concept/syntax I'm missing here.

XML Before

<!-- HTTP Connector from upstream proxy -->  <Connector executor="tomcatConnectorThreadPool" port="8081" protocol="org.apache.coyote.http11.Http11Nio2Protocol"              connectionTimeout="3000" enableLookups="false" redirectPort="443" URIEncoding="UTF-8" bindOnInit="false"              scheme="http" proxyPort="80" />  

XML After (What I'm going after)

<!-- HTTP Connector from upstream proxy -->Hello World  

My Regex that works in VS Code

Search Pattern

(<!-- HTTP Connector from upstream proxy -->)(^.*)(^.*)(^.*)  

Replace Pattern

VS Code back-reference = $1

$1Hello World  

sed failures

Guessing why these don't work.

  1. Sorta hairy regex, can't interpret special characters?

    sed -E 's/(<!-- HTTP Connector from upstream proxy -->\n)([<.\w="\-\s\/>]*$)/\1Hello World/g' path/to/xml.xml  
  2. Sub-sub references aren't legal?

    sed -E 's/(<!-- HTTP Connector from upstream proxy -->\n)((^.*\n){3})/\1Hello World/g' path/to/xml.xml  
  3. Not sure why this doesn't work?

    sed -E 's/(<!-- HTTP Connector from upstream proxy -->)\n(^.*)\n(^.*)\n(^.*)/\1Hello World/g' path/to/xml.xml  

How to express these regular expressions in to proper sed command syntax?

How to grep through rotated logs?

Posted: 04 Apr 2021 09:54 AM PDT

I want to know how many unique IPs have connected to my site. The following worked until logs started rotating:

cut -d' ' -f1 /var/log/apache2/access.log | uniq -d | wc -l  

Is grepping through all the logs the idiomatic solution?

Utility or library to send virtual keypress, incl modifiers and function keys on Wayland

Posted: 04 Apr 2021 10:11 AM PDT

I want to make something akin to virtual keyboard, capable of sending virtual keypress of a full keyboard including the modifiers and function keys, but I have never done anything similar to this so I don't even know how the input stack works or how to start googling for this to begin with.

I have heard of libinput, but I don't understand how it would be related to what I want to do; is there anything like a ready-made text utility or something that can trigger a keypress?

EDIT

After a little more digging, I think what I am looking for is triggering scancode or keycode. Just need a decent generic library to do that.

How can a process detect that it's in a child namespace?

Posted: 04 Apr 2021 08:46 AM PDT

I wonder whether it's possible for a process to detect it's in a child namespace (not the root namespace)?

I have researched the subject and found the following code on Github, which says:

// HasNamespace determines if a container is using a particular namespace or the  // host namespace.  // The device number of an unnamespaced /proc/1/ns/{ns} is 4 and anything else is  // higher.  // Only works from inside a container.  

https://github.com/genuinetools/amicontained/blob/568b0d35e60cb2bfc228ecade8b0ba62c49a906a/vendor/github.com/jessfraz/bpfd/proc/proc.go#L461

However, that comment is obsolete, which is demonstrated by:

$ docker run -ti --rm --pid host debian  root@e29ab2d7176b:/# stat --format="%d" /proc/self/ns/net  58  root@e29ab2d7176b:/# stat --format="%d" /proc/self/ns/pid  58  

Here stat --format="%d" /proc/self/ns/pid should result in 4, if the comment was correct.

How can a process detect it's in a child namespace?

How do i increment and decrement a variable based on command line input?

Posted: 04 Apr 2021 08:58 AM PDT

I'm very new to the world of bash scripts and require some assistance. I want to increment a variable by 1 when I provide the script with a certain command line input and decrement it by 1 when providing a different command line input but I don't want to be able to decrement lower than zero. How can I go about this?

My thought process is somewhat like this. I need a counter that starts at zero and some way to read the command line input. Then two if statements that check the input and the count and if both are valid then either do the increment or decrement.

count=0  read input  if(input == "in" && count >= 0)  let "count++"  if(input == "out" && count > 0)  let "count--"  echo $count  

but I'm not sure about the syntax since I'm very new to bash. Am I on the right track at all? Any help would be appreciated.

How do I backport a package that depends on another package which only exists in testing?

Posted: 04 Apr 2021 11:03 AM PDT

I'm trying to backport mailman3-full from Debian Bullseye to Debian Buster. I've followed the official guide, but when executing sudo mk-build-deps --install --remove I get an error:

Removing mailman3-build-deps:amd64 because I can't find python3-importlib-resources:amd64  

I've researched that package, and apparently it's only found on Bullseye (testing), so I can't just install it. How should I proceed to backport mailman3-full? Maybe I also have to backport python3-importlib-resources?

I've also tried adding testing repositories and just installing mailman3-full from there, but then it wants to upgrade a lot of packages to the testing version, which I'm not comfortable with.

Execute an shell script with sudo inside from php

Posted: 04 Apr 2021 10:54 AM PDT

I want to execute a command line command as root from a php file. In my case I want to view the crontab file in my php page.

Running the sudo command in php is not recommended and on my raspberry pi with raspberry pi OS the php line

echo (shell_exec("sudo more /var/spool/cron/crontabs/pi"));  

does not work. So I created a shell script:

crontab.sh

#!/bin/bash  echo "Start Crontab"  sudo more /var/spool/cron/crontabs/pi  echo "End Crontab"  

and I created a php page: crontab.php

<?php  echo "Get Current User: " . get_current_user();  echo "<br>Who am I: ".(exec("whoami"));  echo "<br>";  echo (shell_exec("/var/www/html/cmd/crontab.sh"));  ?>  

When I execute the crontab.sh in the command line. It seems to work. Because I see the crontab text. When I load the php page. I do not see the crontab text. I only see

Get Current User: pi  Who am I: www-data  Start Crontab End Crontab  

What can I do? I had a cron that used rsync to copy the crontab -e file to a cron.txt file every hour. It worked but i do not want to view an (old) copy.

edit: My problem is that the task that starts with sudo gives zero output. In the comments I got the suggestion to use sudo crontab -l. That's better than the line I used because it gives the root crontab and I just did not know of the -l solution. But the problem is still there. There is zero output.

Wifi not working, but it's connected

Posted: 04 Apr 2021 07:37 AM PDT

I'm running alpine Linux on my e-reader, but I can't get WiFi to work. I got it working once, but after a reboot I couldn't get it back.

To ssh into the e-reader using the USB, I run this on my PC:

ifconfig <USB interface> 192.168.2.3  ssh user@192.168.2.2  

Then on my e-reader I run:

ifconfig eth0 up  iwconfig eth0 essid NAME key PASSWORD  

ifconfig gives:

eth0  Link encap:Ethernet  HWaddr 58:B0:D4:71:48:2C          UP BROADCAST MULTICAST  MTU:1500  Metric:1        RX packets:0 errors:0 dropped:37 overruns:0 frame:0        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0        collisions:0 txqueuelen:1000         RX bytes:3908 (3.8 KiB)  TX bytes:0 (0.0 B)    usb0  Link encap:Ethernet  HWaddr 16:16:97:D3:84:43          inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1        RX packets:1286 errors:0 dropped:0 overruns:0 frame:0        TX packets:302 errors:0 dropped:0 overruns:0 carrier:0        collisions:0 txqueuelen:1000         RX bytes:71707 (70.0 KiB)  TX bytes:37189 (36.3 KiB)  

dhclient -v eth0 gives:

Listening on LPF/eth0/58:b0:d4:71:48:2c  Sending on   LPF/eth0/58:b0:d4:71:48:2c  Sending on   Socket/fallback  DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4  DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6  DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13  DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 20  DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17  No DHCPOFFERS received.  No working leases in persistent database - sleeping.  

EDIT: I got it (kinda) working, I need to run all these three commands, and also in that order to get it working.

iwconfig eth0 essid XXX key XXX  wpa_supplicant -B -i eth0 -c /etc/wpa_supplicant.conf -D wext # fails, operation not permitted  dhclient -v eth0  

The only problem I have right now, I can ping IPs, but not domains?

(none):/home/user# ping 8.8.8.8  PING 8.8.8.8 (8.8.8.8): 56 data bytes  64 bytes from 8.8.8.8: seq=0 ttl=119 time=16.403 ms  64 bytes from 8.8.8.8: seq=1 ttl=119 time=12.965 ms  ...  (none):/home/user# ping google.com  ping: bad address 'google.com'  

I think this is related to the USB connection between my PC and the e-reader, I can only ping my PC from the e-reader, no other internal IP. (It can't access my DNS server)

EDIT 2:

I disabled ssh over the USB, and connected using the IP. Now also the DNS is fixed, and everything works perfectly.

I still don't know why I need both iwconfig and wpa_supplicant tho?

How to display all CPUInfo flags into alphabetical order?

Posted: 04 Apr 2021 07:53 AM PDT

I need some help with the following:

Write a single command that lists the features/capabilities of the CPU on your Linux machine, one per line, sorted alphabetically.

The single command may use pipes and re-direction, but must not simply combine commands (e.g., using ;).
An example of the first few lines of the contents is:

3dnewprefect  abm  aes  apic  ...  

This is what I have so far, but it's not sorting it alphabetically:

lscpu | grep -i flags | sort -d  

How to append a missing line only by comparing 2 columns in 2 different files

Posted: 04 Apr 2021 09:33 AM PDT

I have two files

file1 (reference file)

xxx xxxxx 00      xxx xxxxx 01      xxx xxxxx 02      xxx xxxxx 03      xxx xxxxx 04      xxx xxxxx 00      xxx xxxxx 01       xxx xxxxx 02      xxx xxxxx 03      xxx xxxxx 04     

file2

12345 2021/04/02 00      1212  2021/04/02 01      12123 2021/04/02 02      12123 2021/04/02 04      1223  2021/04/03 01      124   2021/04/03 02      123   2021/04/03 03      

And I want to compare last field on each file and append the missing row from first file(my reference file)

For example I want the out put to be

12345 2021/04/02 00      1212  2021/04/02 01      12123 2021/04/02 02      xxx   xxxxx      03      12123 2021/04/02 04      xxx   xxxxx      00       1223  2021/04/03 01      124   2021/04/03 02      123   2021/04/03 03      xxx   xxxxx      04      

I have tried using awk -F ' ' 'NR==FNR{a[$2]++;next}a[$2] && $1>=00' test2.txt test1.txt, which appends the missing third value from the file1 but output removes the data I need (2nd and 3rd fields) as well. Please help.

Unable to connect to wlan0 (Kali)

Posted: 04 Apr 2021 10:52 AM PDT

I am running Kali Linux, and I was unable to connect to Wi-Fi.  I was searching on the Internet for half an hour.  I tried a lot of things.  Finally, I had installed Wi-Fi driver compat-wireless.

I know that it is deprecated. Although I tried cause, backport wasn't working properly. When I had unloaded compat-wireless. I got wlan0 and wlan1. But, no wireless connection is showing.

screenshot – wlan1 selected

Last time when I tried that by restarting my laptop. I notice that those connection isn't visible anymore. Why it is happening? I earlier said that backport isn't working. When I unloaded backport. I get the error:

/--------------  | Your kernel headers are incomplete/not installed.  | Please install kernel headers, including a .config  | file or use the KLIB/KLIB_BUILD make variables to  | set the kernel to build against, e.g.  |   make KLIB=/lib/modules/3.1.7/  | to compile/install for the installed kernel 3.1.7  | (that isn't currently running.)  \--  make: *** [Makefile:41: unload] Error 1  

I am adding screenshots of what I said/tried.

┌──(istiak㉿kali)-[~]  └─$ sudo airmon-ng                                                          1 ⨯  [sudo] password for istiak:     PHY Interface   Driver      Chipset    phy0    wlan0       iwlwifi     Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)  

screenshot

screenshot

┌──(istiak㉿kali)-[~]  └─$ sudo ifconfig wlan0 up             SIOCSIFFLAGS: Input/output error  

I added most of them as source code which is needed.

iwconfig    lo        no wireless extensions.    eth0      no wireless extensions.    wwan0     no wireless extensions.    docker0   no wireless extensions.    wlan0     IEEE 802.11  ESSID:off/any            Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm            Retry short limit:7   RTS thr:off   Fragment thr:off            Encryption key:off            Power Management:off    wlan1     IEEE 802.11  ESSID:off/any            Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm            Retry short limit:7   RTS thr:off   Fragment thr:off            Encryption key:off            Power Management:off    hwsim0    no wireless extensions.  

When I don't use laptop for few hours, wlan0 works fine again.  But, using laptop 1-2 hours suddenly I face the issue again.

Look it is working fine:
screenshot
after leaving turn off laptop for 10-20 minutes.  After updating the question I have lost my connection again.

┌──(istiak㉿kali)-[~]  └─$ ifconfig  docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500          inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255          ether 02:42:d7:97:c3:66  txqueuelen 0  (Ethernet)          RX packets 0  bytes 0 (0.0 B)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 0  bytes 0 (0.0 B)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500          inet 192.168.0.109  netmask 255.255.255.0  broadcast 192.168.0.255          inet6 fe80::4f08:a5d3:bba9:30fb  prefixlen 64  scopeid 0x20<link>          ether f0:de:f1:da:7d:80  txqueuelen 1000  (Ethernet)          RX packets 174405  bytes 220965740 (210.7 MiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 52107  bytes 7856121 (7.4 MiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0          device interrupt 20  memory 0xf2500000-f2520000    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536          inet 127.0.0.1  netmask 255.0.0.0          inet6 ::1  prefixlen 128  scopeid 0x10<host>          loop  txqueuelen 1000  (Local Loopback)          RX packets 170  bytes 19457 (19.0 KiB)          RX errors 0  dropped 0  overruns 0  frame 0          TX packets 170  bytes 19457 (19.0 KiB)          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  

Output of lspci:

┌──(istiak㉿kali)-[~]  └─$ lspci -knn |grep Net -A2                                        255 ⨯    00:19.0 Ethernet controller [0200]: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) [8086:1502] (rev 04)      Subsystem: Lenovo ThinkPad T520 [17aa:21ce]      Kernel driver in use: e1000e  --  03:00.0 Network controller [0280]: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] [8086:0085] (rev 34)      Subsystem: Intel Corporation Centrino Advanced-N 6205 (802.11a/b/g/n) [8086:1311]      Kernel driver in use: iwlwifi  

Output of lspci:

┌──(istiak㉿kali)-[~]  └─$ iw dev    phy#0      Interface wlan0          ifindex 3          wdev 0x1          addr a2:1e:b7:a8:76:10          type managed          txpower 15.00 dBm  

I took two screenshot what was happening when I had wireless connection.

┌──(istiak㉿kali)-[~]  └─$ iwconfig  lo        no wireless extensions.    eth0      no wireless extensions.    wlan0     IEEE 802.11  ESSID:"Xisilon.Xyz"              Mode:Managed  Frequency:2.417 GHz  Access Point: 0C:80:63:D1:53:20               Bit Rate=162 Mb/s   Tx-Power=15 dBm               Retry short limit:7   RTS thr:off   Fragment thr:off            Power Management:off            Link Quality=63/70  Signal level=-47 dBm              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0            Tx excessive retries:0  Invalid misc:22   Missed beacon:0    wwan0     no wireless extensions.    docker0   no wireless extensions.  

When I don't have wlan0.

┌──(istiak㉿kali)-[~]  └─$ iwconfig  lo        no wireless extensions.  eth0      no wireless extensions.  wlan0     IEEE 802.11  ESSID:off/any              Mode:Managed  Access Point: Not-Associated   Tx-Power=15 dBm               Retry short limit:7   RTS thr:off   Fragment thr:off            Power Management:off  wwan0     no wireless extensions.  docker0   no wireless extensions.  

Output of lspci:

┌──(istiak㉿kali)-[~]  └─$ lspci                       00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)  00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)  00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)  00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)  00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)  00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)  00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)  00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)  00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)  00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)  00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)  00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)  00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset LPC Controller (rev 04)  00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port Mobile SATA AHCI Controller (rev 04)  00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)  03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)  0d:00.0 System peripheral: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 07)  

I have Windows alongside Kali Linux. When I work in Windows while I don't Kali Linux wlan0 works well in Windows.

enter image description here enter image description here

┌──(istiak㉿kali)-[~]  └─$ lsusb                     Bus 002 Device 005: ID 08e6:34ec Gemalto (was Gemplus) Compact Smart Card Reader Writer  Bus 002 Device 004: ID 1199:9013 Sierra Wireless, Inc. Sierra Wireless Gobi 3000 Modem device (MC8355)  Bus 002 Device 003: ID 046d:c058 Logitech, Inc. M115 Mouse  Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub  Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  Bus 001 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo Integrated Camera (0.3MP)  Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. BCM2045B (BDC-2.1)  Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor  Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  

@telcoM I did as you said. But, my wlan0 is set to DOWN. I am unable to change the state also by doing as you said. Earlier, I was unable to changed the state also. :(

┌──(istiak㉿kali)-[~]  └─$ ip link show     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000      link/ether f0:de:f1:da:7d:80 brd ff:ff:ff:ff:ff:ff  3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000      link/ether 56:00:07:23:21:08 brd ff:ff:ff:ff:ff:ff permaddr 10:0b:a9:cb:ff:ec  4: wwan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000      link/ether 26:99:71:e7:f1:f9 brd ff:ff:ff:ff:ff:ff  5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default       link/ether 02:42:4b:fe:c9:60 brd ff:ff:ff:ff:ff:ff                                                                                                                                                                             ┌──(istiak㉿kali)-[~]  └─$ ip link set dev wlan0 up  RTNETLINK answers: Operation not permitted                                                                                                                                                                             ┌──(istiak㉿kali)-[~]  └─$ sudo ip link set dev wlan0 up                                                                                                                                    2 ⨯  [sudo] password for istiak:   RTNETLINK answers: Input/output error  

Finally, I have understood why I am having the issue. But, I don't know how to fix. When laptop gets hotter and hotter I lost my wireless connection. Between 23 minutes I lost my wireless connection. enter image description here

Note: I don't have much more skill with Linux. I am very beginner level Linux user.

Not running .sh files by double-clicking

Posted: 04 Apr 2021 09:53 AM PDT

I have a problem executing a **.sh file. I can run it from terminal, but I want it to run automatically when i double-click it. I 've tried many things such as chmod -x Test.sh but they didn't work. Every time I double-click the file, it opens on Text Editor. Here is the text in my file:

#!/bin/bash    xdg-open https://www.google.com    cd ..  cd username  cd Desktop    mkdir Test  

My OS is Ubuntu 20.04 and I am using Text Editor.

Is it possible to change the terminal colour based on Nightshift (sunset/-rise)

Posted: 04 Apr 2021 11:00 AM PDT

I want to have a conditional terminal color based on the Nightshift (sunrise/-set).

I am using macOS BigSur 11.2.3 and the default terminal with zsh.

what timedate value is always greater than any timedate?

Posted: 04 Apr 2021 09:21 AM PDT

What timedate value is always greater than any timedate?

In a script, I want to provide an argument to variable duration so that the loop will run forever until I kill the process:

# `duration` has a value in seconds  end=$(($(date +%s) + duration))      while true; do      # ...      [ $(date +%s) -ge $end ] && break      # ...  done  

How to identify the python, pip and installed modules location on linux?

Posted: 04 Apr 2021 09:36 AM PDT

I started learning python but I am finding it difficult to understand on linux.

uname -a  Linux machine-name 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux    which python  /usr/local/bin/python    which pip  /usr/local/bin/pip    pip --version  /usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.    utils.PersistentlyDeprecated2018,  pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)    python  Python 2.7.16 (default, May  6 2020, 13:05:58)   [GCC 4.8.4] on linux2  Type "help", "copyright", "credits" or "license" for more information.  >>> import os  >>> import urllib2  >>> os.path.abspath(urllib2.__file__)  '/usr/local/lib/python2.7/urllib2.pyc'    pip install requests  /usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.    utils.PersistentlyDeprecated2018,  Requirement already satisfied: requests in ./dist-packages (2.22.0)  Requirement already satisfied: idna<2.9,>=2.5 in ./dist-packages (from requests) (2.8)  Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./dist-packages (from requests) (3.0.4)  Requirement already satisfied: certifi>=2017.4.17 in ./dist-packages (from requests) (2020.4.5.1)  Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./dist-packages (from requests) (1.25.9)    Python 2.7.16 (default, May  6 2020, 13:05:58)   [GCC 4.8.4] on linux2  Type "help", "copyright", "credits" or "license" for more information.  >>> import os  >>> import requests  Traceback (most recent call last):    File "<stdin>", line 1, in <module>  ImportError: No module named requests  >>>   

pip install requests, says as installed. But when checked in interactive mode, errors out as no module name requests. Can you please help me to understand from which locations these modules are being used (where this path has been set ?) and how to install modules at that particular location ?

Can you please help me ?

Using sed to mass rename files according to contents in those files?

Posted: 04 Apr 2021 10:17 AM PDT

I have a bunch of files which all contain the pattern SIZE1=%d. Is there a way to find that decimal and prefix each filename with %d_?

Further if each of the files contain SIZE1=%d and SIZE2=%e can I somehow prefix each filename with %d_%e_?

I am trying to get a feel for how much I can do with sed as I have little experience with it.

Edit: For example I have a file test_result.log. Somewhere in that file are separate lines SIZE1=100 and SIZE2=150. I want to rename the file 100_150_test_result.log.

Remove redundant openvpn config service from Systemd

Posted: 04 Apr 2021 11:03 AM PDT

I used to have a config for openvpn. After upgrading to 18.04 it started behaving differently in relation to systemd, my syslog gets continuously spammed with connection attempts:

ovpn-login[5191]: Options error: In [CMD-LINE]:1: Error opening configuration file: /etc/openvpn/login.conf  ovpn-login[5191]: Use --help for more information.  systemd[1]: openvpn@login.service: Main process exited, code=exited, status=1/FAILURE  systemd[1]: openvpn@login.service: Failed with result 'exit-code'.  

The login.conf does not exist and should not exist - I want to clean this up and get rid of the entry so it stops trying to connect to a service that doesn't exist.

I've tried systemctl kill openvpn@login.service, systemctl disable openvpn@login.service both with systemctl daemon-reload afterwards to no avail.

However, there is no file that matches openvpn@login.service anywhere, it is templated from /lib/systemd/system/openvpn-client@.service.

Presumably I need to keep that file around should I want to add some VPN configs in the future. I did try removing it and doing systemctl daemon-reload as per an answer elsewhere on StackExchange, again, to no avail.

How do I get rid of this spurious systemd configuration entry?


Edit: even after apt purge openvpn and trying to remove all traces it still has:

openvpn@login.service: Failed to schedule restart job: Unit openvpn@login.service not found.

Where is it picking this up from?

Blinking cursor after new partition and install (ubuntu-mate)

Posted: 04 Apr 2021 09:02 AM PDT

Following these instructions exactly:

  1. https://ubuntu-mate.community/t/gpar...dows-users/797
  2. https://ubuntu-mate.community/t/inst...lse-method/651 to partition a 1TB SSD and install Ubuntu-Mate off a live USB.

My partitioning is different than the instructions as follows(also see attached image)

1 esp 550MiB  2 root 40 GB  3 home 640 GB  4 swap 128GB  

At the blinking cursor, I can either ALT-F4 to boot to UEFI or ESC and I (capital i) or continue to boot to my 2nd SSD with a Windows 10 install.

If I try holding the SHIFT key on reboot I instead see capital GRUB with a blinking cursor on a black screen.

Hitting RETURN takes me to my 2nd SSD with a Win 10 install.

The only change I have made to my UEFI is to disable FastBoot.

Next I tried Boot Repair from a live USB, and attempted to reinstall my grub, but for some reason it did not 'see' my ESP at sda1, only sda and sda2 which is my root partition.

So, probably a mistake, I let it go ahead and install grub in sda2.

After rebooting, same result, blinking cursor.

Next I relaunched gparted from a live USB and reexamined my partitions.

Now I was seeing an error icon on my ESP at sda1, saying it wasn't recognized because I was missing certain files (see attached esp_warning).

I am also getting a warning whenever launching gparted about a discrepancy between Linux and the driver descriptor in regards to physical block size. (attached LibParted_warning)

Question> For my GPT partitioned drive, does it matter what partition flag I have set for my ESP? It was set to 'boot', then I tried 'bios-grub' but neither worked. Results of boot-repair here http://paste.ubuntu.com/23750353/

The Boot Repair results DO seem to indicate a few things wrong. I assume that reinstalling grub with Boot repair AFTER setting my ESP flag to bios-grub may be part of the reason?

And before anyone comments on my swap size
1- storage is relatively cheap.
2- I use my Linux PC primarily for particle simulations in Houdini and got some feedback from Linux-Houdini experts a lot more knowledgeable than I
3- If after several months of use I discover I rarely use that amount, I assume I can easily increase my home partition and reduce swap.

I realize this is a long post but trying to include as much information as possible.

partition libParted warning esp warning

SVN connection refused (Ubuntu)

Posted: 04 Apr 2021 10:03 AM PDT

I'm trying to check out my repository, but it can not connect to my project archive and refuses the connection. When I try to checkout in Uni it works, but not at home. I tried to change the ~/.subversion/servers file but it didn't work. I've been struggling with this issue for a long time, can anyone help me ?

svn: E170013: Konnte nicht mit Projektarchiv bei URL »https://www.myrepository.org« verbinden    svn: E000111: Fehler beim Ausführen des Kontextes: Verbindungsaufbau abgelehnt  

How to copy files to the timestamp generated directory?

Posted: 04 Apr 2021 08:01 AM PDT

Hello I am trying to copy all files from Documents directory to the backup directory that has a timestamp. So I have created a directory called bk$( the time stamp of the directory) and I am trying to copy files from the Documents directory to the new created directory that is unique. This will be in a crontab backing up files from documents and when the backup will kick in, it will create new directory for each backup that is uniquely identified by the directory timestamp. For some reason I cannot get the cp or cpio -mdp.

bkdate="date +%Y_%m_%d_%H_%M_%S"  PATH=/home/user/backup/  bksource="/home/user/Documents/"    mkdir /home/user/backup/"bk$(date +%Y_%m_%d_%H_%M_%S)"  cp $bksource * ls | tail -l | $PATH  

I could of went with the ctime but unfortunately it does not work with the directory creation date.

This was my approach but with the latest created directory and not file

find $HOME -type d -daystart ctime 0  

If someone could please help me out to copy to that new directory, I would really appreciate it.

Solution: This is one solution using target. I am open to other ways that could be used for this purpose.

bkdest=/home/user/backup  bksource=/home/user/Documents  target=${bkdest}/bk.$(date +%Y_%m_%d_%H_%M_%S)  mkdir -p $target  cp ${bksource}/* ${target}/  

laptop enery management for improving battery lifetime Linux

Posted: 04 Apr 2021 10:31 AM PDT

I have bought a Lenovo Ideapad that cames with Windows preinstalled. I installed Ubuntu 14.04 to dual boot. There is a tool for Windows called Lenovo Energy Manager that allows to control the charge of your battery, I mean, I can configure it so that when my computer is connected to AC and the charge is 60%, the computer takes all the energy from the AC and not from the battery. Doing this the battery lifetime is longer. Do you know some software similar for Ubuntu?

Why doesn't grep ignore binary files by default?

Posted: 04 Apr 2021 08:39 AM PDT

The manpage for grep describes the -I flag as follows:

-I      Ignore binary files.  This option is equivalent to           --binary-file=without-match option.  

It also says this about binary files:

 --binary-files=value Controls searching and printing of binary files.           Options are binary, the default: search binary files but do not print           them; without-match: do not search binary files; and text: treat all           files as text.  

I cannot think of a scenario where I would care about matches in binary files. If such a scenario exists, surely it must be the exception rather than the norm. Why doesn't grep ignore binary files by default rather than requiring setting this flag to do so?

No comments:

Post a Comment