4

I’m facing an issue when trying to write an image on a SD card. The image was generated by the Wic tool :

wic create sdimage-8G.wks  -e gnuradio-dev-image -o images/$MACHINE

where gnuradio-dev-image is the name of the image to use the artifacts from, images/$MACHINE is the name of the output directory and sdimage-8G.wks is the kickstart file, here is is :

# short-description: Create SD card image with a boot partition
# long-description: Creates a partitioned SD card image. Boot files
# are located in the first vfat partition.

part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4 --size 16
part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4 --size 5500

This is actually part of the Yocto project. The image seems to be correctly deployed, the BOOT partition (/dev/sda1) has the kernel/device-tree/bootloader files and the ROOTFS (/dev/sda2) is good too, unless the ownership problem.

Before dd the image to the SD card, I erased it completely using the Disks app, ejected it, plugged it back and then ran the following command :

sudo dd bs=4M if=my-image.direct of=/dev/sda

Once the work is finished, if I check the owners of the root file system with ls -l, I can see it’s owned by me (user) and not root.

This leads to a read-only filesystem which in then non bootable...

Does anyone already had the same problem ?

I can't use my dev machine right now so I can't share the exact output of ls -l but what I can say is that when I change the owner of the whole FS with sudo chown -R root:root * inside the mounted FS, the card becomes bootable.

William
  • 41
  • 3
  • 2
    How was the disk image created? In particular, if you mounted the disk image on a loop device, would it still show the wrong file ownerships? – Kusalananda Jul 25 '18 at 16:44
  • I'm using the bitbake tool from the Openembedded project to build a whole distribution. Each required component of the distro is packaged (from the kernel to a random python module) and the packages are used by the wic tool (cf. my post edit) to generate the image. After dd has finished copying the image on the sd card, I run the sync command, and then just uplug the sd card. If i plug it back, it is auto-mounted to /media/william/root and /media/william/boot – William Jul 25 '18 at 19:55
  • Just to clarify, dd is completely irrelevant here, it's just copying the disk image without changing it. Garbage in, garbage out. The problem is during the creation of the disk image. – Gilles 'SO- stop being evil' Jul 25 '18 at 20:39

0 Answers0