Sunday, November 7, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Replacing counter in a filename for all files in a directory

Posted: 07 Nov 2021 08:55 AM PST

After importing several 1000 Files from a camera onto a hard drive I realized, that the counter, used in the process of renaming the file - does not start from 0. This leads to file structure like this:

My vacation 2018-05-03 2345.jpg  My vacation 2018-05-03 2346.jpg  My vacation 2018-05-04 2347.jpg  

I would like to batch rename all those files in a wax, that the index starts with 0

My vacation 2018-05-03 0001.jpg  My vacation 2018-05-03 0002.jpg  My vacation 2018-05-04 0003.jpg  

I went already through some topics dealing with batch renaming files and adding an counter/index (bash loop) or usig rename/prename but I was not able to get a working solution for my case.

Basically, I would like to match the part of the filename with the description and the date using the regular expression .*(\d\d\d\d\-\d\d\-\d\d){1} and add a suffix counter on the end.

Can not install wine32 on newely updated Debian 11

Posted: 07 Nov 2021 08:51 AM PST

Recently I updated my device from Debian 10 to Debian 11.

After that, I tried to install wine on my machine, but the Terminal raised this error to me:

user@machine:~$ sudo apt install wine32  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  Some packages could not be installed. This may mean that you have  requested an impossible situation or if you are using the unstable  distribution that some required packages have not yet been created  or been moved out of Incoming.  The following information may help to resolve the situation:    The following packages have unmet dependencies:   libavcodec58 : Depends: librsvg2-2 (>= 2.14.4) but it is not going to be installed   libavformat58 : Depends: libchromaprint1 (>= 1.3.2) but it is not going to be installed   libglib2.0-0 : Depends: libpcre3 but it is not installable                  Recommends: shared-mime-info   libgtk-3-0 : Depends: adwaita-icon-theme but it is not going to be installed                Depends: shared-mime-info                Depends: libcairo-gobject2 (>= 1.14.0) but it is not going to be installed                Depends: libcolord2 (>= 0.1.10) but it is not going to be installed                Depends: libgdk-pixbuf-2.0-0 (>= 2.40.0) but it is not going to be installed                Depends: libjson-glib-1.0-0 (>= 1.5.2) but it is not going to be installed                Depends: libpangocairo-1.0-0 (>= 1.41.0) but it is not going to be installed                Depends: libpangoft2-1.0-0 (>= 1.41.0) but it is not going to be installed                Depends: librest-0.7-0 (>= 0.7) but it is not going to be installed                Depends: libgtk-3-common (>= 3.24.24-4) but it is not going to be installed                Recommends: libgtk-3-bin                Recommends: librsvg2-common but it is not going to be installed  E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.  

I tried to install all packages one by one, but the computer says that all of them are already installed. Can anyone help?

Thank you.


Edit 1

user@machine:~$ dpkg --print-architecture  amd64  
user@machine:~$ dpkg --print-foreign-architectures  i386  
user@machine:~$ apt policy librsvg2-2  librsvg2-2:    Installed: 2.50.3+dfsg-1    Candidate: 2.50.3+dfsg-1    Version table:   *** 2.50.3+dfsg-1 500          500 http://deb.debian.org/debian bullseye/main amd64 Packages          100 /var/lib/dpkg/status    
user@machine:~$ sudo apt policy librsvg2-2:i386  librsvg2-2:i386:    Installed: (none)    Candidate: 2.50.3+dfsg-1    Version table:       2.50.3+dfsg-1 500          500 http://deb.debian.org/debian bullseye/main i386 Packages  ``  

fixed length file issue

Posted: 07 Nov 2021 08:31 AM PST

few records in fixed length file are split into two records The file looks some thing similar to below. The second record is split into two records. How can I remove '\r' from the end and move the third row up and merge with second row. Any help is appreciated.

Sample File:

abcdefghikdf\n

dekgd\r\n

dfdfddd\n

djfkjeijrerr\n

dfkdfjdfkkdf\n

Final Result needed:

abcdefghikdf\n

dekgddfdfddd\n

djfkjeijrerr\n

dfkdfjdfkkdf\n

Except creating a network bridge on the host, is there any other way to SSH from host to guest in QEMU?

Posted: 07 Nov 2021 08:00 AM PST

I have installed a QEMU VM, both host and guest OS being ubuntu 20.04. For the host to SSH into guest, do I have to use bridged networking? Is there any other way to SSH from host to guest in QEMU without super user privilege of host? If QEMU cannot make it, is VirtualBox able to SSH from host to guest without super user privilege of host? Thanks.

