Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547390 - sys-apps/portage-2.2.14 has overly aggressive read-only filesystem checks
Summary: sys-apps/portage-2.2.14 has overly aggressive read-only filesystem checks
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2015-04-22 10:16 UTC by Stuart Shelton
Modified: 2015-05-19 19:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2015-04-22 10:16:17 UTC
After attempting to emerge sys-apps/man-pages, an ebuild which only installs data beneath /usr/share, I get the following fatal error:

 * One or more files installed to this package are set to be installed to
 * read-only filesystems. Please mount the following filesystems as read-
 * write and retry.
 * 
 *      /
 * 

... and to confirm:

$ grep -v '/usr/' /var/db/pkg/sys-apps/man-pages-3.82/CONTENTS
dir /usr

... so this is correct, in that '/' is read-only.  However, '/usr' (as well as '/var', for 'db/pkg') are writable.  Even if, for performance reasons, the read-only check can't examine every path that an ebuild installs files to (although getting a list of mount-points and then resolving paths from ${D} against them seems fairly do-able) then checking for common mount-points such as this would seem to be beneficial.

(Is the problem actually that single '/usr' entry above lives in '/', and therefore '/' must be writable in case '/usr' doesn't exist?  In this case, directories which already exist (with appropriate permissions? ... and possibly unchanged files also?) could be removed from the list of items checked by the read-only test.  It might also be helpful, if this doesn't already exist for debug purposes, to list /which/ files would be installed to a read-only filesystem if the install were to be allowed to proceed.)
Comment 1 Zac Medico gentoo-dev 2015-04-26 23:18:48 UTC
Yes, the current logic is extremely flawed.

A really simple fix would be to use os.stat(path).st_dev to get the unique device number of each read-only directory, and then search for files that would be merged on a read-only device.
Comment 2 Zac Medico gentoo-dev 2015-04-27 03:27:59 UTC
There's a patch in the following branch:

https://github.com/zmedico/portage/tree/bug_547390

It's fixed to check only if the nearest parent directory is writable.
Comment 3 Zac Medico gentoo-dev 2015-04-27 04:19:26 UTC
(In reply to Stuart Shelton from comment #0)
> It might also be helpful, if this doesn't
> already exist for debug purposes, to list /which/ files would be installed
> to a read-only filesystem if the install were to be allowed to proceed.)

The current patch shows only the nearest existing parent directories of those files.
Comment 4 Zac Medico gentoo-dev 2015-04-27 04:33:17 UTC
(In reply to Zac Medico from comment #3)
> The current patch shows only the nearest existing parent directories of
> those files.

Now it only shows paths from mountinfo, which is more consistent with the existing output.
Comment 5 Zac Medico gentoo-dev 2015-04-27 16:20:02 UTC
You can install my branch for testing purposes like this:

portage_LIVE_REPO=https://github.com/zmedico/portage.git \
portage_LIVE_BRANCH=bug_547390 \
ACCEPT_KEYWORDS="**" emerge --oneshot =sys-apps/portage-9999
Comment 7 Brian Dolbec gentoo-dev 2015-05-19 19:44:41 UTC
Released in portage-2.2.19