Getting started with Snappy Ubuntu Core on the Raspberry Pi 2

[UPDATE: Note that the version of Snappy described in this post is now obsolete – I have a new post describing a newer version which works better, and slightly differently.]

This post consists of a few notes which may be helpful for people trying to get started with Snappy Ubuntu Core on the new Raspberry Pi 2. First of all note that Ubuntu requires ARM7 so it won’t run on any model of Raspberry Pi prior to the Raspberry Pi 2 (model B), released February 2015.

The Ubuntu Core image can be downloaded from the Raspberry Pi downloads page, and written to uSD card in the usual way, just as you would a Raspbian image. From my Ubuntu laptop, I use a command like:

% sudo dd bs=1M if=pi-snappy.img of=/dev/mmcblk0

Be very careful to get the device name correct for of, as this command will completely trash the output device.

Once you have an image on a uSD card, you can insert it into your Pi 2 and boot it up as usual. If you have a keyboard and display hooked up you can log in on the console, but note that Ubuntu Core can be used headless from first boot via ssh. The default username and password are both ubuntu. I ssh in to my device with a command like ssh ubuntu@raspi08.home. Ubuntu Core uses the new containerised “snappy” system for managing packages, so “apt” doesn’t work. To get an idea of how snappy works, you can read through the snappy tour from Canonical, but note that much of this tour won’t actually work on the Pi 2 right now. Here’s a console session:

ubuntu@localhost:~$ snappy info
release: ubuntu-core/devel
frameworks: 
apps: 
ubuntu@localhost:~$ snappy versions
Part         Tag   Installed  Available  Fingerprint     Active  
ubuntu-core  edge  2          -          f442b1d8d6db3f  *              
This command needs root, please run with sudo
ubuntu@localhost:~$ snappy search docker
No matching packages found: docker
ubuntu@localhost:~$ 

You will note that Docker isn’t currently available for Ubuntu Core on the Pi 2, though hopefully that will change soon. However, at the time of writing you may also find that the final command bombs with a certificate error. This turns out to be due to the fact that the system time is incorrect. You can verify this by running date. You can manually set it with a command like

sudo date -s "Sat Feb  7 09:57:32 GMT 2015"

where you paste in the output from running date on a system which does have the correct time. You can also automate this by instead using a command like

sudo date -s "`ssh username@linuxserver date`"

where username and linuxserver are replaced appropriately. At the time of writing there are very few Snappy packages available, but one useful package is webdm. You can search for it with snappy search webdm and install it with

sudo snappy install webdm

Running snappy info will confirm that it has installed correctly. This runs a web based package manager on port 4200, so, for example, I can connect to this from a web browser on the local network using the URL http://raspi08.home:4200/. This allows the browsing of available frameworks and apps.

There currently isn’t any app or framework for Java, but manually downloading and installing Oracle’s JDK8 for ARM works fine, and runs code at the same speed as using the JVM which ships with Raspbian. It would be very easy to package up the JDK8 as a Snappy app or framework, but I guess that there are licensing issues, so I’ll leave that to others to sort out! You can find out more about how Snappy works by reading Canonical’s snappy guides.

I quite like the Snappy system, and running Ubuntu Core on a Pi 2 is potentially a great way to learn about Cloud computing in a very cheap, simple and safe way. However, we need a few key apps and frameworks before it will become genuinely useful. Ubuntu Core certainly isn’t about to replace Raspbian as the main OS for the Raspberry Pi 2 any time soon.

Advertisements

Published by

darrenjw

I am Professor of Stochastic Modelling within the School of Mathematics & Statistics at Newcastle University, UK. I am also a computational systems biologist.

