Possible to make/save Librem 5 distro + data as an image file?

I’m currently trying to save my distro (pure OS) and data as an image file to store in an external device for later and It seems to fail on me while trying to do so using the disk utility app and I don’t know why it’s doing this.

I’ve seen links of how to flash/reflash a librem 5 device with a downloaded fresh image of Pure OS, but unable to find one that can make an image file of my current hd partitions on my phone.

Is there an alternative why of doing this?

Any advice would be of great help.
Thank you

1 Like

You can use Jumpdrive to expose the phone’s eMMC as a mass storage device to your PC and then use regular disk imaging tools (dd, gnome-disks etc.) to do whole disk backup/restore.


Okay, sounds great. Is this similar to ADB to an Android?

Also, I’m just lloking up this software now. Is this something that I need to boot in the Librem 5 via SD card or something that I have to install on a computer?

See community wiki FAQ: https://source.puri.sm/Librem5/community-wiki/-/wikis/Frequently-Asked-Questions#317-how-can-i-backup-my-librem-5 and https://source.puri.sm/Librem5/community-wiki/-/wikis/Building-uuu-and-Jumpdrive

1 Like

Thanks for those links JR-Fi,
I have infact been following this to install UUU: https://github.com/nxp-imx/mfgtools

sudo apt install uuu doesn’t appear to work anymore. So I followed these commands:

git clone https://github.com/nxp-imx/mfgtools.git
cd mfgtools
sudo apt-get install libusb-1.0-0-dev libbz2-dev libzstd-dev pkg-config cmake libssl-dev g++
cmake . && make

I made it all the way to cmake .&& make but I get this error here:

Checking for module 'zlib' 
--   No package 'zlib' found
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  uuu/CMakeLists.txt:9 (pkg_check_modules)

-- Configuring incomplete, errors occurred!
See also "/home/USER/mfgtools/CMakeFiles/CMakeOutput.log".
See also "/home/USER/mfgtools/CMakeFiles/CMakeError.log".

Is there anything that I could be missing?

This is the whole data wall after using cmake and make:
USER@COMPUTER:~/mfgtools$ cmake . && make
– The C compiler identification is GNU 9.4.0
– The CXX compiler identification is GNU 9.4.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Warning (dev) at libuuu/CMakeLists.txt:59:
Syntax Warning in cmake code at column 159

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so (found version "1.0.8") 
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libusb-1.0>=1.0.16'
--   Found libusb-1.0, version 1.0.23
-- Checking for module 'libzstd'
--   Found libzstd, version 1.4.4
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")  
-- Checking for module 'zlib'
--   No package 'zlib' found
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  uuu/CMakeLists.txt:9 (pkg_check_modules)

-- Configuring incomplete, errors occurred!
See also "/home/USER/mfgtools/CMakeFiles/CMakeOutput.log".
See also "/home/USER/mfgtools/CMakeFiles/CMakeError.log".

Hey i gave it a spin and it works, the following i don’t think requires uuu, if you are looking for the unstable uuu .deb image just use the following Debian packages:

  1. Download librem 5 image using Jenkins All Purism builds, i used an older one just to see if it flashes > librem5r3.img.xz
  2. Download and unpack jumpdrive using Jumpdrive Git
  3. execute the jumpdrive script ./boot-purism-librem5.sh from inside the unpacked folder in 2. Use --help for more options.
  4. use instructions to get phone into flash mode attaching original usb-c cable with Flash Mode Section
  5. after attaching the phone it should show success 1 and exit based to terminal input prompt, the eMMC 32GB drive and any internal SD card now show as storage devices in your file browser
    If you get an error about unable to open or access USB try:
    Looks like just a permission issue. You can use https://source.puri.sm/Librem5/librem5-flash-image to configure it automatically: sudo ./librem5-flash-image --udev
  6. open gnome disks and for the Librem 5 eMMC make sure it is unmounted, or execute ‘umount -f /dev/sdd’ or ‘umount -l /dev/sdd’ to unmount all the Librem 5 partitions (if you have a file browser open viewing the mounted partition it will not let you unmount since it is busy and locked so just close those browser windows)
  7. make sure hks on the phone are off, in gnome disks just select the eMMC device and “Restore Disk Image…” option, point to the downloaded image file, and select OK
  8. open gparted and make sure the user space partition /dev/sdd2 takes up the rest of the 32GB space, if not resize partition, and select apply
  9. after completion, unplug the phone reboot,
  10. enter 123456 for encryption and login password and you are done

