Here are some ways to determine if your Linux system requires a reboot following an updated.
Applies to RedHat, CentOS, and Amazon-Linux.
Install the yum-utils package, which contains the command needs-restarting. This command can be
used to check if a full reboot is required because of kernel or core library updates (using the -r
option) or what services need restarting (using the -s option). The command returns a 0 if a
reboot is not required, or a 1 if it is, so it can be scripted.
$ sudo needs-restarting -r
Updating Subscription Management repositories.
Core libraries or services have been updated since boot-up:
* kernel
* systemd
Reboot is required to fully utilize these updates.
More information: https://access.redhat.com/solutions/27943Applies to Debian and Ubuntu.
If the file /var/run/reboot-required exists then the system needs a reboot. This script example
shows how this can be checked.
#!/bin/bash
if [ -f /var/run/reboot-required ]; then
echo 'reboot required'
fiA list of packages with pending changes that require a restart are listed in
/var/run/reboot-required.pks
$ sudo cat /var/run/reboot-required.pkgs
libssl1.0.0There is a helper tool for Debian/Ubuntu called needsrestart that can be installed.
sudo apt install needsrestartRunning this program with not options specified, will attempt to restart all services that have been updated. It can also be run interactively to see which services require restarts.
sudo needsrestart -r i
I’ve spent the past two years learning Go language and using it for some of my personal projects. I’m in the midst of converting this website from using Jekyll to using Hugo, and wrote a conversion program to port all my postings from the old site to the new in Go. For the last year or so I have become increasingly aware of the Rust programming language, and I have wanted to learn more about it.
I’ve just purchased Zero to Production in Rust by Luca Palmieri. My goal is to spend some time everyday reading the book, and working through the code. I plan on capturing my thoughts, successes, setbacks, etc., in daily (near daily) blog postings.
For added interest, I’ve decided to see if I can recreate the same application in Go along side the one the book creates in Rust.
AWS allows the use of multiple accounts to help separate billing, business units, functional items, etc. One downside to multiple accounts is needed to sign into and out of accounts to access the AWS resources or functions you need.
My employer has multiple accounts that I use on a daily basis:
Until today I made use of multiple browsers and incognito windows to be able to be signed into multiple accounts at one time. A lunch time conversation with a former collegue clued me into browser profiles.
A browser profile is a complete encapsulation of all the settings, bookmarks, browsing history, etc., for an identity. Using different profiles, one for each AWS account, it is possible to be signed into several AWS accounts simultaneously, without resorting to private windows or using several different browsers.
It appears that Firefox, Chrome, and Brave all support profiles. Brave is based on Chrome, so I suspect any browser using Chromium will also support profiles.
Brave, at least, adds a “Profiles” menu, that lists all the profiles allowing quick access to any of the others. Even better, by adjusting the theme / color scheme for each profile you can visually separate them. Green for dev, yellow for test, and red for production.
Browser profiles makes multiple AWS accounts much less work.
Like many, I found, read, and followed the articles about “bash strict mode” believing it would make
my scripts better. In some cases my scripts worked fine. In others I had strange results, that were
only addressed by removing set -e. This article explains why “strict” mode is probably not a good
idea.
I’m firmly in the “set timers on my watch or phone” camp, so this app probably isn’t for me. The mechanism for setting the time, however, is very inventive.
For several years I maintained a subdomain on my website where I kept a list of all the books I had read, organized by year. The site was completely hand coded—no CMS involved, no frameworks, just HTML, CSS, and a little JavaScript.
While having the list was pleasing, updating the site was tedious at times. Copy and paste the previous book’s HTML table row, and replace all the values. Then commit the changes to the sites Git repository, and push the changes to GitHub. Finally sign into the host and update the site by updating the local working copy of the repository.
I have been wanting to automate this for some time, and, with a small Go application and a GitHub Action, it now requires far less interaction from me.
My GitHub Action does these steps:
index.html filersync to copy the updated site to the web hostCurrently I have the Action set to run anytime there is a push to the master branch. I am planning
on revising this, to only run the Action when a pull request is merged into master. That will
allow me to make multiple changes, without repeatedly running the automation.
name: Build Book Website
on:
push:
branches:
- masterThe action runs in a “container” which itself is running the latest version of Ubuntu. GitHub provides a clause to specify the OS. GitHub also provides a library to checkout the repository.
jobs:
# The "build" workflow
build:
runs-on: ubuntu-latest
steps:
# Checks out repository
- uses: actions/checkout@v2The site is rebuilt using a small Go language application that reads the list of books from a comma-separated-value (CSV) file, and uses Go’s templating feature to build an HTML table with one row per book.
In order for the GitHub Action to run this application, Go needs to be setup. Again, a provided library makes getting Go installed quick.
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.18.3'With Go installed, and the repository checked out, one command is all that is needed to run the Go
application to rebuild the index.html file.
# Run the Go application to update the site
- name: Run application
run: go run main.goWith the index.html file now updated the change needs to be committed to GitHub. I used an
external action for this.
# Commit the updated index.html file to the repository
- name: Commit updated index
uses: EndBug/add-and-commit@v9
with:
add: 'site/index.html'
author_name: GitHub Action
author_email: root@zanshin.net
message: 'Updated index.html with new listing(s)'
push: trueThere is only one file updated by the Go application, so I’m able to be specific about what is
added. push: true is the default, but I put it here to be unambiguous. The
Endbug/add-and-commit repository has more
information about using this action.
Getting an ssh key setup so that rsync can transfer the site from GitHub to the web host was the
trickiest part of the entire action. I closely followed Deploying to a server via SSH and Rsync in
a GitHub Action to get this working.
Remember, the action is running inside an Ubuntu container, and this will be a different container
each time the action executes. The steps in zellwk.com’s article demonstrate how to use repository
secrets to put the private half of an ssh key pair in the Ubuntu container, and how to update the
.ssh/``known_hosts file. With all the pieces in place, here is the code for setting up the ssh key.
{% raw %}
# Install the private half of our SSH key via a repository secret
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: {{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-place-holder-so-we-dont-get-errors'
# Update the know_hosts file
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
{% endraw %}The final step uses rsync to copy the updated site to the web host. I restructured my repository
to have all the site specific files in a site subdirectory. This makes it possible to copy the
site and not the Go application and associated files to the web host.
{% raw %}
# Use rsync to copy the repo to the host
- name: Deploy with rsync
run: rsync -avz ./site/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/usr/home/mnichols/public_html/books
{% endraw %}Here is my complete build.yaml action.
By default Safari wants to position any new tab opened after the last related tab. When you are browsing a site and open links from it in new tabs, having them immediately follow the current one is nice. However, when you simply want to open a new tab and have it appear at the end of the tab bar, you have to first position the focus on the current last tab, and then do CMD-T.
By enabling the “Debug” menu in Safari, you can access the “Tab Ordering” options. To enable the Debug menu run this command in the Terminal.
defaults write com.apple.Safari IncludeInternalDebugMenu 1
Then quit and reopen Safari. The Debug menu should be listed as the last menu in the Safari menu bar.
Locate the “Tab Ordering” menu option, and then hover over “Position of New Tabs”. There are four to choose from:
Click the option you prefer and your choice should take immediate effect.
I recently purchased “Code” by Charles Petzold. The second edition is fantastic. Starting from very basic first principles (flash lights) Mr. Petzold builds layer upon layer using Morse code and Braille along the way to introduce the concepts at the foundation of how computers function. I haven’t completed the book yet, but I highly recommend it.
For the past 15 months I’ve been running an experiment in having a desktop computer, the first desktop computer I’ve owned since 2002. The experiment actually starts with the purchase of a 12.9” iPad Pro.
In March 2021, with a COVID-19 stimulus check in my pocket, I ordered a 12.9 inch iPadPro, a Magic Keyboard, and an Apple Pencil 2. At the time I was considering updating my 15-inch late-2013 MacBook Pro for a newer laptop, but with Apple’s conference looming on the horizon I didn’t want to get a laptop just before new ones were released.
I was attracted to the 12.9 inch iPad as it would work well for digital sheet music. As it turns out, it also works surprisingly well as a laptop replacement. I have used my iPad almost exclusively since it arrived. I rarely tote my laptop around now.
With the Blink terminal app installed I’m able to perform code / nerdy things by remote access into one of my “real” computers. With forScore installed I have access to over 170 pieces of music.
Having my mobile needs met through the iPad, I was very intrigued by the new M1 iMac, and in June 2021 I bought one. It is a beautiful machine, both to use and to look at. It only has one drawback—it is desk bound.
Since the start of the pandemic I have worked remotely 100% of the time. I have a 2015-era 27” iMac from my employer on my desk, and next to it I have my 24” M1 iMac. Thanks to Universal Control, I’m able to use the keyboard and trackpad from the M1 iMac to access both machines. During the work day I use my computer for my things: email, non-work related browsing, listening to music, etc. I use the work iMac for, well, work.
At the end of my work day, when I go home (yes, going home is something you do even when you work at home), I take my iPad and move to the living room. I don’t use my computer in the evenings, or on the weekends. I remotely access the M1 iMac to do coding work, but I don’t sit at my desk and interact with the computer directly.
Ever since the new M2 MacBook Air was released, I have had a strong attraction to it. Compact but still capable, comes in a dark, almost black color, and it is eminently portable. However, having a 12.9 inch iPadPro and a 24 inch M1 iMac and an M2 MacBook Air feels like overly conspicuous consumption.
Not that I am opposed to having more computers. I already have two Raspberry Pi (a 3 and a 4b), a 13 inch Asus Q325 running Linux, an Intel NUC also running Linux, a 15” 2009 MacBook Pro that mostly collects dust (I may try Google Chrome OS on it), my 15” 2013 MacBook Pro, which I occasionally use, a Mac Mini, and the afore mentioned 12.9 inch iPadPro and M1 iMac. Oh, and an iPhone and Apple Watch.
Still, having both a desktop that I really don’t make full use of and a MacBook Air seems wasteful and extravagant. When I initially started thinking about trading my M1 iMac in for a MacBook Air, the M1 wasn’t listed as an option on Apple’s trade in calculator. Once it started listing the M1 iMac the trade in value was $800. By craftily not acting on impulse I have managed to lower that trade in value to $600 and now $450.
The configuration I’d want in the MacBook Air (24GB Memory / 2TB Storage / M2 chip with 8‑core CPU, 10‑core GPU, 16‑core Neural Engine) lists for $2499. Subtracting $450 from that brings the cost down to $2049. Using the education discount the starting price is $2299 minus $450 nets $1849.
Through my Apple Card I can get interest free installment payments, spreading the cost out over 12 months, ~ $155 per month.
As a first born, I find it difficult to ask for things and to let myself have things. Deciding to switch computers—returning the iMac is a surprisingly hard decision to make. I want the MacBook Air, but then I also want the new Apple Watch Ultra, and a Studio Display. I’m attracted to shiny. There isn’t any computing need of mine unmet by my current combination of iPadPro and iMac, except for portability.
The experiment in having a desktop helped to me to realize that for my personal computing needs and habits, a laptop is the ideal solution. There are things that I want to do, and like to do, that cannot be performed on an iPad. There are also things that the iPad can do that a laptop (or desktop) can’t do. For me the ideal combination would be a laptop and an iPad.
Committing $155 a month for a year to reach that ideal is the stumbling block. At least for now.