The next version of Ubuntu is coming soon

Thursday 14 March 2013

First Login with headless Raspberry Pi

I orderd a Raspberry Pi and got it within a couple of days. Now I was curious to set it up and login to its terminal. If you want to know how to get started with Raspberry Pi you can go through this link:

http://www.raspberrypi.org/quick-start-guide
http://www.engadget.com/2012/09/04/raspberry-pi-getting-started-guide-how-to/

I prepared my SD card and also I had the power connector to power up the Pi. My only problem was that I did not had HDMI enabled monitor nor did I had the TV. I had to purchase an HDMI enabled Monitor, but it was too expensive and I already had a Monitor.

I had got other alternatives to get connected to R-Pi. One was that I buy a HDMI to VGA adaptor cable. But when I searched throught the internet, the HDMI to VGA adaptor was quite expensive. The cheaper ones were not good for the low powered Pi.

The other option was the usage of USB to TTL cable. Just to log into Pi, I had to purchase this USB to TTL cable and it did not seem to be a good choice. Also it wasnt that cheap too.

I was left with only one option. That was connecting the Pi with my Linux PC with the Ethenet cable. I searched the internet to figure out how to connect to R-Pi from my PC. I got a lot of links which would explain the process of connecting to the Pi from the PC via SSH. But none of these tutorials explained how to connect to R-Pi via PC for the first time.

Finally I decided to connect to the Pi with peer-to-peer connection. To be able to get connected via p2p I had to edit the IP address of both the devices. I could change the IP address of my PC, but how could I change the IP address of the Pi which was never logged in?

What I did for this purpose was I mounted the SD card into my PC and edited the required files in the SD card. Then I just inserted the SD card into the Pi and powered it on after connecting the LAN cable in P2P fashoin. I then SSHed into the Raspberry Pi and was able to login successfully.

I was just happy to figure out that I could log in to Raspberry Pi without connecting the Monitor to the Pi even for the first time.

Steps needed to connect to Raspberry Pi for the first time from your PC.

1. Insert the SD card into your PC, which contains the Raspberry Pi OS.
2. Mount the data section of the SD card.
$ sudo mount /dev/sdc2 /mnt
$ cd /mnt
3. Edit the network interface config file
$ vi etc/network/interfaces 
Note that there is no / at the start of the file path.
Make sure the following is fed properly into that file:


auto eth0
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0


Save the file and remove the SD card. Put it in the Raspberry Pi. Remember to connect the LAN cable to both the systems.
Note that the IP address of your PC should be somewhat 192.168.1.2
Start the Raspberrry Pi. Now connect to it via ssh.
$ ssh pi@192.168.1.3

Enjoy your Pi.
blog comments powered by Disqus