Sunday, August 29, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


bluetooth headphones paired, connected not appearing as sound device

Posted: 29 Aug 2021 09:44 AM PDT

Arch MATE up to date

Not blocked

rfkill list  0: phy0: Wireless LAN      Soft blocked: no      Hard blocked: no  1: hci0: Bluetooth      Soft blocked: no      Hard blocked: no        

From the bluetooth session

 [JBL LIVE400BT-LE]# info 71:7D:D8:A5:A4:C8   Device 71:7D:D8:A5:A4:C8 (public)      Name: JBL LIVE400BT-LE      Alias: JBL LIVE400BT-LE      Paired: yes      Trusted: yes      Blocked: no      Connected: yes      LegacyPairing: no  

pavucontrol GUI shows only the laptop's sound card.

aplay says this

 :> aplay -l   **** List of PLAYBACK Hardware Devices ****   card 0: PCH [HDA Intel PCH], device 0: ALC668 Analog [ALC668 Analog]     Subdevices: 0/1     Subdevice #0: subdevice #0   card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]     Subdevices: 1/1     Subdevice #0: subdevice #0   card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]     Subdevices: 1/1     Subdevice #0: subdevice #0   card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]     Subdevices: 1/1     Subdevice #0: subdevice #0   card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]     Subdevices: 1/1     Subdevice #0: subdevice #0   card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]     Subdevices: 1/1     Subdevice #0: subdevice #0     

X11 VNC server sleep problem Ubuntu 21.04

Posted: 29 Aug 2021 09:00 AM PDT

I have talked the default X11 VNC server on the Ubuntu 21.04. I made it run at start with the help of this link:

X11 VNC Auto Start and Password configuration

The problem is that after some time the X11 VNC I suppose goes to sleep and I can't access the computer with VNC. I needed to install "AnyDesk" to gain access in these sleeping issues and wake up the X11 VNC. If X11 VNC is sleeping and I access the computer via "AnyDesk", the X11 VNC wakes up and I can use the computer again with VNC and all perfect. How can I make X11 VNC not go to sleep or whatever is causing the issue?

Thank you

Linux to Windows 10 rdp with local echo cancellation

Posted: 29 Aug 2021 08:22 AM PDT

I am having considerable issues getting audio to and from Linux and Windows over rdp in a sane and rational fashion. It's 2021 so I think it's safe to assume I'm not the only one and there is a possible solution available somewhere. I've tried rdesktop, freerdp, Remmina, and standing on my head. Nothing works completely, either I can't get microphone working or there are limitations which stop me from using obvious local audio routing.

One of those limitations is that the microphone device from the usb camera seems to disappear from pasystray whenever a connection is started in Remmina.

So, I find myself here casting a wide net as I don't have a specific issue rather a collection of unworkable systems that all add up to one issue or another.

Currently I am simply using USB redirection in Remmina to share my camera. This works fine however the microphone does not and is possibly a separate issue. Regardless, it's not an outrageous concept to expect some kind of workable system for this use case.

I want the following setup:

input: usb camera/microphone -> echo cancellation module -> rdp session or other network pipe -> teams/google meet

output: teams/google meet -> rdp session or other network pipe -> echo cancellation module -> tv audio/speaker system

For clarity, the echo cancellation is to stop the tv/speaker audio from going back into the microphone and being retransmitted over the call.

I have a few questions:

  • are there known solutions for this problem? Surely, I am not the first.
  • what alternative to the rdp session as a redirection pipe could I use?
  • what could I use for echo cancellation that also enables sharing over the network and is compatible with Windows?

How to load custom kernel module?

Posted: 29 Aug 2021 08:25 AM PDT

How to force linux kernel to load my custom module instead of default one ? There is a file:

/lib/modules/$(uname -r)/modules.order  

Seems like it is responsible to load modules in specific order. How it can be generated to prioritize my module or maybe it is enough to place it in /etc/modules-load.d for loading during boot and create udev rule binding hardware by productID and vendorID to this custom module ?


Example:

usbhid module is used for mouse and keyboard. I want my mouse uses my custom module instead of usbhid.

How to rotate a PDF by 45 degrees from command line?

Posted: 29 Aug 2021 08:07 AM PDT

Various tools (pdftk, qpdf, etc) can rotate PDF, but only with n*90 degree angles.

