📜 ⬆️ ⬇️

Initial setup of Raspberry Pi without monitor

I decided to join the club of raspberry lovers to do home automation and robotics. I bought a starter kit and a lot of additional hardware capable of working with Raspberry (I hope to write about the 4tronix Initio 4WD Robot Kit later). Upon receipt, I began to master the whole thing. I don’t have a TV and a separate monitor, but I didn’t consider it a big problem - it included a MicroSD card with NOOBS and a wifi adapter. Having connected the Raspberry to the home network over a twisted pair and looking at the ip address on the router, I tried to connect via ssh, but it didn't work out for me - no one was waiting for me on port 22. MicroSD is used in the Raspberry Pi B + - but I didn’t have a handy reader or SD adapter. In the set was a serial port with a USB interface.

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




When booting in graphical mode (which is not visible without a monitor), NOOBS waits for the choice of OS for installation - so the task is to install without question.
')
The cable was unmarked:



By VID and PID I found out that this is Prolific PL-2303. The port did not work under Windows 8.1, the manufacturer writes that PL-2303HXA and PL-2303X are not supported in Windows 8 and recommends using PL-2303HXD or PL2303TA - but I don’t know what kind of model I have.
Under Mac OS X 10.9, the port earned with drivers from the manufacturer’s website , under Ubuntu 14.04, it started working right away, without drivers.

An additional advantage of the port is the availability of power.
IMPORTANT: the power should be used only one - either from the port or via microUSB - but not both.

Port connection:



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

Connect to port on Mac OS:

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

Connect to port in Linux:

 $ sudo screen /dev/ttyUSB0 115200 

In Windows, you can use PuTTY (since under Windows I didn’t get a port, I didn’t check this option).

After turning on Raspberry with NOOBS, we see:

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

Enter using:

 login: root password: raspberry 


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

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


Remove all distributions except Raspbian:

 # cd /mnt/os # rm -r Arch/ Pidora/ RaspBMC/ data_partition/ OpenELEC/ RISC_OS/ 
We reserve 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 


Minimum set of commands:

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

Edit /mnt/recovery.cmdline adding a runinstaller to the beginning (if it is not there) and silentinstall to the end:

 # vi /mnt/recovery.cmdline 


Minimum set of commands:

i - switch to insert mode;
a - switch to insert mode with the next character;
<esc> - exit edit mode.

We check that everything is fine 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 OS - the above described editing and deleting of files can be done in your favorite editor and file manager.

I reload Raspberry by disconnecting / connecting the power and wait for the end of the installation, which takes half an hour. You can check that the installation is done by logging in to the console and entering the top command - after the installation is completed, a reboot will occur and now Raspbian will 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 enter 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:~$ 


In raspi-config ssh and make further settings by connecting via ssh via a local network.

Update 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="<ssid>" psk="<>" key_mgmt=WPA-PSK } 


I turn off the wired network, reboot, and continue to use wifi.

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

For remote access to the GUI in Linux, I prefer x2go - unfortunately, while there is only a client in the repository for Raspberry, the server had to be collected from the sources a little by 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 a few hours, if anyone needs assembled packages, write - lay out somewhere.

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

Source: https://habr.com/ru/post/240283/


All Articles