Saturday, November 15, 2014

Ubuntu - Starting Minecraft Server Automagically FAILs

I run a Minecraft server for myself and some close friends. One thing that I struggled with was getting Minecraft to auto-start when the machine booted up. This is important so that if my power is ever interrupted (not on a UPS, yet.....) the computer would auto-restart via the UEFI bios setting which would then auto-start the Minecraft server due to the init script being added to the default system run levels from using sudo update-rc.d defaults. The error within /var/log/boot.log was
Cannot make directory '/var/run/screen': Permission denied

When I googled the error message I found that it's a bug, apparently screen-cleanup is running via upstart much earlier than it expects to have run, and is failing to correctly clean up the /var/run/screen directory. I'm not sure whether this is an acceptable fix or not but I found a solution after much googling and reading. Basically we're not going to rely on the screen-cleanup upstart or init script, we're going to remove that upstart job completely and within our Minecraft init script we'll create the /var/run/screen directory ourselves. I am using this minecraft init script which is right from the Minecraft wiki page and in order to get around this Ubuntu screen bug we need to make a small modification to it. Note that this modification should work for any init script you're using to auto-start your Minecraft server if you have the same screen bug in Ubuntu. The applicable section looks like the following
cd $MCPATH
as_user "cd $MCPATH && screen -h $HISTORY -dmS minecraft $INVOCATION"
sleep 7

And we need to add the commands for making the /var/run/screen directory ourselves so make it look like this
cd $MCPATH
if ! test -d /var/run/screen; then
mkdir /var/run/screen
chown root:utmp /var/run/screen
chmod 775 /var/run/screen
fi
as_user "cd $MCPATH && screen -h $HISTORY -dmS minecraft $INVOCATION"
sleep 7

It's important that after you alter your Minecraft init script you run the following commands to remove it from the various run levels and then re-add it. (I don't know if remove, defaults, and enable are ALL needed but that's what I did.
sudo update-rc.d minecraft remove

sudo update-rc.d minecraft defaults

sudo update-rc.d minecraft enable

Now when the computer starts up from it being off, a screen session will get created and your Minecraft server will get auto-started from within that screen session. You can then ssh into your server as user minecraft and issue
screen -r

and it will reattach you to your Minecraft server console. Hopefully this was helpful for you as I spent many hours trying to figure out why the init script was not working to auto-start the Minecraft server when the machine was turned on. -Ubu out

Saturday, November 1, 2014

Upgrade HELL: iOS 7 (jailbroken) to iOS 8.1 upgrade trouble

I have a 16GB iPhone 5S that had iOS firmware version 7.0.6 which I had jailbroken using Evasi0n. I've been jailbreaking my iPhones since the original untethered jailbreak was released years ago. Skip to the last paragraph if you don't want any back story.

Jailbreaking your iDevice allows additional tweaks and functionality. I had previously upgraded from iOS 6 to iOS 7 using an older computer which has a 1.8Ghz Core2Duo with 2GB of memory. That process went without trouble what so ever and all was well in my world.

Recently the iOS 8.x untethered jailbreak, Pangu, was updated to include the ability to install Cydia during the jailbreak which is a great convenience. Previous to the update, Pangu would only give you root access to the iDevice and you still had to SSH into your device and manually download and install Cydia. Now that the Pangu jailbreak utility included the ability to install Cydia I was ready to upgrade my iPhone 5S to iOS 8.1.

All of the tutorials I found made it clear that before I upgrade my iPhone to iOS 8.1 that I first needed to perform a restore to the iOS firmware 8.1. Simply doing an upgrade either OTA or using iTunes was not going to work, doing it those ways lead to boot loop issues and other unforeseen issues. I connected it to my computer I choose the Restore button and soon my problems began. It was stuck at "Restoring iPhone Software" within iTunes. I let it sit for about 20 minutes and without any change in the progress bar I realized that it was stuck and not doing what it was suppose to be doing.
I jumped on the IRC channel #jailbreak_qa on freenode and they suggested the normal solutions of reinstalling iTunes and the AppleMobileDevice driver so I did those 2 things and it still was getting stuck at the exact same spot. I even attempted to put the iPhone into DFU mode and using shift+restore so that I could choose the IPSW file that I downloaded for my GSM iPhone 5S but again it was getting stuck at the same location. I even tried a different cable and that didn't work either.

The solution was to perform the restore using a better computer. Believe it or not using my main gaming rig which has Windows 7 Ultimate as the OS running an i5-4670k OC'd to 4.0Ghz and 8GB of DDRIII at 2133Mhz the restore worked immediately. I didn't need to use shift+restore either, I did however ensure the iPhone was in DFU mode before clicking the Restore button within iTunes. I can't believe that's how I solved the problem, I had spent countless hours googling and reading various forums and speaking with multiple people in the IRC channel as well. Now that the restore to 8.1 is complete, I will restore my iCloud backup so I get all my contacts and apps back onto the iPhone and once that's done, I will perform the Pangu jailbreak.Hopefully this post saves anyone else who's having an issue upgrading their iDevice to a newer firmware.

-Ubu out

Tuesday, October 28, 2014

Seagate firmware flash using usb created in Linux

I had an older Seagate Barracuda 7200.12 ST31000528AS (1TB SATA) drive that I literally just found laying among my pile of old hardware. I couldn't figure out why I just had a 1TB drive just sitting there so I put it into a handy SATA to USB enclosure, connected it to my system (Xubuntu 14.04)  and fired up GSmartControl. It's a GUI app for testing hard drives and among all the info it shows that there's newer firmware for the drive. The GSmartControl log even gave me a handy link to go and find out if in fact there was newer firmware for my Seagate Barracuda 1TB drive.
There was in fact newer firmware I could try out on the drive. I was running firmware version C44 and CC49 was available. Now many people will say if it's not broke don't fix it. Meaning if the drive is performing fine than just leave it be, don't bother flashing it with new firmware but I was feeling adventurous since I had just found it and it was empty. 

Viewing the options for flashing they have a Windows executable (in .exe form) or an ISO but again refers to Windows. Since I don't use Windows I set out to find a way to accomplish this task and I found it after many hours of trial and error. First I downloaded the ISO file and mounted it in my system using the following commands:
Create a mount point for it first
sudo mkdir /mnt/iso

Now let's mount it (this command assumes your current working directory is the same location you saved the downloaded ISO file. You can cd to the directory which is most likely ~/Downloads)
mount -o loop Barracuda12-ALL-CC49.iso /mnt/iso
It may warn you that it's read only which is fine cause we're only interested in copying a file out of the ISO. Open up your preferred file manager like Nautilus or Thunar, navigate to the /mnt/iso folder and grab the PH-CC49.ima file and copy it to somewhere on our system, I put it on my desktop. Now simply rename it from an .ima file to an .img file using (you may need sudo)
sudo mv ~/Desktop/PH-CC49.ima ~/Desktop/PH-CC49.img

