dpkg

How To Install Ubuntu 16.04 To A USB Flash Drive

I’m pretty much done with Ubuntu. Really just use Debian. But if you’re ever in a very weird situation where some very messy stuff barely doesn’t work with Debian and the people who set up that messy stuff swear it works in Ubuntu, it may be necessary. For me, the least icky way to run native Ubuntu without it having any impact at all on my real systems is to use a USB flash drive for the complete system. Yes, instead of a hard drive. I’m not talking about a Live CD system (which we will actually use a bit for installation). I’m talking about running the whole OS as if the USB flash drive was the hard drive. It not only works, it works really pretty well. Sometimes you get some odd hanging for a couple of seconds but I’ve run this kind of system hundreds of interactive hours and never had a problem, even playing big Steam games with absolutely no hard drive use at all.

Here is what you need.

  • Any working Linux system with two free USB ports and 1.5GB free disk space.

  • A USB flash drive at least 2GB for the installer.

  • A USB flash drive at least 10GB for the Ubuntu installation.

    • Between 5GB and 6GB for Ubuntu itself.

    • ROS adds another 3GB.

Here is the step by step process I use.

  • Boot your working Linux.

  • Obtain Ubuntu from a terminal.

    wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso
  • Note what drives are there, e.g. /dev/sda, /dev/sdb, etc. with this command.

    lsblk
  • Insert your blank USB Flash drive and run it again.

    lsblk
  • Check what /dev/sd? just showed up. Don’t mess this up! (I’m assuming /dev/sdg is the blank flash drive. YMMV) This will be the installer’s drive.

  • Put the image on the installer drive.

    sudo dd if=ubuntu-16.04.3-desktop-amd64.iso of=/dev/sdg status=progress
  • This is optional but never hurts.

    sync
  • Reboot.

  • Make sure the BIOS boots from the USB flash drive you just copied the Ubuntu installer onto. Need a BIOS boot select hotkey hint?

  • Choose "Try Ubuntu" for the live CD interface.

  • Ctrl-Alt-T to get a terminal.

    lsblk
  • Again note what drives are there.

  • Insert target USB drive.

  • Close stupid file browser window if one pops up.

    lsblk
  • Note the new drive’s letter. I’ll assume /dev/sdc. If there’s a mountable system (which will be overwritten!!!) on this flash drive, it is probably automounted. No big deal; just keep that in mind.

  • Click second icon from top on left column of icons, Install Ubuntu 16.04 LTS.

  • Choose language (e.g. English).

  • Connect to a network. Maybe enter wifi AP and password if needed.

  • Check Download updates while installing Ubuntu. Might as well.

  • Check Install thrid-party software….

  • Click Yes to let installer unmount the automounted /dev/sdc target drive.

  • IMPORTANT! For Installation type, choose Something else. Don’t let it overwrite your main system!

  • Select /dev/sdc (Not /dev/sdc1 if that exists).

  • Choose New Partition Table… since this flash drive will be rebuilt.

  • Continue to confirm.

  • There should now be some free space indented under the /dev/sdc.

  • Double click that.

  • Leave defaults (full size, primary, beginning, ext4)

  • Select the root directory (/) for the mount point from the pulldown.

  • That /dev/sdc1 partition should be the only one with a mount point or checked Format?.

  • On the pulldown for Device for bootloader choose /dev/sdc, i.e. the new flash drive to be installed on.

  • Click Install Now

  • Double check that nothing is going to be formatted that you care about.

  • It’s ok if a swap partition on some other drive gets reformatted.

  • Click Continue

  • Choose timezone, Continue

  • Choose keyboard layout, Continue

  • Create user. (I usually create a fake user so I can delete and redo it later with useradd to get the UID to match my other systems.)

  • Start the install.

  • Now you wait. Quite a while. Like a normal Windows update amount of time.

  • Wait for the Installation has finished.

  • Just kill the power. No need for a clean shutdown.

  • Remove installer’s flash drive.

  • Reboot with target drive still in place.

  • You should now be running Ubuntu 16.04 LTS. Time to fix its sorry ass.

  • Log in.

  • Open a terminal with Ctrl-Alt-T. Do this stuff. Confirm where necessary.

    sudo apt-add-repository ppa:ubuntu-mate-dev/xenial-mate
    sudo apt-get update
    sudo apt-get install mate
    sudo apt-get purge libreoffice-core
    sudo apt-get dist-upgrade
  • Reboot.

  • At the display manager login, click the circle icon to the right of the user name. Choose MATE instead of "Ubuntu (Default)".

  • Log in again.

At this point you are ready to use the system. It can be helpful to customize Mate as I describe in my Debian notes.

New Fangled Ubuntu

One is not supposed to need notes with Ubuntu. It’s all supposed to just work and if it doesn’t, it’s supposed to be obvious how to fix it. But as Ubuntu struggles desperately to debase itself enough to be acceptable to normal people, it leaves me personally quite irritated. I am not alone.

The main problem to start with is the Unity window manager or maybe it’s a window manager theme on a window manager on a windowing system. Confused yet? This Unity is clearly designed for tablets. That may be fine if you have a tablet, but if you don’t, it’s like putting motorcycle handlebars in place of a car’s steering wheel.

Upstart

OMG. What a mess.

So how do you disable a service?

It is painful to think about so just check out this good explanation.

Un-Unify

The first thing to do is to get rid of Unity. One possibility is this.

