How to install Raspbian on a Raspberry Pi without display and controls

What you need

  • RaspberryPi (1 A, 1B, 1B+, 2, 3… doesn’t matter)
  • A (micro)SD card (depending on your Raspberry Pi model) with at least 4GB
  • A (micro)SD card reader
  • USB Power Supply
  • Micro USB cable
  • Network cable
  • Another computer on the same network
  • Internet access

Install the Raspberry

If your SD card still has data on it, download the official SD card formatter of the SD association and use it to format the complete card.

Download the latest Raspbian image for the Raspberry Pi from https://www.raspberrypi.org/downloads/raspbian/

Unpack the image archive and install it onto the SD card. Refer to the Raspberry Pi installation guide for more detail.

Put the SD card into your Raspberry Pi, connect it to your network using a network cable and connect the USB power supply. The Raspberry will now boot into the operating system and after a few seconds it will be accessible within your network.

Connect to the Raspberry over network

Since we do not have any controls connected to the Pi now comes the tricky part: Finding out its IP. Fortunately there are mutiple ways to do so:

  • If you have administrative access to the switch or the router on your network managing the IPs you can look up Raspberries IP somewhere in that menu.
  • You use a tool to scan IPs on your network, e.g. Advanced IP Scanner on Windows or nmap on Linux.
  • If you have a relatively small network and know your DHCP settings you can try to guess it.

When you finally know your Raspberries IP you can connect to it via SSH (on Windows you can use PuTTY for that). Default user: pi, pw: raspberry.

(Optional) Update the Raspberry

After connecting to your Raspberry via SSH the first thing you should do is updating it. You can start by updating the firmware by typing following command:

sudo rpi-update

Next you should retrieve the last feature and security updates for your Raspbian OS

sudo apt-get update
sudo apt-get upgrade

(Optional)Fix a logging bug

As of 07/30/2016 there seems to be a problem with the logging system causing unneccessary log entries to fill up your log files. To circumvent that, open the configuration file:

sudo nano /etc/rsyslog.conf

Scroll to the end and search for following entries. Then disable the configuration by adding a # to the beginning:

#daemon.*;mail.*;\
#news.err;\
#*.=debug;*.=info;\
#*.=notice;*.=warn |/dev/xconsole

Again: Save with [CTRL + O], then [ENTER] and then [CTRL + X] to exit

Restart the logging service

sudo systemctl restart syslog

Configure the Raspberry

After that you can configure your Raspberry to boot into a graphical desktop at startup

sudo raspi-config

Choose following two options:

  • Expand filesystem
  • Boot Options -> Desktop Autologin

If you want your can overclock your Pi’s CPU here as well (Absolutely without warranty!). I have mine in a plastic case with passive heat dissipators on CPU, GPU and RAM and I am running Turbo mode without problems. But you should proceed very carefully here and use the lowest overclocking option to start with.

Exit the menu by choosing “Finish”.

Configure the Raspberry graphics

With the current settings the Pi will search for a display at startup and will try to find the optimal resolution which mostly does not work. Since for this tutorial we do not connect any display at all the Pi will choose a “secure” resolution which most likely will be VGA (800×600). But we want to use a higher resolution so we need to configure that first. Open the Raspberry configuration file with your favourite command line editor (e.g. nano):

sudo nano /boot/config.txt

Alter the configuration as shown below:

# Use HDMI even without monitor (optional)
hdmi_force_hotplug=1
# Output audio via HDMI (optional)
hdmi_drive=2
# Activate DMT-mode
hdmi_group=2

Depending on your target resolution choose one of the options below:

# 1024x768 / 60 Hz
hdmi_mode=16
# 1280x1024 / 60 Hz
hdmi_mode=36
# 1366x768 / 60 Hz
hdmi_mode=81
# 1680x1050 /60 Hz
hdmi_mode=58
# 1280x720 / 60Hz (720p)
hdmi_mode=85
# 1920x1080 / 60 Hz (1080p)
hdmi_mode=82

Save with [CTRL + O], then [ENTER] and then [CTRL + X] to exit.

For more detailed information refer to the official Raspberry Pi config.txt guide

You now configured your Raspberry Pi to boot into a graphical desktop with your chosen resolution. Bot how do you see that desktop without a monitor?

Install and configure VNC server

Since we do not have any display or controls connected to the Pi and we want to see the actual desktop we need to install some kind of remote desktop service to share the desktop over network. In our case we will be using the well known VNC protocol to do that job. Install the x11vnc server using following command

sudo apt-get install x11vnc

Configure the VNC password you want to use for graphical remote access

sudo x11vnc -storepasswd /etc/x11vnc.pass

Enter and confirm the VNC password you want to use.

We now need to configure the VNC server to automatically start at boot. To do so we need to create a x11vnc service configuration file

sudo nano /lib/systemd/system/x11vnc.service

Add following lines and change the scale option to match your Pi’s resolution:

[Unit]
Description=Start X11VNC
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -display :0 -auth guess –scale 1920x1080 -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 –shared

[Install]
WantedBy=multi-user.target

Again: Save with [CTRL + O], then [ENTER] and then [CTRL + X] to exit

Configure the x11vnc-server to automatically start at boot

sudo systemctl enable x11vnc.service

Reboot your Pi

sudo reboot

Connect via VNC

After you rebooted your Pi to apply all the configured settings you can now connect to it via VNC. If do not already have a VNC client you need to download one. Depending on the OS of your client computer there are different VNC client applications. In my case (Windows 10) I used RealVNC which is also available for other plattforms.

Open your VNC client and connect to your Pi by using its IP and port 5900 (e.g. 192.168.0.3:5900)

Now type in your VNC password and you are done.

Congratulations! You are now connected to your Pi without any controls or display connected.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s