97

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.

ProgramFOX
  • 973
  • 1
  • 7
  • 18
  • 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 Apr 14 '14 at 10:18

7 Answers7

124

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
    pi@192.168.0.100'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.

Peter Mortensen
  • 1,984
  • 2
  • 14
  • 17
  • 2
    Yea great answer! Definitely worth the bounty! Some interesting things in here :) – Piotr Kula Jul 21 '14 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. – Peter Mortensen Nov 23 '14 at 03:03
  • (To edit: near "it can be obtained by temporary using step 4 below.") – Peter Mortensen Nov 27 '14 at 08:47
  • (To edit: near "if a fixed IP address is set".) – Peter Mortensen Nov 29 '14 at 19:00
  • (To add: test for the second vulnerability: "env X='() { (a)=>\' bash -c "echo echo vuln"; [[ "$(cat echo)" == "vuln" ]] && echo "still vulnerable :(" ". E.g. ref. https://superuser.com/questions/816662) – Peter Mortensen Nov 29 '14 at 21:52
  • (To edit: "recovery.cmdline (in root)" -> "recovery.cmdline (in the root folder of the SD card)".) – Peter Mortensen Dec 31 '14 at 11:48
  • (To add: a second installation (different SD card and hardware) took 23 min 38 secs.) – Peter Mortensen Dec 31 '14 at 12:57
  • (To add: a third installation with a Raspberry Pi B+ and a SanDisk Ultra 8 GB SD card (class 10, UHS class 1)) took 16 min 38 secs.) – Peter Mortensen Jan 04 '15 at 20:35
  • @PeterMortensen Someone pointed out that your reference to `cmdline.txt` in the latter half of this should probably be `recovery.cmdline` on NOOBS. I've edited a comment about that in, but if possible confirm this and correct as necessary -- cheers. – goldilocks Feb 13 '15 at 08:43
  • @goldilocks: I have checked an SD card that is the result of the installation procedure described here. On the 3 partitions on the SD card, "BOOT", "root", and "SETTINGS", there isn't any file named "recovery.cmdline". File "cmdline.txt" is on partition "BOOT", in the root of that partition. I think "recovery.cmdline" is only relevant pre-installation; the only thing left of NOOBS after installation is two small files on the small 26 MB partition "SETTINGS", "noobs.conf" and "installed_os.json". I will change it when I update my post the next time, at an appropriate time. – Peter Mortensen Feb 14 '15 at 17:24
  • @goldilocks: I have only checked for one of the versions of NOOBS, but I will check the other version before I update this post. – Peter Mortensen Feb 14 '15 at 17:26
  • Okay, I follow -- I presume you're right, so I removed that comment. The "someone pointed out" is [here](http://raspberrypi.stackexchange.com/questions/27612/i-couldnt-see-cmdline-txt-in-my-mac?noredirect=1#comment34609_27612). – goldilocks Feb 14 '15 at 17:52
  • Is it possible to install archlinux from NOOBS this way? Modding the files a little differently of course. – unom Mar 12 '15 at 08:19
  • For my NOOBs card, purchased March '15, there is an extra point to note: In step (4) of Pre-Installation, I had to also prepend 'runinstaller'. While it is in what you showed, on my card it wasn't in the file already. Perhaps it was mistakenly missing when the card was programmed. (It is an official card, bought from MCM). I thought it worth mentioning in case anyone else runs into this issue. – Tom Carpenter Mar 19 '15 at 01:42
  • @unmircea: Yes, at least with NOOBS 1.3.7. After that version, only Raspbian can be installed without an Internet connection. I am not sure how that would play out; I will try it at some time and report here. – Peter Mortensen Mar 24 '15 at 19:26
  • @Tom Carpenter Thanks for the feedback. Which version of NOOBS were you using? I have followed my own instructions here to the letter on many occations both at work and at home for both NOOBS 1.3.7, 1.3.10 and 1.4 (results for 1.4 (done on 2015-03-09) has not yet been reported here), and I haven't encountered this problem. I would like to include such information in the post (and give you credit). – Peter Mortensen Mar 24 '15 at 19:43
  • Shall we format the card to use a single partition with FAT32 or shall we directly FAT32 format the card without a partition table (like a floppy)? – FUZxxl Mar 25 '15 at 14:35
  • @FUZxxl: it needs a single partition. – Peter Mortensen Mar 28 '15 at 22:47
  • 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 Mar 28 '15 at 23:05
  • @PeterMortensen I wanted to install Archlinux on the Pi 2 but it says it's incompatible. – unom Apr 03 '15 at 08:33
  • Thanks! I found that on my new Pi2 (Noobs 1.4.0) the config json files varied slightly, (there was an extra line in each case).. and for some reason the username password edit didn't "take" on install - I had to log in with the default credentials. (btw SSH was already enabled). Tx again! – ptim Apr 21 '15 at 15:14
  • (To edit: register whether the line "T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100" in /etc/inittab is enabled by default. It is related to [this answer](http://raspberrypi.stackexchange.com/questions/14939/boot-messages-available-over-serial-however-no-login-prompt/22588#22588)). – Peter Mortensen Jun 21 '15 at 12:37
  • As of Noobs version 1.5, it contains only Rasbian as the OS. So most of the steps are eliminated. – Adi Jan 31 '16 at 10:54
  • 1
    Amazing answer! Please take a look at this question: https://raspberrypi.stackexchange.com/questions/61351/noobs-offline-intallation-without-monitor-and-disabling-network-mirrors it's somehow related to this topic. I need help making sure that the network mirrors are disabled during installation. Thank you. – Drew Feb 02 '17 at 02:11
  • @Adi Jan: No, most of the steps are not eliminated, only 2 steps in section "Pre-install". – Peter Mortensen Jul 08 '17 at 09:45
  • 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. – Peter Mortensen Jul 08 '17 at 09:45
  • Finding the IP address on a local wifi+ethernet network is easy with Fing — available both on Android and iOS. – ccpizza Oct 13 '17 at 20:57
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.

Greenonline
  • 2,448
  • 4
  • 18
  • 33
philip mudenyo
  • 201
  • 2
  • 3
  • 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. – Greenonline Jun 09 '17 at 00: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 Nov 23 '17 at 01:04
  • Confirmed that the file is definitely deleted upon boot. – slm Jul 28 '19 at 02: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 Mar 24 '20 at 01: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.

Mike Redrobe
  • 951
  • 7
  • 13
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

gameweld
  • 151
  • 1
  • 3
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).

Peter Mortensen
  • 1,984
  • 2
  • 14
  • 17
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?.

Peter Mortensen
  • 1,984
  • 2
  • 14
  • 17
kush rami
  • 11
  • 1
  • 5
    Welcome to Raspberry Pi! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Steve Robillard Jan 23 '15 at 11:26