Transcription of Ubuntu Notes

Russell Bateman
January 2011
last update:

See notes that are less Ubuntu and more Linux/Unix here.
See notes on Linux Mint here.
Or, see the Permuted Index.

$ uname -a
$ cat /etc/issue
$ cat /etc/os-release
$ cat /etc/lsb-release

Setting up Ubuntu: first thing

The first thing to do on Ubuntu after you get it up and running (I didn't find I had to do this prior to Lucid, but I read on-line that others have had to as far back as Feisty or even Edgy) is to fix the mapping of sh. Do this or the equivalent from root:

	root@tuonela:/> rm /bin/sh
	root@tuonela:/> ln -s /bin/bash /bin/sh

You only need to do this if sh isn't just a link to bash. Why do you need to do this? Because you'll be missing important functionality such as pushd when you write and execute shell scripts. pushd will be reported as not found. And it doesn't matter that your script's first line is #!/bin/bash, it still will go missing.


Hacking Ubuntu root password...

If you forgot the root password, get the grub load boot menu by hitting esc in early boot to get the boot menu, and then modifying (editing) the boot line. (Note: If under VMware Server, you will need to hurriedly click in the window to get the keyboard sending to that VM before your esc will be effective. If you’ve got idiot VMware alerts to answer first, this can be challenging.)

	Ubuntu, kernel 2.6.15-26-386

Press e to edit this and (probably) a down arrow, then e again to edit...

	kernel /boot/vmlinuz-2.6.15-26-386 root=/dev/sda1 ro quiet splash

...and change to:

	kernel /boot/vmlinuz-2.6.15-26-386 root=/dev/sda1 init=/bin/bash

Press Enter. Then, boot by pressing b. Once booted, you can change the password:*

	root@(none):/# passwd
	Enter new UNIX password:
	Retype new UNIX password:

After that, you may see an error on the console to the effect that something is locked. Type:

	passwd: Authentication token lock busy
	root@(none):/# sync

...then ^D (or exit) to panic the kernel. Cycle the power, etc. to reboot and you should be done.

* Note that you might attempt to create or edit a file on root (/) to ensure the filesystem isn’t mounted read-only. If this fails, then it is read-only and you need to perform the password change between the following commands so that it takes (because passwd will not tell you if it doesn’t take):

	root@(none):/# mount -o remount rw /
	root@(none):/# passwd (etc. as above...)
	root@(none):/# mount -o remount ro /

A good file to edit is /etc/issue which you can modify and see the effect of during boot, then change back:

	Russ was here: Ubuntu 6.06.1 LTS \n  \l


More Ubuntu installation stuff...

Commands I’ve visited recently in setting up my Ubuntu VM (running under VMware Server)...

	apt-cache search gcc                    # look for GNU C
	apt-get install gcc-4.0-base
	apt-get install gcc-4.0

	apt-get update                          # update Ubuntu installation
	apt-get install build-essential

	apt-cache search bison
	apt-get install bison
	apt-cache search lex | grep lex
	apt-get install flex                    # use flex for lex
	apt-get install libxml2
	apt-get install libxml2-dev
	apt-get install php5


Ubuntu CD access under VMware...

Using apt-get install may lead to CD use. To get the CD working under VMware, go to menu VM, choose Removable Devices, then CD-ROM 1 and Edit... where you click on Location: client and set autdetect. Then, bring this menu up again, but in place of Edit..., choose Connect.


chkconfig on Ubuntu

This handy little utility, popular on SuSE at least, isn't available on Ubuntu, so update-rd.d is how to get around it. Here's a script I found out there in Googleland and modified until it worked. I think this Debian command has changed a bit since it was written back in 2005.

There are two areas of concern. If you don't like the value 20 offered here for use by update-rc.d as the base priority number, you'll have to change it. Second, you may want different levels than the [3,5] and [0,1,2,6] I chose. See what's in red below.

	#!/bin/bash
	#----------------------------------------------------------------
	# Title:         rc-config
	# Author:        Joseph Harrison (and Russell Bateman)
	# Date Created:  12/16/2005
	# Purpose:       Configure services and run-levels
	# Dependencies:  grep, sed, update-rc.d
	#----------------------------------------------------------------

	USAGE="Usage: rc-config [OPTION] [SERVICE ... STATE]\n\
	Information about services and run-levels, configure services and run-levels\n\
	Sorts entries alphabetically\n\
	\n\
	Mandatory arguments to long options are mandatory for short options too.\n\
	  -h,\t\t\t Show help\n\
	  -l,\t\t\t List all services and run-levels\n\
	  -ls ,\t\t List a specific service and run-levels\n\
	  -s  ,\t Configure service\n\
	  \t\t\t Ex: rc-config -s ssh off\n\
	  -t,\t\t\t Terse output\n\n"
	LIST_SERVICE=0
	SET_SERVICE=0
	TERSE=0

	checkroot()
	{
	  if [ $EUID -ne 0 ]; then
	    echo "you must be root to use this feature"
	    exit 1
	  fi
	}

	checkopts()
	{
	  while getopts "lsth" flag; do
	    case $flag in
	      l)  LIST_SERVICE=1  ;;
	      s)   SET_SERVICE=1  ;;
	      t)         TERSE=1  ;;
	      h)  echo -en $USAGE;
	          exit 1          ;;
	      *)  echo -en $USAGE
	          exit 1          ;;
	    esac
	  done

	  if [ -z "$1" ]; then
	    echo -en $USAGE
	  fi
	}

	showrc()
	{
	  if [ $TERSE -eq 0 ]; then
	    echo -en "SERVICE\t\t\tRUN-LEVELS\n"
	  fi

	  if [ $SET_SERVICE -eq 0 ]; then
	    slist=`find /etc/init.d/ -perm -100 | sed "s/\/etc\/init.d\///"`
	  elif [ $SET_SERVICE -eq 1 ]; then
	    service=$2
	    if [ -f "/etc/init.d/$service" ]; then
	      slist="$service"
	    else
	      echo "$service: does not exist"
	      exit 1
	    fi
	  fi

	  for msvc in $slist; do
	    sln=18
	    tsvc=$msvc
	    while [ ${#tsvc} -lt $sln ]; do
	      tsvc="$tsvc "
	    done
	    echo -en "${tsvc:0:$sln}\t"
	    for level in 0 1 2 3 4 5 6; do
	      services=`ls -1 /etc/rc${level}.d/S* | sed "s/\/etc\/rc${level}.d\/S[0-9]*//"`
	      state=0

	      for svc in $services; do
	        if [ "$svc" = "$msvc" ]; then
	          state=1
	          continue
	        fi
	      done

	      if [ $state -eq 1 ]; then
	        echo -en "$level:on\t"
	      else
	        echo -en "$level:off\t"
	      fi
	    done
	    echo
	  done
	}

	setservice()
	{
	  service=$2
	  state=$3

	  if [ -z "$service" ] || [ -z "$state" ]; then
	    echo -en $USAGE
	    exit 1
	  fi

	  if [ ! -f "/etc/init.d/$service" ]; then
	    echo "$service: does not exist"
	    exit 1
	  fi

	  # Here's where I really changed stuff...
	  if [ $state = "on" ]; then
	    #update-rc.d $service defaults —no longer seems to work!
	    update-rc.d $service start 20 3 5 . stop 20 0 1 2 6 .
	  elif [ $state = "off" ]; then
	    echo "Disabling $service"
	    /etc/init.d/$service stop >& /dev/null

	    if [ $? -ne 0 ]; then
	      echo "(/etc/init.d/$service does not yet exist.)"
	    fi

	    for link in `find /etc/rc* -type l -name "[S,K][0-9][0-9]$service"`; do
	      unlink $link
	    done
	  else
	    echo -en $USAGE
	  fi
	}

	main()
	{
	  checkopts "$@"
	  if [ $LIST_SERVICE -eq 1 ]; then
	    showrc "$@"
	  elif [ $SET_SERVICE -eq 1 ]; then
	    checkroot
	    setservice "$@"
	  fi
	}

	main "$@"

Wireless printing on Ubuntu

Setting this up for a new wireless printer is a piece of cake. Here's what I did:

  1. System -> Administration -> Printing.
  2. Add.
  3. Click to expand Network Printer. You should see "AppSocket/HP JetDirect"—don't know what to do if you don't see this.
  4. Click AppSocet/HP JetDirect and type in the hostname (or IP address—see illustration on right).
  5. Click Forward.
  6. Follow the rest of the steps which includes finding it, then mapping a driver that Ubuntu easily found for me without me providing it.

See also how this is done for Windows XP and 7.


Ubuntu: fix position of GNOME title-bar buttons

Starting with Lucid Lynx, Ubuntu uses a default GNOME window theme that places the minimize, maximize and close buttons at the extreme left hand of the title bar à la Macintosh. This is very annoying for right-handed (and "right-thinking" users). Any time you experiment with a theme change, you'll have to re-enact this solution, so this can be an on-going nuisance.

To correct the problem, follow the steps below. Incidentally, the last time I tried this was on Precise, under (ugh) Unity, and it still worked.

  1. Click on the desktop (in case some application is active that interprets the next instruction significantly).
  2. Press ALT - F2 to get the Run Application dialog.
  3. Type "gconf-editor" into the edit field and click Run.
  4. Expand the apps folder on the left.
  5. Scroll down to an expand the metacity folder.
  6. Click on general.
  7. Double-click button layout and change the value to:

    menu:minimize,maximize,close

    as shown in the illustration on the right.

This is repeated and somewhat abbreviated from other pages like http://www.howtogeek.com/howto/13535/move-window-buttons-back-to-the-right-in-ubuntu-10.04/.


apt-get not working...

If the advanced packaging tool doesn't work, maybe the configuration is screwed up. /etc/apt/apt.conf should contain

	root@russ-elite-book:/etc/apt> cat apt.conf
	Acquire::http::proxy "http://web-proxy.austin.acme.com:8080/";
	Acquire::ftp::proxy "ftp://web-proxy.austin.acme.com:8080/";
	Acquire::https::proxy "https://web-proxy.austin.acme.com:8080/";

If you're using your company's proxy. Missing one or two of these lines may impede use of apt-get.

If you're still getting complaints like:

	root@acme-buildserver:/etc/apt# apt-get update
	Err http://security.ubuntu.com precise-security InRelease

	Err http://security.ubuntu.com precise-security Release.gpg
	  Temporary failure resolving 'web-proxy.austin.acme.com'
	Err http://us.archive.ubuntu.com precise InRelease

	Err http://us.archive.ubuntu.com precise-updates InRelease

	Err http://us.archive.ubuntu.com precise-backports InRelease

	Err http://us.archive.ubuntu.com precise Release.gpg
	  Temporary failure resolving 'web-proxy.austin.acme.com'
	Err http://us.archive.ubuntu.com precise-updates Release.gpg
	  Temporary failure resolving 'web-proxy.austin.acme.com'
	Err http://us.archive.ubuntu.com precise-backports Release.gpg
	  Temporary failure resolving 'web-proxy.austin.acme.com'
	Reading package lists... Done
	W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/InRelease

	W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease

	W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease

	W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease

	W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg  Temporary failure resolving 'web-proxy.austin.acme.com'

	W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg  Temporary failure resolving 'web-proxy.austin.acme.com'

	W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg  Temporary failure resolving 'web-proxy.austin.acme.com'

	W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg  Temporary failure resolving 'web-proxy.austin.acme.com'

	W: Some index files failed to download. They have been ignored, or old ones used instead.

...then you should consider modifying /etc/resolv.conf (despite what it says).

	root@acme-buildserver:~# cat /etc/resolv.conf
	# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
	#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
	#nameserver 16.110.135.52
	#nameserver 16.110.135.51
	#search americas.acmecorp.net

Uncomment these lines is all I had to do.

Warning: Most *nicies have changed how /etc/resolv.conf works! Please see here.


Moving from DHCP to static IP addresses on Ubuntu server

CONSIDER NOT DOING IT THIS WAY! (see this way)

The reason this is an issue worth addressing is because there's no easy GUI, but only the command line.

You can make it hard (and it might need to be as in this article), or you can follow these steps (and it will almost surely work).

You must be root to do this. In this (real) example, I'm using address 16.86.192.110; yours will be different, but the patterns are the same.

  1. Edit /etc/network/interfaces. Be careful mucking about with this file except to comment out:
    iface eth0 inet dhcp

    using a # sign, and replace it with:

    #iface eth0 inet dhcp (originally DHCP; we want static IP now...) iface eth0 inet static address 16.86.192.110 netmask 255.255.255.0 network 16.86.192.0 broadcast 16.86.192.255 gateway 16.86.192.1
  2. Do not follow the article referenced above in modifying /etc/resolv.conf unless you find you need to. If this file already has nameservers, don't modify it. Also, the article says to use ifconfig /all. There is no such command and ifconfig -a won't give you anything useful. You simply must know the addresses of your DNS nameservers.
  3.  
  4. Also, do not uninstall DHCP under any circumstances. Read through the whole article including the comments if you want to understand why.
  5.  
  6. Finally, do the following. You'll get a nastygram from Linux telling you that this method is deprecated, but it should work anyway.
    $ /etc/init.d/networking restart

Whoa, here's a nasty thing...

This happened again to my Intel i5 host (tuonela) in February, 2012. The first time was summer, 2011. The same sequence of steps brought it up, but I added a little more detail, if more or less insignificant, in green here.

I was recently proposed installing Ubuntu updates including a number of obviously kernel-relevant files such as:

linux-image-2.6.32-33-generic (New install)

and other, similar stuff, plus myriad usual, mindless updates of lesser import and consequence.

I'm used to doing this; it happens every few days or week, so I went ahead. When done installing updates, it said I needed to reboot. I had stuff to do, so I kept working. When done using my system, I tossed it and left it to reboot. I came back to it a day later and it was not up. Instead, I saw a black screen and:

    error: file not found.
    grub rescue>

I typed ls (what else?) and did this:

    grub rescue> ls
    (hd0,1) (hd0,6) (hd0,5) (hd0,1)

I didn't know really what this meant, but it's not what I wanted to see. Not what I should ever see. It's more like owning a Harley-Davidson that you have to fix Saturday afternoons when all the Honda owners are out enjoying the ride.

This is what I did after Googling around a bit. (To boot from the CD, I had to get into the boot menu, F10, which wasn't successful at first. Then, I chose "ATAPI" in order to boot from the CD.)

  1. I booted from my original Lucid Lynx Live CD. (Once it came up, I clicked on Try Ubuntu 10.04 LTD in the dialog presented.)
  2. I launched a console window and typed sudo bash to get root.
  3. I prowled around looking at /mnt and /dev.
  4. I did the following:
        mount /dev/sda5 /mnt
    

    This mounted the file system on my disk. I then looked at /mnt and, sure enough, I saw my entire Linux installation. That was good.

  5. I did this:
        grub-install --root-directory=/mnt /dev/sda
    

    It's a command I stumbled upon while Googling. I mean, "File not found" and it says "grub" so I thought, the grub loader's gone missing or something during the update. Of course, it may not have anything to do with the update, but hey, what else happened that could cause it? I guess I was blindly flailing around at this point.

    The response from this command was:

        Installation finished. No error reported.
    		
  6. So, I killed the console window, bounced the machine losing the CD on the way, and prayed I wouldn't a) lose my stuff (which I might be able to get back by mounting via the Live CD) or b) have to re-install Linux plus all my tools, etc. which takes a good day plus weeks of off-and-on "oh, yeah, I gotta go get that." Not to mention I'm running Subversion and need a certificate and other tedious stuff to install.

My host came up. I'm much relieved. I hope it will come up again the next time I reboot. I'm vaguely concerned that, if I update my web server also running Lucid and that I haven't yet updated, I'll encounter the same thing. Yet, I'm somewhat sanguine about being able to fix it. Still, if I don't get it back up, it will be very annoying.

Fortunately, my host came up all over again in February, 2012. I have another host, the one that is my web server, which is a Dell Pentium IV or something. I've been afraid to reboot it. Here is what /etc/fstab has in it for that host (just in case it's useful):

/dev/sdb1   /home           reiserfs    defaults                   0   2
/dev/sda1   none            swap        sw                         0   0
/dev/fd0    /media/floppy0  auto        rw,user,noauto,exec,utf8   0   0

...and, while I'm here, I'll specify tuonela's /etc/fstab:

# / was on /dev/sda5 during installation
UUID=9260ab18-53f5-4d62-80d6-311c6a71f261 /        reiserfs notail     0       1

# /home was on /dev/sda6 during installation
UUID=a45d8227-950c-4623-91dc-403de07118fd /home    reiserfs defaults   0       2

# /home2 was on /dev/sdb1 during installation
UUID=77d2375b-5cb5-439b-b5c6-47af74cbc272 /home2   reiserfs defaults   0       2

# swap was on /dev/sda1 during installation
UUID=48ea3b2d-8248-430c-b627-f490666a361a none     swap    sw          0       0

How to set a static IP address...

...for Ubuntu server (no GUI).

CONSIDER NOT DOING IT THIS WAY! (see this way)

Edit /etc/network/interfaces as below. The static IP address is the big one in bold. Compare what's here with what you see in that file: some lines are commented out (for later restoration to original state) and some lines have been added (in italics).

	# This file describes the network interfaces available on your system
	# and how to activate them. For more information, see interfaces(5).

	# The loopback network interface
	auto lo
	iface lo inet loopback

	# The primary network interface
	auto eth0
	# iface eth0 inet dhcp          (originally DHCP; we want static IP now...)
	iface eth0 inet static
	        address   16.86.192.111
	        netmask   255.255.255.0
	        network   16.86.192.0
	        broadcast 16.86.192.255
	        gateway   16.86.192.1

Then, just bounce the server or, more delicately, bounce the Ethernet interface.

	$ ifdown eth0
	$ ifup eth0

How to set up a new launcher on the Unity desktop...

Ubuntu Natty and Oneiric made it hard to create launchers for applications that don't conform to their preferred view of the world. It's necessary to create a "desktop file" by hand in the filesystem, then use Nautilus to browse for it and, finally, drag it to the Application Launcher or elsewhere.

Creating the desktop file in the Desktop folder will result in displaying the file on the Desktop. You can just drag and drop from there.

Here is a sample desktop file for setting up an application launcher for Eclipse Indigo IDE for Java EE Developers. It's named indigo.desktop and has execute permission. The icon, exec, and icon paths point to the appropriate places in my filesystem.

	#!/usr/bin/env xdg-open

	[Desktop Entry]
	Version=1.0
	Type=Application
	Terminal=false
	Icon[en_US]=/home/russ/dev/eclipse/indigo/icon.xpm
	Name[en_US]=Indigo JEE
	Exec=/home/russ/dev/eclipse/indigo/eclipse
	Name=Indigo JEE
	Icon=/home/russ/dev/eclipse/indigo/icon.xpm

How to toss the Unity desktop for GNOME (and sanity)...

This is, only apparently as I haven't tried it yet, the command to use beginning in Oneiric to rid oneself of tyranny and all that is unholy. This broke Natty I hear.

	$ sudo apt-get install gnome-shell && apt-get remove unity

sudo once you've wrecked it...

...is pretty hard to fix. This is how I did it once. I had wrecked it by changing the privileges on /etc/sudoers, then losing my shell. Linux will refuse to let anyone in unless the privileges are:

    -r--r----- 1 root root 567 2010-12-03 08:03 /etc/sudoers

The right way to modify this file is using visudo. Note that it isn't vim, so don't muck up inadvertantly. When you exit (^X), it will ask if you want to keep your changes.

How to repair sudo

Assuming you can't find a root shell anywhere on the host (does you colleague happen to be in as root?), you'll have to shut the machine down—hard as there's no other way.

When it comes back up, you hold down a SHIFT key. You may need to press F1 or something to answer a question from the BIOS about how to come up, but get that SHIFT key down quick.

At some point, you should get a recovery menu. You're looking for an option to Drop to root shell prompt. If you don't see it, use an arrow key to scroll down. Select that.

Once it comes up, you'll be root and have a command line. Fix /etc/sudoers. Or replace it from its backed-up version.

Do a system reboot and all should be fine.


Ubuntu Update Manager failure

Once in a while, I get something like failed to fetch http //dl.google.com/linux... and the Update Manager fails. It's almost always with Google Chrome. The solution is to update the package-manager references:

$ sudo bash
[sudo] password for russ:
$ apt-get update
$ exit

...and try again.


Ubuntu RAID1 links


Experience removing Unity

After installing Precise and verifying that Unity is worthless for use by software developers who have actual work to accomplish, I experimented with removing it.

Based on advice from this page, I restored GNOME to my installation of Precise 12.04 LTS. Here's how that went. Afterward, I bounced the machine.

    root@imladris:~# add-apt-repository ppa:gnome3-team/gnome3
    You are about to add the following PPA to your system:
     Before upgrading your system to a new Ubuntu release (i.e. from Ubuntu 11.10 to 12.10), you should probably run ppa-purge ppa:gnome3-team/gnome3 first.

    === Ubuntu 12.10 (Quantal) ===
    Parts of GNOME 3.6 that won't make it into the normal Ubuntu 12.10 repositories.

    === Ubuntu 12.04 (Precise) ===
    Parts of GNOME 3.4 that didn't make it into the normal Ubuntu 12.04 repositories.

    === Ubuntu 11.10 (Oneiric) ===
    Parts of GNOME 3.2 that didn't make it into the normal Ubuntu 11.10 repositories.

    === Ubuntu 11.04 (Natty) ===
    This section of the PPA contains packages from GNOME 3.0 and their dependencies. It is considered EXPERIMENTAL \
    and MAY BREAK YOUR SYSTEM. There is no easy downgrade process.

    There are no further updates for Natty/11.04 and Oneiric/11.10!
     More info: https://launchpad.net/~gnome3-team/+archive/gnome3
    Press [ENTER] to continue or ctrl-c to cancel adding it

    gpg: keyring `/tmp/tmpCSUgJk/secring.gpg' created
    gpg: keyring `/tmp/tmpCSUgJk/pubring.gpg' created
    gpg: requesting key 3B1510FD from hkp server keyserver.ubuntu.com
    gpg: /tmp/tmpCSUgJk/trustdb.gpg: trustdb created
    gpg: key 3B1510FD: public key "Launchpad PPA for GNOME3 Team" imported
    gpg: no ultimately trusted keys found
    gpg: Total number processed: 1
    gpg:               imported: 1  (RSA: 1)
    OK
    root@imladris:~# apt-get -f update
    Ign http://extras.ubuntu.com precise InRelease
    Ign http://ppa.launchpad.net precise InRelease
    Ign http://ppa.launchpad.net precise InRelease
    Ign http://dl.google.com stable InRelease
    Get:1 http://ppa.launchpad.net precise Release.gpg [316 B]
    Get:2 http://extras.ubuntu.com precise Release.gpg [72 B]
    Hit http://dl.google.com stable Release.gpg
    Ign http://us.archive.ubuntu.com precise InRelease
    Ign http://us.archive.ubuntu.com precise-updates InRelease
    Ign http://us.archive.ubuntu.com precise-backports InRelease
    Hit http://dl.google.com stable Release
    Hit http://us.archive.ubuntu.com precise Release.gpg
    Get:3 http://us.archive.ubuntu.com precise-updates Release.gpg [198 B]
    Hit http://dl.google.com stable/main amd64 Packages
    Hit http://dl.google.com stable/main i386 Packages
    Ign http://security.ubuntu.com precise-security InRelease
    Ign http://dl.google.com stable/main TranslationIndex
    Hit http://ppa.launchpad.net precise Release.gpg
    ...

    Get:47 http://security.ubuntu.com precise-security/universe amd64 Packages [57.7 kB]
    Get:48 http://security.ubuntu.com precise-security/multiverse amd64 Packages [2,189 B]
    Get:49 http://security.ubuntu.com precise-security/main i386 Packages [206 kB]
    Get:50 http://security.ubuntu.com precise-security/restricted i386 Packages [3,968 B]
    Get:51 http://security.ubuntu.com precise-security/universe i386 Packages [58.4 kB]
    Get:52 http://security.ubuntu.com precise-security/multiverse i386 Packages [2,388 B]
    Get:53 http://security.ubuntu.com precise-security/main TranslationIndex [73 B]
    Get:54 http://security.ubuntu.com precise-security/multiverse TranslationIndex [71 B]
    Get:55 http://security.ubuntu.com precise-security/restricted TranslationIndex [71 B]
    Get:56 http://security.ubuntu.com precise-security/universe TranslationIndex [73 B]
    Ign http://extras.ubuntu.com precise/main Translation-en_US
    Hit http://security.ubuntu.com precise-security/main Translation-en
    Hit http://security.ubuntu.com precise-security/multiverse Translation-en
    Hit http://security.ubuntu.com precise-security/restricted Translation-en
    Ign http://extras.ubuntu.com precise/main Translation-en
    Hit http://security.ubuntu.com precise-security/universe Translation-en
    Ign http://ppa.launchpad.net precise/main Translation-en_US
    Ign http://ppa.launchpad.net precise/main Translation-en
    Ign http://ppa.launchpad.net precise/main Translation-en_US
    Ign http://ppa.launchpad.net precise/main Translation-en
    Fetched 2,394 kB in 4s (595 kB/s)
    Reading package lists... Done
    root@imladris:~# apt-get -f install gnome-shell gnome-tweak-tool gnome-session-fallback
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
      alacarte cups-pk-helper gir1.2-accountsservice-1.0 gir1.2-caribou-1.0 gir1.2-clutter-1.0
      gir1.2-cogl-1.0 gir1.2-coglpango-1.0 gir1.2-folks-0.6 gir1.2-gconf-2.0 gir1.2-gdesktopenums-3.0
      gir1.2-gee-1.0 gir1.2-gjsdbus-1.0 gir1.2-gkbd-3.0 gir1.2-json-1.0 gir1.2-mutter-3.0
      gir1.2-networkmanager-1.0 gir1.2-panelapplet-4.0 gir1.2-polkit-1.0 gir1.2-telepathyglib-0.12
      gir1.2-telepathylogger-0.2 gir1.2-upowerglib-1.0 gir1.2-xkl-1.0 gjs gnome-applets
      gnome-applets-data gnome-contacts gnome-icon-theme-full gnome-panel gnome-panel-data gnome-session
      gnome-session-bin gnome-session-common gnome-shell-common gnome-themes-standard
      indicator-applet-complete libcaribou-common libcaribou0 libclutter-1.0-0 libclutter-1.0-common
      libcogl-common libcogl-pango0 libcogl9 libgjs0c libmozjs185-1.0 libmutter0 libpanel-applet-4-0
      mutter-common python-gmenu
    Suggested packages:
      tomboy gnome-netstatus-applet deskbar-applet cpufrequtils evolution epiphany-browser desktop-base
    The following NEW packages will be installed:
      alacarte cups-pk-helper gir1.2-accountsservice-1.0 gir1.2-caribou-1.0 gir1.2-clutter-1.0
      gir1.2-cogl-1.0 gir1.2-coglpango-1.0 gir1.2-folks-0.6 gir1.2-gconf-2.0 gir1.2-gdesktopenums-3.0
      gir1.2-gee-1.0 gir1.2-gjsdbus-1.0 gir1.2-gkbd-3.0 gir1.2-json-1.0 gir1.2-mutter-3.0
      gir1.2-networkmanager-1.0 gir1.2-panelapplet-4.0 gir1.2-polkit-1.0 gir1.2-telepathyglib-0.12
      gir1.2-telepathylogger-0.2 gir1.2-upowerglib-1.0 gir1.2-xkl-1.0 gjs gnome-applets
      gnome-applets-data gnome-contacts gnome-icon-theme-full gnome-panel gnome-panel-data
      gnome-session-fallback gnome-shell gnome-shell-common gnome-themes-standard gnome-tweak-tool
      indicator-applet-complete libcaribou-common libcaribou0 libclutter-1.0-0 libclutter-1.0-common
      libcogl-common libcogl-pango0 libcogl9 libgjs0c libmozjs185-1.0 libmutter0 libpanel-applet-4-0
      mutter-common python-gmenu
    The following packages will be upgraded:
      gnome-session gnome-session-bin gnome-session-common
    3 upgraded, 48 newly installed, 0 to remove and 51 not upgraded.
    Need to get 27.1 MB of archives.
    After this operation, 75.4 MB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    ...
    Setting up gir1.2-mutter-3.0 (3.4.1-0ubuntu1) ...
    Setting up gir1.2-networkmanager-1.0 (0.9.4.0-0ubuntu4.1) ...
    Setting up libpanel-applet-4-0 (1:3.4.1-0ubuntu1.1) ...
    Setting up gir1.2-panelapplet-4.0 (1:3.4.1-0ubuntu1.1) ...
    Setting up gir1.2-polkit-1.0 (0.104-1ubuntu1) ...
    Setting up gir1.2-telepathyglib-0.12 (0.18.0-1ubuntu1) ...
    Setting up gir1.2-telepathylogger-0.2 (0.4.0-0ubuntu1) ...
    Setting up gir1.2-upowerglib-1.0 (0.9.15-3git1) ...
    Setting up gnome-applets-data (3.4.1-0ubuntu1) ...
    Setting up gnome-panel-data (1:3.4.1-0ubuntu1.1) ...
    Setting up gnome-panel (1:3.4.1-0ubuntu1.1) ...
    Setting up gnome-applets (3.4.1-0ubuntu1) ...
    Setting up gnome-contacts (3.4.1-1~precise1) ...
    Setting up gnome-icon-theme-full (3.4.0-0ubuntu1.1) ...
    update-alternatives: using
		/usr/share/icons/gnome/scalable/places/ubuntu-logo.svg to provide \
        /usr/share/icons/gnome/scalable/places/start-here.svg (start-here.svg) in auto mode.
    update-alternatives: warning: skip creation of
		/usr/share/icons/gnome/256x256/places/start-here.png \
        because associated file /usr/share/icons/gnome/256x256/places/ubuntu-logo.png \
        (of link group start-here.svg) doesn't exist.
    update-alternatives: warning: skip creation of
		/usr/share/icons/gnome/48x48/places/start-here.png \
        because associated file /usr/share/icons/gnome/48x48/places/ubuntu-logo.png (of link group start-here.svg) doesn't exist.
    Setting up gnome-session-bin (3.4.2.1-0ubuntu1~precise1) ...
    Setting up gnome-session-common (3.4.2.1-0ubuntu1~precise1) ...
    Setting up gnome-session (3.4.2.1-0ubuntu1~precise1) ...
    Setting up gnome-session-fallback (3.4.2.1-0ubuntu1~precise1) ...
    Setting up gnome-shell-common (3.4.1-0ubuntu2) ...
    Setting up gjs (1.32.0-1ubuntu1) ...
    Setting up gnome-shell (3.4.1-0ubuntu2) ...
    Setting up gnome-themes-standard (3.4.1-0ubuntu1.2) ...
    Setting up gnome-tweak-tool (3.4.0.1-1~precise1) ...
    Setting up indicator-applet-complete (0.5.0-0ubuntu1) ...
    Setting up libclutter-1.0-common (1.10.6-1~precise1) ...
    Setting up libcogl-common (1.10.0-0ubuntu2) ...
    Setting up cups-pk-helper (0.2.1.2-1) ...
    Processing triggers for libc-bin ...
    ldconfig deferred processing now taking place

Then, I followed the instructions for removing Unity:


    $ apt-get --yes purge unity unity-2d unity-2d-places unity-2d-panel unity-2d-spread
    $ apt-get --yes purge unity-asset-pool unity-services unity-lens-* unity-scope-*
    $ apt-get --yes purge liboverlay-scrollbar*
    $ apt-get --yes purge appmenu-gtk appmenu-gtk3 appmenu-qt
    $ apt-get --yes purge firefox-globalmenu thunderbird-globalmenu
    $ apt-get --yes purge unity-2d-common unity-common
    $ apt-get --yes purge libunity-misc4 libunity-core-5*

After the reboot, I found a bare Gnome left with nothing but a desktop. Not knowing exactly how Gnome is configured, I played around a bit after doing Ctrl Alt T to get a shell. I launched gnome-shell, but that's what was already running. I launched gnome-panel and top and bottom panels came up. Except for the ability to log out, shut down, etc., this wasn't too useful. I couldn't add launchers, for instance.

Then I googled around a bit for help, but found very little. Everyone one who's done it seems satisfied with the result, but doesn't say how to set up the desktop a) the way one's accustomed pre-Natty or b) how to make any set-up permanent. I figure I need to explore my installation of Lucid to figure a few things out.

Anyway, I restored Unity by:


    $ apt-get update
    $ apt-get install --reinstall ubuntu-desktop
    $ apt-get install unity

The following is what I see belonging to me on Lucid. I'm lost right now as to how this can be set up.

    ~ $ ps -ef | grep [g]nome
    root      1027   921  0 Nov23 ?        00:00:00 /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
    russ      1335  1255  0 Nov23 ?        00:00:09 gnome-session
    russ      1468  1335  0 Nov23 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
    russ      1471     1  0 Nov23 ?        00:00:00 /usr/bin/dbus-launch --exit-with-session gnome-session
    russ      1528     1  0 Nov23 ?        00:00:22 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
    russ      1531     1  0 Nov23 ?        00:00:00 /usr/bin/gnome-keyring-daemon --start --components=ssh
    russ      1534     1  0 Nov23 ?        00:00:00 /usr/bin/gnome-keyring-daemon --start --components=pkcs11
    russ      1535     1  0 Nov23 ?        00:00:00 /usr/bin/gnome-keyring-daemon --start --components=secrets
    russ      1625  1335  0 Nov23 ?        00:00:15 gnome-panel --sm-client-id 1022286ee8f3fb9eee133575860179933400000012250027
    russ      1630  1335  0 Nov23 ?        00:00:00 /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
    russ      1632  1335  0 Nov23 ?        00:00:26 gnome-power-manager
    russ      1722     1  0 Nov23 ?        00:00:13 gnome-screensaver
    russ      1760  1335  0 Nov23 ?        00:00:00 /usr/lib/gnome-disk-utility/gdu-notification-daemon
    russ      1773     1  0 Nov23 ?        00:00:14 /usr/lib/gnome-panel/wnck-applet --oaf-activate-iid=OAFIID:GNOME_Wncklet_Factory --oaf-ior-fd=18
    russ      1775     1  0 Nov23 ?        00:00:00 /usr/lib/gnome-applets/trashapplet --oaf-activate-iid=OAFIID:GNOME_Panel_TrashApplet_Factory --oaf-ior-fd=24
    russ      1777     1  0 Nov23 ?        00:00:00 /usr/lib/gnome-settings-daemon/gsd-locate-pointer
    russ      1909     1  0 Nov23 ?        00:00:15 /usr/lib/gnome-panel/clock-applet --oaf-activate-iid=OAFIID:GNOME_ClockApplet_Factory --oaf-ior-fd=36
    russ      1911     1  0 Nov23 ?        00:00:00 /usr/lib/gnome-panel/notification-area-applet --oaf-activate-iid=OAFIID:GNOME_NotificationAreaApplet_Factory --oaf-ior-fd=42
    russ      2933     1  0 Nov23 ?        00:00:17 gnome-terminal
    russ      2935  2933  0 Nov23 ?        00:00:00 gnome-pty-helper

Solution to adding Eclipse to the Unity task bar

See here.


Bad time in Unity top bar

For the longest time, I couldn't get Unity's top panel to show the correct time and despite apparent interface, Time and Date Settings..., it refused to change and was 6 hours slow.

What worked for me was this:

$ sudo bash
$ date -s "14 DEC 2012 12:47:00"

Then, I clicked on the top-panel where the time was displayed and it changed to the time I set.

I really hate Unity.


Unity screenshot

Recently discovered. The GNOME "Take Screenshot" utility is no longer a separate application you launch. It's accessed from the keyboard. I guess this is okay since Windows has long already offered a precedent for the first two operations. The third happens to be the one I use more frequently, in fact, very frequently.

  1. If you want to take screenshot of current workspace (whole screen, I think—I don't ever do this) press PrintScrn.
  2. If you want to take screenshot of current window press Alt + PrintScrn.
  3. If you want to define an area for the screenshot press Shift + PrintScrn. You get the cross-hairs cursor with which you can click, then drag to select the area.

Typing diacritics or accented characters

Go to Keyboard preferences (System -> Preferences -> Keyboard or to the Unity gear icon and look for Keyboard) and select a Compose key by clicking the Layout tab, and then Options, then Compose key position. Pick a key; in the image below, I've chosen to use the left-side Windows key.

This illustration is from Lucid:

This illustration is from Linux Mint 18.2 Sonya, reached by Menu → Preferences → Keyboard → Layouts → Options → Position of Compose key:

The key you choose enables you to compose an accented character at the keyboard. To accomplish this, hold the key down and then type the accent character, see Key (and name) in the chart below, followed by the Key (character) you wish to place the accent on.

For example, to get ç, hold down the left Windows key, then press , (comma), followed by c.

Here's the table:

Key (and name) Key (character) Result
'   (apostrophe) a á
e é
i í
o ó
u ú
`   (back tick) a à
e è
i ì
o ò
u ù
"   (double quote) a ä
e ë
i ï
o ö
u ü
^   (caret) a â
e ê
i î
o ô
u û
~   (tilde) n ñ
N Ñ
,   (comma) c ç
C Ç

Special: ligatures

Key sequence name) Result
COMPOSE a e æ
COMPOSE A E Æ
COMPOSE o e œ
COMPOSE O E Œ

Special: Guillements (French: « and »)

Key sequence name) Result
COMPOSE < then Shift < «
COMPOSE > then Shift > »

Special: Ezset (German: ß)

Key sequence name) Result
COMPOSE s then Shift s ß

Can't make it work?

This can take a little practice. Also, it doesn't work everywhere, but depends on where you're trying it. I can't think of a specific application that doesn't work, but I have encountered a few. What do work are: Terminal/Console command line, Facebook in Firefox/Chrome, vim/gvim.

Also, promptness seems to be an issue. For an acute e, for example, don't dilly-dally after pressing Win + '. Press e immediately. You may need to practice. For circumflex e, press and hold Shift + Win, then strike 6, then immediately e.

Really foreign characters like Han Chinese?

You're on your own there. The answer is possibly in the next section, but I always just ask a Chinese, Arabic, Indian, etc. friend to send me stuff in e-mail that I copy and paste. Since I'm incompetent in those languages, my needs are infrequent (usually only for testing software) and the trouble is adquately compensated.

Still another method: For Russian, I'm a lot more competent, but not on the keyboard yet. I usually browse for a word in Russian. For example, even if I happen to know the word, I just Google for "some-word in Russian" and see if it doesn't come up so I can copy and paste it.

More...

You can enter any character when you know its number. Do this:

  1. Press Ctrl + Shift + u; you will see u where you did that.
  2. Before typing anything else, now type the hexadecimal number corresponding to the symbol you seek.
  3. Press the Space bar to confirm.

Sample symbols and the numbers that correspond to them:

© a0
® ae
¢ a2

Clearlooks on the Unity desktop

When running the Eclipse IDE on many Ubuntu themes, in particular the one that ships as default, there are countless informational alerts, pop-up windows, etc. that are nigh unreadable due either to the choice of background or foreground text colors. Considerable experimentation with changing behavior in Eclipse preferences leads me to the conclusion that it's pointless to try to fix these as what's happening is a mixture of part Eclipse, part underlying OS presentation settings.

What has worked for me is the conversion of my Ubuntu desktop to a theme known as Clearlooks.

I've used Clearlooks now for a couple of years. It's vaguely more Windows-like, but I got over that. After all, what's important isn't how cool your Gnome desktop looks, but what you can actually do with it, how clear and fast, etc.

Unfortunately, this theme went missing with the arrival of Unity (on s'en serait douté !). It didn't take too long to figure out how to overcome this although a) the instructions seem to be given by non-engineers and therefore rather jumbled and confusing and b) the result isn't as crisp and professional looking as the original Gnome Clearlooks offering pre-Unity.

Here's how to change over. Note that noobslab is a unofficial repository that might disappear overnight. What you're doing here is installing the gnome-tweak-tool and the theme it will use to fix your desktop.

    sudo apt-get install gnome-tweak-tool
    sudo add-apt-repository ppa:noobslab/themes
    sudo apt-get update
    sudo apt-get install clearlooks-phenix

Once the installations have been accomplished, run gnome-tweak-tool from the command line. It will produce lots of warnings that you can ignore. In the resulting dialog launched, click Theme, then, for GTK+theme and Window theme, you should find the pop-up menu selector offers "Clearlooks-phenix". Choose those settings:


Salvation from Unity

On my way perhaps from Unity to Mint, I'm trying Cinnamon as an alternative to giving up on Ubuntu. This gives me back more or less what I lost from Gnome by having Unity rammed down my throat. Here's what I did to install it.

    $ sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
    $ sudo apt-get update
    $ sudo apt-get install cinnamon

After the installation, I rebooted because I happened to need to anyway, though just logging out and back in would normally have been sufficient. Logging back in, I had to click on an icon to choose the Cinnamon desktop. When I logged in the installation of Cinnamon was a fait accompli.

Then, I right-clicked the new bottom panel, chose Panel settings and then Flipped (panel at the top). You can move the icons (launchers) around by clicking and dragging them.

To add Eclipse to the top panel (as a "launcher" in Gnome parlance), I had to do fake out Cinnamon:

  1. Click Menu.
  2. Add any application that's not there and that you don't care about. (I chose Games -> Majong.)
    1. Right-click the application in the menu.
    2. Choose Add to panel.
  3. Right-click that new application's icon on the panel, choose Edit
  4. Modify all the fields appropriately to point at your new application.
  5. Dismiss the dialog and watch it appear on the panel.

For now, I like Cinnamon much better than Unity, much better.

Links


Changing hostname on Ubuntu Server

Do the following:

  1. sudo vim /etc/hostname
  2. Change name to suit and exit with update.
  3. sudo reboot*

* (I found it complicated and disappointing to muck with upstart to bounce the hostname dæmon.


Returning to sanity from Gnome 3 overlay scrollbars

Here's how to get scrollbars back if you want. I personally don't mind the overlay scrollbars themselves, but when I go to resize a window or pane, or for other reasons need to attack the edge of the window, they pop up preventing me from accomplishing what I need to do and force me into new habits as to how I attack my window edge just as they also increase the accuracy with which I must therefore attack them.

Anyway, if you care...

I tried this, it's simple, it doesn't need to install software or reconfigure stuff beyond a simple, one-command Gnome 3 setting that's totally legitimate anyway.

    $ gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false

How to unfreeze Precise

Until I was forced by the end of Lucid LTS in April 2013 to abandon it (Maverick ended the April before), I never experienced freezes on Ubuntu. It's like going back to Windows. This plus the very nasty Gnome 3/Unity interface changes, discontinued software (presumably for moving on to better things that in many cases just don't work like Remmina at the expense of tsclient), etc. has made the decision for me to move to Mint or find yet another Linux distro to follow.

It's most annoying to find one's desktop frozen and it quickly began happening about once per week.

Of all the suggested work-arounds, here's the most fool-proof I found. It is a "destructive" solution in that I lose all my work, window layout and places in my existing efforts, but the freezing almost never happens when I'm actually using my host. Nearly all the time, it happens when I go home from work or let it sit and it reaches screen-lock mode.

  1. Get a console screen outside the GUI desktop:
    	Ctrl + Alt + F2
    	
  2. Log in.
  3. Enter the following commands:
    	$ sudo stop lightdm
    	$ sudo start lightdm
    	
  4. Log back in at the normal start-up GUI screen.

Yet another solution I found and have used is:

  1. Type Alt + Sys Rq (Sys Rq is the PrtScrn key)
  2. Type the following in succession (not holding anything down):
    	R E I S U B
    	
  3. Your host will reboot after B is typed.

A solution I've seen, which may be more rude, but haven't used yet is:

  1. Type Ctrl + Alt + F1
  2. Type Ctrl + Alt + Del (just like Windows)

The upshot of this is that the Ubuntu engineers are arrogant morons who've broken the platform, won't admit it let alone walk back and fix it. They had a chance to provide a useful and meaningful alternative to Windows, but couldn't abandon their pride in knowing it all, thereby destroying Ubuntu which was the only viable Linux contender to Windows. I wonder if Microsoft didn't throw the match by paying them off. I say this in earnest.


How to sort out keys and Debian apt-get

Often, to install new software, you need a GPG key from the software supplier. This is sometimes impossible to get for various reasons. I haven't nailed down the interdependencies, but here's what I do. The example I take is installing MongoDB behind a firewall:

  1. Assume running as root...
  2. First, ensure you've got the proxy set up.
  3. Update apt-get.
  4. Install the Debian keyring.
  5. Install the software package you were trying.
  6. Verify package installation.
# export http_proxy="http://web-proxy.austin.acme.com:8080"
# apt-get update
# apt-get install debian-keyring
# apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.MM7P0gyWeK \
     --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg \
     --keyserver keyserver.ubuntu.com --recv 7F0CEB10
gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com
gpg: key 7F0CEB10: public key "Richard Kreuter " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
# apt-get install mongodb-10gen
.
.
.
# dpkg --list | grep mongodb
iF  mongodb-10gen                    2.4.5                            An object/document-oriented database

Here's another example:

tol-galen apt # apt-get update
Ign http://dl.google.com stable InRelease
Ign http://extra.linuxmint.com qiana InRelease
.
.
.
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8771ADB0816950D8
tol-galen apt # gpg --keyserver pgpkeys.mit.edu --recv-key 8771ADB0816950D8
gpg: directory `/home/russ/.gnupg' created
gpg: new configuration file `/home/russ/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/russ/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/russ/.gnupg/secring.gpg' created
gpg: keyring `/home/russ/.gnupg/pubring.gpg' created
gpg: requesting key 816950D8 from hkp server pgpkeys.mit.edu
gpg: /home/russ/.gnupg/trustdb.gpg: trustdb created
gpg: key 816950D8: public key "Launchpad HandBrake Snapshots" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
tol-galen apt # gpg -a --export 8771ADB0816950D8 | apt-key add -
OK

How to modify colors got with ls
  1. Instantiate a copy of the existing directory colors:
        $ dircolors -p > ~/.dir_colors
    
  2. Make your modifications by comparison with what's already there. For example, to get Ruby source files to come out in bold purple, add the following line:
        .rb 01;35
    
  3. Set up to have these evaluated when a new shell is created:
        $ eval `dircolors ~/.dir_colors`
    
  4. Kill your shell and get a new one or issue the previous command in the current one. If you have trouble seeing the effect, try this, but really, your ~/.bashrc should already be doing it:
        $ ls --color=auto
    

Installing Audacious Audio Player on Ubuntu/Mint

To get the latest, add this PPA (personal package archive) and perform all other commands as root:

$ add-apt-repository ppa:nilarimogard/webupd8

Then,

$ apt-get update

Then upgrade as you wish using GUI or command-line:

$ apt-get upgrade

You may find that there are missing dependencies and have to do this:

$ sudo apt-get -f install

How to change hostname on Ubuntu/Mint

Do this as root:

$ vim /etc/hostname (change here)
$ hostname new-name
$ vim /etc/hosts (change here)

Until host is rebooted, errors such as this will likely plague you. (pujolla happens to be the old hostname in this example.)

~ $ gvim poop
_IceTransSocketUNIXConnect: Cannot connect to non-local host pujolla
_IceTransSocketUNIXConnect: Cannot connect to non-local host pujolla
_IceTransSocketUNIXConnect: Cannot connect to non-local host pujolla
_IceTransSocketUNIXConnect: Cannot connect to non-local host pujolla

(gvim:11715): GnomeUI-WARNING **: While connecting to session manager:
Could not open network socket.

Microsoft Natural Ergonomic Keyboard on Linux

Specifically, how to remap the slider. I found this post about activating the between-keys zoom slider and using for scrolling instead of zooming:

http://rebelliard.com/enabling-scrolling-using-the-microsoft-natural-ergonomic-keyboard-4000s-zoom-slider-on-ubuntu-12-10/

The first (and easiest) solution worked for me on Linux Mint 13 (Ubuntu). For the second solution, which I didn't implement, but which I had already seen elsewhere, I had to go all the way to event7 before getting a reaction from the evtest application.


"Starting configure network device security [fail]"

This message may happen at boot-up, then you'll see, "Waiting for network configuration" and "Waiting for networkconfiguration up to 60 more seconds". This happens because you mucked with /etc/network/interfaces to change from DHCP to a static IP address and messed up something. For example, did you mindlessly create an interface eth0 when it was originally p4p1? Or, did you misspell something else?

Good thing you copied the iface line and commented it out so you'd see what used to the there, n'est-ce pas ?


Failure to ping outside of LAN, ping google.com

This happened to me using Ubuntu 14.04 LTS Trusty Tahr newly installed. apt-get update wouldn't work and, diagnosing that, I found I couldn't ping Google.

The problem was that I needed to add to /etc/network/interfaces thus:


root@tol-eressea:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto p4p1
#iface p4p1 inet dhcp
iface p4p1 inet static
    address   192.168.0.101
    netmask   255.255.255.0
    gateway   192.168.0.1
    dns-nameservers 192.168.0.1

This was created by my switching from DHCP to a static IP address. The solution fixed apt-get update.


How to disable automatic updates on Ubuntu server

http://ask.xmodulo.com/disable-automatic-updates-ubuntu.html


Ubuntu Server 14.04 Trusty Tahr failed to reboot adding swap...

On login, the OS notified that a reboot was required. Eventually, I acquiesced, but it didn't come back up.

I saw it hung on a message, "Adding [some 7-digit amount of memory] swap on /dev/mapper/tol-eressea..."

In the end, I simple did a hard reset and the server came up. I figure something from an Ubuntu update got in the way and, luckily it came back up. I'm leery, but what can I do?

I Googled for this problem using search string, "ubuntu server 14.04 adding swap on /dev/mapper," and found the following links discussing it or something similar. Note: I did not encrypt my swap (or any other) partition.

http://serverfault.com/questions/546079/ubuntu-server-hanging-on-adding-swap
http://askubuntu.com/questions/456194/swap-not-being-detected-on-14-04-lts
http://askubuntu.com/questions/462775/swap-not-working-on-clean-14-04-install-using-encrypted-home
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=ubuntu%20server%2014.04%20adding%20swap%20on%20%2Fdev%2Fmapper
http://askubuntu.com/questions/56843/could-not-mount-dev-mapper-cryptswap1
http://askubuntu.com/questions/341979/what-to-do-about-the-disk-drive-for-dev-mapper-cryptswap1-is-not-ready-yet-or

Install ssh server...

To a host that doesn't accept ssh/port 22 requests, add the ssh server:

# apt-get install openssh-server

How to remove offending RSA key
Warning: the ECDSA host key for 'acme-roadster.com' differs from the key for the IP address '164.138.23.11'
Offending key for IP in /home/russ/.ssh/known_hosts:10
Matching host key in /home/russ/.ssh/known_hosts:1
Are you sure you want to continue connecting (yes/no)? yes

Run this command to delete 10th line in your known_hosts file:

sed -i '10d' ~/.ssh/known_hosts

Or use ssh-keygen:

ssh-keygen -R git.mywebsite.ir

How to remove offending RSA key

Once I tried to install Apache2 utils and I found I'd run out of space on my boot partition. This was a new problem to me. Googling around, I found a radical solution and, ill-advisedly, followed it.

root@tol-eressea:/ # apt-get install apache2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-3.13.0-43-generic : Depends: linux-image-3.13.0-43-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-3.13.0-43-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
root@tol-eressea:/ # apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  avahi-utils libnss3-1d linux-image-3.13.0-24-generic
  linux-image-3.13.0-32-generic linux-image-3.13.0-33-generic
  linux-image-3.13.0-34-generic linux-image-3.13.0-35-generic
  linux-image-3.13.0-36-generic linux-image-3.13.0-39-generic
  linux-image-3.13.0-43-generic linux-image-extra-3.13.0-24-generic
  linux-image-extra-3.13.0-32-generic linux-image-extra-3.13.0-33-generic
  linux-image-extra-3.13.0-34-generic linux-image-extra-3.13.0-35-generic
  linux-image-extra-3.13.0-36-generic linux-image-extra-3.13.0-39-generic
  linux-image-extra-3.13.0-43-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-generic linux-headers-3.13.0-44 linux-headers-3.13.0-44-generic
  linux-headers-generic linux-image-3.13.0-43-generic
  linux-image-3.13.0-44-generic linux-image-extra-3.13.0-44-generic
  linux-image-generic
Suggested packages:
  fdutils linux-doc-3.13.0 linux-source-3.13.0 linux-tools
The following NEW packages will be installed:
  linux-headers-3.13.0-44 linux-headers-3.13.0-44-generic
  linux-image-3.13.0-43-generic linux-image-3.13.0-44-generic
  linux-image-extra-3.13.0-44-generic
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic
3 upgraded, 5 newly installed, 0 to remove and 101 not upgraded.
11 not fully installed or removed.
Need to get 61.5 MB/76.6 MB of archives.
After this operation, 313 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-3.13.0-44-generic amd64 3.13.0-44.73 [15.1 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-extra-3.13.0-44-generic amd64 3.13.0-44.73 [36.7 MB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-generic amd64 3.13.0.44.51 [1,786 B]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-generic amd64 3.13.0.44.51 [2,800 B]
Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-headers-3.13.0-44 all 3.13.0-44.73 [8,884 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-headers-3.13.0-44-generic amd64 3.13.0-44.73 [718 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-headers-generic amd64 3.13.0.44.51 [2,792 B]
Fetched 61.5 MB in 4s (12.9 MB/s)
Selecting previously unselected package linux-image-3.13.0-44-generic.
(Reading database ... 338030 files and directories currently installed.)
Preparing to unpack .../linux-image-3.13.0-44-generic_3.13.0-44.73_amd64.deb ...
Done.
Unpacking linux-image-3.13.0-44-generic (3.13.0-44.73) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-3.13.0-44-generic_3.13.0-44.73_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-3.13.0-44-generic' to '/boot/vmlinuz-3.13.0-44-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-44-generic /boot/vmlinuz-3.13.0-44-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-44-generic /boot/vmlinuz-3.13.0-44-generic
Selecting previously unselected package linux-image-extra-3.13.0-44-generic.
Preparing to unpack .../linux-image-extra-3.13.0-44-generic_3.13.0-44.73_amd64.deb ...
Unpacking linux-image-extra-3.13.0-44-generic (3.13.0-44.73) ...
Preparing to unpack .../linux-generic_3.13.0.44.51_amd64.deb ...
Unpacking linux-generic (3.13.0.44.51) over (3.13.0.43.50) ...
Preparing to unpack .../linux-image-generic_3.13.0.44.51_amd64.deb ...
Unpacking linux-image-generic (3.13.0.44.51) over (3.13.0.43.50) ...
Selecting previously unselected package linux-headers-3.13.0-44.
Preparing to unpack .../linux-headers-3.13.0-44_3.13.0-44.73_all.deb ...
Unpacking linux-headers-3.13.0-44 (3.13.0-44.73) ...
Selecting previously unselected package linux-headers-3.13.0-44-generic.
Preparing to unpack .../linux-headers-3.13.0-44-generic_3.13.0-44.73_amd64.deb ...
Unpacking linux-headers-3.13.0-44-generic (3.13.0-44.73) ...
Preparing to unpack .../linux-headers-generic_3.13.0.44.51_amd64.deb ...
Unpacking linux-headers-generic (3.13.0.44.51) over (3.13.0.43.50) ...
Preparing to unpack .../linux-image-3.13.0-43-generic_3.13.0-43.72_amd64.deb ...
Done.
Unpacking linux-image-3.13.0-43-generic (3.13.0-43.72) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-3.13.0-43-generic_3.13.0-43.72_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-3.13.0-43-generic' to
 '/boot/vmlinuz-3.13.0-43-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-43-generic /boot/vmlinuz-3.13.0-43-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-43-generic /boot/vmlinuz-3.13.0-43-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.13.0-44-generic_3.13.0-44.73_amd64.deb
 /var/cache/apt/archives/linux-image-3.13.0-43-generic_3.13.0-43.72_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

(Checked out cannot copy extracted data for ... failed to write (No space left on device).)


root@tol-eressea:/ # df -h
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/tol--eressea--vg-root  278G   38G  227G  15% /
none                               4.0K     0  4.0K   0% /sys/fs/cgroup
udev                               7.7G  4.0K  7.7G   1% /dev
tmpfs                              1.6G  684K  1.6G   1% /run
none                               5.0M     0  5.0M   0% /run/lock
none                               7.7G  4.0K  7.7G   1% /run/shm
none                               100M     0  100M   0% /run/user
/dev/sdc1                          236M  233M     0 100% /boot
movies                             1.8T  394G  1.5T  22% /plex-movies
television                         3.6T  387G  3.2T  11% /plex-television
root@tol-eressea:/ # df -l
Filesystem                         1K-blocks      Used  Available Use% Mounted on
/dev/mapper/tol--eressea--vg-root  291071152  38944752  237317724  15% /
none                                       4         0          4   0% /sys/fs/cgroup
udev                                 8048156         4    8048152   1% /dev
tmpfs                                1611880       684    1611196   1% /run
none                                    5120         0       5120   0% /run/lock
none                                 8059396         4    8059392   1% /run/shm
none                                  102400         0     102400   0% /run/user
/dev/sdc1                             240972    237731          0 100% /boot
movies                            1915745664 412347904 1503397760  22% /plex-movies
television                        3831494784 405139840 3426354944  11% /plex-television
root@tol-eressea:/ # dpkg -l | grep -G "linux.*image.*"
ii  linux-image-3.13.0-24-generic       3.13.0-24.47   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-32-generic       3.13.0-32.57   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-33-generic       3.13.0-33.58   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-34-generic       3.13.0-34.60   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-35-generic       3.13.0-35.62   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-36-generic       3.13.0-36.63   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-37-generic       3.13.0-37.64   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
iF  linux-image-3.13.0-39-generic       3.13.0-39.66   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
iF  linux-image-3.13.0-40-generic       3.13.0-40.69   amd64  Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-24-generic 3.13.0-24.47   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-32-generic 3.13.0-32.57   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-33-generic 3.13.0-33.58   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-34-generic 3.13.0-34.60   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-35-generic 3.13.0-35.62   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-36-generic 3.13.0-36.63   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-37-generic 3.13.0-37.64   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
iU  linux-image-extra-3.13.0-39-generic 3.13.0-39.66   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
iU  linux-image-extra-3.13.0-40-generic 3.13.0-40.69   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
iU  linux-image-extra-3.13.0-43-generic 3.13.0-43.72   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
iU  linux-image-extra-3.13.0-44-generic 3.13.0-44.73   amd64  Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
iU  linux-image-generic                 3.13.0.44.51   amd64  Generic Linux kernel image
root@tol-eressea:/ # dpkg -P linux-image{,-extra}-3.13.0-{24,32,33,34,35,36}-generic
...much output...
root@tol-eressea:/ # df -h
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/tol--eressea--vg-root  278G   37G  228G  14% /
none                               4.0K     0  4.0K   0% /sys/fs/cgroup
udev                               7.7G   12K  7.7G   1% /dev
tmpfs                              1.6G  684K  1.6G   1% /run
none                               5.0M     0  5.0M   0% /run/lock
none                               7.7G  4.0K  7.7G   1% /run/shm
none                               100M     0  100M   0% /run/user
/dev/sdc1                          236M   57M  167M  26% /boot
movies                             1.8T  394G  1.5T  22% /plex-movies
television                         3.6T  387G  3.2T  11% /plex-television
Filesystem                         1K-blocks      Used  Available Use% Mounted on
root@tol-eressea:/ # df -l
/dev/mapper/tol--eressea--vg-root  291071152  37763704  238498772  14% /
none                                       4         0          4   0% /sys/fs/cgroup
udev                                 8048156        12    8048144   1% /dev
tmpfs                                1611880       684    1611196   1% /run
none                                    5120         0       5120   0% /run/lock
none                                 8059396         4    8059392   1% /run/shm
none                                  102400         0     102400   0% /run/user
/dev/sdc1                             240972     57766     170765  26% /boot
movies                            1915745664 412347904 1503397760  22% /plex-movies
television                        3831494784 405139840 3426354944  11% /plex-television
root@tol-eressea:/ # dpkg -P linux-headers-3.13.0-{24,32,33,34,35,36}
(just didn't work because of dependencies)

apt-get Could not get lock /var/lib/dpkg/lock - open (11. Resource temporarily unavailable)

Don't delete the suggested lock; likely, this won't do it.

Instead use ps -ef | grep [a]pt to see what process is using apt-get and kill that process.


Ubuntu server hostname change...

Edit /etc/hostname and /etc/hosts and modify the name, then restart. Better still, see here.


How to install static IP address during Ubuntu Server installation

CONSIDER NOT DOING IT THIS WAY! (see this way)

I'm useless at this. Nevertheless, here's what I did last time I tried it.

en0p3:
subnet:         192.168.23.0/24 (see CIDR IP addressing)
address:        192.168.23.101
gateway:        192.168.23.1
nameserver:     192.168.23.1,8.8.8.8,8.8.4.4
search domains:

How to set static IP address on Ubuntu Server 22.04...

CONSIDER NOT DOING IT THIS WAY! (see this way)

  1. Discover network interface name; here, it appears to be enp0s25.
    ubuntu2204:~$ sudo ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 18:66:da:3d:5a:3f brd ff:ff:ff:ff:ff:ff
        inet 192.168.0.128/24 metric 100 brd 192.168.0.255 scope global dynamic enp0s25
           valid_lft 4559sec preferred_lft 4559sec
        inet6 fe80::1a66:daff:fe3d:5a3f/64 scope link
           valid_lft forever preferred_lft forever
    3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
        link/ether 02:42:9e:4a:d8:2d brd ff:ff:ff:ff:ff:ff
        inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
           valid_lft forever preferred_lft forever
    
  2. Discover also the currently configured routes before proceeding:
    ubuntu2204:~$ sudo ip route s
    default via 192.168.0.1 dev enp0s25 proto dhcp src 192.168.0.128 metric 100
    8.8.4.4 via 192.168.0.1 dev enp0s25 proto dhcp src 192.168.0.128 metric 100
    8.8.8.8 via 192.168.0.1 dev enp0s25 proto dhcp src 192.168.0.128 metric 100
    172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
    192.168.0.0/24 dev enp0s25 proto kernel scope link src 192.168.0.128 metric 100
    192.168.0.1 dev enp0s25 proto dhcp scope link src 192.168.0.128 metric 100
    
  3. Discover the current IP gateway before proceeding. This is supposed to happen using:
    ubuntu2204:~$ sudo systemd-resolved | grep Current
    systemd-resolved: command not found
    
    but my system doesn't off this command (or systemd-resolve if you think it's supposed to be spelled that way).

  4. Create (or edit) the network configuration file under /etc/netplan.
    ubuntu2204:~$ ll /etc/netplan
    total 12
    drwxr-xr-x   2 root root 4096 Jun 21 20:20 .
    drwxr-xr-x 108 root root 4096 Jun 21 22:54 ..
    -rw-r--r--   1 root root  118 Jun 21 20:20 00-installer-config.yaml
    ubuntu2204:~$ sudo vi /etc/netplan/01-netcfg.yaml
    
  5. Add this (to what's going to be a new file in my case). I have decided that my static IP address will be 192.168.0.108 and that my gateway address is 192.168.0.1:
    network:
      version: 2
      renderer: NetworkManager
      ethernets:
          enp0s25:
            dhcp4: false
            addresses:
              - 192.168.0.108/24 (see CIDR IP addressing)
            nameservers:
              addresses:
                - 8.8.8.8
                - 8.8.4.4
            gateway4: 192.168.0.1
    
    where:
    • enp0s25 is the network interface name.
    • addresses is used to configure IPv4 address on an interface. Make sure to define CIDR. You can add multiple addresses here.
    • nameservers are the name servers to use. 8.8.8.8 and 8.8.4.4 are safe to use since they're Google's.
    • gateway4 is the gateway on your LAN.
  6. In my case, the original network interface configuration plan had this:
    # This is the network config written by 'subiquity'
    network:
      ethernets:
        enp0s25:
          dhcp4: true
      version: 2
    
  7. With my new configuration (no need apparently to rename the old one), I can try it out to see if it works. First, I pop up a different console and get in.
    ubuntu2204:~$ ll
    total 16
    drwxr-xr-x   2 root root 4096 Jun 22 17:28 ./
    drwxr-xr-x 108 root root 4096 Jun 21 22:54 ../
    -rw-r--r--   1 root root  118 Jun 21 20:20 00-installer-config.yaml.original
    -rw-r--r--   1 root root  233 Jun 22 17:27 01-netcfg.yaml
    ubuntu2204:~$ sudo netplan try
    Do you want to keep these settings?
    
    Press ENTER before the timeout to accept the new configuration
    
    Changes will revert in   90 seconds (this counts down...)
    
    In that other console, I do two things while the trial is going on:
    ubuntu2204:~$ ip address|grep enp0s25
    2: enp0s25:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
        inet 192.168.0.108/24 brd 192.168.0.255 scope global enp0s25
        inet 192.168.0.128/24 metric 100 brd 192.168.0.255 scope global secondary dynamic enp0s25
    ubuntu2204:~$ ping google.com
    PING google.com (142.250.189.238) 56(84) bytes of data.
    64 bytes from nuq04s39-in-f14.1e100.net (142.250.189.238): icmp_seq=36 ttl=115 time=22.9 ms
    64 bytes from nuq04s39-in-f14.1e100.net (142.250.189.238): icmp_seq=37 ttl=115 time=17.6 ms
    64 bytes from nuq04s39-in-f14.1e100.net (142.250.189.238): icmp_seq=38 ttl=115 time=17.6 ms
    ^C
    --- google.com ping statistics ---
    100 packets transmitted, 19 received, 81% packet loss, time 100922ms
    rtt min/avg/max/mdev = 17.378/17.946/22.948/1.279 ms
    root@russ-microservices:/home/russ# ifconfig
      .
      .
      .
    enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.0.108  netmask 255.255.255.0  broadcast 192.168.0.255
            inet6 fe80::1a66:daff:fe3d:5a3f  prefixlen 64  scopeid 0x20
            ether 18:66:da:3d:5a:3f  txqueuelen 1000  (Ethernet)
            RX packets 18996  bytes 2073556 (2.0 MB)
            RX errors 0  dropped 3  overruns 0  frame 0
            TX packets 2859  bytes 476035 (476.0 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 20  memory 0xf7100000-f7120000
      .
      .
      .
    
    These demonstrate to me that my network is functioning.
  8. To activate this new plan, I simply press Enter before the trial expires or:
    ubuntu2204:~$ sudo netplan apply
    

How to install Ubuntu Server updates via command line

When you log into Ubuntu Server, you likely see something like:

59 packages can be updated.
2 packages are security updates.

Do this:

  1. Update the package lists of what needs to be upgraded:
    # apt-get update
    
  2. Upgrade packages. You can update some and refuse to upgrade others, but to accept to upgrade all so you do not have to confirm, use the -y option:
    # apt-get upgrade [-y]
    
  3. Install available updates for the release you already have installed. This may install new packages or remove existing packages if that's necessary to satisfy dependencies:
    # apt-get dist-upgrade [-y]
    
  4. Remove from your system any former dependencies that are no longer depended upon by anything:
    # apt-get autoremove [-y]
    
  5. Clear out the local repository of retrieved package files that can no longer be downloaded and are useless.
    # apt-get autoclean [-y]
    

How to enable the universe repository in Ubuntu 18

This is desired because nice utilities like tree are found within and no longer reachable by default.

# add-apt-repository universe
# apt-get install tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  tree
	0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
	Need to get 40.7 kB of archives.
	After this operation, 105 kB of additional disk space will be used.
	Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 tree amd64 1.7.0-5 [40.7
	kB]
	Fetched 40.7 kB in 1s (76.3 kB/s)
	Selecting previously unselected package tree.
	(Reading database ... 106079 files and directories currently installed.)
	Preparing to unpack .../tree_1.7.0-5_amd64.deb ...
	Unpacking tree (1.7.0-5) ...
	Setting up tree (1.7.0-5) ...
	Processing triggers for man-db (2.8.3-2) ...

How to juggle certificates in Ubuntu (and Mint)

Debian distributions like their certificates under /usr/local/share/ca-certificates. This is how it's done:

  1. The operating system already comes with well known certificates (as do browsers). It is somewhat unusual to have to add any. Most often this happens when dealing with some resource that's both informal and not widespread, like a private repository at work. Following is how to make additional certificates available to the host at large.
  2. There are two types of certificates:
    • Normally, certificates are placed on the path /usr/local/share/ca-certificates.
    • According to best practice, root certificates are placed in a subdirectory (name is not important) underneath /usr/local/share/ca-certificates. The permissions on this subdirectory should be 755 (drwxr-xr-x). Note that this is a practice only: it's not necessary.
  3. Copy the certificate to /usr/local/share/ca-certificates. It's also equivalent to use the path /usr/share/ca-certificates; in fact, Mozilla (Firefox and Thunderbird) put their certificates on that path.
  4. The certificate must bear the extension, .crt and should have permissions 644 (-rw-r--r--).
  5. Update the host's certificates (this is the part that works differently depending on your Linux distribution):
    # update-ca-certificates
    Updating certificates in /etc/ssl/certs...
    0 added, 0 removed; done.
    Running hooks in /etc/ca-certificates/update.d...
    
    done.
    done.
    
  6. To remove a certificate, do this:
    1. Remove the certificate file from the filesystem.
    2. Update certificates thus:
      # update-ca-certificates --fresh
      Clearing symlinks in /etc/ssl/certs...
      done.
      Updating certificates in /etc/ssl/certs...
      134 added, 0 removed; done.
      Running hooks in /etc/ca-certificates/update.d...
      
      Replacing debian:ACCVRAIZ1.pem
      Replacing debian:AC_RAIZ_FNMT-RCM.pem
      Replacing debian:Actalis_Authentication_Root_CA.pem
      ...
      Replacing debian:thawte_Primary_Root_CA_-_G2.pem
      Replacing debian:thawte_Primary_Root_CA_-_G3.pem
      done.
      done.
      
  7. If you have a service that depends on the new certificate, like Docker, you will need to bounce it:
    # systemctl restart docker.service
    

Certificates on other Linux distributions like CentOS...

I'm more of an Ubuntu and Mint (Debian) kind of guy, nevertheless, here's how to do the same thing above on CentOS (Red Hat):

  1. Drop the certificate into /etc/pki/ca-trust/source/anchors (high priority) or /usr/share/pki/ca-trust-sources/anchors (low priority).
  2. Perform these commands:
    # update-ca-trust enable
    # update-ca-trust
    
  3. Verify that the certificate is added/updated successfully by looking at file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem.
  4. If you have a service that depends on the new certificate, like Docker, you will need to bounce it.

How to force Ubuntu (and Mint) updates that are being held back

You see this:

root@moria:~# apt-get update && apt-get upgrade -y
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
	0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

The best and safest way is to do this (if you really want the updates:

root@moria:~# apt-get --with-new-pkgs upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-4.15.0-48 linux-headers-4.15.0-48-generic linux-image-4.15.0-48-generic
  linux-modules-4.15.0-48-generic linux-modules-extra-4.15.0-48-generic
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic
3 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 65.7 MB of archives.
After this operation, 334 MB of additional disk space will be used.
...

...additional security updates can be applied with ESM Apps

Ubuntu Pro was made available on 26 January 2023 from which day users are notified that they can get security packages for ESM applications using an Ubuntu Pro account.

Do this to quiet most of it down:

$ sudo mkdir /etc/apt/apt.conf.d/off
$ sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/off

Fonts (Korean, for example) on Ubuntu...

I inadvertently destroyed Korean fonts on Linux Mint (but, it's just Ubuntu, right?). My daily mailing for Korean vocabulary from Transparent Language was reduced to "boxes" instead of characters.

When this happens, you might find that /usr/share/fonts/truetype/nanum is more or less empty. I corrected this by doing

  1. (At the left end of the Panel...)
  2. Start.
  3. Software Manager.
  4. "nanum" in the Search field.
  5. Choose and install Fonts-nanum.
  6. Choose and install Fonts-nanum-coding (unnecessary unless fixed-width needed for input).
  7. Choose and install Fonts-nanum-eco.
  8. Choose and install Fonts-nanum-extra.