Hi team,
A customer is having an issue when trying to use the legacy method to setup a USB drive and when executing the script command, they have the following error:
Apalis T30 rootfs detected
Image file apalis_t30.img has been successfully generated!
Creating MBR file and do the partitioning
0+0 records in
0+0 records out
0 bytes copied, 0.000753089 s, 0.0 kB/s
Error: Error opening /home/hw/Downloads/Apalis-T30_LXDE-Image_2.8.6/apalis-t30_bin/mbr.bin: Operation not permitted
Script aborted unexpectedly...
They have the same issue with both 2.7.4 and 2.8.6 image when trying to install through the legacy image. With TEZI they don’t have an issue but since they want to use the 2.7.4 image, they asked about the legacy method. They also tried with different devices.
As for the extracting the also did the following, nothing too crazy:
Downloaded Apalis-T30_LXDE-Image_2.8b6.184-20190401.tar.bz2
sudo tar xjvf Apalis-T30_LXDE-Image_2.8b6.184-20190401.tar.bz2 --no-same-owner
cd Apalis-T30_LXDE-Image_2.8.6/
./update.sh -o /media/hw/<partition_label>/
Some additional details:
SoM: Apalis T30
Carrier Board: Apalis Evaluation Board
Tegra U-Boot Versions: Git Branch: 2016.11-toradex
Linux-toradex module version : 3.1.10-g37b9f03
Tegra T20/T30 Image Versions: 2.7 beta 4 (Aplis-T30_LXDE-image_2.7.4)
Gcc version : gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf
UPDATE:
I added some traces into the update.sh file to better understand what is going on and I could better pinpoint the issue but still no idea what is going on and unable to solve the issue. Problem sees to be with dd and parted. Customer is using Ubuntu 16.04.3, with dd (coreutils) 8.25 and parted 3.2.
The part in particular is the following and seems to be related with the permissions or the way that dd creates MBR.bin:
echo ""
echo "Creating MBR file and do the partitioning"
# Initialize a sparse file
sudo rm -rf ${BINARIES}/mbr.bin
if [ -f "${BINARIES}/mbr.bin" ] ; then
echo "MBR file exists"
else
echo "MBR file non-existent"
fi
dd if=/dev/zero of=${BINARIES}/mbr.bin bs=512 count=0 seek=${EMMC_SIZE}
echo "dd - completed"
echo "MBR.bin permissions:"
ls -l ${BINARIES}/mbr.bin
sudo chmod 666 ${BINARIES}/mbr.bin
echo "chmod completed"
echo "MBR.bin permissions:"
${PARTED} -s ${BINARIES}/mbr.bin mklabel msdos
echo "parted - mklabel completed"
echo "MBR.bin permissions:"
ls -l ${BINARIES}/mbr.bin
${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary fat32 ${BOOT_START} $(expr ${ROOTFS_START} - 1 )
echo "parted - mkpart fat32 completed"
echo "MBR.bin permissions:"
ls -l ${BINARIES}/mbr.bin
echo "-----Did it change?-----"
exit 1
# the partition spans to the end of the disk, even though the fs size will be smaller
# on the target the fs is then grown to the full size
if [ "${IMAGEFILE}" = "root.ext3" ] ; then
${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext3 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
else
${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext4 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
fi
${PARTED} -s ${BINARIES}/mbr.bin unit s print
echo "parted - mkpart extX completed"
From the tests I did myself, I always created the MBR file with 666 permissions, however, the customer seems unable to change it for some reason at the botton part when they have to create the ext3/ext4 partition:
Apalis T30 rootfs detected
Image file apalis_t30.img has been successfully generated!
Creating MBR file and do the partitioning
MBR file non-existent
0+0 records in
0+0 records out
0 bytes copied, 0.000787268 s, 0.0 kB/s
dd - completed
MBR.bin permissions:
-rw-r--r-- 1 root root 7811891200 Sep 13 19:03 apalis-t30_bin/mbr.bin
chmod completed
MBR.bin permissions:
parted - mklabel completed
MBR.bin permissions:
-rw-rw-rw- 1 root root 7811891200 Sep 13 19:03 apalis-t30_bin/mbr.bin
parted - mkpart fat32 completed
MBR.bin permissions:
-rw-rw-rw- 1 root root 7811891200 Sep 13 19:03 apalis-t30_bin/mbr.bin
-----Did it change?-----
Error: Error opening /home/hw/Downloads/Apalis-T30_LXDE-Image_2.7.4/apalis-t30_bin/mbr.bin: Operation not permitted
Script aborted unexpectedly...
It seems that there is an issue in the way that the MBR file is created and cannot be correctly changed, even with a forced chmod 666
. Also, the file seems to be created by root even though it is not launched with sudo
. Without chmod
, the permissions look like this, and fails in the same spot, which is something that really confuses me:
Apalis T30 rootfs detected
Image file apalis_t30.img has been successfully generated!
Creating MBR file and do the partitioning
MBR file non-existent
0+0 records in
0+0 records out
0 bytes copied, 0.00018434 s, 0.0 kB/s
dd - completed
MBR.bin permissions:
-rw-r--r-- 1 root root 7811891200 Sep 13 16:38 apalis-t30_bin/mbr.bin
parted - mklabel completed
MBR.bin permissions:
-rw-r--r-- 1 root root 7811891200 Sep 13 16:38 apalis-t30_bin/mbr.bin
parted - mkpart fat32 completed
MBR.bin permissions:
-rw-r--r-- 1 root root 7811891200 Sep 13 16:38 apalis-t30_bin/mbr.bin
-----Did it change?-----
Error: Error opening /home/hw/Downloads/Apalis-T30_LXDE-Image_2.7.4/apalis-t30_bin/mbr.bin: Operation not permitted
Script aborted unexpectedly...
Somehow, the mklabel
and the mkpart fat32
work but the problem happens at the mkpart ext
I attached the final update.sh that I sent the customer with additional tests and changes but everything remains the same compared to the original found in the image. My changes:
Delete of mbr.bin (in case this was created with sudo and kept this way).
Change of PARTED to always use sudo (in case it was a permission issue).
Added a manual chmod 666 to ensure the rw from everyone…
Many thanks and kind regards,
Alvaro.