Monday, August 5, 2024

Slackware64-current Kernel 6.10.3 EVDI-Kernel

Update 08-23-2024:  Version 1.14.6 of evdi (https://github.com/DisplayLink/evdi/releases/tag/v1.14.6) introduced support for  the 6.10 kernel and preliminary support for the 6.11 kernel.

I use a Dell USB 3.0 docking station for multiple monitors, which uses a DisplayLink chipset.  After the latest kernel upgrade to 6.10.3, evdi-kernel did not want to repackage, due to missing module/evdi.ko and would not proceed.  Once I copied evdi.ko, evdi 1.14.5 did repackage and installed, but it could not load the evdi module.  I took a look at evdi 1.14.4 which would not repackage either and found that it was due to module/evdi_gem.c so I copied evdi_gem.c from 1.14.5 into 1.14.4 and repackaged and installed 1.14.4 successfully.  Once I rebooted, I could use my dual monitors again

Regards,

F. Bobbio C.

Saturday, September 9, 2023

Check Open Files By Process Name

I was tasked with finding how many files were open for a specific process name.  The process name had many process IDs (PIDs) running, which could be listed using the following command:

    ps -eaf | grep -i<ProcessName>

The PIDs were listed in the second column, which the required the addition of one more command:

    ps -eaf | grep -i $CheckProcessName | awk -F ' ' '{print $2}'

The output was a list of PIDs, in one column, and the amount of open files could be checked for each of them, by running the following command for the PIDs:

    lsof -p <PID1>,<PID2>,<PID3>,...,<PIDn> | wc -l

This was cumbersome for processes that have multiple PIDs, thus adding one extra command to list all PIDs in one line:

    ps -eaf | grep -i $CheckProcessName | awk -F ' ' '{print $2}' | tr '\n' ,

 I decided to combine it all together and came up with this one-liner:

    lsof -p $(ps -eaf | grep -i <ProcessName> | awk -F ' ' '{print $2}' | tr '\n' ,) | wc -l

Last, but not least, I created a shell script that could be used to check on any process:

    #!/bin/bash
    read -p "Enter process name: " CheckProcessName
    lsof -p $(ps -eaf | grep -i $CheckProcessName | awk -F ' ' '{print $2}' | tr '\n' ,) | wc -l

Feel free to comment if you have a suggestion to make it simpler

Regards,

F. Bobbio C.

Monday, October 31, 2022

Dynect Zones + Record_Id Export

 I was tasked with exporting all records from Dynect to import into another portal.  There was some information here:  https://support.globaldots.com/hc/en-us/articles/115004002829-Dyn-How-to-get-all-records-from-a-zone-through-the-API  which requires the creation of a file in json format with these parameters { "customer_name" : "ACME" , "user_name" : "user", "password" : "secretpassword" }

This would allow me to export only partial information and I needed to export over 750 zones, with over 100 records per zone in some cases.  I created the following script, which exports each domain in the zones into its own json file

# Based on https://help.dyn.com/rest-resources/
#!/bin/bash
Token=$(curl -sX POST -d @Credentials.txt -H "Content-Type: application/json" https://api.dynect.net/REST/Session/ | awk -F '"' '{print $10}')
curl -sX GET -H "Content-Type: application/json" -H "Auth-Token: $Token" https://api.dynect.net/REST/Zone/ >> Zones.json
cat Zones.json | awk -F ']' '{print $1}' | awk -F '[' '{print $2}' > Zones.json.1
sed -i -e 's|/||g' -i -e 's|RESTZone||g' -i -e 's|,||g' -i -e 's|"||g' Zones.json.1
rm Zones.json && mv Zones.json.1 Zones.json
AllZones=$(cat Zones.json)
for val in ${AllZones[@]};do
  curl -sX GET -H "Content-Type: application/json" -H "Auth-Token: $Token" https://api.dynect.net/REST/AllRecord/$val/ >> $val.json
  echo -e Exporting data for zone $val
  cat $val.json | awk -F ']' '{print $1}' | awk -F '[' '{print $2}' > $val.json.1
  sed -i -e 's|,||g' -i -e 's|"||g' $val.json.1
  rm $val.json && mv $val.json.1 $val.json
done
for i in $(cat Zones.json);do
  EachZone=$(cat $i.json)
  for val in ${EachZone[@]};do
    EachZoneName=$(echo $val | awk -F '/' '{print $4}')
    ZoneNameAttribute=$(echo $val | awk -F '/' '{print $3}')
    curl -sX GET -H "Content-Type: application/json" -H "Auth-Token: $Token" https://api.dynect.net$val/ >> $EachZoneName-Detailed.json && echo >> $EachZoneName-Detailed.json && echo >> $EachZoneName-Detailed.json
    echo -e Exporting detailed data for $ZoneNameAttribute in zone $EachZoneName
    cat $i-Detailed.json | awk -F 'zone": ' '{print $2}' | awk -F ', "record_id":' '{print $1}' >> $i-Detailed-Cleaned.json
    sed -i -e 's|,|\n|g' -i -e 's|"||g' $i-Detailed-Cleaned.json
  done
done
#rm *-Detailed.json

Regards,

F. Bobbio C.

Sunday, August 28, 2022

1Password In Slackware64-current

There is currently no SlackBuild for 1password.  It can be installed using the rpm file, via the following script:

#!/bin/bash
rm 1password-latest.rpm 1password-latest.txz
wget https://downloads.1password.com/linux/rpm/beta/x86_64/1password-latest.rpm
sudo rpm2txz 1password-latest.rpm
sudo killall 1password
sudo removepkg 1password-latest
sudo installpkg 1password-latest.txz
sudo cp custom_allowed_browsers /opt/1Password/resources/

Copy custom_allowed_browsers from /opt/1Password/resources/ and modify it by adding a line with the default browser in use, such as firefox

Regards,

F. Bobbio C.

Monday, April 5, 2021

Slackware64-current Query Installed Packages Versions

Update 08-28-2022: I added more packages to be queried.  The script is now hosted in GitLab and has one extra line comparing the versions of the packages.

Original:

I needed a script to check on the current versions of  specific packages, as well as the latest versions from the vendors or manufacturer websites.  I used the github and gitlab repositories for the packages, along with awk to query the versions and tr to remove the v in front of the version numbers.  I even added a line for Microsoft Teams.

First attempt:

#!/usr/bin/bash
echo DKMS && echo Current:  && ls /var/log/packages | grep dkms | awk -F "-" '{print $2}' && echo Latest: && git ls-remote --tags --refs --sort="version:refname" git://github.com/dell/dkms | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo EVDI: && echo Current:  && ls /var/log/packages | grep evdi-1 | awk -F "-" '{print $2}' && echo Latest: && git ls-remote --tags --refs --sort="version:refname" git://github.com/DisplayLink/evdi | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo FreeRDP && echo Current: && xfreerdp /version | awk '{print $5}' && echo "Latest:" && git ls-remote --tags --refs --sort="version:refname" git://github.com/FreeRDP/FreeRDP | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo NVIDIA: && echo Current: && grep "X Driver" /var/log/Xorg.0.log | awk '{print $8}' && echo Latest: && git ls-remote --tags --refs --sort="version:refname" git://github.com/NVIDIA/nvidia-xconfig | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo Remmina: && echo Current: && ls /var/log/packages | grep Remmina | awk -F "-" '{print $2}' | tr -d \v && echo Latest: && git ls-remote --tags --refs --sort="version:refname" https://gitlab.com/Remmina/Remmina.git | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo Teams: && echo Current: && ls /var/log/packages | grep teams-insiders | awk -F "-" '{print $3}' | tr -d \v && echo Latest: && curl -s https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams-insiders/ | awk -F "teams" 'NF > 1 {print $NF}' | tail -1 | awk -F "_" '{print $2}'

Second attempt:

#!/usr/bin/bash
CurrentDKMS=$(ls /var/log/packages | grep dkms | awk -F "-" '{print $2}' 2>&1)
LatestDKMS=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/dell/dkms | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo DKMS Current: $CurrentDKMS Latest: $LatestDKMS
CurrentEVDI=$(ls /var/log/packages | grep evdi-1 | awk -F "-" '{print $2}' 2>&1)
LatestEVDI=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/DisplayLink/evdi | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo EVDI Current: $CurrentEVDI Latest: $LatestEVDI
CurrentFreeRDP=$(xfreerdp /version | awk '{print $5}' 2>&1)
LatestFreeRDP=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/FreeRDP/FreeRDP | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo FreeRDP Current: $CurrentFreeRDP Latest: $LatestFreeRDP
CurrentNVIDIA=$(grep "X Driver" /var/log/Xorg.0.log | awk '{print $8}' 2>&1)
LatestNVIDIA=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/NVIDIA/nvidia-xconfig | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo NVIDIA Current: $CurrentNVIDIA Latest: $LatestNVIDIA
CurrentRemmina=$(ls /var/log/packages | grep Remmina | awk -F "-" '{print $2}' | tr -d \v 2>&1)
LatestRemmina=$(git ls-remote --tags --refs --sort="version:refname" https://gitlab.com/Remmina/Remmina.git | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo Remmina Current: $CurrentRemmina Latest: $LatestRemmina
CurrentTeams=$(ls /var/log/packages | grep teams-insiders | awk -F "-" '{print $3}' | tr -d \v 2>&1)
LatestTeams=$(curl -s https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams-insiders/ | awk -F "_" 'NF >1 {print $2}' | tail -1 2>&1)
echo Teams Current: $CurrentTeams Latest: $LatestTeams

Regards,

F. Bobbio C.

Monday, February 8, 2021

Slackware64-current In MacBook Pro

I am just another regular Slackware user, who likes tinkering around with machines and installing Slackware64-current on them to check on their performance and if Slackware64-current can work on them.

I received a MacBook Pro from one of my customers and wanted to see if I could install Slackware64-current natively on it, since it had an issue that would cost $300 to $500 to fix with the built-in or integrated (soldered to the motherboard) video card, which all laptops have anyway.  These are the steps I took and the URLs I gathered in this process.

Note:  Do this at your own risk.  I assume no responsibility if something goes wrong.  This procedure will format the whole drive and you will lose macOS on it.

01) Download Slackware64-current iso (https://slackware.nl/slackware/slackware64-current-iso/) and create a USB bootable stick with it

02) Hold "alt" or "option" before pressing the power button on the MacBook Pro.  Release it when you see "EFI Boot"

03) Double click on "EFI Boot" to start the Slackware64-current installation

04) Use cfdisk or cgdisk to create partitions.  The first partition should be a 100M EFI partition.  Other partitions can include a swap partition, a root ("/") partition and a home ("/home") partitions or any other partition that you need.  The EFI partition is required for this procedure to work

05) Run setup as with any other installation and follow the prompts.  After it finishes installing the system, it will encounter the EFI partition and ask you if you want to format it

06) Click on "install" on the "ELILO (EFI Linux Loader) installation" screen

Note:  The text mentions "Apple computers use a different type of EFI firmware and efibotmgr has been know to damage them.  On all other computers, it is recommended to add a boot menu entry." and give the options to "install" or "skip".  This is the step that creates the boot entry and makes the MacBook Pro recognize the partition and allow you to boot from the installation

07) Remove elilo and configure grub.  I could not get elilo to work once I updated the kernel, plus I "pimped" my Slackware64-current installation a bit, by creating a png file to display while grub loads with 5 a seconds countdown.  I also downloaded a font to use in this splash screen in grub.  You can still use "e" while grub is displayed on the screen to login into a different runlevel

Files:

# grub (place it in /etc/default/ or run the script)

# If you change this file, run grub-mkconfig -o /boot/grub/grub.cfg
# afterwards to update /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Slackware"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vga=current"
GRUB_FONT="/boot/grub/fonts/unicode.pf2"
GRUB_DISABLE_OS_PROBER=true
GRUB_BACKGROUND="/boot/grub/SlackGrub.png"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1280x1024

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

# Save this image as SlackGrub.png and place it in /boot/grub/


