Sunday, December 28, 2014

DLNA Streaming from Linux --> 1st Gen Sony GoogleTV

While cleaning up my wife's tablet I found a few hundred photos/videos from 2010-2011 time frame.  I copied them all to offline storage.  My kids were having a ball watching younger versions of themselves over my shoulder, so I thought, why can't I just stream this stuff?

The Sony GoogleTV already supports streaming from other DLNA devices.  This generally includes a lot of devices, like Windows laptops, that appear on the network and make videos and pictures available to DLNA clients.

I tried a few different approaches in Linux before I found one that just worked right out of the box.

First, there's MiniDLNA (now called ReadyMedia).  This project is "sort of" supported by Ubuntu with a separate repo.  However the objects in that old repo seem out of date, and the only way to get this up and running with the latest and greatest version is by building it from source.  I didn't want to mess with that this morning, so I moved on without even giving this one a go.

Next, I found MediaTomb.  While this was relatively easy to set up under Ubuntu, I couldn't get my Sony GTV to recognize it.  My phone w/ a DLNA client, however, *would* recognize it, but it refused to play any of the content.  I messed w/ the config file and uncommented some lines for the PS3, Google'd around a bit, didn't find any solution.  Uninstalled, moving on.

I looked around for Plex, which I know is popular, but it is commerical and I didn't really like the license terms, so I moved on.

I finally found Rygel, which installed easily under Mint/Ubuntu and in literally minutes I had it running.  I also installed the companion app, rygel-preferences, which made it super easy to point to specific folders that had the content I wanted to publish. 

I did have to run "rygel &" from the commandline to start the server, but after that the Sony GTV discovered it immediately and the kids could look at all 6GB of short movies and photos.

Monday, December 1, 2014

123D Design Uses Open Source Code, but Autodesk Says Your 3D Model is Closed

I downloaded Autodesk's 123D Design solid modeling package, aimed at makers.  It looks okay, I played with it for a few minutes.  I wanted to see what it would take to "go premium", and what exactly that would entail.  Just click "Go Premium" to get started...

...and you are presented with:

You're allowed to use the models you create for non-commercial use only.  This means that whatever you design, whatever it is you make with this software, somehow Autodesk says that you can print it, but you're not allowed to sell it.  In fact if you look at their FAQ you will find exactly what they mean:

They note that even if you upgrade your account, you aren't able to include any Autodesk-provided 3D models.  It is not clear if this includes the primitives, such as the sphere, block, torus, cone, etc that would be inserted into your model automatically by Autodesk.

It is also amusing that they say they've made the change because while they believe in the Maker Movement, they also want to keep improving their free apps so they can unlock the creativity in everyone.

Well, it certainly seems fair to say that Autodesk likes free and they like the creativity of others, because as you take a look at the license agreement, you'll find licenses and copyright notices for all of the free software that Autodesk is depending on to build this application (click Help, then About):

I'll save you the time of going through this box, I cut/pasted it into Vim and I'm told it's about 8600 words long.  You'll see all of the open source goodies in a minute.

Autodesk says many times in this license that they'll give you the sources if you send a CD-ROM to their legal department.  I don't have much reason to believe that they won't honor this request, but I don't care enough to mail them a CD.

Now, to be fair, I don't think that Autodesk should give away their expertise -- namely decades of work on their solid modeling and CAD software -- for free.  However, I do find it curious that they want to impose ownership on the physical output that was created using their software.  In my opinion this type of restriction is not in the spirit of the open source licenses that Autodesk used to build 123D.  And further, is it legal?  Could Adobe put a claim on artwork you've made with Illustrator?  Could Google put such a claim on a book you're written using Google Docs?

Legality aside, it would have been a better move, in my opinion, to not impose restrictions on the output of the free version of 123D, but then give the users good reasons to go for a paid version.  Maybe even give users the full version for a month to try it out?

