Thursday, April 22, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Change shell from bash to ksh permanently with no admin rights

Posted: 22 Apr 2021 10:28 AM PDT

I need to change my putty shell from bash to ksh permanently. The chsh command and editing /etc/passwd are not available to me as I don't have admin rights. Please help me understand what needs to be changed in the .profile file or if it's something I need to change in the .bashrc/.kshrc files so I can use ksh moving forward.

Why would sshd reject a key when options are given?

Posted: 22 Apr 2021 10:11 AM PDT

sshd accepts connections from my public key, however, when I add the following options to the start of authorized_keys:

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty [SSH KEY HERE]   

it gives me

[user]@[host]: Permission denied (publickey).  

when I try to connect.

What are the possible reasons for this? This is not a problem that I've been able to figure out by searching, and currently the solution I've been going with is to simply leave those options out -- however in the interest of security, I'd like to start using them. I do not see any specific errors when running with -vvvv, although there is a lot to parse, so I may have missed something.

sshd is running on a different (<1000) port, and the user has been added to AllowUsers, and there are not many non-standard settings (no challenge-response allowed, PAM allowed, etc.)

How can I obtain the block size of an iso file without booting from it?

Posted: 22 Apr 2021 09:55 AM PDT

I would like to use the dd command to make a bootable flash drive, but for that I need to know what the correct block size is. I know that I can just boot the ISO in a VM and run parted or fdisk to obtain it, but I would like to know if it's possible to get the block size from the file directly. I've tried looking at it with both parted and fdisk, both mounted and unmounted as a loop device, but I just get the logical block size of the drive where the ISO is located, not the block size of the data in the ISO.

Extract text from a string and store in a variable

Posted: 22 Apr 2021 09:57 AM PDT

I have a string like /feature/abc-1245_branch_name, I wanted to extract abc-1245 from the string and store it into a different variable.

I tried using sed but didn't worked out well.

zip and unzip work in my shell script, but not in the terminal [closed]

Posted: 22 Apr 2021 09:59 AM PDT

I try using zip and unzip in my terminal and it fails to find the zip or unzip commands. However, I execute the same line by executing my program, and it works without error. What would cause this behavior?

My command:

zip -9 out_1.csv  

The error:

bash: zip: command not found  

WiFi: Can rtw88 firmware error be caused by USB and power?

Posted: 22 Apr 2021 09:10 AM PDT

Booting information

I have a dual boot system with Manjaro on my HDD and Windows 10 on SSD. After I am done with my work on Windows, I shut my laptop down, turn it on again and boot into Manjaro normally.

Problem scenario

Recently, my journald and dmesg logs are flooded with

rtw_8822ce: failed to send h2c command  

And cryptic error logs where it says it is trying to "reestablish connection" and/or "requesting hardware restart".

This repeats until the WiFi goes completely berserk and loses connection, never to reconnect back again. Strangely, Bluetooth works completely fine (it properly connects and disconnects).

This only happens if I am booting Manjaro after using Windows.

Also, this problem persists irrespective of Windows fast boot.

Apparent solution

Here are the steps I took that temporarily solves the problem:

  1. Shut down the laptop from Windows.
  2. Disconnect power supply.
  3. Remove any USB peripheral and plug it back in.
  4. Reconnect power supply.
  5. Turn the laptop on.
  6. Boot into Manjaro.

No more WiFi errors appear as long as I'm not booting into Windows. If I do boot back into Windows, I am required to follow the same steps again.

Note that Windows has no problem with the WiFi hardware whatsoever, which reinforces my hypothesis that this is not a hardware issue.

Information about USBs

$ inxi -Jxxx    USB:       Hub-1: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 speed: 480 Mb/s              chip-ID: 1d6b:0002 class-ID: 0900              Device-1: 3-3:2 info: Dell Dell MS116 Optical Mouse type: Mouse              driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 1.5 Mb/s power: 100mA              chip-ID: 413c:301a class-ID: 0301              Device-2: 3-4:3 info: IMC Networks Bluetooth Radio type: Bluetooth driver: btusb              interfaces: 2 rev: 1.0 speed: 12 Mb/s power: 500mA chip-ID: 13d3:3548 class-ID: e001              serial: 00e04c000001              Hub-2: 4-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s              chip-ID: 1d6b:0003 class-ID: 0900              Hub-3: 5-0:1 info: Full speed (or root) Hub ports: 2 rev: 2.0 speed: 480 Mb/s              chip-ID: 1d6b:0002 class-ID: 0900              Device-1: 5-1:2 info: IMC Networks USB2.0 HD UVC WebCam type: Video driver: uvcvideo              interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 13d3:56a2 class-ID: 0e02              serial: 0x0001              Hub-4: 6-0:1 info: Full speed (or root) Hub ports: 1 rev: 3.1 speed: 10 Gb/s              chip-ID: 1d6b:0003 class-ID: 0900  

