Skip to contentSkip to conversation

udev-extraconf: update mount.sh to use /run/media instead of /media

PATCH In review Denys Dmytriyenko 3 participants 6 messages Apr 1, 2014 – Apr 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 udev-extraconf: update mount.sh to use /run/media instead of /media

From: Denys Dmytriyenko <[email protected]>

This is done to work around the issue of auto-mounting block devices (i.e. SD cards) when root filesystem is still in read-only mode and creating /media/<device> mount-points by udev is not possible. That is due to udev (/etc/rcS.d/S03udev) getting started earlier than checkroot (/etc/rcS.d/S10checkroot.sh) gets a chance to re-mount the rootfs as read-write.

Although, canonical FHS specifies /media/<device> as a mount point for removable media devices, the latest 2.3 version was released in 2004 and since then FreeDesktop/udisks and other tools adopted the new /run/media/<user>/<device> location. That was done to overcome read-only rootfs limitation, since /run is usually a tmpfs mounted partition, plus avoid name-clash between users.

For our embedded systems environment we assume single-user operation and hence simplify mount point to just /run/media/<device>. But for proper per-user mounting to /run/media/<user>/<device>, some sort of session management is required along with the tool like udisks, that is out of scope of this simple udev-based auto-mounting.

---
v2 - drop PR, bump PV, elaborate on session/user mounting option

 meta/recipes-core/udev/udev-extraconf/mount.sh             | 14 +++++++-------
 .../udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb}  |  2 --
 2 files changed, 7 insertions(+), 9 deletions(-)
 rename meta/recipes-core/udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb} (99%)
