Changing Default Editor in Ubuntu

By default the editor in Ubuntu Server is Nano, I prefer Vim.

Run the following command:

sudo update-alternatives --config editor

this will output a selection list that may differ depending on which editors you have installed:

There are 5 alternatives which provide `editor’.
Selection Alternative
———————————————–
*+ 1 /bin/nano
2 /usr/bin/vim.basic
3 /usr/bin/vim.tiny
Press enter to keep the default[*], or type selection number:

Select the number of the editor you want to use and press enter. That’s it.

Was this helpful for you? Leave us a comment below. Thanks.

Advertisements

Rotate display in Linux when not using an X Server

In general you would use a desktop version of whatever Linux Distro you decided suits your needs and you may have an external display that you use to write scripts on or whatever else you do that would work best with a rotated (portrait) display; for me that is note taking or scripting. I have mine hard mounted to the wall and if I need to rotate it it’s almost impossible because I have displays on either side of it that are also hard mounted on the wall.

The last few days I’ve been playing with building a Linux (Ubuntu Server 18.04 LTS) based Gateway to run my network in server mode and I had to use this rotated display as I had other things going on that were taking up the other displays. As you are aware, using a portrait display to see what you’re doing on a server is no fun and yes I can ssh into the server but I wanted to work directly off the server while tasks on my other machine were still going on. Yes, I did make this extra complicated for myself but it made me learn things that I and not many normally people think about. I could make this easy by installing a GUI but that would add extra things to my system that I do not need and that would take up resources that I prefer to go to the task I’m creating this system for.
Continue reading Rotate display in Linux when not using an X Server

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.

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

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

Activate Ubuntu login sound

I miss some things from the old Ubuntu releases and one of those things is the login sound. I found it still included but not active, here is how to re-activate it if you want to have some nostalgia…

  • Cling on the Ubuntu Launcher
  • Search for and launch Startup Applications
  • Click Add
  • Add the following lines:
    • Name: Login Sound
    • Command: paplay /usr/share/sounds/ubuntu/stereo/desktop-login.ogg
    • Comment: Play Login Sound
  • Click Save
  • Restart your computer

If you just want to hear it without having it load every time you login check, here ya go.