Sunday, July 24, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to distribute files per directories based on names of these files?

Posted: 23 Jul 2022 11:11 AM PDT

I have camera pictures stored in files with names

192.168.33.16_01_20220723150356205_MOTION_DETECTION.jpg  

I want to move each file into separate directory per date

I found that command

find | awk '{print $1, substr($1,20,8)}'   

prints tuples of filenames and desired target directory

Can I pipe output of this command to command like

mkdir -p $2; mv $1 $2  

somehow? May be with xargs?

Add commas in place of number with sed?

Posted: 23 Jul 2022 11:16 AM PDT

Trying to write a simple script to fetch ethereum price and format the response.

Here is what I've tried:

#!/bin/bash    response=$(curl 'https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=GBP')  price=$(echo $response | grep -o -P '(?<=:).*(?=})')  formattedPrice=$(echo "${price%.*}" | sed 's/\([[:digit:]]\{3\}\)\([[:digit:]]\{3\}\)\([[:digit:]]\{3\}\)/\1,\2,\3/g')    echo "£$formattedPrice"  

Although it doesn't add the commas.

Given Size in Terminal Row and Column units, how to calculate equivalent number pixels

Posted: 23 Jul 2022 10:14 AM PDT

I have a program which makes available 2 shell variables $width and $height, which are the desired width and desired height in "rows" and "columns" of an output (in this case a sixel image) to the terminal.

How would I go about converting these $height and $width values from row/column units to pixel units?

#!/bin/bash  pixelsperrow=# How  pixelspercolumn=# How  heightpixels=$(($height*$pixelsperrow))  widthpixels=$(($width*$pixelspercolumn))  

I also noticed my terminal emulator (foot) provides an environment variable $COLUMNS which is the current number of column available in the terminal window. I am using river (a wayland tiling window manager) as my WM if that is relevant.

Debian 11 - How can i lower the load on my server?

Posted: 23 Jul 2022 11:06 AM PDT

I'm currently running a Debian 11 with a load average of 4. I want to lower this load - But i don't really know where to start, like a first step on at least the analisis part...

It's a Docker Server, with MySQL,

Below a few commands and its outputs, to give some overview of the server.

Processes:

administrator@srv-docker:~$ top -b -n 1 | head -n 20  top - 12:56:41 up 12 days,  4:28,  1 user,  load average: 4,19, 4,16, 4,14  Tasks: 242 total,   1 running, 241 sleeping,   0 stopped,   0 zombie  %Cpu(s):  1,4 us,  2,1 sy,  0,0 ni, 81,6 id, 14,9 wa,  0,0 hi,  0,0 si,  0,0 st  MiB Mem :   7955,3 total,    131,5 free,   1877,4 used,   5946,4 buff/cache  MiB Swap:      0,0 total,      0,0 free,      0,0 used.   5733,5 avail Mem        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND   775840 systemd+  20   0 4996956 973276  35944 S  11,8  11,9   1019:50 mysqld  1856787 adminis+  20   0   10480   3956   3372 R  11,8   0,0   0:00.03 top        1 root      20   0  164224  10424   7656 S   5,9   0,1   0:11.93 systemd  1184306 472       20   0 1974008 119776  60416 S   5,9   1,5  10:40.71 grafana-server        2 root      20   0       0      0      0 S   0,0   0,0   0:00.67 kthreadd        3 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_gp        4 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_par_gp        6 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/0:0H-events_highpri        8 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 mm_percpu_wq        9 root      20   0       0      0      0 S   0,0   0,0   0:00.00 rcu_tasks_rude_       10 root      20   0       0      0      0 S   0,0   0,0   0:00.00 rcu_tasks_trace       11 root      20   0       0      0      0 S   0,0   0,0   3:07.86 ksoftirqd/0       12 root      20   0       0      0      0 I   0,0   0,0  21:54.79 rcu_sched  

Memory:

administrator@srv-docker:~$ free -mh                 total        used        free      shared  buff/cache   available  Mem:           7,8Gi       1,8Gi       125Mi        49Mi       5,8Gi       5,6Gi  Swap:             0B          0B          0B  

IO Stat:

root@srv-docker:~# iostat -m  Linux 5.10.0-16-amd64 (srv-docker)      23/07/2022      _x86_64_        (8 CPU)    avg-cpu:  %user   %nice %system %iowait  %steal   %idle             0,92    0,00    1,12    9,31    0,00   88,65    Device             tps    MB_read/s    MB_wrtn/s    MB_dscd/s    MB_read    MB_wrtn    MB_dscd  dm-0              0,03         0,00         0,00         0,00        757         54       2965  dm-1              0,22         0,00         0,00         0,00        351       1863        758  dm-2              0,00         0,00         0,00         0,00          2          0          0  dm-3              0,00         0,00         0,00         0,00          3          4          0  dm-4              0,01         0,00         0,00         0,00         15        136       3578  dm-5            204,93         0,00         1,90         0,01       3929    2009381      12419  sda             155,93         0,00         1,82         0,02       5071    1919118      20230  sr0               0,00         0,00         0,00         0,00          0          0          0  

