TechGuySG

Apr 01, 2021

"Almalinux"


ALL The Centos Linux distribution was first released in 2004. It fulfilled its promise as a free and binary compatible version of RHEL ( Red Hat Enterprise Linux ). The project is possible because the source code for all the software in RHEL is publicly available. The Centos project folks will strip out any RedHat copyright information and recompiled to create the binary RPM packages. All the packages are bundled together into a Linux distribution that was easy to install.

Centos is a popular distribution because it mirrors RHEL and provides the corresponding software updates. It has the same 10 years of support life span as RHEL. It has also been incorporated into many commercial software/hardware products.

In Jan 2014, Red Hat announced their hiring of the Centos team and acquisition of the Centos project. Centos still maintained its independence from Red Hat with its own governing board. This change was positive as it gave financial stability to the Centos team and helped to keep the Centos distribution and update releases on a consistent pace.

IBM acquisition of Red Hat closed on July 9, 2019. It was in no doubt that there will be changes coming. In December 2020, Red Hat unilaterally terminated CentOS development. Red Hat will however continue to support the related rolling release distribution called CentOS Stream.

EOLCentos

Centos 8 will ceased to be supported on 31st December 2021. CentOS Stream is replace it but it will no longer be one to one compatible with RHEL 8. Software will be changing all the time and eventually it will become the next RHEL release. In the development cycle, CentOS Stream will be positioned between Fedora and RHEL. CentOS Stream will not be suitable for production use due to the software changes. To put it plainly, Centos Stream is like a RHEL Beta which will used for developing new features for the next RHEL release.

The Centos user community was incensed on hearing this announcement. Those who have implemented Centos 8 were placed in a untenable position because instead of a End of Life date of May 2029, Centos 8 support will end in 1 years time.

Subsequently 2 projects were started to provide a replacement to Centos 8.

Rocky Linux rockylinux

Almalinux almalinux

Rocky Linux is led by Gregory Kurtzer, founder of the CentOS project. The current ETA for a beta release is April 30th.

Almalinux is a project run by The AlmaLinux OS Foundation. Cloudlinux Inc backs the Almalinux project. Cloudlinux Inc makes a Linux distribution CloudLinux OS marketed to shared hosting providers. CloudLinux OS is based on the CentOS operating system; it uses the OpenVZ kernel and the rpm package manager.

Rocky Linux starts from ground zero however Almalinux is being worked on by a team that has already produced a fork of RHEL 8 for CloudLinux OS.

On Mar 30 2021, Amalinux 8.3 was officially released. On Mar 31, using the migration script provided almalinux-deploy. I successfully did a inplace switch to Almalinux from Centos 8. After the script performs a few initial checks, it began the process of removing, reinstalling, downgrading, and upgrading certain packages in order to synchronize the system with the current AlmaLinux release. The entire process took about 20mins which concluded by rebooting the system.

Almalinux being 1::1 compatible, everything works. Already there features that it provides which was missing from Centos. Almalinux maintains the errata information in their repositories. Therefore you can retrieve only updates related to security or perform queries based on types of errata.

errata

The other observable improvement is the speed of updates. Two recent flaws have been found in openssl, which were deemed important. Redhat patched their source code on March 24-25 and released openssl packages for RHEL8 on March 30.

AlmaLinux had updated openssl packages by March 31st. Centos will probably take awhile longer to release their updates. To be fair, Centos will provide quick update responses for critical security patches.

Mar 25, 2021

"Byobu - Terminal Multiplexer"


byobu Byobu is a GPLv3 open source text-based window manager and terminal multiplexer. Byobu includes an enhanced profiles, convenient keybindings, configuration utilities, and toggle-able system status notifications for both the GNU Screen window manager and the more modern Tmux terminal multiplexer.

The key benefits are:

It provides easier to remember keybinding to Screen/Tmux.

Terminal sharing is easily done with just two terminal sessions ( same user account ) running byobu.

Automatic resumption of terminal session if remote is reconnected

Byobu defaults to launching tmux.


KEYBINDINGS byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings are:

   F2 - Create a new window

   F3 - Move to previous window

   F4 - Move to next window

   F5 - Reload profile

   F6 - Detach from this session

   F7 - Enter copy/scrollback mode

   F8 - Re-title a window

   F9 - Configuration Menu

   F12 -  Lock this terminal

   shift-F2 - Split the screen horizontally

   ctrl-F2 - Split the screen vertically

   shift-F3 - Shift the focus to the previous split region

   shift-F4 - Shift the focus to the next split region

   shift-F5 - Join all splits

   ctrl-F6 - Remove this split

   ctrl-F5 - Reconnect GPG and SSH sockets

   shift-F6 - Detach, but do not logout

   alt-pgup - Enter scrollback mode

   alt-pgdn - Enter scrollback mode

   Ctrl-a $ - show detailed status

   Ctrl-a R - Reload profile

   Ctrl-a ! - Toggle key bindings on and off

   Ctrl-a k - Kill the current window

   Ctrl-a ~ - Save the current window's scrollback buffer

SCROLLBACK, COPY, PASTE MODES Each window in Byobu has up to 10,000 lines of scrollback history, which you can enter and navigate using the alt-pgup and alt-pgdn keys. Exit this scrollback mode by hitting enter. You can also easily copy and paste text from scrollback mode. To do so, enter scrollback using alt-pgup or alt-pgdn, press the spacebar to start highlighting text, use up/down/left/right/pgup/pgdn to select the text, and press enter to copy the text. You can then paste the text using alt-insert or ctrl-a-].

   Shift - F1 for Help

Mar 18, 2021

"Software Packaging"


software Every Linux distribution has a default method for managing the installation/removal/updating of software. Suse/Redhat/Centos/Fedora uses the RPM package manager to manage rpm packages. Debian/Ubuntu uses dep packages with the corresponding tools to manage them.

There are now alternative method of installing Linux software applications which tries to solve the typical problems of software compatibility issues like having the required libraries and specific versions of software.

Snap

Snap are app packages for desktop, cloud and IoT that are easy to install, secure, cross‐platform and dependency‐free. Developed and supported by Canonical, it has a repository of snap packages at snapcraft.io. There you will find a very large collection of free and propriety software installed via snap tools. Snap tools are available for many Linux distributions.

Flatpak

Flatpak touts itself as the future of software distribution for desktop software for Linux. This means it does not have server type of application which limits it pool of software. It has the least number of packages among the 3 software distribution tools being discussed. It was co-developed by RedHat. List of their packaged software can be found here Flatpak Software List. Flatpak has only free software and the Flatpak tools are supported by 28 Linux distributions.

AppImage

AppImage approach is the simplest of the 3 mentioned, one file, make it executable and then run it. All libraries and associated software are included in that one file. Surprisingly their packages are also smaller than those from Flatpak and Snap. You will find a list 1000 over software at AppImage software list

Mar 17, 2021

"All About Battery Charging"


charge Lets talk about all the ways battery charging is done via cables. Various manufacturers have adopted different methods to transfer power to the batteries on smartphones and other electronic devices. We will focus on the charging methods used in smartphones.

One of the product differentiation used by manufacturers is the speed that the phone battery achieve 100% charge. One of the major standard is the Quick Charge method

Quick Charge

Quick Charge or is also called turbo charging, adaptive fast charging and QC rapid charging. Quick Charge (QC) is a Qualcomm-licensed technology. It’s a marketing phrase that signifies the power managing circuitry capabilities of a wall charger and smartphone. Basically, the technology can charge batteries faster without damaging it. Both the phone, charger and cable must be compatible to enable quick charging.

Although the technology is designed to work with Snapdragon chipsets, Qualcomm had licensed the technology to other vendors chipsets, such as Zenphone (Intel) and Exynos (Samsung).

Rapid charging is applied typically up to the 60-70% range. The charging process will become less aggressive as it reaches the 100% mark. This is to avoid affecting the life span of the battery.

These are three quick charge generations:

QC 1.0 – Devices with QC 1.0 compatibility were first released in 2013. QC 1.0 supports up to 2A and operates on 5V.

QC 2.0 – The next generation of quick charging. QC 2.0 is 50% faster than QC 1.0. It works on a multi-voltage charging system offering 5V, 9V and 12V up to 3A. This multistage voltage means when your device battery is really low it will charge with 12V, this allows for a really rapid charge, then as the charge gets higher it slowly drops the voltage (fixed values) until you reach normal QC 1.0 voltages and speeds.

QC 3.0 – Adds stepless multi-voltage charging, so adapts its voltage to deliver a faster charge. QC 3.0 voltage varies from 3-20V and delivers faster and more economical charging when compared to QC 2.0. QC 3.0 is about 15% faster than QC 2.0

QC 3.0/2.0 chargers can be used to charge older devices with QC 1.0 speeds, ensuring backward compatibility.

USB Power Delivery and Qualcomm Quick Charge 4.0 / 4+

USB Power Delivery (USB-PD) is a standard from USB-IF ( USB Implementers Forum, Inc. ). USB-IF is a non-profit corporation founded by the group of companies that developed the Universal Serial Bus specification. Qualcomm Quick Charge 4+ and USB-PD are intercompatible. USB-PD is used by Apple for their iphones ( iphone 8 and up ). Google Pixel phones also uses USB-PD. Current Samsung high end phones support USB-PD for the highest rate of fast charging.
 

Version Maximum Power Voltage Maximum Current
USB 2.0 2.5 W 5 V 500 mA
USB 3.1 4.5 W 5 V 900 mA
USB BC 1.2 7.5 W 5 V 1.5 A
USB Type-C 1.2 15 W 5 V 3 A
USB PD 100 W 5/9/15/20 V 5 A

 

All USB 2.0 devices provide a minimum of 500 mA at 5 volts. This increases to 900 mA with a USB 3.1 port. USB Type-C ports can be configured in fast charging modes at either 1.5 or 3.0 A for more power when connected to other Type-C devices or chargers. USB-PD is a separate specification that can work across USB 2.0 and 3.0 ports and cables, but you will still need a USB Type-C port due to the communication pins used by the standard.

Power Rules for both USB-PD 2.0 and USB-PD 3.0:

Sources >15W supply 5 volts and 9 volts

Sources >27W supply 5 volts, 9 volts, and 15 volts

Sources >45W supply 5 volts, 9 volts, 15 volts, and 20 volts

Maximum current of 5 A

In order to make use of the highest power modes, specially rated USB cables are required. As standard cables are only rated for 7.5W at most.

The difference between the two types of PD charging (2.0/3.0) lies in the amount of detailed information given by each type of PD. USB-PD 3.0 has worked to improve its power delivery but is primarily known for offering increased amounts of information about the device being charged and its power/ battery.

In addition to faster charging, USB-PD enables both host and peripheral devices to provide power. For example, your phone could be used to charge another device using the same USB-C port.

USB-PD can be used to charge laptops and it is becoming the default fast charging standard.

May 10, 2019

"Flash Storage Types in Mobile Products"

wafer eMMC, or embedded multimedia card, is an advanced, managed NAND flash memory for mobile applications and it is still the dominant go-to memory solution for many consumer electronics products. The latest standard is eMMC 5.1. It is can perform either a read or write operation at a time.

UFS is the future of Flash memory. UFS 2.1, the current most pervasive version, offers sequential read/write speeds fast enough to rival SSDs while combining it with the low power consumption of eMMC. At the time of this post, the new UFS 3.0 storage standard is appearing in products like the OnePlus 7 pro and the Samsung Fold. UFS can perform read and write operation at the same time.

UFS Trends!

UFS can also process multiple tasks simultaneously while on eMMC user has to wait for one process to complete before they could start another. This makes devices with eMMC slower than UFS based devices when it comes to copying files and booting speed.

What makes UFS 3.0 better than its predecessor is the faster read and write speeds. It is the first standard to offer data transfer speeds of up to 11.6 Gbps simultaneously, which means an overall transfer speed of 23.2Gbps

UFS 2.1 can muster peak speed of 5.9Gbps in one lane, while eMMC can manage speeds of up to 2Gbps only.

eMMC is still popular because of its lower cost. However for premium mobile device lookout for UFS 3.0 storage.

May 09, 2019

"Getting a Domain Name"

DNS

It has never been easier to put up a presence on the internet. Setting up a account on a social media site is convenient as storage, bandwidth and content management are all taken of. However the content you create may not belong to you anymore subject to the policy of that web service. If you want full control of your internet presence then you should setup your our own website.

The first step is to register a domain name. The domain name will be a easier handle to points to your website. This domain will be a unique label which points any web server which you define. The cost of registering a domain name can vary greatly from less that USD$1 to USD$50 or more per year. Sometimes the name you want may already be registered, for example, rabbit.com is already taken but rabbit.com.pt is still available. Beware, the 1st year price maybe offered at a very low but take note of the renewal price which will be much higher.

A good site to do search and price comparison of domain names is

TLD LIST

it ranks the cheap domain names and search for names and check if they are still available.

Of course when you setup a website with a hosting vendor, they may bundle a free domain name with the service.

