# Upgrade mender client

**URL:** <https://hub.mender.io/t/upgrade-mender-client/6728>\
**Category:** General Discussions\
**Tags:** mender-client\
**Created:** [April 11, 2024, 12:13pm UTC](https://hub.mender.io/t/upgrade-mender-client/6728 "2024-04-11T12:13:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zivkapl](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/zivkapl/32/2061_2.png) [@zivkapl](https://hub.mender.io/u/zivkapl)\
**Post date:** [April 11, 2024, 12:13pm UTC](https://hub.mender.io/t/upgrade-mender-client/6728/1 "2024-04-11T12:13:17Z")

</div>

Hi,  
Is it possible to upgrade the mender-client itself using mender?

Let’s say I an a VM with a single connection to a mender server. Can I create an artifact to upgrade the Mender client?  
I assume OS artifact can handle that, however is it possible with a lighter artifact on non-partitioned disks?

Thank you!

---

<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:** [April 12, 2024, 7:57am UTC](https://hub.mender.io/t/upgrade-mender-client/6728/2 "2024-04-12T07:57:20Z")

</div>

@zivkapl it absolutely is. In the simplest case you can just use a [`single-file`](https://github.com/mendersoftware/mender/blob/master/support/modules/single-file) artifact. If there is a config format change or other migration requirement, you might either use state scripts or go for a custom update module. So it’s definitely possible.

Greets,  
Josef

---

<div class="post-metadata">

**Author:** ![zivkapl](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/zivkapl/32/2061_2.png) [@zivkapl](https://hub.mender.io/u/zivkapl)\
**Post date:** [July 4, 2024, 11:40am UTC](https://hub.mender.io/t/upgrade-mender-client/6728/3 "2024-07-04T11:40:49Z")

</div>

Hi @TheYoctoJester thanks  
I tried to change the service file for mender (to inject some HOSTALIASES env var to it to resolve to the server) and it requires a restart of the mender client which fails the upgrade.  
Is it possible to restart the mender client using the mender upgrade?

---

<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 4, 2024, 11:49am UTC](https://hub.mender.io/t/upgrade-mender-client/6728/4 "2024-07-04T11:49:53Z")

</div>

Hi @zivkapl,

Yeah, would have guessed that restarting through a state script while the update is in progress will have such an effect.

At least out of the box, I don’t there is a mechanism for that. Some ideas:

- rebooting, that will obviously restart the client. It is quite easy to craft an Update Module that is essentially `single-file`, but with a successive reboot.
- using some scripting/trickery to delay the Mender Client restart until _after_ the artifact installation.
- extending the Client to support such a feature. PRs welcome, alternatively you can get in touch with us for feature development.

Greets,  
Josef