ImageMagick can also rotate pdf, but it automatically converts the vectorial format to a raster one, what I do not want.

Can I somehow rotate a PDF while preserve the vectorial format?

Installed pycharm successfully on Debian, but cannot run it

Posted: 29 Aug 2021 07:23 AM PDT

I installed pycharm successfully.

sudo snap install pycharm-community --classic

But I cannot find it on the applications menu, nor run it form the terminal pycharm-community

enter image description here

Highlight specific date in ncal output

Posted: 29 Aug 2021 06:26 AM PDT

Is it possible to highlight specific dates in the output of ncal command ? For example ncal -M -w will display calendar with highlighted current day, but it is possible to specify additional dates do highlight?

display range of specified months with ncal

Posted: 29 Aug 2021 06:51 AM PDT

Is it possible to display specific months in ncal? For example ncal -m1 will display January. But what If I want to display January and February? I've tried following ncal -m1,2 with no luck

Debian 9 won't wake up after suspend

Posted: 29 Aug 2021 08:24 AM PDT

Since some weeks ago, my Debian 9 distro is randomly not waking up after suspend. It does not matter the way of suspending: it can be by using the command systemctl suspend (a shortcut that I'm using with i3wm) or by closing the lid.

It happens the following: for some seconds I can move the mouse or the keyboard. Then the screen is frozen, and the only thing I can do is to press the shutdown button.

I checked the dmesg and I've read the /var/log/syslog file. There were some errors about mysql, vbox and bluetooth. I ended up uninstalling mysql, php, vbox and disabling the bluetooth (I never used it).

I also edited the file /etc/default/grub to modify this line GRUB_CMDLINE_LINUX="nouveau.modeset=0", I executed the command sudo update-grub and the problem persists after rebooting the laptop.

It's a Thinkpad Lenovo T530. I'm not sure if I should update the BIOS, since everything worked fine since the day I installed Debian 9 (year 2018). Using a SSD disk since that moment.

The problem persists and it's really random. Sometimes it wakes up perfect and I can use it several hours. Two times the computer frozes while using it, too.

What should I check?

How to supply both passphrase and admin PIN to gpg?

Posted: 29 Aug 2021 05:39 AM PDT

Trying to move private keys to YubiKey using script.

How can I supply both PGP master key passphrase and YubiKey OpenPGP applet PIN using command line?

The following works for passphrase, but not PIN as passphrase supplied using --passphrase-fd 3 is used.

echo -e "key 1\nkeytocard\n1\nkey 1\nkey 2\nkeytocard\n2\nkey 2\nkey 3\nkeytocard\n3\nsave" | gpg \    --command-fd 0 \    --passphrase-fd 3 \    --pinentry-mode loopback \    --edit-key $fingerprint \    3<<<"$passphrase"  

How to remove root@localhost: from termux Command line?

Posted: 29 Aug 2021 07:31 AM PDT

root@localhost:~#  username@localhost:~$  

There is something like this on the command line when you install Linux distros on Termux. How can it be removed? or atleast reduced to:

#  $  

How to remove root@localhost from termux Command line?

The alternatives command on FreeBSD (for choosing between versions of a package)

Posted: 29 Aug 2021 05:17 AM PDT

There's an alternatives command on Linux (man page section 1, update-alternatives), and there's a select subcommand on the port command from MacPorts.

Is there an equivalent on FreeBSD? Or do I have to manually manage the symbolic links?

Ncat: Got more than one port specification

Posted: 29 Aug 2021 04:56 AM PDT

I am trying to run a subrocess the listen and recives a file using ncat:

proc = subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)  

Where the "command" variable is this list:

command = ['nc', '-4', '-l', '10099', '>', '/tmp/files/copy_file_2_10099']  

And I get the error:

Ncat: Got more than one port specification: 10000 > *path to file*  

It seems like it sees the ">" and path strings as port numbers. Any ideas?

Bash: \r printed when doing a find using variable path

Posted: 29 Aug 2021 05:57 AM PDT

Appreciate your advise on below

my bash:

withCtryPath=$home/$ctryCd/$city/suburb/files  if [ -d $home/$ctryCd ] && [ -d $home/$ctryCd/$city ]; then    echo "File Path: " ${withCtryPath}    result=$(find ${withCtryPath} -name "*.ext1" -or -name "*.ext2" | xargs grep -l ${pattern})    echo $result >> listOfFiles.txt  fi  

output:

File Path: /path/ctrycd/city/suburb/files  find: '/path/ctrycd/city/suburb/files\r': No such file or directory  

As you can see the output contains of "\r".. with resulting file not found. I have echo the path correctly. However when it is passed as variable, it append extra value. Appreciate someone can help on this matter. Thanks.

Detecting getopts `--` (double dash) to issue a message

Posted: 29 Aug 2021 09:50 AM PDT

I am using the customary way of using getopts through a variable named arg. I can capture the option names as follows. Is it possible to detect the moment getopts reaches "--" so that I can issue a message?

while getopts "$shortopts" arg; do     echo "--> arg: $arg"     case $arg in     ("V")       return       ;;     ("u")       return       ;;     ("h")       return       ;;  

sftp with chroot and file creation problem

Posted: 29 Aug 2021 06:00 AM PDT

I configured second sshd systemd service using own sshd configuration with different tcp port configured in it and following configuration of sftp subsystem:

Match Group sftponly    ChrootDirectory /srv/%u    AllowTcpForwarding no    ForceCommand internal-sftp    PubkeyAuthentication yes    PasswordAuthentication no    PermitTunnel no    AllowAgentForwarding no    X11Forwarding no  

The user I created in sftponly group is:

uid=1001(sftpuser) gid=1001(sftponly) groups=1001(sftponly)  

The directory tree for chroot is:

drwxr-xr-x   3  root     root           22 Aug 27 15:43 /srv  drwxr-xr-x   4  root     root           34 Aug 27 18:27 /srv/sftpuser  drwx------   2  sftpuser sftponly       29 Aug 27 15:43 /srv/sftpuser/.ssh  -rw-r--r--   1  sftpuser sftponly      398 Aug 27 15:43 /srv/sftpuser/.ssh/authorized_keys  

I can successfully do sftp with the private key however I can't create any file in user's /srv/%u chroot directory:

sftp> ls -al  drwxr-xr-x    3 root     root           18 Aug 27 16:38 .  drwxr-xr-x    3 root     root           18 Aug 27 16:38 ..  drwx------    2 sftpuser sftponly       29 Aug 27 13:43 .ssh  sftp> mkdir one  Couldn't create directory: Permission denied  sftp>  

When I do chown sftpuser /srv/sftpuser and go back to active sftp session I can create files but when I logout I can't login sftp anymore, until I change back /srv/%u directory to be owned by root

Connection to 192.168.1.110 closed by remote host.  Connection closed  

I can of course create additional directory inside /srv/%u (/srv/sftpuser) owned by sftpuser but is this the only solution with chroot? Why user can't change/upload files directly to /srv/%u?

Additional question - how to prevent other users on the system from using this custom sshd configured for sftp only? When I set above Subsystem line in the custom sshd_config_sftponly two options: PubkeyAuthentication and PasswordAuthentication to no and do restart sshd daemon, regular system users can still login with their password using that custom sshd port.

LVM recovery with physical disk failure on remote system

Posted: 29 Aug 2021 08:47 AM PDT

Questions like this have been asked a lot here but I've not found any with the same situation as I have. I have a system with a failed LVM volume group and I have no physical access to it. More details below.

I have a Debian 10 linux server with two physical volumes, a 4TB HDD and a 750GB SSD. The SSD contains the boot volume. The HDD is configured as an LVM Volume Group with a single physical volume (/dev/sda, the 4 TB HDD) and a number of logical volumes.

The HDD has apparently failed. No diagnosis appears possible as /dev/sda simply doesn't exist anymore and any attempt to read from the disk results in an i/o error.

The data on the disk isn't critical and I do have a system backup. The issue is that the system is a headless linux box sitting in the cellar of my house in Switzerland, which is half a world away. My concern is that if I reboot it, it may well fail during boot and enter diagnostic mode and I will have no network access to it. In that case I have to ask a friend to collect it and mail it to me - which is what I'm really trying to avoid as it will be down for months. I can live without /dev/sda until the next time I visit the house and replace it.

The output I get from LVM is as follows:

sudo /sbin/pvdisplay -vd /dev/sda    Error reading device /dev/Webcams/Birch-Snapshot at 0 length 512.    Error reading device /dev/Webcams/Birch-Snapshot at 0 length 4096.    Error reading device /dev/Webcams/Birch-Video at 0 length 512.    Error reading device /dev/Webcams/Birch-Video at 0 length 4096.    Error reading device /dev/Webcams/Roof-Snapshot at 0 length 512.    Error reading device /dev/Webcams/Roof-Snapshot at 0 length 4096.    Error reading device /dev/Webcams/Roof-Video at 0 length 512.    Error reading device /dev/Webcams/Roof-Video at 0 length 4096.    Error reading device /dev/Webcams/Tree-Snapshot at 0 length 512.    Error reading device /dev/Webcams/Tree-Snapshot at 0 length 4096.    Error reading device /dev/Webcams/Tree-Video at 0 length 512.    Error reading device /dev/Webcams/Tree-Video at 0 length 4096.    Error reading device /dev/Webcams/Archive at 0 length 512.    Error reading device /dev/Webcams/Archive at 0 length 4096.    Error reading device /dev/Webcams/Video2 at 0 length 512.    Error reading device /dev/Webcams/Video2 at 0 length 4096.    Error reading device /dev/Webcams/Backup at 0 length 512.    Error reading device /dev/Webcams/Backup at 0 length 4096.    Failed to find device for physical volume "/dev/sda".  

vgs -vd and lvs -vd both execute and print just the single line:

sudo /sbin/vgs -vd      No volume groups found.  

/etc/fstab mounts the individuals logical volumes like so:

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>  /dev/Webcams/Archive            /mnt/Webcams/Archive        ext4    defaults,nofail         1 2  

/dev/Webcams looks like this:

ls -l /dev/Webcams  total 0  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Archive -> ../dm-6  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Backup -> ../dm-8  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Birch-Snapshot -> ../dm-0  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Birch-Video -> ../dm-1  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Roof-Snapshot -> ../dm-2  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Roof-Video -> ../dm-3  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Tree-Snapshot -> ../dm-4  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Tree-Video -> ../dm-5  lrwxrwxrwx 1 root root 7 Aug 25 08:05 Video2 -> ../dm-7  

There is also a /dev/mapper directory:

ls -l /dev/mapper  total 0  crw------- 1 root root 10, 236 Aug  3 10:44 control  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Archive -> ../dm-6  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Backup -> ../dm-8  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Birch--Snapshot -> ../dm-0  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Birch--Video -> ../dm-1  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Roof--Snapshot -> ../dm-2  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Roof--Video -> ../dm-3  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Tree--Snapshot -> ../dm-4  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Tree--Video -> ../dm-5  lrwxrwxrwx 1 root root       7 Aug 25 08:05 Webcams-Video2 -> ../dm-7  

So both /dev/Webcams and /dev/mapper have symlinks pointing to files in /dev:

ls -l /dev/*dm-*  brw-rw---- 1 root disk 253, 0 Aug 25 08:05 /dev/dm-0  brw-rw---- 1 root disk 253, 1 Aug 25 08:05 /dev/dm-1  brw-rw---- 1 root disk 253, 2 Aug 25 08:05 /dev/dm-2  brw-rw---- 1 root disk 253, 3 Aug 25 08:05 /dev/dm-3  brw-rw---- 1 root disk 253, 4 Aug 25 08:05 /dev/dm-4  brw-rw---- 1 root disk 253, 5 Aug 25 08:05 /dev/dm-5  brw-rw---- 1 root disk 253, 6 Aug 25 08:05 /dev/dm-6  brw-rw---- 1 root disk 253, 7 Aug 25 08:05 /dev/dm-7  brw-rw---- 1 root disk 253, 8 Aug 25 08:05 /dev/dm-8  

My question: What steps should I take to ensure that the system does't enter diagostic mode during reboot? Is it enough to simply comment out the relevant lines in /etc/fstab or is there something else I need to do?

My concern is that lvm itself might make checks during boot and throw off errors that stop the boot from completing. I am not using lvm for any other volumes so theoretically at least I suppose I could remove the package, although given the state the system is in I'm not sure that would be wise.

Any help much appreciated.

File operation difference and looping

Posted: 29 Aug 2021 07:23 AM PDT

i have 2 files. I need to find difference in percentage between these files value ( e.g 1st value of both files e.g aaa 200,20 and 100,00) then second bbb with bbb so on in unix shell script in HPUX. I have written below code. Its working for 1 value for(aaa) however I need to add a loop for it so it can work for multiple values likes bbb (500,20 and 300,60) and ccc, and so on.could you please help how to read both files in loop and perform below operation in Unix shell scripting in HPUX.

1.txt

aaa:200,20               bbb:500,20              ccc:600,40              

2.txt

aaa:100,00  bbb:300,60  ccc:400,50  

i have written below code.

M1=`cat 1.txt| sed -n 1p 1.txt|cut -d ":" -f2|sed 's/,//g`  M2=`cat 2.txt| sed -n 1p 2.txt|cut -d ":" -f2|sed 's/,//g`    if [ $M1 -gt $M2 ]  then  perc=$(expr $M1 - $M2)  echo $perc  erc1=$(expr $perc \* 100)  echo $erc1  exp2=$(expr $erc1 / $M2)  echo $exp2  echo "Diffence in Percentage is:$exp2"    else    perc=$(expr $M2 - $M1)  erc1=$(expr $perc \* 100)  exp2=$(expr $erc1 / $M1)  echo "Differnce in Percentage is:$exp2"  fi    if [ $exp2 -gt 20 ]     //20 is threshold  then  echo "Difference between trend is more then 20%: It is $exp2"  fi  

How to Remove or replace double quote(") or comma(,) with a string within double quotes from txt file in Linux [closed]

Posted: 29 Aug 2021 05:18 AM PDT

example data

124,5,"abc"dcf",-1 --> 124,5,"abcdcf",-1    124,5,"abc"dcf",-1 --> 124,5,"abc<double>dcf",-1    124,5,"abc,dcf",-1 --> 124,5,"abcdcf",-1    124,5,"abc,dcf",-1 --> 124,5,"abc<COMA>dcf",-1  

Difference in output of sar command

Posted: 29 Aug 2021 07:23 AM PDT

I came across a scenario, where I saw different values in the output of sar command in two situations:

  • A shell script that runs at every 30-second interval.
  • Manually running the command in the command line.

I observed that values at the same second when the script invoked and produced output and at the same time when I ran the command in the command line, the values were different in the output.

I also observed that values change in milliseconds time, when i created a new script to run command at every 300 millisecond interval and it gave different values in the same second in three outputs at 300 milliseconds.

I had two questions here:

  • Is this understanding of mine correct that values can differ in milliseconds and that is why i am getting different results in my automatic script and manual command execution in command line.
  • Is this likely that values can also change drastically within 10-30 second interval.

UFW not allowing to boot debian 11

Posted: 29 Aug 2021 04:58 AM PDT

I installed debian 11 on dell 5505 SE and installed UFW. But when I start my pc it shows "a start job is running for Uncomplicated firewall (xxx min / nolimit)". And goes on.. I restarted and booted into debian recovery mode and uninstalled UFW, there is no boot issue How can I fix the UFW issue boot splash

How to remove grub bootloader from windows 10?

Posted: 29 Aug 2021 05:17 AM PDT

I used to have ubuntu installed in pc hard disk but for other purposes, I can have only windows installed. Now I have uninstalled all partitions having ext4 fs, so only ntfs and bootable fs (vfat32 I think) remain. But still, when I boot I see grub bootloader (GNU GRUB version - Minimal BASH-like line editing is supported. For the first word, TAB lists possible command , …). Now I would like to remove this as well. I have tried to go to recovery mode, and from there to command prompt: bootrec.exe /fixmbr and then bootrec.exe /fixboot but access denied (I do not know why), but neither helped - I am still entering the grub. I do not have any media with full windows installation so I cannot boot from usb and make full install (I have tried although full restart which reinstalled the whole windows - still did not helped). So How can I delete/remove the grub bootloader from master boot record (or wherever it resides) to boot directly to windows?

PS: to get from the bootloader, I have to at least twice exit from the bootloader, when it finally boots windows. How to delete the bootloader?

How to embed current time with ffmpeg?

Posted: 29 Aug 2021 06:45 AM PDT

I'm using ffmpeg combined with tee and mplayer to have a simple video livestream and recorder over SSH. Now, I'd love to embed the current (server) time in the stream. The format doesn't matter much, ideally would be YYYY-MM-DD HH:MM:SS.

I've found this how-to suggesting the following command:

ffmpeg -f video4linux2 -input_format mjpeg -s 1280x720 -i /dev/video0 \  -vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: \  text='%{localtime\:%T}': fontcolor=white@0.8: x=7: y=700" -vcodec libx264 \  -preset veryfast -f mp4 -pix_fmt yuv420p -y output.mp4  

But using the -vf portion of this results in the following error for me:

[NULL @ 0x55e4ef96b2a0] Unable to find a suitable output format for 'text=%{localtime:%T}:'  text=%{localtime:%T}:: Invalid argument  

I've also tried this command (the third code block in the Q), just to test it, but it failed aswell:

[Parsed_drawtext_0 @ 0x55fb2862a940] Both text and text file provided. Please provide only one  [AVFilterGraph @ 0x55fb28629fc0] Error initializing filter 'drawtext' with args 'text=%{pts:hms:1553359336.166336638}'  

Finally, I also found this question, and tried it, slightly modified like this (this is showing my full command, I've only adjusted the -vf options in the past two examples):

ffmpeg  -r 20 -s 640x480 -f video4linux2 -i /dev/video0 -vf "drawtext=fontsize=90:fontcolor=white: fontfile=/usr/share/fonts/TTF/DejaVuSans.ttf: text='%{localtime\:%X}'" -f avi -  

This presents me with the following error:

[NULL @ 0x55ae61d051a0] Unable to find a suitable output format for 'fontfile=/usr/share/fonts/TTF/DejaVuSans.ttf:'  fontfile=/usr/share/fonts/TTF/DejaVuSans.ttf:: Invalid argument  

Modifying what I've found here a bit to:

-vf drawtext="fontfile='/usr/share/fonts/cantarell/Cantarell-Light.otf':fontsize=14:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=1:text='%H-%M-%S':x=8:y=8"  

Presents me with:

[Parsed_drawtext_0 @ 0x55e36db2aa40] Stray % near 'H-%M-%S'  

Note that using this comment with just text (e.g. text='test') works fine..
Adding 1-4 \s in front of the %s shows no change in error or effect.

My ffmpeg version: ffmpeg version 3.2.12-1~deb9u1 on a debian machine.
It has been compiled with the drawtext library and it is present in ffmpeg -filters.

Sort function doesn't work

Posted: 29 Aug 2021 05:08 AM PDT

So a week ago I asked a question, > here , The question was about sorting. If I use this code for sorting and creating files:

tail -n +2 File1.txt |    split -l1 --filter='      {         head -n 1 File2.txt &&          cat <(tail -n +2 File2.txt) - |          sort -n -r -k4      ; } > "$FILE"'  

it does work on the files I use in that example, but when I use this on my real files which are bigger its seems like the sorting doesn't work.

I fixed this problem before by using LC_ALL=C , but it seems that it worked just 1 time, so I don't know what the real problem is. if i specifically print and sort the column it works, but not with in side this code..

Maybe because its to much in 1 time to do? i have 151 columns with different data annotated, and I just want to sort the columns 43 and 151, but I still need the new sorted files. Please help me out.

Linux Mint jdb2 continuous writing to disk

Posted: 29 Aug 2021 09:03 AM PDT

Captured disk activity from last 2 days using below command but unable to find out why it is writing so much (426MB) on root partition

iotop -oPa -d 2      Total DISK READ :       0.00 B/s | Total DISK WRITE :       0.00 B/s  Actual DISK READ:       0.00 B/s | Actual DISK WRITE:       0.00 B/s    PID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                       239 be/3 root          0.00 B    426.21 M  0.00 %  0.17 % [jbd2/sdd2-8]   2678 be/4 root        961.21 M    107.91 M  0.00 %  0.03 % <emby mono-sgen>   2198 be/4 root          0.00 B      0.00 B  0.00 %  0.02 % udisksd --no-debug   6402 be/4 root         16.00 K      0.00 B  0.00 %  0.07 % [kworker/u4:1]  13162 be/4 root         16.00 K      0.00 B  0.00 %  0.09 % [kworker/u4:2]  

I have below disk

/dev/sdd2 on / type ext4 (rw,noatime,errors=remount-ro)  /dev/sda1 on /media/<user>/2TB_EXT4 type ext4 (rw,nosuid,nodev,noatime,uhelper=udisks2)  /dev/sdb1 on /media/<user>/2TB_EXT4_2 type ext4 (rw,nosuid,nodev,noatime,uhelper=udisks2)  

CMake returns linux/videodev.h not exist while build opencv

Posted: 29 Aug 2021 07:05 AM PDT

Got problem while building opencv accoding to link:

Determining if the include file linux/videodev.h exists failed with the following output:  Change Dir: /home/pi/opencv-3.1.0/build/CMakeFiles/CMakeTmp    Run Build Command:"/usr/bin/make" "cmTC_affcb/fast"  /usr/bin/make -f CMakeFiles/cmTC_affcb.dir/build.make CMakeFiles/cmTC_affcb.dir/build  make[1]: Entering directory '/home/pi/opencv-3.1.0/build/CMakeFiles/CMakeTmp'  Building C object CMakeFiles/cmTC_affcb.dir/CheckIncludeFile.c.o  /usr/bin/cc    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden  -O3 -DNDEBUG   -o CMakeFiles/cmTC_affcb.dir/CheckIncludeFile.c.o   -c /home/pi/opencv-3.1.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c  /home/pi/opencv-3.1.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:28: fatal error: linux/videodev.h: No such file or directory   #include <linux/videodev.h>                              ^  compilation terminated.  

..... .....

I just did cd linux in order to look file videodev.h is there, but system can't find such directory. File /usr/include/linux/videodev.h exist on my system. I suppose compiler is not able to find it. How to solve such problem?

Auto expand last partition to use all unallocated space, using parted in batch mode

Posted: 29 Aug 2021 04:52 AM PDT

Long story short, I need to perform this all automatically on boot (embedded system).

Our engineers will flash images to production devices. These images will contain a small partition table. On boot, I need to automatically expand the last partition (#3) to use all the available space on the disk.

Here is what I get when I look at the free space on my disk.

> parted /dev/sda print free  Model: Lexar JumpDrive (scsi)  Disk /dev/sda: 32.0GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End     Size    File system  Name     Flags          17.4kB  1049kB  1031kB  Free Space   1      1049kB  25.3MB  24.2MB  fat16        primary  legacy_boot          25.3MB  26.2MB  922kB   Free Space   2      26.2MB  475MB   449MB   ext4         primary   3      475MB   1549MB  1074MB  ext4         primary          1549MB  32.0GB  30.5GB  Free Space  

I need to expand partition 3 by N (30.5GB) number of bytes

How do I perform this step automatically, with no prompt? This needs to work with a dynamic size of space available after the 3rd partition.

What will ls -l | wc -l command display?

Posted: 29 Aug 2021 07:13 AM PDT

Will:

ls -l|wc -l  

Display the number of devices too? (Including files and directories)

Disable KVM Kernel Module while its still in use

Posted: 29 Aug 2021 05:48 AM PDT

In order to run a virtual machine, VirtualBox tells me to disable the KVM kernel module. I googled around and found out that KVM is included in the qemu-*-packages, but none of them is/was installed on my system (Debian Wheezy).

After that I simply tried to unload the module, but this doesn't want to work because it is in use:

# modprobe -r kvm_intel  FATAL: Module kvm_intel is in use.  # modprobe -r kvm  FATAL: Module kvm is in use.  

I don't know what program is using it and I have really no idea what that could be. I also tried with the -f option but I get the same result.

My question is: How can I remove or disable the KVM Kernel module?

Update:

Here is the output of the lsmod command:

# lsmod | grep kvm  kvm_intel             138825  3   kvm                   404853  1 kvm_intel  

How to rename devices for graphical output such as VGA0

Posted: 29 Aug 2021 08:04 AM PDT

On my Laptop the names of my graphical outputs change depending on what chip is activated in the BIOS. This leads to problems in some scripts where outputs such as VGA-0 or LVDS-0 are specified. So I want to rename the graphical outputs, similar to how you can specify persistent names for network devices with udev.

But I can't find anything that would explain how or if this is even possible at all.

In /sys I could find kernel names such as as:

/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DVI-D-1  /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-VGA-1  

while xrandr reports the names as DVI1 and VGA1. So they have to be renamed somewhere(?) When I call udevadm info on one of those devices I get a lot of information but not the names used by xrandr and other X tools.

So is it possible to create a udev rule to rename the outputs and if so how? Are the names even set by udev?

No comments:

Post a Comment