init boot mount: mounting /root on /root.ro failed: Invalid argument, aufs
2
votes
1
answer
1316
views
I am trying to set up a read-only filesystem at
/root
directory on my embedded device.
I have following in code in my boot init command file /sbin/init-overlay
:
rootmnt=/root
ro_mount_point="${rootmnt%/}.ro"
rw_mount_point="${rootmnt%/}.rw"
# For local system rearranged from init
/bin/mkdir -p "${ro_mount_point}" "${rw_mount_point}"
# Move the already-mounted root filesystem to the ro mount point:
/bin/mount --move ${rootmnt} ${ro_mount_point}
# Mount the read/write filesystem:
/bin/mount -t tmpfs root.rw "${rw_mount_point}"
# Mount the union:
/bin/mount -t aufs -o dirs=${rw_mount_point}=rw:${ro_mount_point}=ro aufs ${rootmnt}
# Correct the permissions of /:
/bin/chmod 755 "${rootmnt}"
# Make sure the individual ro and rw mounts are accessible from within the root
# once the union is assumed as /. This makes it possible to access the
# component filesystems individually.
/bin/mkdir "${rootmnt}/ro" "${rootmnt}/rw"
/bin/mount --bind "${ro_mount_point}" "${rootmnt}/ro"
/bin/mount --bind "${rw_mount_point}" "${rootmnt}/rw"
This is my boot command:
console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootfstype=ext4 rootwait fsck.repair=${fsck.repair} panic=10 ${extra} fbcon=${fbcon} rw init=/sbin/init-overlay
But while booting, I am getting the following error:
mount: mounting /root on /root.ro failed: Invalid argument
Can anyone point-out what's wrong here?
Asked by Gopal Kildoliya
(121 rep)
Sep 13, 2018, 06:18 AM
Last activity: Sep 14, 2018, 09:12 PM
Last activity: Sep 14, 2018, 09:12 PM