Linux Kernel 5.4

This past Sunday saw the announcement of Linux Kernel 5.4, this release brings a number of significant improvements.

I think it will be cool to try the following:

  • new virtiofs filesystem – a FUSE based implementation for sharing physical host filesystems with virtual machine guests.
  • exFAT and sdFAT implementations – although my issues on Linux laptop are more to do with card reader than the exFAT filesystem on the microSD Cards
  • booting from CIFS (Wndows share) – don’t quite know how it works, but sounds too cool not to try!
  • lockdown module – a feature aimed to minimise access to Linux kernel even for root user – meaning no direct access to memory and device ports, limited calls and fully controlled debugfs amd kprobes.

Lots of new graphics cards are added into both AMD and Intel drivers, will be interesting to see if anything is improved for my Ubuntu 19.10 laptop.

See Also




Black Friday Deals

Unix Tutorial

It’s Black Friday, meaning there’s lots of great deals online – hardware, software and hosting.

Here’s just a few things I really liked:

Have a great weekend!




Check Config Before Restarting SSH Daemon

Super quick advice today, but one of them pearls of experience that now and then saves your day. Learn how to check and confirm your recent changes to SSH daemon config file (/etc/ssh/sshd_config) won’t break your remote SSH access.

Why Double-Checking Configs Is A Good Idea

I should probably start a special section of Unix Tutorial someday, just to talk about how and when things can go wrong. These things below would certainly belong to that section.

Why it’s a good idea to check that your new config file is error free:

  • avoid getting service outage (syntax error means service won’t restart)
  • prevent service malfunction (if you end up with only partial service functionality)
  • don’t get yourself locked out of service (or server, in case of broken SSH)

How To Check SSHd Config

I have shown you before how to test new SSHd config on a different port, but there’s also a way to check primary config.

Here’s how you do it:

greys@s2:~ $ sudo sshd -t 

It will either return nothing, or complain about errors or highlight deprecated options, like this:

greys@s2:~ $ sudo sshd -t
/etc/ssh/sshd_config line 56: Deprecated option RSAAuthentication

That’s all there is to it, enjoy!

See Also




Upgrading RHEL 8 to RHEL 8.1

Red Hat Enterprise Linux 8

Needed to reboot my Red Hat Enterprise Linux 8 desktop anyway, so decided to upgrade it to RHEL 8.1.

Check That Your Software Subscription is Active

For example, I realised that I have still been using the RHEL 8 beta subscription instead of the Developers License. After completing Red Hat subscription registration, I got the following:

greys@redhat:~ $ sudo subscription-manager list
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux for x86_64
Product ID: 479
Version: 8.1
Arch: x86_64
Status: Subscribed
Status Details:
Starts: 14/11/19
Ends: 13/11/20

Upgrade Red Hat OS with yum-update

yum tools are more integrated that many people though! So I’m still using yum update instead of dnf:

root@redhat:~ # yum update
 Updating Subscription Management repositories.
 Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                              2.6 kB/s | 4.5 kB     00:01
 Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                              3.0 MB/s |  13 MB     00:04
 Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                 2.4 kB/s | 4.1 kB     00:01
 Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                 2.4 MB/s |  12 MB     00:04
 Last metadata expiration check: 0:00:01 ago on Thu 14 Nov 2019 21:28:59 GMT.
 Dependencies resolved.
  Package                                        Arch      Version                                           Repository                           Size
 Installing:
  yum-utils                                      noarch    4.0.8-3.el8                                       rhel-8-for-x86_64-baseos-rpms        64 k
      replacing  dnf-utils.noarch 4.0.2.2-3.el8
  kernel-debug-devel                             x86_64    4.18.0-147.0.3.el8_1                              rhel-8-for-x86_64-baseos-rpms        14 M
  kernel-devel                                   x86_64    4.18.0-147.0.3.el8_1                              rhel-8-for-x86_64-baseos-rpms        13 M
  kernel-core                                    x86_64    4.18.0-147.0.3.el8_1                              rhel-8-for-x86_64-baseos-rpms        25 M
  kernel                                         x86_64    4.18.0-147.0.3.el8_1                              rhel-8-for-x86_64-baseos-rpms       1.5 M
  kernel-modules                                 x86_64    4.18.0-147.0.3.el8_1                              rhel-8-for-x86_64-baseos-rpms        22 M
 Upgrading:
  netcf-libs                                     x86_64    0.2.8-12.module+el8.1.0+4066+0f1aadab             rhel-8-for-x86_64-appstream-rpms     77 k
  libXt                                          x86_64    1.1.5-12.el8                                      rhel-8-for-x86_64-appstream-rpms    185 k
  alsa-utils                                     x86_64    1.1.9-1.el8                                       rhel-8-for-x86_64-appstream-rpms    1.1 M
