Search This Blog

Tuesday, March 26, 2013

Installing VirtualBox Extension Pack drivers on Ubuntu 12.10 guest system

After successful upgrade of my VirtualBox and its Extension Pack here I decided to spin up a new local virtual machine and install Ubuntu 12.10. All went fine except that I had an issue installing the Guest additional drivers from the Extension Pack. Below are my notes and missing steps from the official guide (*) Chapter 4. Guest Additions that I had to do in my Ubuntu Desktop.

The default installation of Ubuntu for your desktop doesn't install dkms package. Following the (*) guide you will have to install it. 

Additionally you have to install your kernel source header files that 

apt-get install aptitude
aptitude install  linux-headers-3.5.0-26-generic

After this the driver instillation goes well. All what you need to do is now to restart your VM.
 
root@rado-VirtualBox:/media/rado/VBOXADDITIONS_4.2.10_84104# sh ./VBoxLinuxAdditions.run  uninstall
root@rado-VirtualBox:/media/rado/VBOXADDITIONS_4.2.10_84104# sh ./VBoxLinuxAdditions.run 
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.10 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
 Installing the Window System drivers
Installing X.Org Server 1.13 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services components ...done.

VirtualBox upgrade error

I've decide to update my old version of VirtualBox on Windows 7. The installation of the software went fine but when I tried to update the  Extension Pack I run into this issue:
 
Failed to install the Extension Pack C:/Users/rado4752/.VirtualBox/Oracle_VM_VirtualBox_Extension_Pack-4.2.10.vbox-extpack.

The installer failed with exit code 1: VBoxExtPackHelperApp.exe: error: Failed to rename the extension pack directory: VERR_ALREADY_EXISTS

rcExit=1.

Result Code: E_FAIL (0x80004005)
Component: ExtPackManager
Interface: IExtPackManager {3295e6ce-b051-47b2-9514-2c588bfe7554}

As the error suggest this is most likely a file system security issue. As I don't have full Admin right on this host the solution for me was to clean and uninstall the old Extension Pack before trying to install the new one again (more info about it can be found here: https://forums.virtualbox.org/viewtopic.php?f=6&t=46861)
 
c:\Program Files\Oracle\VirtualBox>vboxmanage extpack cleanup
Successfully performed extension pack cleanup

# try to install the Extension Pack again
C:\Users\rado4752\.VirtualBox>Oracle_VM_VirtualBox_Extension_Pack-4.2.10.vbox-extpack

Monday, March 25, 2013

Example of a failing DNS request

I've run into an DNS issue today. I usually scan quickly the answer from dig as I'm interested in the actual A, PTR or MX only. Today the issue was different. Below in the two failing example DNS requests please note the SERVFAIL status code.

Example 1
 
dig @194.2.2.2 www.example.com A

; DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> @194.2.2.2 www.example.com A
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5995
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.example.com. IN A

;; ANSWER SECTION:
www.example.com. 86400 IN CNAME buuu.example.com.

Example 2
 
dig @194.2.2.2 www.example.com

; DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> @83.138.151.80 www.example.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 55778
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.example.com. IN A

;; Query time: 12 msec
;; SERVER: 194.2.2.2#53(194.2.2.2)
;; WHEN: Mon Mar 25 17:41:28 2013
;; MSG SIZE  rcvd: 52

References
  1. http://networking.ringofsaturn.com/Unix/dnstroubleshooting.php

Is Connection header mandatory in HTTP 1.1

I've troubleshoot recently an F5 load balancer issue and show a traffic like below (example with mangled fields)

10.178.155.180 - F5 
10.178.100.64  - server

Nr      Time        Source                Destination    Protocol flags  Length vlan hsrc                  hdst                  sport  dport  Info                           
    1 9.970000   10.178.155.180        10.178.100.64      TCP      0x02   100    777  F5Networ_45:c9:05    Rackspac_08:2d:3d     41588  80     41588 > http [SYN] Seq=0 Win...
    1 9.970821   10.178.100.64         10.178.155.180     TCP      0x12   100    777  Rackspac_08:2d:3d    F5Networ_45:c9:05     80     41588  http > 41588 [SYN, ACK] Seq=...
    1 9.971842   10.178.155.180        10.178.100.64      TCP      0x10   92     777  F5Networ_45:c9:05    Rackspac_08:2d:3d     41588  80     41588 > http [ACK] Seq=1 Ack...
    1 9.971921   10.178.155.180        10.178.100.64      HTTP     0x18   179    777  F5Networ_45:c9:05    Rackspac_08:2d:3d     41588  80     GET /status.aspx HTTP/1.1   ...
    1 9.978979   10.178.100.64         10.178.155.180     HTTP     0x18   475    777  Rackspac_08:2d:3d    F5Networ_45:c9:05     80     41588  HTTP/1.1 200 OK  (text/html)...
    1 9.979898   10.178.155.180        10.178.100.64      TCP      0x10   92     777  F5Networ_45:c9:05    Rackspac_08:2d:3d     41588  80     41588 > http [ACK] Seq=88 Ac...
    1 9.980028   10.178.155.180        10.178.100.64      TCP      0x11   92     777  F5Networ_45:c9:05    Rackspac_08:2d:3d     41588  80     41588 > http [FIN, ACK] Seq=...
    1 9.980315   10.178.100.64         10.178.155.180     TCP      0x11   92     777  Rackspac_08:2d:3d    F5Networ_45:c9:05     80     41588  http > 41588 [FIN, ACK] Seq=...
    1 9.980950   10.178.155.180        10.178.100.64      TCP      0x10   92     777  F5Networ_45:c9:05    Rackspac_08:2d:3d     41588  80     41588 > http [ACK] Seq=89 Ac...

The HTTP request and response:

GET /status.aspx HTTP/1.1
Host: www.dummy.com
User-Agent: MyAgent :)

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=tbc1vlvsjxjx01xs2frend5z; path=/; HttpOnly
Date: Mon, 25 Mar 2013 09:59:33 GMT
Content-Length: 9

Status OK

Problem

The 'Host' header is mandatory in HTTP 1.1. Is 'Connection: keep-alive|close' HTTP header mandatory in HTTP 1.1 as well?

Analisis and results description

An example request from the Chrome browser that specifically provide a value for the 'Connection' header:

GET / HTTP/1.1
Host: www.google.com
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22
Accept-Encoding: gzip,deflate,sdch

HTTP/1.1 302 Found
Date: Mon, 25 Mar 2013 10:15:23 GMT
Server: gws
Location: https://www.google.com/
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Cache-Control: private
Content-Length: 220

We can see that the client specify what should happen to the underlying TCP session. In this example the TCP session should remain active and idle for a while - until either the client or server decide to close it.

Although in our example we can see that the client (F5)
  • didn't specify the 'Connection' header in the GET request
  • the session was closed by the F5 (the client) after receiving the response 

According to 8.1 Persistent Connections  of the rfc 2616 the persistent connections are the default behaviour in HTTP 1.1. The field is not mandatory and either sides can close it. In our example the  client decide to close the established tcp session after receiving the HTTP response.

References
  1. http://tools.ietf.org/html/rfc2616#section-8.1
  2. http://www8.org/w8-papers/5c-protocols/key/key.html

Sunday, March 24, 2013

Rackspace api-challenge summary

Below is a listing of some of my steps I went through when I participated in Rackspace  API Challenges: By Support, for Support contest. The final github repository with the code is here https://github.com/rtomaszewski/api-challenge
  1. Create initial repository on github
  2. In the OS of your choice install your favorite editor like Sublime (Installation of Sublime Text editor on Ubuntu 12.10) or other
  3. Install Python SDK for Rackspace cloud: How to install Rackspace Python SDK for cloud
  4. Authentication issue with London cloud account when using Pyrax module
  5. Howto add a file to api-challenge repository on github
  6. Challenge 1 script
  7. As my development efforts go on I wanted make sure I can always get back to the code I was initially released as challenge1.py script: How to create a branch on github to freeze your code in a particular version
  8. Challenge 2 script
  9. How to modify files in your branch on github
  10. bpython supports virtualenv
  11. How to develop and debug programs that use pyrax or python-novaclient libraries
  12. Challenge 3 script
  13. How to paste into Python interpreter a code snippet for testing
  14. Challenge 4 script
  15. Challenge 5 script
  16. How to merge changes from a custom branch into master branch on github
  17. Challenge 6 script
  18. Challenge 7 script
  19. Challenge 8 script
  20. Challenge 9 script
  21. How to use pyrax and ipython together to test and learn the library api
  22. Challenge 10 script
  23. Challenge 11 script

Create initial repository on github

The full summary of all posts for API Rackspace challenge can be found here:
Rackspace api-challenge summary

This is in regards to the Rackspace API-challenge. More info can be found at Rackspace api-challenge summary.

All my steps to create my repository are listed below.

Install Git Shell for windows

mkdir api-challenge
git init

Create next a README.md file

git commit
git add README.md
git commit -m 'init'
git remote add origin git@github.com:rtomaszewski/api-challenge.git

git push -u origin master
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Troubleshooting base on https://help.github.com/articles/error-permission-denied-publickey
 
ssh -vT git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
....
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/rado4752/.ssh/github_rsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

ssh-add -l
The agent has no identities.

I had to add and register my public ssh key github_rsa on github. After adding it using the webgui https://github.com/settings/ssh this test went fine.
 
ssh -vT git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Applying options for github.com
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /c/Users/rado4752/.ssh/github_rsa type 1
...
Hi rtomaszewski! You've successfully authenticated, but GitHub does not provide
shell access.
debug1: channel 0: free: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.5 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 1

git remote add origin git@github.com:rtomaszewski/api-challenge
fatal: remote origin already exists.

git remote -v
origin  git@github.com:rtomaszewski/api-challenge (fetch)
origin  git@github.com:rtomaszewski/api-challenge (push)

git push -u origin master
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know hosts.
ERROR: Repository not found.
Fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git remote rm origin
git remote add origin git@github.com:rtomaszewski/api-challenge.git
git remote -v
origin  git@github.com:rtomaszewski/api-challenge.git (fetch)
origin  git@github.com:rtomaszewski/api-challenge.git (push)

As there is not repository with the name api-challenge I created it under my github account.
 
git push -u origin master

After all this trouble i could navigate to my newly created repository under https://github.com/rtomaszewski/api-challenge

At the end got to http://challenge.cldsrvr.com/register and register your repo.

Practical online github course

There are many modern distributed versioning systems and github is one of them. This link is going to take you to a simple online but practical course where you can practice the basic git commands.

Learning by doing: http://try.github.com/ (http://www.codeschool.com/courses/try-git)

Commands reference:
 
$ git init
$ git status
$ git add octocat.txt
$ git status
$ git commit -m "Add cute octocat story"
$ git add '*.txt'
$ git commit -m 'Add all the octocat txt files'
$ git log
$ git remote add origin git@github.com:rtomaszewski/try_git.git
$ git push -u origin master
$ git pull origin master
$ git diff HEAD
$ git add octofamily/octodog.txt
$ git diff --staged
$ git reset octofamily/octodog.txt
$ git checkout -- octocat.txt
$ git branch clean_up
$ git checkout clean_up
$ git rm '*.txt'
$ git commit -m "Remove all the cats"
$ git checkout master
$ git merge clean_up
$ git branch -d clean_up
$ git push