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):
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.
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).
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).
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).
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
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).
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.
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
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.
Ping from the host to test if there is a connection.
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
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.
If the LiveCD method has been used for step 3 and 4: Shutdown
Ubuntu (to write out the changes and unmount the SD
card).
Start the Raspberry Pi up with the SD card inserted.
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*.)
Change to a new password:
su pi
passwd
Optional: do further configuration of the Raspberry Pi
sudo raspi-config
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
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:
NOOBS 1.3.7 and NOOBS 1.3.10.
UltraEdit on Windows as it handles text files with Unix
line endings without any problems.
Windows XP 64-bit (yes, I know)
Sources:
NOOBS at GitHub, sub section How to Automatically Install an OS
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).
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.
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).
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...
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.