Information about Network Adapters

$ inxi -Nxxx    Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK              driver: r8169 v: kernel port: e000 bus-ID: 02:00.0 chip-ID: 10ec:8168 class-ID: 0200              Device-2: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter vendor: AzureWave              driver: rtw_8822ce v: N/A port: d000 bus-ID: 04:00.0 chip-ID: 10ec:c822 class-ID: 0280  

Some online forums said that it is a faulty Realtek driver, and suggested that lwfinger's driver be used. I used it without any success.

Information about hardware

$ inxi -M    Machine:   Type: Laptop System: ASUSTeK product: TUF Gaming FX505DV_FX505DV v: 1.0              serial: <superuser required>              Mobo: ASUSTeK model: FX505DV v: 1.0 serial: <superuser required>              UEFI: American Megatrends v: FX505DV.312 date: 01/28/2021   

According to my research and via online forums, this problem is extremely common with the Asus TUF Gaming line of products. Unfortunately, I found no solution to the problem that pin-pointed towards TUF Gaming's hardware/firmware.

I even opened up my device to check for loose connections, and concluded that there were none.

My questions

  1. Is there any relation among power, USB and Wifi adapters?
  2. Is there any possible permanent solution to this?

“linux” grub loader can't detect android

Posted: 22 Apr 2021 10:07 AM PDT

I had installed Bliss OS. enter image description here

I wasn't getting that in grub loader. That's why I was searching in Google little bit. I got this.

And, I added following code at the bottom of /etc/grub.d/40_custom:

menuentry "Android-x86" {  set root='(hd0,2)'  linux /android-4.0-RC1/kernel quiet root=/dev/ram0 androidboot.hardware=eeepc acpi_sleep=s3_bios,s3_mode SRC=/android-4.0-RC1 SDCARD=/data/sdcard.img  initrd /android-4.0-RC1/initrd.img}  

And, tried following command

root@istiak ~ # sudo chmod +x /etc/grub.d/40_custom  #permission   root@istiak ~ # sudo update-grub           #updating grub  Generating grub configuration file ...    WARNING: Failed to connect to lvmetad. Falling back to device scanning.  Found Windows 10 (loader) on /dev/sda1  done  

/dev/sda2 209616896 272531455 62914560 30G 7 HPFS/NTFS/exFAT

I think I am having problem with root='(hd0,2)'. I didn't find SDCARD=/data/sdcard.img. There's only three img formatted file.Here are they.

/dev/sda1  *      1026048 209615761 208589714  99.5G  7 HPFS/NTFS/exFAT  /dev/sda2       209616896 272531455  62914560    30G  7 HPFS/NTFS/exFAT  /dev/sda3       272533504 273694719   1161216   567M 27 Hidden NTFS WinRE  /dev/sda4       274749438 625141759 350392322 167.1G  5 Extended  /dev/sda5       274749440 623142911 348393472 166.1G 83 Linux  /dev/sda6       623144960 625141759   1996800   975M 82 Linux swap / Solaris  

sda2 is Android. After doing above changes I got android while I can't access it

enter image description here Error : enter image description here

If you didn't create an sdcard image, remove the "SDCARD=/data/sdcard.img" part from the 3rd line (make sure you don't remove anything else!)

I am sure that I created image... But, I can't find it.. I tried by removing that line also but, same error occurs

Generating grub configuration file ... WARNING: Failed to connect to lvmetad. Falling back to device scanning. Found Windows 10 (loader) on /dev/sda1 done

Here's what I am currently trying..

#!/bin/sh  exec tail -n +3 $0  # This file provides an easy way to add custom menu entries.  Simply type the  # menu entries you want to add after this comment.  Be careful not to change  # the 'exec tail' line above.  menuentry "Android-x86" {  set root='(hd0,2)'   `search --no-floppy --fs-uuid --set=root 28D9FDF951298246    linux android-x86/kernel root=UUID=1cf9767a-6334-4490-8ac7-d51aec2b0ac8  quiet   androidboot.hardware=generic_x86 SRC=/android-x86 acpi_sleep=s3_bios,s3_mode   initrd Android-x86/android-4.4-r1/initrd.img}  

blkid :

istiak@istiak ~ $ blkid  /dev/sda1: UUID="10C4F74DC4F73416" TYPE="ntfs" PARTUUID="cdead0a2-01"  /dev/sda2: LABEL="Android-x86" UUID="1cf9767a-6334-4490-8ac7-d51aec2b0ac8" TYPE="ext4" PARTUUID="cdead0a2-02"  /dev/sda3: UUID="0A122C29122C1BE7" TYPE="ntfs" PARTUUID="cdead0a2-03"  /dev/loop0: TYPE="squashfs"  /dev/loop1: TYPE="squashfs"  /dev/loop2: TYPE="squashfs"  /dev/loop3: TYPE="squashfs"  /dev/loop4: TYPE="squashfs"  /dev/sda5: UUID="5144d217-9d4a-4e8c-b8d5-31959274dd51" TYPE="ext4" PARTUUID="cdead0a2-05"  /dev/sda6: UUID="b6f4d65c-46a0-4985-9ec3-dd0044257fcb" TYPE="swap" PARTUUID="cdead0a2-06"  

http to https redirection preventing redirections to other domains

Posted: 22 Apr 2021 09:01 AM PDT

I have following vhost redirecting 80 to 443:

<VirtualHost *:80>          ServerName site.mydomain.com          ServerAlias www.site.mydomain.com          DocumentRoot /srv/htdocs          Redirect permanent / https://site.mydomain.com            <Directory /srv/htdocs>                  Options Indexes FollowSymLinks MultiViews                  AllowOverride None                  Order allow,deny                  allow from all          </Directory>    </VirtualHost>  

The problem is that it does not prevent to redirect to other sites, e.g. by:

http://site.mydomain.com///.s3.amazonaws.com

http://site.mydomain.com/@google.com/

Which rewrite rule would fix such issue?

Double symlink of vim doesnt load library file ncurses.so.6 when invoked with sudo

Posted: 22 Apr 2021 09:25 AM PDT

I have a symlink of the vim.basic executable:

⤷ ls -l /etc/alternatives/vim  lrwxrwxrwx 1 root root 18 Apr 22 21:02 /etc/alternatives/vim -> /usr/bin/vim.basic  

Another symlink to the above symlink as:

⤷ ls -l /usr/bin/vim           lrwxrwxrwx 1 root root 21 Apr 22 21:02 /usr/bin/vim -> /etc/alternatives/vim  

They are system configured as I would expect from update-alternatives and I haven't changed anything except I boot sometimes from linux kernel 5.4 or generally from 4.15 using the same root and home partition and this probably what created a problem running vim with sudo?:

⤷ sudo vim.basic                #This works fine!  ⤷ sudo /etc/alternatives/vim    #This works fine!  ⤷ sudo vim        vim: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory  

libncurses.so is installed in a path pointed to by LD_LIBRARY_PATH:

⤷ echo $LD_LIBRARY_PATH  /home/akd/dotapps/local/lib:    ⤷ ls -l /home/akd/dotapps/local/lib/libncurses.so.6  lrwxrwxrwx 1 akd akd 17 Nov  9 21:24 /home/akd/dotapps/local/lib/libncurses.so.6 -> libncurses.so.6.2    

I can't seem to understand why the double symlink cannot find the libcurses.so.6 on sudo vim operation. Normal vim binary without sudo works as expected though (doesnt compain about ncurses lib).

⤷ vim --version  VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 16 2021 13:33:23)  ⤷ sudo --version  Sudo version 1.8.21p2  Sudoers policy plugin version 1.8.21p2  Sudoers file grammar version 46  Sudoers I/O plugin version 1.8.21p2  

Any idea, why this weird behavior?

Update:

Adding more info as req:

⤷ ldd $(which vim)              linux-vdso.so.1 (0x00007ffc9a2a6000)      libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9d5e059000)      libncurses.so.6 => /home/akd/dotapps/local/lib/libncurses.so.6 (0x00007f9d5ddee000)      libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d5dbea000)      libpython3.6m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0 (0x00007f9d5d53f000)      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9d5d320000)      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d5cf2f000)      /lib64/ld-linux-x86-64.so.2 (0x00007f9d5e909000)      libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f9d5ccfd000)      libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9d5cae0000)      libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f9d5c8dd000)    

Gimp: Cut And Paste Rectangle on New Layer

Posted: 22 Apr 2021 09:21 AM PDT

I have an image open. I then made a rectangle. I then cut out the rectangle. I then created a New Layer called loveLanguage. I am now trying to paste the contents of the cut-rectangle it onto this New Layer I created but gimp isn't doing what I'm expecting it to do. I am learning here. How Do I paste the contents of the rectangle so I can save the contents of the rectangle as it's own image.

enter image description here

How to echo the literal "-n"

Posted: 22 Apr 2021 09:46 AM PDT

Is it possible to echo the string "-n" using just the echo command?

I know I can do printf "%s\n" -n but was just wondering if the echo command is capable of outputting the string "-n" at all.

Python 2.7 built from source unable to import packages (Ubuntu 14.04)

Posted: 22 Apr 2021 08:23 AM PDT

I have an Ubuntu 14.04 VM running Python 2.7.6. 14.04 and Python 2.7 are requirements for what I'm working on, but I need to upgrade to a newer version of Python 2.7 because pip packages are failing to install due to lack of SNI support on 2.7.6.

I decided to download and build 2.7.18 from source. I then update the symlinks in /usr/bin/python to all point to the new 2.7.18 executable, which is at /usr/local/lib/python2.7.18/bin/python.

The problem is that this new Python version is not finding a lot of site packages. For example, I am unable to import apt_pkg. I've tried adding /usr/local/lib/python2.7/dist-packages, which contains apt_pkg.so, to the PYTHONPATH environment variable, and when I do python -m site I see it in sys.path, but it still fails to import apt_pkg. I've tried apt remove python-apt and apt install python-apt with no luck. The package was already there before building the new Python version.

I'm not sure what else to try. From what I've seen, replacing the system Python is generally a no-no, but that is what I would like to do. It seems like there is just some config I'm unaware of that needs to be updated for this new Python version.

tmux doesn't inherit PATH variable when inside docker?

Posted: 22 Apr 2021 08:20 AM PDT

I am trying to run tmux inside docker container. It runs but looses variables like PATH, for example inside container:

root@sparkmaster:/opt/bitnami/spark# ls /opt/bitnami/python/bin/python  /opt/bitnami/python/bin/python  root@sparkmaster:/opt/bitnami/spark# which python  /opt/bitnami/python/bin/python  root@sparkmaster:/opt/bitnami/spark# echo $PATH  /opt/bitnami/python/bin:/opt/bitnami/java/bin:/opt/bitnami/spark/bin:/opt/bitnami/spark/sbin:/opt/bitnami/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  

Then inside tmux inside container:

root@sparkmaster:/opt/bitnami/spark# ls /opt/bitnami/python/bin/python  /opt/bitnami/python/bin/python  root@sparkmaster:/opt/bitnami/spark# which python  root@sparkmaster:/opt/bitnami/spark# echo $PATH  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  

i.e. some paths are absent, like path to Python, but not all paths.

Why and how to fix?

Deleted unity-control-center without reinstalling and now keyboard and mouse are not responsive

Posted: 22 Apr 2021 08:12 AM PDT

I had a problem that I could not open the on Ubuntu 18.04 system settings and I read that I should uninstall unity-control-center and then reinstall it. However, at the time being I didn't have any internet so I just uninstalled it and told myself I'll install it when I get home. After booting the system and managing to log in my startup applications start perfectly normal, but my keyboard and mouse are completely unresponsive, besides REISUB.

If anyone has any idea on how I can fix it I'll be eternally grateful.

EDIT: I entered advanced settings and installed unity-control-center through the root there but still same issue so I wonder if there's another problem.

How to fix this PostFix error?

Posted: 22 Apr 2021 07:59 AM PDT

I have upgraded from Ubuntu 20.10 to 21.04 and after i am running: sudo apt update sudo apt-get upgrade i get this error below with PostFix how can i solve this error?