Now we need a flash drive, the .img file is only 5.4MB so a 256MB thumb drive should work just fine. I made sure that the thumb drive was empty by using GParted, I deleted all partitions and then made a new partition table with the msdos format. Then ensure you know which device node your thumb drive is by using the command (VERY IMPORTANT STEP, using dd is very dangerous so triple check you're running the dd command onto the correct /dev/sdX drive)
sudo fdisk -l

Which will return a list of all your harddrives that are in your system as well as each of their partition tables. Look for your thumbdrive, mine was /dev/sde. Now let's write the .img file to the thumb drive using the command
dd if=~/Desktop/PH-CC49.img of=/dev/sde bs=512k

After it's done it will output something that resembles the following
33706002+0 records in
33706002+0 records out
17257473024 bytes (17 GB) copied, 34.791 s, 496 MB/s

Now you're done, you now can boot your computer using the thumb drive that you just created and you'll be presented with the Seagate Flashing Utility. If you need some instruction for using the Firmware Flashing Utility you can find that HERE. Things to note are that the drive you want to flash will need to be connected to your motherboard directly, you can't use an external enclosure and usb. Hopefully this was helpful as I spent hours finding out how to accomplish flashing a Seagate hard drive with updated firmware.

-Ubu out

Sunday, October 26, 2014

Guvcview black screen with Linux kernel 3.16

Sorry I haven't posted anything in forever, I've just been really busy gaming and livestreaming using Linux via obs-studio along with nginx to push a 2,000Kbps flv stream to both Hitbox and Twitch at the same time. This recent incident made me feel obligated to let other Linux users know what I experienced so I decided to come to my long forgotten blog and blog it.
My system has been running rock solid as of late (Xubuntu 14.04) but my friend was telling me about Ubuntu 14.10 and how it had kernel 3.16 in it by default. I believe Xubuntu 14.04 will only ever have kernel 3.13 so after feeling inadequate I thought to myself, "what's preventing me from running kernel 3.16 also?" So I found a great tutorial for installing Ubuntu Utopic's mainline 3.16 kernel into my Xubuntu 14.04 system. It was painless and believe it or not DKMS actually worked for my proprietary Nvidia graphics driver so I didn't even need to reinstall the graphics driver after installing the new kernel.

The system booted right up and all was well, or was it? I noticed that when I launched Guvcview I was only getting a black screen. To the terminal I went, launching an app from a terminal window provides a lot of information that you just don't see when launching an app from a menu or launcher. The output looked like this
guvcview 1.7.1
file guvcview_video.mkv has extension type 1
file guvcview_image.jpg has extension type 0

** (guvcview:2853): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-RZEC5PqweK: Connection refused
file guvcview_image.jpg has extension type 0
Video file suffix detected: 0
Image file suffix detected: 3
ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started

(guvcview:2853): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:63:17: Theming engine 'unico' not found
video device: /dev/video0
Init. UVC Camera (046d:081a) (location: usb-0000:00:14.0-3)
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 176 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 432, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 544, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 640, height = 360 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 752, height = 416 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 448 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 600 }
 Time interval between frame: 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 864, height = 480 }
 Time interval between frame: 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 544 }
 Time interval between frame: 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 720 }
 Time interval between frame: 1/10, 1/5,
{ discrete: width = 1024, height = 576 }
 Time interval between frame: 1/10, 1/5,
{ discrete: width = 1184, height = 656 }
 Time interval between frame: 1/10, 1/5,
{ discrete: width = 1280, height = 720 }
 Time interval between frame: 1/10, 1/5,
{ discrete: width = 1280, height = 960 }
 Time interval between frame: 2/15, 1/5,
{ pixelformat = 'MJPG', description = 'MJPEG' }
{ discrete: width = 640, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 176 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 432, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 544, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 640, height = 360 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 752, height = 416 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 448 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 600 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 864, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 544 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1024, height = 576 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1184, height = 656 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 960 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 176 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 432, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 544, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 640, height = 360 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 752, height = 416 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 448 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 600 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 864, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 544 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1024, height = 576 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1184, height = 656 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 960 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 176 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 432, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 544, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 640, height = 360 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 752, height = 416 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 448 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 600 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 864, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 544 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1024, height = 576 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1184, height = 656 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 960 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 176 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 432, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 544, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 640, height = 360 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 752, height = 416 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 448 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 600 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 864, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 544 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1024, height = 576 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1184, height = 656 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 960 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 176 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 432, height = 240 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 544, height = 288 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 640, height = 360 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 752, height = 416 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 448 }
 Time interval between frame: 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 800, height = 600 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 864, height = 480 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 544 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 960, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1024, height = 576 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1184, height = 656 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 720 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 960 }
 Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
vid:046d
pid:081a
driver:uvcvideo
mapping control for Pan (relative)
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Tilt (relative)
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Pan Reset
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Tilt Reset
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Focus (absolute)
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for LED1 Mode
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for LED1 Frequency
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Disable video processing
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Raw bits per pixel
UVCIOC_CTRL_MAP - Error: No such file or directory
mapping control for Off
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
checking format: 1196444237
VIDIOC_G_COMP:: Inappropriate ioctl for device
fps is set to 1/20
drawing controls

