Friday, September 8, 2017

Tether Android to Ubuntu / Fedora Linux

(Update 09-08-17 - CLICK HERE for the automatic setup script - Now Just 296KB! sha1sum: f3b79c2e191baf8060367681bae27ac75fab9886 ). Based on reader comments, I've added the functionality for the script to use either yum or apt-get (Fedora or Ubuntu). Includes updated Azilink by Charlie Snider - for Android 2.3.x. READ the install instructions here (e.g., PLUG YOUR DROID INTO THE USB FIRST!)) Let me know how it works for you in the comments.)



So if you're like me you recently picked up the fabulous Verizon Droid Linux-based phone, and now you're one happy camper.

I've been cruising along with my Droid (Android Linux based device) for a month now, and I'm happy as a clam. I have to tell you... The Verizon Droid is quite a fine Linux-based device indeed.

So now that I've used the Droid for awhile, I set out in search of a piece of functionality that I hadn't yet replaced from my Blackberry days. That is: The capability to tether my Droid as an Internet modem to my Ubuntu GNU/Linux 9.10 machine using the USB cable.

On the Blackberry, this was as simple as, a.) provisioning the data service through Verizon(yes, this does cost extra), and then b.) setting up the "Berry4All/BBTether" script (by the extravagant Mr. Thibaut Colar) on my Ubuntu Linux box.

In my search for a solution, the first place I checked for a tethering application was in the Android Market. And while there are many other applications, the only app I was able to find for tethering, required for my phone to be "rooted". And so instead of jumping right into that, I went looking for an easier solution, and voila! - I found it.

What I found are some easy tethering instructions by the masterful Shwan.c (link at ubuntuforums.org) using James Perry's azilink (modified for Android 2.3.x by Charley Snider) from Google Project Hosting, GNU+Linux, and the FOSS program openvpn. So now there was only one problem: I'm using the Verizon Droid, not the HTC Magic. The good news is that the process is generally the same, except for a difference in hardware id information for the udev rules settings in Ubuntu.

So after some minor changes, I've now successfully tethered my Verizon Droid via USB as a modem for my Ubuntu GNU/Linux 9.10 machine(Works with 10.04 too - only difference is that you may have to uncheck "Work Offline" in Firefox after connecting (Thanks to Gene for mentioning this)). Update:06-04-10 - I've tested these instructions and they work successfully with both the Motorola Droid and the HTC Incredible Android phones.

So here are the easy steps to get you up and running with using your Droid as a USB tethered modem (and a big Thanks to Shwan.c for posting the original idea):

1.) Download the current Android SDK (for Linux (i386)) from: http://developer.android.com/sdk/index.html

Update(thanks for comments!): 12-13-10 adb does not come with the new SDK by default so you have to add it via the Android SDK and AVD Manager.
2.) Extract the SDK, run the "Android SDK and AVD Manager", then to get the adb tool, install "Android SDK Platform-tools, revision 1":

tar xvf android-sdk_r07-linux_x86.tgz
cd android-sdk-linux_86
tools/android


In the Android SDK and AVD Manager, expand "Available Packages", put a checkmark by "Android SDK Platform-tools, revision 1", click "Install Selected" and follow the prompts to complete the download/installation of adb into your SDK folder (screenshot below).


3.) Change Directory into the "platform-tools" directory, then copy the "adb" application to your Ubuntu /usr/bin directory (sudo privs needed)
#From the extracted "android-sdk-linux_86" directory:
cd platform-tools
sudo cp adb /usr/bin/adb

4.) Create/edit/save a rules file for udev to allow your machine to see your device
sudo vi /etc/udev/rules.d/91-android.rules

Put the text below into the file(using "i" to enter "insert" mode and hitting the escape key to return to "select" mode before saving.. C'mon, what fun would Linux be without using vi? If you really don't like vi, you can substitute with something like gedit, or nano, or kate, or etc.), replace USERNAME with your Linux username, then type ZZ to save the file from vi.

SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"
If you have an HTC Android phone - use this rule instead of the one above:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"
If you have the Samsung Galaxy Android phone, use this rule instead of the one above:
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"  
If you have the Sony Ericsson X11 Android phone, use this rule instead of the one above (Thanks to Steven from the comments):
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"If you have the LG Optimus V(Virgin Mobile) Android phone, use this rule instead of the one above: 
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME" 


5.) Set the appropriate permissions to the rules file you just created.
sudo chmod a+r /etc/udev/rules.d/91-android.rules


6.) Restart udev to load the new rule.
sudo restart udev


7.) Enable "USB debugging" on your Verizon Droid via Settings | Applications | Development


8.) Connect your Droid to the computer with the USB cable and then use the following adb command to check for your device.
adb devices


example:
$ adb devices
List of devices attached
040364FA0901E011


9.) Install openvpn on your computer so you can connect to your device with it.
sudo apt-get install openvpn
sudo /etc/init.d/networking restart
sudo /etc/init.d/network-manager restart



*For Fedora and Yum, replace the commands above with this:
sudo yum install openvpn
sudo /etc/init.d/networking restart



Note for those without Internet: If you need to install the openvpn package (and dependencies) separately, these packages are what you will need: (liblzo2-2 libpkcs11-helper1 openssl-blacklist openvpn-blacklist openvpn). It's best to use the package manager to install openvpn because it will automatically install the dependencies, but if you can't get your Ubuntu machine onto to the Internet, then you can download the above packages (in .deb format) to a separate medium (i.e., USB drive, CDR, etc.)separately and then install them in the order listed to achieve the same result as installing from the package manager.


10.) Install openvpn on your Verizon Droid. Note: the line "adb install" actually installs the azilink application on your Droid device. After azilink is installed, an icon that looks like a flying insect will appear on your Droid in th applications area.
cd /home/Downloads/
mkdir azilink
cd azilink
#Manually download the setup script, untar it to get the Azilink-debug.apk - fixed by Charley Snider for Android 2.3.x from


adb install -r Azilink-debug.apk
Download the azilink.ovpn file from here


11.) Create a replacement resolv.conf file to be copied over to your /etc directory at run-time:
vi resolv.conf


#Type in the text below(hit "i" for insert first, then ESC after the insert, before saving) and then hit ZZ to save
domain lan
search lan
nameserver 192.168.56.1


12.) Now create a very small script to start the modem
vi start_modem


#Type in the text below, then hit ZZ to save
adb forward tcp:41927 tcp:41927
sudo cp resolv.conf /etc/
sudo openvpn --config azilink.ovpn


13.) Set your new script to be executable.
chmod 755 start_modem


14.) On your Verizon Droid, launch the azilink app and place a checkmark by "Service active" so it can receive the connection from your Ubuntu machine.


15.) With your wireless connection in Ubuntu "unchecked"(via right-click of the Network manager applet), launch the the connection script you just made in the Terminal:
/home/Downloads/azilink/start_modem


You should now be able to surf the Internet, using your Verizon Droid as a tethered modem. When you're finished - hit ctrl+c at the Terminal from which you started the connection script. Then uncheck "Service active" in Azilink on your Droid.


Here's a Speedtest (courtesy of speakeasy.net/speedtest) of the connection from Seattle, WA:
Download Speed: 1448 kbps (181 KB/sec transfer rate)
Upload Speed: 281 kbps (35.1 KB/sec transfer rate)


If you have any questions, feel free to leave a comment.

Sunday, September 25, 2016

HowTo: Frostwire install on Ubuntu Linux 16.04. Answered for Carl of SC.

frostwire running, with ubuntu 16.04 search results
Frostwire Application
  "Switch to GNU/Linux and get your freedom on today!" A message I've been working to share for years! A simple way that I do this, is by wearing a shirt that says "Linux" as often as I can.
  So I was out on a road trip, proudly wearing my Ubuntu GNU/Linux shirt, and I pulled into a gas station to get a snack. That's when I met Carl.
  Carl saw my shirt and complimented Linux. We nearly did a high five right there in the gas station! Then, after a quick exchange of praise for our favorite operating system, and a solid hand shake, Carl asked if I knew how to solve a problem he was having with installing the Frostwire application for Ubuntu 16.04, or even in Pinguy OS.

  Frostwire is a GPL licensed, free and open-source software (FOSS) application for use with bit-torrent(file sharing/distribution), media-download(i.e., from YouTube, archive.org, etc.), and/or media-playback of a myriad of different media content types (i.e.,m4a,mp3, and more).
  So to get my new Linux buddy Carl up and running, I did a bit of testing to see what might be the issue with installing Frostwire on Ubuntu 16.04 64-bit(amd64) and I've documented the details below.

  First of all, I downloaded the Frostwire *.deb installer file for my Ubuntu 16.04 GNU/Linux machine, by simply navigating my web browser to http://www.frostwire.com and clicking the "Free Download" button appearing there (See Fig. 1).
site of frostwire www.frostwire.com/home with free download button
Fig. 1
  If you're using the Google Chrome browser, there will be a prompt at the bottom of the browser with a warning about the *.deb installer file being a possible harmful one.
  Not to worry, this is the default safe-browsing behavior for any type if installer file that you will encounter on the web.  Click the "Keep" button and proceed with the download of the Frostwire *.deb installer file. In our case, the file was saved to the default download path of ~/Download (See Fig. 2).

  Note: At the time of this writing, the name of the *.deb installer file is "frostwire-6.3.6.all.deb". But keep in mind, the name of the installer file could be updated to a newer version name over time.
frostwire download page - click Keep to download .deb file
Fig. 2

  Upon testing this application, I noticed it failed due to not having some dependencies needed for installing the application (See Fig. 3).

pic of dpkg failing to install frostwire due to missing openjdk-8-jre, lib32stdc++6 (>= 4.8.1), and mplayer
Fig. 3
  A caveat to installing *.deb files in Linux with dpkg is that dependencies needed to install the application are not automatically calculated and installed along with the application.  So if there are any dependencies are needed for your application, the dpkg *.deb installation will fail to complete properly.
  Also, in the case of this specific Frostwire application *.deb installer, the dependencies I need to have installed before I can install Frostwire, require the 32-bit(ia32) architecture capability to be setup on my Ubuntu GNU/Linux 64-bit(amd64) operating system first.  I will show how to correct these issues below.

For Carl: So in order to INSTALL Frostwire on my Ubuntu 64-bit operating system, I simply need to run the following command in the terminal (press CTRL+ALT+t to bring up the terminal )(for visual example, See Fig. 4):



Fig. 4
  Note: The above output doesn't show the packages downloading for install. So keep in mind that an Internet connection will be needed to run the install commands and the downloading of the additional packages may vary depending on your Internet connection speed.

  After the command in Fig. 4 completes, simply open your Ubuntu search glass, type frostwire, and you should be presented with an icon you can click to launch the application (See Fig. 5)

frostwire app icon shown in Ubuntu search glass
Fig. 5
  See the picture 'Frostwire Application' at the top of this post to see what Frostwire looks like after it's launched.

  Disclaimer: Frostwire is an application that can be used to download .torrent files. While torrent files and the related protocol are a fantastic way to share files and get fast downloads - I recommend only downloading files that you can independently verify as being legally downloadable in your locale, and safe to use for your system.  This post, or any post on my blog, don't advocate for downloading illegal content or breaking the law in any way.

  Should you want to remove/uninstall Frostwire and the packages it depends on, simply run the following command in the terminal (shown in Fig. 6):



removal of frostwire and dependencies
Fig. 6

That's it! I hope this helps someone out there, especially Carl! Feel free to leave a comment below with any questions or comments. And as always, get your FREEDOM ON!! Switch to GNU/Linux today!

Cheers.
Shannon VanWagner
09/25/2016

Saturday, July 9, 2016

(Updated) Chrome Browser Freezing Up Your Linux Box? Try This:

Being an absolutely avid GNU/Linux user, I am always very much enjoying my technological freedom!

In fact, switching to GNU/Linux is among the better choices I've ever made, career-wise and from the standpoint of weilding the cutting edge when it comes to Technology! Get Yours!

That said, I use two web browsers on my Linux machines: Google's Chrome and Mozilla's Firefox.

The thing with using Chrome on GNU/Linux, and it's good and a bad thing - is that the Adobe(tm) Flash plugin is integrated into the Chrome. So until all Flash content gives way to HTML5 content on the web, Chrome gives me the most functionality for the current Internet.

Google's Chrome is an awesome an powerful browser that's based on the Open Source Chromium project. This is an awesome project that helps to provide the most access to the web, from all sorts of devices and operating systems - it's cross-platform-compatible.

Google Chrome is awesome, but one thing I've noticed, is that since Chrome will launch extra processes as necessary to handle additional tabs in the browser, the browser can end up having a very large memory footprint on the machine. On several of my Linux boxes, this memory consumption by Chrome, seems to have caused an issue where the machine will actually lockup from being out of memory.

When the going gets tough, Linux is infinitely configurable! The user is in charge! So after looking around for a way to manage the issue where Chrome is eating up all of my system's memory and locking up the box, I found a blogpost entitled 'Automatically kill process using too much memory on Linux' by Jon Jensen on blog.endpoint.com - accessed 7/9/2016, that seems to have helped me solve my issue.

Mr. Jensen's blog post mentions a Perl script that is setup in a crontab to run every minute and kill off any process that uses too much memory. The script provides pretty much what I need to control my Chrome from running away with the memory on my system and locking up the machine.

After doing some testing, what I realized with the Chrome memory usage problem, is that due to the fact that many chrome processes are launched with the browser, we can't just watch for one process to eat up a large amount of memory and act accordingly. Instead, we need to look at the overall total usage of the several Chrome processes that will run to support multiple tabs in Chrome.

For instance, in a test, I have 7 tabs open in Chrome, and currently there are 10 chrome processes showing on my Linux machine:


Another thing I noticed is that with those 10 chrome processes, they are using over 2GB of the 8GB of RAM I have on my machine currently.

So here's the script I created to kill off some chrome processes when the overall memory usage from them is too large. This script is based on the example script from Mr. Jensen's blog post above. Note: The script example below will kill off chrome processes when total usage of system RAM by chrome is over 7.5GB, because I have 8GB of RAM installed. If your system has a different amount of RAM, adjust the value for $numMaxByteUsage accordingly. For example, if you have 2GB of RAM installed, I'd suggest setting something like this - $numMaxByteUsage = 1610612736 in the script below. Note, if the below is pasted into the terminal, it will create the script file named 'kill_chrome_tabs_when_ram_depleted.pl' in the home directory.



Note: You then can setup a crontab to run the script every minute. In this case, if you're browsing along and chrome starts eating up all your memory, the crontab+script will kill off any chrome processes after reaching the threshold noted in the script. See '$intRamUsed' setting, which is shown as byte-size.

