28

To keep myself entertained during the COVID-19 pandemic, I've bought a Raspberry Pi. I thought that it would be possible to program it from my laptop over SSH using an Ethernet connection, but I've just discovered that this requires me to know the IP address of the Raspberry Pi.

Without a keyboard/mouse to plug into it, I can't set up the Raspberry Pi's Wi-Fi and/or check its IP address (as far as I'm aware) using a monitor.

Without an SD card reader, I cannot follow a tutorial such as this for headless setup.

Can anyone think of a way around this?

The Raspberry Pi already has an SD card in it with the Raspbian operating system installed on it.

8
  • 1
    Do you have a ttl-level USB to RS232 serial dongle?
    – slebetman
    Commented Apr 17, 2020 at 7:30
  • I can't be bothered to write this again, as an answer, but here's how I connected it over ethernet to my windows pc. Once you're connected, you can set up a cron job that connects to your wifi so you don't need to do this every time
    – lucidbrot
    Commented Apr 17, 2020 at 13:12
  • This was recently covered on Hacker Public Radio (also about finding the IP address of a Raspberry Pi): Locating computers on a network (episode 3052) Commented Apr 17, 2020 at 13:18
  • nmap -sn 192.168.1.0/24 usually does that for me. Note that network may vary. Commented Apr 19, 2020 at 23:42
  • 1
    SD card reader should be a mandatory purchase if you have a Pi. Even if you work around it today, you'll need it tomorrow. Also regarding keyboards, a cheap-as-possible compact USB keyboard is good to have around... even getting into the BIOS on many PCs cannot be done without a wired keyboard
    – Greg Woods
    Commented Apr 30, 2020 at 9:02

13 Answers 13

30

Welcome to the world of Pi - you will get many hours of fun from them once you are up and running.

First check with your supplier to see if the version of the operating system they put on the card had ssh enabled - most suppliers do not do this though. If not:

  • Try ping raspberry.local - it may find it.
  • Check your router to see if you have a new device
  • Look at a ping program for your computer or 'phone / tablet - I use one called fing

Once you have the IP address you need to load and use PUTTY on a PC or ssh from the terminal of a Linux or Mac computer.

ssh [email protected]

where x.x.x.x is the IP address of the Pi from above. Sorry I do not use PUTTY but plenty of guides on the internet :-)

If that does not work then unfortunately without a SD card reader/writer you are stuck as you do not have ssh enabled - as a bare minimum you need to be able to add a file call ssh to the /boot partition of the SD card then you can access it via ssh [email protected] from a Mac, Linux or an up to date Windows PC.

You can get low cost USB to SD card adapters - that will take a few more days of waiting though.

11
  • 8
    Note that raspberry.local uses Apple's Boujour protocol which by default does not exist on Windows. A neat trick to make it work on Windows is to install iTunes for Windows. On Linux it sometimes works automatically but if it doesn't then you don't have Avahi installed
    – slebetman
    Commented Apr 17, 2020 at 7:32
  • 3
    @slebetman Windows calls it Zero Configuration Networking and its been available since 2005 microsoft.com/en-us/research/video/… M/S broke its own implementation about two years ago but fixed it again. You can install iTunes or just Bonjour from Apple to make it more stable or hope M/S do not break it again :)
    – user115418
    Commented Apr 17, 2020 at 12:20
  • 2
    Zero conf on Windows is a different protocol that is incompatible with Bonjour and does not implement the .local domain which is part of a DNS based protocol developed separately by Apple after Windows released zero conf. In early 2020 the .local domain still does not work in Windows (tested on both Windows 7 and Windows 10 when I instructed my employees to connect to the test server using the .local domain and I discovered that Windows does not support it as of February 2020)
    – slebetman
    Commented Apr 17, 2020 at 12:30
  • 3
    I did some googling around and found that Windows only support mDNS (.local domain) in newer applications built with .Net 4.6 and above: social.technet.microsoft.com/Forums/en-US/…. This explains why none of our software can connect to .local domain as they are all Java8 based. Older .Net and win32 apps cannot access .local domain without installing something like Bonjour
    – slebetman
    Commented Apr 17, 2020 at 12:51
  • 5
    @slebetman That's wild. "Today we will be setting up our Raspberry Pi. To be able to SSH into it, please first download iTunes onto your Windows 10 desktop." Commented Apr 17, 2020 at 18:53