=======[ Output Device #1 ]=======
Description: Built-in Audio Analog Stereo
Name: alsa_output.pci-0000_00_1b.0.analog-stereo
Index: 0
Channels: 2
SampleRate: 44100
Latency: 10438 (usec)
Card: 2

=======[ Input Device #1 ]=======
Description: 081a Analog Mono
Name: alsa_input.usb-046d_081a_13339CA0-02-U0x46d0x81a.analog-mono
Index: 0
Channels: 1 (default to: 1)
SampleRate: 48000
Latency: 140 (usec)
Card: 1

=======[ Input Device #2 ]=======
Description: Monitor of Built-in Audio Analog Stereo
Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
Index: 1
Channels: 2 (default to: 2)
SampleRate: 44100
Latency: 0 (usec)
Card: 2

=======[ Input Device #3 ]=======
Description: Built-in Audio Analog Stereo
Name: alsa_input.pci-0000_00_1b.0.analog-stereo
Index: 2
Channels: 2 (default to: 2)
SampleRate: 44100
Latency: 59 (usec)
Card: 2

Checking video mode 320x240@32bpp : OK
Ignoring empty buffer ...
Ignoring empty buffer ...
write /home/ubu/.config/guvcview/video0 OK
free controls
cleaned allocations - 100%
Closing portaudio ...OK
Closing GTK... OK

Now I don't know exactly what this means but basically it's not receiving anything from the buffer. I tried to play around with the video format from MJPG to YU12 but that just changed the preview window from black to green.

I thought maybe I needed to get a more recent version of Guvcview since the one that's provided within the Ubuntu 14.04 repository is only version 1.7.1 but even after enabling a PPA which had version 2.0.0 that still provided the same results which was a black screen. The error I got using the 2.0.0 version was as follows:
GUVCIEW: Error - Couldn't decode frame
V4L2_CORE: not decoding empty raw frame
Booting my machine using kernel 3.13.0-38-generic made Guvcview work again so there's something wrong with Guvcview with the new 3.16 kernel but I would like to point out that Cheese, OBS-Studio (using the v4l plugin) as well as Skype video chat work just fine so I believe it's something specific to Guvcview or even possibly the module that it uses which is uvcvideo but I'm not so sure about that since those 3 other software titles worked with the 3.16 kernel.

I really enjoy Guvcview because it has a lot of options that just aren't in Cheese and I haven't searched for any other applications that can record video from my Logitech C260 webcam. For now I have to just keep booting into kernel 3.13 if I want to use Guvcview. That's one thing I really like about Linux is it's versatility in options, I install a new kernel but if something isn't working right with the new kernel than all I have to do is watch for the GRUB boot menu and choose the kernel that I'd like to boot into. I can then either uninstall kernel 3.16 OR modify GRUB so that it boots the kernel I want by default and not just the latest installed kernel. Accomplishing that is possibly for another blog post so until next, I'll smell ya when I smell ya.

-Ubu out

UPDATE: The developer got back to me via email within about 6 hours and informed me that I needed to run his testing PPA in order to get Guvcview to work with kernel 3.16 and sure enough as soon as I enabled the testing PPA now Guvcview works again. To reiterate the testing PPA has version 2.0.1 in it whereas the stable PPA only has version 2.0.0 for Trusty Tahr. YIPPIE!!! One thing I would like to point out about PPA's is that just removing a certain PPA (add-apt-repository -r) does NOT revert packages back to their previously installed versions before you enabled a particular PPA, you need to use the ppa-purge command. That not only removes a certain PPA but also reverts any packages that were installed using the PPA that you're purging so to ensure this all works if you had installed his Stable PPA which provided version 2.0.0 and it still didn't work ensure you used ppa-purge ppa:pj-assis/ppa and then add his Testing PPA using sudo add-apt-repository ppa:pj-assis/testing and you should be golden.

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