Monday, June 20, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Checking integrity of a created backup archive

Posted: 20 Jun 2022 11:47 AM PDT

I'm wondering how to verify the checksum of a tarball backup with the original directory after creation.

Is it possible to do so without extracting it for example if it's a large 20GB backup?

Example, a directory with two files:

mkdir test &&  echo "one" > test/one.txt &&  echo "two" > test/two.txt  

Get checksum of directory:

find test/ -type f -print0 | sort -z | xargs -0 shasum | shasum  

Resulting checksum of directory content:

d191c793cacc4bec1f070eb96fa68524cca566f8  -  

Create tarball:

tar -czf test.tar.gz test/  

The checksum of the directory content stays constant.

But when creating the archive and getting the checksum of the archive I noticed that the results vary. Why is that?

How would I go about getting the checksum of the tarball content to compare to the directory content checksum?

Or what's a better solution to check that the archive contains all the necessary content from the original directory (without extracting it if it's large)?

how to install csvkit in bash

Posted: 20 Jun 2022 11:57 AM PDT

Kusalananda nicely recommends using csvformat from csvkit to format jq @csv into a csv format without double quotes " answering how to parse json with jq.

This answer does not seem to involve the use of python. But the csvkit installation tutorial and its installation troubleshooting do seem to rely on, perhaps require, the use of python. This makes me, a newbie, confused:

Is it possible to install csvkit in git bash without using python (read: open spyder or anaconda, let's say)? How?

Need help identifying and closing back BIOS level backdoor - OS Agnostic

Posted: 20 Jun 2022 11:17 AM PDT

I'm stopping by trying to further narrow down my understanding and ultimately the eradication of one if not multiple Cobalt Strike beacons on multiple machines.

Before you ask the normal "How do you know..." questions - This has been going on since late Jan of this year. Picking up intensity and visibility early April. Leaving out the gory details it's been an hell of an experience, to put it lightly. Three months ago I had never even seen a Linux distro boot, had no idea what an ARP broadcast was, and sure as hell had no idea how to use CL.

Today I primarily run Linux, am having to do a clean install of an OS on average about once a day. And have been in a battle of attrition with whoever is propagating this.

This past weekend I even made it down into their shell. Which, with CSM enabled and using Grub2Hybrid show up as MS-DOS either floppy disks or CDROMs. There are at least six of them. This is just on one machine. Every single piece of circuitry that is network-enabled has been touched by whatever this is.

To give context the software/malware stack I'm up against seems to be an offshoot or a variant of Gonna Cry ransomware. As there are multiple files, both in binary and in C, that are labeled 'gcry.'. And the program seems to reinforce that understanding as it is seemingly programmed to immediately, pre boot, take root privileges, and start maneuvering to box me out of system files, and makes efforts to obfuscate its actions. It is 100% more prolific in Windows, particularly 10, and runs in 32 bit. On Linux the user shows up in the logs, and essentially masquerades as me, uuid 1000, but boxes me out of all the pertinent files including /var /etc /root /bin and makes them read-protected, write-protected, sometimes hidden, and sometimes archived.

The thing automatically propagates on any removeable media device, usually by adding a hidden .trash-1000 file which if not programmed to drop a payload will be focused on information gathering including logs, debug, and dev dumps. It seems to be interested in installs as well.

All of that is autonomous.

When there is an operator on the other end things get much, much more difficult. As it's already an unfair fight (I just learned how to use chown, usermod, and passwd the past week), but when there's an operator, or at least the one I'm dealing with. It's like fighting with my hands behind my back. It has not been fun.

My question is; how and what process is this actor using to get seemingly super root over not just my Linux OS's but also the BIOS or UEFI (using UEFI shell, which is where I'm having the most even playing field). In Windows, it's not even worth installing as he can have me either blue screen'd, bitlocked, or otherwise locked out of my own system in the course of an hour.

Additionally I'd like to know what I can do to premptively harden a Linux install by using single user mode, changing permissions to directories such as /etc and /var and if that doesn't work what I can do to exorcise this asshole and his bot once that has failed. Using usermod -L and passwd all work for a short period of time, but since the intruder is essentially just me, it doesn't hold back much.

I've gotten pretty efficient at at least prolonging my fight against them using lynis, tiger, chkboot, lockdown, and a few other tools. But it'll just lock those files and their directories in one of their files, rendering them useless.

The whole entire goal of this thing seems to be owning the system, and subsequently me. It's like playing one of the weirdest games of capture the flag I've ever played. Going on three months now...

Oh, by the way. It's important to mention that either the script, or the operator are acutely network aware. And whenever I send out traffic that is ambiguous to the infection it can either meter, poison, or just plain kill my connection.

It also alters the header file and seemingly collects EFI files and grub.cfg files as scalps. I deleted over 250 from one of their shells this past weekend. Every one having a .mod at the end.

Any insight or tips are appreciated.

And please, keep the internet meta of questioning me five ways from Sunday at a minimum. I'm honestly tired of having to explain, justify and ultimately defend myself. If you're curious please keep it respectful and I can produce literally any collateral you may want to reinforce my line of questions. Hell, if you want I even have the videos from their shell and almost a play by play as it was happening. I've even gone so far as to offer remote access to multiple people who found it their role to try and discredit me. None have accepted. If you'd like to be the first please let me know.

And lastly. You have to look at this from an incredibly granular view. This is not your Daddy's adware. This is or at least was enterprise style phased malware attacks over the course of now over six months.

Other most recent observations:

  1. It mounts some sort of volume right at boot
  2. It calls a litany of different commands or processes after it mounts, sometimes using SNAP, and other times just invoking a "gnome binary"
  3. The shell they've been using recently is Busy Box "Multi Shell Binary"
  4. It installs its own proprietary NVIDIA drivers, whittling me down to one monitor from 5
  5. It collects literally everything. Even having imaged and stealing my Lenovo bios the past week.
  6. They seem to be operating off of a version of Arch Linux
  7. The most recent patches and kernel releases from distros like Ubuntu and Zorin make it more difficult, but not impossible for them to infiltrate the system.
  8. It is completely invisible to any operating system until I start breaking things either by memory, or entropy. That means even in DOS
  9. I was able to space suit down into their MS-DOS operating lair by using Grub2hybrid to smoke them out, and then using Kali Linux Rescue, feinting an install, but then backing out to the shell and using ls to pull up the query. All in 32 bit or dos. It seems that if my system touches anything of theirs, it seems to think that those files are now shared, or mine. Which is how it should be. But I'm still at a loss as to how they conceal them from me in the first place.

The systems I'm using are, in which are all affected:

  • MSI Unify, 12900ks, 64gb, (I have like 8 different NVMe drives, five different SSD's, and four HDDs that are interchangeable with all of these machines)
  • MSI Edge DDR4 12900k 64gb
  • Asus B560m-a 10900
  • MSI Z690 Pro, no processor
  • Lenovo P350 Tiny i5 10600k
  • Lenovo Thinkbook 15L G2 i5 11th gen
  • Lenovo Ideapad 3 i3 10th gen
  • Dell Latitude 3550 i5 10th gen
  • Lenovo 100e Chromebook Tablet
  • Asus Vivobook i3 11th gen
  • iPhone 12 Pro (although, not nearly as bad as it was before this last patch 05/18)
  • Android S10

Not to mention

  • Netgear R6900
  • TPLink Omada VPN Router
  • Netgear CM1200

Operating systems have primarily been:

  1. Ubuntu
  2. Zorin
  3. Kali
  4. Antix - Can't seem to get past secure boot
  5. Mx - Hard to get past secure boot

Thanks in advance.

Forgot to mention: About a month ago I was able to hail mary a couple stacks of this dickheads toolkit at virustotal, hybrid-analysis, kaspersky, etc. The only one as of yet to pick up any thing en masse has been kaspersky. With those showing up as:

  • Trojan.Win32..jobutyve.aie
  • Trojan.Win32.jobutyve.ibyj
  • Trojan.Win32.fsysna.ibrm
  • Trojan.Win32.fsysna.icuc
  • Trojan.Win32.Cobalt.hzr
  • Trojan.Win.64.agent.byo
  • Trojan.Win.64.Agent.byn
  • Trojan.Win.64.Agent.byp
  • Trojan.Win.64.Cobalt.Lk
  • Trojan.Win.64.Cobalt.hab
  • Trojan.Win.64.Cobalt.Gis
  • Trojan.Win.64.Cobalt.Hab
  • Trojan.Win.64.Cobalt.gwx
  • Trojan.Win.64.Cobalt.Ggy
  • Trojan.Win.64.Agent.Qwhzba
  • Trojan.Win.64.Agentb.Byo
  • Trojan.Win.64.Agentb.Byn
  • Trojan.Win.64.Agentb.byp

copy/paste in terminator stop working after a while

Posted: 20 Jun 2022 10:26 AM PDT

I am running Ubuntu 16 and has Terminator installed, for some strange reason copy/paste either through keyboard shortcut or right-click mouse menu would stop working on certain terminator windows, it would still work on other terminator windows when this happens, the only way that I can fix this is to restart the bad terminator window. Anyone else experience this and is there a quick fix for it? Thanks.

How to share a folder between two users on the same linux laptop

Posted: 20 Jun 2022 11:00 AM PDT

  1. Ubuntu 20.4 installed with user Marco
  2. created other user Polo by going to |settings > Users > Add User|
  3. created "commonDir" folder in Marco's home directory. |right click > new folder|
  4. logged out from Marco. |click top right corner > power Off/Log Out > Log Out|
  5. logged into Polo
  6. navigated to Polo's home directory but "commonDir" folder was not visible.

What should I do in order to make it accessible by both the users.?

(Still working my way through linux commands. That's why I'm using UI to do all the things)

When would unsolicited message triggered from wpa_suplicant

Posted: 20 Jun 2022 09:05 AM PDT

I've been doing some study about wpa_supplicant, while i was going through the manual page i found a term 'unsolicited events', from what i understood, the events that are triggered by wpa-supplicant other than events that are triggered as response for user commands are called 'unsolicited events'. I need to know on what scenarios these events occurs,please give me some 2 realtime examples for atleast 2 events and do we have to respond to these events? I really cant find anything about the real time situations for these events in google. Please share me your thoughts

Are connection between Local Microsoft SQL serer and azure microsoft sql server compatible or not?

Posted: 20 Jun 2022 09:01 AM PDT

If they are not compatible please provide some explanation for somebody who is trying to learn about protocols :)

