Raspberry Pi initial setup without monitor

I decided to join the club of raspberry lovers to do home automation and robotics. I bought a starter kit and many additional pieces of iron that can work with Raspberry (I hope to write about the 4tronix Initio 4WD Robot Kit later). Upon receipt, he began to master the whole thing. I do not have a TV and a separate monitor, but I did not consider this a big problem - the kit included a microSD card with NOOBS and a wifi adapter. Having connected Raspberry to the home network via twisted pair and looking at the ip address on the router, I tried to connect via ssh, but nothing came of it - no one was waiting for me on port 22. The Raspberry Pi B + uses MicroSD - but I didn’t have the appropriate reader or SD adapter. The set had a serial port with a USB interface.

Under the cut, there’s a story about how I got the Raspberry Pi through the serial port and put the x2go server there.




NOOBS, when booting in graphical mode (which is not visible without a monitor), waits for the OS to be selected for installation - therefore, the task of installing without question.

The cable turned out to be without identification marks: I



found out by VID and PID that it was a Prolific PL-2303. The port did not work under Windows 8.1, the manufacturer writes that the PL-2303HXA and PL-2303X are not supported in Windows 8 and recommends using the PL-2303HXD or PL2303TA - but I don’t know which model I have.
Under Mac OS X 10.9, the port earned with drivers from the manufacturer’s site , under Ubuntu 14.04 it worked right away, without drivers.

An additional advantage of the port is the availability of power.
IMPORTANT: you only need to use power - either from the port or via microUSB - but not both.

Port connection:



Red cable - power - last connected or not connected at all if using microUSB power.

Connecting to a port on Mac OS:

$ screen /dev/cu.usbserial 115200
The documentation says that the port is called /dev/cu.PL2303-00001004, but I had a port /dev/cu.usbserial.

Linux port connection:

$ sudo screen /dev/ttyUSB0 115200

In Windows, you can use PuTTY (since I did not get a port under Windows, I did not check this option).

After turning on Raspberry with NOOBS we see:

Uncompressing Linux... done, booting the kernel.
Welcome to the rescue system
recovery login:

Log in using:

login: root
password: raspberry


The file system is mounted read-only, remount it for writing:

# mount -o remount,rw /dev/mmcblk0p1 /mnt


We remove all distributions except Raspbian:

# cd /mnt/os
# rm -r Arch/ Pidora/ RaspBMC/ data_partition/ OpenELEC/ RISC_OS/
We leave the only option to install Raspbian in / mnt/os/Raspbian/flavours.json

File before editing:

{
  "flavours": [
    {
      "name": "Raspbian - Boot to Scratch",
      "description": "A version of Raspbian that boots straight into Scratch",
      "feature_level": 123900
    },
    {
      "name": "Raspbian",
      "description": "A Debian wheezy port, optimised for the Raspberry Pi",
      "feature_level": 123900
    }
  ]
}
after editing:
# cat /mnt/os/Raspbian/flavours.json 
{
  "flavours": [
    {
      "name": "Raspbian",
      "description": "A Debian wheezy port, optimised for the Raspberry Pi",
      "feature_level": 123900
    }  
  ]
}
#


For editing, I use vi:

# vi /mnt/os/Raspbian/flavours.json


The minimum set of commands:

dd- delete the line;
5dd- delete 5 lines;
:x- exit with saving;
:q!- exit without saving changes.

We edit /mnt/recovery.cmdlineadding runinstallerto the beginning (if it is not there) and silentinstallto the end:

# vi /mnt/recovery.cmdline


The minimum set of commands:

i- switch to insert mode;
a- switch to insert mode with the next character;
- exit editing mode.

Check that everything is in order with the file:

# cat /mnt/recovery.cmdline
runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline silentinstall


If you have access to the SD card from under other OSs - editing and deleting files described above can be done in your favorite editor and file manager.

I reboot the Raspberry by disconnecting / connecting the power and wait for the installation to finish, which takes half an hour. You can verify that the installation is happening by logging in to the console and entering the command top- after the installation is complete, a reboot will occur and Raspbian will now boot:

...
[   13.281406] EXT4-fs (mmcblk0p6): re-mounted. Opts: (null)
[   13.785784] EXT4-fs (mmcblk0p6): re-mounted. Opts: (null)
Raspbian GNU/Linux 7 raspberrypi ttyAMA0
raspberrypi login:


I log in using:

login: pi
password: raspberry
Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'
pi@raspberrypi:~$ 


I raspi-configturn on sshand carry out further configuration by connecting via ssh via the local network.

Updating Raspbian:

$ sudo apt-get update
$ sudo apt-get upgrade -y


Configure wifi:

$ sudo apt-get install wpasupplicant wireless-tools
$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf


Add to the end of the file (I use WPA2 PSK):

network={
        ssid=""
        psk="<пароль>"
        key_mgmt=WPA-PSK
}


I disconnect the wired network, reboot, and then use wifi.

For Scratch, with which, unlike python, my son is already familiar with I need a GUI.

For remote access to the GUI on Linux, I prefer x2go- unfortunately, as long as there is only a client in the Raspberry repository, the server had to be collected from the sources by slightly updating the instructions from here :

sudo apt-get install -y debhelper libpng-dev libjpeg-dev zlib1g-dev quilt libfontconfig1-dev libfontenc-dev libfreetype6-dev libxmltok1-dev libxml2-dev autoconf pkg-config x11proto-core-dev man2html-base
git clone http://code.x2go.org/git/nx-libs.git
cd nx-libs/
git checkout redist-server/3.5.0.27
dpkg-buildpackage -us -uc
cd ..
git clone http://code.x2go.org/git/x2goserver.git
cd x2goserver/
git checkout 4.0.1.18
dpkg-buildpackage -us -uc
cd ..
git clone git://code.x2go.org/cups-x2go.git
cd cups-x2go/
git checkout 3.0.1.0
dpkg-buildpackage -us -uc
cd ..
sudo apt-get install  -y autotools-dev libqt4-gui libglib2.0-dev m4 qt4-qmake libqt4-dev dh-autoreconf
git clone git://code.x2go.org/pinentry-x2go.git
cd pinentry-x2go
git checkout 0.7.5.7
dpkg-buildpackage -us -uc
cd ..
sudo apt-get install -y libc6 lsof bc openssh-server openssh-client libconfig-simple-perl pwgen libdbd-pg-perl libdbd-sqlite3-perl libfile-basedir-perl libcapture-tiny-perl adduser xauth psmisc net-tools sshfs x11-apps x11-session-utils x11-utils x11-xfs-utils x11-xkb-utils x11-xserver-utils fontconfig xinit xfonts-base x11-common
sudo apt-get install -y libxml2 libjpeg8 libpng12-0 libstdc++6 zlib1g libgcc1
sudo dpkg -i x2goagent_*.deb nxagent_*.deb libnx-x11_*.deb libxcomp3_*.deb libxcompext3_*.deb libxcompshad3_*.deb
sudo dpkg -i x2goserver_*.deb x2goserver-xsession_*.deb x2goserver-extensions_*.deb


The assembly took several hours, if anyone needs the assembled packages, write - I'll post it somewhere.

This weekend is over - I will put Raspberry on wheels next weekend.


Also popular now: