Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] fixing initrd mounts w/ spaces fail to move to real rootfs
@ 2018-06-28 14:16 Arsalan Awan
  2018-06-28 14:16 ` [PATCH 1/1] initrdscripts/init-live.sh: fix " Arsalan Awan
  2018-07-13 11:07 ` [PATCH 0/1] fixing initrd " Awan, Arsalan
  0 siblings, 2 replies; 4+ messages in thread
From: Arsalan Awan @ 2018-06-28 14:16 UTC (permalink / raw)
  To: openembedded-core

From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>

When there are spaces in the mount points of devices e.g.:

 a partition mounted at "/run/media/My Root Partition-sda1",

the initrd fails to move such mount points over to the
corresponding directories at /media under the real root filesystem,
and the mount points would appear at the same location as they were
mounted on when detected by initrd, for example:
 here: "/run/media/My Root Partition-sda1"
 instead of here: "/media/My Root Partition-sda1"

This causes issues such as:

  * The disks/partitions cannot be formated with any filesystem
    using e.g. mkfs.ext4 or mke2fs in general. When tried to do so
    by making sure the device is not mounted, it failed with
    errors such as:

    > /dev/sda1 is apparently in use by the system; will not make a
      filesystem here!
    > /dev/sda1: Device or resource busy while setting up superblock

  * The read/write operations become extremely slow. e.g. Under testing,
    it took approx. 2 hours just to copy 700 MB of data to the partition,
    and it took more than 40 minutes to delete that data from it.
    Same operations took under 5 minutes on a partition that had no
    spaces in its mount point (or that was successfully moved to real
    root by initrd and appeared under /media instead of /run/media).

This commit fixes such issues by quoting the arguments of failing mount
move commands and by parsing OCT or HEX encoded special characters
such as spaces to ASCII charecters in the mount points as kernel
populates the procfs like so.


The following changes since commit 40a904bf8bc1279c3da0893c003f740f1d2066c2:

  bitbake.conf: Allow BBINCLUDED to be unset (2018-06-28 12:26:33 +0100)

are available in the git repository at:

  git://github.com/ArsalanHAwan/openembedded-core initrdscripts-init-live
  https://github.com/ArsalanHAwan/openembedded-core/tree/initrdscripts-init-live

Arsalan H. Awan (1):
  initrdscripts/init-live.sh: fix mounts w/ spaces fail to move to real
    rootfs

 meta/recipes-core/initrdscripts/files/init-live.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] initrdscripts/init-live.sh: fix mounts w/ spaces fail to move to real rootfs
  2018-06-28 14:16 [PATCH 0/1] fixing initrd mounts w/ spaces fail to move to real rootfs Arsalan Awan
@ 2018-06-28 14:16 ` Arsalan Awan
  2018-11-28 11:07   ` Awan, Arsalan
  2018-07-13 11:07 ` [PATCH 0/1] fixing initrd " Awan, Arsalan
  1 sibling, 1 reply; 4+ messages in thread
From: Arsalan Awan @ 2018-06-28 14:16 UTC (permalink / raw)
  To: openembedded-core

From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>

When there are spaces in the mount points of devices e.g.:

 a partition mounted at "/run/media/My Root Partition-sda1",

the initrd fails to move such mount points over to the
corresponding directories at /media under the real root filesystem,
and the mount points would appear at the same location as they were
mounted on when detected by initrd, for example:
 here: "/run/media/My Root Partition-sda1"
 instead of here: "/media/My Root Partition-sda1"

This causes issues such as:

  * The disks/partitions cannot be formated with any filesystem
    using e.g. mkfs.ext4 or mke2fs in general. When tried to do so
    by making sure the device is not mounted, it failed with
    errors such as:

    > /dev/sda1 is apparently in use by the system; will not make a
      filesystem here!
    > /dev/sda1: Device or resource busy while setting up superblock

  * The read/write operations become extremely slow. e.g. Under testing,
    it took approx. 2 hours just to copy 700 MB of data to the partition,
    and it took more than 40 minutes to delete that data from it.
    Same operations took under 5 minutes on a partition that had no
    spaces in its mount point (or that was successfully moved to real
    root by initrd and appeared under /media instead of /run/media).

This commit fixes such issues by quoting the arguments of failing mount
move commands and by parsing OCT or HEX encoded special characters
such as spaces to ASCII charecters in the mount points as kernel
populates the procfs like so.

Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 46cab6c..65183d7 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -95,8 +95,11 @@ boot_live_root() {
     # Move the mount points of some filesystems over to
     # the corresponding directories under the real root filesystem.
     for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
-        mkdir -p  ${ROOT_MOUNT}/media/${dir##*/}
-        mount -n --move $dir ${ROOT_MOUNT}/media/${dir##*/}
+        # Parse any OCT or HEX encoded chars such as spaces
+        # in the mount points to actual ASCII chars
+        dir=`printf $dir`
+        mkdir -p "${ROOT_MOUNT}/media/${dir##*/}"
+        mount -n --move "$dir" "${ROOT_MOUNT}/media/${dir##*/}"
     done
     mount -n --move /proc ${ROOT_MOUNT}/proc
     mount -n --move /sys ${ROOT_MOUNT}/sys
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/1] fixing initrd mounts w/ spaces fail to move to real rootfs
  2018-06-28 14:16 [PATCH 0/1] fixing initrd mounts w/ spaces fail to move to real rootfs Arsalan Awan
  2018-06-28 14:16 ` [PATCH 1/1] initrdscripts/init-live.sh: fix " Arsalan Awan
@ 2018-07-13 11:07 ` Awan, Arsalan
  1 sibling, 0 replies; 4+ messages in thread
From: Awan, Arsalan @ 2018-07-13 11:07 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

ping

________________________________________
From: Awan, Arsalan
Sent: Thursday, June 28, 2018 7:16 PM
To: openembedded-core@lists.openembedded.org
Cc: Awan, Arsalan
Subject: [PATCH 0/1] fixing initrd mounts w/ spaces fail to move to real rootfs

From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>

When there are spaces in the mount points of devices e.g.:

 a partition mounted at "/run/media/My Root Partition-sda1",

the initrd fails to move such mount points over to the
corresponding directories at /media under the real root filesystem,
and the mount points would appear at the same location as they were
mounted on when detected by initrd, for example:
 here: "/run/media/My Root Partition-sda1"
 instead of here: "/media/My Root Partition-sda1"

This causes issues such as:

  * The disks/partitions cannot be formated with any filesystem
    using e.g. mkfs.ext4 or mke2fs in general. When tried to do so
    by making sure the device is not mounted, it failed with
    errors such as:

    > /dev/sda1 is apparently in use by the system; will not make a
      filesystem here!
    > /dev/sda1: Device or resource busy while setting up superblock

  * The read/write operations become extremely slow. e.g. Under testing,
    it took approx. 2 hours just to copy 700 MB of data to the partition,
    and it took more than 40 minutes to delete that data from it.
    Same operations took under 5 minutes on a partition that had no
    spaces in its mount point (or that was successfully moved to real
    root by initrd and appeared under /media instead of /run/media).

This commit fixes such issues by quoting the arguments of failing mount
move commands and by parsing OCT or HEX encoded special characters
such as spaces to ASCII charecters in the mount points as kernel
populates the procfs like so.


The following changes since commit 40a904bf8bc1279c3da0893c003f740f1d2066c2:

  bitbake.conf: Allow BBINCLUDED to be unset (2018-06-28 12:26:33 +0100)

are available in the git repository at:

  git://github.com/ArsalanHAwan/openembedded-core initrdscripts-init-live
  https://github.com/ArsalanHAwan/openembedded-core/tree/initrdscripts-init-live

Arsalan H. Awan (1):
  initrdscripts/init-live.sh: fix mounts w/ spaces fail to move to real
    rootfs

 meta/recipes-core/initrdscripts/files/init-live.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] initrdscripts/init-live.sh: fix mounts w/ spaces fail to move to real rootfs
  2018-06-28 14:16 ` [PATCH 1/1] initrdscripts/init-live.sh: fix " Arsalan Awan
@ 2018-11-28 11:07   ` Awan, Arsalan
  0 siblings, 0 replies; 4+ messages in thread
From: Awan, Arsalan @ 2018-11-28 11:07 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

Hi,

This was fixed in Thud (& master), but can we backport this 6f8f984ba363f764e83290b972ec31a90aad1603 to [sumo ... morty]?

Link: http://git.openembedded.org/openembedded-core/commit/meta/recipes-core/initrdscripts/files/init-live.sh?h=thud&id=6f8f984ba363f764e83290b972ec31a90aad1603

Thanks

-
Arsalan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-28 11:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-28 14:16 [PATCH 0/1] fixing initrd mounts w/ spaces fail to move to real rootfs Arsalan Awan
2018-06-28 14:16 ` [PATCH 1/1] initrdscripts/init-live.sh: fix " Arsalan Awan
2018-11-28 11:07   ` Awan, Arsalan
2018-07-13 11:07 ` [PATCH 0/1] fixing initrd " Awan, Arsalan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox