A Git Primer for Sysadmins

I am writing this post with the intention of giving readers (and other sysadmins) that are unfamiliar with Git a brief introduction to get up and running as quickly as possible.  There are numerous guides out there but none I have found so far with the spin of getting things working quickly for system administrators.  I recently went through the process of submitting some work of mine to an Open Source project and went through all of the work myself and thought I would write up a little guide to getting started, just in case anyone is interested.  Because of this experience, I thought the process could be streamlined if I presented a simple set of steps and examples for other sysadmins so that they can get started and get comfortable using Git as quickly as possible.  By no means am I advocating that I am a Git expert, I simply know enough to “do stuff” so take this guide for what it is, a simple introduction.  Hopefully it is enough to get the ball rolling and get you hooked on revision control!

Step 1:  If you haven’t already, head over to github and set yourself up with a free account.  The steps are trivial, just like setting up any other account.  You will need to install Git on you machine locally so that you can do everything, sudo apt-get install git in Ubuntu, or, with a little more legwork if you are using Windows.

Step 2:  Once you are all set up and running you can either create a new repository or fork off of somebody else’s repo, which will essentially make a copy of their work to your user account in github.  Since I was contributing to a public project I forked their repo.  This is typically (for beginners at least) done through the website by browsing to the project you are interested in and then clicking the fork button at the top right.

Fork a repo

Once you have copied or forked the project you want, you can begin working on making your own changes and updates to the project.  This is where much of the initial confusion came in for me.  I should make a note here; there are a few things that must be done through the website and others that should be done with the git tool you downloaded and installed earlier.

Step 3:  Clone the repo down to your machine locally to begin making changes.  This is done via command line with the following:

git clone https://github.com/$username/repository.git
git clone https://github.com/jmreicha/curriculum.git

Once you have the repo cloned down to your machine, let’s create a branch which we will use to work on the specific piece of the project we are working on.  There are a few more common commands that are used for working with repos.  In some scenarios the public project may change or get updated while you are working on it so you might want to pull in the most recent changes to your own fork.  The following commands are used to work with public repos and forks.

Fetch new changes from original repo:

git fetch upstream

Merge the fetched changes into your working files:

git merge upstream/master

Pull newest updates and changes from a for or repo:

git pull

Okay, let’s assume that our repository is all up to date and we are ready to start working on the new changes that we want to make.  First, we need to create a local branch to make the changes on.  The command for creating a branch is:

git checkout -b $topic
git checkout -b my_topic

Where $topic is the specific change you will be working on.  Then go ahead and make your changes and/or updates with your favorite text editor.  If you have multiple changes to make it may be a good idea to create a few different branches using the command above.  To switch between branches use the following:

git checkout $branchname
git checkout my_topic

If you are working on a branch and either don’t want to commit the changes or the branch becomes obsolete, you can delete the branch with either of the following commands:

git reset --hard
git branch -d $branchname
git branch -d my_topic

Step 4:  Assuming you are all done with your branches and are finished making your changes the next step is to commit the changes.  This will basically record a snapshot of (the state) the files.  Typically for a commit you will want to do one thing at a time to keep track of things more easily.  So you will make one change and then commit and then repeat if there are numerous changes that need to be made.  The command is:

git commit -am "update goes in here"

Now that we have created a branch, made our changes, written our changes so that git knows about them and can keep track of them, we are ready to go ahead and merge the code that we have changed locally back up to github.  Start by pushing the branch up to the github repo.

git push $remote $branchname
git push origin my_topic

Next, merge your changes.  This is done by changing to the “master” branch and then issuing a merge command on the branch that was created to make changes into.  So here is what this process would look like:

git checkout master
git merge $branchname
git merge my_topic

alternatively if you just want to quickly push out a change to the master branch you can issue a git commit locally and then a git push to update the master branch without merging the items first.

git commit -am "updated message"
git push

I like to use this for local repositories where I just need to get things up quickly.

Step 5:  At this point everything should be accurate on your own personal github page.  You can double check your commit history or look at the last update time to make sure your changes worked their way into your public fork or repo.  If you are contributing to a public project the final step is to issue a pull request on the github site.  Once this is done, wait to hear back from a moderator of the project if your changes need to be fixed before they accept them or wait for a response saying that your changes were good and get merged to the project.

