# How to update bootloader and erase environment

**URL:** <https://hub.mender.io/t/how-to-update-bootloader-and-erase-environment/596>\
**Category:** General Discussions\
**Created:** [May 21, 2019, 12:21pm UTC](https://hub.mender.io/t/how-to-update-bootloader-and-erase-environment/596 "2019-05-21T12:21:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://hub.mender.io/u/Yury)\
**Post date:** [May 21, 2019, 12:21pm UTC](https://hub.mender.io/t/how-to-update-bootloader-and-erase-environment/596/1 "2019-05-21T12:21:12Z")

</div>

Hello,

Could you please help to find graceful way to update bootloader and its env with mender artifact?

I am using mender Yocto meta layer to assemble artifacts. I don’t have physical access to device and I can not rewrite whole sdcard from PC, but the device connected to mender server.

Sdcard partition looks like:  
Device Boot Start End Sectors Size Id Type  
test-img.sdimg1 \* 49152 81919 32768 16M c W95 FAT32 (LBA)  
test-img.sdimg2 81920 409599 327680 160M 83 Linux  
test-img.sdimg3 409600 737279 327680 160M 83 Linux  
test-img.sdimg4 737280 999423 262144 128M 83 Linux

Uboot.bin is placed on first partition. I understand that updating bootloader is risky but is there any way by using mender artifact from the server?

---

<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:** [May 21, 2019, 2:16pm UTC](https://hub.mender.io/t/how-to-update-bootloader-and-erase-environment/596/2 "2019-05-21T14:16:00Z")

</div>

Hi @Yury,

You can update the bootloader (you already know it is risky), using Update Modules.

[https://docs.mender.io/2.0/devices/update-modules](https://docs.mender.io/2.0/devices/update-modules)

You could use one of the existing modules, e.g

[https://hub.mender.io/t/single-file/486/10](https://hub.mender.io/t/single-file/486/10)

Or create your own.

If you are not using 2.0 version of the Mender client you could accomplish this state-scripts,

[https://docs.mender.io/2.0/artifacts/state-scripts](https://docs.mender.io/2.0/artifacts/state-scripts)