...
  podman-manpages                                noarch    1.4.2-5.module+el8.1.0+4240+893c1ab8              rhel-8-for-x86_64-appstream-rpms    180 k
  python3-pip-wheel                              noarch    9.0.3-15.el8                                      rhel-8-for-x86_64-baseos-rpms       1.2 M
  mozjs60                                        x86_64    60.9.0-3.el8                                      rhel-8-for-x86_64-baseos-rpms       6.7 M
  libssh-config                                  noarch    0.9.0-4.el8                                       rhel-8-for-x86_64-baseos-rpms        18 k
  python3-setuptools-wheel                       noarch    39.2.0-5.el8                                      rhel-8-for-x86_64-baseos-rpms       289 k
 Installing weak dependencies:
  oddjob-mkhomedir                               x86_64    0.34.4-7.el8                                      rhel-8-for-x86_64-appstream-rpms     52 k
  libvarlink                                     x86_64    18-3.el8                                          rhel-8-for-x86_64-baseos-rpms        44 k
 Transaction Summary
 Install   17 Packages
 Upgrade  646 Packages
 Total download size: 1.2 G
 Is this ok [y/N]:

Some 15min later I had my desktop in a much better shape:

...
   sos-3.7-6.el8_1.noarch
   hwdata-0.314-8.2.el8_1.noarch
   ca-certificates-2019.2.32-80.0.el8_1.noarch
   microcode_ctl-4:20190618-1.20191112.1.el8_1.x86_64
   kernel-tools-4.18.0-147.0.3.el8_1.x86_64
   kernel-headers-4.18.0-147.0.3.el8_1.x86_64
   bpftool-4.18.0-147.0.3.el8_1.x86_64
   kernel-tools-libs-4.18.0-147.0.3.el8_1.x86_64
   python3-perf-4.18.0-147.0.3.el8_1.x86_64
 Installed:
   yum-utils-4.0.8-3.el8.noarch                                            kernel-debug-devel-4.18.0-147.0.3.el8_1.x86_64
   kernel-devel-4.18.0-147.0.3.el8_1.x86_64                                kernel-core-4.18.0-147.0.3.el8_1.x86_64
   kernel-4.18.0-147.0.3.el8_1.x86_64                                      kernel-modules-4.18.0-147.0.3.el8_1.x86_64
   oddjob-mkhomedir-0.34.4-7.el8.x86_64                                    libvarlink-18-3.el8.x86_64
   python3-argcomplete-1.9.3-6.el8.noarch                                  oddjob-0.34.4-7.el8.x86_64
   tbb-2018.2-9.el8.x86_64                                                 gnome-shell-extension-horizontal-workspaces-3.32.1-10.el8.noarch
   podman-manpages-1.4.2-5.module+el8.1.0+4240+893c1ab8.noarch             python3-pip-wheel-9.0.3-15.el8.noarch
   mozjs60-60.9.0-3.el8.x86_64                                             libssh-config-0.9.0-4.el8.noarch
   python3-setuptools-wheel-39.2.0-5.el8.noarch
 Complete!
 root@redhat:~ #

And that’s it! I rebooted the server and my OS is RHEL 8.1 now:

greys@redhat:~ $ more /etc/redhat-release
Red Hat Enterprise Linux release 8.1 (Ootpa)
greys@redhat:~ $ uname -a
Linux redhat 4.18.0-147.0.3.el8_1.x86_64 #1 SMP Mon Nov 11 12:58:36 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

See Also




Red Hat Enterprise Linux 8.1

RHEL 8

Just as I published last Unix Tutorial Digest on November 5th, RHEL 8.1 release got shipped – think this is a great incremental release bringing a number of key improvements to the Red Hat Enterprise Linux 8.

RHEL 8 Release Cadence

Red Hat announced that going forward Red Hat Enterprise Linux OS will be receiving regular updates every 6 months. Since RHEL 8 release was in May 2019, this current RHEL 8.1 update is right on time, 6 months after.

RHEL 8.1 Improvements I Want To Try