Git, to me, was a little bit confusing at first.  Like I said earlier, I still only have a generic and basic understanding but I think it is important for system administrators to know how to commit code to projects and how to keep track of their own code and projects as well.  Even if the code is only small scripting projects it is still beneficial to publish since github is a public site.  Potential colleagues and employers can browse through your work, which increases your visibility and can even lead to job offers.

If you’re interested in learning more, I found this site to be a great resource.

Read More

Setting up Git in PowerShell

It seems like everybody is using git these days.  And for most, not everybody is stuck using Windows in their day to day workflow.  Unfortunately, I am.  So that means it is much more painful to get up and running with a lot of the coolest and best open source projects that are offered by members of github and other online code repositories being shared via git.  However, there is hope and it is possible for Windows users to join the git party.  So in this post, I would like to describe just how to do that.  And it should only take a few minutes if done correctly.  I will mention beforehand that there are a few steps that need to be completed in order for this technique to work successfully that typically are taken care of in a Linux or OSX environment.

The goal of this post is to work through these steps as best I can to get users up and running as quickly as possible and as easily as possible, reducing the amount of confusion and fumbling around with settings.  This post is designed for beginners that are just getting their feet wet with git but hopefully others can use it as a resource if they are coming from a different environment and are confused by the Windows way of doing things.

First step – Download and install the git port for Windows.

This is pretty straight forward.  Download and run the executable to install git for Windows.  If you just want to get up and running or are lazy, you can leave all of the defaults when you run through the installation wizard.

Second step – Add the git binaries to your system path variable.

This is the most important step, because out of the box git won’t work in your ordinary PowerShell command prompt, it needs to be opened separately.  So to fix this and add all the necessary binaries open up your environmental variables (in Windows 8).

Computer -> Properties -> Advanced -> Environmental Variables

environmental variables

and add the following value to the PATH variable.

C:\Program Files\Git\bin

Here is what this should look like in Windows.

path variable

Third step (optional) – Download and install posh-git for better PowerShell and git integration.

I have highlighted part of this process before in an older post but will go through the steps again because it is pretty straight forward.  To be able to get posh-git you need to have a sort of PowerShell package management tool called PsGet (instructions here).  To get this tool run the following command from your PowerShell command prompt.

(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex

Once the command has completed you should be able to simply run this install command and be finished.

install-module posh-git

That should be it.  With these simple steps you should be able to utilize git from the command line like you are accustomed to on other operating systems.  As I said, there is a tad more leg work but you can really utilize the flexibility of PowerShell to get things working.  I hope it helps, and as always let me know if you have any tips or questions.

Read More

Evo 4G Customization Goodness

Since my initial rooting and unlocking project last weekend I haven’t been able to stop thinking about the shiny new ROM I have installed and how awesome it is.  So now that I have the taste for flashing custom ROM’s, I wanted to see what else was out there.  I did some digging and learned (to my happy surprise) that the Evo 4G, or the “OG” as community members refer to it as, is still alive and well, with a very talented community and very active user base.  Especially for a device that is nearly 3 years old.

If you missed my original ROM flashing post you can view it here.  That should get you up speed.

Custom ROM’s can be confusing and maybe a bit intimidating at first but once you start to wrap your head around the concept then things get much easier.  If you have any questions let me know and I will do my best to help explain things as best I can (from my own understanding of how it all works at this point).  I am certainly new to this as well but am quickly beginning to understand the power and draw behind custom ROM’s, especially for tinkerers and people that are interested in DIY tech projects, there is really a whole world out there to go explore for this type of stuff.  I would take a look at XDA Developers forum for a good place to get started on many of these topics.

I am working on putting together a list of the latest and greatest ROM’s that I have stumbled across since my initial flash using the MazWoz Jelly Bean ROM last week.  I will also try to offer some perspective and comparisons between these custom ROM’s to help you choose which one will suit your needs and will work best in your use case.  All of the ROM’s that I have been testing are currently all 4.2.x (Jelly Bean) and are all fantastic, so if you are having trouble picking one out I would advise that you just pick one.  More than likely it will be a good fit.  The only difference between many of these are small subtleties such as specific themes, customization options, look and feel and a few packaged apps here and there.  So for example, Slim Bean offers a UI “pie controls” that aren’t built in to some of the other ROM’s.  But for the most part many of these ROM’s are using a lot of the same “stuff” in the background.  There are probably more out there but I will just be covering the most popular and most active ROM’s that I cam across, so let’s go ahead get started.

MazWoz – http://forum.xda-developers.com/showthread.php?t=1947452

This is a great ROM and the first custom ROM that I tried.  Nearly everything is working currently, it is certainly stable enough for every day use IMO.  It did a hot reboot on me once and the camera was a little bit on the glitchy side, there were some strange GUI effect glitches every now and WiMax is broken (which won’t get a fix it doesn’t look like but who cares) but otherwise worked flawlessly, it is very snappy and responsive, it provides a buttery smooth experience.  I would highly recommend giving this ROM a shot since it is both stable and smooth.  It isn’t quite there 100% on all the new Jelly Bean features but it is getting there and is under active development by its creator and maintainer.  The latest release was about a month ago so hopefully there will be an update to provide some of these niceties in the near future.

Slim Bean – http://forum.xda-developers.com/showthread.php?t=2217412

Currently testing this ROM out.  So far so good, it is fast and everything I’ve tried seems to be working correctly.  This ROM is designed to be light weight and snappy, so only basic themes, look and feel and apps although I will say that after booting initially it felt a very tiny bit slower than the MazWoz ROM but this slowdown was still very tolerable.  I suspect there may have been issues since it was trying to sync up and download things in the background, because everything has been working much more smoothly after the everything is in sync.  The camera works slightly more fluidly than the MazWoz camera and there do not appear to be any other noticibly odd glicthy behaviors with the GUI.  Other initial findings were that there is no WiMax (again expected) and no front camera.  This ROM is very smooth and there is support for facial recognition and unlock which is pretty slick.  There are some other cool features baked in such that other ROM’s do not offer such as “The Real Dark Slim (TRDS)” which is basically a customization engine for this particular ROM as well as Slim PIE and a few other unique customizations for this ROM which allow for a more fine tuned experience.

Cyanogenmod 10.1 – http://forum.xda-developers.com/showthread.php?t=2244061

This is the defacto for custom ROM’s currently, it easily has the largest user and developer base and its latest version has been ported over to the Evo 4G.  This is pretty much the most complete package as far as custom 4.2.x ROM’s go.  It has basically every standard feature that comes along with this version of Android as well as a ton of tweaks and improvement, including pie controls and speed/optimization improvements and other nice goodies.  There is no official release for this build because this current port literally just happened not more than a few weeks ago but I’m sure the word will spread quickly.  So far I have liked this release for the most part, there are some issues though, such as a little big of glitchiness as with the other releases I have tried, the swype style keyboard doesn’t work all the time, the launcher (trebuchet) crashed ones, no front camera, some of the camera options aren’t perfect either and there is no WiMax support.  These are really just small gripes though and outside of that it is snappy and also probably the smoothest ROM I’ve tried so far.  It has some slick features built in including a custom launcher, file manager and media player, as well as some additional themes and widgets built in which are a really nice touch.  The CyanogenMod is an all around good experience and with all of the little additions and bells and whistles built in has been my favorite ROM so far.

AOKP – http://forum.xda-developers.com/showthread.php?t=2257194

This is one of the newer projects out there but it is gathering steam and the community as well as developers have really worked hard to make this ROM very nice.  The features of this ROM are on par (some may even say better) than Cyanognmod and this ROM certainly delivers so very nice customization options as well as a stable and fast platform.  I have only recently tried this ROM out myself yet so I can’t report on all of the issues that it has other than the standard issues that all of these ROM’s suffer from.  No front camera, no WiMax, some weird camera issues, etc.  Nothing out of the ordinary.  I have really liked the quickness of this ROM so far, I’d say it is on par or better than Slim Bean and offers a really nice experience overall and the ability for a lot of customization.  I would definitely recommend trying this ROM out.  The only caveat for getting this ROM to work correctly is that you need to partition your SD card prior to flashing, otherwise you will suffer from boot loops which caught me originally.  Other than that, it is pretty straight forward to flash and use.

Evervolv – http://forum.xda-developers.com/showthread.php?t=2172323

This one is worth a mention as well but seems to be losing some of its previous favor amongst the community as of late (at least as far as I can tell, I could be totally wrong about this though).  It seems like a lot of ROM’s are built using much of Evervolv’s code but the project itself isn’t quite as popular as it was at one time.  I haven’t tried this ROM out for myself yet, I just found that it was worth a mention because of its support for the Evo 4 G.  I might come back and update this post if I ever switch and try this ROM out, but I just can’t get away from Cyanogenmod right now.

Read More

Hack your Evo 4G into a High End Smart Phone

I was in desperate need of a phone upgrade recently and ran across a nice little deal on an old Evo 4G (not to be confused with the Evo 4G LTE) on craigslist this past weekend, which to my surprise turned into a nice little phone hacking project.  Luckily for me the phone I got was basically in mint condition as it belonged to an older gentlemen who I imagine didn’t get a lot of mileage out of it.  On top of that, it was layered in protective casings.

Sometimes buying phones on craigslist can be scary and turn into a crap shoot but in my own experience I’ve found them to work out more often than not.  The two pieces of advice I can offer when buying a used phone on craigslist are to have the seller send you the ESN number prior to meeting so you can check to make sure it is active (there are many online ESN checkers out there).  The other, simple advice is to look at the phone when you meet and make sure you can turn it on and off and that it can hold a charge.

I also want to take a moment and tell everybody about the provider I use, which is Ting.  Why?  Because they are awesome and super easy to use.  Ting offers a very competitive price and doesn’t require contracts, which I believe are important things to consider when selecting a provider.  Anyway, I could probably write an entire post about how awesome Ting is and why you should use their service but I will forego the details for now.  I just wanted to mention that you can activate your phone entirely on your own in like 5 minutes, which helped me out a lot with this project.  There are detailed instructions on their site about activating new/used phones and porting over numbers, it is easy and Ting even encourages its users to root and unlock their phones.  Long story short, Ting is awesome, it made this project much easier and you should give them a try.

Once you do all the running around and finally get your phone it is time to actually get down to the fun stuff.  I learned that rooting the Evo 4G was a bit tricky since it had all of the newest firmware and protection from HTC.  I have had less issues with rooting some other HTC devices in the past, but I don’t know how that effects the steps if the software and firmware change.  In all reality the additional steps are just a technicality I would say and aren’t too much of a hindrance.  So in the following details I will outline the process of getting your phone from the basic locked version of HTC Android to a fully unlocked phone with the capability of running custom ROMS, namely the MazWoz ROM which is currently the Jelly Bean ROM that I am using for the Evo 4G.

The first step is to get root.  This is essential because without it you will not be able to get S-OFF and be able to flash custom ROM’s.  Rather than go into great detail and post all of the steps here I will instead point you in the right direction on how to get started yourself.  There are a ton of guides out there already on how to do this and there would really be no point to add another to that collection of guides, since there are some really good ones out there that have all the links and resources.  I found this one and this one to be the most relevant and helpful.  The first one is especially nice because it offers some video guidance as well as written.  Basically when I got stuck with one of the guides I would just switch back and forth and reference the other.   I feel that they both definitely compliment each other very well.

The second step is to obtain S-OFF.  Use the links mentioned previously for obtaining root to obtain S-OFF as well, after you root your phone.  This step was very confusing to me at first so I thought I would clarify the process to make things easier for readers to understand.  Once you have root on your phone you can The major issue I ran across with this step was when I reached the step for copying over the flashimage and mtd-eng.img files.  To get this step to work I had to be in Fastboot mode to gain read/write access to the sdcard.  Other than that, everything else worked great.  I should also note that for S-OFF I chose to use to use revolutionary.exe following the instructions from the first site.  I think the steps for flashing S-OFF using the unrevoked method from the second link would work fine, maybe even preferably, I just never tested this myself.

The third step is to flash the custom ROM, along with the other apps and fixes that turn your phone in the Jelly Bean device.  Jelly Bean brings with it a number of features and improvements that make for a much better, much smoother smart phone experience.  It is really leaps and bounds above the stock version of Android OS that is shipped by default on the Evo 4G and the experience is often referred to as “buttery smooth” because it is so nice.  Here is the link for getting the MazWoz Supersonic ROM.  I used the B4 release, which is the most current as of this writing as well as the link to Gapps and the GPS fix.  As of the B4 release the WiMax wasn’t working and the video is a little glitchy and the front camera isn’t working but other than that, this ROM is a fully functioning 4.2.1 Jelly Bean image.  The WiMax isn’t important to me as I don’t have access to it where I live and the video isn’t really a big issue for me either since I don’t shoot a lot of video.

The positives of using this custom ROM immensely outweigh the negatives in my opinion. So all in all, hacking an almost 3 year old phone in about 3 hours time into a usable Jelly Bean device that typically sells for upwards of $300 for the bargain $80 price tag seems like a steal to me, the experience is nearly flawless.  Granted there are a few caveats and you need to be willing to follow the steps for the upgrade but in my opinion this is still a great deal.  You get to a) revive an old piece of hardware that is beginning to show its age, b) save a shitload of money on the cost of a new phone and c) get to tinker with your phone, which to me was the best part out of this project.  Here is a link to some other devices that have been quickly faded in popularity that can potentially be updated and given new life.  My hop is that this post will inspire you or at least give you some ideas to go and check what’s out there and maybe even help breathe some new life into some of your otherwise antiquated and dying android devices.