We are talking about a software for makers.  Software for hobbyists, for tinkerers.  Make it powerful, but not powerful enough to generate prints and build cars with.  Adobe experimented with this concept with Adobe Photoshop Elements, a stripped down version of the professional-grade Photoshop.  For $60 you could get Elements that would do almost everything most hobbyists needed.  For $600 or more you could get the full-blown Photoshop.  Today, even Adobe has jumped on the software-by-subscription bandwagon, giving you all sorts of cloud-based services for a monthly fee.

The trick here is, it's almost Christmas.  And I think there will be a lot of 3D printers under trees this year.  Dremel is jumping into the mix and their printer will even be for sale at Home Depot.  So Autodesk needs to provide users with a way to get their model out of their software and into the physical world.  So, they do allow you to export your model to .stl format from the free version of 123D, but I'm not sure how they would prevent you from uploading your work to Shapeways and putting it up for sale in the Shapeways store.  Nevertheless, their license says you can't do that.

Here are the software licenses I mentioned earlier.  I've deleted all the lines that didn't contain "portion.*related.*" to end up with this list.  There are also some commercial licenses in here as well as some licenses I can't identify, and some portions that haven't given any credit.  If you see a mistake here, leave a comment and I'll correct it.

PackageLicenseLicense Holder
Qt MFC Migration Framework v 2.8GPL 2.1Nokia Corporation
ASIX2/C v1.6.0Apache 2.0Apache Software Foundation
hash.cFree w/ conditionsBjorn Reese and Daniel Veillard
list.cFree w/ conditionsGary Pennington and Daniel Veillard
trio filesFree w/ conditionsBjorn Reese and Daniel Stenberg
libiconv v1.9.2GPL 2.1Free Software Foundation, Inc.
Qt v 4.7.2GPL 2.1Nokia Corporation
OpenSSLProprietary?OpenSSL Project
"cryptographic software"SSLeay? Free w/ conditionsEric Young, Tim Hudson
Qt Cryptopgraphic Architecture v2.0.2GPL 2.1Justin Karneges, Brad Hards
OpenSSL Plugin to Qt Cryptographic Architecture v 2.0.0 beta 3GPL 2.1Justin Karneges, Brad Hards
QOAuth v1.0GPL 2.1Dominik Kapusta
expatFree w/ conditionsThai Open Source Software Center Ltd. and Clark Cooper
Threading Building BlocksClosed?Intel
FIPS 180-2 SHA-224/256/384/512Free w/ conditionsOlivier Gay
Paul Hsieh Super Fast HashFree w/ conditionsPaul Hsieh
MurmurHashFree w/ conditionsMurmurHash2, 64 bit version, by Austin Appleby
zlibFree w/ conditionsJean-loup Gailly and Mark Adler
InstallShieldClosed?Acresso Software Inc. and/or InstallShield Co. Inc.
"source code provided by NVIDIA ARC GmbH"Closed?NVIDIA ARC GmbH
"files related to libxml"Free w/ conditionsDaniel Veillard
"portions related to libtiff"Free w/ conditionsSam Leffler and Silicon Graphics, Inc.
sparsehashFree w/ conditionsGoogle, Inc.
libxerces-c v 2.7.0Apache 2.0Apache Software Foundation
OpenEXR v 1.6.0Free w/ conditionsIndustrial Light & Magic
"portions relating to Adobe Photoshop CS4 software"Closed?Thomas Knoll, Adobe Systems, Inc.
libpng v 0.97Free w/ conditionsVarious
JPEG software?Thomas G. Lane, Independent JPEG Group
TIFFFree w/ conditionsSam Leffler, Silicon Graphics, Inc.
LuaPlusFree w/
"portions"?International TechneGroup
Info-ZIPFree w/ conditionsInfo-ZIP (multiple indivdiuals named)
OpenSSL v 1.0.0dFree w/ conditionsOpen SSL Project, Eric Young
liboauth v 0.9.4Free w/ conditionsRobin Gareus
SCons v 2.0.1Free w/ conditionsSCons Foundation
Epydoc v 3.0Free w/ condiionsEdward Loper
Xerces v 3.1.1Apache 2.0? No credit given
Boost Software License v 1.0Free w/ Conditions? No credit given
"Portions"?Python Software Foundation
"Portions relating to Open SSL"Free w/ ConditionsOpenSSL Project
"Portions relating to WINE"GPL 2.1Wine project authors