45 thoughts on “Getting started with Snappy Ubuntu Core on the Raspberry Pi 2”

    1. Hi, I’m a long-term C language user, and I always use wiringPi library to control the GPIO of The Raspberry Pi. Recently, I burned Snappy Ubuntu Core OS image into SD card and plug it into my Raspberry Pi 2. But I find that I can not install wiringPi on the Snappy Ubuntu Core. It prompt me that make tool is not installed. Can you tell me how can I install make or gcc to Snappy Ubuntu Core? Besides, is there have anther way to control GPIO based on Snappy Ubuntu Core for Raspberry ?
      Thanks !

  1. Thanks for the details.
    I’m using the Snappy img downloaded yesterday from the link you provided. I have a keyboard and mouse connected, but when I boot up I just get a black screen with 4 raspberries at the top-left and nothing else. I can Ctrl+Alt+Delete to restart, but otherwise there’s no response. Same as described here: http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99316&p=689536
    When you booted up did you get a terminal where you could log in? What are we doing differently, do you know?
    I’d be happy to ssh in but I have no way of knowing what the hostname would be…
    Any advice is appreciated, thanks.

    1. How long did you wait? On the first boot it took an age to go from the 4 raspberries to the console login prompt (several minutes). It might be worth re-flashing the card and trying again, being sure to be patient on the first boot. I did have a wired network connection – not sure if that’s necessary.

  2. I tried again after re-flashing the card – same thing. If I touch keys every so often it doesn’t go blank (screen saver), but still just four raspberries – nothing I can do.
    However, now I’m trying to boot my Pi 2 with Raspbian and it’s not getting past the coloured screen, so maybe something else is up…

  3. I’m with Lindsay here: Nothing after the four raspberries.

    I dd-ed the Snappy .img to the uSD using OSX, and checking the card from a true Linux box, the partitions look quite OK. But no success booting the Raspi2. … Relief: My regular Raspian uSD booted nicely after switching cards and power-cycling. (phew!)

    … Re-dd-ing the Snappy .img now from above mentioned Linux box as I’m typing. I’ll let you know if that helped.

    1. No, it didn’t. I came back after about 20 minutes and I found the Raspi2 “dead”, i.e. the DVI monitor black. Pressing keys on the keyboard did nothing, although CapsLock switched the LED on and off. I couldn’t connect via ssh over ethernet: It had not requested an IP via DHCP (according to my DHCP server).

      1. Got it!

        It is somehow related to my ancient Nec Multisync LCD1970NXp (1280×1024 / 4:3) monitor that I hooked to the Raspi2 via HDMI/DVI adapter.

        What I did to solve the issue was: I mounted the system-boot partition (the one with the VFAT filesystem that can be mounted on Mac/Win/Lin), edited config.txt and uncommented the “hdmi_safe=1” line to force a safe HDMI/DVI graphic mode.

        This time, when powering up, the four raspberries were _huge_, and while I was still staring at the uSD activity LED and thinking that at least something was going on, suddenly the Ubuntu login prompt showed up in huge letters – and I could also connect to the Raspi2 via SSH.

        … I’ll experiment further. I’ll now try to copy the HDMI related lines from my Raspian over to the Ubuntu to get a nicer text console.

  4. I dd-ed the image to an SD card, and the rpi boots the GPU, showing the standard colorburst. It then shows a blank shell screen with a raspberry in the top left, and after about three quarters of a second, reboots itself and this process repeats, as far as I can tell indefinately. Does anyone have a suggestion about what to do?
    Thanks!
    P.S. I used the Rpi to burn the image, running off an OS I installed on a USB drive, and I am using the B+ model.

  5. Thank you. This information was very helpful. I ran through the Snappy commands on my new RPI-2 and all worked as advertised. I’ll be checking back for updates.

    1. Setting aside the fact for a moment that Snappy is not really an end-user Linux distribution –

      It is highly unlikely that you will be able to run Pipelight or any other kind of Wine driven Windows software on a Raspberry Pi. Wine provides a compatible environment inside a Linux (or Mac) operating system so that WinTel binary applications will run. “WinTel” means that those will be (among others) .exe or .dll files that have been compiled for a x86 or x64 CPU and for a Win32 or Win64 OS.

      Even if Wine as a piece of Open Source Software could be successfully cross-compiled for an ARM machine like the Raspi, the .exe / .dll files would still not run, as they are meant for a totally different CPU architecture.

      Seen from this perspective, Pipelight will never run on an Raspberry Pi (neither on Raspbian nor on Ubuntu, if a fully fledged desktop Ubuntu should become available at some point), as the Raspi would have to emulate the Intel compatible CPU, which it simply doesn’t have enough processing power.

      1. No, this is certainly not a joke. Pipelight as a Wine based package can be installed on various x86/x64 based Linux systems, such as Ubuntu, Arch Linux, Debian, SuSE, etc. etc.

        But you need to understand that Linux is somewhat platform-independent, so an Debian for x86 CPUs is very similar to a Debian for ARM CPU like Raspbian: More or less every piece of Debian compatible software that is available in source code can be compiled to run *either* on x86 *or* ARM.

        The problem is: Pipelight and its foundation Wine is open source software, but the actual software that you would like to run within Pipelight/Wine, i.e. Microsoft Silverlight or Adobe Flash, is not. It is available for x86 alone. To run this, your computer needs to run a x86 or x64 CPU, a/k/a Intel compatible.

        So: The Pipelight installer page omits the (somewhat obvious) fact that it can run only on a platform that supports x86/x64 binary code being run within Wine. A Raspi will never be able to run x86/x64 code.

        … Ok, Ok, this is only half true: Dosbox is a tool that emulates a whole PC with the goal to run old DOS games on a Raspi. So this actually emulates a x86 CPU. But we are talking about old DOS games, not modern Windows multimedia frameworks like Silverlight or Flash.

      2. No, this is certainly not a joke. Pipelight as a Wine based package can be installed on various x86/x64 based Linux systems, such as Ubuntu, Arch Linux, Debian, SuSE, etc. etc.

        But you need to understand that Linux is somewhat platform-independent, so an Debian for x86 CPUs is very similar to a Debian for ARM CPU like Raspbian: More or less every piece of Debian compatible software that is available in source code can be compiled to run *either* on x86 *or* ARM.

        The problem is: Pipelight and its foundation Wine is open source software, but the actual software that you would like to run within Pipelight/Wine, i.e. Microsoft Silverlight or Adobe Flash, is not. It is available for x86 alone. To run this, your computer needs to run a x86 or x64 CPU, a/k/a Intel compatible.

        So: The Pipelight installer page omits the (somewhat obvious) fact that it can run only on a platform that supports x86/x64 binary code being run within Wine. A Raspi will never be able to run x86/x64 code.

        … Ok, Ok, this is only half true: Dosbox is a tool that emulates a whole PC with the goal to run old DOS games on a Raspi. So this actually emulates a x86 CPU. But we are talking about old DOS games, not modern Windows multimedia frameworks like Silverlight or Flash.

  6. Ok, thank you very much.
    Now, I understand.
    That is very sad. I was hopefully, that I can use the Raspberry for steaming Videos like Maxdome, Netflix or other.

    Best regards.

  7. I have just started using Snappy Ubuntu and have found your information quite useful. I was able to login since I did not know the username & password. I was able to set the date & time manually, and I created the push_date.sh file using vi. Not sure how to use the sh file at this point. I was able to get the “snappy info” which turned out to be frameworks: webdm – the image that I got was from today’s https://www.raspberrypi.org/downloads/ – Snappy Ubuntu Core Snappy Ubuntu Core for Developers download.

  8. How to we get docker up and running on Snappy ?. I did install it using “snappy install docker” and see that it’s installed. But Beyond it, don’t see docker startup scripts working. Any help in with working examples of how to run a sample docker container inside snappy would be helpful.

  9. Why can’t Raspberry Pi play Vevo youtube videos, and it can’t play CBS’s website shows. It says there’s no adobe flash, but it won’t install? I tossed my media center PC to use this because so many people say it can be used the same way. It’s not working right :\

    1. On a home network you can usually use your router’s web admin tool to figure out the IP address that it has assigned to the Pi. Failing that, if you have a linux machine on your network you can run “nmap” on it to scan the network, and I’m sure there are similar tools for Windows, Mac, etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s