sudo apt-get install xfce4

But I now am pretty convinced that this is the superior solution.

sudo apt install mate-desktop-environment-core
sudo apt install mate-desktop-environment
sudo apt install mate-desktop-environment-extras
sudo apt install lightdm

I hate things wasting valuable screen real estate, especially on the more limited Y pixels. The main reason to get rid of Unity is that it insists on wasting the top of your screen with a stupid Mac-inspired bar. The top "panel" as it’s officially called is easier to deal with in xfce4. With xfce4 just right click on an empty part of it, then select "Panel" and then "Panel Preferences". From there choose "Automatically show and hide the panel". This is the same in Mate and sufficiently solves the problem. There may be a way to get rid of it completely, but if you’re that serious, look into ratpoison (or awesome or dwm).

The bottom panel is easy to get rid of in Mate. I don’t mind the workplace switcher which shows if I have things open in other windows (hidden until bidden, of course). I add that to the top bar and then right clicking on the bottom bar allows a "Delete this panel". Problem solved.

Check the Debian notes for more on smooth dealings with Mate.

Sensible keyboard shortcuts are now under "System→Control Center→Keyboard Shortcuts".

How do I get an SSH agent? The old fashioned way, I guess.

Annoyances

nano

Gah! If you are a skilled programmer then you’ll want to abolish this debilitating editor:

sudo apt-get remove nano

Put this in ${HOME}/.bashrc:

export EDITOR=/usr/bin/vim

If that doesn’t work, do things like:

alias visudo='sudo EDITOR=/usr/bin/vim /usr/sbin/visudo'

There are smarter ways to do this, but they have to keep getting reset when you install a new OS. This solution is based on your own private settings.

Ubuntu One

WTF? No thanks.

sudo apt-get purge ubuntuone-client python-ubuntuone-storage*

This may screw some things up in your current session. Reboot.

Cut/Paste

A very annoying thing about Unity is that they have destroyed (with no option to fix) the very powerful and easy way that cut and paste works. Moving to xfce4 almost solves the problem but my mouse, the Logitech Marble does not have a useful 3rd button. Many trackpads suffer this problem too. To get the left and right buttons held together to represent a center click, I had to install gpointing-device-settings. Run this and select "Use middle button emulation". I have had some trouble getting this to survive reboots.

Another option is to install:

sudo apt-get install xkbset

Then use xev to figure out what’s what and then map things the Linux way, i.e. the way your fussy self wants them mapped. My trackball’s two useless inner buttons are button 8 and button 9. Try:

xmodmap -e 'pointer = 1 8 3 4 5 6 7 2 9 10'

Missing software

Ubuntu comes with tons of software, much of which I wish it wouldn’t. Unfortunately it’s missing some crucial obvious stuff that serious people would like. For example, the SSH server and the full and proper version of Vim.

gimp xpdf inkscape ssh vim feh mpg123 g++ screen mercurial

xpdf

xpdf on Ubuntu is seriously messed up!

Need to:

sudo apt-get remove xpdf

because it completely does not work (seg faults). Go get the source package (I used xpdf-3.03 which has been stagnant for a while).

When configuring (./configure) there are lots of errors. This cures the one about X:

sudo apt-get install xserver-xorg-dev-lts-quantal

Make sure you have:

sudo apt-get install libfreetype6-dev

This cures the freetype error:

./configure --with-freetype2-library=/usr/lib/x86_64-linux-gnu \
--with-freetype2-includes=/usr/include/freetype2

Now make sure you have:

sudo apt-get install libmotif-dev libxt-dev libxt6

Then configure with:

./configure --with-freetype2-library=/usr/lib/x86_64-linux-gnu \
--with-freetype2-includes=/usr/include/freetype2 \
--with-Xm-includes=/usr/include/Xm \
--with-Xm-library=/usr/lib/x86_64-linux-gnu

Then make and test it out before make install. You test it out because it still doesn’t work! Now it runs but the screen is garbled. What a mess.

GuitarPro6

Wow, it sure can be a pain to install something like GP6. Here’s roughly what I did that mostly worked.

sudo dpkg-deb --fsys-tarfile gp6-full-linux-r11686.deb >
~/gp6-full-linux-r11686.tar
T=/tmp/gp6-contents
mkdir $T ; cd $T
tar -xvf ~/gp6-full-linux-r11686.tar
sudo mv opt/GuitarPro6 /opt/
rm -rv $T
cd /opt/GuitarPro6
ldd GuitarPro  | grep not
sudo apt-get install libportaudio2:i386
sudo apt-get install libsm6:i386
sudo apt-get install libasound2-plugins:i386
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"   # ?? Maybe not
sudo /opt/GuitarPro6/GPBankInstaller /tmp/Banks-r370.gpbank /opt/GuitarPro6/Data/Soundbanks/
./GuitarPro

Note that I had to download the sound bank and install it manually. Worked though.

OpenGL Development

You probably won’t but I needed all this:

freeglut3 freeglut3-dev freeglut3-dbg python-opengl
libglew1.6 libglew1.6-dev glew-utils python-pyglew
libdevil-dev libdevil1c2

Video codecs

What a mess this continues to be. For 12.04 I followed the directions on this web page.

Screensaver

sudo apt-get remove gnome-screensaver

Make Your own Packages

Interested in making your own Debian style packages? Maybe this will help.

Help