Saturday, November 13, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Why will the echo sta

Posted: 13 Nov 2021 03:21 PM PST

I am trying to write a command for code golf (hence the questionable syntax below), and I cannot get it to work. The errors I am getting point to the inline function. At this point, it is probably already too long for code golf; I just want to know where I went wrong.

The script is as follows:

#!/bin/bash  list=("one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten")  function parse { echo -e "${1}" }  P='N'; for i in "${list[@]}";do [ $P = 'Y' ] && P='N';[ $P != 'Y' ] && { parse "${i}" P='Y'; }; done  

The challenge is to write code that parses every other line in a list using as few characters as possible. The smallest script wins. The bash script above was supposed to set a flag and call parse if unset, and if set, it unsets and passes. Sounds simple enough, but for whatever reason, I couldn't get this to run.

By the way, as I said above, you will notice a lot of 'dirty' syntax and inconsistencies below. It is because of the "few characters as possible" constraint, combined with the fact that I've been picking through it for a while now, adding or removing things to subvert the most recent error in whatever way I could.

My question has to do with the function on the second line. Shell-check can't parse it at all, and I don't understand why. Additionally, when I try to run, why am I getting an unexpected EOF error? I assumed that I had forgotten to close something, but I don't see anything.

When to use named FIFO over posix message queues for IPC and process-thread communication

Posted: 13 Nov 2021 03:18 PM PST

Trying to understand which IPC mechanism (mqueue vs mkfifo) is preferred to use in which scenario.

I have got two different processes/tasks and multiple threads running in one of the processes. The idea is to have a communication channel established between two processes, as well as process and all the threads running inside it.

Message queues are a part of the kernel space so does that mean one could allocate it to allow communication between the processes whereas Mkfifo for each thread so that process could write to a corresponding thread to wake it up when there's some work to do? Would using message queues instead of Mkfifos for processes and threads be a rather more expensive thing to do in terms of resources?

Also, priority of the messages isn't of any concern.

Video artifacts on xmonad

Posted: 13 Nov 2021 02:25 PM PST

I suddenly started getting this type of artifacts while using xmonad.

glitch 1 glitch 2

The pattern changes and often disappears after some mouse movements.

I didn't do any video-related updates, nor xmonad updates. This does not happen when using gnome. Similar glitches also manifest when typing in gui applications, but not in the terminal emulator nor in emacs.

I have tried both with and without nvidia driver, the issue is always present.

I am using debian bookworm with linux 5.14.0-2-amd64.

Do you have any idea what this could be related to?

How to reveal a file in file explorer?

Posted: 13 Nov 2021 01:40 PM PST

What's a cross-platform solution I can implement in Python to reveal a file (by path) in the user's file browser?

I have working solution for windows and macOS:

def reveal_file(filename: str):      if sys.platform == 'win32':          opener = ['explorer',  '/select,']      elif sys.platform == 'darwin':          opener = ['open', '-R']      subprocess.Popen(opener + [filename])  

But I don't know how to support the rest of Unix and Linux. The most portable way to open a file seems to be xdg-open file, unfortunately it doesn't have a "reveal" option.

Why LanguageTool is not working on LibreOffice?

Posted: 13 Nov 2021 12:58 PM PST

I am using LibreOffice 7.2.2.2. I have installed LanguageTool 5.4, then 5.5.1, but none of them are working. They only add buttons to the toolbar, though they do not react. What would you suggest?

Subshell (subprocess/child process) with its own $BASHPID not listed by `ps`

Posted: 13 Nov 2021 12:59 PM PST

I don't understand the following:

mkfifo p;  $ (>p ps -f | >>p echo $BASHPID) &  [1] 983527  $ cat p  983529     PID    PPID  C STIME TTY          TIME CMD  981815  165343  0 19:57 pts/27   00:00:00 bash  983527  981815  0 21:09 pts/27   00:00:00 bash    # <- child bash process `(...)`  983528  983527  0 21:09 pts/27   00:00:00 ps -f  983530  981815  0 21:09 pts/27   00:00:00 cat p  

(...) & results in a child process with PID 983527. It is a bash process.

ps -f executes in a child process of (...) with PID 983528. It is the left hand-side component command of the pipeline ...|....

echo $BASHPID reports to be executing in a process with PID 983529. It ought to be the right hand-side component of the pipeline ...|... and it ought to be listed as a bash process.

Is that last interpretation correct? And why can we not see that last process listed by the ps -f command?

libvpx and python-sqlalchemy causing errors when running `yay -Syyu`

Posted: 13 Nov 2021 12:22 PM PST

My computer runs Arch Linux. I have yay installed.

Recently, when I run yay -Syyu I've been prompted with the following messages, and here are the responses I give. The result is basically the same, conflicting packages prevents the upgrades from running.

Below are the four outputs. How do I resolve these errors and get on with the system upgrade?

:: Starting full system upgrade...  :: Replace qwtpolar with extra/qwt? [Y/n] Y  resolving dependencies...  looking for conflicting packages...  warning: removing 'python-sqlalchemy' from target list because it conflicts with 'python-sqlalchemy1.3'  :: python-sqlalchemy1.3 and python-sqlalchemy are in conflict. Remove python-sqlalchemy? [y/N] y  error: failed to prepare transaction (could not satisfy dependencies)  :: installing libvpx (1.11.0-1) breaks dependency 'libvpx.so=6-64' required by ffmpeg-compat-57   -> error installing repo packages       :: Starting full system upgrade...   :: Replace qwtpolar with extra/qwt? [Y/n] n   resolving dependencies...   looking for conflicting packages...   warning: removing 'python-sqlalchemy' from target list because it conflicts with 'python-sqlalchemy1.3'   :: python-sqlalchemy1.3 and python-sqlalchemy are in conflict. Remove python-sqlalchemy? [y/N] y   error: failed to prepare transaction (could not satisfy dependencies)   :: installing libvpx (1.11.0-1) breaks dependency 'libvpx.so=6-64' required by ffmpeg-compat-57    -> error installing repo packages        :: Starting full system upgrade...  :: Replace qwtpolar with extra/qwt? [Y/n] Y  resolving dependencies...  looking for conflicting packages...  warning: removing 'python-sqlalchemy' from target list because it conflicts with 'python-sqlalchemy1.3'  :: python-sqlalchemy1.3 and python-sqlalchemy are in conflict. Remove python-sqlalchemy? [y/N] N  error: unresolvable package conflicts detected  error: failed to prepare transaction (conflicting dependencies)  :: python-sqlalchemy1.3 and python-sqlalchemy are in conflict   -> error installing repo packages      :: Starting full system upgrade...  :: Replace qwtpolar with extra/qwt? [Y/n] n  resolving dependencies...  looking for conflicting packages...  warning: removing 'python-sqlalchemy' from target list because it conflicts with 'python-sqlalchemy1.3'  :: python-sqlalchemy1.3 and python-sqlalchemy are in conflict. Remove python-sqlalchemy? [y/N] N  error: unresolvable package conflicts detected  error: failed to prepare transaction (conflicting dependencies)  :: python-sqlalchemy1.3 and python-sqlalchemy are in conflict   -> error installing repo packages  

How to properly parse a quoted arg-list string in a shell script?

Posted: 13 Nov 2021 11:54 AM PST

Summary

How to convert a single string a "b" 'c d' $'e\nf' into separate arguments, respecting quotes and preserving whitespaces and newlines?

Question

I'm trying to read and process the output of a script that exports value lists, one per line, in form of quoted strings (as created by printf %q). The values within a list are space-separated, may be quoted, may include spaces and newlines, and are of unknown count.

Example: a "b" 'c d' $'e\nf'

I'm looking for a way to restore the values in a POSIX shell script and handle them as arguments to a shell function.

Desired solutions, in descending priority:

  1. POSIX shell commands and core utilities like xargs, printf and the like; no eval
  2. Bash
  3. A full-blown programming language like perl
Skeleton for the shell script process.sh:
#!/bin/sh  set -eu    process() {    printf '>%s<\n' "${@}"  }    main() {    value_list="${1}"    # split value list here and set positional parameters    set -- ???    process "${@}"  }    main "${@}"  
Desired behaviour
$ process.sh "a \"b\" 'c d' $'e\nf'"  >a<  >b<  >c d<  >e  f<  
What happened so far
  • I tried different combinations of printf (incl. %q), xargs, while read loops, changing IFS, separation of args with a null byte, subshell invocations, heredocs.
  • xargs allows unquoting, but only for spaces, not for newlines, and only without argument -d.
  • A while read loop can parse args, but does not allow to call a shell function when input is read from a pipe

Running a process in the background and get the terminal back

Posted: 13 Nov 2021 12:38 PM PST

I'm running ethr tool to send TCP Traffic to my device. The Ethr tools sends traffic per interface and i have written a python script to execute the ethr tool command for multiple interfaces. I chose to run to execute the command in the background so that i can interate through.

The problem that I face is, using ampsersand '&' I'm able to send the process to background but it requires to press Enter to be able to get back the prompt. is there a way to get the prompt without pressing enter?

The command that I use to run the tool is: ./ethr -s ip 73.3.224.11 -4 -port 10499 -no &

I tried to redirect to a file but the problem is the file size grows and my VM Crashes. kindly suggest any alternate solution pls

How can I remove characters before and after a text in a chain of characters with Grep, knowing that text is produced through a variable?

Posted: 13 Nov 2021 10:56 AM PST

I'm using

grep 'name=>' log.txt | cut -d\   -f3   

I get this kind of result:

name=>"Faya-Largeau",  name=>"Paris",  name=>"Madrid",  

name is the output of a variable (I have a long list of cities like this)

I would like to get only "Faya-Largeau" or "Paris" or "Madrid" So I need to exclude both name=> and , before and after a city between brackets.

How can I do that ?

Thanks in advance

i am using centos 7, i keep receiving the boot almost full prompt. how do i resolve this?

Posted: 13 Nov 2021 11:37 AM PST

[

root@localhost ~]# ls -l /boot/  total 369648  -rw-r--r--. 1 root root   153596 Oct 13 20:25 config-3.10.0-1160.45.1.el7.x86_64  -rw-r--r--. 1 root root   229187 Nov  2 15:45 config-5.10.75-200.el7.x86_64  -rw-r--r--. 1 root root   227122 Nov  5 02:34 config-5.15.1-1.el7.elrepo.x86_64  -rw-r--r--. 1 root root   227122 Nov 11 02:28 config-5.15.2-1.el7.elrepo.x86_64  drwx------. 3 root root       17 Jul 29  2020 efi  drwxr-xr-x. 2 root root     4096 Nov  9 08:38 extlinux  drwxr-xr-x. 2 root root       27 Nov  9 08:37 grub  drwx------. 5 root root       97 Nov 13 21:11 grub2  -rw-------. 1 root root 79859483 Nov  9 09:01 initramfs-0-rescue-a350d250d61946feaf8ce7cd586d2a3f.img  -rw-------. 1 root root 43025918 Nov 11 10:27 initramfs-3.10.0-1160.45.1.el7.x86_64.img  -rw-------. 1 root root 17871653 Nov 11 10:33 initramfs-3.10.0-1160.45.1.el7.x86_64kdump.img  -rw-------. 1 root root 49402929 Nov 12 21:23 initramfs-5.10.75-200.el7.x86_64.img  -rw-------. 1 root root 29178359 Nov 12 21:26 initramfs-5.10.75-200.el7.x86_64kdump.img  -rw-------. 1 root root 47363206 Nov 11 10:20 initramfs-5.15.1-1.el7.elrepo.x86_64.img  -rw-------. 1 root root 48028233 Nov 13 10:16 initramfs-5.15.2-1.el7.elrepo.x86_64.img  -rw-r--r--. 1 root root   320757 Oct 13 20:25 symvers-3.10.0-1160.45.1.el7.x86_64.gz  -rw-r--r--. 1 root root   267754 Nov  2 15:45 symvers-5.10.75-200.el7.x86_64.gz  -rw-r--r--. 1 root root   406168 Nov  5 02:36 symvers-5.15.1-1.el7.elrepo.x86_64.gz  -rw-r--r--. 1 root root   406143 Nov 11 02:29 symvers-5.15.2-1.el7.elrepo.x86_64.gz  -rw-------. 1 root root  3620596 Oct 13 20:25 System.map-3.10.0-1160.45.1.el7.x86_64  -rw-------. 1 root root  5692601 Nov  2 15:45 System.map-5.10.75-200.el7.x86_64  -rw-------. 1 root root  5132230 Nov  5 02:34 System.map-5.15.1-1.el7.elrepo.x86_64  -rw-------. 1 root root  5132230 Nov 11 02:28 System.map-5.15.2-1.el7.elrepo.x86_64  -rwxr-xr-x. 1 root root  6769256 Nov  9 09:01 vmlinuz-0-rescue-a350d250d61946feaf8ce7cd586d2a3f  -rwxr-xr-x. 1 root root  6773352 Oct 13 20:25 vmlinuz-3.10.0-1160.45.1.el7.x86_64  -rwxr-xr-x. 1 root root 10784456 Nov  2 15:45 vmlinuz-5.10.75-200.el7.x86_64  -rwxr-xr-x. 1 root root  8799136 Nov  5 02:34 vmlinuz-5.15.1-1.el7.elrepo.x86_64  -rwxr-xr-x. 1 root root  8798528 Nov 11 02:28 vmlinuz-5.15.2-1.el7.elrepo.x86_64  [root@localhost ~]#   

MariaDB & Amazon Linux 2: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded

Posted: 13 Nov 2021 11:55 AM PST

Following AWS documents, I'm attempting to get a basic LAMP server up and running. Everything appears to be working fine. Logging into MySQL either through the terminal or phpMyAdmin (GUI) works.

However, when I check the status of MariaDB, I'm given an error and unsure how to tackle it.

[ec2-user@ip-172-31-30-51 ~]$ sudo systemctl status mariadb● mariadb.service -     MariaDB 10.2 database server   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)  Drop-In: /etc/systemd/system/mariadb.service.d           └─override.conf        /usr/lib/systemd/system/mariadb.service.d           └─tokudb.conf   Active: active (running) since Sat 2021-11-13 16:52:39 UTC; 37s ago  Process: 3087 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)    Process: 2837 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)    Process: 2801 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)   Main PID: 2943 (mysqld)     Status: "Taking your SQL requests now..."     CGroup: /system.slice/mariadb.service             └─2943 /usr/libexec/mysqld --basedir=/usr    Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal mysql-check-upgrade[3087]: ERROR: ld.so: object '/usr/lib64/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.  Nov 13 16:52:39 ip-172-31-30-51.ec2.internal systemd[1]: Started MariaDB 10.2 database server.  

It's not a problem yet, but I've only just done the installation of everything. So I would imagine problems would arise in the future from this?

EDIT: I'm testing this on a t2.micro EC2 instance with 30GB of storage space.

Lost boot option 'debian' after switching between UEFI and Legacy

Posted: 13 Nov 2021 12:09 PM PST

In a stupid attempt to test something I switched between UEFI and Legacy on my Dell XPS13 where I am running Debian Bullseye on an encrypted SSD.

Sofar I have tried several things according to the most useful similar questions here, but I cannot recover the boot option 'debian'. From here I gathered most of the used options below, which are kind of similar to this tutorial.

# decrypt drive  sudo cryptsetup luksOpen /dev/nvme0n1p3 mydisk    # mount  sudo mount /dev/mapper/ALF--vg-root /mnt  sudo mount /dev/nvme0n1p1 /mnt/boot/efi  for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done    sudo chroot /mnt    grub-install /dev/nvme0n1  update-grub    exit  

The output of efibootmgr -v before (see below) only changes to BootOrder: 0003,0007, but somehow gets reset apparently when rebooting (Ive tried this several times)?

BootCurrent: 0007  Timeout: 0 seconds  BootOrder: 0007  Boot0000* Windows Boot Manager  HD(2,GPT,13a9ec87-8ccb-4b03-9a6a-82ef130b8028,0x109000,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...o................  Boot0003* debian        HD(1,GPT,d68c44b3-646d-4e6d-9c3f-16b2ff1fd834,0x800,0x100000)/File(\EFI\debian\shimx64.efi)  Boot0007* UEFI: SanDisk U3 Cruzer Micro 8.02, Partition 1       PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(1,MBR,0x3b632446,0x800,0xb057ee)..BO  

I dont now if this helps, but there are several efi-files, for some reason there are 2 nested uppercase EFI direcotries:

kubuntu@kubuntu:~$ ls /mnt/boot/efi/EFI  Dell  EFI  debian  kubuntu@kubuntu:~$ ls /mnt/boot/efi/EFI/debian/  BOOTX64.CSV  fbx64.efi  grub.cfg  grubx64.efi  mmx64.efi  shimx64.efi  

I am open to any hints and suggestions.

EDIT: I tried this

Why are cloud-init processes running long after server creation?

Posted: 13 Nov 2021 03:01 PM PST

I'm spinning up a new Ubuntu 18.04 cloud server and using a cloud-init to install docker. I can see that the cloud-init process runs and apparently completes fine, by inspecting the /var/log/cloud-init-output.log file. But I'm finding that several cloud-init processes are still running long after this, and using up CPU:

enter image description here

These cloud-init processes appears on the top list every 30 seconds or so, then drop off, then back again. Any way to diagnose this further... why is cloud-init running at all after it has apparently finished, and why so many processes?

I'm also seeing a CPU trace which has regular peaks which seem to follow the same pattern:

enter image description here

Looking at /var/log/cloud-init.log, I see that it goes crazy every 30 seconds or so, outputting the following, with a small number of lines repeated over and over again:

2021-11-13 19:21:25,927 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}  2021-11-13 19:21:25,928 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events  2021-11-13 19:21:25,928 - hotplug_hook.py[DEBUG]: Fetching datasource  2021-11-13 19:21:25,928 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]  2021-11-13 19:21:25,928 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)  2021-11-13 19:21:25,928 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl  2021-11-13 19:21:25,931 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)  2021-11-13 19:21:25,932 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id  2021-11-13 19:21:25,932 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner  2021-11-13 19:21:25,932 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner  2021-11-13 19:21:25,932 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net  2021-11-13 19:21:25,932 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events  2021-11-13 19:21:25,932 - hotplug_hook.py[DEBUG]: Exiting hotplug handler  2021-11-13 19:21:25,932 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)  2021-11-13 19:21:25,932 - util.py[DEBUG]: Read 17 bytes from /proc/uptime  2021-11-13 19:21:25,932 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.058 seconds (0.06)  2021-11-13 19:21:26,035 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}  2021-11-13 19:21:26,035 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events  2021-11-13 19:21:26,035 - hotplug_hook.py[DEBUG]: Fetching datasource  2021-11-13 19:21:26,035 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]  2021-11-13 19:21:26,036 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)  2021-11-13 19:21:26,036 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl  2021-11-13 19:21:26,039 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)  2021-11-13 19:21:26,039 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id  2021-11-13 19:21:26,039 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner  2021-11-13 19:21:26,039 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner  2021-11-13 19:21:26,039 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net  2021-11-13 19:21:26,040 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events  2021-11-13 19:21:26,040 - hotplug_hook.py[DEBUG]: Exiting hotplug handler  2021-11-13 19:21:26,040 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)  2021-11-13 19:21:26,040 - util.py[DEBUG]: Read 17 bytes from /proc/uptime  2021-11-13 19:21:26,040 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.054 seconds (0.06)  2021-11-13 19:21:26,054 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}  2021-11-13 19:21:26,054 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events  2021-11-13 19:21:26,054 - hotplug_hook.py[DEBUG]: Fetching datasource  2021-11-13 19:21:26,054 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]  2021-11-13 19:21:26,055 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)  2021-11-13 19:21:26,055 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl  2021-11-13 19:21:26,058 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)  2021-11-13 19:21:26,058 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id  2021-11-13 19:21:26,058 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner  2021-11-13 19:21:26,058 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner  2021-11-13 19:21:26,058 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net  2021-11-13 19:21:26,058 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events  2021-11-13 19:21:26,059 - hotplug_hook.py[DEBUG]: Exiting hotplug handler  2021-11-13 19:21:26,059 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)  2021-11-13 19:21:26,059 - util.py[DEBUG]: Read 17 bytes from /proc/uptime  2021-11-13 19:21:26,059 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.057 seconds (0.05)  