To run the script, you may have to install the supporting Perl package to inspect system processes first (e.g., if you get error 'Can't locate Proc/ProcessTable.pm in @INC (you may need to install the Proc::ProcessTable module'):

Also, you'll want to add the script to run in a crontab every minute. Here's the example crontab entry for root(sudo crontab -e) in my case (sudo crontab -l):


To test, I opened up about 60 tabs in Chrome(see 1st pic below). I then ran the script above to output the total memory used by chrome. As you can see, the usage reached about 7.5GB of RAM, then the script executed a command to kill some chrome processes. This caused a few tabs to go "snap", but the rest of the browser tabs continued working(see 2nd pic below).

Lotsa tabs to use all my RAM!
Totalrss gets to around 7.5GB, then chrome processes start getting killed

Monday, March 14, 2016

(updated) How To: Ubuntu 16.04 GNU / Linux - Netgear Wireless AC Adapter AC600 ( AC6100 ) Dual Band

Update - 7/9/2017 SIMPLY TRY THIS METHOD INSTEAD:
Try building the driver by running this in the terminal (ctrl+alt+t):

sudo apt-get install rtl8812au-dkms

It works for me in Ubuntu 17.10 (Artful) If it doesn't get your wireless up, then run:

sudo apt-get remove rtl8812au-dkms

And carry on with the rest of this blogpost.


Another GNU/Linux adventure. This time with Ubuntu GNU/Linux 16.04, kernel - uname -r - 4.4.0-12-generic.

So I went shopping at my local Walmart (TM), and picked up this Netgear (TM) Wireless AC Adapter AC600 (A6100) Dual Band USB wireless adapter and brought it home to install in my GNU/Linux rig.

Plug it in and nothing... No wireless connection detected!

Why does this still happen! The year is 2016, why do we still have to manually setup wireless adapters for GNU/Linux? Oh well, good honest CLI training for the users to understand their new system I guess.

So, as it turns out, the driver for this nice little USB wireless adapter is not automagically installed with Ubuntu 16.04 GNU/Linux. The purpose of this post is to help you get this adapter working.

First, follow the instructions below to ensure your new netgear wireless adapter matches the hardware in this post.

When you run this command in the terminal(ctrl+alt+t):
$ lsusb|grep -i wireless

You should see something like this:


If your hardware matches the above (RTL8811AU) , see the instructions below for manually building, installing, loading the wireless driver module.

Ah, where to to get the driver! No worries, Michal Ulianko - @Grawp, on github.com has us covered! Thanks for your contributions to Open Source Michal!

To get this Netgear AC600 adapter working, you're going to have to roll up your sleeves and follow these detailed instructions:

Preparation for building from source, run these in the terminal:
Note, you will have to have your computer connected to the Internet to run the commands below, say via the Ethernet, or another connection.

1.) $ sudo apt-get install linux-headers-generic build-essential git -y 


Note: for the above command, you will have to enter your password, then hit enter key (notice - it will not show your typing).

2.) ~$ mkdir wireless_driver && cd wireless_driver

3.) ~/wireless_driver$ git clone https://github.com/Grawp/rtl8812au_rtl8821au.git

4.) ~/wireless_driver$ cd rtl8812au_rtl8821au

5.) ~/wireless_driver/rtl8812au_rtl8821au$ make
Note: the process from #5 above may run for a time, have several lines of output, and should end with something like 'make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-12-generic'... no errors.

6.) ~/wireless_driver/rtl8812au_rtl8821au$ sudo make install

7.) ~/wireless_driver/rtl8812au_rtl8821au$ sudo modprobe 8812au


Voila! Driver loaded, now use the Network manager applet to select and connect to your network (see pic below):


















Great speed from this adapter - 434 Mb/s !



Hope this helps you get connected!

Cheers!


Shannon VanWagner
03/14/2016

Saturday, January 9, 2016

How to fix slow video in Supertux 0.3.4 (FOSS game)

Supertux2, is a fantastic free open source ( FOSS / GPL ) 2d side-scroller game, similar to the Super Mario Bros variety. My children have been playing this awesome game for years.

This awesome game is available in most GNU/Linux distros via their software package-management systems. It's also available for other OSes.

In the case of the Debian-based GNU/Linux, the packages are available for the previous version of Supertux (sudo apt-get install supertux-stable), and Supertux2 (sudo apt-get install supertux).

To learn more about Supertux, checkout the project page for Supertux is supertuxproject.org Thanks to all the great efforts from the Supertux team for this awesome game!

Supertux2 is the newest of the Supertux games and is fabulous. However, the Supertux2 game appears to have a bug where the "auto" selection of video rendering can result in very slow behavior from the game.