VM Stat:

root@srv-docker:~# vmstat  procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----   r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st   1  0      0 140500 216556 5868484    0    0     1   233    5    3  1  1 89  9  0  

Perf top:

Perf top results.

MP Stat:

root@srv-docker:~# mpstat -P ALL  Linux 5.10.0-16-amd64 (srv-docker)      23/07/2022      _x86_64_        (8 CPU)    15:04:53     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle  15:04:53     all    0,92    0,00    0,67    9,31    0,00    0,46    0,00    0,00    0,00   88,65  15:04:53       0    1,14    0,00    0,80    7,02    0,00    1,05    0,00    0,00    0,00   90,00  15:04:53       1    0,67    0,00    0,64   27,24    0,00    0,46    0,00    0,00    0,00   70,99  15:04:53       2    1,13    0,00    0,86   12,72    0,00    0,50    0,00    0,00    0,00   84,79  15:04:53       3    0,70    0,00    0,47    3,16    0,00    0,29    0,00    0,00    0,00   95,38  15:04:53       4    1,11    0,00    0,84   10,40    0,00    0,41    0,00    0,00    0,00   87,24  15:04:53       5    0,74    0,00    0,46    2,82    0,00    0,27    0,00    0,00    0,00   95,71  15:04:53       6    1,14    0,00    0,82    8,55    0,00    0,39    0,00    0,00    0,00   89,10  15:04:53       7    0,71    0,00    0,45    2,66    0,00    0,28    0,00    0,00    0,00   95,90  

Please, can someone help me? Thanks in advance... Any light is appreciate it.

Deleted Kali identifier but still it shows in bios

Posted: 23 Jul 2022 10:13 AM PDT

Previously I had installed Kali Linux but few days later I deleted it. The way I did it (1) was to first delete the partition then using diskpart and rd. Still it was showing on my BIOS. So (2) I deleted the identifier. But recently it popped up again on my BIOS. In firmware except the windows boot manager there are 5 other firmwares. Their descriptions are: windows boot manager, Debian, EFI USB, EFI DVD/CDROM, EFI Network. No matter how many times I delete Kali identifier it still shows in the BIOS. But it doesn't show in the firmware list.

Different Plugins for Different Filetypes Neovim

Posted: 23 Jul 2022 09:37 AM PDT

I've used Neovim in the past for writing LaTex documents and have found that experience pretty great.

I'm considering expanding my usage so that it becomes my daily driver for software development.

However, I have no idea how I'd make it so that I could use different plugins for different filetypes which, I'd assume, would be necessary.

Am I overcomplicating this? What would the usual workflow look like?

I'll be working with:

  • LaTex
  • C, C++, C#
  • Flutter/Dart
  • Typescript/JS
  • VHDL
  • MatLab

Please note, I'm not asking for how to set it up for each of these languages, that would be far too much for one question, just how to have different configs for each language without having to manually swap config files in and out.

PPP0 Client Routing

Posted: 23 Jul 2022 09:32 AM PDT

Firstly, my knowledge of routing and network architecture is basic. I apologise if this is extremely low level.

I have a raspberry pi with two interfaces - eth0 and ppp0 . The pi is also hosting dnsmasq, running dhcp and dns server. My "main" network is running on eth0 - my gateway address is 192.168.0.1 and pi is 192.168.0.2, with other devices connecting on 192.168.0.1xx.

I have also now successfully been able to connect external devices via ppp interfaces (xl2tpd and IPsec). The IP address of the pi on this interface is 192.168.20.1, and peers connect on 192.168.20.2. However when I connect I cannot see anything behind the 192.168.20.1 server. I would like to route to my internal network and ultimately through the default gateway (192.168.0.1). I am not 100% whether this should be a routing solution of forwarding. However my gut is saying that routing is probably the best solution!

I apologise if this is a little bit muddled, if you require any further clarification please let me know. I am just fried trying to solve this, and have tried to create static routes with no success! Any help would be greatly appreciated!

is it possible to use wireshark to capture https request that send from localhost node server

Posted: 23 Jul 2022 08:59 AM PDT

I am trying to use wireshark to decrypt the https request. I have tried to write the tls key to local folder by setting:

export SSLKEYLOGFILE=~/apps/wireshark/debug.log  

it works fine when I using google chrome to access the https website. But I could not capture the http request that send from localhost Node server. is it possible to capture the https that send from localhost Node server? what should I do to make it capture success? The full http workflow look like this:

http request tools(local machine) -> localhost node server(local machine) -> remote cloud service(remote machine)  

How to view OpenVPN connections?

Posted: 23 Jul 2022 09:13 AM PDT

I want to view the open connections between my OpenVPN client and server via the server. Not sure how to do this as tcpdump does not show anything, yet OpenVPN is working and running.

Again, when SSHing into my OpenVPN servers, all I can see are my SSH packets being sent over and nothing for OpenVPN. Why?

Thanks!

split file by awk

Posted: 23 Jul 2022 08:41 AM PDT

Here is my file which contains three columns and separate by "\t", and the delimiter of the second column is a space

       1   a b    tom         2   a b c  sim         3   a      mary         4   o l    shey            5   c      bob  

I want to get the first file which the second column contains multiple elements

       1   a b    tom         2   a b c  sim         4   o l    shey   

and then I want to get the second file like this

       1    a     tom         1    b     tom         2    a     sim         2    b     sim         2    c     sim         4    o     shey         4    l     shey  

Actually, i have tried that

awk -F\\t 'BEGIN {OFS=FS} {n=split($2,aa,",");for (i=1;i<=n;i++) {$2=aa[i]; printf "%s\n" $0 }}'  

but it looks like didn't work. Can you give me some advice? thanks.

Why bash histroy rewrite IP and User data

Posted: 23 Jul 2022 10:41 AM PDT

I'm use HISTTIMEFORMAT like this:

HISTFILESIZE=4000  HISTSIZE=4000  USER_IP="`echo $SSH_CLIENT | awk '{ print $1}'`"  USER_FIO=($USER_RYBAV $USER_TROVL)  HISTTIMEFORMAT="%d/%m/%y %T $USER_IP:$USER_FIO | "  export HISTTIMEFORMAT  

and in .ssh/authorized_keys

environment="USER_TROVL=torvalds.linux" ssh-rsa AAAAB3N....  environment="USER_RYBAV=rybafing.valing" ssh-rsa AAAAB3....    

And when I'm login by 1 rsa, I got in history:

  178  22/07/22 16:48:07 10.100.19.204:torvalds.linux exit    179  22/07/22 16:48:12 10.100.19.204:torvalds.linux lsblk     180  22/07/22 16:48:14 10.100.19.204:torvalds.linux history  

When I'm loggin by 2 rsa:

  178  22/07/22 16:48:07 10.100.19.204:rybafing.valing exit    179  22/07/22 16:48:12 10.100.19.204:rybafing.valing lsblk     180  22/07/22 16:48:14 10.100.19.204:rybafing.valing history    181  22/07/22 16:48:18 10.100.19.204:rybafing.valing exit    182  22/07/22 16:48:30 10.100.19.204:rybafing.valing lsblk   

How you can see $USER_FIO from .bash_profile rewriting at any connection with different keys and env.

I expect no rewrite user logins:

  178  22/07/22 16:48:07 10.100.19.204:**torvalds.linux** exit    179  22/07/22 16:48:12 10.100.19.204:**torvalds.linux** lsblk     180  22/07/22 16:48:14 10.100.19.204:**torvalds.linux** history    181  22/07/22 16:48:18 10.100.19.204:rybafing.valing exit    182  22/07/22 16:48:30 10.100.19.204:rybafing.valing lsblk   

XMP and GPU Crash

Posted: 23 Jul 2022 08:04 AM PDT

I have a question mostly related to hardware, if by any chance someone have an idea I might try.

I was experiencing random crash lately, 2/3 times a day, and logs pointed out GPU errors. Never really the same, mostly:
[drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed to initialize parser -125!
But also for example:

amdgpu: SMU load firmware failed  amdgpu: 81 │ failed to send message 302 ret is 0  

So after going down the rabbit hole, updating mesa, amd drivers and co. I figured out the problem started when I changed my RAM... And enabled XMP.

Previously my RAM were 2400 MHz and I upgraded to 3600 MHz (supported by my MOBO).

Some specs:

  • Mother board: MSI Z390-A PRO
  • Current RAM: 2 x Corsair Vengeance LPX 16GB DDR4 3600 (‎CMK32GX4M2D3600C18)
  • Previous RAM 4 x Corsair Vengeance LPX 4GB DDR4 2400 (‎CMK8GX4M2A2400C16)
  • GPU: Sapphire Nitro+ Radeon RX 570 4Go GDDR5

So everything worked great with my previous 2400 MHz and not with my 3600 MHz with XMP. Now I run without XMP at 2133 MHz, but no freeze.

So I guess it must be a XMP parameter of some sort, some kind of under voltage. Well, I know nothing about that, just used my BIOS to do it automatically.
I looked it up a bit, it seems that my current RAM needed 1,35V and that was indeed the voltage provided by my system.

Terminal Specific Aliases

Posted: 23 Jul 2022 08:01 AM PDT

Is there a way to have a terminal specific alias?

For example: I want to use "vim" and "nvim" to refer to vanilla vim on terminal.app but I want "vim" and "nvim" to refer to NeoVim on Iterm2.

Which is more reliable, $DESKTOP_SESSION or $XDG_CURRENT_DESKTOP

Posted: 23 Jul 2022 07:42 AM PDT

Which environment variable has better support. I know that desktops like GNOME or Plasma will definitely support both, but for other sessions (like i3wm, LXDE or enlightenment), which one would have better support / standardisation?

NixOS: Ensure root-level folder exists

Posted: 23 Jul 2022 07:56 AM PDT

At work we tend to keep our large code workspaces under a /scratch folder. Is there a NixOS option to declare such a folder/file should exist?

I know about environment.etc which will setup symlink from /etc into the nix store.

Otherwise I'd have to resort to declare some systemd boot-up script, doing mkdir -p and so on - which feels ugly.

Btrfs and lack of free disk space

Posted: 23 Jul 2022 08:00 AM PDT

Good afternoon!

I was in the process of writing files via rsync and had enough free disk space, but I am using btrfs and btrfs shows that the free space has run out. Can you please tell me how to deal with this situation? I deleted unnecessary files, but it didn't help.

Can you please tell me how to make the system work again? Judging by the output of the du utility, I should still have about 150 GB.

Additional info:

❯ df -h | grep "sda"  /dev/sda4          515G         513G  5,6M          100% /  /dev/sda4          515G         513G  5,6M          100% /var/log  /dev/sda4          515G         513G  5,6M          100% /home  /dev/sda4          515G         513G  5,6M          100% /var/cache  /dev/sda1          996M         1,5M  995M            1% /boot/efi    ❯ mount | egrep "sda"  /dev/sda4 on / type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=815,subvol=/@)  /dev/sda4 on /var/log type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=260,subvol=/@log)  /dev/sda4 on /home type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=814,subvol=/@home)  /dev/sda4 on /var/cache type btrfs (rw,noatime,compress=zstd:3,space_cache,autodefrag,subvolid=259,subvol=/@cache)  /dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)    [root@localhost]# du -sh / 2> /dev/null  346G    /    [root@localhost]# btrfs fi df /  Data, single: total=506.52GiB, used=506.51GiB  System, DUP: total=8.00MiB, used=80.00KiB  Metadata, DUP: total=4.00GiB, used=2.71GiB  GlobalReserve, single: total=512.00MiB, used=0.00B    [root@localhost]# btrfs fi usage /  Overall:      Device size:         514.53GiB      Device allocated:        514.53GiB      Device unallocated:        1.03MiB      Device missing:          0.00B      Used:            511.92GiB      Free (estimated):          5.31MiB  (min: 5.31MiB)      Free (statfs, df):         5.31MiB      Data ratio:               1.00      Metadata ratio:           2.00      Global reserve:      512.00MiB  (used: 0.00B)      Multiple profiles:              no    Data,single: Size:506.52GiB, Used:506.51GiB (100.00%)     /dev/sda4     506.52GiB    Metadata,DUP: Size:4.00GiB, Used:2.71GiB (67.64%)     /dev/sda4       8.00GiB    System,DUP: Size:8.00MiB, Used:80.00KiB (0.98%)     /dev/sda4      16.00MiB    Unallocated:     /dev/sda4       1.03MiB  

Update:

[root@localhost]# echo "     Total   Exclusive  Set shared  Filename"; find . -maxdepth 1 -type d | grep './' | xargs -I{} btrfs filesystem du -s {} 2> /dev/null | grep -v 'Total'       Total   Exclusive  Set shared  Filename   266.01GiB    67.92GiB   189.58GiB  ./home    64.89GiB     7.96GiB    56.93GiB  ./var   111.59MiB    34.20MiB    77.39MiB  ./boot     6.76MiB     2.52MiB     3.79MiB  ./etc       0.00B       0.00B       0.00B  ./mnt     1.06GiB   113.59MiB   582.69MiB  ./opt       0.00B       0.00B       0.00B  ./srv     8.77GiB     5.28GiB     2.34GiB  ./usr    [root@localhost]# btrfs subvolume list -t --sort=path /  ID  gen top level   path      --  --- ---------   ----      815 235310  5       @  259 235014  5       @cache  814 235315  5       @home  260 235315  5       @log  450 233611  5       timeshift-btrfs/snapshots/2021-10-18_19-59-20/@  451 5639    5       timeshift-btrfs/snapshots/2021-10-18_19-59-20/@home  536 233611  5       timeshift-btrfs/snapshots/2021-11-23_22-48-30/@  537 13984   5       timeshift-btrfs/snapshots/2021-11-23_22-48-30/@home  545 233611  5       timeshift-btrfs/snapshots/2021-12-12_18-12-40/@  546 17778   5       timeshift-btrfs/snapshots/2021-12-12_18-12-40/@home  257 233611  5       timeshift-btrfs/snapshots/2022-05-02_13-10-31/@  258 229392  5       timeshift-btrfs/snapshots/2022-05-02_13-10-31/@home  894 233611  5       timeshift-btrfs/snapshots/2022-06-08_20-38-08/@  895 215821  5       timeshift-btrfs/snapshots/2022-06-08_20-38-08/@home  896 233611  5       timeshift-btrfs/snapshots/2022-06-08_21-09-00/@  897 215918  5       timeshift-btrfs/snapshots/2022-06-08_21-09-00/@home  923 233611  5       timeshift-btrfs/snapshots/2022-06-28_19-06-50/@  924 229388  5       timeshift-btrfs/snapshots/2022-06-28_19-06-50/@home    [root@localhost]# timeshift --list  Mounted '/dev/sda4' at '/run/timeshift/3351/backup'  Device : /dev/sda4  UUID   : d0a8bc03-a8d9-470e-8868-ec49b1d4f9dc  Path   : /run/timeshift/3351/backup  Mode   : BTRFS  Status : OK  7 snapshots, 2.3 GB free    Num     Name                 Tags  Description      ------------------------------------------------------------------------------  0    >  2021-10-18_19-59-20  O     {timeshift-autosnap} {created before upgrade}       1    >  2021-11-23_22-48-30  O     {timeshift-autosnap} {created before upgrade}  2    >  2021-12-12_18-12-40  O     {timeshift-autosnap} {created before upgrade}  3    >  2022-05-02_13-10-31  O     {timeshift-autosnap} {created before upgrade}  4    >  2022-06-08_20-38-08  O     {timeshift-autosnap} {created before upgrade}      5    >  2022-06-08_21-09-00  O     {timeshift-autosnap} {created before upgrade}      6    >  2022-06-28_19-06-50  O     {timeshift-autosnap} {created before upgrade}          Found stale mount for device '/dev/sda4' at path '/run/timeshift/3351/backup'  Unmounted successfully  

Update 07/17/22:

enter image description here

[root@localhost]# btrfs filesystem du -s / 2> /dev/null       Total   Exclusive  Set shared  Filename   340.59GiB    81.30GiB   249.14GiB  /  

How do I know what the 511.92GiB is made up of?

[root@localhost]# btrfs fi usage /  Overall:      Device size:         514.53GiB      Device allocated:        514.53GiB      Device unallocated:        1.03MiB      Device missing:          0.00B      Used:            511.92GiB  

EDIT 7/23/22:

I deleted some timeshift snapshots, the used disk space decreased, now it shows the following data:

% # df -h | grep '/dev/s'  /dev/sda4          515G         393G  118G           77% /  tmpfs              7,8G          22M  7,8G            1% /dev/shm  /dev/sda4          515G         393G  118G           77% /var/cache  /dev/sda4          515G         393G  118G           77% /var/log  /dev/sda4          515G         393G  118G           77% /home  /dev/sda1          996M         1,5M  995M            1% /boot/efi  /dev/sda4          515G         393G  118G           77% /mnt/sda4    % btrfs filesystem df -h /  Data, single: total=439.01GiB, used=388.90GiB  System, DUP: total=8.00MiB, used=80.00KiB  Metadata, DUP: total=4.00GiB, used=1.49GiB  GlobalReserve, single: total=512.00MiB, used=0.00B    % mkdir /mnt/sda4 && mount -o subvol=/ /dev/sda4 /mnt/sda4 && btdu /mnt/sda4  --- /<SINGLE>/<DATA> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------    ~572.9 KiB [          ]  <NO_INODE>    ~111.2 MiB [          ] /<ROOT_TREE>     ~50.1 GiB [#         ]  <SLACK>     ~18.4 GiB [          ] /<UNREACHABLE>     ~62.7 GiB [##        ] /@     ~6.26 GiB [          ] /@cache    ~284.5 GiB [##########] /@home    ~480.8 MiB [          ] /@log     ~16.4 GiB [          ] /timeshift-btrfs    --- Details: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  - Full path: /mnt/sda4  - Average query duration: 0.0003639 seconds  - Represented size: ~439.0 GiB (68296505 samples), ±10.1 MiB  - Logical offsets: ..., 485646549606, 442831113925, 525544520914    --- Explanation:  This node holds samples from chunks in the DATA block group, which mostly contains file data.  