I guess this would be something that the cloud host (Hetzner) is doing (wrong) with their cloud-init? (I have now raised a ticket.)

Why this word can't be grep?

Posted: 13 Nov 2021 11:49 AM PST

I have access to busybox only, v 1.27.

I'm trying to use a huge TXT file I extracted from a PDF document as a TXT dictionary, to be console friendly. The word I'm trying to get is the very first word of the line. What's next on the line, is the definition.

Word I'm grepping for:    patético  

The one liner I'm using is this:

cat ./rae.txt | grep '^patético'  

cat is being used because I have a quicker access to delete the word I'm looking for and that's more efficient. It saves a couple of keystrokes by just deleting the last part of the line, the term.

Most of the time I get the definition of the word I'm searching, for example anhelo.

$ grep -e '^anhelo' ./rae.txt  anhelo. (Del lat. anhelus). 1. m. Deseo vehemente.       anheloso, sa. (Del lat. anhelosus). 1. adj. Que tiene o siente anhelo. Anhelosos de con-   cluir. 2. adj. Propio de lo que muestra anhelo. Mirada, búsqueda anhelosa. 3. adj. Dicho de la   respiración: Frecuente y fatigosa. 4. adj. desus. Que respira de este modo.       

As you can see, each line has the definition, anhelo and anheloso.

First I thought the issue was the dot . and/or comma , right after the word, I assumed it was being expanded or interpreted as a special character and not as plain text. But is not the case.

My questions are:

Why I can't grep ^patético? Why this does not work?

grep -e '^patético' ./rae.txt  

The text I'm running grep on is:

patería. 1. f. coloq. Chile y Perú. Muestra ocasional y fingida de amistad.         paternal. (De paterno). 1. adj. Propio del afecto, cariño o solicitud de padre.         paternalismo. 1. m. Tendencia a aplicar las formas de autoridad y protección propias del   padre en la familia tradicional a relaciones sociales de otro tipo; políticas, laborales, etc. U. m.   en sent. peyor.         paternalista. 1. adj. Dicho de una persona: Que adopta el paternalismo como forma de   conducta. U. t. c. s. 2. adj. Que responde o parece responder a dicha actitud.         paternalmente. 1. adv. m. De modo propio o digno de un padre.         paternidad. (Del lat. paternitas, -atis). 1. f. Cualidad de padre. 2. f. Tratamiento que en   algunas órdenes dan los religiosos inferiores a los padres condecorados de su orden, y que   los seculares dan por reverencia a todos los religiosos en general, considerándolos como   padres espirituales.         paterno, na. (Del lat. paternus). 1. adj. Perteneciente o relativo al padre. 2. adj. Propio   del padre. 3. adj. Derivado de él.  V. casa paterna         paternóster. (Del lat. Pater noster, Padre nuestro, palabras con que principia la oración   dominical). 1. m. Oración del padrenuestro. 2. m. Padrenuestro que se dice en la misa, y es   una de las partes de ella. 3. m. Cada uno de los aditamentos de alambre que se adaptan al   chambel para aumentarle su capacidad de pesca. 4. m. Chambel ya preparado con estos   artilugios. 5. m. coloq. Nudo gordo y muy apretado.         patero, ra. (De pato1). 1. adj. Chile y Perú. Adulador, lisonjeador. U. t. c. s. 2. m.   Cazador de patos salvajes.         pateta. (De pata1). 1. m. coloq. diablo (|| príncipe de los ángeles rebelados). Ya se lo   llevó pateta. No lo hiciera pateta. 2. m. coloq. Persona que tiene un vicio en la conformación   de los pies o de las piernas. 3. m. pl. u. c. sing. Méx. diablo (|| príncipe de los ángeles rebela-   dos). EL patetas.         patéticamente. 1. adv. m. De modo patético.         patético, ca. (Del lat. patheticus, y este del gr. o, que impresiona, sensible). 1. adj. Que   es capaz de mover y agitar el ánimo infundiéndole afectos vehementes, y con particularidad   dolor, tristeza o melancolía.         patetismo. 1. m. Cualidad de patético.         patí. (De or. guar.). 1. m. Arg. y Ur. Pez grande de río, de color gris azulado con man-   chas oscuras. 2. m. C. Rica. Especie de empanada rellena de carne o papas.         -patía. (Del lat. -pathia, y este del gr. a, de la raíz -, sufrir, experimentar). 1. elem. com-   pos. Significa 'sentimiento', 'afección' o 'dolencia'. Homeopatía, telepatía.         patiabierto, ta. (De pata1 y abierto). 1. adj. coloq. Que tiene las piernas torcidas e irreg-   ulares, y separadas una de otra.         

By the way, is not just patético is every word with a tilde; in this word is é. My system doesn't have UTF-8 support, nor a language package installed. I assumed this should not be a problem, because letters are just a stream of bytes and also that I don't have issues if I utilize less to search for words not showing up with grep.

EDIT

locale