There’s a number of great improvements in this release:

  • Live Kernel Patching with kpatch
  • SELinux profiles for containers and tbolt for Thunderbolt devices – will be cool to try on my RHEL 8 PC
  • Perhaps try RHEL 7.6 in-place upgrade to RHEL 8.1
  • Review rhel-system-roles and specifically the new storage role added in RHEL 8.1
  • LUKS2 online re-encryption
  • RHEL 8 Web Console
    • firewall zones management
    • Virtual Machines configuration

I also want to try Red Hat Universal Base Image for RHEL 8 – it’s been around since initial release in May, I just never got the chance to have a look.

See Also




OpenIndiana 2019.10 Released

OpenIndiana

I’m hardly getting any chance to work on Sun/Oracle hardware and Solaris anymore, but still like tracking the releases. OpenIndiana is a free Solaris implementation based on the Illumos project, and OpenIndiana 2019.10 just got released.

Improvements in OpenIndiana 2019.10

  • Latest improvements from the Illumos project (namely illumos-gate)
  • Lots of documentation updated and moved from old wiki to https://docs.openindiana.org
  • Python dependent tools (including IPS) upgraded to support Python 3
    • IPS ships Python 3.5 tools and libraries
  • Bash updated; sudo updated; vim updated – these are like my top 3 commands! 🙂
  • Development toolchain is refreshed
  • Server software packages updated
    • nginx 1.16.1
    • BIND 9.14
    • Samba 4.11 (plus lots of improvements for SMBv3 from Illumos)

More information can be found here: OpenIndiana 2019.10 Release Notes.

Installing OpenIndiana 2019.10

This section is a placeholder: I plan on downloading OpenIndiana ISO image and installing it inside a virtual machine.

Will update this post with links to the OpenIndiana install notes and first screenshots shortly.

See Also




brew cask vs brew formula

Homebrew for MacOS
Homebrew for MacOS

Since reinstalling certain software packages on my Linux desktop, Linux laptop and Macbook a few times in the past months, I’m positively in love with the Homebrew project. Today I’ll share my understanding of its basic deployment modules: casks vs formulae.

What Homebrew does

Homebrew project is the magic behind brew command – it’s a software manager that assists with source-code and binary distributions of various software projects.

Specifically, brew is popular on macOS platform where most of software is traditionally installed using graphical user interface (GUI) or via AppleScript automation. Recent versions of macOS exposed a number of relevant interfaces via command line, but average user (and most of advanced users/developers) still had to resort to some enterprise level proprietary delivery and installation mechanism.

With the arrival of Homebrew, things got much easier. A typical software installation is now simpler and quite comparable to the number of steps required in other Unix and Unix-like operating systems:

  1. You enable relevant software repo
  2. You install software package

With brew, first install is similar:

  1. You install Homebrew
  2. You install software package

But later things get even simpler:

  1. You simply use brew to install software package

This is mostly due to the fact that Homebrew supports both standard and third-party software using its own centralised approach to software packaging. Application owners define a formula for installing their software, get in touch with Homebrew team to add it to the project, and going forward things happen pretty much automatically.

In Linux world, many software packages are still distributed independently or have to make their way into a specific application/software store – so many small projects are hard to find.

brew formula

Each Open Source package integrated with Homebrew is configured using a brew formula. It’s a Ruby language based configuration file that explains how the software can be downloaded from GitHub or similar repository and then compiled.

Here’s a formula for htop command:

class Htop < Formula
  desc "Improved top (interactive process viewer)"
  homepage "https://hisham.hm/htop/"
  url "https://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz"
  sha256 "d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57"
  revision 1

  bottle do
    cellar :any
    sha256 "c06ff60960f64f5c8395f53d7419cbcce2a22ee87f0cb0138352c8a88111d21c" => :catalina
    sha256 "77aa302765353b4085dcad52356d3264183e06310dda8d5bac64642299ea2902" => :mojave
    sha256 "0ebfb655b91566ba31f8effc94d642a43305ff95bdc9b30b46fadc132e2ced0c" => :high_sierra
    sha256 "ed93b86f011de155c5d261b8c9cc9cb81fd0017667bf3ebe26ee090716bcd650" => :sierra
  end

  head do
    url "https://github.com/hishamhm/htop.git"
 
    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
  end
 
  depends_on "pkg-config" => :build
  depends_on "ncurses" # enables mouse scroll
 
  def install
    system "./autogen.sh" if build.head?
    system "./configure", "--prefix=#{prefix}"
    system "make", "install"
  end
 
  def caveats; <<~EOS
    htop requires root privileges to correctly display all running processes, so you will need to run `sudo htop`.
    You should be certain that you trust any software you grant root privileges.
  EOS
  end
 
  test do
    pipe_output("#{bin}/htop", "q", 0)
  end
