# My device fell back to the old image after booting new one from USB live stick

**URL:** https://hub.mender.io/t/my-device-fell-back-to-the-old-image-after-booting-new-one-from-usb-live-stick/4433
**Category:** General Discussions
**Tags:** yocto, rocko
**Created:** [December 30, 2021, 9:37am UTC](https://hub.mender.io/t/my-device-fell-back-to-the-old-image-after-booting-new-one-from-usb-live-stick/4433 "2021-12-30T09:37:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dantacmui](https://avatars.discourse-cdn.com/v4/letter/d/cab0a1/32.png) [@dantacmui](https://hub.mender.io/u/dantacmui)
#### Post date: [December 30, 2021, 9:37am UTC](https://hub.mender.io/t/my-device-fell-back-to-the-old-image-after-booting-new-one-from-usb-live-stick/4433/1 "2021-12-30T09:37:29Z")

</div>

Hi, I’m having problem with booting the new image to the device by USB stick.  
After choosing boot by USB stick in BIOS settings, the device asking me that do I want to install uefiimg to /dev/sda and erase all its content?, I typed yes and then the device worked with the new image.  
But after that, when I removed the USB stick, the device doesn’t work anymore, it prompted some errors about EXT4 from /dev/sdb2.  
And when I reboot the camera again, the device doesn’t boot with the newest image that I just boot but with the old one.  
I was confusing because I did erase all its content and overwrite /dev/sda?  
Here is my local.conf looked like, I changed the size of mender storage to 3800MB, does it affect anything?

```auto
MACHINE ??= "intel-corei7-64"
MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"

#
# Default policy config
#
# The distribution setting controls which policy settings are used as defaults.
# The default value is fine for general Yocto project use, at least initially.
# Ultimately when creating custom policy, people will likely end up subclassing
# these defaults.
#
DISTRO = "kuvio"
GRUB_TIMEOUT = "1"
DISTRO_FEATURES_append = " systemd"
#DISTRO_FEATURES_append += " usrmerge"
DISTRO_FEATURES_remove = " sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
PACKAGECONFIG_append_pn-systemd = " resolved networkd"

IMAGE_FSTYPES_remove = "live wic"
ARTIFACTIMG_FSTYPE = "ext4"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
PREFERRED_VERSION_linux-yocto ?= "4.4%"

PREFERRED_VERSION_xserver-nodm-init = "1.0"
PREFERRED_VERSION_lighttpd = "1.4.41"
CORE_IMAGE_EXTRA_INSTALL = "libgl-mesa libgl-mesa-dev glib-2.0"

MENDER_STORAGE_DEVICE = "/dev/sdb"
MENDER_STORAGE_DEVICE_BASE = "${MENDER_STORAGE_DEVICE}"
MENDER_BOOT_PART = "${MENDER_STORAGE_DEVICE_BASE}1"
MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE_BASE}2"
MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE_BASE}3"
MENDER_DATA_PART = "${MENDER_STORAGE_DEVICE_BASE}4"
#MENDER_STORAGE_TOTAL_SIZE_MB = "2048"
MENDER_STORAGE_TOTAL_SIZE_MB = "3800"
MENDER_BOOT_PART_SIZE_MB = "16"
MENDER_DATA_PART_SIZE_MB = "128"
MENDER_GRUB_STORAGE_DEVICE = "hd0"

IMAGE_INSTALL_append += "\
       kernel-module-axi-dma-sensor \
       openssh-sftp-server \
       samba \
       samba-luci \
       busybox \
       coreutils \
       fontconfig \
       freetype \
       libxrender \
       uci \
       luci \
       luajit \
       libpng \
       nano \
       jemalloc \
       libudev \
       copy-uefiimg-to-sda \
       "

# Enable meta-virtualization
DISTRO_FEATURES_append += " virtualization"
IMAGE_INSTALL_append += " docker docker-contrib"

#
# Package Management configuration
#
# This variable lists which packaging formats to enable. Multiple package backends
# can be enabled at once and the first item listed in the variable will be used
# to generate the root filesystems.
# Options are:
# - 'package_deb' for debian style deb files
# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager)
# - 'package_rpm' for rpm style packages
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
# We default to rpm:
PACKAGE_CLASSES ?= "package_rpm"

# Extra image configuration defaults
#
# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated
# images. Some of these options are added to certain image types automatically. The
# variable can contain the following options:
# "dbg-pkgs" - add -dbg packages for all installed packages
# (adds symbol information for debugging/profiling)
# "dev-pkgs" - add -dev packages for all installed packages
# (useful if you want to develop against libs in the image)
# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages
# (useful if you want to run the package test suites)
# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.)
# "tools-debug" - add debugging tools (gdb, strace)
# "eclipse-debug" - add Eclipse remote debugging support
# "tools-profile" - add profiling tools (oprofile, exmap, lttng, valgrind)
# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.)
# "debug-tweaks" - make an image suitable for development
# e.g. ssh root access has a blank password
# There are other application targets that can be used here too, see
# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details.
# We default to enabling the debugging tweaks.
EXTRA_IMAGE_FEATURES = "debug-tweaks"

#
# Additional image features
#
# The following is a list of additional classes to use when building images which
# enable extra features. Some available options which can be included in this variable
# are:
# - 'buildstats' collect build statistics
# - 'image-mklibs' to reduce shared library files size for an image
# - 'image-prelink' in order to prelink the filesystem image
# - 'image-swab' to perform host system intrusion detection
# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink
# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
include conf/distro/include/flatpak-applications.inc
#
# Interactive shell configuration
#
# Under certain circumstances the system may need input from you and to do this it
# can launch an interactive shell. It needs to do this since the build is
# multithreaded and needs to be able to handle the case where more than one parallel
# process may require the user's attention. The default is iterate over the available
# terminal types to find one that works.
#
# Examples of the occasions this may happen are when resolving patches which cannot
# be applied, to use the devshell or the kernel menuconfig
#
# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none
# Note: currently, Konsole support only works for KDE 3.x due to the way
# newer Konsole versions behave
#OE_TERMINAL = "auto"
# By default disable interactive patch resolution (tasks will just fail instead):
PATCHRESOLVE = "noop"

#
# Disk Space Monitoring during the build
#
# Monitor the disk space during the build. If there is less that 1GB of space or less
# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully
# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort
# of the build. The reason for this is that running completely out of space can corrupt
# files and damages the build in ways which may not be easily recoverable.
BB_DISKMON_DIRS = "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K"

#
# Qemu configuration
#
# By default qemu will build with a builtin VNC server where graphical output can be
# seen. The two lines below enable the SDL backend too. This assumes there is a
# libsdl library available on your build system.
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
ASSUME_PROVIDED += "libsdl-native"

# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
# track the version of this file when it was generated. This can safely be ignored if
# this doesn't mean anything to you.
CONF_VERSION = "1"

```

Please help, thank you so much.

Ps, after booting with the new image I noticed about some mismatch size errors:

```auto
GPT:Primary header thinks Alt. header is not at the end of the disk.
GPT:8388607 != 58626287
GPT:Alternate GPT header not at the end of the disk.
GPT:8388607 != 5862687
GPT: Use GNU Parted to correct GPT errors.
sda: sda1 sda2 sd3 sd4

```

And going through the forum, I run command `sgdisk -e or echo 'w' | fdisk /dev/sda`  
And it showed that this partition has been altered. But then nothing changed.

---

<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: [January 3, 2022, 5:10am UTC](https://hub.mender.io/t/my-device-fell-back-to-the-old-image-after-booting-new-one-from-usb-live-stick/4433/2 "2022-01-03T05:10:49Z")

</div>

`MENDER_STORAGE_DEVICE` must be set to the storage device that Mender will run on, so you most likely need to set this to `/dev/sda`. This means it might not boot correctly from the USB stick, but you can just use a standard Linux image on the USB stick, and include the image file you are going to flash.