Sunday, September 21, 2014

FreeMind XML Parse Exception When Opening an Old Map

I think this bug has been fixed in a more recent version of FreeMind, but you may go through this with version 1.0.1 for Linux, possibly for Windows also:

1.  Try to open a map

2.  Get this error

This is clearly a bug, and I haven't seen it with newer versions of FreeMind on Windows.  A workaround is to fix the first line of the .mm file in question:

<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from -->
<node CREATED="1386726098959" ID="ID_368233367" MODIFIED="1386726102812" TEXT="git">

To resolve the issue, replace "0.9.0" with "1.0.1" using a text editor, save the file, and you should be able to open the file again.

If you want to update a large number of maps try the following (Linux command line):

sed -i -e 's/0\.9\.0/1.0.1/' *.mm

The above command will look for "0.9.0" and replace it with "1.0.1" in all files named *.mm, and the -i option means it will update the file in place.

(You can also use sed under Windows, see the unixutils package at Sourceforge)

Sunday, September 7, 2014

[Linux, Mint, Ubuntu] Update FreeMind the Lazy Way...

The latest version of FreeMind in the Ubuntu repositories as of this writing is 0.9, which is quite old.  But, there is an easy way to get the latest version, use a 3rd party repo.

See here:
wget -q -O - | sudo apt-key add -
sudo sh -c 'echo "deb trusty-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'

After this, do:

sudo apt-get update

and finally:

wskellenger@marquette ~ $ sudo apt-get install freemind
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  freemind-plugins-help freemind-plugins-svg freemind-plugins-script
  freemind-plugins-map freemind-browser
Recommended packages:
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.
Need to get 20.1 MB of archives.
After this operation, 18.3 MB of additional disk space will be used.
Get:1 trusty-getdeb/apps freemind all 1.0.1-1~getdeb1 [20.1 MB]
Fetched 20.1 MB in 15s (1,319 kB/s)            

[Linux] Create a Mind Map (Freemind) from a Directory Structure

I wanted to have a mindmap of the Cyanogenmod source tree.  It is a huge bunch of folders and I just want a nice way to have an overview of the file structure and make notes.

FreeMind, the open source mind mapping tool, has a native utility to import a directory structure, but I found that the resulting mind map was on the heavyweight side.  In fact, using FreeMind 0.9, the native import tool never completed the import -- after 30 minutes or so I had to kill the application.

So I just want to create a FreeMind file that has the directory entries as text nodes, and that's it.  How about using the awesome "tree" command line tool in Linux?