prime-run: Segmentation fault

Posted: 20 Jun 2022 09:57 AM PDT

When I run any graphical program with prime-run I get the following error:

[jomosoto@Jomosoto ~]$ prime-run glxinfo  name of display: :0  /usr/bin/prime-run: line 2:  7630 Segmentation fault      __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"  

The problem should be the __GLX_VENDOR_LIBRARY_NAME=nvidia:

[jomosoto@Jomosoto ~]$ __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo  name of display: :0  Segmentation fault  

System Info:

OS: Artix Linux x86_64
Host: 82JQ Legion 5 Pro 16ACH6H
Kernel: 5.18.2-artix1-1


lspci -k | grep -A 3 VGA:

01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q] (rev a1)          Subsystem: Lenovo Device 3a4f          Kernel driver in use: nvidia          Kernel modules: nouveau, nvidia_drm, nvidia  --  05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne (rev c5)          Subsystem: Lenovo Device 3a4f          Kernel driver in use: amdgpu          Kernel modules: amdgpu  

My /etc/X11/xorg.conf.d/ and /etc/modprobe.d/ are empty and there's no /etc/X11/xorg.conf


Any ideas?

Side note: I think I caused this problem when trying to configure my optimus (I tried optimus-manager, bumblebee, prime-select and more - all uninstalled now). It may be (not sure) some auto-generated config.

Side question: Does steam automatically use offloading? Steam games stopped launching shortly before I discoreverd my problem with prime-run.

"Ambigous Redirect" for redirecting text to a variable

Posted: 20 Jun 2022 10:20 AM PDT

NOTE: RESOLVED

I'm making a shell script to limit the amount of time someone spends on a program but it gives me these errors:

./time_limit: line 26: $Log: ambiguous redirect  ./time_limit: line 16: [: root: unary operator expected  

Here is the code:

#!/bin/bash  config (){  ImageViewer=/ 2> /dev/null   AllowedTime=30 #in minutes  AllowedPlays=1  cmd=sol #for demonstration, I use sol installed by default in Ubuntu. Set to your liking  AllowedUser=root #Set to your liking.  ImageViewer=eog #I set this to the Eye of GNOME image viewer. If no GUI or if you don't want an explosion (really?) comment out.  #If you have another desktop change to yor image viewer.  Log=/dev/null #if you want to log this, set to file of your liking  #but make sure you have write permission.  config  date=$(date)    }  if [ $USER = $AllowedUser ]  then       echo "ACSESS ALLOWED for $AllowedTime minutes."          at now + $AllowedTime minutes <<< "killall $cmd; $ImageViewer ../files/Explode.gif"      echo "Session 1: $date" >> $Log      $cmd      exit  fi  echo "ACSESS DENIED!"  echo "This UNAUTHORIZED USE has ben recorded."  echo "Violation by $USER $date" >> $Log    

I ran it though ShellCheck and it seems fine. Can anyone see the problem?

locate specific drive after failure in zfs pool

Posted: 20 Jun 2022 08:21 AM PDT

I have a pool that had a drive fail and zfs is being stupid about it. I added a disk which ended up going to /dev/sdl I used the disk by id to add it in and due to that after the other drive failed during or just before a reboot i get the following line.


5642991870772164099 UNAVAIL 0 0 0 was /dev/sdl1
any idea how to get the info to find what the serial number of 5642991870772164099 is?

How do I use netplan to link my lan port with my wan port?

Posted: 20 Jun 2022 08:52 AM PDT

This is part of a project to setup my linux machine with 2 nics as a router. The "routes" key in the below mentioned yaml configuration file is what I think I need to set in the yaml file. What value should I enter against the "to" key?

The following are the steps I took to configure network interfaces via netplan. I did not have the entries for the routes key as they had no effect.

This is what the values used in my configuration file and commands represent:

wan0 — connected to the internet. Has dynamic IP address.

lan0 - dhcp and dns server for my local network. Has static ip 192.168.1.1

/etc/netplan/00-installer-config.yaml - netplan configuration file.

Entered values in the yaml file:

vi /etc/netplan/00-installer-config.yaml

  ethernets:      wan0:        dhcp4: true      lan0:        dhcp4: no        ignore-carrier: true        addresses: [192.168.1.1/24]        routes:          - to: <what value should I enter here?>          via: 192.168.1.1     version: 2  

These are the actual entries in my yaml configuration file (without the routes: key)

  ethernets:      wan0:        dhcp4: true      lan0:        dhcp4: no        ignore-carrier: true        addresses: [192.168.1.1/24]    version: 2  

Executed the following commands:

sudo netplan generate

sudo netplan apply

Additional information: Finally I gave up on netplan and took these steps to get the router working: I did do the steps I mentioned above to configure my network interfaces via netplan. Then, I did these steps:

  1. Enabled ip forwarding:

sudo vi /etc/sysctl.conf

uncomment net.ipv4.ip_forward=1

Saved the file and executed the following commands

sudo sysctl -p

sysctl net.ipv4.ip_forward - to Check whether the value took effect

  1. Configure firewall rules: executed these commands

sudo iptables -t nat -A POSTROUTING -o wan0 -j MASQUERADE

sudo iptables -A FORWARD -i wan0 -o lan0 -m state --state RELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i lan0 -o wan0 -j ACCEPT

  1. Install iptables-persistent (Needed so that above rules are persistent between boots)

sudo apt install iptables-persistent

sudo bash -c "iptables-save > /etc/iptables/rules.v4"

Kali OS Not found, not booting

Posted: 20 Jun 2022 08:06 AM PDT

I have Kali Linux installed on my laptop's SSD, I have another SSD on which I wanted to install Windows as a backup. The process was successful, but the next day I went to boot up my laptop (with Kali) and it said there was no OS installed, but I know that Kali is installed. I checked by using a Kali Live USB. Do I need to install grub somewhere different? This is NOT a dual-boot, BTW.

Installing font packages

Posted: 20 Jun 2022 07:52 AM PDT

I'm trying to install several font packages (frontproto, inputproto, kbproto, renderproto, xproto, xetproto) in an Ubuntu 20.04 system using either apt or compiling them from source. However, I don't know any source and apt-cache search is coming back empty.

How to send output to next input line?

Posted: 20 Jun 2022 09:44 AM PDT

This my snippet alias hst="history 1 -1 | cut -c 8- | uniq | fzf ". when I run hst The output is

$ ~ hst  (the output from hst)  $  

This is what I want

$ ~ hst  $ (the output from hst)  

Example

$ ~ hst  vi .zshrc  $  

should be

$ ~ hst  $ vi .zshrc  

How to fix this? (or enhance the script)

Replace values in fifth column

Posted: 20 Jun 2022 09:41 AM PDT

I have multiple text

Name 1:10:34 date short_id 10   Name 1:10:45 date short_id 10  Name 1:20:54 date short_id 20  Name 1:30:43 date short_id 30  Name 1:40:43 date short_id 40  Name 1:40:13 date short_id 40  Name 1:20:01 date short_id 20  Name 1:10:01 date short_id 10  

I want to replace the fifth column , but when I use sed 's/\b10\b/user1/g' the second column also changes

The output should look like this :

Name 1:10:34 date short_id user1  Name 1:10:45 date short_id user1  Name 1:20:54 date short_id user2  Name 1:30:43 date short_id user3  Name 1:40:43 date short_id user4  Name 1:40:13 date short_id user4  Name 1:20:01 date short_id user2  Name 1:10:01 date short_id user1  

--- update ---

if there is no user1, there will be a name and the second column is just time, it has nothing to do with the name

something like this

Name 1:10:34 date short_id John  Name 1:10:45 date short_id John  Name 1:20:54 date short_id Robert  Name 1:30:43 date short_id Jennifer  Name 1:40:43 date short_id Mary  Name 1:40:13 date short_id Mary  Name 1:20:01 date short_id Robert  Name 1:10:01 date short_id John  

Boot from USB and run sshd on server without keyboard or display

Posted: 20 Jun 2022 07:49 AM PDT

I have an old HP server, would like to

  1. Plugin USB and ethernet cable
  2. USB boots a linux distro and starts running sshd with default user/password

I can then ssh into the box from my laptop. I was wondering if the above setup/startup is possible ?

dpkg: Remove msodbcsql17

Posted: 20 Jun 2022 11:59 AM PDT

I'm getting this error when I'm trying to uninstall msodbcsql17:

$ sudo dpkg --remove msodbcsql17  (Reading database ... 198868 files and directories currently installed.)  Removing msodbcsql17 (17.9.1.1-1) ...  dpkg: error processing package msodbcsql17 (--remove):   installed msodbcsql17 package post-removal script subprocess returned error exit status 127  Errors were encountered while processing:   msodbcsql17  

I've also tried with apt remove:

sudo apt remove msodbcsql17  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  You might want to run 'apt --fix-broken install' to correct these.  The following packages have unmet dependencies:   mysql-shell : Depends: libffi7 (>= 3.3~20180313) but it is not going to be installed                 Depends: libpython3.8 (>= 3.8.2) but it is not installable                 Depends: libssl1.1 (>= 1.1.1) but it is not installable  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).  