12

To find the IP address of your Raspberry Pi, you can try one of the following:

  • ping with common names (rpi, rpi4, rpi3, raspberry and raspberrypi)
  • look at your router administration console to list all devices on the LAN
  • use tools for LAN analysis (like Fing for Android)

If ssh is not enabled by default, if you don't own an SD reader nor a USB flash drive, nor a USB adapter for microSD cards, you will probably be stuck.

3
  • 2
    Re raspberry (on the network): Not raspberrypi? Commented Apr 17, 2020 at 13:54
  • Try both. If one works ...
    – waltinator
    Commented Apr 20, 2020 at 0:27
  • All Pi computers using Raspbian by default are named raspberrypi.local as this is the name built into the image. As you never seem to have just one pi (you may start with one but the seem to grown) it should be changed ASAP as two computers with the same name on the same network is an issue... Unless you have the weird software I have on your PC (Macs are fine) then load support.apple.com/kb/DL999?locale=en_GB but some Windows service packs can break this see superuser.com/questions/1330027/… for one fix
    – user115418
    Commented Apr 30, 2020 at 23:41
11

According to What are the possible OUIs for the Ethernet MAC address, there are exactly two OUIs used by Raspberry Pi devices as of April 2020.

This is confirmed by Raspberry Pi Foundation - MAC vendors list.

One solution would be to search your desktop system's ARP table with:

linux>    sudo arp -a | tr -d : | egrep "b827eb|dca632"

windows>  arp -a | findstr dc-a6-32
windows>  arp -a | findstr b8-27-eb

You might need to fill your ARP table with a command like fping (I am not sure if there's a Windows equivalent)

 linux>      sudo fping -a -g 10.99.99.0/24

You could also use Nmap to find all hosts on your LAN that listen for SSH:

 linux>      sudo nmap 10.99.99.0/24 -p 22

These would not be my first solutions - I'd check the DHCP logs in my firewall in the first instance.

10

xkcd butterfly

Are you looking for a theoretical solution, or a practical one?

SD cards have SPI interface as well, so as long as you can provide a stable 3.3V for powering your card and a debounced clock signal, a few additional switches and wires could solve it. (maybe add an LED and a series resistor to MISO to have some feedback)

There's a video where an Atmel AVR chip is programmed by hand through SPI similarly. The SD card's protocol is different, and this is not practical nor recommended. But in theory it's possible to read/write anything.

Let's program an AVR manually

4
  • But an AVR microcontroller may not have enough RAM for the required buffers for newer SD card interfaces, like SDHC (all SD cards these days - you can no longer buy the old ones (nominally at or below 1 GB)) Commented Apr 17, 2020 at 14:14
  • It doesn't need to, because you don't need it. You could - in theory - program the SD card by directly wiring up VCC and GND to a 3V3 power supply, its MOSI to a switch, its MISO to an LED and a series resistor, and its SCK to a debounced button. Just like in the video, only put the card in place of the AVR. You might need some pen and paper, also very good patience, dexterity, and memory.
    – Nyos
    Commented Apr 17, 2020 at 14:23
  • 1
    That's the spirit, the rest is so ... pedestrian. I was expecting something like "connecting GPIO x and y via a resistor causes it to crash to terminal and this-and-this hairpin has the right resistance" or some such. You know, like using Ikea coffee tables for cheap home 19" racks, CD audio cable ends for HP 48 calculator serial cables and whatnot.
    – chx
    Commented Apr 18, 2020 at 3:54
  • Why do I expect that YouTube URL to go to a famous Rick Astley video? 🤔
    – rugk
    Commented May 4, 2020 at 20:00
9

It is possible to access the Pi over serial terminal, but this requires a USB-serial dongle on the laptop.

It is far easier to buy a SD Card reader to enable ssh - these are available for < $5.

Once enabled you can ssh into the Pi over Ethernet using a Link-local address with the Pi's hostname (raspberrypi by default)
ssh [email protected]

This works using with most OS although other variants on raspberrypi may work on Windows.

6
  • Shouldn't you be able to access the pi directly through a USB port on your pc connected to the usb-in?
    – NomadMaker
    Commented Apr 17, 2020 at 6:40
  • @NomadMaker I believe this is possible on the Pi4 & PiZero BUT you need to configure the Pi first!
    – Milliways
    Commented Apr 17, 2020 at 6:48
  • 1
    @NomadMaker On the early Pi's, no, not at all (Up through the Pi 3+, the USB port used for power doesn't even have the data lines connected). The Pi Zero can do it, but requires special setup. I think the Pi 4 can also, but I'm not sure. Commented Apr 17, 2020 at 17:58
  • That is an interesting antediluvian idea. Is the serial terminal set up normally? Commented Apr 18, 2020 at 8:57
  • Isn't a word missing after "This works using a"? Commented Apr 20, 2020 at 16:57
