Sunday, May 25, 2014

Downgrade Apple TV 2 so we can jailbreak it

I recently found an AppleTV 2 just collecting dust in my fathers basement. Since I am already running XBMC in the family room on an original 40GB AppleTV via Crystalbuntu 2.0, it was an easy decision to want to put XBMC on it. When I booted it up and went to the about section within settings it showed that it was running software 6.1.4. In order to be able to install XBMC on it I have to jailbreak it and in order to jailbreak it, the software version needs to be 5.3. Hence the reason for the post.
A critical thing to point out is that this is a version 2 AppleTV, version 3 AppleTV's haven't been jailbroken yet so if you're going to attempt at putting XBMC onto an AppleTV that you're going to buy ensure it's a version 2. Here's a video I found which explains which version is which.
This post will show you how to get your device downgraded in case it's running any software which is higher than 5.3.
Items you'll need to complete this task;
-AppleTV version 2
-Computer running Windows with iTunes installed (I used Windows 7 Ultimate and iTunes 11.2.0.115. NOTE: you can also do this within OS X but these instructions only cover using Windows)
-Micro-USB cable (do NOT use a usb hub or usb extender)
First you'll need to download the 5.3 ISPW file, I got mine from here: atv 2 5.3 ISPW
Download that ISPW file and store it on your desktop for now. In order for us to downgrade the software on your atv 2 we'll need to get the device into DFU mode. Connect power to your atv 2 as well as connect the micro-usb cable to the back of the atv 2 and the other end to your computers usb port. Using the atv 2 remote hold the menu button along with the play button for approximately 10 seconds until the light on the front of the atv 2 starts blinking. If you did it correctly iTunes window should appear and state that your device is in recovery mode. That's what we want. If yours does anything like mine it wasn't as easy to get it into DFU mode as it sounds. The following steps are what worked for me:
-Press menu+down for around 10 seconds and you'll see the light blink, this restarts the atv 2
-Remove the power cord from the back of the atv 2 (it's still receiving some power from the usb plug)
-Press menu+play for approximately 7 seconds or so (this should put it into DFU mode)
-Replace the power cable and continue
iTunes should now show that your device is in recovery mode.
It's now that you hold the shift key on your keyboard and click on "Restore Apple TV...", navigate to where you stored the 5.3 ISPW file (your desktop if you followed along) and double click it, click Restore. iTunes should now be restoring your AppleTV 2 to software version 5.3. After approximately 5 minutes iTunes will inform you that your device has been restored.
You can now unplug the micro-usb cable and connect the HDMI cable to your TV. You'll be presented with the screen where you choose the language you want your AppleTV 2 to be and proceed thru the setup and that's it. You're done. Your device is now running software version 5.3 and is ready to jailbreak.
I may create a blog post covering how to jailbreak your AppleTV 2 but it all depends on how busy I am.

-Ubu out

Saturday, May 17, 2014

Ubuntu 13.10 upgrade to 14.04 failure

I was running Xubuntu 13.10 for a couple months, it was a new installation (not an upgrade from a previous version) when I had built my current Haswell all purpose rig. I had just upgraded my server from 12.04.4 to 14.04 so I figured it was finally time to upgrade my workstation to 14.04. Normally going from 1 release to the next is as simple as clicking the Update Manager located within System but I was receiving an error. It was
ERROR:root:Could not find any typelib for Dbusmenu 
ERROR:root:Could not find any typelib for Unity
WARNING:root:can not import unity GI cannot import name Dbusmenu

(update-manager:2799): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:3274:48: Expected ',' in color definition
Checking for a new Ubuntu release
(do-release-upgrade:2872): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:3274:48: Expected ',' in color definition
** (do-release-upgrade:2872): WARNING **: Failed to load shared library 'libwebkitgtk-3.0.so.0' referenced by the typelib: libGL.so.1: cannot open shared object file: No such file or directory
/usr/lib/python3/dist-packages/gi/_gobject/__init__.py:58: Warning: cannot derive 'DistUpgrade+ReleaseNotesViewerWebkit+ReleaseNotesViewerWebkit' from non-derivable parent type 'void'
  _gobject.type_register(cls, namespace.get('__gtype_name__'))
Traceback (most recent call last):
  File "/usr/bin/do-release-upgrade", line 152, in <module>
    fetcher.run()
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherCore.py", line 274, in run
    if not self.showReleaseNotes():
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcher.py", line 71, in showReleaseNotes
    res = self._try_show_release_notes_webkit()
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcher.py", line 81, in _try_show_release_notes_webkit
    from .ReleaseNotesViewerWebkit import ReleaseNotesViewerWebkit
  File "/usr/lib/python3/dist-packages/DistUpgrade/ReleaseNotesViewerWebkit.py", line 35, in <module>
    class ReleaseNotesViewerWebkit(WebKit.WebView):
  File "/usr/lib/python3/dist-packages/gi/types.py", line 175, in __init__
    super(GObjectMeta, cls).__init__(name, bases, dict_)
  File "/usr/lib/python3/dist-packages/gi/_gobject/__init__.py", line 46, in __init__
    cls._type_register(cls.__dict__)
  File "/usr/lib/python3/dist-packages/gi/_gobject/__init__.py", line 58, in _type_register
    _gobject.type_register(cls, namespace.get('__gtype_name__'))
RuntimeError: could not create new GType: DistUpgrade+ReleaseNotesViewerWebkit+ReleaseNotesViewerWebkit (subclass of void) 
I went to System Settings and then Menu Editor to find out what command "Software Updater" was running and it turned out it was only running
/usr/bin/update-manager
which I thought was weird as normally if you're updating your system files you'll need root access so I decided to run the command with gksudo. The command that worked is the following;
gksudo update-manager
NOTE: You don't need to use /usr/bin/ due to that directory being in your environment path anyway. After running that command I was presented with the possible upgrade to 14.04. I am now running Xubuntu 14.04 and everything is working great.

-Ubu out

Monday, April 28, 2014

Is your getty (tty) a black screen?

For those running Linux who have ever been without a graphical user interface (GUI) have most likely gotten to know and love getty's. Getty is short for "get teletype", it's a program that manages physical or virtual terminals (TTY's). When it detects a connection, it prompts for a username and runs the 'login' program to authenticate the user.

Within Ubuntu based distributions there are a total of 7 tty consoles that a user can log into but note that tty7 has the X server running on it. If you ever want to get back to your GUI desktop from a tty console than you would merely hold ctrl and alt and then hit the f7 key and that should lead you to your desktop assuming your X server is properly configured and running. You get to getty consoles by holding ctrl and alt keys and then hitting the function number key that corresponds to the getty console you want to use, f1 is getty 1. So if you wanted to log into a console at tty4, you would hold ctrl and alt and then hit the f4 key. You can see how many getty's your system has running by issuing the following command
ps aux | grep tty
I am running Xubuntu 13.10 and this is the output of the above command
root      1071  0.0  0.0  23016   968 tty4     Ss+  19:09   0:00 /sbin/getty -8 38400 tty4
root      1079  0.0  0.0  23016   960 tty5     Ss+  19:09   0:00 /sbin/getty -8 38400 tty5
root      1098  0.0  0.0  23016   968 tty2     Ss+  19:09   0:00 /sbin/getty -8 38400 tty2
root      1099  0.0  0.0  23016   972 tty3     Ss+  19:09   0:00 /sbin/getty -8 38400 tty3
root      1102  0.0  0.0  23016   968 tty6     Ss+  19:09   0:00 /sbin/getty -8 38400 tty6
root      1261  3.8  1.8 262128 152288 tty7    Rs+  19:09   0:23 /usr/bin/X -core :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
root      1391  0.0  0.0  77984  2184 tty1     Ss   19:09   0:00 /bin/login --    
ubu       2812  0.0  0.0  30108  4016 tty1     S+   19:10   0:00 -bash
ubu       3339  0.0  0.0  25424  1668 pts/0    S+   19:14   0:00 man getty
ubu       3416  0.0  0.0  16644   948 pts/4    S+   19:19   0:00 grep --color=auto tty

Tty consoles are best used for when you're uninstalling a graphics driver because you can't uninstall a driver that's in use by your X server. For example, I use the Nvidia binary from their website so after I download the .run file I go to tty1, stop my X server by stopping lightdm, run the .run file with root privileges and then when it's done installing I will restart the computer using sudo shutdown -r now so that it restarts the computer using the newly installed driver.

The black tty consoles are usually caused because the graphical text-mode resolution set at boot is not compatible with your video card but there may be other reasons that I am unaware of. I will show you how to use uvesafb (it's a framebuffer) and get a high resolution console so that you can actually use them and they aren't just a black screen of nothing.

It involves installing a package and changing your grub config file as well as some other files. Everyone's video card will support different resolutions so if a resolution isn't working for you than try a lower one until you get text within your tty consoles. If you don't want to just guess than you can use vbeinfo from within grub which will show you the resolutions that are supported. So when grub appears, hit the 'c' key and then type in vbeinfo and hit enter. If your grub doesn't normally appear than you can get it to show by holding the shift key while your computer boots. Note down the largest screen resolution that you would like your tty consoles to be. Mine was 1680x1050.

Let's get to fixing. Open a terminal. The first command is to install the v86d package so that we can use  uvesafb.
sudo apt-get install v86d
Next we need to edit the grub config file.
gksudo gedit /etc/default/grub
This will open the grub config file using the text editor called gedit. If you're using Xubuntu substitute gedit with mousepad or leafpad and if using Kubuntu then your text editor is kate I believe. Now that you're in the grub config file you need to make the following 3 different lines look like mine but using your resolution.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=1680x1050-24,mtrr=3,scroll=ywrap"
GRUB_CMDLINE_LINUX="vga=0x0369"
GRUB_GFXMODE=1680x1050
You'll need to look up your vga code for the resolution you want to use, google is your friend here. Once you're done make sure you save the file and then close it. Now we need to update the kernel modules file. Using the following command
gksudo gedit /etc/initramfs-tools/modules
Within that file you want to add the following line
uvesafb mode_option=1680x1050-24 mtrr=3 scroll=ywrap
Again make sure you save the file before closing it. Now we need to tell the system to use the framebuffer for your splash screen by issuing the following command. If you're not using a splash screen than I don't believe you need to perform this step. Despite me removing quiet and splash from my kernel boot line because I like seeing scrolling text in case there are any errors I still performed this step but it's up to you. This command will create a file in that location with that 1 line in it of FRAMEBUFFER=y
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
Now that we have updated the config files we need to get those cofigurations into each bootable kernel and we do that by issusing the following commands
sudo update-grub2
sudo update-initramfs -u
And that's it, if you restart your machine you should now have 6 high resolution consoles to use, tty1 thru tty6.

Wednesday, February 5, 2014

Linux Screencasting or Livestreaming

The goal of this post is to inform you about a GUI screencasting piece of software that I use for both recording my desktop gaming sessions as well the livestreaming them to sites like Twitch.tv and Hitbox.tv. I will show you how to compile and install the latest version from GIT as I feel it has some improvements within the code that are not available in the ppa version of the software. Compiling code shouldn't scare you away as it will not harm your system in anyway if you follow step by step. Many times it is necessary to compile software in Linux so that you can have the latest version of a package because the maintained versions within the official repositories are not up to date.

There are various GUI software packages out there for Linux users in order to capture their desktop so they can create a screencast of how to complete a particular task in Linux or to create a video showing how to get past a certain level in a game like gtkrecordmydesktop, istanbul, and kazam, but when I attempted to use any of those I would always have issues with synchronization of the video and audio. Either it would be out of sync from the start or it would start to become out of sync over time. Also none of those packages allowed me to livestream the action in realtime (as close to real time as you can get). I came across a package called SimpleScreenRecorder.


Simplescreenrecorder is a GUI screencasting software. It's very similar to the other pieces of software that I listed above in that it uses FFMPEG at it's core but the key difference is that it has built in synchronization coding as well as the ability to livestream to sites like Twitch or Hitbox.tv. He has a PPA if you want to just try that version of the software but that version does not contain the ability to set the keyframe interval (which Twitch and Hitbox expect a value of 2 seconds for every keyframe) and it also doesn't contain the improvements he made to the syncronizer and scaling feature. Let's get right to it and compile SSR from GIT.

The README.md file within the source files contain all the information you'll need to build and install it for your Linux Distribution except for Ubuntu 13.10, it's missing 1 library so we'll walk through those steps together right now. These steps are for a 64bit architecture so if you're running a 32bit version of Ubuntu 13.10 than your steps may vary slightly but I believe Maartin has accounted for both 32bit and 64bit in his build and compile script so don't give up now.

Let's get started, in Ubuntu 13.10 64bit you can open the terminal by holding the alt key and pressing F2 which will bring up the dash, then simple type in terminal and then click on gnome-terminal to open that application.
First we need to install the dependencies. *NOTE* Ensure you scroll inside the code box to copy and paste everything required.
sudo apt-get install git build-essential cmake pkg-config qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386
Let's first make sure you're in your /home directory. The cd command should get you there, just type in cd and hit enter in the terminal and then you can check by typing in pwd and hitting enter. It should show /home/youusernamehere.
Now we need to get the code from his GIT project
git clone https://github.com/MaartenBaert/ssr.git

Now let's switch to his glinject-next branch with has the improvements to the code and the ability to set the keyframe interval as required by Twitch and Hitbox. First we'll need to cd into the newly created ssr folder (run the next 2 commands separately, 1 line per command)
cd ssr
git checkout glinject-next
Now we can run the simple-build-and-install script from the ssr folder.
./simple-build-and-install
If you receive the following error than the 32bit libraries are not linked correctly for a 64bit system and we need to create some symlinks but it depends on what type of graphics drivers you're running on your system.
checking for XOpenDisplay in -lX11... no
configure: error: required library missing
If you're running open source drivers (intel, radeon, or nouveau) than you need to create the following symlinks. First cd into the appropriate directory and then create the 2 symlinks (run the next 3 commands separately, 1 line per command).
cd /usr/lib/i386-linux-gnu
sudo ln -s libGL.so.1 mesa/libGL.so
sudo ln -s mesa/libGL.so libGL.so
If you're running proprietary graphics drivers (fglrx or nvidia) than you need to create some additional symlinks which you can find out about by reading the SSR source README.me file. It's located within the ssr folder that you cloned from GIT.

For all drivers we need to create these additional 4 symlinks. You should still be within the /usr/lib/i386-linux-gnu/ directory when you create these 4 (run the next 5 commands separately, 1 line per command) *NOTE* Ensure you scroll inside the code box to see all required symlinks required.
sudo ln -s libGLU.so.1 libGLU.so
sudo ln -s libX11.so.6 libX11.so
sudo ln -s libXext.so.6 libXext.so
sudo ln -s libXfixes.so.3 libXfixes.so
sudo ldconfig

We can now cd back into the SSR directory so that we can run the simple-build-and-install script again now that we have properly linked to the 32bit libraries (run the next 2 commands separetly, 1 line per command)
cd ~/ssr
./simple-build-and-install

That should have successfully run and you should see the ending lines that appear like the following
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/vm1/ssr/build32/glinject'
make[1]: Leaving directory `/home/vm1/ssr/build32/glinject'
Making install in scripts
make[1]: Entering directory `/home/vm1/ssr/build32/scripts'
make[2]: Entering directory `/home/vm1/ssr/build32/scripts'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/vm1/ssr/build32/scripts'
make[1]: Leaving directory `/home/vm1/ssr/build32/scripts'
Making install in src
make[1]: Entering directory `/home/vm1/ssr/build32/src'
make[2]: Entering directory `/home/vm1/ssr/build32/src'
make[2]: Leaving directory `/home/vm1/ssr/build32/src'
make[1]: Leaving directory `/home/vm1/ssr/build32/src'
make[1]: Entering directory `/home/vm1/ssr/build32'
make[2]: Entering directory `/home/vm1/ssr/build32'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/vm1/ssr/build32'
make[1]: Leaving directory `/home/vm1/ssr/build32'
Running post-install script ...
Done.
You've just successfully compiled and installed SimpleScreenRecorder from GIT using the glinject-next branch. You won't be able to use SSR and encode (capture) using h264, aac, or mp3 yet though. For those to be applicable as a choice when you choose your encoding settings within SSR you'll need to install the ubuntu-restricted-extras package. You would just type in the following command into the terminal. It may prompt you to accept the installation of the packages by having to type in a "y", meaning Yes. It may also prompt you again for accepting the user license for true type fonts, mp3 and aac codec's, you would merely hit tab so that "ok" highlights and then hit enter.
sudo apt-get install ubuntu-restricted-extras
*NOTE*If you're running Kubuntu, Lubuntu or Xubuntu, be sure you install it's applicable restricted-extras pacakge ie: xubuntu-restricted-extras.
This was only to show you how to install SimpleScreenRecorder. I may do a follow up on how to use it properly but Maartin already has a lot of great information on his website.

-Ubu out

Friday, November 29, 2013

Xbox 360 Controller and Steam Games (Valve's Source Engine Games)

Some may yell at me for wanting to play PC games with a controller. They all say, "PC games are meant to be played with a keyboard and mouse." Well I grew up playing console games which always had a controller. It's not due to the lack of trying but when I play with keyboard and mouse my movement is less than adequate and my fingers don't have the buttons memorized yet so I end up dieing because I didn't move away from an enemy quick enough. W, S, D, and A are the buttons normally used in PC FPS games for moving forward, backward, and strafing side to side. The mouse is used for where your eyes are looking and or where your gun shoots. So until I get better with a keyboard and mouse I'd like to play my PC games with a controller at times.

I was happy to see that Serious Sam 3 BFE (a first person shooter) had controller support. Most Steam games will denote whether a game has controller support or not. Sometimes it may say "Partial Controller Support". I am not certain what that means but some controller support is better than none in my opinion. I took a chance and bought the game. When I fired it up my After Glow Xbox 360 Controller was supported immediately upon turning on the game. This is with a default Ubuntu 12.04.3 installation, it uses the xpad module (driver) and I didn't have to install the xboxdrv module (driver) which is a userspace driver. There are some advantages to using the xboxdrv module but I won't cover those in this post.

Other games I quickly found the same controller did NOT work in, notably all the Source Engine Games by Valve. The ones I tried were Team Fortress 2, Portal, and Left 4 Dead 2 the controller did not work. I tried everything,  from opening the console in game and entering "exce 360controller" and "exec 360controllerlinux" to allowing world readable permissions on the /dev/input/event11 device node which is what the controller was plugged into but nothing was working. Well after many hours of googling and trial and error I found what finally solved the controller issue for Valve's Source Engine Games. The original solution has to be credited back to a google post just to give credit where credit is due.

First open the Steam Client and you'll notice that there is a place to click to activate Big Picture Mode, it's located on the upper right side of your Steam Client.
Click that and it will activate Big Picture Mode which is basically Steam running in fullscreen. Use your mouse and click on the little gear symbol in the upper right corner which is where all the settings are. Now click on Controller. Next you'll see the following picture and hopefully it states that your controller is detected. If not, sorry I can't help any further, you'll have to investigate why Steam can't detect your controller.
Click on edit controls and you'll be taken to this screen. 
You just go down the list, Steam shows the button on the screen in green and you click that corresponding button on your wire connected Xbox 360 controller. I am not sure whether this works with a wireless controller due to the Microsoft's wireless technology of the controller, you'll definitely need a wireless dongle from somewhere if they even make them. Once you have mapped each button then click save, you can choose to give it a name or overwrite the existing name that was there. Now you are all done.

You can now use your controller within Team Fortress 2, Portal, and Left 4 Dead 2. One thing to note was that I did have to increase the sensitivity within TF2 because the movements were really slow but other than that I am very pleased I got the controller working.

-Ubu out