LANG=C  LC_CTYPE="C"  LC_NUMERIC="C"  LC_TIME="C"  LC_COLLATE="C"  LC_MONETARY="C"  LC_MESSAGES="C"  LC_PAPER="C"  LC_NAME="C"  LC_ADDRESS="C"  LC_TELEPHONE="C"  LC_MEASUREMENT="C"  LC_IDENTIFICATION="C"  LC_ALL=    

file -i rae.txt

rae.txt: text/plain; charset=utf-8  

EDIT2

Console codepage

C  POSIX    ANSI_X3.110-1983  ANSI_X3.4-1968  ISO-8859-1  ISO-8859-15  ISO-8859-2  

EDIT 3 After processing rae.txt with iconv to be ISO8859-1

./rae-iso88591.txt: text/plain; charset=iso-8859-1  

Create redundant grub bootloader on Debian

Posted: 13 Nov 2021 12:58 PM PST

I have a Debian based server, where every partition is RAIDed, except the one that has /boot/efi. This means that I will still have all my data after a disk failure, but the system may be unable to boot.

Is there a good way to create a redundant grub install / EFI partition?

I tried mdadm RAID with v0.90 headers, but its fragile thus unsupported. I also found that grub supports syncing multiple EFI partitions on Ubuntu, but it's also not available on Debian.

Example of subshell without child-shell process

Posted: 13 Nov 2021 03:11 PM PST

I just recently learned that "subshell" is not the same as "child shell process" (see for example What is the exact difference between a "subshell" and a "child process"? and the POSIX definitions of subshell and child process).

To convince myself of this, I am looking for a command that illustrates (proves) that a subshell is created without a child-shell being spawned.

For now, everything I tried seemed to spawn a child-shell whenever a subshell is created:

$ echo $BASHPID; (pwd; cd ..; echo $BASHPID; pwd); pwd      # `( ...)` executed in a subshell                                                              # and in a child-shell process    $ >&2 ps | ps       # Theoretically executed in two subshells and apparently without child-shells                      # but I cannot be sure due to the outcome of the next example    $ $ >&2 echo $BASHPID | ps      # `ps` doesn't display a child-shell for the execution of `echo`  953790                          # but `echo $BASHPID` shows a new process that is necessarily      PID TTY         TIME CMD    # a child-shell since echo is a built-in    948538 pts/2   00:00:00 bash   953791 pts/2   00:00:00 ps  

I am looking for a way to demonstrate that having a subshell doesn't necessarily imply having a child-shell...

Bash 5.0.17

HTTPD: What's Missing?

Posted: 13 Nov 2021 03:16 PM PST

I am unable to get webpages past the default Apache Welcome screen. I am trying to get www.mybestfriendsarecats.com to publish.

httpd -S  

provided error information in /etc/httpd/conf.d/mod_security, so I rm /etc/httpd/conf.d/mod_security.conf and now httpd -S goes through with no errors.

So I restart httpd systemctl restart httpd and get Error: Too many open files

Apache server is on:

[Neptune@orcacomputers ~]$ systemctl status httpd  ● httpd.service - The Apache HTTP Server     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)     Active: active (running) since Wed 2021-11-10 09:01:55 PST; 20min ago       Docs: man:httpd(8)             man:apachectl(8)   Main PID: 2080 (httpd)     Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"      Tasks: 8     CGroup: /system.slice/httpd.service             ├─2080 /usr/sbin/httpd -DFOREGROUND             ├─2373 /usr/libexec/nss_pcache 7 off             ├─2539 /usr/sbin/httpd -DFOREGROUND             ├─2540 /usr/sbin/httpd -DFOREGROUND             ├─2541 /usr/sbin/httpd -DFOREGROUND             ├─2542 /usr/sbin/httpd -DFOREGROUND             └─2543 /usr/sbin/httpd -DFOREGROUND    Nov 10 09:01:55 orcacomputers systemd[1]: Starting The Apache HTTP Server...  Nov 10 09:01:55 orcacomputers systemd[1]: Started The Apache HTTP Server.    firewalld-cmd --list-all  services: http, https are active in firewalld  

ports: 80/tcp 443/tcp are open on firewalld

firewall-cmd --list-all  ports: 80/tcp 443/tcp   

forward-ports: none

Firewalld running

[root@orcacomputers conf]# systemctl status firewalld -l  ● firewalld.service - firewalld - dynamic firewall daemon     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)     Active: active (running) since Sat 2021-11-13 11:44:42 PST; 10s ago       Docs: man:firewalld(1)   Main PID: 3429 (firewalld)      Tasks: 2     CGroup: /system.slice/firewalld.service             └─3429 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid    Nov 13 11:44:42 orcacomputers systemd[1]: Starting firewalld - dynamic firewall daemon...  Nov 13 11:44:42 orcacomputers systemd[1]: Started firewalld - dynamic firewall daemon.  

ping internally to site replies but does not externally:

[Neptune@orcacomputers ~]$ ping mybestfriendsarecats.com  PING mybestfriendsarecats.com (24.109.184.150) 56(84) bytes of data.  64 bytes from security.orcacomputers.com (24.109.184.150): icmp_seq=1 ttl=64 time=0.065 ms  64 bytes from security.orcacomputers.com (24.109.184.150): icmp_seq=2 ttl=64 time=0.038 ms  

Here is the configuration file for this virtual host

[Neptune@orcacomputers ~]$ cat /etc/httpd/conf.d/mybestfriendsarecats.com.conf  <VirtualHost *:80>                   ServerName mybestfriendsarecats.com          ServerAlias www.mybestfriendsarecats.com          ServerAdmin webmaster@localhost          DocumentRoot /var/www/mybestfriendsarecats.com/public_html          ErrorLog /var/log/httpd/mybestfriendsarecats.com-error.log          CustomLog /var/log/httpd/mybestfriendsarecats.com-access.log combined              <Directory "/var/www/mybestfriendsarecats.com/public_html">            AllowOverride None          </Directory>  

Here is the default httpd.conf file. My intuition is thinking Allow Override setting or something?