Here is what the output looks like from my /usr/share folder (note I'm using the -d option to show only directories):

wskellenger@marquette /usr/share $ tree -d
├── aclocal
├── acpi-support
├── adduser
├── alsa
│   ├── alsa.conf.d
│   ├── cards
│   │   └── SI7018
│   ├── init
│   ├── pcm
│   ├── speaker-test
│   └── ucm
│       ├── apq8064-tabla-snd-card
│       ├── DAISY-I2S
│       ├── Manta-I2S
│       ├── Manta-SPDIF
│       ├── PandaBoard
│       ├── PandaBoardES
│       ├── SDP4430
│       ├── tegraalc5632
│       ├── tegra-rt5640
│       └── Tuna
├── alsa-base

Now if you take a look at the options for tree, there already is an option to output XML!  Try "tree --help" at the commandline, and you'll see something like this:

  ------- Graphics options ------
  -i            Don't print indentation lines.
  -A            Print ANSI lines graphic indentation lines.
  -S            Print with ASCII graphics indentation lines.
  -n            Turn colorization off always (-C overrides).
  -C            Turn colorization on always.
  ------- XML/HTML options -------
  -X            Prints out an XML representation of the tree.
  -H baseHREF   Prints out HTML format with baseHREF as top directory.
  -T string     Replace the default HTML title and H1 header with string.
  --nolinks     Turn off hyperlinks in HTML output.
  ---- Miscellaneous options ----
  --version     Print version and exit.
  --help        Print usage and this help message and exit.

So, awesome, shall we see what this option does?

wskellenger@marquette ~/cm11 $ tree -d -X | more
<?xml version="1.0" encoding="UTF-8"?>
  <directory name=".">
    <directory name="abi">
      <directory name="cpp">
        <directory name="include">
        <directory name="src">
    <directory name="android">
    <directory name="art">
      <directory name="build">
      <directory name="compiler">
        <directory name="dex">
          <directory name="portable">
          <directory name="quick">
            <directory name="arm">
            <directory name="mips">
            <directory name="x86">
        <directory name="driver">
        <directory name="jni">
          <directory name="portable">

And here is what a FreeMind file looks like:

<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from -->
<node CREATED="1410111246409" ID="ID_718284210" MODIFIED="1410122249321" TEXT="Android build env">
<node CREATED="1410122250455" HGAP="11" ID="ID_1487627158" MODIFIED="1410122267863" POSITION="right" TEXT="cm11" VSHIFT="-41">
<node CREATED="1410111257071" ID="ID_181927416" MODIFIED="1410111257071" TEXT="abi"/>
<node CREATED="1410111257072" ID="ID_1980677560" MODIFIED="1410111257072" TEXT="android"/>
<node CREATED="1410111257072" ID="ID_584603213" MODIFIED="1410111257072" TEXT="art"/>
<node CREATED="1410111257073" ID="ID_821356947" MODIFIED="1410111257073" TEXT="bionic"/>
<node CREATED="1410111257073" ID="ID_1847225096" MODIFIED="1410111257073" TEXT="bootable"/>
<node CREATED="1410111257074" ID="ID_777789702" MODIFIED="1410111257074" TEXT="build"/>
<node CREATED="1410111257074" ID="ID_1798981557" MODIFIED="1410111257074" TEXT="cts"/>
<node CREATED="1410111257075" ID="ID_1299267080" MODIFIED="1410111257075" TEXT="dalvik"/>
<node CREATED="1410111257076" ID="ID_283530905" MODIFIED="1410111257076" TEXT="developers"/>
<node CREATED="1410111257077" ID="ID_1162422382" MODIFIED="1410111257077" TEXT="development"/>
<node CREATED="1410111257078" ID="ID_772625792" MODIFIED="1410111257078" TEXT="device">
<node CREATED="1410122307224" FOLDED="true" ID="ID_981437287" MODIFIED="1410122649648" TEXT="common">
<node CREATED="1410122647210" ID="ID_1480883631" MODIFIED="1410122647823" TEXT="gps"/>

To dump the output of "tree" we just do a simple redirect of the output:

wskellenger@marquette ~/cm11 $ tree -d -X > out.xml

Now we just need to make some simple substitutions in the "out.xml" file from "tree" to make it compatible with FreeMind.  This is really simple with Vim.

It looks like we need to do the following:

  1. Rename the "directory" elements to "node".
  2. Add the "CREATED" attribute with today's date.
  3. Add the "ID" attribute (this appears to hold a random number).
  4. Add the "MODIFIED" attribute, which also contains a date.
  5. Rename the "name" attribute to "TEXT"
  6. Get rid of the <?xml> element at the top.
  7. Replace the <tree> tag with <map version="0.9.0"> (use version="1.0.1" for the newer version of FreeMind).
  8. Replace </tree> at the bottom of the file with </map>
  9. Bonus hint: If you have a huge directory structure, like the Cyanogenmod file tree, you might want to add another attribute, FOLDED="true" to each "node" element.

This is really a search/replace problem.  If you don't know regular expressions, you should learn them, because this problem becomes pretty easy, except for the random number part, but even that can be solved with Vim.

So generally we will do some searching and replacing with Vim:

:%! perl -pne '$random=int(rand 100000000); s/<node/<node CREATED="1410111247071" ID="ID_$random" MODIFIED="1410111247072" /gc'
:%s/ID=/FOLDED="true" ID=/gc

I manually removed the <tree> tags and added the <map> tags.  I also manually removed the <?xml> tag at the top.  

The tricky part is in yellow: generating the random numbers.  I found the solution for that at StackOverflow.  In that line, we basically callupon perl to generate a random integer, and stuff it into a variable "$random".  After that, perl creates a vim-like search/replace string, searching for <node and updating it as shown.  Vim executes this for each and every line and performs the search/replace.  Slick.

After this, save the file and open it with FreeMind.

WARNING:  FreeMind 0.9.0 is really terrible about handling large maps.  With a huge directory tree (like what is in Cyanogenmod), you may open a few nodes and have it crash on you.  FreePlane seems to behave better with large maps.  Here is the result opened in FreePlane:

WARNING2: After you save the file in FreePlane, you probably won't be able to open it in FreeMind.  So save it as a new filename.

UPDATE: FreeMind 1.0.1 is much better at handling large maps.

Wednesday, July 2, 2014

Mint 17 install with Windows 8, machine doesn't boot...

I tried Arch for about six months but -- a running release system isn't for me.  I like the stability and ease with which Ubuntu/Mint can be maintained.  I was constantly breaking wifi and other things with Arch -- probably I was doing it wrong but, hey, when you use Linux you have a ton of choices.  So back to Mint.
After installing Mint 17 the machine didn't reboot.  I went directly to the grub2 recovery prompt and got something like this:

GRUB loading:
Welcome to GRUB!

error: file '/grub/i386-pc/normal.mod' not found
Entering rescue mode...
grub rescue>

Since you've already installed Mint (or Ubuntu), you can boot again with your LiveCD but then chroot into your new system.  This is kind of like exactly like using jumper cables on a car to get it started (this is the LiveCD), and then removing the jumper cables once the car is running (this is the chroot part).

Good instructions are here.  The important part:

Update Failure

If there was an update that made your system non-bootable and they have fixed it in the repositories, you can use the Live CD to run apt-get to get the new files to fix your system.
  1. Boot the Ubuntu Live CD.
  2. Press Ctrl-Alt-F1
  3. sudo mount /dev/sda1 /mnt  (/dev/sda8 is my Linux partition)
  4. sudo mount --bind /dev /mnt/dev
  5. sudo mount --bind /proc /mnt/proc
  6. sudo mount --bind /sys /mnt/sys
  7. sudo chroot /mnt
  8. apt-get update
  9. apt-get upgrade
If you have trouble accessing your network after chroot, you probably use DHCP and can work around this by adding OpenDNS name servers to your /etc/resolv.conf after you use chroot:

If you boot with the LiveCD and follow the above instructions, you'll be "in" your new Mint environment -- you just used jumper cables to get there.  At this point we can fix the booting issue.  (Notice that steps #8 and #9 above require you to update all of the packages on your system, this is a great idea to fix things that maybe weren't updated at the time the LiveCD was released.)

Now we need to fix grub.  If you look at my older post about installing Arch on top of Mint13, you know that I've got a Windows 8 system.  My boot partition is actually /dev/sda1 -- this is where the EFI stuff goes.  So just like I mentioned in that old post, I first need to mount /dev/sda1 to /boot/efi.

mint boot # mount /dev/sda1 /boot/efi

With that done I can run grub-install and tell it to put the efi stuff into /boot/efi (which will go into /dev/sda1 since it is mounted there).  If you are uncomfortable at this point I suggest you find some help elsewhere, like the Ubuntu forums.  There are also some tools like boot-repair that work quite well.  If you know what is going on so far, continue reading:

mint boot # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=mint17 --boot-directory=/boot --recheck
Installing for x86_64-efi platform. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Installation finished. 
No error reported. 

mint boot # modprobe efivars 

mint boot # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=mint17 --boot-directory=/boot --recheck 
Installing for x86_64-efi platform. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Installation finished. 
No error reported. 

mint boot # grub-mkconfig -o /boot/grub/grub.cfg 
Generating grub configuration file ... 
Found linux image: /boot/vmlinuz-3.13.0-24-generic 
Found initrd image: /boot/initrd.img-3.13.0-24-generic 
No volume groups found done 
mint boot #

Hm, that doesn't look good. Turns out I didn't boot the LiveCD the Right Way. I used the legacy method of booting and I needed to use the UEFI method.  I shut the machine down and restarted it. 

Now go into your BIOS setup and create a new EFI entry that will point to grub.  I talk about doing this in another old post.

To my surprise, after configuring the new UEFI option, the system booted. So I booted into my new Mint system but then I re-ran grub-install just to be sure:

wskellenger@marquette /boot $ mount | grep boot
/dev/sda7 on /boot type ext4 (rw)
/dev/sda1 on /boot/efi type vfat (rw)

wskellenger@marquette /boot $ sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=mint17 --boot-directory=/boot --recheck
[sudo] password for wskellenger:
Installing for x86_64-efi platform.
Installation finished. No error reported.

wskellenger@marquette /boot $ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
  No volume groups found
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration

wskellenger@marquette /boot $

You should be booting now.

Sunday, June 8, 2014

Jeep TJ (Wrangler) Oil Cap Breaks During Removal

Here is what happened to the oil fill cap in my 2006 Jeep Wrangler when I tried to remove it:

Isn't that nice?  Much more complicated than it needed to be, this oil cap has some teeth in it that ensure it can only be tightened to a specific torque, after which it will make a ratcheting "click click click" noise as it is tightened.  The teeth are angled such that when you remove it, they interlock and will not ratchet.

The problem is, all of these pieces are plastic.  And it's all broken.

Here is how I got the fill cap off after it broke:

And here is what I ordered from Amazon to replace it:

The new piece is solid plastic with a rubber o-ring.  It will not split in half.

Tuesday, May 6, 2014

ASUS Cube: Disable Voice Search Key, Add TV Power Key

