Regular Ethernet cable + RPI 2 + Raspbian Jessie 2016-05-27 + Ubuntu 16.04 - 17.04 host
Link the Ethernet cable from your laptop directly to the Pi.
On Ubuntu 17.04 to work around this bug as mentioned on this answer you first need:
sudo apt-get install dnsmasq-base
Then open the Dash, and go:
- Network Connections
- Add
- Ethernet
- Create
- IPv4 Settings
- Method: Shared to other computers
- Set a good name for it
- Save
Find the IP of the Pi on Ubuntu:
cat /var/lib/misc/dnsmasq.leases
Then as usual:
ssh pi@IP
The crossover cable is not required if the host network card supports Auto MDI-X. This is the case for most recent hardware, including for example the 2012 Lenovo T430 I tested with, which has an "Intel® 82579LM Gigabit Network Connection" which documents support for Auto MDI-X.
Now you can also:
- access the Internet from the PI through your Ubuntu's Wifi connection
- open a VNC to get rid of the display as well: How to set up Raspberry Pi without a monitor?
This is a more concise version of: http://www.interlockroc.org/2012/12/06/raspberry-pi-macgyver/ which was mentioned by: https://raspberrypi.stackexchange.com/a/4294/33424
Serial to USB cable
Another alternative if you just want to get a shell on the Pi, is to use a serial cable.
This does not use SSH or networking itself, but rather the older, simpler, more direct, more reliable, lower bandwidth, lower distance serial interface.
You just need a cheap serial to USB connector like this one: https://thepihut.com/products/adafruit-usb-to-ttl-serial-cable-debug-console-cable-for-raspberry-pi
Then, you attach the sockets to the corresponding GPIO serial pins (TX, RX, 5V and ground) as documented at: https://www.raspberrypi.org/documentation/usage/gpio/README.md
Finally, plug the USB side of the connector to your host computer, and get a shell with:
sudo usermod -a -G dialout $USER
screen /dev/ttyUSB0 115200
Desktop computers still have a serial port which you can connect directly wire to wire with the Pi, but these are hidden in most laptops, and then we need the USB adaptor, see also: https://unix.stackexchange.com/questions/307390/what-is-the-difference-between-ttys0-ttyusb0-and-ttyama0-in-linux/367882#367882
Here is a video by Adafruit showing it: https://www.youtube.com/watch?v=zUBPeoLW16Q