Upgrade Ubuntu Server over ssh

I run an Ubunutu server and initially I found it tedious to have to do upgrades by going to the server and manually running the upgrade. I did not want to get too fancy with this process as it was not worth the time. I just log in and set it then come back later and ensure thing are going smoothly and answer any questions that may come up.

I was thinking about doing this via ssh but there is always the possibility that your connection may drop and you can potentially break your server, Ubuntu actually puts up a warning for you in this regard.

Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?

Continue [yN]

What I did was use a screen session should things disconnect me from my session so that the process can remain running and I can reconnect once I am able to. I have not had an issue as yet (knocks on wood) but you just never know and I prefer to be safe than sorry.

Install screen

sudo apt update && sudo apt install screen

Start a session and accept the license as prompted

screen

If you need to reconnect just run the following command

screen -r

If you have more than one session running find the one you want by running the following command

screen -ls

To connect to one of your running sessions run the following command where 17448 is the screen session id

screen -r 17448

Ensure Update Manager is installed

sudo apt install update-manager-core

Ensure your upgrade config is set to the tree you want to be on

/etc/update-manager/release-upgrades

From that file, as you can see, I use lts only:

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the release that immediately succeeds the currently-running
#           release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=lts

Run a base upgrade

sudo do-release-upgrade

Run a full Upgrade

sudo do-release-upgrade -d

Follow the instructions that appear on screen. You will be asked about keeping files or installing the new version, that will be up to you as only you know your server and what you’ve changed.

Warning : Pay close attention as upgrading a file that has config settings that let your sever do the work you built it for may be overwritten.

Did it work?

Ensure that the upgrade works and that you are on the most recent release as per your upgrader settings.

Run the lsb command:

The lsb_release command provides certain LSB (Linux Standard Base) and distribution-specific information.

lsb_release -a

Here are all the options you can use:

-v, --version
              Show the version of the LSB against which your current installation is compliant.  The version is expressed as a colon separated list of LSB module descriptions.

       -i, --id
              Display the distributor's ID.

       -d, --description
              Display a description of the currently installed distribution.

       -r, --release
              Display the release number of the currently installed distribution.

       -c, --codename
              Display the code name of the currently installed distribution.

       -a, --all
              Display all of the above information.

       -s, --short
              Use the short output format for any information displayed.  This format omits the leading header(s).

       -h, --help
              Show summary of options.

You should see something like this:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:        18.04
Codename:       bionic

The Description line would show the sub version number if there are security releases done after the initial release. In those cases you should see something like this which I got from my server prior to the upgrade:

Description:    Ubuntu 16.04.4 LTS

There you go. Did I forget something or do you have something to add to make this article better, leave a comment below.

Advertisements

100 Percent Disk Usage – Windows 10

In this article we’ll be talking about some things that cause 100 Percent Disk Usage and how to fix them

Windows Search

Windows Search is the back-end system that allows you to find your files faster on your Computer. It works by constantly indexing every single file on your computer.

  • Open a Command Prompt as Administrator
  • Enter the following
net.exe stop “Windows search”

Click Enter
To turn it off permanently:

Press Windows key + R and type

services.msc
  • Click OK
  • Scroll down the list of services and double-click Windows Search
  • Click the General tab
  • Set the Startup type to Disabled
  • Click OK

SuperFetch

SuperFetch is a feature that helps decrease boot time by making apps load more efficiently. However, it can cause usage problems with your drive.

  • In Command Prompt, type
net.exe stop superfetch
  • Click Enter

To disable it permanently

In services.msc, disable Windows SuperFetch

Skype

  • Go to C:\Program Files (x86)\Skype\Phone and right-click on Skype.exe
  • Select Properties
  • Click the Security tab
  • Click the Edit button
  • Make sure All Application Packages is highlighted
  • Check Allow for Write Permissions
  • Click OK

Linux Lite on older CPUs with PAE

On machines with older Pentium M ™ and Celeron M ™ processors, there is an extra requirement to get Linux installed, I’ve encountered this mainly with Linux Lite as that is the OS of choice I use for older systems.

Important: This only works if your installation is failing with this error kernel requires features not present on the CPU: PAE

Continue reading Linux Lite on older CPUs with PAE

Systemd Vulnerable to DNS Attacks

Systemd, the Linux world’s favorite init monolith, can be potentially crashed or hijacked by malicious DNS servers. Patches are available to address the security flaw, and should be installed ASAP if you’re affected.
Continue reading Systemd Vulnerable to DNS Attacks

macOS 10.13 High Sierra Public Beta

macOS Public Beta is now active, however; there are many articles out there telling users how to signup then leaving them short of getting the actual update.

I have been checking for days now and the update would not show up.. So I dug around and found the installer.
Continue reading macOS 10.13 High Sierra Public Beta

grub-pc (2.02~beta2-36ubuntu3.10)

I’m running an Ubuntu server and the other day while running updates I started getting the following error:

Setting up grub-pc (2.02~beta2-36ubuntu3.10) ...
/var/lib/dpkg/info/grub-pc.postinst: line 703: syntax error near unexpected token `fi'
dpkg: error processing package grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)

Opening /var/lib/dpkg/info/grub-pc.postinst I found:

        if dpkg --compare-versions "$2" lt-nl 2.02~beta2-36ubuntu3.10 then
          if [ -e "/boot/efi/EFI/${bootloader_id}/fbx64.efi" ]; then
            rm -f "/boot/efi/EFI/${bootloader_id}/fbx64.efi";
          fi
        fi

There was a missing semicolon in the first line and that’s what was breaking my update. I updated it and the error went away:

        if dpkg --compare-versions "$2" lt-nl 2.02~beta2-36ubuntu3.10; then
          if [ -e "/boot/efi/EFI/${bootloader_id}/fbx64.efi" ]; then
            rm -f "/boot/efi/EFI/${bootloader_id}/fbx64.efi";
          fi
        fi

Installing Linux Kernel v4.10

I started using CentOS over several other Distros that I have been testing ever the years. I still have an Ubuntu laptop just to keep up to date with things seeing that it’s one of the most popular ones.

I’ve covered installing Kernels before but I wanted to refresh that topic and include how to do it on CentOS.

Continue reading Installing Linux Kernel v4.10