CI20 Headless Setup

From eLinux.org
Jump to: navigation, search

This page describes how to set up your CI20 board for headless operation. This is useful if you don't have an HDMI screen available or don't wish to use one.

Setting up SSH using ethernet and keyboard

New Debian 7 NAND image

SSH is already setup in the newer Debian7 NAND image. If you have access to an sd card reader/writer, please flash the new image on the NAND.

http://elinux.org/CI20_Distros#Debian_7_beta_image

If you have flashed the new image, all you will need is to figure out what IP address your dhcp server (home router e.g.) assigned to the ci20. Then you can access the ci20 using any command line ssh client. e.g.

ssh ci20@IPAddress

Default Factory Debian 7

If you have a keyboard and ethernet plugged in but no HDMI screen, the ethernet will be connected automatically using DHCP. It is then possible to blindly install the SSH server using the keyboard.

  1. Give the CI20 plenty of time to boot. (1-2 minutes)
  2. Press Ctrl+Alt+F1 to open TTY 1
  3. Type
    root
    and press enter
  4. Type
    ci20
    and press enter
  5. Type
    apt-get install ssh
    and press enter
  6. Give it a moment and press enter a few times

If all went well you should be able to connect to the CI20 with SSH.

If you're lucky your router will have detected the CI20's hostname and added it to its DNS server as something like ci20 or ci20.lan. Otherwise you may have to log in to your router's control panel to find the IP address which was allocated for it.

Setting up SSH using serial and WiFi/ethernet

It is possible to set up SSH using only serial, and WiFi or ethernet, which may be necessary if you don't have ethernet or a USB keyboard handy.

Getting connected to the serial

The CI20's serial interface uses a baud rate of 115200. The easiest approach to connecting to the serial interface is to purchase a USB to TTL UART adapter. Something like this would probably do (but don't connect the red VCC wire).

See RPi Serial Connection#Connection to a PC for help setting up the serial console.

Which pins to use to connect to the serial interface differs between kernel versions - as is discussed below. For both cases, keep the following in mind:

  • Connect the Ground of the serial cable to the ground on the CI20.
  • Connect the serial cable Tx to the CI20 Rx.
  • Connect the serial cable Rx to the CI20 Tx.

See here for more info on why Tx/Rx are swapped when connecting boards.

Linux kernel 3.0.8

The default NAND's UART0 signals are accessible from the main expansion header near the camera connector. Note that this header is compatible with the Raspberry Pi's expansion header, so much of the RPi Serial Connection article applies to the CI20.

The CI20 Ground, TXD and RXD wires are pins 6, 8 & 10 of the header. These are the 3rd, 4th and 5th pins on the row nearest the edge of the board:

+------------------------ +
| 2 4 [6   8   10] 12 ... |
| 1 3  5   7    9  11 ... |
| ^                       |

Linux kernel 3.18+

The CI20's UART4 signals are accessible from the dedicated UART header that is located near the HDMI port. The TXD, Ground and RXD pins are 2, 3, and 4 respectively.

+---------+
|1 [2 3 4]|
|^        |

Boot

When you plug in the CI20's power connector you will see text output on the serial console. This comes first from U-Boot, which offers you a chance to interrupt the autoboot in order to get to U-Boot's interactive prompt (from which you can load a different kernel).

If the autoboot is allowed to continue it will load and start the Linux kernel which will output its own boot log on the serial console.

Eventually Debian will present a login prompt:

Debian GNU/Linux 7 ci20 ttyS0

ci20 login:

The default username and password are both "ci20".

Setting up WiFi

One of the first things you may want to do is set up the network so that you can install an SSH server and connect to the CI20 over SSH. If you have ethernet available with DHCP you can skip this section. If you only have WiFi available then this is complicated by the fact you don't have access to the normal graphical interface.

The default Debian image has Network Manager set up, but unfortunately that version of the Network Manager command line tool (nmcli) cannot create a new WiFi connection, so you'll need to find another way.

You can scan for WiFi networks with nmcli, for example:

ci20@ci20:/etc$ nmcli dev wifi
SSID                              BSSID               MODE             FREQ        RATE       SIGNAL   SECURITY   ACTIVE  
'PlusnetWirelessXXXXXX'           XX:XX:XX:XX:XX:XX   Infrastructure   2412 MHz   54 MB/s    41       WPA WPA2   yes     

