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

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.