The Asus Cube (image from
I was able to disable the voice search key on the ASUS Cube, as well as turn the Netflix key into a TV power key simply by remapping these keys in the keyboard layout file.  

I won't go into great detail about getting root on this device here, you can find that yourself.  Root is however required to proceed. 

Look for this file: /system/usr/keylayout/Vendor_0b05_Product_17ca.kl.

The /system filesystem must be mounted with read/write access.  You can do this from adb or the awesome ES File Explorer is able to do this.

Change the following lines:

change to:
key 88    TV_POWER

Reboot the device completely, a good way to do this is by issuing "adb reboot".  Another way is to disconnect the power to the device.

Now you can stop accidentally hitting the voice search key and have a "sort of" working TV power key.  The reason I say this is because the IR blaster is required, so the newly-added TV_POWER button will not work unless you have the Cube powered up already.

If you don't want to change the Netflix key, you could, for example, change the existing TV/STB key to be TV_POWER.  I am not at the moment a Netflix subscriber so this key is useless to me.

Thursday, April 10, 2014

Resistor Parts Drawer Organization

I've got a terrible resistor organizing scheme going on and I want to fix it.  So I browsed around on the interweb hoping to find some advice.  This is probably all you need, a single discussion on where several different options are discussed.  I went with the top-rated one and I also discovered several photos on Google Images of people doing it this way.

So here's how Nich Fugal did it, and I like it very much, except there is a mistake on his diagram (55 and 75 ohms are the same colors).  Easy enough to correct, he provides an Adobe Illustrator document which you can import into Inkscape if you don't have Illustrator (I don't).

While I was making the small correction, I re-arranged the glyphs to fit on Avery 5160 mailing labels, I have some laying around here from when I was printing address for Christmas cards.  Here is the Inkscape document (for printing labels) if you want to use it.

You'll see some very faint lines, these are the approximate locations of the labels -- I'm a smidge off but it is pretty dang close.  You can make these lines completely transparent for printing or delete them altogether.  There are also some centerlines that I used to center the glyphs on each label.

Here are a couple of photos:

Applying the labels, my daughter Emma holding up the labels so I could take a photo...

The finished drawers!
I will probably create some "sub" drawers for the "10_" resistors, as this drawer is pretty stuffed.  Thanks to Nich Fugal for publishing these drawings, and check out his blog, called Makeatronics.

Thursday, January 16, 2014

Arch Install over Existing Linux (Mint) Installation with Windows 8 UEFI

Wow, that title sounds like fun.

Well, it wasn't bad at all.  After using Mint for a couple years I started to get frustrated with the outdated packages in APT (to name a few: scilab, hplip, freemind, bluez).  I liked Mint just fine, and keeping the system up to date is quite painless, which is a lot more than I can say for the several years I spent with Gentoo.

That being said, as I Googled for problems I was having with my Bluetooth setup, I noted that most of the hits were generated by  I read a little about the distro and I decided to try it out.

For installers, there is so much information available on the Arch wiki it isn't even funny.  There's the 30,000 foot installation guide, which for experts is more of a checklist if you've done it a lot.  For everyone else but the sysadmins and hard-core experts, I recommend their beginner's guide.  This will have you going in no time.

The first thing I noticed was how small the LiveCD was -- it's only 500MB or so.  This is because Arch gives you a bare, and I mean BARE bones setup.  You won't find photo managers, a word processor, solitaire, and mine sweeper.  You won't find ANYTHING except the bare basics to boot the system and get you going.  Everything after that is what YOU add, and this can sometimes be shocking.  For example, if you think you might connect to a secure wifi network with your laptop, you might want to install wpa_supplicant.

Before installing Arch, I spent some time cleaning out my Mint system.  Not unlike moving day, you've got to pack your crap and move out.  This takes some time.

Once I thought I was ready to go, I knew I wasn't going to follow the beginner's guide to a T.  All I really needed to do was wipe my root partition, install the new kernel, set up the new environment, and reboot.

So, I didn't need to know about partitioning or formatting.  I knew I needed to start somewhere in that area of the guide.

After booting the LiveCD I quickly realized I needed to have some knowledge about the existing partitions.  I used lsblk:

$ lsblk
sda      8:0    0 465.8G  0 disk 
|-sda1   8:1    0   500M  0 part
|-sda2   8:2    0    40M  0 part 
|-sda3   8:3    0   128M  0 part 
|-sda4   8:4    0   500M  0 part 
|-sda5   8:5    0   232G  0 part 
|-sda6   8:6    0   7.2G  0 part 
|-sda7   8:7    0 190.8M  0 part
|-sda8   8:8    0 220.3G  0 part
`-sda9   8:9    0   4.9G  0 part

Well, I know the 200+ GB partitions are my Windows 8 drive and my Linux drive, but I wasn't sure which.  I just had to mount them and take a look around to figure out what was what.

I ended up scribbling the following down on a scrap of nearby paper:

/sda8 --> data/root
/sda9 --> swap
/sda7 --> boot/grub

I think it is obvious, but I want to note, that if you follow any instructions here you'd better be damn sure you know what you're doing.  Computer configuration can be UNFORGIVING.  If you are attached to any data on your hard drive, you'd better back everything up right now.  The computer doesn't particularly care if it blows all of your wedding pictures away.  You have been warned.

Now then -- I formatted /sda8 as ext4 (it already was formatted ext4, but I basically wanted to wipe it).  I did a "swapon /sda9", I mounted sda7 as /boot, and I chrooted into sda8.  (Okay, there was a little more to it than that but I basically followed the beginner's guide after the part about partitioning your system.)

Boom, I was in my new Linux system.  Now the tricky part was setting up GRUB.  There is a lot of info about GPT, UEFI, etc all over the Arch Wiki.  In particular see the excellent grub guide.  Most of the guides are taking you from ground zero, where you're starting with a blank drive.  In my case, I had a drive that was already populated.

In particular there are some warnings about checking for a GPT and an ESP here.

I didn't see a GPT when I tried using parted as described above.  In fact this is what I've got:

[root@marquette /]# parted /dev/sda print
Model: ATA ST500LM012 HN-M5 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                          Flags
 1      1049kB  525MB   524MB   fat32           EFI system partition          boot
 2      525MB   567MB   41.9MB  fat32           Basic data partition          hidden
 3      567MB   701MB   134MB                   Microsoft reserved partition  msftres
 4      701MB   1226MB  524MB   ntfs            Basic data partition          hidden, diag
 5      1226MB  250GB   249GB   ntfs            Basic data partition
 7      250GB   251GB   200MB   ext4
 8      251GB   487GB   237GB   ext4
 9      487GB   492GB   5264MB  linux-swap(v1)
 6      492GB   500GB   7765MB  ntfs            Microsoft recovery partition  hidden, diag

So there's my ESP, partition 1 or /sda1.  I don't see "Partition Table: GPT" as the wiki mentions.  The article also mentions:  "An EFI System Partition (ESP) is needed on every disc you want to boot using EFI. GPT is not strictly necessary, but it is highly recommended and is the only method currently supported in this article."

Okay then, I don't think I have it, and I'm not messing around with these existing partitions lest I break my Windows 8 installation.

Check out the UEFI Alternative Method.  Here we are getting into some interesting commands.  What I noticed while I was poking around on /boot is that I already have a directory called /boot/efi.  FURTHER, I noticed while poking around the EFI parition (sda1 for me), that there was /Boot, /EFI, /Microsoft, /linuxmint directories.  Inside these I would drill down and eventually find some *.efi files.  Presumably this is where the booting magic happens.

I ended up mounting /dev/sda1 at /boot/efi:

[root@marquette /]# mount /dev/sda1 /boot/efi

Following the alternative instructions on the Arch grub wiki, I did this (modified what was on the wikipage and copied below):

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --boot-directory=/boot --recheck --debug

Don't forget the equal signs after the command line arguments!  You might get errors without some of them.  If all was successful, you'll see some stuff like this at the end:

grub-install: info: executing efibootmgr -c -d /dev/sda -p 1 -w -L arch -l \EFI\arch\grubx64.efi.
BootCurrent: 0008
Timeout: 0 seconds
BootOrder: 0008,0001,0002,0003,0000,0004,0005,0006,0007
Boot0000* mint
Boot0001* Realtek PXE B09 D00
Boot0002* P4: HL-DT-ST DVD+-RW GT80N    
Boot0003* P0: ST500LM012 HN-M500MBB     
Boot0004* Windows Boot Manager
Boot0005* UEFI: IP4 Realtek PCIe FE Family Controller
Boot0006* UEFI: IP6 Realtek PCIe FE Family Controller
Boot0007* linuxmint
Boot0008* arch
Installation finished. No error reported.

It turns out all of the crap above will be visible by the BIOS -- these *are* your UEFI boot options.  You'll want "arch" to be your main entry point.  (I still have to figure out how to get rid of some the old mint stuff.)

Next do: 

# grub-mkconfig -o /boot/grub/grub.cfg

[root@marquette boot]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initramfs image: /boot/initramfs-linux.img
Found fallback initramfs image: /boot/initramfs-linux-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found linux image: /boot/vmlinuz-3.12.7-031207-generic
Found initrd image: /boot/initrd.img-3.12.7-031207-generic
Found linux image: /boot/vmlinuz-3.12.6-031206-generic
Found initrd image: /boot/initrd.img-3.12.6-031206-generic
  /dev/cdrom: open failed: No medium found
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi

Now, reboot and see if it worked.  If all went well you should see the grub boot screen.

If you get a grub command line, something went wrong.  You can try following these instructions to see if you can get up and running again.

Good luck.