Read More

8 Golden Rules for Sysadmins

Getting the most out of your career can be rewarding.  Today I feel like taking a minute to slow down and reflect on a few of the things that I have observed in my time as a system administrator that I believe lead to success.  The following are some general rules that I have found to be true both in my work and more generally, many of these rules are just attitudes which can be applied to life as well.  Hopefully these come as common sense to you but it is always good to take time to reflect on good things.  I hope this isn’t too cliche or too much of a time waste for many of you but rather an opportunity to take a moment and analyze your current situation and potentially reevaluate anything you feel to be a weak area or area that could use improvement.

1. ) Always have a backup. Good backups are an invaluable asset to you as a system administrator, and can be a great bargaining piece if necessary in political battle.  Often times backups are overlooked by IT staff, so by ensuring you have good backups (you must always test them!) you are covering your own ass and are able to deflect blame if something out of your control occurs.   As a bonus, you look like a hero when the CEO or president of the company needs files from a month ago and have no idea where to turn, you will look like a magician and could potentially strengthen their view of IT.

2.)  Be likable. It can be a sad truth but many promotions hinge on whether or not people like you. You may be far and away the smartest, most technical or most talented person on your team but it is not going to get you very far if you are an asshole, and people don’t like you.  In this profession it is the case more often than not I see colleagues take the “holier than thou” approach which just perpetuates the stereotype that IT people are jerks.  If you can manage to be smart and not an asshole in IT you will go far.

