Skip to content

running out of loopback devices, then rsync issues. #104

@timcoote

Description

@timcoote

I'm running pi-gen's build-docker.sh in various fedora vms. I find that I need to create extra loop devices on the guest vm, otherwise docker containers seem to run out in export-image/prerun.sh, near here:
BOOT_DEV=$(losetup --show -f -o ${BOOT_OFFSET} --sizelimit ${BOOT_LENGTH} ${IMG_FILE}) ROOT_DEV=$(losetup --show -f -o ${ROOT_OFFSET} --sizelimit ${ROOT_LENGTH} ${IMG_FILE})
like this:

+ ROOT_LENGTH=2988912640
++ losetup --show -f -o 4194304 --sizelimit 43854848 /pi-gen/work/2017-09-01-osx/export-image/2017-09-01-osx-4GB.img
losetup: /pi-gen/work/2017-09-01-osx/export-image/2017-09-01-osx-4GB.img: failed to set up loop device: No such file or directory
+ BOOT_DEV=

Clearly there's a workaround, eg:

# create a couple of dummy files:
dd if=/dev/zero of=virtualfs1 bs=1024 count=30720
dd if=/dev/zero of=virtualfs1 bs=1024 count=30720
# incrementally associate the files with loop devices
sudo losetup -f    # creates loop0
sudo losetup /dev/loop0 virtualfs1
sudo losetup -f   # creates loop1
sudo losetup /dev/loop0 virtualfs2
# remove the associations:
sudo losetup -d /dev/loop0
sudo losetup -d /dev/loop1

I don't know whether this is a specific redhat distro issue. I thought it worth pointing out. It would be a pita to automate, I think.

Once the script gets onto the rsync command (rsync -aHAXx --exclude var/cache/apt/archives ${EXPORT_ROOTFS_DIR}/ ${ROOTFS_DIR}/), there seems to be some tangling with SELinux as the -X flag (--xattrs) fails for the vfat partitions (/boot and /dev), with errors like this:

output.build.osx.7:+ rsync -aHAXx --exclude var/cache/apt/archives /pi-gen/work/2017-09-01-osx/stage4/rootfs/ /pi-gen/work/2017-09-01-osx/export-image/rootfs/
output.build.osx.7:rsync: rsync_xal_set: lsetxattr(""/pi-gen/work/2017-09-01-osx/export-image/rootfs/boot"","security.selinux") failed: Operation not supported (95)
output.build.osx.7:rsync: rsync_xal_set: lsetxattr(""/pi-gen/work/2017-09-01-osx/export-image/rootfs/boot/.COPYING.linux.QQ1rbT"","security.selinux") failed: Operation not supported (95)

It looks to me like rsync shouldn't try to transfer attributes to filesystems that cannot handle them, and SELinux isn't yet sufficiently widespread for this issue to occur often. I'll update this when I find a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions