# Root Filesystem Image v2

**URL:** <https://hub.mender.io/t/root-filesystem-image-v2/402>\
**Category:** Update Modules\
**Created:** [March 21, 2019, 12:20pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402 "2019-03-21T12:20:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [March 21, 2019, 12:20pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/1 "2019-03-21T12:20:39Z")

</div>

### Description

This module performs a full root filesystem updates on the device. The module was originally developed for testing purposes and it is published as a non-official alternative way of doing rootfs updates on devices with dual partition layout (A/B).

It supports rollback in the same way as the conventional root filesystem update: rolling back to the old partition on any unforeseen problem. See [Mender Architecture](https://docs.mender.io/overview/introduction) documentation to learn more about this design.

### Specification

| A | B |
| --- | --- |
| Module name | rootfs-image-v2 |
| Supports rollback | yes |
| Requires restart | yes |
| Artifact generation script | no |
| Full operating system updater | yes |
| Source code | [Update Module](https://github.com/mendersoftware/mender/blob/3.5.x/tests/rootfs-image-v2) |
| Maintainer | Community |

## 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), version 2.0 or later.
- Mender integration with a dual partition layout
  - Follow the official [Board Integration docs](https://docs.mender.io/overview/device-integration) or find your board on [Mender Hub - Board Integrations](https://hub.mender.io/c/board-integrations).

### Install the Update Module

Download the latest version of this Update Module by running:

```
mkdir -p /usr/share/mender/modules/v3 && wget -P /usr/share/mender/modules/v3 https://raw.githubusercontent.com/mendersoftware/mender/master/tests/rootfs-image-v2

```

## 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/downloads), version 3.1.0 or later

### Create Mender Artifacts

The Artifact can be generated using mender-artifact tool. To generate a rootfs-image-v2 Update Module Mender Artifact, you can use command:

```bash
ARTIFACT_NAME="my-update-1.0"
DEVICE_TYPE="my-device-type"
OUTPUT_PATH="my-update-1.0.mender"
IMAGE="rootfs.ext4"
mender-artifact write module-image -T rootfs-image-v2 -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -o ${OUTPUT_PATH} -f ${IMAGE}

```

- `ARTIFACT_NAME` - The name of the Mender Artifact
- `DEVICE_TYPE` - The compatible device type of this Mender Artifact
- `OUTPUT_PATH` - The path where to place the output Mender Artifact. This should always have a `.mender` suffix
- `IMAGE` - The path to the rootfs image to be packaged in the Artifact

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).

### Artifact technical details

The Mender Artifact used by this Update Module has the root filesystem image as the only payload.

The Mender Artifact contents will look like:

```bash
Mender artifact:
  Name: my-update-1.0
  Format: mender
  Version: 3
  Signature: no signature
  Compatible devices: '[my-device-type]'
  Provides group: 
  Depends on one of artifact(s): []
  Depends on one of group(s): []
  State scripts:

Updates:
    0:
    Type: rootfs-image-v2
    Provides: Nothing
    Depends: Nothing
    Metadata: Nothing
    Files:
      name: rootfs.ext4
      size: 0
      modified: 2019-04-15 11:59:24 +0200 CEST
      checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

```

---

<div class="post-metadata">

**Author:** ![ster](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ster/32/282_2.png) [@ster](https://hub.mender.io/u/ster)\
**Post date:** [July 19, 2019, 3:26pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/2 "2019-07-19T15:26:36Z")

</div>

hmm, this is confusing:

- what is the difference from using `mender-artifact write rootfs-image`?
- `mender-artifact write module-image -h` says that “_This command is not meant to be used directly, but should rather be wrapped by an update module build command_”

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [July 23, 2019, 6:51am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/3 "2019-07-23T06:51:14Z")

</div>

The former command creates a normal rootfs update, the latter creates an update meant for an update module. Since update modules are generic plugins, there is no one command that can be recommended. Instead the update module should come with its own artifact build command which uses the `module-image` command under the hood.

---

<div class="post-metadata">

**Author:** ![mEK](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mek/32/377_2.png) [@mEK](https://hub.mender.io/u/mEK)\
**Post date:** [September 30, 2019, 1:11pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/4 "2019-09-30T13:11:33Z")

</div>

Hello @lluiscampos . I followed this document to get the full system update and I came to the end. But when I run the last command, I get an answer like this:

> root@ubuntu:/home/robust2# ARTIFACT\_NAME=“full-update-1.0”  
> root@ubuntu:/home/robust2# DEVICE\_TYPE=“imx6ul-var-dart”  
> root@ubuntu:/home/robust2# OUTPUT\_PATH=“full-update-1.0.mender”  
> root@ubuntu:/home/robust2# IMAGE=“rootfs.ext4”  
> root@ubuntu:/home/robust2# ./mender-artifact write module-image -T rootfs-image-v2 -n ${ARTIFACT\_NAME} -t ${DEVICE\_TYPE} -o ${OUTPUT\_PATH} -f ${IMAGE}  
> writer: can not open data file: rootfs.ext4: open rootfs.ext4: no such file or directory

Finally I can’t generate artifact.  
What is the reason of this ? What does the image mean? How do I fix this problem?

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [September 30, 2019, 1:41pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/5 "2019-09-30T13:41:40Z")

</div>

Hello again @mEK,

This Update Module requires a full filesystem image. If you have full Mender integration in your device (namely A/B filesystems), you can generate update images for your device the same way you created the first image: using [Yocto project](https://docs.mender.io/2.1/devices/yocto-project) or [mender-convert](https://docs.mender.io/2.1/devices/debian-family) .

Then, once you have an image, you can specify the path with `IMAGE=...` for the Mender Artifact to include it.

---

<div class="post-metadata">

**Author:** ![mEK](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mek/32/377_2.png) [@mEK](https://hub.mender.io/u/mEK)\
**Post date:** [September 30, 2019, 3:12pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/6 "2019-09-30T15:12:07Z")

</div>

Thank you for your quick and clear answer. First of all, what are the steps I need to follow for full mender integration? Where do you think I should start? Is meta-mender not enough to create an A / B root file system?

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [October 1, 2019, 8:04am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/7 "2019-10-01T08:04:48Z")

</div>

But how have you installed Mender in your device?

Your logs hint that you are using an NXP imx6 based board, so maybe you have followed a Board integration tutorial here on Mender Hub? If so, you have already yocto environment ready to create new images 🙂

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [May 30, 2022, 11:22pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/9 "2022-05-30T23:22:55Z")

</div>

@lluiscampos @kacf I think there is an issue here with the current version of the U-boot utils on the Dunfell branch. Passing the variables into `fw_setenv -s -` seems to require the syntax `var=value` rather than `var value`. Interestingly the `var value` syntax seems to work directly from the command line (ie `fw_setenv foo bar`).

Of course the Grub version of these commands probably needs to be adapted to match but I’ve not looked into that.

Thoughts?  
Drew

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [May 31, 2022, 5:56am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/10 "2022-05-31T05:56:37Z")

</div>

Yes, but I believe the client already does this. Check out [this commit](https://github.com/mendersoftware/mender/commit/b2507398889da5de4d859a97cf9fd8d0daf1449c), and then this later [followup](https://github.com/mendersoftware/mender/commit/f815e316d4d0491ac7948409c1828703f9a85c96). The command line is a bit different, because `var` and `value` are parsed by the shell, not by the command, and I believe it accepts this.

Grub has always used the `=` variant.

What problem are you seeing exactly?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [May 31, 2022, 6:07am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/11 "2022-05-31T06:07:58Z")

</div>

Oh, never mind, I missed the context, this is about rootfs-image-v2. And I’ve seen [your pull request](https://github.com/mendersoftware/mender/pull/998). Then you’re right, this needs fixing. We are testing the rootfs-image-v2 module, but only using Grub, which seems to support both.

---

<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:** [December 1, 2022, 11:59am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/12 "2022-12-01T11:59:43Z")

</div>

3 posts were split to a new topic: [Root filesystem update module - extend by additional payload files](https://hub.mender.io/t/root-filesystem-update-module-extend-by-additional-payload-files/5470)

---

<div class="post-metadata">

**Author:** ![seth](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@seth](https://hub.mender.io/u/seth)\
**Post date:** [June 9, 2023, 8:57pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/13 "2023-06-09T20:57:47Z")

</div>

Is is possible to construct the artifact such that it updates the `rootfs-image.version` value? Right now, it’s setting `rootfs-image.rootfs-image-v2.version`. I’ve monkeyed around with different combinations of `--software-filesystem` and `--software-name` to no avail.

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [June 12, 2023, 7:28am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/14 "2023-06-12T07:28:43Z")

</div>

@seth It is not possible with an update module.

Let me explain,

`rootfs-image.version` is reserved for full rootfs update, with a command like `mender-artifact write rootfs-image...`. There you could specify `--software-version` and it will end up in the key `rootfs-image.version`.

However here we are using an update module, that happens to be named `rootfs-image-v2` (which is the parameter in `-T` option) which produces a the key `rootfs-image.rootfs-image-v2.version`. With update modules, `mender-artifact` tool will always append the module name.

Does this make sense to you? It is an implementation detail and we could think about changing it. Can you elaborate your use case?

---

<div class="post-metadata">

**Author:** ![seth](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@seth](https://hub.mender.io/u/seth)\
**Post date:** [June 12, 2023, 5:00pm UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/15 "2023-06-12T17:00:32Z")

</div>

Hi Luis, thank you for your response. That makes sense. Setting `--software-filesystem="" --software-name="rootfs-image"` gets close, but there’s a preceding dot (`.rootfs-image.version=...`)

The use case would just be to replace the the rootfs updating facility in Mender with an update module, as is being done in this “rootfs-image-v2” example. This could be useful if the target device does not use one of Mender’s supported bootloader scenarios. However, the difference is purely cosmetic. I don’t think there’s any downside to having `rootfs-image.custom-rootfs-update-module.version` over `rootfs-image.version`.

I’ve read elsewhere on this forum that in the C++ rewrite of the client, the rootfs updater will become similar to an update module. Would this change allow replacing it’s behavior on systems that don’t follow a supported pattern?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [June 13, 2023, 6:29am UTC](https://hub.mender.io/t/root-filesystem-image-v2/402/16 "2023-06-13T06:29:50Z")

</div>

Actually, it is possible with an Update Module, but you have to specify the Provides data manually. You can’t use the `--software-...` convenience options. This should work:

```bash
mender-artifact write module-image \
    --no-default-software-version \
    --no-default-clears-provides \
    --provides rootfs-image.version:VALUE \
    --clears-provides "rootfs-image.*"

```
