Sunday, 22 July 2012

Upgrading Android Phone With Linux

I've had a Samsung Galaxy S II with Android 2.3.3 from Virgin Mobility in Canada since last year at this time. Part of the reason I went Android is I wanted to get away from having to have a Windows VM just to manage my phone. When I got the Galaxy I asked how upgrades worked, and I was told it was a stand-alone upgrade.

Time goes by and I rather enjoy not having my phone's behaviour change every time I plug it in to my computer. For that matter, I enjoy not having to plug it into a computer all the time. Lately, however, some of the things that I didn't like about my phone bugged me enough that I thought I should do something about them. And before doing that, I thought, well I better upgrade Android first.

So it turns out I needed a PC or a Mac to upgrade using the Samsung Kies software. No stand-alone upgrade like they told me. Crap. Well, I thought, I'm a Linux user so suck it up and Google for the solution. Many Androids do indeed have a stand-alone upgrade on the phone, and people report it works quite well, although it's best to be connected to WiFi first. I suspect, therefore, that either it's something that Virgin/Bell did to their version of Android, or it's an artefact of the old version of Android.

In other words, these instructions are only for if you can't find the stand-alone upgrade on your phone. Look under Settings-> About Phone.

Without the stand-alone upgrade, here's what I did:
  1. I went to samfirmware.com to find the version of software for my exact model of phone, a GT-I9100M and download it. The version I got was 4.0.3 (Ice Cream Sandwich)
  2. I uncompressed it
  3. Heimdall is the Linux program to flash the Samsung's firmware. I downloaded heimdall 1.3.1, both frontend and the base, from the heimdall github site. At the time I wrote this, heimdall 1.3.2 was the most recent, but apparently it had an issue and the Internet recommended using 1.3.1
  4. I installed each of the .deb files by double-clicking on them
  5. I ran "sudo heimdall-frontend" in a terminal. I had to run it with sudo or I would get a "libusb error: -3" [Update: On another system I got "heimdall-frontend: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory" when I installed the 32-bit Heimdall on a 64-bit Linux Mint.]
  6. Somewhere around here you may want to back up your phone. I didn't, but I was quite confident that most of what I have on the phone is also in the cloud somewhere. I copied all my photos to my computer before starting the upgrade
  7. The phone has to be in "download mode" before connecting to it with heimdall. To put it in download mode, turn off the phone, disconnect the USB cable, and hold down Volume-Down, Power, and Home all at the same time for a few seconds. The phone shows a display that it's in download mode within a couple of seconds. To quit without downloading anything, just hold down the power button for five seconds or so (http://forum.xda-developers.com/wiki/Samsung_Galaxy_S_II_Series#Download_Mode)
  8. I prepared the firmware to flash according to the Heimdall instructions: https://github.com/Benjamin-Dobell/Heimdall/tree/master/Linux, under the heading "Performing a Custom Flash with Heimdall Frontend". Note that the instructions say to get the PIT file from the phone first
It took a couple of minutes to download all the files. For the larger files the feedback would pause every once in a while. I was patient and waited and it continued after a brief pause.

Once it's done the phone rebooted and set about doing a bunch of post-install updating. It took maybe ten minutes tops and the phone was ready to go. My memos were still there.  I lost all my playlists. As far as I can tell, that's all I lost (but then I don't have a lot of stuff on my phone that isn't in the cloud).

Finally, an annoying irony: One of the first things I noticed when I started to use the new version is that it does indeed support a stand-alone upgrade, so now all I need to do is connect to WiFi and upgrade.

Wednesday, 23 May 2012

Getting to Xubuntu


I don't want to start a flame war, but I've been unable to adjust to Unity. So I've been using Xubuntu for some months now. I just installed the Xubuntu packages over my Ubuntu 11.10 from the instructions here: http://www.psychocats.net/ubuntu/xfce.

After installing Xubuntu, some things still seemed to be weird. Much of it I could imagine might have to do with the fact that I had a lot of perhaps unnecessary Ubuntu stuff hanging around my system. So yesterday I finally followed the excellent instructions at: http://www.psychocats.net/ubuntu/purexfceoneiric to get rid of the unnecessary stuff.

I had to reinstall LibreOffice and a few other packages after following the instructions. It's worthwhile to capture the output of the command given by the link above, so you can see what's been removed.

I had one obscure problem that gave me many hours of angst. When I restarted my computer, it wouldn't boot. By booting to a live CD and checking /var/log/syslog, and Googling, I discovered that /etc/lightdm/lightdm.conf was sending me to the unity-greeter. I had to change /etc/lightdm/lightdm.conf to look like this, and then I could happily boot again:


[SeatDefaults]
greeter-session=lightdm-gtk-greeter
user-session=

I knew that after switching to Xubuntu but before following the above instructions, my startup was still going to the Ubuntu login screen, rather than the Xubuntu login screen. Part of the reason I was trying to go to "pure" Xubuntu was to get rid of the Ubuntu login and get to a pure Xubuntu experience.

I can't say enough good things about pyschocats. She has done an excellent job of documenting a number of tricky topics.

Thursday, 16 February 2012

Sluggish Ubuntu Video

Since I got my Dell Vostro 1440, I felt that it wasn't quite as responsive as it should have been. Yesterday I spent a little time trying to figure out why that might be. (A little time -- like all morning.) I stumbled across what seemed like good instructions on troubleshooting Linux video. At the start of all the instructions was a warning to make sure the user was in the video group. If not, the user's desktop wouldn't be able to use the graphics hardware.

Well I checked my groups, and sure enough I wasn't in the video group. I added myself to the video group, and after logging out and in, and a day of use, I'm confident in saying that the desktop is much more responsive.

More Googling turned up a useful command: 'glxinfo | grep "direct rendering"'. It will tell you "yes" if you're going straight to the graphics hardware.

Friday, 27 January 2012

Installing Ruby on Rails on Ubuntu 11.10

[I've made an important change to this post -- steps 3 and 4 below are new. Apologies to anyone I've lead astray.]

I'm back to playing with Rails a bit. NetBeans for Ruby is gone, so I'm going to do things the macho Rails way and just develop with an editor and a bunch of terminal windows. (One of my open source rules is "do whatever everyone else is doing." Trying to use an IDE with Rails was always a violation of that rule.)

rvm
 is a great idea. I found it really helpful to read about named gemsets early on. I had to install rvm, then install rails and a few other packages.
  1. Install the Ruby Version Manager (rvm) from these instructions
  2. Put this line at the end of your .bashrc: "[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function"
  3. Run "rvm requirements" in a terminal window
  4. Install all the packages the output of "rvm requirements" tells you to install (apt-get install...). You must do this before you start installing any rubies with rvm. If you don't, you may have all sorts of problems crop up later, like weird messages from irb ("Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.")
  5. Do the following in a terminal window:
rvm 1.9.3 
rvm --default 1.9.3 
gem install rails 
sudo apt-get install sqlite 
sudo apt-get install libsqlite3-dev 
sudo apt-get install nodejs 

Now create an application to test:

rails new testapp 
cd testapp 
rails server 

Browse to localhost:3000 and you should see the Rails default page.


Sunday, 22 January 2012

Know What You're Building

"Know what you're building" seems like an obvious thing to say, but I don't think we do it that well in IT. For my recent data centre relocation project, we applied that principle successfully to a couple of areas. The network lead wrote up exactly what he was building, and the storage lead listed out every device he needed. But we never did a complete "final state" description of the new data centre.

It all worked pretty well, although we needed a number of meetings during the design phase of our new data centre -- laying out the racks, non-rack equipment, power, cabling for the networks. I think we needed to have a lot of meetings because there isn't a commonly accepted way to draw a plan of a data centre that covers the requirements of all the people in the room.

I'm running into the issue again in a smaller way now that we're designing the new central communication room for the equipment that used to be in the old data centre, but needs to remain behind for local operations (mostly the network gear to service a large office building).