[Neptune@orcacomputers conf]$ cat httpd.conf  #  # This is the main Apache HTTP server configuration file.  It contains the  # configuration directives that give the server its instructions.  # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.  # In particular, see   # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>  # for a discussion of each configuration directive.  #  # Do NOT simply read the instructions in here without understanding  # what they do.  They're here only as hints or reminders.  If you are unsure  # consult the online docs. You have been warned.    #  # Configuration and logfile names: If the filenames you specify for many  # of the server's control files begin with "/" (or "drive:/" for Win32), the  # server will use that explicit path.  If the filenames do *not* begin  # with "/", the value of ServerRoot is prepended -- so 'log/access_log'  # with ServerRoot set to '/www' will be interpreted by the  # server as '/www/log/access_log', where as '/log/access_log' will be  # interpreted as '/log/access_log'.    #  # ServerRoot: The top of the directory tree under which the server's  # configuration, error, and log files are kept.  #  # Do not add a slash at the end of the directory path.  If you point  # ServerRoot at a non-local disk, be sure to specify a local disk on the  # Mutex directive, if file-based mutexes are used.  If you wish to share the  # same ServerRoot for multiple httpd daemons, you will need to change at  # least PidFile.  #  ServerRoot "/etc/httpd"    #  # Listen: Allows you to bind Apache to specific IP addresses and/or  # ports, instead of the default. See also the <VirtualHost>  # directive.  #  # Change this to Listen on specific IP addresses as shown below to   # prevent Apache from glomming onto all bound IP addresses.  #  #Listen 24.109.184.150:80  Listen 80    #  # Dynamic Shared Object (DSO) Support  #  # To be able to use the functionality of a module which was built as a DSO you  # have to place corresponding `LoadModule' lines at this location so the  # directives contained in it are actually available _before_ they are used.  # Statically compiled modules (those listed by `httpd -l') do not need  # to be loaded here.  #  # Example:  # LoadModule foo_module modules/mod_foo.so  #  Include conf.modules.d/*.conf    #  # If you wish httpd to run as a different user or group, you must run  # httpd as root initially and it will switch.    #  # User/Group: The name (or #number) of the user/group to run httpd as.  # It is usually good practice to create a dedicated user and group for  # running httpd, as with most system services.  #  User apache  Group apache    # 'Main' server configuration  #  # The directives in this section set up the values used by the 'main'  # server, which responds to any requests that aren't handled by a  # <VirtualHost> definition.  These values also provide defaults for  # any <VirtualHost> containers you may define later in the file.  #  # All of these directives may appear inside <VirtualHost> containers,  # in which case these default settings will be overridden for the  # virtual host being defined.  #    #  # ServerAdmin: Your address, where problems with the server should be  # e-mailed.  This address appears on some server-generated pages, such  # as error documents.  e.g. admin@your-domain.com  #  ServerAdmin root@localhost    #  # ServerName gives the name and port that the server uses to identify itself.  # This can often be determined automatically, but we recommend you specify  # it explicitly to prevent problems during startup.  #  # If your host doesn't have a registered DNS name, enter its IP address here.  #  ServerName www.orcacomputers.com:80    #  # Deny access to the entirety of your server's filesystem. You must  # explicitly permit access to web content directories in other   # <Directory> blocks below.  #  <Directory />      AllowOverride None      Require all denied  </Directory>    #  # Note that from this point forward you must specifically allow  # particular features to be enabled - so if something's not working as  # you might expect, make sure that you have specifically enabled it  # below.  #    #  # DocumentRoot: The directory out of which you will serve your  # documents. By default, all requests are taken from this directory, but  # symbolic links and aliases may be used to point to other locations.  #  DocumentRoot "/var/www/"    #  # Relax access to content within /var/www.  #  <Directory "/var/www">      AllowOverride all      # Allow open access:      Require all granted  </Directory>    # Further relax access to the default document root:  <Directory "/var/www/">      #      # Possible values for the Options directive are "None", "All",      # or any combination of:      #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews      #      # Note that "MultiViews" must be named *explicitly* --- "Options All"      # doesn't give it to you.      #      # The Options directive is both complicated and important.  Please see      # http://httpd.apache.org/docs/2.4/mod/core.html#options      # for more information.      #      Options Indexes FollowSymLinks        #      # AllowOverride controls what directives may be placed in .htaccess files.      # It can be "All", "None", or any combination of the keywords:      #   Options FileInfo AuthConfig Limit      #      AllowOverride None        #      # Controls who can get stuff from this server.      #      Require all granted  </Directory>    #  # DirectoryIndex: sets the file that Apache will serve if a directory  # is requested.  #  <IfModule dir_module>      DirectoryIndex index.html  </IfModule>    #  # The following lines prevent .htaccess and .htpasswd files from being   # viewed by Web clients.   #  <Files ".ht*">      Require all denied  </Files>    #  # ErrorLog: The location of the error log file.  # If you do not specify an ErrorLog directive within a <VirtualHost>  # container, error messages relating to that virtual host will be  # logged here.  If you *do* define an error logfile for a <VirtualHost>  # container, that host's errors will be logged there and not here.  #  ErrorLog "logs/error_log"    #  # LogLevel: Control the number of messages logged to the error_log.  # Possible values include: debug, info, notice, warn, error, crit,  # alert, emerg.  #  LogLevel info    <IfModule log_config_module>      #      # The following directives define some format nicknames for use with      # a CustomLog directive (see below).      #      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined      LogFormat "%h %l %u %t \"%r\" %>s %b" common        <IfModule logio_module>        # You need to enable mod_logio.c to use %I and %O        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio      </IfModule>        #      # The location and format of the access logfile (Common Logfile Format).      # If you do not define any access logfiles within a <VirtualHost>      # container, they will be logged here.  Contrariwise, if you *do*      # define per-<VirtualHost> access logfiles, transactions will be      # logged therein and *not* in this file.      #      #CustomLog "logs/access_log" common        #      # If you prefer a logfile with access, agent, and referer information      # (Combined Logfile Format) you can use the following directive.      #      CustomLog "logs/access_log" combined  </IfModule>    <IfModule alias_module>      #      # Redirect: Allows you to tell clients about documents that used to       # exist in your server's namespace, but do not anymore. The client       # will make a new request for the document at its new location.      # Example:      # Redirect permanent /foo http://www.example.com/bar        #      # Alias: Maps web paths into filesystem paths and is used to      # access content that does not live under the DocumentRoot.      # Example:      # Alias /webpath /full/filesystem/path      #      # If you include a trailing / on /webpath then the server will      # require it to be present in the URL.  You will also likely      # need to provide a <Directory> section to allow access to      # the filesystem path.        #      # ScriptAlias: This controls which directories contain server scripts.       # ScriptAliases are essentially the same as Aliases, except that      # documents in the target directory are treated as applications and      # run by the server when requested rather than as documents sent to the      # client.  The same rules about trailing "/" apply to ScriptAlias      # directives as to Alias.      #      ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"    </IfModule>    #  # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased  # CGI directory exists, if you have that configured.  #  <Directory "/var/www/cgi-bin">      AllowOverride None      Options None      Require all granted  </Directory>    <IfModule mime_module>      #      # TypesConfig points to the file containing the list of mappings from      # filename extension to MIME-type.      #      TypesConfig /etc/mime.types        #      # AddType allows you to add to or override the MIME configuration      # file specified in TypesConfig for specific file types.      #      #AddType application/x-gzip .tgz      #      # AddEncoding allows you to have certain browsers uncompress      # information on the fly. Note: Not all browsers support this.      #      #AddEncoding x-compress .Z      #AddEncoding x-gzip .gz .tgz      #      # If the AddEncoding directives above are commented-out, then you      # probably should define those extensions to indicate media types:      #      AddType application/x-compress .Z      AddType application/x-gzip .gz .tgz        #      # AddHandler allows you to map certain file extensions to "handlers":      # actions unrelated to filetype. These can be either built into the server      # or added with the Action directive (see below)      #      # To use CGI scripts outside of ScriptAliased directories:      # (You will also need to add "ExecCGI" to the "Options" directive.)      #      #AddHandler cgi-script .cgi        # For type maps (negotiated resources):      #AddHandler type-map var        #      # Filters allow you to process content before it is sent to the client.      #      # To parse .shtml files for server-side includes (SSI):      # (You will also need to add "Includes" to the "Options" directive.)      #      AddType text/html .shtml      AddOutputFilter INCLUDES .shtml  </IfModule>    #  # Specify a default charset for all content served; this enables  # interpretation of all content as UTF-8 by default.  To use the   # default browser choice (ISO-8859-1), or to allow the META tags  # in HTML content to override this choice, comment out this  # directive:  #  AddDefaultCharset UTF-8    <IfModule mime_magic_module>      #      # The mod_mime_magic module allows the server to use various hints from the      # contents of the file itself to determine its type.  The MIMEMagicFile      # directive tells the module where the hint definitions are located.      #      MIMEMagicFile conf/magic  </IfModule>    #  # Customizable error responses come in three flavors:  # 1) plain text 2) local redirects 3) external redirects  #  # Some examples:  #ErrorDocument 500 "The server made a boo boo."  #ErrorDocument 404 /missing.html  #ErrorDocument 404 "/cgi-bin/missing_handler.pl"  #ErrorDocument 402 http://www.example.com/subscription_info.html  #    #  # EnableMMAP and EnableSendfile: On systems that support it,   # memory-mapping or the sendfile syscall may be used to deliver  # files.  This usually improves server performance, but must  # be turned off when serving from networked-mounted   # filesystems or if support for these functions is otherwise  # broken on your system.  # Defaults if commented: EnableMMAP On, EnableSendfile Off  #  #EnableMMAP off  EnableSendfile on    # Supplemental configuration  #  # Load config files in the "/etc/httpd/conf.d" directory, if any.  IncludeOptional conf.d/*.conf  