end

brew install

Installing software from brew formulae is easy:

$ brew install htop

brew cask

brew cask is an extension to standard brew based software management, it’s a type of formula that documents the process of installing a graphical application (and not entirely coincidentally closed-source software).

Similar to brew formula, cask defines where software can be downloaded and what dependenices it has, but specification is so flexible that you can even download binary packages from developer websites. If it’s a paid project, you’ll probably get a chance to download a trial copy (that you later can enable using a valid serial number for that software).

Here’s brew cask for my password manager of choice, 1Password:

cask '1password' do
  version '7.4'
  sha256 'e6b26726d2e67fa33f0a3dadd84fab8d7a2b0a7b281b3d55a62cd7b226080f91'

  url "https://c.1password.com/dist/1P/mac#{version.major}/1Password-#{version}.zip"
  appcast "https://app-updates.agilebits.com/product_history/OPM#{version.major}"
  name '1Password'
  homepage 'https://1password.com/'
 
  auto_updates true
  depends_on macos: '>= :sierra'
 
  app "1Password #{version.major}.app"
 
  zap trash: [
               "~/Library/Application Scripts/2BUA8C4S2C.com.agilebits.onepassword#{version.major}-helper",
               "~/Library/Application Scripts/com.agilebits.onepassword#{version.major}",
               "~/Library/Application Scripts/com.agilebits.onepassword#{version.major}-launcher",
               '~/Library/Application Scripts/com.agilebits.onepasswordnativemessaginghost',
               "~/Library/Containers/2BUA8C4S2C.com.agilebits.onepassword#{version.major}-helper",
               "~/Library/Containers/com.agilebits.onepassword#{version.major}",
               "~/Library/Containers/com.agilebits.onepassword#{version.major}-launcher",
               '~/Library/Containers/com.agilebits.onepasswordnativemessaginghost',
               '~/Library/Group Containers/2BUA8C4S2C.com.agilebits',
               '~/Library/Logs/1Password',
               "~/Library/Preferences/com.agilebits.onepassword#{version.major}.plist",
             ]
end

brew cask install

Installing brew casks is easy:

$ brew cask install 1password

That’s all I wanted to explain today. Let me know if you have any questions!

See Also




Automating macOS Screenshots with Hazel

screenshots folder

I’ve used a number of screenshot applications on my computers in the last few years, and it’s a never ending search for the perfect balance of flexibility and performance. Today I’m testing a new approach using native macOS grab functionality together with Hazel app.



Hazel by Noodlesoft

In case you haven’t heard about it, Hazel is an unbelievably powerful and flexible file management and automation tool for macOS:

Hazel by Noodlesoft

You select incoming folders to process (in my screenshot: Downloads and Desktop) and then define rules for automatically processing files. Hazel is running in background, monitoring folders for matching rules you configured and applying them as it finds new files – within seconds of a new file matching a Hazel rule it gets dispatched.

Here’s just a few of the workflows I have:

  • Rename PDF files to a specific name based on some keywords found inside the PDF document itself (great for automatically renaming utility bills)
  • Move ISO file downloads into specific folder on my NAS server
  • Move large files from Downloads folder into special archive area on NAS (to save space on laptop)
  • Rename all sorts of files to include datestamp – great for making these files easily found from Bash scripts later

Common Issues with Screenshot Software

I’ve found that most screenshot making software (for macOS) is not flexible enough in one way or another:

  • many apps are using proprietary database for storing images instead of standard folder
  • there’s no easy way to add screenshots from other software or folders – so unless you used the app to make a screenshot (or retake a screenshot of an existing image file) – it won’t make it
  • lots of apps allow you to export and import images but metadata is lost (like the date/time when the screenshot was taken)
  • there’s the problem of bloating up apps too, so something that started as a perfect screenshot tool can become an unusable (for me) collection of all sorts of image and video capturing functinality that’s just too slow or complex to use any longer

The Problem with Cloud Sync

I would also like to have screenshots from different laptops and PCs to be synced if at all possible – and it’s quite hard to find a screenshot app capable of doing this intelligently enough.

There’s a few great solutions that are geared towards team work and collaboration, but the problem with them is I have to create separate account for each computer or that all the images end up in a cloud with potentially auto-generated links.

Approach I’m trying Today

I decided to try a much simpler approach:

  • use built-in screenshot tool in macOS
  • use Hazel app to auto-collect screenshots from Desktop and place them into Pictures/screenshots folder
  • use Hazel app to auto-rename screenshots for better file sorting
  • Use Finder for accessing the screenshots folder with previews

Configure folder processing rule in Hazel

Here’s how my rule looks:

Hazel processing for screenshots

macOS Finder settings for the screenshots folder

And these are the settings I’ve selected for the screenshots folders:

I think it’s working out nicely: all my screenshots are sorted by the date they’re taken, there’s image size indication and thumbnails large enough for quickly finding the screenshot I want:

screenshots folder in macOS Finder

Syncing screenshots folder

Documents folder is iCloud synced, so I’m hoping to configure this setup on both desktop and laptop, this way both of them will always have the same screenshot collection. Potentially, I can even use my Ubuntu 19.10 XPS laptop to capture screenshots into Dropbox folder, which can be processed by Hazel on macOS to import images.

That’s it for now! Let me know how you’re dealing with screenshots and what tools you use!

See Also




Show Mounted Filesystems of Certain Type

mount -t

Pretty cool: I’ve just learned a very simple but rather useful trick that will certainly help with my basic home automation and shell scripting. mount command has an option to list filesystems by type.

List Mounted Filesystems by Type

Quite often your Linux/Unix system will have filesystems of different types: most likely it will be special types like proc or tmpfs along with a number of traditional (Linux) filesystem types like ext2/ext3/ext4 or xfs.

mount -t command helps list just the mounted filesystems of certain type.

For instance, here’s how I can see just the ext4 filesystems on one of my Linux servers:

greys@s2:~ $ mount -t ext4
/dev/md0 on / type ext4 (rw,relatime,stripe=256,data=ordered)
/dev/md1 on /var/log type ext4 (rw,relatime,stripe=256,data=ordered)
/dev/md2 on /storage type ext4 (rw,relatime,stripe=256,data=ordered)
/dev/md0 on /var/lib/docker/devicemapper type ext4 (rw,relatime,stripe=256,data=ordered)

And here’s how I can now easily confirm list of AFPFS network shares mounted from my NAS server on MacBook under macOS:

greys@MacBook-Pro:~ $ mount -t afpfs
//[email protected]/t3chstack on /Volumes/t3chstack (afpfs, nodev, nosuid, mounted by greys)
//[email protected]/Storage on /Volumes/Storage (afpfs, nodev, nosuid, mounted by greys)
//[email protected]/Stuff on /Volumes/Stuff (afpfs, nodev, nosuid, mounted by greys)

See Also




Unix Tutorial Digest – November 5th, 2019

Unix Tutorial Digest: monthly digest of Unix/Linux topics

September and October 2019 have been so busy for me at work and at home that I posted less frequently than usual and also skipped the September Unix Tutorial Digest. All is good, lots of interesting developments at work and with my home office servers, so I’ve been reading a lot and preparing new material.

I also launched Unix Tutorial RU for Russian speaking readers of my website – so check it out: https://www.unixtutorial.ru.

As always, please get in touch to arrange a technical consultation with me or want to suggest a useful link for the next digest here at Unix Tutorial.

Unix and Linux News

Software News

  • HTTP/3 is becoming a thing! Initial support for it is found in nginx, curl and major browsers now
  • PulseAudio 13.0 released – I still remember how tricky it was to get its early versions to work on my desktop 10 years ago. This package has made great progress since then! Modern codecs like Dolby TrueHD and DTS-HD Master Audio are supported in version 13.
  • VirtualBox 6.1 beta was released – will test VirtualBox on my Dell XPS laptop soon, 6.1 beta 2 is out now. Should be cool to export VMs right into (Oracle) cloud! On macOS I still prefer Parallels.

Software News

  • Firefox 70 is here
  • Chrome 68 is out
  • Perl 6 is officially named Raku
  • Python 3.8 is released
  • OpenSSH 8.1 is released. Yay!
  • PostgreSQL 12 database server is now available
  • Java SE 13 is released

Interesting and Useful

Unix Tutorial articles

Full list of posts published on Unix Tutorial in September/October 2019:

That’s it for the months of September and October 2019!

See Also