Network Manager stores system wide connection information in /etc/NetworkManager/system-connections. You'll need to become root to add one (the default password is "ci20"):

ci20@ci20:~$ su
Password:
root@ci20:/home/ci20# cd /etc/NetworkManager/system-connections/

Write a new text file for the WiFi network using your favourite text editor. For example:

root@ci20:/etc/NetworkManager/system-connections# nano PlusnetWirelessXXXXXX

If you already have a Linux machine connected to the WiFi network, the contents of the file can come directly from that machine. You will however need to delete any "mac-address=XX:XX:XX:XX:XX:XX" line to allow it to connect.

For example:

[connection]
id=PlusnetWirelessXXXXXX
uuid=68f0fd52-cbb4-4f64-bbbb-65d5c6da68d1
type=802-11-wireless

[802-11-wireless]
ssid=PlusnetWirelessXXXXXX
mode=infrastructure
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=wpa-psk
psk=<the WPA passphrase>

[ipv4]
method=auto

[ipv6]
method=auto

Save the file and change the permissions so that only root can read it:

root@ci20:/etc/NetworkManager/system-connections# chmod 0600 PlusnetWirelessXXXXXX

Now restart Network Manager:

root@ci20:/etc/NetworkManager/system-connections# /etc/init.d/network-manager restart

You can check that the connection was valid by checking that nmcli can see it:

root@ci20:/etc/NetworkManager/system-connections# nmcli con list
NAME                      UUID                                   TYPE              TIMESTAMP-REAL                    
Wired connection 2        63f0b880-1003-414a-8798-95492d5b1e77   802-3-ethernet    Mon 18 Aug 2014 00:45:11 BST      
Wired connection 1        6fec7fea-803b-4112-ac6f-e24be941cd09   802-3-ethernet    Mon 18 Aug 2014 00:45:11 BST      
PlusnetWirelessXXXXXX     68f0fd52-cbb4-4f64-bbbb-65d5c6da68d1   802-11-wireless   Mon 18 Aug 2014 00:45:16 BST      

And if your configuration is correct it should automatically connect to the WiFi network:

root@ci20:/etc/NetworkManager/system-connections# nmcli dev
DEVICE     TYPE              STATE        
wlan0      802-11-wireless   connected    
usb0       802-3-ethernet    unavailable  
eth0       802-3-ethernet    unavailable  

You may be able to see the CI20 from other devices on your network. If not you can use /sbin/ifconfig to find its IP address.

Setting up SSH

Now that you are connected to the internet you can install an SSH server. Switch to root (the default root password is "ci20"), and use apt-get:

ci20@ci20:~$ su
Password: 
root@ci20:/home/ci20# apt-get install ssh

When it completes you should be able to connect to the CI20 with SSH, using the IP address reported by ifconfig or the DNS name ci20 (if your router has picked it up).

Setting up VNC

New Debian7 NAND Image

A VNC server is already setup on the newer NAND image. If you have an sd card and a writer, please flash that image

http://elinux.org/CI20_Distros#Debian_7_beta_image

If you have flashed the new image, ssh into the ci20. And run x11vnc. This should set up the server. You can use any client like gtk vnc on Ubuntu with the ci20 ip address and port (default 5900).

Default Factory Debian7

If you want to use the graphical interface to the CI20 over the network you can use VNC. Setting it up is pretty standard.

Install tightvncserver as root:

ci20@ci20:~$ su
Password: 
root@ci20:/home/ci20# apt-get install tightvncserver

Exit back to the normal user and start the vnc server:

root@ci20:/home/ci20# exit
exit
ci20@ci20:~$ vncserver

You will require a password to access your desktops.

Password: 
Verify:   
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is ci20:1

Creating default startup script /home/ci20/.vnc/xstartup
Starting applications specified in /home/ci20/.vnc/xstartup
Log file is /home/ci20/.vnc/ci20:1.log

You can now connect to the VNC server (as e.g. ci20:1) using your favourite VNC client. You may wish to connect through an SSH tunnel for extra security.