3.)  Learn how to write. This doesn’t mean you have be able to produce enough volume for a novel, just use writing to develop your own voice, and use it as a way to communicate things effectively.  The great thing about writing is, the more you do it, the easier and more impactful it becomes.  Use your writing as an opportunity to help position yourself for success in the future.

4.)  Learn to program. Again, following up on the last point; this doesn’t mean that you need to become a software engineer, this is just the ability to quickly patch some code together to automate something that you are doing every day or having the ability to look at some process and say, “hey, I bet I could write a script to make this work better”.  It will make you more productive and efficient and will free up your time for other important tasks.

5.)  Patience. In this line of work the number one virtue any Sysadmins can have is patience. Being able to be pulled away from your work multiple times a day to help with completely unrelated issues can quickly become frustrating so having patience to deal with these things is incredibly helpful. And if you can deal with distractions well, people will like you more. Reference rule #2 for more on that.

6.)  Never stop learning.  System administration changes considerably quickly, which in my opinion is great, if you embrace it.  New technologies are always are always on the horizon, companies get bought and integrated into other companies all the time and technology strategies change all the time.  It is a never ending game of catch up for the sysadmins, so if you become content with where you are at and don’t keep up on your studies and on your technologies you will surely fall by the way side sooner than later.

7.) Attention to detail.  This one can be a real difference maker.  There is something to be said for tidiness and orderliness in system administration. Not only does it make things much easier to fix when everything is in a specific place, but it just makes you look better and in all reality doesn’t take much time to do things correctly. We all know the reckless admin who pays no attention to the mess they are making, and in turn it reflects poorly on their character.  Even if they are a genius and amazingly talented, it makes that person look sloppy and lazy to me.

8.) Balance your life.  This helps prevent stress and burnout.  Work and everything associated can get stressful at times so finding a balance becomes a great benefit when you learn how to manage it correctly.  Being able to leave work at work when you need to is crucial in keeping your sanity, but that’s not the only thing that’s important in balancing your life.  It is also helpful to find things outside of work that you enjoy doing.  Whether that be a hobby, interests outside of work, exercise, an interest group, vacations, whatever.  When you spend time focusing on the things that make you happy outside of work it will recharge your spirit more quickly and ultimately help keep you happy as well as productive at work.

Did I miss anything?  Have any other helpful tips that you’d like others to know about?  If so, let me know.

Read More