99

I am trying to install Raspbian from NOOBS, but I have no other screen/keyboard available than my laptop screen/keyboard. I find enough information about using a laptop screen/keyboard for a Pi, but then you already need to have an OS installed. But I have no OS installed, because my SD card contains NOOBS and I want to install Raspbian using NOOBS.

How can I do that with only my laptop screen and keyboard? I'm running Windows 7 on my laptop.

1
  • 14
    Why bother. If you don't have a screen or keyboard what are you planning to do with NOOBS? Just download Raspbian and install on the SD card. NOOBS is just a waste of space.
    – Milliways
    Commented Apr 14, 2014 at 10:18

7 Answers 7

125
+100

This no longer works since ssh is not enabled.

Using only the laptop's screen and keyboard (both before and after installation), install and configuration for headless operation using SSH is possible using NOOBS (they call it "silent install"). It does not require a separate screen or keyboard/mouse. It does require an SD card reader on the laptop (built in or external USB), though.

The only thing required on the Raspberry Pi side is an Ethernet connection (to SSH into it from a host system). Alternatively, using special hardware (USB-to-serial adapter), it possible to use some GPIO pins on the Raspberry Pi.[3]

This can be done deleting a few folders, editing two files on the SD card and setting some symbolic links in /etc/init.d (make a backup copy first of the SD card content if you only have the SD card with NOOBS on it). The security conscious may want to change the default password before installation.

Prerequisites:

  • A host computer capable of running an SSH client and of reading/writing the file system on the Raspberry Pi's SD card (ext4). The operating system could be Windows, Mac or Linux. This could be a computer that is normally running Windows, but which has a DVD drive so Ubuntu can be started in trial mode using a LiveCD.

  • An Ethernet connection to the Raspberry Pi and accessible by the host computer TCP/IP-wise (the host computer could itself use Ethernet or a wireless connection).

  • A text editor on the host system that can correctly handle Unix end-of-line characters. For example, UltraEdit on Windows that I have used for testing. Notepad++ and Vim on Windows should also be fine.

  • An SD card reader (to make crucial changes to the SD card during the process, both pre-install og post-install).

HowTo

Pre-install

For instance, to automatically install Raspbian (the recommended choice) when power is applied to the Raspberry Pi with the SD card in, do the following offline (on the host system, Windows, Mac or Linux):

  1. Download and prepare NOOBS (NOOBS 1.3.10, released 2014-09-09, is a 704 MB download) on a sufficiently large SD card, 4 GB or greater.

    This can involve using SDFormatter with option "FORMAT SIZE ADJUSTMENT" set to "ON" to format the entire SD card as one big FAT32 formatted partition). See the linked page for details.

  2. In the os folder on the SD card with NOOBS, delete all folders except Raspbian (folders Arch, RaspBMC, Pidora, OpenELEC, RISC_OS, and data_partition for NOOBS 1.3.7. And only Data_Partition for NOOBS 1.3.10).

  3. Edit file \os\Raspbian\flavours.json, so it only contains the desired version of Raspbian, "Raspbian" (not "Raspbian - Boot to Scratch").

    Before:

       {
         "flavours": [
           {
             "name": "Raspbian - Boot to Scratch",
             "description": "A version of Raspbian that boots straight into Scratch"
           },
           {
             "name": "Raspbian",
             "description": "A Debian wheezy port, optimised for the Raspberry Pi"
           }
         ]
       }
    

    After:

       {
         "flavours": [
           {
             "name": "Raspbian",
             "description": "A Debian wheezy port, optimised for the Raspberry Pi"
           }
         ]
       }
    

    Delete the extra file(s) that your text editor may produce (such as a .bak file).

  4. Edit file recovery.cmdline (in SD card root folder) to append silentinstall to the arguments list.

    Before (may differ depending on NOOBS version):

     runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline
    

    After (may differ depending on NOOBS version):

     runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline silentinstall
    

    Delete the extra file(s) that your text editor may produce (such as a .bak file).

  5. Optional:

    To hold the option open of connecting a TV to the video output, also add display=3 (3 for PAL, 4 for NTSC):

     runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline silentinstall display=3
    
  6. Optional: change the default user name and password by editing \os\Raspbian\os.json:

    Before:

       {
         "name": "Raspbian",
         "url": "http://www.raspbian.org/",
         "version": "wheezy",
         "release_date": "2014-01-07",
         "kernel": "3.10",
         "description": "A community-created port of Debian wheezy, optimised for the Raspberry Pi",
         "username": "pi",
         "password": "raspberry"
       }
    

    After:

       {
         "name": "Raspbian",
         "url": "http://www.raspbian.org/",
         "version": "wheezy",
         "release_date": "2014-01-07",
         "kernel": "3.10",
         "description": "A community-created port of Debian wheezy, optimised for the Raspberry Pi",
         "username": "pi",
         "password": "DerSkalMangeFlereJobsTilI2014tOverHeleVerden11111111111111111111df11111111111111111111"
       }
    

    Delete the extra file(s) that your text editor may produce (such as a .bak file).

  7. Put the SD card into the Raspberry Pi, connect it with an Ethernet cable such that the host system with the SSH client can see it and such that DHCP is available to the Raspberry Pi (for instance, most NAT-routers have a DHCP server built in). Perhaps disconnect the system from the Internet until the password has been changed.

  8. Power the Raspberry Pi on to start the installation. And wait! This can take a while, like half an hour or more. To be sure, leave it alone for a few hours. An install time of 19 minutes and 20 seconds has been measured when using NOOBS 1.3.10 (from power up till the first successful ping). The current drawn was 400 - 480 mA and fell to 370 mA after the first ping succeeded.