Hit:1 http://archive.ubuntu.com/ubuntu hirsute InRelease  Hit:2 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease  Hit:3 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease  Hit:4 http://archive.ubuntu.com/ubuntu hirsute-security InRelease  Reading package lists... Done  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  Calculating upgrade... Done  The following packages were automatically installed and are no longer required:    gcc-10-base:i386 gnome-shell-extension-desktop-icons libaom0:i386 libaribb24-0:i386 libasync-mergepoint-perl libavcodec-extra58:i386 libavutil56:i386    libboost-date-time1.71.0 libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-locale1.71.0 libboost-python1.71.0 libbrlapi0.7 libcodec2-0.9:i386    libdav1d4:i386 libfuture-perl libgdk-pixbuf-xlib-2.0-0:i386 libgdk-pixbuf2.0-0:i386 libgomp1:i386 libio-async-loop-epoll-perl libio-async-perl libisl22 libjs-sizzle    libjuh-java libjurt-java liblibreoffice-java liblinux-epoll-perl libmetrics-any-perl libmp3lame0:i386 libmysqlclient21 libmysqlclient21:i386 libnuma1:i386    libopencore-amrnb0:i386 libopencore-amrwb0:i386 liborcus-0.15-0 liborcus-parser-0.15-0 libperl5.30 libperl5.30:i386 libpgm-5.2-0 libpodofo0.9.6 libpoppler102    libpoppler102:i386 libpython3.8-dev libraw19 libre2-8 libreadline5 libridl-java libsereal-perl libshine3:i386 libsnappy1v5:i386 libsnmp35 libsnmp35:i386    libsoxr0:i386 libspeex1:i386 libstd-rust-1.47 libstruct-dumb-perl libswresample3:i386 libtest-fatal-perl libtest-metrics-any-perl libtest-refcount-perl    libtwolame0:i386 libunoloader-java libvdpau1:i386 libvo-amrwbenc0:i386 libvpx6:i386 libwavpack1:i386 libwebpmux3:i386 libx264-160:i386 libx265-192:i386    libxml-writer-perl libxvidcore4:i386 libzvbi0:i386 linux-headers-5.8.0-49 linux-headers-5.8.0-49-generic linux-image-5.8.0-49-generic linux-modules-5.8.0-49-generic    linux-modules-extra-5.8.0-49-generic mesa-vdpau-drivers:i386 mysql-common node-ansi-align node-arrify node-bl node-bluebird node-boxen node-builtin-modules    node-call-limit node-camelcase node-ci-info node-cli-boxes node-cliui node-co node-concat-stream node-config-chain node-configstore node-cross-spawn    node-crypto-random-string node-cyclist node-debbundle-es-to-primitive node-decamelize node-decompress-response node-deep-extend node-define-properties    node-detect-indent node-detect-newline node-dot-prop node-duplexer3 node-duplexify node-editor node-end-of-stream node-errno node-es-abstract node-es6-promise    node-execa node-find-up node-flush-write-stream node-from2 node-fs-vacuum node-genfun node-get-caller-file node-get-stream node-got node-has-symbol-support-x    node-has-to-string-tag-x node-import-lazy node-invert-kv node-is-buffer node-is-npm node-is-obj node-is-object node-is-path-inside node-is-plain-obj    node-is-retry-allowed node-is-stream node-isurl node-jquery node-json-buffer node-kind-of node-latest-version node-lazy-property node-lcid node-libnpx    node-locate-path node-lodash node-lodash-packages node-lowercase-keys node-make-dir node-mem node-merge-stream node-mimic-fn node-mimic-response node-minimist    node-mississippi node-npm-run-path node-object-inspect node-os-locale node-os-tmpdir node-p-cancelable node-p-finally node-p-is-promise node-p-limit node-p-locate    node-p-timeout node-package-json node-parallel-transform node-path-exists node-path-is-inside node-pify node-prepend-http node-proto-list node-prr node-pseudomap    node-pump node-pumpify node-qw node-rc node-registry-auth-token node-registry-url node-require-directory node-require-main-filename node-semver-diff node-sha    node-shebang-command node-shebang-regex node-slide node-sorted-object node-stream-each node-stream-iterate node-stream-shift node-strict-uri-encode node-strip-eof    node-strip-json-comments node-term-size node-through2 node-timed-out node-typedarray node-uid-number node-unique-string node-unpipe node-url-parse-lax    node-url-to-options node-which-module node-widest-line node-wrap-ansi node-xdg-basedir node-xtend node-y18n node-yargs node-yargs-parser ocl-icd-libopencl1:i386    perl-modules-5.30 python3.8 python3.8-dev python3.8-minimal python3.8-venv shim ure-java vdpau-driver-all:i386  Use 'sudo apt autoremove' to remove them.  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.  1 not fully installed or removed.  After this operation, 0 B of additional disk space will be used.  Do you want to continue? [Y/n] y  Setting up postfix (3.5.6-1) ...    Postfix (main.cf) configuration was not changed.  If you need to make changes,   edit /etc/postfix/main.cf (and others) as needed.  To view Postfix   configuration values, see postconf(1).    After modifying main.cf, be sure to run 'systemctl reload postfix'.    Running newaliases  newaliases: warning: valid_hostname: misplaced delimiter: kubernetes-worker..  newaliases: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: kubernetes-worker..  dpkg: error processing package postfix (--configure):   installed postfix package post-installation script subprocess returned error exit status 75  Processing triggers for libc-bin (2.33-0ubuntu5) ...  Errors were encountered while processing:   postfix  E: Sub-process /usr/bin/dpkg returned an error code (1)  

How to control screens on several Windows computers placed around a room?

Posted: 22 Apr 2021 07:47 AM PDT

I want to setup read-only screens around a room that displays different messages at different times. A single laptop would run a BASH script that checks the times, and decides which messages to send to which display, and when. This could either be text only (maybe a console, but with a huge font) or pictures, whichever is possible will be fine. A very basic script might look something like this:

#!/bin/bash  echo "Good morning!" > /dev/screen1  echo "Please stack the blocks as high as you can!" > /dev/screen2  

My workplace has many unused Lenovo Yogas, so I could fold back the keyboard and mount seven or eight of the them around the room with just the screens showing. I don't think the workplace would allow me to remove Windows 10 from these devices.

  • Text or pictures, either is fine.
  • The Yogas do have HDMI ports.
  • People in the room won't interact with the screens, they display information only.

The question is, how do I get text (or optionally pictures) from a BASH script on a laptop running Linux to display on these different messages or pictures on the Windows screens scattered around the room?

Slow /dev/zero format using dd with nvme to prepare crypto, is there nvme specific tool?

Posted: 22 Apr 2021 08:45 AM PDT

I try to prepare an nvme for encryption, so i first follow this post on SO.

But the speed of dd is really really slow (less than 100 mb/s). I see there is new option to speed up dm-crypt on kernel 5.9 (see this post), but before updating my kernel, i want to know if using nvme-cli format zero tools is equivalent to /dev/zero to prepare a disk : https://manpages.debian.org/testing/nvme-cli/nvme-write-zeroes.1.en.html

The actual (and very very slow) command to prepare disk before luks2 format :

   cryptsetup plainOpen --key-file /dev/urandom /dev/nvme0n1p2 ecrypt     dd if=/dev/zero of=/dev/mapper/ecrypt bs=1M status=progress     cryptsetup plainClose  

Update :

Going to kernel 5.12 with dmcrypt 2.3.4, i use this new perf options :

cryptsetup plainOpen --perf-no_read_workqueue --perf-no_write_workqueue --key-file /dev/urandom /dev/nvme0n1p2 ecrypt   

dmsetup table say option are correctly activated :

ecrypt: 0 1999358607 crypt aes-cbc-essiv:sha256 0000000000000000000000000000000000000000000000000000000000000000 0 259:2 0 2 no_read_workqueue no_write_workqueue  

I also verifyed that AES is activated with cpuid :

 cpuid | grep -i aes | sort | uniq        AES instruction                         = true        VAES instructions                        = false  

I have the same problem, dd write zero at 900mb/s and slowly decrease to 45 mb/s ...

Run executable on background detached from terminal but with arguments

Posted: 22 Apr 2021 10:15 AM PDT

I can run an executable in the background and detach it from the terminal with these commands:

$ nohup ./executable &  

or

$ ./executable &     $ disown  

But none work if I send arguments to the executable:

$ nohup ./executable argument &  

or

$ ./executable argument &  $ disown  

I have tried combining it with the .sh strings and pipes syntax but it does not work either:

$ nohup ./executable <<<$'argument' &  

or

$ ./executable <<<$'argument' &  $ disown  

or

$ nohup echo -e "argument" | ./executable &  

or

$ echo -e "argument" | ./executable &  $ disown  

EDIT: The "./executable" program accepts any number of parameters, like "./executable arg1 arg2" etc... I think the problem is that "&" gets absorbed by "./executable" as a parameter. Also, it is written in Go if that is of any help.

Q: Inspircd RDNS not working [closed]

Posted: 22 Apr 2021 07:51 AM PDT

I dont know how or why, when adding the ident module to inspircd irc server the rdns broke magicaly, if anyone has any idea tell me

Yes it worked before but when i added the ident module, it stopped working

How to get the correct device to limit block IO for docker container?

Posted: 22 Apr 2021 08:40 AM PDT

