Skip to contentSkip to conversation

base-files: remove symbolic link from /etc/mtab to /proc/mounts

PATCH In review Chunrong Guo 5 participants 6 messages Jul 31, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base-files: remove symbolic link from /etc/mtab to /proc/mounts

*If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error. As a consequence, the Private directory is unusable because /proc/self/mounts is read-only feature.

---
 meta/recipes-core/base-files/base-files_3.0.14.bb |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -1
index 054fefa..1843bdd 100644
@@ -100,7 +100,6 @@ do_install () {
 	install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
 	install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
 
-	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
 }
 
 do_install_basefilesissue () {
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 4 lines · Chunrong Guo

*If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error. As a consequence, the Private directory is unusable because /proc/self/mounts is read-only feature.

Could you please detail your environment a little bit? Where does this error come from?

Besides, if you're going to make this change, please take a read-only rootfs into consideration. There should be more to fix.

Best Regards,
Chen Qi

Quoted 17 lines
---
  meta/recipes-core/base-files/base-files_3.0.14.bb |    1 -
  1 files changed, 0 insertions(+), 1 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -1
index 054fefa..1843bdd 100644
@@ -100,7 +100,6 @@ do_install () {
  	install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
  	install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
 
-	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
  }
 
  do_install_basefilesissue () {
#2 lore raw
Quoted 9 lines · ChenQi
Quoted 4 lines · Chunrong Guo

*If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error. As a consequence, the Private directory is unusable because /proc/self/mounts is read-only feature.

Could you please detail your environment a little bit? Where does this error come from?

I'm curios as well. Also can you please test this on a real hw? Try to boot and/or install an image on atom-pc, I suspect it will fail.

Thanks,
Stefan

Quoted 28 lines

Besides, if you're going to make this change, please take a read-only rootfs into consideration. There should be more to fix.

Best Regards,
Chen Qi

Quoted 10 lines
---
  meta/recipes-core/base-files/base-files_3.0.14.bb |    1 -
  1 files changed, 0 insertions(+), 1 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -0
index 054fefa..1843bdd 100644

meta/recipes-core/base-files/base-files_3.0.14.bb do_install () { · line 105

Quoted 7 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -1
@@ -100,7 +100,6 @@ do_install () {
  	install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
  	install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
 
-	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
  }
 
  do_install_basefilesissue () {

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

#3 lore raw
In reply to ChenQi

Hello,

I add libhugetlbfs package into my rootfs and run the below command in my board .

root@p1021rdb:~# hugeadm --create-mounts
    hugeadm:WARNING: Unable to add entry /var/lib/hugetlbfs/pagesize-4MB to /etc/mtab, error: Invalid argument
    hugeadm:WARNING: Unable to add entry /var/lib/hugetlbfs/pagesize-16MB to /etc/mtab, error: Invalid argument
root@p1022ds:~# ls /etc/mtab -l
lrwxrwxrwx 1 root root 12 Jul 31 07:28 /etc/mtab -> /proc/mounts
root@p1022ds:~# ls /proc/mounts 
/proc/mounts
root@p1022ds:~# ls /proc/mounts -l
lrwxrwxrwx 1 root root 11 Jul 31 07:58 /proc/mounts -> self/mounts

thanks,
chunrong

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of ChenQi
Sent: Wednesday, July 31, 2013 4:47 PM
To: [email protected]
Subject: Re: [OE-core] [PATCH] base-files: remove symbolic link from /etc/mtab to /proc/mounts

Quoted 4 lines · Chunrong Guo

*If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error. As a consequence, the Private directory is unusable because /proc/self/mounts is read-only feature.

Could you please detail your environment a little bit? Where does this error come from?

Besides, if you're going to make this change, please take a read-only rootfs into consideration. There should be more to fix.

Best Regards,
Chen Qi

Quoted 11 lines
---
  meta/recipes-core/base-files/base-files_3.0.14.bb |    1 -
  1 files changed, 0 insertions(+), 1 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -0
index 054fefa..1843bdd 100644

meta/recipes-core/base-files/base-files_3.0.14.bb do_install () { · line 105

Quoted 7 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -1
@@ -100,7 +100,6 @@ do_install () {
  	install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
  	install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
 
-	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
  }
 
  do_install_basefilesissue () {

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

#4 lore raw
Quoted 6 lines · On 7/31/13 4:16 AM, Guo Chunrong-B40290 wrote:

Hello,

I add libhugetlbfs package into my rootfs and run the below command in my board .

root@p1021rdb:~# hugeadm --create-mounts
     hugeadm:WARNING: Unable to add entry /var/lib/hugetlbfs/pagesize-4MB to /etc/mtab, error: Invalid argument
     hugeadm:WARNING: Unable to add entry /var/lib/hugetlbfs/pagesize-16MB to /etc/mtab, error: Invalid argument

This looks like the hugeadm may be broken in some way. The writing to the mounts and behavior should be based on the way the standard mount does it.

If the hugeadm uses standard mount resources, then the entries it adds should have showed up into the /proc/mounts automatically.

--Mark

Quoted 64 lines
root@p1022ds:~# ls /etc/mtab -l
lrwxrwxrwx 1 root root 12 Jul 31 07:28 /etc/mtab -> /proc/mounts
root@p1022ds:~# ls /proc/mounts
/proc/mounts
root@p1022ds:~# ls /proc/mounts -l
lrwxrwxrwx 1 root root 11 Jul 31 07:58 /proc/mounts -> self/mounts

thanks,
chunrong

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of ChenQi
Sent: Wednesday, July 31, 2013 4:47 PM
To: [email protected]
Subject: Re: [OE-core] [PATCH] base-files: remove symbolic link from /etc/mtab to /proc/mounts

Quoted 4 lines · Chunrong Guo

*If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error. As a consequence, the Private directory is unusable because /proc/self/mounts is read-only feature.

Could you please detail your environment a little bit? Where does this error come from?

Besides, if you're going to make this change, please take a read-only rootfs into consideration. There should be more to fix.

Best Regards,
Chen Qi

Quoted 11 lines
---
   meta/recipes-core/base-files/base-files_3.0.14.bb |    1 -
   1 files changed, 0 insertions(+), 1 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -0
index 054fefa..1843bdd 100644

meta/recipes-core/base-files/base-files_3.0.14.bb do_install () { · line 105

Quoted 7 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -1
@@ -100,7 +100,6 @@ do_install () {
   	install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
   	install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
 
-	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
   }
 
   do_install_basefilesissue () {

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

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

#5 lore raw
In reply to Chunrong Guo
Quoted 4 lines · Chunrong Guo

*If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error. As a consequence, the Private directory is unusable because /proc/self/mounts is read-only feature.

This looks like it will break anything with a READ_ONLY_ROOTFS since now mtab won't exist and there will be no way for it to get created.

I'm not quite sure I understand what problem you're trying to fix (since I can't immediately think of any situation where calling addmntent() is a sensible thing to do) but, whatever the problem is, I don't think that unilaterally removing /etc/mtab is a good way to go about fixing it.

p.