meta/recipes-core/udev/udev-extraconf/mount.sh +7 -7
index cb57e47..3e4f21f 100644
@@ -20,7 +20,7 @@ done
 automount() {	
 	name="`basename "$DEVNAME"`"
 
-	! test -d "/media/$name" && mkdir -p "/media/$name"
+	! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
 	# Silent util-linux's version of mounting auto
 	if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
 	then
@@ -38,12 +38,12 @@ automount() {
 		;;
 	esac
 
-	if ! $MOUNT -t auto $DEVNAME "/media/$name"
+	if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
 	then
-		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
-		rm_dir "/media/$name"
+		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
+		rm_dir "/run/media/$name"
 	else
-		logger "mount.sh/automount" "Auto-mount of [/media/$name] successful"
+		logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
 		touch "/tmp/.automount-$name"
 	fi
 }
@@ -60,7 +60,7 @@ rm_dir() {
 
 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"
-[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
+[ -e /sys/block/$name/device/run/media ] && media_type=`cat /sys/block/$name/device/run/media`
 
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
 	if [ -x "$PMOUNT" ]; then
@@ -87,5 +87,5 @@ if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
 	
 	# Remove empty directories from auto-mounter
 	name="`basename "$DEVNAME"`"
-	test -e "/tmp/.automount-$name" && rm_dir "/media/$name"
+	test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
 fi
meta/recipes-core/udev/udev-extraconf_1.1.bb renamed from meta/recipes-core/udev/udev-extraconf_1.0.bb +0 -2
similarity index 99%
rename from meta/recipes-core/udev/udev-extraconf_1.0.bb
rename to meta/recipes-core/udev/udev-extraconf_1.1.bb
index 3810b28..d69056d 100644
@@ -4,8 +4,6 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-PR = "r16"
-
 SRC_URI = " \
        file://automount.rules \
        file://mount.sh \
Signature · 1 line
1.9.1
#1 lore raw

ping

Quoted 101 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

This is done to work around the issue of auto-mounting block devices (i.e. SD cards) when root filesystem is still in read-only mode and creating /media/<device> mount-points by udev is not possible. That is due to udev (/etc/rcS.d/S03udev) getting started earlier than checkroot (/etc/rcS.d/S10checkroot.sh) gets a chance to re-mount the rootfs as read-write.

Although, canonical FHS specifies /media/<device> as a mount point for removable media devices, the latest 2.3 version was released in 2004 and since then FreeDesktop/udisks and other tools adopted the new /run/media/<user>/<device> location. That was done to overcome read-only rootfs limitation, since /run is usually a tmpfs mounted partition, plus avoid name-clash between users.

For our embedded systems environment we assume single-user operation and hence simplify mount point to just /run/media/<device>. But for proper per-user mounting to /run/media/<user>/<device>, some sort of session management is required along with the tool like udisks, that is out of scope of this simple udev-based auto-mounting.

---
v2 - drop PR, bump PV, elaborate on session/user mounting option

 meta/recipes-core/udev/udev-extraconf/mount.sh             | 14 +++++++-------
 .../udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb}  |  2 --
 2 files changed, 7 insertions(+), 9 deletions(-)
 rename meta/recipes-core/udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb} (99%)
meta/recipes-core/udev/udev-extraconf/mount.sh +7 -7
index cb57e47..3e4f21f 100644
@@ -20,7 +20,7 @@ done
 automount() {	
 	name="`basename "$DEVNAME"`"
 
-	! test -d "/media/$name" && mkdir -p "/media/$name"
+	! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
 	# Silent util-linux's version of mounting auto
 	if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
 	then
@@ -38,12 +38,12 @@ automount() {
 		;;
 	esac
 
-	if ! $MOUNT -t auto $DEVNAME "/media/$name"
+	if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
 	then
-		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
-		rm_dir "/media/$name"
+		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
+		rm_dir "/run/media/$name"
 	else
-		logger "mount.sh/automount" "Auto-mount of [/media/$name] successful"
+		logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
 		touch "/tmp/.automount-$name"
 	fi
 }
@@ -60,7 +60,7 @@ rm_dir() {
 
 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"
-[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
+[ -e /sys/block/$name/device/run/media ] && media_type=`cat /sys/block/$name/device/run/media`
 
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
 	if [ -x "$PMOUNT" ]; then
@@ -87,5 +87,5 @@ if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
 
 	# Remove empty directories from auto-mounter
 	name="`basename "$DEVNAME"`"
-	test -e "/tmp/.automount-$name" && rm_dir "/media/$name"
+	test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
 fi
meta/recipes-core/udev/udev-extraconf_1.1.bb renamed from meta/recipes-core/udev/udev-extraconf_1.0.bb +0 -2
similarity index 99%
rename from meta/recipes-core/udev/udev-extraconf_1.0.bb
rename to meta/recipes-core/udev/udev-extraconf_1.1.bb
index 3810b28..d69056d 100644
@@ -4,8 +4,6 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-PR = "r16"
-
 SRC_URI = " \
        file://automount.rules \
        file://mount.sh \
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#2 lore raw
Quoted 2 lines · Denys Dmytriyenko

ping

This change is a little late for 1.6 as we are prepping for the final RC this week. It's kind of an API change since it moves the mount location /media, should we be linking /media to /run/media?

There is also an issue with the Freescale PPC BSP, which has a bbappend for 1.0, so some coordination with them will be needed.

I can revisit this for 1.7 in a week or so.

Sau!

Quoted 102 lines · Denys Dmytriyenko
Quoted 101 lines

From: Denys Dmytriyenko <[email protected]>

This is done to work around the issue of auto-mounting block devices (i.e. SD cards) when root filesystem is still in read-only mode and creating /media/<device> mount-points by udev is not possible. That is due to udev (/etc/rcS.d/S03udev) getting started earlier than checkroot (/etc/rcS.d/S10checkroot.sh) gets a chance to re-mount the rootfs as read-write.

Although, canonical FHS specifies /media/<device> as a mount point for removable media devices, the latest 2.3 version was released in 2004 and since then FreeDesktop/udisks and other tools adopted the new /run/media/<user>/<device> location. That was done to overcome read-only rootfs limitation, since /run is usually a tmpfs mounted partition, plus avoid name-clash between users.

For our embedded systems environment we assume single-user operation and hence simplify mount point to just /run/media/<device>. But for proper per-user mounting to /run/media/<user>/<device>, some sort of session management is required along with the tool like udisks, that is out of scope of this simple udev-based auto-mounting.

---
v2 - drop PR, bump PV, elaborate on session/user mounting option

  meta/recipes-core/udev/udev-extraconf/mount.sh             | 14 +++++++-------
  .../udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb}  |  2 --
  2 files changed, 7 insertions(+), 9 deletions(-)

rename meta/recipes-core/udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb} (99%)

meta/recipes-core/udev/udev-extraconf/mount.sh +7 -7
index cb57e47..3e4f21f 100644
@@ -20,7 +20,7 @@ done
  automount() {	
  	name="`basename "$DEVNAME"`"
 
-	! test -d "/media/$name" && mkdir -p "/media/$name"
+	! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
  	# Silent util-linux's version of mounting auto
  	if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
  	then
@@ -38,12 +38,12 @@ automount() {
  		;;
  	esac
 
-	if ! $MOUNT -t auto $DEVNAME "/media/$name"
+	if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
  	then
-		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
-		rm_dir "/media/$name"
+		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
+		rm_dir "/run/media/$name"
  	else
-		logger "mount.sh/automount" "Auto-mount of [/media/$name] successful"
+		logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
  		touch "/tmp/.automount-$name"
  	fi
  }
@@ -60,7 +60,7 @@ rm_dir() {
 
  # No ID_FS_TYPE for cdrom device, yet it should be mounted
  name="`basename "$DEVNAME"`"
-[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
+[ -e /sys/block/$name/device/run/media ] && media_type=`cat /sys/block/$name/device/run/media`
 
  if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
  	if [ -x "$PMOUNT" ]; then
@@ -87,5 +87,5 @@ if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
 
  	# Remove empty directories from auto-mounter
  	name="`basename "$DEVNAME"`"
-	test -e "/tmp/.automount-$name" && rm_dir "/media/$name"
+	test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
  fi
meta/recipes-core/udev/udev-extraconf_1.1.bb renamed from meta/recipes-core/udev/udev-extraconf_1.0.bb +0 -3
similarity index 99%
rename from meta/recipes-core/udev/udev-extraconf_1.0.bb
rename to meta/recipes-core/udev/udev-extraconf_1.1.bb
index 3810b28..d69056d 100644
@@ -4,8 +4,6 @@ LICENSE = "MIT"
  LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                      file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-PR = "r16"
-
  SRC_URI = " \
         file://automount.rules \
         file://mount.sh \
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 8 lines · Saul Wold
Quoted 2 lines · Denys Dmytriyenko

ping

This change is a little late for 1.6 as we are prepping for the final RC this week. It's kind of an API change since it moves the mount location /media, should we be linking /media to /run/media?

Quoted 6 lines

There is also an issue with the Freescale PPC BSP, which has a bbappend for 1.0, so some coordination with them will be needed.

I can revisit this for 1.7 in a week or so.

Sau!

I understand the timing concern and am fine waiting another week for when 1.7 window opens.

But I'm slightly confused as to since when OE-Core is concerned about breaking bbappends in other layers? I guess some layers are not created equal, eh? :)

Signature · 1 line
Denys
Quoted 103 lines
Quoted 102 lines · Denys Dmytriyenko
Quoted 101 lines

From: Denys Dmytriyenko <[email protected]>

This is done to work around the issue of auto-mounting block devices (i.e. SD cards) when root filesystem is still in read-only mode and creating /media/<device> mount-points by udev is not possible. That is due to udev (/etc/rcS.d/S03udev) getting started earlier than checkroot (/etc/rcS.d/S10checkroot.sh) gets a chance to re-mount the rootfs as read-write.

Although, canonical FHS specifies /media/<device> as a mount point for removable media devices, the latest 2.3 version was released in 2004 and since then FreeDesktop/udisks and other tools adopted the new /run/media/<user>/<device> location. That was done to overcome read-only rootfs limitation, since /run is usually a tmpfs mounted partition, plus avoid name-clash between users.

For our embedded systems environment we assume single-user operation and hence simplify mount point to just /run/media/<device>. But for proper per-user mounting to /run/media/<user>/<device>, some sort of session management is required along with the tool like udisks, that is out of scope of this simple udev-based auto-mounting.

---
v2 - drop PR, bump PV, elaborate on session/user mounting option

 meta/recipes-core/udev/udev-extraconf/mount.sh             | 14 +++++++-------
 .../udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb}  |  2 --
 2 files changed, 7 insertions(+), 9 deletions(-)
 rename meta/recipes-core/udev/{udev-extraconf_1.0.bb => udev-extraconf_1.1.bb} (99%)
meta/recipes-core/udev/udev-extraconf/mount.sh +7 -7
index cb57e47..3e4f21f 100644
@@ -20,7 +20,7 @@ done
 automount() {	
 	name="`basename "$DEVNAME"`"
 
-	! test -d "/media/$name" && mkdir -p "/media/$name"
+	! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
 	# Silent util-linux's version of mounting auto
 	if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
 	then
@@ -38,12 +38,12 @@ automount() {
 		;;
 	esac
 
-	if ! $MOUNT -t auto $DEVNAME "/media/$name"
+	if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
 	then
-		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
-		rm_dir "/media/$name"
+		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
+		rm_dir "/run/media/$name"
 	else
-		logger "mount.sh/automount" "Auto-mount of [/media/$name] successful"
+		logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
 		touch "/tmp/.automount-$name"
 	fi
 }
@@ -60,7 +60,7 @@ rm_dir() {
 
 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"
-[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
+[ -e /sys/block/$name/device/run/media ] && media_type=`cat /sys/block/$name/device/run/media`
 
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
 	if [ -x "$PMOUNT" ]; then
@@ -87,5 +87,5 @@ if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
 
 	# Remove empty directories from auto-mounter
 	name="`basename "$DEVNAME"`"
-	test -e "/tmp/.automount-$name" && rm_dir "/media/$name"
+	test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
 fi
meta/recipes-core/udev/udev-extraconf_1.1.bb renamed from meta/recipes-core/udev/udev-extraconf_1.0.bb +0 -3
similarity index 99%
rename from meta/recipes-core/udev/udev-extraconf_1.0.bb
rename to meta/recipes-core/udev/udev-extraconf_1.1.bb
index 3810b28..d69056d 100644
@@ -4,8 +4,6 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-PR = "r16"
-
 SRC_URI = " \
        file://automount.rules \
        file://mount.sh \
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#4 lore raw
Quoted 5 lines · Denys Dmytriyenko

I understand the timing concern and am fine waiting another week for when 1.7 window opens.

But I'm slightly confused as to since when OE-Core is concerned about breaking bbappends in other layers? I guess some layers are not created equal, eh? :)

The question is more one of timing. I don't think its reasonable that we break things like that between -rc2 and -rc3 of 1.6 without a better reason...

I'm even nervous changing the sstate checksums but I think the CONFFILES change does warrant that for example.

Cheers,

Richard

#5 lore raw
Quoted 7 lines · Richard Purdie
Quoted 5 lines · Denys Dmytriyenko

I understand the timing concern and am fine waiting another week for when 1.7 window opens.

But I'm slightly confused as to since when OE-Core is concerned about breaking bbappends in other layers? I guess some layers are not created equal, eh? :)

Quoted 6 lines

The question is more one of timing. I don't think its reasonable that we break things like that between -rc2 and -rc3 of 1.6 without a better reason...

I'm even nervous changing the sstate checksums but I think the CONFFILES change does warrant that for example.

Is 1.7 window now open? Should I resubmit this patch again? Thanks.

Signature · 1 line
Denys