Error log /var/log/httpd/error_log https://termbin.com/uogv

I see ports 443 and 80 are listening

    tcp6       0      0 :::443                  :::*                    LISTEN      7356/httpd            tcp6       0      0 :::80                   :::*                    LISTEN      7356/httpd            

Center text with printf

Posted: 13 Nov 2021 01:16 PM PST

printf "%*s\n" $(((${#fname}+$COLUMNS)/2)) "$fname"  

I get this error:

line 9: (7+)/2: syntax error: operand expected (error token is ")/2")  

This works in the terminal but not in my script. Do you have any ideas?

Use USB stick with file on it to select GRUB 2 entry

Posted: 13 Nov 2021 12:31 PM PST

I have a machine which has Windows and Ubuntu 20.04 on it. The active partition (first boot item in BIOS) is the one where Ubuntu is installed on, and I've manually entered entries to GRUB to have Windows as a selection to boot into, which is set as the default.

I would like to be able to use a USB stick (or maybe better a SD-Card) in order to change the default selection. If it is inserted, it should boot into Ubuntu (the first entry), if not, then it should use the default selection (the third entry, Windows).

Would I need to (somehow, I wouldn't know how) install/copy/dd GRUB onto the USB-Stick/SD-Card and select it to be the first item in the BIOS's boot order, with a fallback to Ubuntu's partition, which is currently the first in the boot order?

Or is there (hopefully) a tool where I can just place a file on the Stick/Card which is then read by GRUB?


Update: I've been checking out the GRUB config files and noticed that there is one file called /boot/grub/grubenv which has an entry named next_entry=. This line exists because I sometimes used sudo grub-reboot 0 in order to reboot into Ubuntu. If I execute sudo grub-reboot 0 then this line changes to next_entry=0.

I am now thinking about modifying /etc/default/grub/00_header to check if a certain USB device is connected, and if it is, that it then either writes next_entry=0 into the grubenv file, or that I add some code which just sets the necessary variables similar to how next_entry=0 is doing it.

So now my issue is that I don't know what actions can be performed in 00_header, eventually using curl to fetch the variable would be perfect, but I guess that at that point no networking is present and that curl is not a recognized command.

How can I debug/get to learn GRUB to see what is doable in this file without risking of damaging the system?

I'm currently thinking about using a clean VM with a Snapshot into which I can revert into if something goes wrong, in order to gain some insights. But maybe a hint or two from experts here would have a lot of value to me.

Ubuntu, No Wifi Adapter

Posted: 13 Nov 2021 12:04 PM PST

I have installed Ubuntu 18.04.3 as a persistent storage, live USB version on an old Seagate external drive. I'm getting a "No Wifi Adapter Found" error in the Wifi settings once I boot into this Ubuntu Drive.

My network adapter readout from 'lspci' is 00:14.3 Network controller: Intel Corporation Wireless-AC 9560 [Jefferson Peak] (rev 10)

I dowloaded the corresponding linux supported drivers and copied it to /lib/firmware folder. After restarting my computer I still get the same error message. I double checked the /lib/firmware folder for the .ucode file and it was still there. Any help is greatly appreciated.

Does OpenRC support cgroups v2?

Posted: 13 Nov 2021 12:32 PM PST

A simple question: does OpenRC support cgroups version 2?

It seems that only version 1 is supported. And if it supports v2, how do I enable it?

Execute script in new gnome-terminal loading bashrc

Posted: 13 Nov 2021 03:06 PM PST

I have a script in a gnome-terminal shell and I would like to open a new terminal, load the bashrc configuration, execute a new script and avoid the closure of the new terminal window.

I have tried to execute this commands:

gnome-terminal -x bash  

the script above open a new shell and loads bashrc, but I don't know how to execute a script automatically.

gnome-terminal -x ./new_script.sh  

the script above open a new shell and execute the script but doesn't load bashrc and close the window.


The result that I would like to obtain is to feel like opening a new terminal as clicking the term icon but execute a script after the bashrc setup.

How to show complete window titles in Gnome overview?

Posted: 13 Nov 2021 11:43 AM PST

When doing scientific computation, I need many figures, often >50. When I press super, I get Gnome overview where the titles are often not useful etc in Fig. 1.

Fig. 1 a small sample of my Gnome overview with many windows where you see that Figure 34: P... is not useful

enter image description here

It would be really nice if the complete figure title was popping out when you move your cursor on top of the figure in Gnome overview.

OS: Debian 8.5 6 bit
Window manager: Gnome 3.14
Linux kernel: 4.6 backports
Hardware: Asus Zenbook UX303UA

Persist ip route and ip rule configurations for Policy Based Routing (iproute2)

Posted: 13 Nov 2021 01:04 PM PST

Currently running on Fedora Server 23, I've been searching for the right way to persist commands such as:

ip route add default via 10.0.2.1 dev ens32 table EXAMPLE_TABLE  ip rule add from 10.1.2.50 lookup EXAMPLE_TABLE prio 1000  

either through nmcli (ideally) or through some other, similarly, sane way.

I've seen examples like lodging it on the route-ifname file but that don't seem to execute the default rule correctly.

If you run ip route show table EXAMPLE_TABLE after a reboot you'll realize it doesn't stick - at least in my experience.

Any insights into this would be lovely, thank you.

Check whether Built-In Audio is active from different user login

Posted: 13 Nov 2021 02:41 PM PST

In my job, I support remote employees running Linux Mint via SSH and VNC.

Each employee uses a USB headset, which is the only sound device we want to be active. The sound device we need to disable is the "Built-in Audio" device, and if I open up a terminal on the employee's desktop, I can check whether the device is disabled by running pacmd list-sinks | grep "Built-in Audio".

This command also works over SSH if I login with the employee's username and password, but if I try to SSH with our admin "IT" username, it gives me the error "No PulseAudio daemon running, or not running as session daemon." Help! For security, I don't have the local passwords of each employee, but I can't seem to check whether Built-In Audio is active when I SSH via my IT username, even when I elevate IT to root privileges with su.

I've tried using su - [employee] and then accessing the local display with the command export DISPLAY=:0, but that didn't allow me to check the sound devices either. :(

Rhel 7 not booting up

Posted: 13 Nov 2021 02:03 PM PST

I recently installed rhel 7 on my laptop as dual boot (with windows 8.1) in UEFI mode. After the installation I cannot log into redhat. The gnome desktop starts to load and then it goes to a black screen with an underscore at top left corner. No key works at this stage except the power button.
My laptop is dell inspiron 15r 5537, 4th gen i5, 8gb ram amd graphics card.
I had this same screen while trying to install rhel (while booting from dvd in uefi). After some reboots the anaconda installer just started. And I installed rhel server with gui.
What is the issue?

Can I list the filesystems a running kernel can support?

Posted: 13 Nov 2021 02:26 PM PST

I'm trying to detect what filesystems a kernel can support. Ideally in a little list of their names but I'll take anything you've got.

Note that I don't mean the current filesystems in use, just ones that the current kernel could, theoretically support directly (obviously, fuse could support infinite numbers more).

How to tell Chromium-browser to run a url as single instance not multiple instances?

Posted: 13 Nov 2021 11:01 AM PST

I have a web application which crawls data and any browser download it first the second one will not get that crawl informations.

While using Chromium-browser in a PC i start as below:

$ chromium-browser -kiosk "http://pbx/adminkiosk/index?language=EN&username=2002&password=1234" &  sun@sun-Alienware-X51:~$ ps aux | grep "chromium-browser"  sun      31816  0.7  1.5 613092 61384 pts/4    Sl   15:44   0:03 /usr/lib/chromium-browser/chromium-browser -kiosk http://pbx/adminkiosk/index?language=EN&username=2002&password=1234  sun      31818  0.0  0.1 264484  7248 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser -kiosk http://pbx/adminkiosk/index?language=EN&username=2002&password=1234  sun      31819  0.0  0.0   6464   408 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser-sandbox /usr/lib/chromium-browser/chromium-browser --type=zygote  sun      31820  0.0  0.4 281364 18012 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser --type=zygote  sun      31824  0.0  0.1 281364  5404 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser --type=zygote  sun      31849  1.1  2.3 1052972 91968 pts/4   Sl   15:44   0:05 /usr/lib/chromium-browser/chromium-browser --type=renderer --lang=en-US --force-fieldtrials=ForceCompositingMode/disable/InfiniteCache/No/OmniboxHQPReplaceHUPRearrangeNumComponents/Standard/OmniboxSearchSuggestTrialStarted2013Q1/5/OneClickSignIn/BlueOnWhite/Prefetch/ContentPrefetchPrefetchOff/Prerender/Prerender15minTTL/UMA-New-Install-Uniformity-Trial/Experiment/UMA-Session-Randomized-Uniformity-Trial-5-Percent/group_15/UMA-Uniformity-Trial-1-Percent/group_45/UMA-Uniformity-Trial-10-Percent/group_06/UMA-Uniformity-Trial-20-Percent/group_02/UMA-Uniformity-Trial-5-Percent/default/UMA-Uniformity-Trial-50-Percent/group_01/ --disable-gl-multisampling --disable-accelerated-2d-canvas --disable-accelerated-video-decode --channel=31816.0.281183995  sun      31981  0.0  0.0  13584   924 pts/4    S+   15:51   0:00 grep --color=auto chromium-browser  

Now because 2 instance opening 2 url the data that gets crawled is delivered to other instance without balance. As a result my apps does not work with Chromium but works with Firefox/Opera.

How can i tell Chromium to stop this? And run the url only with one instance not twice??

EDIT:

I tried flags but no luck

--process-per-site    --single-process  

How do I install mono's System.Windows.Forms on Ubuntu?

Posted: 13 Nov 2021 01:34 PM PST

I haven't found any concise explanation of this.

No comments:

Post a Comment