Viewing Pictures via SMB much slower than copying the picutre

Posted: 07 Nov 2021 07:23 AM PST

I have an NAS in my local network that I connect to via SMB from my laptop. When I try to view a single picture that is stored on my NAS via feh or nomacs, it takes 30s sometimes longer. Copying over a picture to my laptop and opening it there is way faster (<1s).

What could be the reason for this? Do I need to look into a different picture viewer or file explorer or should I use SFTP instead?

I am on Manjaro and the NAS is a Synology. We are connected through a mix of ethernet and WiFi.

Why doesn’t my system boot (Arch)?

Posted: 07 Nov 2021 07:19 AM PST

What exactly is happening here? I had Arch installed on this system for the last couple of weeks and everything was working fine. I have LVM on LUKS. Last time I did an update was a couple of days ago, and everything worked fine since then. Now, it won't boot.

enter image description here enter image description here

Colours aren't right on Pop OS running on a 2012 macbook pro

Posted: 07 Nov 2021 06:50 AM PST

I need a little help here if someone tried this procedure before. The subject is to run Linux (dual-boot) on a MacBook Pro 2012 (non-retina edition).

For the dual boot procedure, I want to keep Mojave because I have two programs that I want to use from time to time, and unfortunately they don't provide a Linux version. As for the Linux distribution, I want to use Pop Os.

The problem:

I tried this before some times and although the system runs very good, the graphics are very different from how Mojave is showing the colors. Is something that I can do so that I can run pop Os and use the correct graphics driver? I may think that something is happening with the driver..

Unfortunately I cannot explain exactly how the colors are but imagine that you see something more blue and more white. I feel like the graphics card is not working..

Summary:

  • MacBook Pro 2012 Non Retina with Mojave for dual boot with Linux Pop Os.
  • Graphics card model : Intel HD Graphics 4000 1536 MB
  • Problem : graphics are not showing correctly.

Thank you very much for your time.

Can't play audio in Bluetooth headphones

Posted: 07 Nov 2021 06:13 AM PST

I have a pair of Bluetooth headphones that I would like to use as a playback device. The first time I turned my headphones on and entered "Bluetooth pairing" mode, I was able to see them in the list of available devices and thus connect to them. After the connection was established, the headphones were correctly selected as the default output device.

However, something weird happens when I turn my headphones off and turn them back on. In particular, I am able to connect to them via Bluetooth but I'm unable to select them as the output device - they don't even show up in the Audio settings. The only way to make them work again is to:

  1. Turn the headphones off
  2. Delete them from the list of known Bluetooth devices
  3. Turn them back on and enter Bluetooth pairing mode
  4. Connect to them

Does anybody have a clue of why this happens and how could I solve the problem?

Here are some useful info about my setup:

  • OS: KDE Neon 5.22
  • KDE Plasma version: 5.22.1
  • Headphones model: Panasonic RB-HF420B

Glibc 2.34 cross-compiling issue for aarch64 on x86_64

Posted: 07 Nov 2021 05:57 AM PST

