2015-12-31

Got my chip a few days ago. I think I'll document what I've done with it for anybody who needs help. I am a Linux user with moderate knowledge of command line wizardry, so this guide should be helpful to people who are getting a feel for *nix based operating systems.

Disclaimer: Whenever I say "A computer" I mean a computer with a modern unix based operating system. My laptop is a thinkpad running Xubuntu. You should be able to do everything I did on a mac, but with windows you will have to use Cgwin or putty and I can't make any grantees.

Out of the box

My CHIP arrives at my parents house during Christmas break. Just in time for me to take it back home to my apartment. I grab a micro-usb power cable and take it with me. It comes with a cool headphone jack RCA cable and has an OS preloaded, so all I have to do is plug it into my roommate's TV. It works right away and soon I'm looking at a cool logo.

The chip needs a micro USB power cable and not much else. If you own a cell phone, you probably have one laying around.

First problem

Of course I need a way to control this computer. I plug my USB mouse in and... it dies. The CHIP shuts down. Apparently plugging things into the USB can do that. Fortunately unplugging and re-plugging the power cable brings it back to life. I'll just have to remember to plug the power cable in last.

This is an issue for the developers to fix, but for now I'd advise any other users to plug the cable in last.

Of mice and manual input

This is where I slap myself. I don't have any spare keyboards. I had a wireless keyboard at my parents house for controlling the Raspberry Pi, and I could have grabbed it when I got my USB cable, but I forgot. Right now I'll have to make do with no keyboard input.

I'd suggest the developers include some sort of onscreen keyboard pre-installed. You can install one yourself, but that can be difficult if you don't already have keyboard input. I can work around this, but I'd sugest any CHIP owner have a spare Bluetooth keyboard. The ones designed for the Rasbery Pi should work perfect with this. Particularly the ones with built in trackpads.

By my bootstraps

I can connect to wifi using my mouse, but only to networks that don't require passwords. Fortunately my guest network has no password. Unfortunately my guest network has network isolation so I can't SSH. For those who don't know, SSH stands for secure shell, and it lets you gain remote command line access to another computer over a network. I use it to connect to the Rasbery Pi at my parents house, and it's very powerful, you can do anything you could do sitting in front of the computer via SSH. I'd be able to install an onscreen keyboard and do other terminal things, but Unfortunately I can't connect yet.

I order a Bluetooth keyboard off of amazon with the last of my Xmass giftcard balance, but even next day shipping isn't fast enough for me right now. (and not everyone can afford to do that) so I'm going to have to find another way.

Where there's a shell there's a way

I can't keyboard and I can't SSH, but fortunately there is another way to access a shell. The micro USB-power cable can be plugged into a computer and not only will it supply power, it will also allow you to access the CHIP via a terminal.

Pluging the CHIP into the computer will light up the CHIP's LEDs, but does not generate any particular messages for the user. That does not mean things aren't happening though.

Open up a terminal emulator and type

You should get an output like this

dmesg is a command that prints the kernal ring buffer. Among other things, this is a log of things that were plugged into the computer. Because this log would be too long to be useful, we use the | to redirect or pipe it's output to another command called tail. This shows us just the last few lines, there is another command called head that does the opposite, but that's less useful.

Most of those messages (all but the first really) are talking about the CHIP I just plugged in. But the important information is on the third to last line.

Particularly, I'm looking for ttyACM0 that tells us where I can access the CHIP from my computer. Specificly, it's located in /dev/ttyACM0 I could go there in my file manager if I wanted to, and if you don't believe me you can see for yourself. In order to access the CHIP, now all we have to do is use the following command. screen /dev/ttyACM0 Screen is a useful program which I could spend a lot of time describing, but in this case it allows us to access the CHIP's shell as if it were part of our regular computer. You should be prompted for a username and password. The login is root and the password is chip. You won't see anything when you type the password, but trust me, it's going through, just type it and press enter when you are done. If everything goes well, you should see something like the following.

For security reasons It's a good idea to disable root login and change the default password, but we'll do that latter. Logging in as root is very dangerous, you can have access to everything. If you don't know what you are doing, you can break something, and if a hacker gets access to root, they can do whatever they want.

