Pi2–Assembly

This page is under construction.

I purchased a second Raspberry Pi.  It it the new, better, bigger version.  The Pi2.  More USB ports, more memory, better CPU, more ….  I purchased this Pi with the intent of having it control a tracked vehicle/crawler.

What follows will be an “assembly” scenario using the Pi2 with Ubuntu’s Mate OS for the RaspberryPi.

I.  Installing the OS on an SD card and sizing the /root partition:

On a Linux PC/laptop:

  1. down load Ubuntu Mate from here.
  2. cd to directory where you stored the OS zip file
  3. bunzip ubuntu-mate-15.04-desktop-armhf-raspberry-pi-2.img.zip
    insert your sd card
  4. df – note output – my card showed as:
    /dev/sdb1 31263744  32  31263712   1% /media/9016-4EF8
    unmount /dev/sdb1
  5. sudo dd bs=4M if=2015-05-05-raspbian-wheezy.img of=/dev/sdb
    note in the above:
    a.  “if=” is my release of raspian
    b.  “of=” is my “filesystem name” from the “df” command less
    the trailing 1, i.e., /dev/sdb NOT /sev/sdb1
  6. this write will take awhile.  when complete
  7. sudo sync
  8. remove the card
  9. launch gparted (the graphical partioning tool)
  10. reinsert your card
  11. in gparted at the top right make sure you check the card’s device.  if you don’t then the next steps will cause you to trash your current system.  you should see two entries in the screen below.  a partiion for /boot and a partition for /root.  the /root partition during install gets sized small so it might be undersized if your card is a 16, 32 or 64 gig card.  We are going to resize it so that when you insert it into your pi that problem will be fixed and you will be able to address the entire card’s space.  left click on the /root entry/line.  Now right click on that line and select resize.  There will be a screen displayed in graphical format.  On the right side of graphical display left click and drag the right  hand side all the way to the right.  You have now selected the entire remaining space for the /root partition. Now click on the “check” mark to cause the resize to happen.
  12. Unmount both /root and /boot partions by left clicking and right clicking.
  13. sudo sync
  14. Remove your card and place in the Pi.  After configuring your Pi open a terminal window and “df -h”.  You should see that your /root partition is sized to your cards size less a few MB for /boot and …

II.  Configuring the Pi2 network

I am using DHCP so I let the Pi2 ask for and receive and IP address from the router.  Using this method make for a bit more difficulty in addressing the Pi2 because its address could be different the next time it is booted or when the Pi2’s lease on that address runs out.  Assuming your Pi2’s hostname is “tonga” login to the Pi2 like so:

ssh your_login_name@tonga.local

III.  install remote desktop server on the pi

                      • sudo apt-get install tightvncserver
                        • start the server
                          vncserver
                          provide passwd (there is a limit of 8 characters I believe)
                          answer “no” to view only passwd

IV.  How to start vncserver automatically – two parts

Part 1.    login your user

cd $HOME
cd .config
mkdir autostart
cd autostart
nano (vi) vncserver.desktop
enter the following
[Desktop Entry]
Type=Application
Exec=vncserver  :1
Hidden=false
X-MATE-Autostart-enabled=true
Name[en_US]=tightvnc
Name=tightvnc
Comment[en_US]=allows remote login
Comment=allows remote login

Part 2. login as super user from your login:

sudo -s (become root administrator)
cd /etc/init.d
vi vncboot (it will create if not there – it should not be present)
in this file insert the following lines changing VNCUSER to your
user name:

#!/bin/sh
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO
VNCUSER=’your_user_name_here’
eval cd ~$VNCUSER
case “$1” in
start)
su $VNCUSER -c ‘/usr/bin/tightvncserver :1’
echo “Starting TightVNC server for $VNCUSER ”
;;
stop)
pkill Xtightvnc
echo “Tightvncserver stopped”
;;
*)
echo “Usage: /etc/init.d/tightvncserver {start|stop}”
exit 1
;;
esac
exit 0

make this file, “vncboot”, executable

chmod 755 /etc/init.d/vncboot

now you need to create links into the /etc/rc#.d directories

update-rc.d vncboot defaults

this will create files in /etc/rc1.d that link back to
/etc/init.d/vncboot i.e., in the directory /etc/rc1.d you will find
the following links:

S01vncboot -> ../init.d/vncboot

reboot your pi and from another computer login to the pi’s remote desktop as
the user you defined.

FYI:
to kill an instance of tightvnc do the following:

vncserver -kill :4

this will kill the vnc pid for a particular login found in $HOME/.vnc

Leave A Reply

Your email address will not be published. Required fields are marked *


*

Bad Behavior has blocked 375 access attempts in the last 7 days.