(I posted this question at stackoverflow, but maybe here is the more appropriate place, if necessary - I'll delete the other question.)

I need to put a limit on block IO operations speed for a number of docker containers.

To achieve this, I need to do something like: docker run -it --device-read-bps /dev/sda:1mb ubuntu,according to the docs.

My question is how do I get the correct device per container to set the limit for? Is there any what to get this info with docker inspect?

docker inspect my_container | grep DeviceName returns nothing?

The output of df -h is:

Filesystem            Size  Used Avail Use% Mounted on  devtmpfs              7.9G     0  7.9G   0% /dev  tmpfs                 7.9G     0  7.9G   0% /dev/shm  tmpfs                 7.9G  1.4M  7.9G   1% /run  tmpfs                 7.9G     0  7.9G   0% /sys/fs/cgroup  /dev/mapper/vg0-data   31G  6.9G   23G  24% /  tmpfs                 7.9G     0  7.9G   0% /tmp  /dev/sda3             283M   27M  238M  11% /boot  /dev/sda2              10M  2.2M  7.9M  22% /boot/efi  /dev/sdb1              63G  198M   60G   1% /mnt/data  overlay                31G  6.9G   23G  24% /var/lib/docker/overlay2/0c917cf591efb40f75a450b6ad93bf9cf06c91f7f625e1f073887031d152f444/merged  shm                    64M     0   64M   0% /var/lib/docker/containers/b21b4b5d27bd57f04204d3a54f11930a532bdc8c56cabfe903f34b955f3c81f1/mounts/shm  overlay                31G  6.9G   23G  24% /var/lib/docker/overlay2/8b198c4829d4eb13c21e7c9d1be99aa00986d64f13f50a454abc539aed37e759/merged  shm                    64M     0   64M   0% /var/lib/docker/containers/1667192b0b8026eb517894fdf72f71c6aca5a0ff78648447c12175c96b76990c/mounts/shm  overlay                31G  6.9G   23G  24% /var/lib/docker/overlay2/72efa8bcdec2c529ca3ebde224f8d14e22780636c614fe45a0228eb957a99351/merged  shm                    64M     0   64M   0% /var/lib/docker/containers/a7123dfebcc42a675b6ccb0435df1cc24bcd0a39847fb4cb5a3fdcaf2d38089f/mounts/shm  overlay                31G  6.9G   23G  24% /var/lib/docker/overlay2/65ede56c537f5de766f616f13df90aae46f287b9e28703496f90af9f74f4c463/merged  shm                    64M     0   64M   0% /var/lib/docker/containers/6a24ef7116078d48fde87fc47a8efd194ef541ffb7d85ae4bec34e5086e46d4b/mounts/shm  overlay                31G  6.9G   23G  24% /var/lib/docker/overlay2/2b444d99740719500285bd94eb389815e631cd183cf3637e64fa40999ccf2530/merged  shm                    64M     0   64M   0% /var/lib/docker/containers/8c7300dcd9981878ce46f4b805d65b72bf3afbf87d9510312ba5110b95ae8cf4/mounts/shm  overlay                31G  6.9G   23G  24% /var/lib/docker/overlay2/9ea1ad005bcbcdb0e52d6f2b05568268e3a6e318f8d30986e0fac56523408e89/merged  shm                    64M     0   64M   0% /var/lib/docker/containers/5eb12be6805976d230f5ec17bda65100745bebeccea4ab7c2bcf2260405ecb96/mounts/shm  

I came across many threads asking this question, like this, but no determined answer was given

How do I check if my CPU supports x86-64-v2?

Posted: 22 Apr 2021 10:22 AM PDT

AMD, Intel, Red Hat, and SUSE have defined a set of "architecture levels" for x86-64 CPUs. For example x86-64-v2 means that a CPU support not only the basic x86-64 instructions set, but also other instructions like SSE4.2, SSSE3 or POPCNT.

How can I check which architecture levels are supported by my CPU?

Why my scheduled crontab update is not working?

Posted: 22 Apr 2021 09:07 AM PDT

As root, I've created a file called update.bash and saved it inside the /root folder... The content of the file is the following:

#!/bin/bash  apt update  apt -y upgrade  

I gave this file execution permission with chmod +x /root/update.bash... Then using the command crontab -e (as root), I've added the following line on root's crontab:

0 1 * * *  /root/update.bash     

This syntax schedules this script to run every day at 1 am, which is fine since it's a server that's always on. The problem here is that my update doesn't seem to be working even though I know this script runs every day as root, I know it doesn't work because there's usually a lot of accumulated updates on the system after some time I don't do it manually. In my view, scheduling crontab as root to run apt update and apt -y upgrade should work fine for automating updates... But it doesn't work, what am I missing? Is there any additional step I need to do to update the system with crontab?

Podman can not kill containers: not running, but state improper

Posted: 22 Apr 2021 09:50 AM PDT

When I run podman container kill -a, I get

can only kill running containers. 11d887d57069b3ee630fd6f1b13d600485c34f5020ff09fec65f4e31dd7242a5 is in state configured: container state improper  can only kill running containers. 2132c0543eedbe3c4ee8680da508fea6251d38107d5e707f260eb5aa8549409d is in state configured: container state improper  can only kill running containers. 2db317cc73ec92e434fda88653f872e4c4cf07e9f32c0c29ecc5e69515beb96d is in state exited: container state improper  can only kill running containers. 465d133dec7a568bd8a6231036e1c489b6a6f88c65154629d75ce4161fb6e3c4 is in state exited: container state improper  

Subsequent runs still show the containers. How can I get rid of them?

Creating VM's using kvm. Error: Unit libvirtd.service could not be found?

Posted: 22 Apr 2021 10:08 AM PDT

TLDR;
On Ubuntu 20.04.1, I am trying to run VM's using KVM. After installing the required packages, I still get below error:

sudo systemctl status libvirtd  Unit libvirtd.service could not be found.    

The below is what I have done -
a) check kvm support

$ sudo kvm-ok  INFO: /dev/kvm exists  KVM acceleration can be used  

b) install required packages

$ sudo apt install -y qemu qemu-kvm libvirt-daemon libvirt-clients bridge-utils virt-manager  

Now, the above should be everything and I must be able to open the virt-manager gui and get going and the libvertd service should have been started already. But, there is no libvirtd service running on my machine still and there is no libvirtd.service unit installed.

And obviously, The virt-manager is not able to connect to the demon so the below errors - After doing $ sudo virt-manager --> the virt-manager GUI starts with root permissions.
enter image description here
Clearly the window says -

The libvirtd service does not appear to be installed. Install and run the libvirtd service to manage virtualization on this host.

And obviously, no VM creation is feasible and below is the error on attempting for same.
enter image description here

Reference - How to Install KVM on Ubuntu 20.04
Note: This issue is not duplicate with - KVM Virt-Manager Error: No active connection to Install on
(one answer here ask to install - libvirt-bin , but this packages does not exist in the repo.

$ apt list  libvirt-bin      Listing... Done  

Hardware: This attempt is on Quad-Core, Intel CPU Laptop.

Edit - Following the comment from ajgringo619, i could solve the libvirtd.service issue. But other issues still persist.
Below is also posted as seperate Q @ Warning: KVM kernal modules are not loaded. Your VM may perform poorly?
enter image description here
This is the lsmod output -

$ sudo lsmod | grep kvm  kvm_intel             282624  0  kvm                   663552  1 kvm_intel  

Should I ignore the warning, is the performance really gonna be poor??

Copy file from one remote server to another remote server

Posted: 22 Apr 2021 10:12 AM PDT

I am at server A. I want to copy a file from remote server B to remote server C.

This can be done with below commands,

scp username@B:/path_of_file_on_server_B/file.txt /path_of_file_on_server_A  scp /path_of_file_on_server_A/file.txt username@C:/path_of_file_on_server_C  

However I want to understand if there is any other way to directly copy file from remote server B to remote server C.

Splitting long commands in shell scripts

Posted: 22 Apr 2021 07:57 AM PDT

I have been writing Unix shell scripts, but I'm inexperienced in proper formatting. There were many instances where I had to write long lines to be executed as a single command.

Question is: Is there a way that I can split a single long line of a shell command into multiple lines, yet make it execute as a single command?

Booting kernel (FIT image) with no rootfs

Posted: 22 Apr 2021 08:39 AM PDT

An embedded Linux device I am working with has the following kernel parameter:

root=/dev/ram0

Additionally, the kernel image is bundled together with an initrd and device tree to make a flattened image tree, or FIT image.

When fully booted the device does not have persistent storage. That is, anything written to the file system is completely volatile. Considering the root= parameter passed to the kernel, this is not surprising.

My questions is: How does this work?

  • I do know that Uboot copies the kernel into ram and executes it with a bootm command, but where do the filesystem files come from? Are they contained within the initrd? My understanding of an initrd is that it is a temporary construct. If so, it would be an offset into FIT image blob. So, how is just passing root=/dev/ram0 sufficient for the kernel to know where its file system is?

  • Does the kernel perform introspection and read the FIT image's header to determine placement of constituent components?

  • How are file system changes supported inside a FIT image considering it will be packed together with both the kernel and device tree blob?

Convert a Windows-created ZIP to Linux (internal paths issue)

Posted: 22 Apr 2021 07:46 AM PDT

I have a .zip created on a Windows machine (outside of my control). The zip file contains paths that I need to preserve when I unzip.

However, when I unzip, all files end up like:
unzip_dir/\window\path\separator\myfile.ext

I've tried both, with and without -j option. My issue is that I need that path information under \window\path\separator\. I need that file structure to be created when I unzip.

I can mv the file and flip the \ to / easily enough in a script, but then there are errors that the destination path directories do not exist. My workaround for now is to mkdir -p the paths (after converting \ to /) and then cp the files to those paths.

But there are a lot of files, and these redundant mkdir -p statements for every file really slows things down.

Is there any more elegant way to convert a zip file with Windows paths to Linux paths?

Are there GPG-signed OpenBSD ISOs with which I can verify an installation disc?

Posted: 22 Apr 2021 07:53 AM PDT

Are there GPG-signed OpenBSD ISOs that I can download and later verify the downloaded file? Or at least a GPG-signed shasum?

No comments:

Post a Comment