aarch64-linux-gnueabihf-gcc ../sysdeps/gnu/getutmpx.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-prototypes -Wold-style-definition -fmath-errno   -fPIC   -ftls-model=initial-exec      -I../include -I/mnt/lfs/sources/glibc-2.34/build/login  -I/mnt/lfs/sources/glibc-2.34/build  -I../sysdeps/unix/sysv/linux/aarch64  -I../sysdeps/aarch64/nptl  -I../sysdeps/unix/sysv/linux/generic  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/aarch64/fpu  -I../sysdeps/aarch64/multiarch  -I../sysdeps/aarch64  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /mnt/lfs/cross-tools/lib/gcc/aarch64-linux-gnueabihf/11.2.0/include -isystem /mnt/lfs/cross-tools/lib/gcc/aarch64-linux-gnueabihf/11.2.0/include-fixed -isystem /mnt/lfs/cross-tools/aarch64-linux-gnueabihf/usr/include -D_LIBC_REENTRANT -include /mnt/lfs/sources/glibc-2.34/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC -DSHARED     -DTOP_NAMESPACE=glibc -o /mnt/lfs/sources/glibc-2.34/build/login/getutmpx.os -MD -MP -MF /mnt/lfs/sources/glibc-2.34/build/login/getutmpx.os.dt -MT /mnt/lfs/sources/glibc-2.34/build/login/getutmpx.os  aarch64-linux-gnueabihf-gcc ../sysdeps/gnu/getutmp.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-prototypes -Wold-style-definition -fmath-errno   -fPIC   -ftls-model=initial-exec      -I../include -I/mnt/lfs/sources/glibc-2.34/build/login  -I/mnt/lfs/sources/glibc-2.34/build  -I../sysdeps/unix/sysv/linux/aarch64  -I../sysdeps/aarch64/nptl  -I../sysdeps/unix/sysv/linux/generic  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/aarch64/fpu  -I../sysdeps/aarch64/multiarch  -I../sysdeps/aarch64  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /mnt/lfs/cross-tools/lib/gcc/aarch64-linux-gnueabihf/11.2.0/include -isystem /mnt/lfs/cross-tools/lib/gcc/aarch64-linux-gnueabihf/11.2.0/include-fixed -isystem /mnt/lfs/cross-tools/aarch64-linux-gnueabihf/usr/include -D_LIBC_REENTRANT -include /mnt/lfs/sources/glibc-2.34/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC -DSHARED     -DTOP_NAMESPACE=glibc -o /mnt/lfs/sources/glibc-2.34/build/login/getutmp.os -MD -MP -MF /mnt/lfs/sources/glibc-2.34/build/login/getutmp.os.dt -MT /mnt/lfs/sources/glibc-2.34/build/login/getutmp.os  echo 'login/getlogin.o login/getlogin_r.o login/setlogin.o login/getlogin_r_chk.o login/getutent.o login/getutent_r.o login/getutid.o login/getutline.o login/getutid_r.o login/getutline_r.o login/utmp_file.o login/utmpname.o login/updwtmp.o login/getpt.o login/grantpt.o login/unlockpt.o login/ptsname.o login/ptsname_r_chk.o login/login.o login/login_tty.o login/logout.o login/logwtmp.o login/openpty.o login/forkpty.o login/setutxent.o login/getutxent.o login/endutxent.o login/getutxid.o login/getutxline.o login/pututxline.o login/utmpxname.o login/updwtmpx.o login/getutmpx.o login/getutmp.o' > /mnt/lfs/sources/glibc-2.34/build/login/stamp.oT  mv -f /mnt/lfs/sources/glibc-2.34/build/login/stamp.oT /mnt/lfs/sources/glibc-2.34/build/login/stamp.o  echo 'login/getlogin.os login/getlogin_r.os login/setlogin.os login/getlogin_r_chk.os login/getutent.os login/getutent_r.os login/getutid.os login/getutline.os login/getutid_r.os login/getutline_r.os login/utmp_file.os login/utmpname.os login/updwtmp.os login/getpt.os login/grantpt.os login/unlockpt.os login/ptsname.os login/ptsname_r_chk.os login/login.os login/login_tty.os login/logout.os login/logwtmp.os login/openpty.os login/forkpty.os login/setutxent.os login/getutxent.os login/endutxent.os login/getutxid.os login/getutxline.os login/pututxline.os login/utmpxname.os login/updwtmpx.os login/getutmpx.os login/getutmp.os' > /mnt/lfs/sources/glibc-2.34/build/login/stamp.osT  mv -f /mnt/lfs/sources/glibc-2.34/build/login/stamp.osT /mnt/lfs/sources/glibc-2.34/build/login/stamp.os  make[2]: Leaving directory '/mnt/lfs/sources/glibc-2.34/login'  make  subdir=elf -C elf ..=../ subdir_lib  make[2]: Entering directory '/mnt/lfs/sources/glibc-2.34/elf'  ../Makerules:1137: *** multiple target patterns.  Stop.  make[2]: Leaving directory '/mnt/lfs/sources/glibc-2.34/elf'  make[1]: *** [Makefile:478: elf/subdir_lib] Error 2  make[1]: Leaving directory '/mnt/lfs/sources/glibc-2.34'  make: *** [Makefile:9: all] Error 2  

Configuration:

../configure                           \    -prefix=$LFS/cross-tools           \    --host=$CLFS_TARGET                \    --build=$(../scripts/config.guess) \    --enable-kernel=3.2                \    --with-headers=$LFS/cross-tools/${CLFS_TARGET}/usr/include    \    libc_cv_slibdir=/usr/lib \   && make $MAKEFLAGS\   && make DESTDIR=$LFS/cross-tools/${CLFS_TARGET} install  

where

$LFS="/mnt/lfs"    $CLFS_TARGET="aarch64-linux-gnueabihf"    $MAKEFLAGS="-j7"  

configparams:

echo "rootsbindir=/usr/sbin CC=${CLFS_TARGET}-gcc" > configparms  

Increase glusterfs mount max read

Posted: 07 Nov 2021 05:43 AM PST

Looking at glusterfs mounts in /proc/mounts I see this:

162.xxxx:/cluster /mnt/glusterfs fuse.glusterfs rw,noatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072 0 0  

Is there a way to increase it? It seems my fstab doesn't recognize max_read when I try to set it manually

Count the number of times where the next log entry came after one or more minutes than the last one

Posted: 07 Nov 2021 06:46 AM PST

I have a log file that records the date, time (hours, minutes, seconds, milliseconds), the speed of a vehicle and the free distance between the vehicle and the vehicle in front and back of our vehicle. If the vehicle stops, then it doesn't measure the distances.

My selfdriving.log file look looks like this:

2021.04.01. 13:14:30:78 78 110 110  2021.04.01. 13:14:30:99 79 111 111  2021.04.01. 13:14:31:50 80 111 119  2021.04.01. 13:14:59:87 87 118 117  2021.04.01. 13:16:59:87 86 116 119  2021.04.01. 13:17:22:32 75 117 115  2021.04.01. 13:18:50:65 75 96 109  2021.04.01. 13:18:55:00 0 0 0  

What I have to do is to write a script that returns the number of times an log entry was made one or more minutes after the last one (so if my calculations are correct, it should return 2 in this case). I don't understand how grep works and how I can put the returned values into variables. So far, I've tried:

#!/bin/sh    for i in "cat selfdriving.log"  do    grep (([01][0-9])|(2[0-3])):[0-5][0-9]:[0-5][0-9]:[0-9][0-9]  done  

Which I know doesn't evaluate to much.

sudo apt autoclean doesn't work; wheras sudo apt clean does

Posted: 07 Nov 2021 08:33 AM PST

I'm on Debian Bullseye XFCE. Please find the relevant details of my system below:

vrgovinda@krishna:~$ uname -a  Linux krishna 5.10.0-8-amd64 #1 SMP Debian 5.10.46-5 (2021-09-23) x86_64 GNU/Linux  

The version of apt-get is as follows:

vrgovinda@krishna:~$ apt-get -v  apt 2.2.4 (amd64)  Supported modules:  *Ver: Standard .deb  *Pkg:  Debian dpkg interface (Priority 30)   Pkg:  Debian APT solver interface (Priority -1000)   Pkg:  Debian APT planner interface (Priority -1000)   S.L: 'deb' Debian binary tree   S.L: 'deb-src' Debian source tree   Idx: Debian Source Index   Idx: Debian Package Index   Idx: Debian Translation Index   Idx: Debian dpkg status file   Idx: Debian deb file   Idx: Debian dsc file   Idx: Debian control file   Idx: EDSP scenario file   Idx: EIPP scenario file  

The issue is this. When I run sudo apt autoclean, it is expected that all the .deb files except the most recent versions should get deleted (i. e.) the ones which cannot be downloaded anymore. But that doesn't happen in my system. I've posted the samples here below:

/var/cache/apt/archives$ ls  libuuid1_2.36.1-7_amd64.deb  libuuid1_2.36.1-8_amd64.deb  lock  libuuid1_2.36.1-7_i386.deb   libuuid1_2.36.1-8_i386.deb   partial    

Now I run autoclean:

/var/cache/apt/archives$ sudo apt autoclean   Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  

The contents of the archives folder remains as it is:

/var/cache/apt/archives$ ls  libuuid1_2.36.1-7_amd64.deb  libuuid1_2.36.1-8_amd64.deb  lock  libuuid1_2.36.1-7_i386.deb   libuuid1_2.36.1-8_i386.deb   partial  

Surprisingly, sudo apt clean cleans out the archives folder as expected. It is therefore weird that only the autoclean function doesn't work.

vrgovinda@krishna:~$ sudo apt clean  [sudo] password for vrgovinda:   vrgovinda@krishna:~$ cd /var/cache/apt/archives/  vrgovinda@krishna:/var/cache/apt/archives$ ls  lock  partial  

Can someone help me out?? Thanks in advance.

Edit: @StephenKitt

vrgovinda@krishna:/var/cache/apt/archives$ apt policy libuuid1   libuuid1:    Installed: 2.36.1-8   Candidate: 2.36.1-8  Version table:  *** 2.36.1-8 500   500 file:/home/vrgovinda/bullseye-deb-files ./ Packages  500 deb.debian.org/debian bullseye/main amd64 Packages  100 /var/lib/dpkg/status  2.36.1-7 500   500 file:/home/vrgovinda/bullseye-deb-files ./ Packages`  

How is a dual boot with grub supposed to be configured?

Posted: 07 Nov 2021 06:39 AM PST

I've seen some instructions but I'm really trying to understand the whole boot process. I installed debian on a drive with a partition for the OS and another partition for the user. It automatically created boot and swap partitions also. Then, using gparted, I created a new partition cloning the original debian partition. I gave it a new UUID. I updated grup options.

When I boot, I get to the grub options and I see two versions of the os. I specifically select the OS on the new partition. But when it boots and i check in the terminal, i see / is mounted from /dev/nvme0n1p2 instead of /dev/nvme0n1p5

This is what I'm confused about: /dev/nvme0n1p1 mounts to /boot/efi and in /boot/efi/EFI/debian/grub.cfg there is a config file:

search.fs_uuid FIRST-DRIVE-UUID root   set prefix=($root)'/boot/grub'  configfile $prefix/grub.cfg  

What this basically means to me is that it's going to mount the first install, then load the grub.cfg from that first install. Now it's already got the first install mounted as root, but to run the second install, it obviously needs to mount the second drive as root instead. So it seems like it's loading grub from within the first install instead of loading grub BEFORE it mounts the first install?

There is a grub config file that references both installs at /boot/grub/grub.cfg , but this is part of the first install's partition. It seems like once this file is read, the first install has already loaded and it's too late to select which partition to boot from. This file starts with

#  # DO NOT EDIT THIS FILE  #  # It is automatically generated by grub-mkconfig using templates  # from /etc/grub.d and settings from /etc/default/grub  

Does this config somehow need to be moved to the boot partition?

When I run update-grub or grub-mkconfig (v2.04-20) i get this output:

$ sudo grub-mkconfig -o grub.cfg   Generating grub configuration file ...  Found background image: /usr/share/images/desktop-base/desktop-grub.png  Found linux image: /boot/vmlinuz-5.10.0-9-amd64  Found initrd image: /boot/initrd.img-5.10.0-9-amd64  Found linux image: /boot/vmlinuz-5.10.0-8-amd64  Found initrd image: /boot/initrd.img-5.10.0-8-amd64  Found Debian GNU/Linux 11 (bullseye) on /dev/nvme0n1p5  Adding boot menu entry for EFI firmware configuration  done  

This would appear to reference the initrd and vmlinuz on the first install. the second install just gets found.

evince is slow to open

Posted: 07 Nov 2021 05:16 AM PST

//Ever since I updated debian, evince has been slow to startup - it takes about half a minute. Once it is open, it works fine, its just slow to open. It never used to take that long - it just used to take a couple of seconds. How can I get it going fast again?

$ uname -a  Linux mypc 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux  

I noticed that evince is hanging at the following line for about half a minute:

$ strace evince  ...  eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 11                                      write(11, "\1\0\0\0\0\0\0\0", 8)        = 8                                       write(10, "\1\0\0\0\0\0\0\0", 8)        = 8                                       futex(0x562f5b8ffac0, FUTEX_WAKE_PRIVATE, 1) = 1                                  futex(0x562f5b909b30, FUTEX_WAKE_PRIVATE, 1) = 1                                  futex(0x562f5b8bd158, FUTEX_WAKE_PRIVATE, 1) = 1                                  poll([{fd=11, events=POLLIN}], 1, 25000) = 1 ([{fd=11, revents=POLLIN}])          read(11, "\1\0\0\0\0\0\0\0", 16)        = 8                                       poll([{fd=11, events=POLLIN}], 1, 25000) = 0 (Timeout) # <- hanging here for a while  

Then it proceeds on to open evince as normal and evince then works fine.

I have my own .xinitrc, which I'm not sure if I have configured correctly - so that could be the problem:

$ cat ~/.xinitrc   #!/bin/bash    # update the xterm colors, font size, etc  [[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources    # run the window manager in the background first  metacity &    # get the window manager process id  wm_pid=$!    # make the window manager process id available to kill later if required  export wm_pid    # run urxvt instead of xterm since this seems able to render greek symbols etc  urxvt &    # do not let the window manager become a zombie  wait $wm_pid  

Then startx is called from .bashrc. The relevant part is:

$ tail -20 ~/.bashrc    # go straight to x on login. only do this for tty1 so that we can still use the  # other tty consoles without starting x. also only do this when there is no  # display, otherwise the terminal will try and do this after x starts aswell.  # finally, only do it when x is installed (command -v startx checks if startx  # exists).  # note: as of xorg-server 1.16, x is rootless but can only be started on the  # current vt (1)  [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]] && \  command -v startx > /dev/null 2>&1 && \  startx -- :0 vt1    # if using rxvt or urxvt immediately set the window to fullscreen  if [[ $TERM == *"rxvt"* ]]; then      # make the window with rxvt in the name the active window      wmctrl -a rxvt        # make the active window fullscreen      wmctrl -r ":ACTIVE:" -b add,fullscreen  fi  

Syntax highlighting combinations of strings and comments in nano

Posted: 07 Nov 2021 05:11 AM PST

I was wondering if anyone could tell me if it possible to configure syntax highlighting in .nanorc so that in the following text ...

Dim s$ = "foo ' bar" ' bar "foo"  

... the string "foo 'bar" is all highlighted one colour and the trailing comment ' bar "foo" is highlighted another.

If I do this:

# Comments.  color yellow "'.*"    # Strings  color brightmagenta ""(\\.|[^"])*""  

Then I get this:

Image1

And if I do it in the other order:

# Strings  color brightmagenta ""(\\.|[^"])*""    # Comments.  color yellow "'.*"  

Then I get this:

Image2

Move and shrink a partition at the same time

Posted: 07 Nov 2021 04:55 AM PST

It is possible to shrink a partition with, for example, parted.

It is also possible to move (copy) a partition from one hard drive to another, by creating a partition of the same size on the target drive and then do something like dd if=/dev/sda1 of=/dev/sdb1.

Is it possible to do this simultaneously? To shrink a not very full partition of drive a and copy it smaller on drive b. Of course one could shrink it on drive a first, but I think it should be possible without doing that first.

The "Pro Audio" profile in PipeWire for audio devices / sound cards

Posted: 07 Nov 2021 08:20 AM PST

After upgrading from PulseAudio to PipeWire my sound devices now feature the "Pro Audio" profile however I've Googled for it and haven't found anything interesting. You can find it by running PulseAudio Volume Control and see it under the Configuration tab for your devices.

Would be nice if someone could, I don't know, glance over PipeWire sources (I'm not a C programmer per se and I don't really understand digital audio aside from the very basics) and explain what it is and why the user may want to use it instead of e.g. something which is offered by default.

QEMU VM has no IP

Posted: 07 Nov 2021 07:03 AM PST

I tried to run a VM on QEMU, but the VM is up without an IP address associated with eth0. I configured the bridge and tap interface on the host, and I can see that:

brctl show bro  bridge name     bridge id               STP enabled     interfaces  bro             8000.bedc8d16e7d8       no              eno1                                                          tap0  

The interfaces look good:

ip addr show bro  3: bro: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000      link/ether be:dc:8d:16:e7:d8 brd ff:ff:ff:ff:ff:ff      inet 192.168.100.112/24 brd 192.168.100.255 scope global dynamic bro         valid_lft 540129sec preferred_lft 540129sec      inet6 fe80::bcdc:8dff:fe16:e7d8/64 scope link         valid_lft forever preferred_lft forever    ip addr show eno1  2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bro state UP group default qlen 1000          link/ether 98:90:96:9d:d9:83 brd ff:ff:ff:ff:ff:ff    ip addr show tap0  8: tap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master bro state DOWN group default qlen 1000      link/ether d2:74:5b:04:81:f8 brd ff:ff:ff:ff:ff:ff      inet 192.168.100.222/24 brd 192.168.100.255 scope global tap0         valid_lft forever preferred_lft forever  

Here is the command I use to run the VM:

sudo qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic -pflash flash0.img -pflash flash1.img -drive if=none,file=CentOS-7-aarch64-Minimal-1810.iso,id=hd0 -device virtio-blk-device,drive=hd0 -netdev type=tap,id=net0 -device virtio-net-device,netdev=net0,mac=bc:dc:8d:16:e7:d8, -hda centos7-arm.img  

At the guest there is no IP, even though DHCP is no:

[root@localhost ~]# ip link show eth0  2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000      link/ether bc:dc:8d:16:e7:d8 brd ff:ff:ff:ff:ff:ff  

After I tried to config from CentOS nmtui, service network restart failed. Found in log:

localhost.localdomain network[4058]: Bringing up interface eth0: Error: Connection activation failed: IP configuration could not be reserved (no available address, timeout, etc.)  

Do you have any idea what could be going wrong?

Refresh arp entries in FreeBSD

Posted: 07 Nov 2021 03:07 AM PST

In Linux, an ARP entry's age gets reset/refreshed if a packet comes by. However, it seems that FreeBSD simply sets a timer, and unconditionally evicts the ARP entry even if packets with that MAC-address/IP came by. Is there a way to get Linux's behaviour of updating the age if traffic is seen?

I am experiencing large bursts of ARP broadcast traffic every 20 minutes on my LAN because of this. I know that one can change the age in FreeBSD's cache, but that just changes the intervals between bursts. I want to stop the bursts in the first place.

Pulseaudio no LFE (subwoofer output) in 2.1 or 4.1 configuration

Posted: 07 Nov 2021 06:55 AM PST

I'm using pulseaudio with a 6-channel USB sound device (which reports itself as a "CM106 Like Sound Device"). I added the following to ~/.config/pulse/daemon.conf:

enable-lfe-remixing = yes  lfe-crossover-freq = 50  

If I open pavucontrol and, under the configuration tab, select "Analog Surround 5.1 Output," everything works fine as best I can tell, except for the fact that I don't have 5 speakers. (I can test by moving the speakers around to different output ports and playing surround sound test files.)

Unfortunately, if I select either "Analog Surround 4.1 Output" or "Analog Surround 2.1 Output", I get no sound out of my subwoofer. Is there any way to make my subwoofer work with fewer than 6 channels?

Network Manager user-side dispatcher scripts

Posted: 07 Nov 2021 04:38 AM PST

This answer gives a solution to run scripts when a connection has been set up by NetworkManager. However, I'd like to run my script (that auto-connect to some special kinds of hotspot) as a non-root user, because it's quite dirty, and I would not bet that it's not possible to do code-injection inside. Do you know if a kind of ~/.config/NetworkManager/dispatcher.d/ exists ?

Thank you!

WiFi repeater with a single WiFi adapter in Debian

Posted: 07 Nov 2021 07:16 AM PST

Is it possible to create a WiFi repeater with a single WiFi adapter in Debian , to increase the range of my WiFi network?

How to list "only" startup applications through the terminal on Fedora 24

Posted: 07 Nov 2021 04:03 AM PST

How to list in the terminal "only" start-up applications (the ones that you find normally in "Startup Application Preferences" Dialog box on Fedora Mate Desktop). This question can be generalized to Ubuntu or any other Linux Distro.

pulseaudio-equalizer keeps resetting at startup

Posted: 07 Nov 2021 08:02 AM PST

Every time I start my laptop, pulseaudio-equalizer it's enabled. Even when I disable it (inside the app there's a button to disable it). How can I avoid that?

Moreover, something is resetting my volume to 100% at startup. I believe it has something to do with pulseaudio-equalizer. Can anyone help me to solve this?

I'm using elementaryOS, based on Ubuntu 14.04 LTS.

KMS Terminal: How to disable second screen, or how to force a certaion resolution?

Posted: 07 Nov 2021 05:04 AM PST

I have two screens with different native resolution connected to my Gentoo/systemd machine. since the VTs try to mirror the outputs, they do not use the whole size of the higher resolution screen. I never use virtual terminals on the lower resolution screen, so I'd like to have them use the whole high resolution monitor.

If I disable the lower resolution screen with the video kernel command line parameter, I cannot switch it on in X11, since the kernel thinks the output is not connected. Nevertheless, on X11 I want to be able to enable the second monitor whenever I need it.

Is there an option on the kernel command line, in systemd, or somewhere I can't think of at them moment, to disable the virtual terminals on one output, to have different virtual terminals on different outputs (kind of multiseat), to force the vts to use the whole size of one connected screen, or to disable an output on virtual terminals in such a way that xrandr can reenable it?

TCP buffers keep filling up (Recv-Q full): named unresponsive

Posted: 07 Nov 2021 05:40 AM PST

Using netstat -an, I set the message that the Recv-Q is full. It is filling up to the rmem_max:

Active Internet connections (servers and established)  Proto Recv-Q Send-Q Local Address               Foreign Address             State        udp   1894912      0 10.0.64.150:53              0.0.0.0:*  

(it keeps 'filling' until it crashes)

Sizes:

/proc/sys/net/core/optmem_max:20480  /proc/sys/net/core/rmem_default:8388608  /proc/sys/net/core/rmem_max:8388608  /proc/sys/net/core/wmem_default:229376  /proc/sys/net/core/wmem_max:229376  

Result in netstat -su:

Udp:  426057 packets received  37152 packets to unknown port received.  2350589 packet receive errors  517422 packets sent  

Who has an idea?

openvpn with systemd: reconnect

Posted: 07 Nov 2021 06:00 AM PST

I'm using openvpn enabled as a service. It works well, but once I get assigned a new IP address or lose the connection, I can't access to the internet any more. Then I have to systemctl restart openvpn@ipredator.conf manually. How can I fix that so I don't have to login as root each time and restart the service manually?

[root@arch paul]# cat /etc/openvpn/ipredator.conf   client  dev tun0  proto udp  remote pw.openvpn.ipredator.se 1194  resolv-retry infinite  nobind    auth-user-pass /etc/openvpn/ipredator.auth  auth-retry nointeract    ca [inline]    tls-client  tls-auth [inline]  ns-cert-type server    keepalive 10 30  cipher AES-256-CBC  tls-cipher TLSv1:!ADH:!SSLv2:!NULL:!EXPORT:!DES:!LOW:!MEDIUM:@STRENGTH  persist-key  persist-tun  comp-lzo  tun-mtu 1500  mssfix  passtos  verb 3    <ca>  -----BEGIN CERTIFICATE-----  ###censored###  -----END CERTIFICATE-----  </ca>    <tls-auth>  -----BEGIN OpenVPN Static key V1-----  ###censored###  -----END OpenVPN Static key V1-----  </tls-auth>  

How to remove gnome-games package without removing other packages?

Posted: 07 Nov 2021 03:05 AM PST

So I want to remove (more exactly purge) some packages like gnome-games from Debian 6. As already expected and know by research Aptitude also wants to remove in example the meta-package gnome, as without the gnome-games the gnome package is not fully installed. No problem with that. But now the difference comes: Aptitude also wants to remove a ton of other important packages! How can I just avoid that? I cannot understand what in example network-manager has to do with gnome-games. Unmarking gnome-games as manually installed does not make a difference.

However, this is my console dump:

root@testing:/home/branch# aptitude purge gnome-games  The following packages will be REMOVED:    gnome-games{p}   0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.  Need to get 0 B of archives. After unpacking 2,490 kB will be freed.  The following packages have unmet dependencies:  gnome: Depends: gnome-games (>= 1:2.30) but it is not going to be installed.  The following actions will resolve these dependencies:    Remove the following packages:  1)     gnome                           Accept this solution? [Y/n/q/?] Y  The following packages will be REMOVED:  aptdaemon{u} binfmt-support{u} cli-common{u} dnsmasq-base{u} epiphany-extensions{u}  evolution-exchange{u} gdebi{u} gdebi-core{u} gedit-plugins{u} gnome{a}  gnome-codec-install{u} gnome-games{p} gnome-office{u} gnome-themes-extras{u}  gnome-themes-more{u} gtk2-engines-smooth{u} libart2.0-cil{u} libgconf2.0-cil{u}   libgee2{u} libgexiv2-0{u} libglade2.0-cil{u} libglib2.0-cil{u} libgmime2.4-cil{u}   libgnome-vfs2.0-cil{u} libgnome2.24-cil{u} libgnomepanel2.24-cil{u} libgpod-common{u}  libgpod4{u} libgtk2.0-cil{u} libmono-addins-gui0.2-cil{u} libmono-addins0.2-cil{u}  libmono-cairo2.0-cil{u} libmono-corlib2.0-cil{u} libmono-i18n-west2.0-cil{u}  libmono-posix2.0-cil{u} libmono-security2.0-cil{u} libmono-sharpzip2.84-cil{u}  libmono-system2.0-cil{u} libmtp8{u} libndesk-dbus-glib1.0-cil{u} libndesk-dbus1.0-cil{u}  libnm-glib-vpn1{u} libpcsclite1{u} liferea{u} liferea-data{u} media-player-info{u}  mobile-broadband-provider-info{u} modemmanager{u} mono-2.0-gac{u} mono-gac{u}  mono-runtime{u} network-manager{u} network-manager-gnome{u} ppp{u} python-aptdaemon{u}  python-aptdaemon-gtk{u} python-mako{u} python-markupsafe{u} python-vte{u}  python-webkit{u} rhythmbox{u} rhythmbox-plugin-cdrecorder{u} rhythmbox-plugins{u}  shotwell{u} simple-scan{u} software-center{u} tcl{u} tcl8.4{u} tomboy{u} totem-mozilla{u}  transmission-common{u} transmission-gtk{u} update-manager-core{u} update-manager-gnome{u}  update-notifier{u} update-notifier-common{u} usb-modeswitch{u} usb-modeswitch-data{u}  wpasupplicant{u}  0 packages upgraded, 0 newly installed, 79 to remove and 0 not upgraded.  Need to get 0 B of archives. After unpacking 143 MB will be freed.  Do you want to continue? [Y/n/?] n  Abort.  

Edit: Aptitude wants to remove all the packages as it assumes they are unused after removing the gnome metapackage. But that definitely is not the case. How to tell aptitude that it simply keeps those packages? It does not give any other option.

No comments:

Post a Comment