May 08, 2019

"Fixing Timestamp in Pictures"

programming As per my routine, I downloaded a bunch of podcast on to my Android phone in the morning. Upon playback of the first podcast, after 5 mins, the audio from another podcast cuts in. This happens on other recently downloaded podcasts. After some troubleshooting I concluded that my 128Gb microsd card was having write issues. This was a Samsung microsd which I thought would have a longer life than the sandisk it replaced.

I did a backup of the contents of the microsd card but I knew it will change the time stamp of the picture files in the DCIM folder. The gallery app will no longer show the photos in chronological order. My solution was to reset the time stamp of the photos using the time/date information stored in the exif metadata in the photos. So after restoring all the data from the failing microsd card to a new microsd card, the next step was to find a script/application to reset the timestamp of the photos.

I found this blog entry with the script that will do the job.

Android Photo Date Correction

Unfortunately the python script was for python2. I modified it to the python3 syntax so it would run on my archlinux system. Modified script photodate.py as follows:

{{< highlight python >}}

!/usr/bin/env python

import os, re, time, argparse, exifread

def date_correction(args): '''Method for Android date correction of /sdcard/DCIM/Camera''' for dirpath, dirnames, filenames in os.walk(args.directory): for filename in [f for f in filenames if f.endswith('.jpg') or f.endswith('.jpeg') or f.endswith('.mp4') or f.endswith('.3gp') or f.endswith('.JPG')]: fn = os.path.join(dirpath, filename) f = open(fn, 'rb') tags = exifread.process_file(f) if 'EXIF DateTimeOriginal' in tags.keys(): ts = str(tags['EXIF DateTimeOriginal']) else: ts = None if ts is not None: print ('Found date in EXIF metadata: ' + fn + ' (' + ts + ')') ft = time.mktime(time.strptime(ts, '%Y:%m:%d %H:%M:%S')) os.utime(fn, (ft, ft)) else: match = re.search(r'((?P[0-9]{8}[0-9]{6})|(?P[0-9]{4}-[0-9]{2}-[0-9]{2}[0-9]{6})|(?P[0-9]{4}-[0-9]{2}-[0-9]{2}[0-9]{2}-[0-9]{2}-[0-9]{2}))', filename) if match: if match.group('y1') is not None: print ('Found date in filename: ' + fn + ' (' + match.group('y1') + ')') t = match.group('y1') ft = time.mktime(time.strptime(t, '%Y%m%d%H%M%S')) os.utime(fn, (ft, ft)) elif match.group('y2') is not None: print ('Found date in filename: ' + fn + ' (' + match.group('y2') + ')') t = match.group('y2') ft = time.mktime(time.strptime(t, '%Y-%m-%d_%H%M%S')) os.utime(fn, (ft, ft)) elif match.group('y3') is not None: print ('Found date in filename: ' + fn + ' (' + match.group('y3') + ')') t = match.group('y3') ft = time.mktime(time.strptime(t, '%Y-%m-%d_%H-%M-%S')) os.utime(fn, (ft, ft)) else: print ('Failed to get file date for ' + fn)

def main(): try: print ('\033[92m' + '\nAndroid Photo Date Correction\n' + '\033[0m') parser = argparse.ArgumentParser() required = parser.add_argument_group('required arguments') required.add_argument('-d', '--directory', metavar='[directory]', required=True, help='Photo source directory') args = parser.parse_args() date_correction(args) except ImportError as e: print ('There must be something missing\n') print (e.args[0])

if name == "main": main()

{{< /highlight >}}

As per instructions in the blogpost, I ran sshdroid as the ssh server on the phone. I used sshfs to mount the phone folder with pictures onto a mountpoint on my system. I run the script and processed thousands of photos.

There were bunch of photo which did not have the time/date information in the exif. However the filename of the photos had the date information so I wrote a script to use the filename to set the timestamp. For example, this is the script to fix a photo with this filename structure 2011-05-02 20.08.07.jpg.

fix_timestamp.sh

{{< highlight bash >}}

IFS=$'\n'; for i in $(ls *.jpg) ; do touch --date $(echo $i | grep -Eo '[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}' | tr -d '-' ) $i; done

{{< /highlight >}}

The change in the IFS variable is to fix the issue of the space in the photo filename.

Used similar scripts to correct the timestamp of videos as they also have the date in the filename.

So now the photos/videos will display correctly on the phone gallery app.

← Previous Page 2 of 2