Script:

# I saved it as grubconf.sh and chmod +x for it to run

#!/bin/bash
echo "Removing elilo"
removepkg elilo
cd /boot/efi/EFI/Slackware
mv elilo.conf elilo.conf.orig
mv elilo.efi elilo.efi.orig

echo "Configuring grub"
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

echo "Copying grub files"
cp grub /etc/default/grub
cp SlackGrub.png /boot/grub/SlackGrub.png
mkdir /boot/grub/fonts
cp unicode.pf2 /boot/grub/fonts/unicode.pf2

echo "Reconfiguring grub"
grub-mkconfig -o /boot/grub/grub.cfg

URLs:

https://docs.slackware.com/howtos:slackware_admin:set_up_grub_as_boot_loader_on_uefi_based_hardware

https://github.com/anak10thn/ign-bootloader/blob/master/ign-grub2/config/boot/grub/ -- Download unicode.pf2 from it

Regards,

F. Bobbio C.

Monday, January 18, 2021

Citrix WorkSpace In Slackware64-current

Some time ago I wrote about Citrix Receiver In Mozilla Firefox (64-bit) In Slackware64-current. Citrix Receiver has been replaced by Citrix WorkSpace. These are the steps to install it in Slackware64-current. 

1) Repackage and install libmanette (SlackBuild: https://github.com/conraid/SlackBuilds/tree/master/libmanette and package: https://ftp.acc.umu.se/pub/GNOME/sources/libmanette/) and webkit2gtk (SlackBuild: http://cgit.ponce.cc/slackbuilds/tree/libraries/webkit2gtk and package: https://www.webkitgtk.org/releases/)

2) Download the "Tarball Packages" Citrix WorkSpace app for Linux (x86_64) from https://www.citrix.com/downloads/workspace-app/linux/workspace-app-for-linux-latest.html

3) Untar the package

4) Open a terminal, su, enter root password

5) Run ./setupwfc and accept all defaults for installation

6) cd /opt/Citrix/ICAClient

7) Run ./selfservice or open Citrix WorkSpace app from KDE menu

8) Check https://www.citrix.com/content/dam/citrix/en_us/documents/downloads/citrix-receiver/linux-oem-guide-13-1.pdf for information on mapping drives (Hint: Search for "DrivePathA...Z" on page 72 of 104 and read on ~/.ICAClient/wfclient.ini file)

Regards,

F. Bobbio C.