Also:

$ sudo apt --fix-broken install  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  Correcting dependencies... Done  The following packages will be REMOVED:    msodbcsql17 mysql-shell  0 upgraded, 0 newly installed, 2 to remove and 16 not upgraded.  2 not fully installed or removed.  After this operation, 127 MB disk space will be freed.  Do you want to continue? [Y/n]   (Reading database ... 198874 files and directories currently installed.)  Removing msodbcsql17 (17.9.1.1-1) ...  dpkg: error processing package msodbcsql17 (--remove):   installed msodbcsql17 package post-removal script subprocess returned error exit status 127  dpkg: too many errors, stopping  Errors were encountered while processing:   msodbcsql17  Processing was halted because there were too many errors.  E: Sub-process /usr/bin/dpkg returned an error code (1)  

Any ideas about how to remove it?

How to decorate comments in bash?

Posted: 20 Jun 2022 10:16 AM PDT

From time to time I see similar framing for comments in bash scripts:

#!/bin/bash  #===================================================================================  #  # FILE: stale-links.sh  #  # USAGE: stale-links.sh [-d] [-l] [-oD logfile] [-h] [starting directories]  #  # DESCRIPTION: List and/or delete all stale links in directory trees.  # The default starting directory is the current directory.  # Don't descend directories on other filesystems.  #===================================================================================  

Is there any program to generate such a decoration for comments or do people usually create it manually?

Fedora 36 Virtualbox 6.1 Kernel driver not installed

Posted: 20 Jun 2022 08:56 AM PDT

VM in VirtualBox wouldn't launch displaying this issue:

enter image description here

I don't know how to resolve it.

Fedora 36 KDE Virtualbox 6.1

What is the different use for setopt and zstyle?

Posted: 20 Jun 2022 10:14 AM PDT

I don't understand why they are both needed since they seem that zstyle does the same as setopt and even more?

Dual GPU xorg.conf ignores XScreen on one GPU and uses xrandr

Posted: 20 Jun 2022 11:52 AM PDT

Dual GPU X11 using xorg to separate workloads and screens. 2 GPU 3 screens/monitors. Basically

GPU 0 => XScreen 0.0 => Monitor 0 (left)

GPU 1 => XScreen 0.1 => Monitor 1 (center)

GPU 0 => XScreen 0.2 => Monitor 2 (right)

When I set this up the system only acknowledges 2 XScreens (one per GPU) which then lumps the flanking screens together which breaks placements.

Any input on why this is happening would be appreaciated.

Section "ServerLayout"      Identifier     "PootSlap"      Screen      0  "Screen0" 0 0      Screen      1  "Screen1" RightOf "Screen0"      Screen      2  "Screen2" RightOf "Screen1"      InputDevice    "Mouse0" "CorePointer"      InputDevice    "Keyboard0" "CoreKeyboard"      Option "Xinerama" "0"  EndSection    Section "Module"      Load  "glx"  EndSection    Section "InputDevice"      Identifier  "Keyboard0"      Driver      "kbd"  EndSection    Section "InputDevice"      Identifier  "Mouse0"      Driver      "mouse"      Option      "Protocol" "auto"      Option      "Device" "/dev/input/mice"      Option      "ZAxisMapping" "4 5 6 7"  EndSection    Section "Monitor"      Identifier     "Monitor0"      VendorName     "ACR"      ModelName      "Acer G246HYL"      HorizSync       31.0 - 75.0      VertRefresh     56.0 - 75.0      Option         "DPMS"  EndSection    Section "Monitor"      Identifier     "Monitor1"      VendorName     "ACR"      ModelName      "Acer SA270"      HorizSync       31.0 - 84.0      VertRefresh     48.0 - 76.0      Option         "DPMS"  EndSection    Section "Monitor"      Identifier     "Monitor2"      VendorName     "ACR"      ModelName      "Acer G247HYL"      HorizSync       31.0 - 75.0      VertRefresh     56.0 - 75.0      Option         "DPMS"  EndSection    Section "Device"      Identifier  "Card0"      Driver      "amdgpu"      BusID       "PCI:48:0:0"  EndSection    Section "Device"      Identifier  "Card1"      Driver      "nvidia"      BusID       "PCI:16:0:0"  EndSection    Section "Device"      Identifier  "Card2"      Driver      "amdgpu"      BusID       "PCI:48:0:1"  EndSection    Section "Screen"      Identifier "Screen0"      Device     "Card0"      Monitor    "Monitor0"          Option     "metamodes" "DisplayPort-0: 1920x1080_60 +0+0"      SubSection "Display"          Depth     24      EndSubSection  EndSection    Section "Screen"      Identifier "Screen1"      Device     "Card1"      Monitor    "Monitor1"          Option     "metamodes" "DFP-3: 1920x1080_75 +0+0"      SubSection "Display"          Depth     24      EndSubSection  EndSection    Section "Screen"      Identifier "Screen2"      Device     "Card2"      Monitor    "Monitor2"          Option     "metamodes" "HDMI-A-0: 1920x1080_60 +0+0"      SubSection "Display"          Depth     24      EndSubSection  EndSection  

OBS can't do window capture under Sway

Posted: 20 Jun 2022 10:28 AM PDT

I'm running Fedora Linux with Sway, and I wanted to capture some stuff with OBS.  However, there is simply no option to do a "Window capture".  As far as I can tell, this is usually attributed to problems with PipeWire or xdg-desktop-portal-wlr.  Despite that, I can do a full screen capture – that works via PipeWire, and to select the monitor it prompts me with a nice window, which is, presumably, generated by xdg-desktop-portal-wlr.  So, I guess, those work just fine:

screenshot showing Screen Capture source selection (?) window

As suggested in xdg-desktop-portal-wlr GitHub repo, I've also added this to my sway config:

exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway  

However, that didn't really help.  What else can cause OBS to refuse to capture windows?

Firewalld forwarded ports are refusing connection

Posted: 20 Jun 2022 10:37 AM PDT

I have a problem with Firewalld port forwarding. The issue is that forwarded ports are refusing connections or are not responding (TCP flag RSET? on hypervisor where port forwarding is set up)

OS: Oracle Linux 8.4, kernel 4.18

The firewalld configuration:

public (active)    target: default    icmp-block-inversion: no    interfaces: enp9s0    sources:    services: cockpit dhcpv6-client http https ssh    ports: 81/tcp 55565/udp    protocols:    forward: no    masquerade: yes    forward-ports:          port=25:proto=tcp:toport=25:toaddr=192.168.1.3          port=143:proto=tcp:toport=143:toaddr=192.168.1.3          port=465:proto=tcp:toport=465:toaddr=192.168.1.3          port=587:proto=tcp:toport=587:toaddr=192.168.1.3          port=993:proto=tcp:toport=993:toaddr=192.168.1.3          port=3389:proto=tcp:toport=3389:toaddr=192.168.1.4          port=3389:proto=udp:toport=3389:toaddr=192.168.1.4    source-ports:    icmp-blocks:    rich rules:          rule family="ipv6" source address="fd00::0/121" masquerade  

Forwarded ports are open on target VM and its IPv4 address is correct (192.168.1.3):

