# Install\_snap - installing a snap package through a Mender Artifact

**URL:** <https://hub.mender.io/t/install-snap-installing-a-snap-package-through-a-mender-artifact/6051>\
**Category:** Update Modules\
**Created:** [July 31, 2023, 2:39pm UTC](https://hub.mender.io/t/install-snap-installing-a-snap-package-through-a-mender-artifact/6051 "2023-07-31T14:39:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [July 31, 2023, 2:39pm UTC](https://hub.mender.io/t/install-snap-installing-a-snap-package-through-a-mender-artifact/6051/1 "2023-07-31T14:39:40Z")

</div>

## Description

The install\_snap Update Module is able install packages to the device running Mender using the snap tooling.

Example use-cases:

- managing devices running the [snap](https://snapcraft.io/) app store, specifically [Ubuntu](https://ubuntu.com/)

## Specification

| Specification | |
| --- | --- |
| Module name | install\_snap |
| Supports rollback | no |
| Requires reboot | no |
| Artifact generation .script | yes |
| Full operating system updater | no |
| Source code | [GitHub](https://github.com/mendersoftware/mender-update-modules/tree/master/install_snap) |
| Maintainer | [josef.holzmayr@northern.tech](mailto:josef.holzmayr@northern.tech) |

**Please be aware that Mender Update modules are meant to update parts of the operating system and if not configured properly they could potentially delete parts or even the full operating system. Always inspect the code carefully and only test modules on device that you can recover easily.**

**It is not recommended to install a Mender Artifact on your workstation**

## Prepare the device

This section describes how to setup your target device, i.e. the device to be updated. This will also be referred to as the device environment.

All commands outlined in this section should be run in the device environment.

### Prerequisites

This update module has the following prerequisites for the device environment:

- [Install the Mender client](https://docs.mender.io/client-installation/install-with-debian-package?target=_blank), version 2.0 or later
- Install the `snap` command line tool: `sudo apt install snapd`

### Install the Update Module

Download the latest version of this Update Module by running:

```bash
mkdir -p /usr/share/mender/modules/v3 && wget -P /usr/share/mender/modules/v3 https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/install_snap/module/install_snap && chmod +x /usr/share/mender/modules/v3/install_snap

```

## Prepare the development environment on your workstation

This section describes how to set up your development environment on your workstation.

All commands outlined in this section should be run in the development environment.

### Prerequisites

This Update Modules has the following prerequisites for the development environment:

- [Install mender-artifact](https://docs.mender.io/artifacts/modifying-a-mender-artifact#compiling-mender-artifact), version 3.0.0 or later

- Install the `snap` command line tool: `sudo apt install snapd`

### Create Mender Artifacts

To download `install_snap-artifact-gen`, run the following:

```auto

wget https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/install_snap/module-artifact-gen/install_snap-artifact-gen && chmod +x install_snap-artifact-gen

```

Generate Mender Artifacts using the following command:

```auto
ARTIFACT_NAME="my-update-1.0"
DEVICE_TYPE="my-device-type"
./install_snap-artifact-gen \
--artifact-name ${ARTIFACT_NAME} \
--device-type ${DEVICE_TYPE} \
<name of snap> ...

```

An example to create an artifact installing the `hello-world` snap package on a `raspberrypi4` machine could be:

```auto
ARTIFACT_NAME="hello-world-1.0"
DEVICE_TYPE="raspberrpi4"
./install_snap-artifact-gen \
--artifact-name ${ARTIFACT_NAME} \
--device-type ${DEVICE_TYPE} \
hello-world

```

You can either deploy this Artifact in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client only in [Standalone deployments](https://docs.mender.io/artifact-creation/standalone-deployment?target=_blank).

### Artifact technical details

This is a use case of an artifact exclusively using meta data as its payload. Find more on the concept in [this article](https://hub.mender.io/t/using-metadata-in-a-mender-artifact/5983).