8

Contrary to popular belief, there is also a way of booting the Raspberry Pi without using an SD card at all! All of the previous answers recommended impractical ways, and the same applies to this method, though I hope you find it much more practical than what was previously suggested.

Method 1: Booting from a MSD (Mass Storage Device ie. USB Flash / Thumb Drive)

First of all, I'd like to point out that you can boot your Raspberry Pi via a USB. However, this only works if you're using any of the following models (OR if you have an SD Card Reader):

  • Pi 2B v1.2
  • Pi 3A+
  • Pi 3B
  • Pi 3B+

Unfortunately, if you do not have an SD Card Reader and your model is not one of the supported ones listed above, you cannot use this method.

If you have a SD Card and a SD Card Reader, then this guide is for you!

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

Method 2: Making the computer serve all the files to the Raspberry Pi

For this method, you will not even need an SD card to get your Pi up and running! You will just need to connect the DATA MicroUSB port on your Pi to your computer!

This method will only work for the following Raspberry Pi models:

  • Pi Compute Module
  • Pi Compute Module 3
  • Pi Zero
  • Pi Zero W
  • Pi A
  • Pi A+
  • Pi 3A+

See this official GitHub project if you're interested! https://github.com/raspberrypi/usbboot

Your computer will serve all the files needed for the Raspberry Pi to boot (make sure you read the "Running your own (not MSD) build" part in README.md; that is what you want to do).

7
  • You still need an SD card reader to make the changes in the second option.
    – user115418
    Commented Apr 19, 2020 at 15:29
  • @Andyroo No, that is incorrect. You only need to remove the SD card for it to try booting into that mode. See raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/… for full details.
    – Toothbrush
    Commented Apr 19, 2020 at 17:18
  • @Toothbrush Apologies - I see how that works now but the Pi would boot from the OPs card first and I would not like to put the only card I had in a powered Pi SD slot to add the ssh file to it :-) The second options (not MSD) does state copy the FAT partition files into a subdirectory hence the reader requirement above.
    – user115418
    Commented Apr 20, 2020 at 11:13
  • 1
    @Andyroo No, it is not required. "When this boot mode is activated (usually after a failure to boot from the SD card), the Raspberry Pi puts its USB port into device mode and awaits a USB reset from the host. […] The host first sends a structure to the device down control endpoint 0. This contains the size and signature for the boot (security is not enabled so no signature is required). Secondly, code is transmitted down endpoint 1 (bootcode.bin)."raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/…
    – Toothbrush
    Commented Apr 21, 2020 at 17:51
  • 1
    @Andyroo "you just need to copy the FAT partition files into a subdirectory (it must have at the minimum bootcode.bin and start.elf)" is trying to say that you need to copy the files which are necessary to boot the Raspberry Pi firmware to the directory which usbboot reads from and sends to the booting Raspberry Pi. It goes on to explain that copying the full kernel distribution will not work by default. "To provide a filesystem there are many options, you can build an initramfs into the kernel, add an initramfs to the boot directory or provide some other interface to the filesystem"
    – Toothbrush
    Commented Apr 21, 2020 at 17:53
6

Newer raspberry PIs will boot from the USB port. You can install raspbian on the USB stick with the usual process. When it boots you plug in the SD card (don't do it before the boot or it'll try booting from the SD card) and write the data there.

1
5

If the Raspbian installation already has SSH enabled and you know the password, it is only a matter of finding the IP. However, the default installation has SSH disabled.

If you have a Raspberry Pi 3B+ and a USB drive, you can install ssh-enabled Rasbian on the USB drive and boot from that. Unfortunately the other Raspberry models do not boot from USB by default.

Alternatively, you might have a SD card writer you do not know about. For example many phones and digital cameras have SD card slots, and give access to that from PC when connected. To follow the tutorial you linked in your question, you only need to create two text files on the card.

5

Rasbpian boots up with IPv6 enabled by default. Provided your laptop supports IPv6, too it solves all your problems:

First, broadcast ping your local network:

ping6 ff02::1%eno1

All the machines will answer. Log in via ssh (just try all adresses):

ssh pi@fe80::f000%eno1

eno1 refers to my laptop's ethernet device in this example.

2
  • that may well find the IP address (assuming the LAN supports IPv6 - some do not) but does not enable ssh (SD card adapter is still needed to enable ssh over IPv6) - Serial is the only way to go in these cases :-(
    – user115418
    Commented Apr 18, 2020 at 14:18
  • Dang. I completely forgot ssh is not enabled by default.
    – Hermann
    Commented Apr 18, 2020 at 17:24
5

Yes, there is quite convenient method. Take a look at PiConfig - Raspberry Pi Network Configurator: https://www.kickstarter.com/projects/827010089/raspberry-pi-network-configurator-piconfig

https://www.geeky-gadgets.com/piconfig-raspberry-pi-network-configurator-23-03-2015/

This is a pendrive dedicated to set up a raspi. It was successfully funded at Kickstarter five years ago and it seems one can still buy it. PiConfig plugged into RPi

3

From the constraints you mention (no USB keyboard available and no SD-Card reader to modify the Raspbian image to contain your wifi credentials), there is only one option left. That is attaching a serial console to the Raspberry Pi and then you have full access. RPi Serial Connection

For attaching a serial console you will need a special USB cable which can connect to the right header pins on the Pi. Search for "Raspberry Pi serial USB cable" of "Raspberry Pi USB console cable". If you have an FTDI converter laying around you can use that.

Instead of a cable you could also use an ESP8266 and do serial over Wifi ;)

The next best option without a SD-Card reader/writer, is to borrow a USB keyboard from your neighbours. With that you can connect the PI to your television over HDMI and use the keyboard to log in and modify the wifi credentials. It's even possible to do this without a mouse by interrupting the boot and adding

init=/bin/bash

after the boot command. This way raspbian will boot up in text mode.

3

There is the option of network boot, some details can be found here. It uses another raspberry as network boot server, but any machine can act as it.
I don't have any raspberries so I never tried it with them, I did it many years ago with normal x86_64 machines, a bit cumbersome to configure, but it works.

1

Actually you cannot generally run a Raspberry pi without a SD card, as it stores the operating system it will be running. It's the secondary memory unit of the Raspberry Pi. But alternatively you can also use a pendrive (in the first place), to use a bootable hard drive, and run your your Raspberry Pi.

Now you can do two things very interestingly, 1.connect your raspberry pi with your network (use an Ethernet medium to avoid credentials input), and go to your Router to find out your Raspberry Pi IP address. That you can do by going to the 'Connected Client Status' on your Router. 2. Using your Raspberry pi IP, connect your PI, by SSH or you can use VNC (search on internet how to connect to Raspberry pi with VNC, this is easy af) and enjoy yourself.

N.T. for your entertainment purpose, you can use Volumio, MusixBox, or RuneAudio Operating Systems over Raspberry pi. (I'm not sure whether you can make portable hard drive medium, for these OSs, but if such, go for Raspbian or Raspbian Noobs or other Linux Frameworks).

All the best.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.