PORT    STATE SERVICE  22/tcp  open  ssh  25/tcp  open  smtp  80/tcp  open  http  110/tcp open  pop3  143/tcp open  imap  443/tcp open  https  465/tcp open  smtps  587/tcp open  submission  993/tcp open  imaps  995/tcp open  pop3s  

Port 80 and 443 are load balanced using Nginx (as HTTP Load Balancer) and forwarding works fine.

IPv4 and IPv6 port forwarding are enabled:

# sysctl net.ipv4.ip_forward  net.ipv4.ip_forward = 1  # sysctl net.ipv6.conf.all.forwarding  net.ipv6.conf.all.forwarding = 1  

What can be the issue here?

How to automatically run mkinitramfs on Debian after apt update for kernel packages?

Posted: 20 Jun 2022 08:06 AM PDT

What I am trying to achieve is to have an encrypted root file system on a Raspberry Pi (running Raspian Buster) that gets unlocked at boot via ssh. I got quite far by adapting a tutorial for Kali linux and got it working at least once, but it does not survive kernel updates yet.

One of the problems is, that this setup is using an initramfs that is referenced in /boot/config.txt by

initramfs initramfs.gz followkernel  

and that needs to be updated after an kernel update by manually calling e.g.

mkinitramfs -o /boot/initramfs.gz 4.19.118-v7+  

where 4.19.118-v7+ depends on the current kernel version and the kind of Raspberry Pi hardware that is used. Of course, I want to have this automatically done whenever apt upgrade installs a new kernel.

This is where I got stuck with 2 problems:

  • A) Where and how do I plug in that update process in a proper way?
  • B) How do I determine the correct kernel version to use?

Regarding A) I came as far as learning that raspberrypi-kernel.postinst executes /etc/kernel/postinst.d/. This again calls /usr/sbin/update-initramfs which in the end will call mkinitramfs. Where I got confused was this code in /usr/sbin/update-initramfs:

set_initramfs()  {          initramfs="${BOOTDIR}/initrd.img-${version}"  }  

It determines the filename for the initramfs. No such file got ever generated during the update and I'm not sure if I am on the right track, as wikipedia says that the init.rd scheme was superseded by the initramfs scheme. However, I was not able to find a good documentation that describes how things are supposed to happen after a kernel module upgrade. (Good links appreciated).

So my question is: Where is a good place to plug in a script that runs the mkinitramfs command? Should I modify /etc/kernel/postinst.d/? Will this solution be stable over the next few Debian versions?

Regarding B), it is easy to get available kernel versions with