At this point you'll probably feel an urge to put on fingerless gloves and mutter "i'm in", but we have work to do here. First order of business is to connect to the internet. Type nmtui to open up network manager's curses based interface.

Pretty nifty eh? You can move your cursor around with the arrow keys and select with the enter key. Chose Activate a connection and then select your network from the list. You will then be prompted to enter the password. Exit out of nmtui and open it back up again, this time selecting edit a connection. You'll see lots of scary options, but the important ones are at the bottom. Scroll down the whole way using the arrow buttons.

the important options are the ones that say [X] Automatically connect and [X] Available to all users Make sure both are connected and you are done. The CHIP will automatically connect to the proper network and the password will be saved.

Installing software

Sudo apt-get Probably one one of the most useful commands you will use.
sudo is how you ask please in *nix. Right now you are logged in as root so it's not really necessary, but you should get into the habit now. Many commands require elevated permission.With sudo you will be prompted for your password (once again, the characters in your password will not be displayed as you type them) and if you have the proper authorization, you will be allowed to execute the command.
apt-get is a package manager used by many distributions of Linux, particularly Debian based ones such as Ubuntu or Rasbian. IDK what the CHIP's distro is called, but it appears to be based off of Rasbian and thus uses apt-get. apt-get install something is basically telling apt-get to install something (assuming there was a packaged named "something" for it to install, replace that with whatever you want to install.)
apt-get update is telling apt-get to check it's repositories for a list of available software packages.

Before we install anything, we need to use sudo apt-get update this will take a while so be patent. Once it's done, install SSH with sudo apt-get install ssh
once again this takes a while, sometimes it will ask you if you want to install extra packages that are required as dependencies. Always answer yes.

Once SSH is installed, we can leave, but if you want, you can install other things. Try installing and running a program called cmatrix to see what it does. If you ever want to un-install something, use sudo apt-get purge something it's also a good idea to run sudo apt-get autoremove from time to time as it removes un-needed dependencies that would otherwise clog your system. Remember you only have 4 gigs of storage space so use it wisely.

Ghost in the shell

Now that you have SSH running, you can close the terminal, disconnect the chip, and hook it back up to wherever it was before. You will be able to connect to it through wifi now. Some routers handle things diffrently, but you should be able to log in with ssh root@chip' or 'ssh root @chip.local

If neither of those work, go into your router and find the IP address. You can usually connect to it by opening a web browser and typing 192.168.1.1 you will be prompted for a password, but you can usually find the default written on the back of the router, or if the people who made it are idiots, the default login will be admin and password. Fun fact, this trick can often be used to hack into public wifi-hotspots. Use this power responsibly. What you will find inside depends on the router manufacturer, but usualy there is a place listing all the devices attached. On this list next to your computers and smartphones, you will find an entry labeled chip along with it's local IP address. Once you have that you can connect to it via ssh root@xxx.xxx.x.x If this doesn't work, your router is probably specifically preventing ssh connections or something shady like that. Complain to your ISP.

Once you have found the proper way to connect, ssh will ask you the following question

This sounds scary, but SSH is just making sure nobody is trying to trick you. Answer yes. If somebody tries to trick you with a computer that has the same name and ip address as yours, ssh will warn you because it will check to make sure the keys are the same.

Once that's taken care of, you will be prompted for a password. Unless you changed it, it will still be chip but you're smart so you'll change it to something less obvious won't you.

Now that you are connected via SSH, you can access it remotely and do anything you could do with a keyboard locally. Your chip dosn't even need a screen anymore, just a source of electricity. It would be nice if SSH came pre-installed so you could start doing this out of the box, but that's an issue for the developers. SSH is also a better interface in general compared to using the USB cable. your terminal will now be able to scroll up and down, and display colored text.

If you want the power to access your chip from anywhere in the world, go back into your router and set up port forwarding. Again this is diffrent depending on your router, but there should be an option to set any incoming traffic to be redirected to the chip's ip address using port 22. This however can be dangerous if you don't know what you are doing. Your chip will be exposed to the internet, and random botnets will start trying to connect to it. I'd recommend disabling the root login, changing the password to something other than chip, and setting up fail2ban. I'll show you how to do that latter on.

Show more