# Reboot remotely

**URL:** <https://hub.mender.io/t/reboot-remotely/2247>\
**Category:** Update Modules\
**Created:** [July 28, 2020, 1:22pm UTC](https://hub.mender.io/t/reboot-remotely/2247 "2020-07-28T13:22:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [July 28, 2020, 1:22pm UTC](https://hub.mender.io/t/reboot-remotely/2247/1 "2020-07-28T13:22:35Z")

</div>

### Description

The reboot update module provides an ability to reboot the devices remotely.

Example use-cases:

- any time you need a reboot for any reason.

### Specification

| Specification | |
| --- | --- |
| Module name | reboot |
| Supports rollback | no |
| Requires reboot | yes |
| Artifact generation script | yes |
| Full operating system updater | no |
| Source code | [Update Module](https://github.com/mendersoftware/mender-update-modules/blob/master/reboot/module/reboot), [Artifact Generator](https://github.com/mendersoftware/mender-update-modules/blob/master/reboot/reboot-gen) |
| 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

### Install the Update Module

Download the latest version of this Update Module by running:

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

```

## 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 Module 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

For convenience, an Artifact generator tool `reboot-gen` is provided with the Update Module.  
Download `reboot-gen` , by running the following command:

```bash
wget https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/reboot/reboot-gen

```

Make it executable:

```bash
chmod +x reboot-gen

```

Generate Mender Artifacts using the following command:

```auto
ARTIFACT_NAME="my-update-1.0"
DEVICE_TYPE="my-device-type"
./reboot-gen --artifact-name ${ARTIFACT_NAME} \
                      --device-type ${DEVICE_TYPE}

```

---

<div class="post-metadata">

**Author:** ![nishad1092](https://avatars.discourse-cdn.com/v4/letter/n/5fc32e/32.png) [@nishad1092](https://hub.mender.io/u/nishad1092)\
**Post date:** [August 3, 2020, 12:43pm UTC](https://hub.mender.io/t/reboot-remotely/2247/2 "2020-08-03T12:43:46Z")

</div>

Wow @peter, This is a fantastic update. Been waiting for it.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [August 3, 2020, 12:54pm UTC](https://hub.mender.io/t/reboot-remotely/2247/3 "2020-08-03T12:54:49Z")

</div>

I am very happy you like it!

peter

---

<div class="post-metadata">

**Author:** ![genedupre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/genedupre/32/289_2.png) [@genedupre](https://hub.mender.io/u/genedupre)\
**Post date:** [August 4, 2020, 9:02am UTC](https://hub.mender.io/t/reboot-remotely/2247/4 "2020-08-04T09:02:09Z")

</div>

Hello @peter  
this looks really cool! i wanted to try it out now, but it seems its not available at the moment?

```
/mender-reboot-module$ mkdir -p /usr/share/mender/modules/v3 && wget -N -P /usr/share/mender/modules/v3 https://raw.githubusercontent.com/mendersoftware/mender-update-modules/blob/master/reboot/module/reboot
--2020-08-04 11:00:07-- https://raw.githubusercontent.com/mendersoftware/mender-update-modules/blob/master/reboot/module/reboot
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.12.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.12.133|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-08-04 11:00:07 ERROR 404: Not Found.
```

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [August 4, 2020, 9:23am UTC](https://hub.mender.io/t/reboot-remotely/2247/5 "2020-08-04T09:23:12Z")

</div>

> [@genedupre](#):
>
> Hello @peter  
> this looks really cool! i wanted to try it out now, but it seems its not available at the moment?

Hello @genedupre!

Thanks for giving it a try!  
I am sorry, bad link, this is the correct link:

[https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/reboot/module/reboot](https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/reboot/module/reboot)

I will update the original post.

peter

---

<div class="post-metadata">

**Author:** ![genedupre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/genedupre/32/289_2.png) [@genedupre](https://hub.mender.io/u/genedupre)\
**Post date:** [August 5, 2020, 1:28pm UTC](https://hub.mender.io/t/reboot-remotely/2247/6 "2020-08-05T13:28:03Z")

</div>

Hi @peter!

thanks for the module, it works as intended.  
i do have a question.  
i intend on using this module, for my colleges that are more on the support side, so they can use this when needed. However after testing this with my support colleges i encountered this

 ![reboot-script-mender](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/1X/99fddb57fe7a0ecb3a426c947ba3304a03fe0acf.png)  
because the artifact name (probably some md5 hash) is the same as the “current software” it wont be installed/ runned again.  
do you have an idea/ suggestion on how to get around this?  
creating a “new artifact with a new date” wont be an solution.  
since this is more intended as a low level solution for people unfamiliar with code in general  
Greets Gene

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [August 6, 2020, 5:09pm UTC](https://hub.mender.io/t/reboot-remotely/2247/7 "2020-08-06T17:09:45Z")

</div>

I am happy that it works.  
@genedupre so what you are trying to tell me is that re-creating/editing an artifact is not an option at all?

peter

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [August 6, 2020, 5:12pm UTC](https://hub.mender.io/t/reboot-remotely/2247/8 "2020-08-06T17:12:44Z")

</div>

> [@genedupre](#):
>
> do you have an idea/ suggestion on how to get around this?

I would suggest to just have two artifacts, `reboot1` and `reboot2`. This way you can alternate them if you need to reboot multiple times.

This functionality is not “core” functionality of Mender so it is a bit clunky

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [August 6, 2020, 5:13pm UTC](https://hub.mender.io/t/reboot-remotely/2247/9 "2020-08-06T17:13:09Z")

</div>

Hey Gene,

one solution that comes to mind (it is a workaround) is: to have two artifacts with different names: e.g.: “reboot” and “reboot-back”, and deploy them in turns. That is: when “reboot” is installed deploy “reboot-back”, and vice-versa.

peter

---

<div class="post-metadata">

**Author:** ![genedupre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/genedupre/32/289_2.png) [@genedupre](https://hub.mender.io/u/genedupre)\
**Post date:** [August 7, 2020, 8:09am UTC](https://hub.mender.io/t/reboot-remotely/2247/10 "2020-08-07T08:09:59Z")

</div>

@mirzak @peter  
thanks, yes this looks like a nice workaround  
Gene

---

<div class="post-metadata">

**Author:** ![dducrest](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dducrest/32/1499_2.png) [@dducrest](https://hub.mender.io/u/dducrest)\
**Post date:** [April 21, 2022, 8:27pm UTC](https://hub.mender.io/t/reboot-remotely/2247/11 "2022-04-21T20:27:24Z")

</div>

I’m noticing that my devices aren’t rebooting when a deployment is released & installed. Am I supposed to combine directory update artifacts with this reboot module?

Thanks

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [July 20, 2022, 2:50pm UTC](https://hub.mender.io/t/reboot-remotely/2247/12 "2022-07-20T14:50:31Z")

</div>

hello @dducrest

sorry for the delay. could I have the listing of your `/usr/share/mender/modules/v3` directory?

peter

---

<div class="post-metadata">

**Author:** ![nowls](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nowls](https://hub.mender.io/u/nowls)\
**Post date:** [February 14, 2025, 7:12pm UTC](https://hub.mender.io/t/reboot-remotely/2247/14 "2025-02-14T19:12:41Z")

</div>

@peter In order to distribute the [reboot](https://github.com/mendersoftware/mender-update-modules/blob/master/reboot/module/reboot) script to devices, it seems that the options are:

1. Install it at image building time (Yocto, etc.)
2. Deploy it using the [single-file](https://github.com/mendersoftware/mender/blob/master/support/modules/single-file) module to drop the file in `/usr/share/mender/modules/v3` directory
3. Use SSH or some out-of-band method

Am I thinking about this the right way? It seems like option 2 could be part of the documentation as a suggestion for distributing to fielded devices.

---

<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:** [February 17, 2025, 1:59pm UTC](https://hub.mender.io/t/reboot-remotely/2247/15 "2025-02-17T13:59:56Z")

</div>

Hi @nowls,

We even have a tutorial on 2., because it applies to all kinds of Update Modules: [How to install a new Update Module](https://hub.mender.io/t/how-to-install-a-new-update-module/6630)

Greetz,  
Josef