You can check the video setting for Supertux2 from the terminal(CTRL+ALT+t) with something like this:
$ grep 'video \"' .supertux2/config
 (video "auto")

Note: The 'video "auto" setting appears to be the default setting installing Supertux2. And after some testing, this setting is what causes the game to be very slow in some cases.

To fix, try setting the video mode to "sdl" in the .supertux2/config file.

Here's how:
1.) Make a backup of your configuration:
$ cp .supertux2/config .supertux2/config.bak

2.) Update your Supertux2 video setting in the config file to use "sdl" instead of "auto" or "opengl".

$ sed -i 's/video\ "auto"/video\ "sdl"/g;s/video\ "opengl"/video\ "sdl"/g' .supertux2/config

3.) Check to ensure the change:

$ grep 'video \"' .supertux2/config
 (video "sdl")

4.) That's it! Launch the game and it should work as good as the original Supertux.



Shannon VanWagner
2015-01-09

Wednesday, September 16, 2015

Hulu.com - No Video Love For Linux Users(even paying ones); Modern Technology Fail!



(UPDATE 2-13-2016) - Hulu now working on Google Chrome browser again! Hulu folks - for us Linux users, please test before breaking Hulu on Linux in the future. Thanks for looking out.

Self-driving cars, the international space station, major stock markets, bullet trains, top supercomputers, billions of smart phones, animated movies, science, education, entire citties, and even the very Internet that we rely on for information and connectivity everyday. These are just a few of the amazing things that are brought to us thanks to the power of the GNU/Linux operating system!!

So why is it that hulu.com wouldn't test to ensure us GNU/Linux desktop users weren't blocked by their latest DRM/video-rendering update? C'mon hulu.com, I'm a paying customer - and hulu.com used to work just fine for me on my Ubuntu GNU/Linux systems.

Now when I try to view hulu.com, I'm presented with this problem and can't watch the videos at all:




To hulu.com's credit, it's not all their fault.. Adobe's flash sucks (especially in terms of Linux support), and Hollywood's endless push for Digital Rights Management technology makes it a miracle that any video content can be viewed online at all. That said, this is unacceptable for paying customers hulu!

There's an answer to this problem.. Netflix.com has already found it. Use open standards and HTML5 to deliver your content instead! Drop those arcane technologies that bind themselves to old technologies and lock-in systems.

So this is a callout to hulu.com - Please fix your site to work with Linux again. Thanks.

Update 10/16/2015: Thanks to the luanchpad.net PPA from  
Michael Blennerhassett, you can install the hal package then use Mozilla Firefox to view hulu.com. To enable the hal package, run these commands, then open hulu.com in Firefox to watch:
sudo add-apt-repository ppa:mjblenner/ppa-hal
sudo apt-get update && sudo apt-get install hal

Related linuxforums.com link


9/16/2015


Sunday, August 10, 2014

How To Set Default Grub / kernel / boot option on Ubuntu GNU/Linux 14.04

