linux-surface / aarch64-arch-mkimg

Scripts to create Arch Linux AArch64 disk images (e.g. for flashing to a USB stick), adapted for the Surface Pro X
MIT License
15 stars 7 forks source link

Docker Command in Ubuntu WSL with symlink [/dev/shm -> /run/shm] causes mount failure #3

Closed 7coil closed 2 years ago

7coil commented 2 years ago

Synopsis

When running the following command in WSL (I'm using Windows 11, Ubuntu 20.04), the following command causes the following error to occur.

Disk images can then be generated via

docker run --rm --privileged -v /dev:/dev -v "${PWD}/build":/build aarch64-arch-mkimg <profile>
===> Preparing sources...
 --> Importing Arch Linux ARM GPG key...
 --> Downloading 'ArchLinuxARM-aarch64-latest.tar.gz'...
 --> Verifying 'ArchLinuxARM-aarch64-latest.tar.gz'...
 --> Verification passed
 --> Extracting 'ArchLinuxARM-aarch64-latest.tar.gz'...
===> Preparing rootfs...
 --> Copying base files...
 --> Installing chroot scripts...
 --> Switching into rootfs...
mount: //build/rootfs/dev/shm: mount point is a symbolic link to nowhere.
       dmesg(1) may have more information after failed mount system call.
==> ERROR: failed to setup chroot //build/rootfs

Reason

This is because the Ubuntu /dev/shm points to /run/shm, which does not exist in the Arch Linux image.

See this Arch Linux forum post for more information: https://bbs.archlinux.org/viewtopic.php?id=156970

Solution

Adding --mount type=tmpfs,destination=/run/shm to the command to create a tmpfs (RAM based temp, not disk based /tmp) in the expected location

docker run --rm --privileged --mount type=tmpfs,destination=/run/shm -v /dev:/dev -v "${PWD}/build":/build aarch64-arch-mkimg <profile>
qzed commented 2 years ago

Thanks for reporting this! I've updated the readme in 5c5f5437940d691fcbd14fc14489389fe02d4d3a to include that.