Wrapup.sh not running as root

Hello,

When I attempt to use the Toradex EZ Installer to load a custom image, I am running into issues with the wrapup.sh script not executing certain commands as root. I have copied the code I’ve added to wrapup.sh below.

resize2fs /dev/mmcblk0p2 &> /dev/console

# Set the time zone to Pacific and update the hardware clock to match network
# time.
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime &> /dev/console
hwclock -w
timedatectl &> /home/user/test.txt
touch /home/user/test.txt

After flashing the device, I get the errors shown below.

/run/media/src/Apalis-iMX6_LXDE-Image-Tezi_2.8b2/wrapup.sh: line 78: resize2fs: not found
ln: /etc/localtime: Read-only file system
hwclock: Sorry, only the superuser can use the Hardware Clock.

Can you provide clarification on why it appears that wrapup.sh is not executing as root?

Hi @esilva

Could you provide the version of Toradex Easy Installer you are using?

Apalis-iMX6_LXDE-Image-Tezi_2.8b2

Please update to the stable Bsp 2.8 since 2.8b2 is not supported anymore.

Could you provide the dmesg log in a file?

Thanks and best regards,
Jaski

Hi @jaski.tx

We are using Easy Installer version 1.8

I have attached the dmesg output here

Thank you for your help,
Erik

link text

Hello esliva! What Easy Installer version are you using? I cannot reproduce the hwclock error that you mention. The other errors are understandable.

Keep in mind that the wrapup.sh is executed inside the Easy Installer, which is an image that runs completely in memory. Its rootfs is read-only, so trying to write (or make a link) to any file in that system is not going to work.

What I assume that you actually want to do is set the localtime in your image. Since your image has been flashed into memory, you first want to mount it so that you can access it from the Easy Installer system. The Easy Installer provides a writable tmpfs in /var/volatile, so you want to do sth like mount /dev/mmcblk0p2 /var/volatile/myimage and then create the symlink in /var/volatile/myimage/etc/localtime.

The Easy Installer image also does not provide resize2fs, and it is not using systemd to save space, so no timedatectl is available either. You probably want to do this in a boot script inside your system, not in the wrapup script.