TTY – TeleType

Read, heard and ever wondered what a tty is. Well it stands for teletype and it is a command used in the shell. Basically it gives information about the terminal that a user is currently at. TTY has historic significance as they were used in the first computers which were TeleType terminals and these were essentially remote controlled typewriters. When you enter the command ‘tty’ in the shell without the quotes you will receive a response ‘dev/pts/1’ or some other number which essentially tells you that you are using device /pts/1.

Installing Guest Additions and DKMS on Centos.

I was trying to install guest additions on my Centos operating system but faced a lot of problems. Though the idea was very simple as all you have to do was to install DKMS package  on your centos operating system and run the install virtual box guest additions setup, but the main problem is that dkms package is not available on your centos,  it is a third party repository. So I believe there are a lot of new users who face this issue (I being one of them).

Following steps will help in installing guest additions on your centos.

Step1: update everything( though not really required but still I took this step 1st)

Step2: make a directory rpm using the following commands and go in that directory and download the rpm package from this link

$ mkdir rpm

$ cd rpm

$ wget

$ rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

$ yum install htop

now if you get an error something like this

error: Failed dependencies:
rpmlib(FileDigests) <= 4.6.0-1 is needed by rpmforge-release-0.5.2-2.el6.rf.i686
rpmlib(PayloadIsXz) <= 5.2-1 is needed by rpmforge-release-0.5.2-2.el6.rf.i686

That means you have installed your centos virtual machine from cloudera which is centos5 and you have downloaded rpm package for centos6 so all you have to do is to change that package and download package for centos5. You can also check if you are running a 32 bit machine or a 64 bit machine as there are two packages one is for 32 bit machine and the other for 64 bit. To check which machine you are running just type the following command

$uname -i

if you get i386 or i686 that means you are running 32 bit machine and if you get x86_64 that means you are running a 64 bit machine.

Step3. Install kernel-devel

$ sudo yum install kernel-devel

Step4. So almost everything is done and you are ready to install  dkms package

sudo yum install dkms

if everything goes fine dkms package will install successfully, without any issues.

Step5. This will be the final step

Insert VboxGuestAdditions.iso and go to the folder which will be probably in


and run the following command

$ sh ./


This will successfully install Guest Additions on Centos.

Enabling Root user in Ubuntu

Now root user in Ubuntu is by default disabled. The reason for this is simple, if you login as root user and you did some horrendous or deleted some files in a hurry or by mistake your system might become unusable, but if you still would like to enable the root user and you know what you are doing then its straight forward. Open the terminal and add the following command

$  sudo passwd root

$ <you will be prompted to add the root password twice>

add the root password. Now this will enable the root user in command line interface. If you wish to login as the root from the main system you will have to add the following line

sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'

Adding a user to sudoers list

I had been tired of getting this error for a while in my Ubuntu machine “The user is not in the sudoers list. This error will be reported”. Now this was kind of getting over my nerves so I browsed the internet and got this solution. The sudoers list is available in /etc/sudoers so to edit it login as the root and then edit it by hitting the following command visudo. Now navigate the sudoers file and just under

root ALL=(ALL) ALL

add the following line for eg. if the user is testuser to be given sudo privileges

testuser ALL=(ALL) ALL

now save the file by hitting CTRL X and Y

Adding Users and Creating Home Directory in Ubuntu

So it turns out that if you just issue useradd command in your linux machine you will create a user but there will be no home directory. Th problem the added user will not be able to login in his home directory. He can login using cli but not otherwise. So here is how to create user home directory when adding a user

sudo useradd -d /home/testuser -m testuser

sudo passwd testuser


this is a as simple as that and another way is using the adduser command in which you can add more detail for the user like phone number and all.

User Administration in Ubuntu

To add a user use the following command

>useradd xyz

when you run the following command a bunch of config files from the /etc/skel directory on your system gets copied in the users home directory.

To set a user password we have to run the following command

passwd  <username>

The password gets stored in the /etc/shadow file and it is encrypted. In the /etc/passwd file our new user gets added in the following format


which is


adding a group

groupadd -r projectX

the -r in groupadd gives the group an id of below 500 in red hat linux as id greater than 500 is reserved for user private group

adding a user to a group

usermod -G projectX,projectY[,groups1,2,3] <username>

you will have to remember all the groups that user is already in if you dont include it the user gets removed from that group

File permissions for users

-(rwx)(rwx)(rwx) for files

user,group,other permissions

d(rwx)(rwx)rwx) for directories the starting ‘d’ indicates a directory

giving permissions to users

chmod g+w filename


chmod 777 filename

to give ownership of a directory or a file to the user

chown <filename>

making a user admin of a directory

gpasswd -A <user> <group>

gpasswd -A bob projectX

now bob can add anyone he likes to the group without permissions from the admin

gpasswd -a alice

gpasswd -d alice to delete alice

activating the superuser in ubuntu 12.04

sudo passwd root

add  a password


sudo su

authenticate using the password added

ssh Agent admitted failure to sign using the key. Permission denied (publickey)

Now this error was something that made me bang my head on the table. I had tried almost everything— looking up in google, stackover flow, adding my ssh key to the github account but nothing seem to work.

the error–

$ Permission denied (publickey).
$ fatal: The remote end hung up unexpectedly

these are some of the solutions on stackoverflow  that I had tried but none seemed to work.

and finally what did work was the most simplest solution of all

you just have to add these lines

$ ssh-add ~/.ssh/id_rsa

Problems While Deploying Ruby on Rails App on Heroku

Ok this was the second day and it was no less cumbersome than the previous one, tried deploying the app on Heroku and that turned out to be a big headache. so it turns out that heroku doesn’t supports sqlite3. One way of solving this problem is to put sqlite3 in development mode in your Gemfile==> bundle install(again)==> add Gemfile using git and then run git push heroku master.

so if you are facing the following error

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
Gem files will remain installed in /tmp/build_26udn5p5vbb5b/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /tmp/build_26udn5p5vbb5b/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
! Failed to install gems via Bundler.
! Detected sqlite3 gem which is not supported on Heroku.
! Heroku push rejected, failed to compile Ruby/rails app To! [remote rejected] master -> master (pre-receive hook declined)error: failed to push some refs to ''





source ''

gem 'rails', '3.2.7'

group :development do
 gem 'sqlite3', '1.3.5'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
 gem 'sass-rails', '3.2.4'
 gem 'coffee-rails', '3.2.2'

gem 'uglifier', '1.2.3'

gem 'jquery-rails', '2.0.2'

*courtesy Ruby on Rails Tutorial Book by M. Hartl 

copy the above source code from listing 1.5 in the book and probably you will have to change your rails version and sqlite3 version to your current installed version for me it was rails-3.2.8 and sqlite3-1.3.6. After changing this do the following

$ bundle install

$ git add Gemfile

$ git commit -m "Put Sqlite3 into development in the Gemfile"

$ git push heroku master


And I believe this will finally solve all your problem

Problems and Fixes While Installing Ruby on Rails on Ubuntu 12.04

So yesterday I finally decided to give Ruby on Rails a try, the installation of which was a major headache and kept me up all night. Some of the major problems that one will face will installing Ruby on rails using Ruby Version Manager especially on Ubuntu are as follows.

ZLIB not installed

The dreaded zlib error

ERROR:  Loading command: update (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::UpdateCommand

It seems that there are some of the libraries that are not pre installed in Ubuntu and because of that ‘gem‘ will not install or update rails. One way to get out of this mess is to install these libraries beforehand, otherwise there will be a problem while installing rails, or while running rails server.

so the 1st thing to do is to install all these libraries with the following command

$ sudo apt-get install zlib1g-dev libssl-dev libreadline6-dev libxml2-dev libsqlite3-dev

and then install ruby if you haven’t installed it yet

rvm install 1.9.3

or reinstall it if you have already installed it

rvm reinstall 1.9.3

Javascript runtime error

Could not find a JavaScript runtime. See for a list of available runtimes.
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect'
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:5:in `<module:ExecJS>'
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
/home/vitalarthur/rails/316-private-pub/chatter-after/config/application.rb:7:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/vitalarthur/rails/316-private-pub/chatter-after/Rakefile:5:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `load'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `raw_load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `block in load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake- `<top (required)>'
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19:in `<main>'

The catch here is that Windows has a builtin JavaScript engine which execjs can locate. On Linux there is not a builtin although there are several available that one can install. therubyracer is one of them. Others are listed in the execjs.

the trick here is to include

gem 'execjs'
gem 'therubyracer'

in your Gemfile which can be found in your first_app directory (the directory which is installed when you run the following command ‘rails new first_app’). So I believe this will take care of some of your problems

and here are a few links which might be useful

How to Remove Old Linux Kernels

So I was using Ubuntu 11.10 on my virtual machine and I ran into this problem of storage. I had allocated about 8gb of space for my linux machine but as I kept of updating it frequently, it was eating all my precious hard disk space. The problem was that I wasn’t removing my older kernels. So I did some search on Google and found this solution of freeing up space and improving my system’s performance.

Step 1.

Find out your current kernel.

You can do this by opening the terminal and typing the following command

uname -r

this command will give you your current kernel, you should note it down.

mine was 3.0.0-19-generic

Step 2.

Find out all your older kernels by typing the following command in your terminal.

dpkg --list | grep linux-image

you will get a list of all your kernels and you have to remove all other kernels which are lower than your current kernel

Step 3.

Remove your older kernels one by one

sudo apt-get purge linux-image-

Step 4.

When you are done update your grub using the following command

sudo update-grub2