Here you will find simple explanations and resources to problems encountered with the Raspberry Pi software and hardware. (Also it helps me to remember!)

domingo, 11 de enero de 2015

First steps. My new Raspberry Pi B+

Hi,

I just unpacked my new hardware and I'm working with it.

This platform works with Linux (various versions of OS are available in the Raspberry Pi official web site, also called "distros").The Micro SD memory card purchased with the hardware comes with the OS pre-installed. Mine was NOOBS. Thats fine if you wants to start "playing" with the system.

But I had a problem: I had no HDMI monitor available. But I had a laptop PC with Windows XP. So the only way to "watch" inside the system was through a VNC sessión. For this, first you have to configure the system entering with a SSH session (Secure SHell session). That is only possible if the OS has started. And this is impossible with the pre-installed NOOBS image card, and without a HDMI monitor and a keyboard.

So, the first of all was to delete the original SD card with the pre-installed NOOBS and install the RASPBIAN image. Follow this steps for that.

Second: the SSH session. Be aware that the RPi has to be connected to a network with router through the wired ethernet port for the first time (remember, you don't have screen and you can't configure the Wifi connection). RASPBIAN has enabled the DHCP in the wired ethernet port by default but you must to find the IP. For this follow this steps. After that, and if you have a Raspbian release before November 2016, follow this, step by step. (¡¡Attention!!:
As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. This is done using raspi-config:
Enter sudo raspi-config in the terminal, first select Interfacing options, then navigate to ssh, press Enter and select Enable or disable ssh server.
For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card.)

Third: the VNC session. To install the VNC server in Raspberry Pi (TightVNCserver for example) type the next in the SSH session:
sudo apt-get install tightvncserver
With this you have installed the VNC server software. But you have to run TightVNC Server in order to enter a password and an optional view-only password (you have to execute this step only once): 

tightvncserver
I wanted my system to run the VNC server at boot (every time the RPi started). For this you have the next steps:
  • Log into a terminal on the Pi as root:
sudo su
  • Navigate to the directory /etc/init.d/:
cd /etc/init.d/
  • Create a new file here:
nano vncboot
  • And write the following script inside:
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

#! /bin/sh
# /etc/init.d/vncboot

USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
  echo "Starting VNC Server"
  #Insert your favoured settings for a VNC session
  sudo /usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565
  ;;

 stop)
  echo "Stopping VNC Server"
  /usr/bin/vncserver -kill :0
  ;;

 *)
  echo "Usage: /etc/init.d/vncboot {start|stop}"
  exit 1
  ;;
esac

exit 0

  • Save this file as vncboot.
  • Make this file executable:
chmod 755 vncboot
  • Enable dependency-based boot sequencing:
update-rc.d /etc/init.d/vncboot defaults
  • If enabling dependency-based boot sequencing was successful, you will see this:
update-rc.d: using dependency based boot sequencing
  • But if you see this:
update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot
  • then try the following command:
update-rc.d vncboot defaults
  • Reboot your Raspberry Pi and you should find a VNC server already started.
  • Install a VNC viewer in your laptop OS.
With this steps you'll have a Raspberry Pi hardware with RASPBIAN installed and the VNC server running from boot.

Remember that if you want to start de RASPBIAN GUI you must run the "startx" command.

No hay comentarios:

Publicar un comentario