> ls -l /lib/modules/ | awk -F" " '{print $9}'`    5.4.51+  5.4.51-v7+  5.4.51-v7l+  5.4.51-v8+  

But how do I automatically select the right one for the current hardware? For a Pi3B+ this would be 5.4.51-v7+. Is there a way to determine this automatically?

Thank you very much for your help!

Arch Linux KDE Plasma Black Screen after login

Posted: 20 Jun 2022 10:07 AM PDT

I wanted to install kde plasma, so I followed the next steps:

pacman -S xorg-server xorg-apps xorg-xinit xterm  pacman -S xf86-video-nouveau  pacman -S plasma-meta kde-applications-meta  pacman -S sddm  systemctl start sddm.service  

But when i run systemctl start sddm.service to start KDE plasma in the login screen doesn't apper the mouse but it's there because I can move the profile the mouse seems invisible on the other hand when I type the password and enter I have a black screen but this time I can see the mouse.

enter image description here enter image description here How i can solve it?

Btw i installed gdm and works why kde plasma not??

Thx.

Command not executing over SSH

Posted: 20 Jun 2022 11:03 AM PDT

I made this script for a course. It executes commands through ssh from the arguments of the script, on a number of remote servers specified in a file:

#!/bin/bash    # The server file. Can be changed with the -f argument  SERVER_FILE='/vagrant/servers'    # The function to check if the chosen SERVER_FILE exists  filecheck() {  if [[ ! -e $SERVER_FILE ]]; then    echo "The file $SERVER_FILE does not exist." >&2    exit 1  fi  }    # The usage statement  usage() {    echo "usage $0 -vsn -f FILE 'COMMAND'"    echo "  -v Verbose mode"    echo "  -s Run command as sudo on remote server"    echo "  -n Dry run, commands not actually executed"    echo "  -f FILE Selects a different file other than /vagrant/servers"    exit 1  }    # The verbose mode text things  say() {    if [[ $VERBOSE = 'true' ]]; then      echo "$@"    fi  }    # The ssh command  sshing() {    ssh -o ConnectTimeout=2 $SERVER $@  }    # User executing the command should not be root  if [[ $UID -eq 0 ]]; then    echo "You should not execute this script with sudo or as root" >&2    echo "Use the -s argument if you want sudo powers" >&2    exit 1  fi    # DRYMODE is sshing by Default  DRYMODE='sshing'    #check to see if file SERVER_FILE exists  filecheck    # The options for the script  while getopts vsnf: OPTION; do    case $OPTION in      v)        echo "Verbose mode on"        VERBOSE='true'        ;;      s)        say "Sudo mode"        SUDO='sudo'        ;;      n)        say "Dry run mode"        DRYMODE='echo'        DRYRUN='DRY RUN: '        echo "DRY RUN MODE ON: "        echo        ;;      f)        say "Different file mode"        SERVER_FILE=${OPTARG}        #check to see if file SERVER_FILE exists        filecheck        ;;      *)        usage        ;;    esac  done    echo    # shifts so that the options are removed from the list of arguments  shift $((OPTIND-1))    #Set a variable for the rest of the arguments, as a command  COMMAND="${@}"    # Checks if the user provided any arguments apart from the optinos  if [[ $# -eq 0 ]]; then    usage    exit 1  fi    # Executes the commands  for SERVER in $(cat ${SERVER_FILE}); do    say "Executing ${COMMAND} on ${SERVER}:"    $DRYMODE $DRYRUN $SUDO ${COMMAND} 2> /dev/null    CMDEX=$?    # if the exit status is 255, something is wrong with the server or is unreachable    if [[ $CMDEX -eq 255 ]]; then      echo "The server you're trying to reach does not exist or is unreachable. Aborting." >&2      exit 1    fi    # if the exit status is non 0 and non 255, something is wrong with the command    if [[ $CMDEX -ne 0 ]]; then      echo "Invalid command ${COMMAND} or wrong syntax. Aborting." >&2      exit 1      # if the exit status is non 0 and non 255, something is wrong with the command    fi    say "Command ${COMMAND} executed successfuly."  done  exit 0  

And it works perfectly for simple commands (like ls, ps, and even adduser test), but it just breaks if I give it any command that would include a double quote UNLESS I single quote the whole command.

Now I don't know if it's a bug in my code or something, but I cannot pipe commands through this.

So this command does not work:

[vagrant@admin01 vagrant]$ ./run-everywhere.sh -sv 'echo 1 | passwd --stdin test4'  

If I escape the pipe with \| it just literally writes it as \|. This other command also doesn't work:

[vagrant@admin01 vagrant]$ ./run-everywhere.sh -sv 'echo "1" | sha256sum > file1'  

EDIT:

I found the problem with piping not working: I have to write sudo AFTER the pipe as well if a command needs sudo priviledges. This one works this way:

[vagrant@admin01 vagrant]$ ./run-everywhere.sh -sv 'echo 1 | sudo passwd --stdin test4'  

I still cannot redirect though.

gksu replacement

Posted: 20 Jun 2022 12:05 PM PDT

In the old days of CentOS 5 i had an application that run as another user. I created a .desktop file which run a command that looked like this:

gksu -u anotheruser someapplication  

When the user clicked the icon a popup asked for the password of "anotheruser" and when the password was correct "someapplication" started.

Now in the modern days of CentOS 7 i can't find a replacment for this behaviour. I tried beesu:

beesu -l -P someapplication anotheruser  

but it is asking me for the root password instead of "anotheruser" password.

I also tried pkexec:

pkexec --user anotheruser someapplication  

With the same result.

Both methods also have problems finding the correct display variable:

Failed to parse arguments: Cannot open display:  

Any help will be appreciated.

Thank you.

Why is nullglob not default?

Posted: 20 Jun 2022 10:48 AM PDT

In most shells nullglob isn't the default. That means, for example, if you run this command

ls *  

in an empty directory, it will expand the * glob to a literal *, instead to an empty list of arguments. There are ways to change that behaviour, so that * in an empty directory will return an empty list of arguments, which would seem more intuitive.

So, is there a reason why nullglob is disabled by default? If so, what is that reason?

Ffmpeg problems on centOS 5.8 64 bit

Posted: 20 Jun 2022 09:03 AM PDT

I did install ffmpeg with winff, unsuccessfully when I try converting avi to x264, it says I don't have it. When I try to convert mp4 to Xvid I get unknown encoder 'libxvid'. It's like nothing really works except avi Msi compatible using winff.

Can anyone help?

No comments:

Post a Comment