Getting Started With Snappy Ubuntu Core

In our previous article, we discussed what is Snappy Ubuntu Core, and how to install it. If still haven’t read that guide and don’t know what is Snappy Ubuntu Core, read the following article.

Today, In this tutorial, let us see how to getting started with Snappy Ubuntu Core.

Snappy Ubuntu Core Usage

Log in to your Snappy Ubuntu Core system. The default username and password is ubuntu/ubuntu.

Or you can SSH from a remote system with command:

ssh ubuntu@<IP-address-of-snappy>

1. Check Snappy Ubuntu Core version

Let us check Snappy Core version first.

To do that, run:

snappy info

Sample output:

release: ubuntu-core/15.04/stable
architecture: amd64
frameworks: 
apps: webdm

Well, as you see in the above output, the version of Snappy Ubuntu Core is 15.04 stable, and its arch is 64bit. Since it is a fresh system, it has no frameworks and only one app called “webdm”.

2. Viewing Installed applications

To list all installed apps with version, run:

snappy list -v

Sample output:

Name          Date       Version Developer 
ubuntu-core   2015-04-23 2       ubuntu*   
webdm         2015-04-23 0.5     sideload* 
generic-amd64 2015-04-23 1.1     *

The asterisk (*) tells you that this version of the component is what is currently running. If you do an update, you will get the newer version of the system to be active when you reboot.

Let us see see if there is an updated system. The update‐versions command will check the store for newer versions of any installed components. If you are fully up to date, you will see the same versions listed which are currently installed.

To check if there is an updated system, run:

snappy list -uv

Sample output:

Name           Date       Version 
ubuntu-core    2015-04-23 2       
webdm*         1-01-01    0.8     
generic-amd64* 1-01-01    1.1.1

As you above, we had two updates. The updated versions are marked with active flag(*).

Let us go ahead and update them using command:

sudo snappy update

Sample output:

Installing webdm (0.8)
Starting download of webdm
6.16 MB / 6.16 MB [======================================] 100.00 % 246.20 KB/s 
Done
Installing generic-amd64 (1.1.1)
Starting download of generic-amd64
40.93 KB / 40.93 KB [=====================================] 100.00 % 81.89 KB/s 
Done
Name          Date    Version Developer 
webdm         1-01-01 0.8     canonical 
generic-amd64 1-01-01 1.1.1   canonical

Again, run  the following command to check if there is any updates.

snappy list -uv

Sample output:

Name          Date       Version 
ubuntu-core   2015-04-23 2       
webdm         2015-06-03 0.8     
webdm         2015-04-23 0.5     
generic-amd64 2015-06-03 1.1.1

See, the webdm and generic-amd64 have been updated to the latest available version.

If you update the Ubuntu Core, you must restart to apply the changes. To reboot Snappy Ubuntu Core, Run:

sudo reboot

3. Roll back applications or frameworks

Also, we can roll back to the previous version if needed. This is the useful feature of Snappy. To roll back any application, for example generic-amd64, run:

sudo snappy rollback generic-amd64

Sample output:

Setting generic-amd64 to version 1.1

To verify the changes, run:

snappy list -v

Sample output:

Name          Date       Version Developer 
ubuntu-core   2015-04-23 2       ubuntu*   
webdm         2015-06-03 0.8     *         
webdm         2015-04-23 0.5     sideload* 
generic-amd64 2015-04-23 1.1     *         
generic-amd64 2015-06-03 1.1.1

As you see above, the generic-amd64 package shows two versions here, 1.1 and 1.1.1. The asterik (*) beside 1.1.1 shows that this is the one that is actively used.

4. Installing applications and frameworks

Well, now we will see how to install new applications and frameworks.

snappy frameworks are somewhat different from the Ubuntu for Phones click frameworks and are more flexible. Most importantly, click frameworks for Ubuntu for Phones map to a particular release and are contracts between the platform (OS) and apps. Snappy splits out the platform (OS) and the framework such that the contract is split between the framework and the platform release (OS) (the release and installed frameworks can be seen via snappy info). As such, apps will specify the release they target (implementation covered elsewhere) and any frameworks they require.

To search all available applications, run:

snappy search

Sample output:

Name                     Version            Summary                          
beagle.gumstix           0.1                beagle                           
duovero.gumstix          0.1                duovero                          
xkcd-webserver           0.5                xkcd-webserver                   
system-status.victor     1.0.3              System status web portal         
overo.gumstix            0.1                overo                            
mosquitto.kartben        1.4.2.201505120017 Mosquitto                        
webcam-demo              1.0.1              webcam-demo                      
pi2.lool                 0.11               pi2                              
snake.mectors            0.0.5              Snake                            
pepper.gumstix           0.1                pepper                           
panda.gumstix            0.1                panda                            
hello-dbus-fwk.canonical 1.0.0              hello-dbus-fwk                   
docker                   1.6.1.002          Docker                           
generic-amd64            1.1.1              generic-amd64                    
hello-world              1.0.15             hello-world (forks not shown: 1) 
chatroom.ogra            0.1-8              Snappy Chatroom                  
computexintel.mectors    0.0.3              Computex Intel                   
crossbar.crossbar        0.10.4             Crossbar.io                      
webdm                    0.8                webdm                            
beagleblack              1.7.1              beagleblack                      
go-example-webserver     1.0.7              go-example-webserver             
config-example           1.0.6              config-example                   
pastebinit.mvo           1.4.0.0.2          pastebinit                       
Use --show-all to see all available forks.

You can search for a particular apps or frameworks as shown below.

snappy search webserver

Sample output:

Name                 Version Summary                  
go-example-webserver 1.0.7   go-example-webserver     
xkcd-webserver       0.5     xkcd-webserver           
system-status.victor 1.0.3   System status web portal

Let me show you how to install a package.

To install an application, for example docker, run:

sudo snappy install docker

Sample output:

Installing docker
Starting download of docker
8.36 MB / 8.36 MB [=======================================] 100.00 % 99.96 KB/s 
Done
Name          Date       Version   Developer 
ubuntu-core   2015-04-23 2         ubuntu    
docker        2015-06-03 1.6.1.002           
webdm         2015-06-03 0.8                 
webdm         2015-04-23 0.5       sideload  
generic-amd64 2015-06-03 1.1.1

Remember there is no ‘apt-get’ or ‘aptitude’ or ‘dpkg’ commands in Snappy Core. If you try to install, remove or update any package using apt-get method, you will get the following error.

Ubuntu Core does not use apt-get, see 'snappy --help'!

Now, let us check if the docker application has installed or not. To do that, run:

snappy list

Sample output:

Name          Date       Version   Developer 
ubuntu-core   2015-04-23 2         ubuntu    
docker        2015-06-03 1.6.1.002           
webdm         2015-06-03 0.8                 
webdm         2015-04-23 0.5       sideload  
generic-amd64 2015-06-03 1.1.1

As you see in the above output, Docker has been installed.

5. Removing applications and frameworks

Similarly, you can install as many as applications you want. To remove an installed application, for example docker, run:

sudo snappy remove docker

Sample output:

Removing docker
Waiting for docker_docker-daemon_1.6.1.002.service to stop.

Check if docker is really removed or not using command:

snappy list

Sample output:

Name          Date       Version Developer 
ubuntu-core   2015-04-23 2       ubuntu    
webdm         2015-06-03 0.8               
webdm         2015-04-23 0.5     sideload  
generic-amd64 2015-06-03 1.1.1

See, Docker is no more now in Snappy core.

To completely remove all the data from the listed packages, run:

sudo snappy purge docker

To view more details about Snappy commands, run:

snappy --help

Sample output:

Usage:
  snappy [OPTIONS] <command>

Help Options:
  -h, --help  Show this help message

Available commands:
  booted              Flag that rootfs booted successfully
  build               Builds a snap package (aliases: bu)
  config              Set configuraion for a installed package.
  firstboot           internal
  hw-assign           Assign a hardware device to a package
  hw-info             List assigned hardware device for a package
  hw-unassign         Unassign a hardware device to a package
  info                Display a summary of key attributes of the snappy system.
  install             Install a snap package
  internal-run-hooks  internal
  internal-unpack     internal
  list                List active components installed on a snappy system (aliases: li)
  login               Log into the store
  purge               Remove all the data from the listed packages
  remove              Remove a snapp part
  rollback            Rollback to a previous version of a package
  search              Search for packages to install (aliases: se)
  set                 Set properties of system or package
  update              Update all installed parts
  versions            (deprecated) please use "list"

There is no man pages for Snappy commands right now. I hope Snappy developers is working on it.

Also, there is more online guides are available in Snappy official documentation page. Go and refer them if you need to learn more about Snappy.

Once you have finished, power off the Snappy Core using command:

sudo poweroff

Conclusion

Working with Snappy Ubuntu Core is pretty easy. Be you’re a normal user, developer or a system administrator, you don’t have worry about the Snappy commands. All Snappy commands are really easy to remember and use. Snappy provides a new approach to package management, improved security, simplifying tasks. The installation is really fast. And everything is available as a single package, so there is no dependencies errors or broken system. Let us welcome this new baby from Canonical and appreciate the developers efforts to make it possible.

Cheers!