Post-install

  1. Find the Raspberry Pi's IP address (assigned by DHCP) somehow. For instance, guess it from the IP address range that a DHCP server in a NAT router uses and ping those addresses (mine is set up to use 192.168.0.100 - 192.168.0.255 and often it is assigned 192.168.0.100 or 192.168.0.101).

    Wireshark can also be used for this purpose, especially if it is in an environment with a lot of devices. This is much easier to do if the MAC address of the Raspberry Pi is known, and it can be obtained by temporary using step 4 below.

    This step is not necessary if a fixed IP address is set in step 4 below.

  2. Ping from the host to test if there is a connection.

  3. SSH is not enabled by default for Raspbian in NOOBS version 1.3.7 - despite what some pages claim. (It may be different for Arch Linux.) However, it is for Raspbian in NOOBS version 1.3.10, and this step may no longer be necessary (however, any purchased Raspberry Pi may be delivered with an SD card with an older version of NOOBS, and it may be worth saving the 700 MB download).

    The easiest way to enable it is described in Oli's answer to Prepare for ssh without a screen (on this site) and is to change the symbolic links in /etc/init.d (in root).

    For instance, booting from the Ubuntu 13.04 LiveCD with a USB card reader on the host system and issuing these commands in Terminal will be sufficient:

     sudo su
     cd /media/ubuntu/root
     for i in 2 3 4 5; do sudo ln -s /etc/init.d/ssh etc/rc$i.d/S02ssh; done
    
  4. Optional: set a fixed IP address if this makes it easier and the kind of network allows it. On a home network this could be by assigning an IP address outside of the IP address range used by a NAT router's DHCP server, for example, 192.168.0.93.

    In file cmdline.txt (in folder boot off the root of the SD card) add this at the end of the long line:

    ip=192.168.0.93
    

    The end result may be something like:

    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait ip=192.168.0.93
    

    Like for step 3, the file to edit would be /media/ubuntu/root/boot/cmdline.txt.

    Note: without extra parameters after the IP address there is no connection to the Internet and thus step 11 below will fail.

  5. If the LiveCD method has been used for step 3 and 4: Shutdown Ubuntu (to write out the changes and unmount the SD card).

  6. Start the Raspberry Pi up with the SD card inserted.

  7. SSH to the Raspberry Pi using the IP address found in step 1 or step 4 (for instance, using PuTTY on Windows) and log in:

    login as: pi
    [email protected]'s password: raspberry    (or the password that was set in os.json, see 6 in *Pre-install*.)
    
  8. Change to a new password:

        su pi
        passwd
    
  9. Optional: do further configuration of the Raspberry Pi

        sudo raspi-config
    
  10. Optional: enable TV output

    • Open config.txt in vi:

        sudo vi /boot/config.txt
      
    • Outcomment this line (NOOBS may have inserted an extra line with this enabled), so it reads (insert # at the beginning of the line):

        #hdmi_force_hotplug=1
      
    • Uncomment this line (2 is for PAL; use 0 for NTSC), so it reads (remove the # at the beginning of the line):

        sdtv_mode=2
      
    • :wq

    • Restart to see the effect:

        sudo shutdown -r now
      
  11. Even Raspbian delivered with NOOBS 1.3.10 has the very serious Shellshock vulnerability that is in Bash, and you do not want the Raspberry Pi to be left unpatched.

    To test whether the Raspberry Pi is vulnerable to Shellshock, issue:

    env x='() { :;}; echo "WARNING: SHELLSHOCK DETECTED"' bash --norc -c ':' 2>/dev/null;
    

    To refresh the repositories and upgrade Bash, issue:

    sudo su
    apt-get update && apt-get install --only-upgrade bash
    

When testing this, I used:

  1. NOOBS 1.3.7 and NOOBS 1.3.10.

  2. UltraEdit on Windows as it handles text files with Unix line endings without any problems.

  3. Windows XP 64-bit (yes, I know)


Sources:

  1. NOOBS at GitHub, sub section How to Automatically Install an OS

  2. Running the Raspberry Pi headless with Debian Linux (However, this presumes SSH is enabled by default which is not the case with version 1.3.7 of NOOBS).

  3. New Out Of Box Software (NOOBS) headless install onto a Raspberry Pi. YouTube video. It uses special hardware (USB cable with a built-in USB-to-serial converter) to connect to the TX/RX pins on the GPIO. Effectively, it is like connecting an old-fashioned dump terminal to the Raspberry Pi.

  4. Raspberry Pi Remote Connections – Without A Network!. Describes how to connect a computer directly to the Raspberry using a normal Ethernet cable (a special cross-over is not needed) and how to set a static IP address on the Raspberry Pi (however, the example precludes connection outside the current subnet and thus connection to the Internet).

  5. Mounting the root filesystem via NFS (nfsroot), near "This parameter tells the kernel". Formal documentation for setting a static IP address as in source 4 and 8 other parameters that should allow connection to the Internet, but it is not clear exactly what those parameters should be...

  6. Setting Up Ethernet, near "Method 1: Editing /boot/cmdline.txt". Example of the more advanced uses of "ip=" from which it may be possible to deduct how to set it up such that a connection to the Internet is possible.

27
  • 2
    Yea great answer! Definitely worth the bounty! Some interesting things in here :)
    – Piotr Kula
    Commented Jul 21, 2014 at 20:16
  • Note: using the static IP address method there is no connection to the Internet as the gateway address, etc. is not set up. Thus, the Shellshock patch will not work. But it can be used to bootstrap the process by finding the MAC address while connected using the static IP address method - issue "ifconfig" and write down the MAC address (field "HWaddr" in the line with "eth0"). The MAC address can be used with a DHCP server to always use the same IP address (reserve a particular IP address for a particular MAC address) to effectively get a static IP address. Commented Nov 23, 2014 at 3:03
  • 1
    @PeterMortensen I figured that out in the meanwhile. Thank you for confirming. Notice that the partition must have type hexadecimal C (FAT32 LBA) or the Raspberry Pi won't boot.
    – FUZxxl
    Commented Mar 28, 2015 at 23:05
  • 1
    Amazing answer! Please take a look at this question: raspberrypi.stackexchange.com/questions/61351/… it's somehow related to this topic. I need help making sure that the network mirrors are disabled during installation. Thank you.
    – Drew
    Commented Feb 2, 2017 at 2:11
  • 1
    @Milliways: What do you mean by "This no longer works since ssh is not enabled."? This is how it was with earlier versions of NOOBS, and I wrote "SSH is not enabled by default for Raspbian in NOOBS version 1.3.7". And provided a solution for it (section Post-install, step 3). Is ssh now completely removed so it can not be enabled? Have you done some testing or have some evidence to establish that the procedure described does not work? Anyway, I am going to check it soon with the newest version NOOBS. Commented Jul 8, 2017 at 9:45
10

For a headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card.

When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled, and the file is deleted. The content of the file does not matter: it could contain text, or nothing at all.

4
  • Is the file really deleted? If so, then upon a subsequent reboot, the file would no longer be present, and SSH would not be enabled. Is it really only a one-time use mechanism, and each time the Pi boots, the ssh file needs to be manually replaced? That doesn't sound quite right. Commented Jun 9, 2017 at 0:57
  • 2
    Yes, the file is really deleted. Upon boot, you need to login and configure normal bootups for ssh, like: sudo systemctl enable ssh so it comes up next time.
    – Dave X
    Commented Nov 23, 2017 at 1:04
  • Confirmed that the file is definitely deleted upon boot.
    – slm
    Commented Jul 28, 2019 at 2:59
  • Keep in mind, once you have an OS installed, you can enable ssh within the OS and ssh to NOOBS is no longer needed
    – uSlackr
    Commented Mar 24, 2020 at 1:37
9

The short answer is, make sure you download the offline install version of NOOBS, then edit the file recovery.cmdline and add silentinstall on the end of the first line.

That will auto install raspbian, and reboot into the desktop when finished.

1
  • 2
    If you find recovery.cmdline has a blank line at the end, delete the line, otherwise silentinstall won't work ! Commented Apr 1, 2017 at 9:55
5

I found this guide to be the most useful.

An important update in setup:

  • ssh is disabled by default on the newest images. You have to create a new file ssh in /boot (can be empty). E.g.

    touch /Volumes/boot/ssh

3

The way I did this was as follows:

  1. Remove power cable from the Pi and then take out the SD card.

  2. Use a card reader (or built in one if your laptop has one) and the SD adapter to read the card on your computer.

  3. In recovery.cmdline add vncinstall to the end of the line. Source here, example here.

  4. Safely eject the media in your OS then remove the adapter.

  5. Insert SD into Pi, connect Pi with ethernet to your router, power up, and then find the device on your network. If you can't access your router to see connected devices, use a tool such as nmap to scan your network. e.g. nmap 192.168.1.0/24 -p 5900. Another thing you can try is nslookup raspberrypi or ping raspberrypi to find the IP. Use vncviewer raspberrypi or vncviewer <IP> to connect to the host.

  6. Install Raspbian using your VNC connection.

  7. After installation the device will reboot.

  8. Turn off the Pi and put the card back into your computer.

  9. Add a file called ssh to the boot partition. You can use touch on Linux to do this.

  10. Safely eject SD and put back into Pi and power up.

  11. You will now be able to SSH to the Pi.

  12. Change the password immediately using passwd.

1

Even I was facing the same problem as yours. I was using the RCA display for NOOBS and there was nothing on the screen. The only option I had was using my laptop, but that needs to be initially set up with PuTTY to connect to Raspberry Pi via SSH.

The quick solution to your problem is: Download a separate image of Raspbian from the official website and then mount it on the SD card after formatting. You'll get the display easily. You just have to get an RCA monitor (maybe you have an old TV set lying around).

2
  • 1
    The OP stated: "I have no other screen/keyboard available than my laptop screen/keyboard." Commented Nov 13, 2014 at 11:22
  • What is that default setting for RCA in Raspbian, PAL or NTSC? Commented Nov 13, 2014 at 11:23
1

I have posted the detailed setup of a Raspberry Pi without a screen, mouse and keyboard at How to start Raspberry Pi without a screen?.

1
  • 5
    Welcome to Raspberry Pi! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Commented Jan 23, 2015 at 11:26

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.