This whole process makes me wonder a little, is it possible to create the .img.xz file myself on a desktop using a fully setup phone as the resource? Then if it crashes or something goes wrong instead of flashing a stock image i flash and image that includes all my settings, programs, optimizations etc?

1 Like

Yeah, that exactly the question that I had been wondering.

I have been informed that jumpdriving is the way to go, but like I mentioned earlier, after trying to use cmake . && make (install instructions in here: https://github.com/nxp-imx/mfgtools) parts failed, some packages were not found and errors occurred.

So, going back to what you were saying…I don’t need to install anything on my computer, I just have to execute boot-purism-librem5.sh from the terminal and I can then copy or turn my librem 5 current state into a .img file?

Ok thats the 1 Million dollar question, if someone can answer it it would mean that is the last time i have to restore a phone from backup (which is time consuming). BalenaEtcher has a Clone drive function.

Maybe i give that a spin by cloning my eMMC, then flashing the cloned drive image back to the phone? That way you just clone the drive every month or so, and if something goes wrong reflash and you are up and running in 30minutes as if nothing has happened. With LUKS i just don’t know if it lets you.

It wasn’t obvious to me but using:

  1. jumpdrive make the eMMC discoverable;
  2. use gnome disks and option create image after selecting eMMC
  3. save image in your desktop backup folder
  4. that image contains all settings, apps, optimizations and data you had previously saved and can be restored

Tested and works!

So from now i will create an img. file every month or so and if something goes wrong i’ll take the last .img file use gnome disks and restore from image option. I will still use DejaDup because backup restore of more recent items in your user folder will still be useful in that case. I use the internal SD card to keep my backup storage.

1 Like

I figured that was the case after being afk. But I still can’t get boot-purism-librem5.sh to work. Whenever I try to boot it, I get this:
boot-purism-librem5.sh: command not found

Is there something that I’m doing wrong, cause I only used the terminal to go inside of the directory that boot-purism-librem5.sh is in and typed in boot-purism-librem5.sh?

Thanks for confirming all of that Captain_Morgan

Maybe it should be ./boot-purism-librem5.sh to run?

Btw. looking at all the instructions related to this, I notice a point that may not be evident to all (and seems to be assumed is understood): to which device is each file in and where are scripts copied and used. There are no obvious reference points when something is done in L5 and when something is done in another computer.

thats it i fixed my instructions.

1 Like

… my observation was also in relation to Jumpdrive page and wiki too. (like: “provided script will boot the Librem 5 with Jumpdrive” - which leaves out where, which device, the script or Jumpdrive are needed)

Thanks, but now I’d just getting:
./boot-purism-librem5.sh: 3: uuu: not found

What do you mean by that? Which distro are you using?

I meant the sudo command: sudo apt install uuu doesn’t seem to work as an installation. I’ve been using the instructions in: https://github.com/nxp-imx/mfgtools

I had been assuming that I don’t have to install it, just run ./boot-purism-librem5.sh but that doesn’t seem to be the case

My distro that I’m using now is Trisquel (https://trisquel.info/) which is based of Ubuntu

I only seem to ever get the failure. Any troubleshooting ideas?
“Failure to open usb device. Try sudo uuu” (…and do what?)

Edit: silly thing when you are tired… sudo gets things moving :expressionless:

Try sudo apt install mfgtools.

… which version of Ubuntu? Newer versions of Ubuntu already have uuu available in the repo and it can be installed normally (rather than having to build it from source). This is noted in the link above about building uuu.

Sorry, it didn’t work

Trisquel MATE . It’s not made by the same team who made Ubuntu, but by a team that doesn’t use proprietary software or coding in their distros.