In general, deleting some of the snapshots helped, after that the timeshift showed a display of busy disk space. A screenshot is attached: enter image description here

Unfortunately, btdu did not answer the question of what makes up the 388 Gb of occupied disk space, as in the conclusion attached above:

--- /<SINGLE>/<DATA> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------    ~572.9 KiB [          ]  <NO_INODE>    ~111.2 MiB [          ] /<ROOT_TREE>     ~50.1 GiB [#         ]  <SLACK>     ~18.4 GiB [          ] /<UNREACHABLE>     ~62.7 GiB [##        ] /@     ~6.26 GiB [          ] /@cache    ~284.5 GiB [##########] /@home    ~480.8 MiB [          ] /@log     ~16.4 GiB [          ] /timeshift-btrfs    --- Details: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  - Full path: /mnt/sda4  - Average query duration: 0.0003639 seconds  - Represented size: ~439.0 GiB (68296505 samples), ±10.1 MiB  - Logical offsets: ..., 485646549606, 442831113925, 525544520914    % echo "62.7+6.26+284.5+0.48+16.4"|bc  370.34  

Maybe the problem is that btdu gives approximate results? I didn't wait for the program to finish it ran for a few minutes.

Keyboard not working during Debian Install on LG Ultra laptop

Posted: 23 Jul 2022 11:13 AM PDT

During install of an LG ultra laptop ( 17U70P ), the mouse work correctly, but the keyboard stop reacting after booting into "Graphical Install".

I was looking in the bios configuration, and found not specific option that could enable or restore this situation.

The keyboard is required to connect to the wifi (I have an additional USB with the firmware). I have no external keyboard to test.

How to get the laptop keyboard working during install?

Related question, which did not solved my case:

USB keyboard doesn't work with Debian installer

linux /install.amd/vmlinuz vga=788 --- quiet noapic nolapic    or    linux /install.amd/vmlinuz vga=788 --- quite iommu=soft  

Did not worked, the first freeze, while the second keeps the keyboard not working.

initramfs got corrupted/ misconfigured, how to boot properly?

Posted: 23 Jul 2022 07:32 AM PDT

How to boot properly, fix the boot loader? Why my initramfs-fallback have higher size than newly created? (use mkinitcpio instead update-initramfs on arch)

-rw-------  1 root root 29MB Mei 30 06:49 initramfs-5.10-x86_64-fallback.img  -rw-------  1 root root  9MB Mei 30 06:48 initramfs-5.10-x86_64.img  -rw-------  1 root root  9MB Mei 30 23:43 initramfs-subscribe-5.10-x86_64.img  

The initramfs is always missing for 8 month i just do via recovery fallback initramfs. What I notice is, even i do kernel update, it still missing. I assume it will be fixed when the newer kernels do post-transaction things. I do use dual boot, both arch and on a different drive (HDD and SDD).

detailed config and the old story

Joining hosts to freeIPA without changing hostname

Posted: 23 Jul 2022 08:45 AM PDT

I've been asked to join linux hosts in my company to freeIPA. But the problem is that I'm not allowed to change hostnames. So I should leave hosts NetBios names intact.

I am wondering if there is any idea to implement such a thing (like alias name for hostname or something)?

How do I add a command to zsh history?

Posted: 23 Jul 2022 07:02 AM PDT

I'd like to use a zsh script to append a command to the command history so that it appears when I hit the up arrow. I've been appending a line to ${HISTFILE}, and it shows up there as the last line, but the up arrow action appears to ignore it.

I see that zsh maintains a session history in parallel to the history file, but I haven't yet seen a way to add to it, or to otherwise accomplish what I'm setting out to do. Is there a way to do it?

strace write calls to stdout

Posted: 23 Jul 2022 08:30 AM PDT

Is there a way to use strace to just show a process's stdout? I know I can do

strace -p pid -e write

but that shows calls to write(2) to multiple file descriptors. When reading the man page I also saw the -e write= option but I'm getting a bunch of other stuff when using

strace -p pid -e write=1

Basically, I want the output of the first command (strace -p pid -e write) but only showing the write(1,... outputs. I know I could filter the output, but I'm wondering if there's a way for strace to do this directly.

how can I set a right click and open terminal in context menu

Posted: 23 Jul 2022 11:00 AM PDT

I am using Debian 10.1 See the following screenshot. right click and no terminal I am used to a Ubuntu environment where I do a right click and terminal opens. Is this kind of a thing possible for Debian environment. If it is possible please let me know how can I enable it?

If the same can be added to context menu like in the screenshot I see following three options
1)Change Background
2)Display Settings
3)Settings
Here can I add the option in black menu in screenshot to open terminal (I am not referring to the Ctrl+Alt+T to open terminal) some how tweaking gnome?

edit

based on discussion below package gnome-tweak-tool and nautilus-extension-gnome-terminal were installed. Then when required setting were not found as in videos here
1)https://youtu.be/scOYZZIyoM4
2) https://www.youtube.com/watch?v=scOYZZIyoM4&feature=youtu.be
gsettings get org.gnome.desktop.background show-desktop-icons
has been set to true
gsettings set org.gnome.desktop.background show-desktop-icons true

Still the desired results have not been achieved. What I want is I do a right click on any area on my desktop and in the context menu I want to see an option to open terminal.

Unable to install Mongodb on linux mint

Posted: 23 Jul 2022 08:06 AM PDT

I cannot install Mongodb on my linux mint.

Operating System: Linux Mint 19.1

Kernel: Linux 4.15.0-50-generic

Architecture: x86-64

I followed official documentation.

Import the public key used by the package management system

$wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | sudo apt-key add -  

Create a list file for MongoDB Ubuntu 18.04 (Bionic)

$echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list  

Reload local package

$sudo apt-get update  

Install the MongoDB package

$sudo apt-get install -y mongodb-org

While installing got these errors:

Reading package lists... Done  Building dependency tree         Reading state information... Done  The following packages were automatically installed and are no longer required:    icoutils libboost-program-options1.65.1 libgoogle-perftools4 libpcrecpp0v5    libtcmalloc-minimal4 libwine-development libwxgtk3.0-gtk3-0v5    libyaml-cpp0.5v5 mongodb-server-core python-wxgtk3.0 python-wxversion    wine64-development  Use 'sudo apt autoremove' to remove them.  The following additional packages will be installed:    mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools  The following NEW packages will be installed:    mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell    mongodb-org-tools  0 upgraded, 5 newly installed, 0 to remove and 245 not upgraded.  Need to get 48.3 MB/73.0 MB of archives.  After this operation, 267 MB of additional disk space will be used.  Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org-shell amd64 4.0.12 [9,865 kB]  Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org-tools amd64 4.0.12 [38.5 MB]  Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org amd64 4.0.12 [3,528 B]  Fetched 48.3 MB in 31s (1,553 kB/s)                                              Selecting previously unselected package mongodb-org-shell.  (Reading database ... 349983 files and directories currently installed.)  Preparing to unpack .../mongodb-org-shell_4.0.12_amd64.deb ...  Unpacking mongodb-org-shell (4.0.12) ...  Preparing to unpack .../mongodb-org-server_4.0.12_amd64.deb ...  Unpacking mongodb-org-server (4.0.12) ...  dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.0.12_amd64.deb (--unpack):   trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1  dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)  Preparing to unpack .../mongodb-org-mongos_4.0.12_amd64.deb ...  Unpacking mongodb-org-mongos (4.0.12) ...  dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.0.12_amd64.deb (--unpack):   trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1  dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)  Selecting previously unselected package mongodb-org-tools.  Preparing to unpack .../mongodb-org-tools_4.0.12_amd64.deb ...  Unpacking mongodb-org-tools (4.0.12) ...  Selecting previously unselected package mongodb-org.  Preparing to unpack .../mongodb-org_4.0.12_amd64.deb ...  Unpacking mongodb-org (4.0.12) ...  Errors were encountered while processing:   /var/cache/apt/archives/mongodb-org-server_4.0.12_amd64.deb   /var/cache/apt/archives/mongodb-org-mongos_4.0.12_amd64.deb  E: Sub-process /usr/bin/dpkg returned an error code (1)  

Tried to start the DB

$sudo service mongod start    Failed to start mongod.service: Unit mongod.service not found.  

The code below gives the same error:

sudo apt-get install -f  

Unable to remove mongodb-server-core:

$ apt remove mongodb-server-core    Reading package lists... Done  Building dependency tree         Reading state information... Done  You might want to run 'apt --fix-broken install' to correct these.  The following packages have unmet dependencies:   mongodb-org : Depends: mongodb-org-server but it is not going to be installed                 Depends: mongodb-org-mongos but it is not going to be installed  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).  

How to use existing partitioning when re-installing Debian?

Posted: 23 Jul 2022 07:02 AM PDT

I have Debian/Windows dual-boot laptop, and I want to re-install Debian on it, leaving the Windows partition untouched.

Basically, I want to leave the specification for all the partitions the same. I just want the new Debian installation to completely overwrite the old one.

When I get to this dialog in the installation sequence, I am not sure how to proceed to achieve the goal above:

enter image description here

The settings above are already the way I want them, but if I select

Finish partitioning and write changes to disk  

and click Continue, the installer complains with

No root file system
No root file system is defined.

Please correct this from the partitioning menu.

If I select #5 or #6, the installer requires me to re-specify all the configurations for each partition, without telling me what their current settings are. Since I don't know how these partitions are currently configured, I cannot replicate these configurations from memory.

What steps should I follow to retain the partition specs as they are, and just overwrite the current Debian partition(s) (#5 and #6 in the listing above) with the new Debian installation?

Should isohybrid work on all iso media, for example Windows 7?

Posted: 23 Jul 2022 09:54 AM PDT

I have a an original Windows 7 Professional x86 iso file, straight from Microsoft. I want to make a bootable USB from this ISO. Some sources suggest that I simply dd the iso to the USB, but I don't see how that should work. The ISO's first 32768 bytes (reserved as System Area on ISO 9660 media, to be used fx for MBR) are all zeroes, so there is no MBR or anything for the BIOS to read.

So as far as I can understand, one way is to add a MBR in this System Area, so that the ISO can be both dd'ed to a USB or written to an optical media, and be bootable from both.

I think the tool isohybrid should do that trick. I don't know how it works, so I can't figure out if it should just work for all bootable (ie bootable if written to optical media) ISO 9660 files. Or does it only work for some specific/familiar iso files?

At least I can't make it work with my Windows 7 iso. I get the following error:

$ isohybrid win7.iso  isohybrid: win7.iso: unexpected boot catalogue parameters  

Configuring device's wifi settings through SSH

Posted: 23 Jul 2022 09:01 AM PDT

I just unpackaged a NVIDIA Jetson TX2 running Ubuntu 16.04 today and I am connecting to it with SSH while it's plugged in to my router via ethernet.

I'd like to configure the TX2 to automatically connect to my wifi network so the physical connection is not necessary.

I was hoping that copying my wifi config file located at /etc/NetworkManager/system-connections/ to the same location on the TX2 would be sufficient -- after running nmap to list hosts connected to my network, I'm now seeing that this is probably embarrassingly naive.

Is there a way I can, through an SSH connection alone, setup the TX2 to automatically connect to my wifi on boot?

Edit: I'm seeing posts like this one and this one which seem like they might lead me down the right path (modifying /etc/network/interfaces), but I honestly have no idea what I'm doing...

Yum Corrupted on RHEL 6

Posted: 23 Jul 2022 10:03 AM PDT

. I am encountering the issue with my yum command. It seems to be exactly the same as the issue described on this site, Yum corrupted on CentOS 6.2, Problem importing one the python modules

This will be the error produced whenever I execute the yum command.

[root@Server1~]# yum list     There was a problem importing one of the   Python modules required to run yum. The error leading to this problem   was:        /lib64/libldap-2.4.so.2: undefined symbol: ber_sockbuf_io_udp     Please install a package which provides this module, or verify that   the module is installed correctly.     It's possible that the above module doesn't match the current version   of Python, which is:   2.6.6 (r266:84292, Nov 21 2013, 10:50:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]     If you cannot solve this problem yourself, please go to the yum faq   at:   http://yum.baseurl.org/wiki/Faq  

However I am able to run # python2 , which is located in /usr/bin/python2

[root@Server1~]# python2    Python 2.6.6 (r266:84292, Nov 21 2013, 10:50:32)    [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2    Type "help", "copyright", "credits" or "license" for more information.    \>>>  

These are the modules yum import:

yum_modules

Equivalent of update-grub for RHEL/Fedora/CentOS systems?

Posted: 23 Jul 2022 09:07 AM PDT

In Ubuntu (and I guess in Debian too) there is a system script named update-grub which automatically executes grub-mkconfig -o with the correct path for the grub configuration file.

Is there any similar command for Red Hat based distributions?

If not, how do the system knows where is the grub configuration file to update when a new kernel version is installed?

How to view the output of a running process in another bash session?

Posted: 23 Jul 2022 08:37 AM PDT

I have left a script running on a remote machine from when I was locally working at it. I can connect over SSH to the machine as the same user and see the script running in ps.

$ ps aux | grep ipcheck  myuser  18386  0.0  0.0  18460  3476 pts/0    S+   Dec14   1:11 /bin/bash ./ipchecker.sh  

It is simply outputting to stdout on a local session (I ran ./ipchecker.sh form a local terminal window, no redirection, no use of screen etc).

Is there anyway from an SSH session I can view the output of this running command (without stopping it)?

So far the best I have found is to use strace -p 18386 but I get hordes of text flying up the screen, its far too detailed. I can stop strace and then sift through the output and find the text bring printed to stdout but its very long and confusing, and obviously whilst it's stopped I might miss something. I would like to find a way to see the script output live as if I was working locally.

Can anyone improve on this? The obvious answer is to restart the script with redirection or in a screen session etc, this isn't a mission critical script so I could do that. Rather though, I see this as a fun learning exercise.

No comments:

Post a Comment