raspberrypi/scriptexecutor

How to build a correct image

Opened this issue · 2 comments

Hi,

I have build an image i want to write using scriptexecutor. But it's always slow to copy (lets say 755mb) and the copy command gives errors when doing the copy. It starts off really fast going to 40% but then it stalls eventually getting back on speed until it drops again around 70%.... and then speeds up again. I suspect this has to do with the 3 partitions on the image and the empty space it holds.

Not tainted 5.4.83-scriptexec 1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Workqueue: events_freezable mmc_rescan

Then a a large backtrace message

Usually the image still continue's to copy.. but sometimes it also fails to copy with the following error:
Error during dd. Return code 1. Script output:

28728576+0 records in
14027+1 records out

What i'm trying to do is creating an image of a Ubuntu core installation that is already installed and ready to go.

I remove the SD card from the already setup PI and put this in a Ubuntu laptop... creating an image and supplying this to the scriptexecutor (compressed in .gz format)

I suspect this has to do with the image and how it's created. If i supply a standard ubuntu core image dd is finished in about 3 minutes and the error never appears. What am i doing wrong?

It cannot be the SD card as it's brand new.

Hung task is "normal" with slow SD cards, and just a warning you can ignore.
Can happen if the kernel write buffer grew so large that it wants to write everything to storage first before continueing, and that is taking long.
Don't know why dd fails for you, but can also be that your destination SD card is smaller than your original image. Not all SD cards that are advertised as say 32 GB are really 32 GB, but may be 31.5 GB instead...

With Ubuntu Core I do not recommend cloning already installed Core installations.
Always let Ubuntu Core install itself instead.
If you want to do your own customizations, use cloud-init, which in Ubuntu Core (unlike Ubuntu Server) is not enabled by default, but which you do can enable easily by altering cmdline.txt.
E.g. add "ds=nocloud-net;s=http://your-server/where-your-cloudinit-files-live/"
Or "ds=nocloud;s=file:///somepath/" if you store the cloud-init configuration files on SD card.