Looking around on Google (or whatever one's favorite search engine); one can usually find everything they need in terms of tips for making GNU/Linux work optimally.

But sometimes, you just want to do one specific thing, and although the required documentation is available, it may be questionable because you can't figure out if the fix exactly matches what you need for your system.

Finding the fix online, along with too much information about how to implement it, is what happened in recent situation I encountered. A friend brought me his Gateway Laptop. The laptop was failing to boot (kernel panic) after some recent updates that were run. So I referred to my technical library, Google, and although I was able to find an answer, it wasn't immediately clear to how to implement the fix to my friend's specific situation. So for that reason, and for the reason of being able to quickly get of this jam in the future, I decided I would write up the specific steps that helped my friend out of his jam.

The problem: a kernel bug in the newest kernel that was running on his machine was causing kernel panic on startup.
The workaround: We needed to boot to a previous kernel version until a fix was released for the newer kernel. Furthermore, we didn't want to let the system accidentally boot into the newer kernel because it wasted time for us to exit the broken system and  have to go back through the steps to get to the older kernel for the workaround.

While I'm at it, I want to mention that (another thing) that's great about GNU/Linux is that you can choose to boot with a variety of different versions of the Linux kernel if you wish. This open capability enables you to easily transcend any kernel bugs that may affect your particular hardware, by being able to boot to whatever you want, and get back up and running! This type of openness with the system is the reason why I've switched to GNU/Linux and have been using it on all my computers for many years now.

So back to my friend's situation: He's running Ubuntu GNU/Linux 'Trusty Tahr' 14.04 and when he ran a recent update, it installed the newest available kernel. Let's just say it was kernel 3.13.0-32-generic, for the purposes of my examples below. With this newly updated kernel booting as default, my friend's machine would fail early in the boot process with a 'kernel panic'.

Since the machine was working perfectly before this latest update, we tried booting into an earlier version kernel. To do this, we would tap CTRL then SHIFT(but not together) repeatedly just as Linux is loading up, this would get us to the grub menu where we could select a particular kernel to boot with. The grub menu, if triggered, appears just after the machine shows the screen for the brand of the computer and the POST (Power On Self Test).

Let's walk through the steps to get to the menu for kernel selection on Ubuntu 14.04 so you can see how we began working around this issue.

1.) POST screen. This appears when you very first turn on your computer. Note: The image you see will vary depending on your specific computer maker.. It also may go by so fast that you don't even see it, so be ready to use the keyboard. Just at the end of this type of screen, start tapping back and forth between CTRL or the left SHIFT key to get the menu in #2 below.



2.) The GRUB menu with 'Ubuntu' as the default selection. We could press "e" at this prompt, and edit the Linux startup commands in grub, but unless we've memorized the specific text of the boot option we need, that idea may be difficult to implement on the fly. Instead, at this point we'll hit the down arrow on the keyboard to select "Advanced options for Ubuntu" (see next image):


3.) In this view, I've hit the down arrow on my keyboard to select "Advanced options for Ubuntu". I then hit ENTER to get all the options to boot to previous kernels that are still installed. Ubuntu keeps a number of previous kernels installed after updates, to help you if you ever have to fallback to an earlier version.


4.) Here's the menu with the Kernel selection menu. We want to boot to the 3.11 kernel because we tried and it's the one that boots without error for us. So we'll use the down arrow to move down to the 3.11 kernel (see next image).


5.) Here's the screen with the older kernel (kernel 3.11) selected, now we hit ENTER to boot the machine to that kernel, and when it boots, we give our colleagues a nice high-five because we were able to get the booting and running again! Go GNU/Linux! We've now learned about something that can be helpful to others that may encounter a similar situation.


So, in the case of my friend, once we booted to the previous kernel, his machine loaded up without issue.  So this is how we will work around the kernel issue. The next steps would be to file a bug (or add input to an existing bug) at launchpad.net to get the issue for the newer kernel fixed. The actual fixing of the new kernel will likely take time, but that's ok because we can use the workaround and still continue to enjoy our awesome Ubuntu GNU/Linux system!

But how do we make our machine boot to a specific kernel for future boots until the problem is fixed, so we don't have to worry about the system failing to boot? There are a few ways, but one way is to add the previous kernel as the default boot option via the /etc/default/grub file.

I'll explain how to do that below..

First of all, as seen in #2 above, Ubuntu 14.04, it's noteworthy to point out that Ubuntu now nestles the previous kernel boot options under a 'submenu' named "Advanced options for Ubuntu". In a separate, more advanced subject, another thing that's new is that it's no longer recommended to use the label of a grub.cfg menuentry to set it as default because it may cause a problem if it contains special characters in it. So instead, we should use the value for "$menuentry_id_option" that appears in the menuentry we want to select for the default boot option.

Sounds pretty confusing right? It's actually pretty straight forward, save for a few more steps needed to make the edit to the appropriate file to affect the changes. We simply have to build the GRUB_DEFAULT= value using the $menuentry_id_option for the submenu, then add ">" (no quotes), then add the $menuentry_id_option for the actual kernel boot selection we want to boot to behind it. For example:

GRUB_DEFAULT='gnulinux-advanced-7ec5403e-7a25-47a1-bf0c-1a7c955dc590>gnulinux-3.11.0-19-generic-advanced-7ec5403e-7a25-47a1-bf0c-1a7c955dc590'

1.) So first, let's get the $menuentry_id_option for the 'submenu' named "Advanced options for Ubuntu". Hit CTRL+ALT+t to open a terminal and run:

grep submenu /boot/grub/grub.cfg 

Example output (with the "id" text we need highlighted):


2.) Next, we get the $menuentry_id_option for the 3.11.0-19-generic kernel boot entry that we know will work with my friend's computer and we highlight the id for it. Hit CTRL+ALT+t to open a terminal and run:

grep gnulinux /boot/grub/grub.cfg 


Example output (with desired value highlighted):




2.) In the Terminals where you ran the commands for #1 and #2 above, use your mouse to select the text after "$menuentry_id_option" (everything inside and including '  '  ), then we'll use CTRL+SHIFT+c to copy them from the Terminal (one by one) and paste them into /etc/default/grub to build our default entry, in another step below. Example values to be copied:

'gnulinux-advanced-7ec5403e-7a25-47a1-bf0c-1a7c955dc590' 
'gnulinux-3.11.0-19-generic-recovery-7ec5403e-7a25-47a1-bf0c-1a7c955dc590'

3.) Now, with new Terminal, we'll backup, then edit /etc/default/grub file, and then use the values from the first two terminals above to make the default entry for boot.
Make a backup of the file, to our home directory:

sudo cp /etc/default/grub ~


Now edit the file:

sudo vi /etc/default/grub

4.) Edit the default entry in your /etc/default/grub file so your system will boot to the previous kernel by default. Use your arrow keys (or h j k l ) to move to the line with "GRUB_DEFAULT=0". Hit Y to copy, then P to paste the line again. Next, use the keyboard arrow keys, or h/j/k/l to position your cursor in front of the lower "GRUB_DEFAULT=0", then hit i for insert mode, then type # in front of the line to comment it out. Hit esc to get out of insert mode, then position your cursor over the 0 in the upper entry of GRUB_DEFAULT=0, then hit x to delete "0". Now, hit A to insert after the end of the line with "GRUB_DEFAULT=". Now, you'll copy the value from Terminal in  step #1. above(highlight text, then use CTRL+SHIFT+c), then switch back to the current Terminal and hit CTRL+SHIFT+V to paste it in, then type ">" (no quotes), then copy the 3.11 kernel text from Terminal in step #2 above and paste it in after the ">".  Then hit esc again, then type ZZ or :wq to save/quit. Example (also see image below):
GRUB_DEFAULT='gnulinux-advanced-7ec5403e-7a25-47a1-bf0c-1a7c955dc590>gnulinux-3.11.0-19-generic-advanced-7ec5403e-7a25-47a1-bf0c-1a7c955dc590'


5.) IMPORTANT: Now that we have the default kernel setting in place in the /etc/default/grub, we must update our grub configuration for the changes to take effect:

sudo update-grub

You'll see something like this:



6.) Reboot the computer, then verify the system has booted to the new default kernel by launching CTRL+ALT+T to open a Terminal, then run the command to check the loaded kernel:

uname -r

The output from the command should show something like:

3.11.0-19-generic

In closing: You'll want to keep an eye out for kernel updates as you update your system. The reason is that once the newer kernel comes out, like the one with the appropriate update to fix the original problem that's outlined in this post, you'll want to revert the changes outlined in the post to let your system to boot to the default kernel again. Basically you'll just go into /etc/default/grub, place a "#" in front of your custom kernel specified in #4 above.

GNU/Linux rockin!! Get your Freedom on!!

Shannon VanWagner
08/10/2014