Just as a refresher, here are all the people you need to involve:

  • The server team(s) know the physical dimensions of the servers, their weight, how many network ports they have and how they need to be configured, whether they need SAN-attached storage, backup requirements, how much power and cooling the server needs
  • The network team(s) know the network devices, which have most of the same requirements as servers, the approach for connecting, which defines the need for cables and patch panels, and the cabling, which may affect weight of cable trays or floor loading
  • The storage team(s) know the switching devices, which have most of the same requirements as the network devices
  • The electrical engineer or consultant needs to know all the power requirements and placement of all the equipment
  • The mechanical engineer or consultant needs to know the cooling requirements and placement of all the equipment
  • The structural engineer or consultant needs to know the weight and placement of all the equipment
  • The trades who actually build it all need to know exactly what they're building
  • There's likely some other poor person, maybe a building architect, who has to pull this all together

Add to all that the fact that the technology in a data centre is constantly changing, at least in terms of the number and type of servers in the room. Also, the requirements and constraints tend to be circular: For example, the number of network ports on a server affects the amount of network gear you need, which affects how many servers you can have (either through port capacity or rack space), which affects how much power and cooling you need but also how many network ports you need.

You also have to worry about other details than can seriously derail an otherwise great plan. For example, when running fibre, you need to make sure it's the right kind of fibre and that it has the right connectors. Power cables in a data centre can be varied, so again you need to make sure that the power distribution units (PDUs) in the racks can be connected to your servers.


With all this, it can be hard for people to come to an agreement on what to build. We don't have well-established ways of describing what's going to be built in a way that everyone understands. There's software to help do this, but it tends to be unreasonably expensive for a medium-sized enterprise.

Regardless of how hard or expensive it is, there's a lot of value in figuring out what you're going to build, before you built it. We were successful using Excel and Word to describe what to build, and drawings of floor plans. We had to be extremely careful about versions and keeping the different documents in sync. In the end, happily it all worked out.

Friday, 30 December 2011

Manual Two-Sided Printing

In my home office, I have a multi-function printer that does pretty much everything I typically need, except printing two sides. Here's how I get two-sided printing when I need it.

The printer is an HP CM1312nfi. It prints on the side of the paper facing up in the paper tray. The "far end" of the paper in the paper tray is the top of the page.

I print the even-numbered pages first. These are the "back side" or "left pages".


Print in reverse order.


I take the paper from the output tray, and turn it so that the blank side is up, and the top goes into the far side of the paper tray.

Then I print the odd-numbered pages. These are the "right side pages".


Print in forward order.


This only works for one copy at a time if I have an odd number of pages in the document. That's because you need one extra page when you print the second time to get the odd number of pages.

The screen shots are LibreOffice 3.4.4.

Saturday, 10 December 2011

Relocating Data Centres in Waves

I've never had to relocate a data centre in one big bang. You hear stories about organizations that shut down all the computers at 5:00 PM, unplug them, move them, and have them up by 8:00 AM the next morning, but I've never done that.

The big bang approach may still be necessary sometimes, but you can mitigate a lot of risk by taking a staged approach, moving a few systems at a time.

Conventional wisdom on the staged data centre relocation is to move simpler systems, and test and development systems, first. This lets you tune your relocation processes and, particularly if you're moving into a brand new data centre, work the kinks out of the new data centre.

It sounds great in theory. In practice, we ran into a few wrinkles.

I'd say the root source of the wrinkles traces back to our environment: We had a lot of applications integrated through various tools, and a large J2EE platform running a lot of custom applications. Also, even though we had some months to do the relocation in waves, we didn't have an infinite amount of time. On top of that, business cycles meant that some systems had to be moved at certain times within the overall relocation period.

The net result is that we ended up moving some of the most complicated systems first. At least we were only moving the development and test environments. Even so, it turned out to be quite a challenge. We were slammed with a large workload when people were just learning the processes for shipping and installing equipment in the new data centre. The team pulled it off quite well, but it certainly increased the stress level.

I don't think there's much you can do about this. If your time lines force you to move complicated systems first, so be it. The lesson I take away is to identify early in planning if I have to move any complicated environments. On this project, I heard people right from the start talking about certain environments, and they turned out to be the challenging ones. We focused on them early, and everything worked out well.