Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 489520 - sys-libs/glibc devpts check fails with <linux-2.6.25 kernels
Summary: sys-libs/glibc devpts check fails with <linux-2.6.25 kernels
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-27 00:06 UTC by William Throwe
Modified: 2014-06-14 23:28 UTC (History)
2 users (show)

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


Attachments
pkg_preinst patch (489520.patch,927 bytes, patch)
2013-11-10 07:33 UTC, William Throwe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description William Throwe 2013-10-27 00:06:16 UTC
On machines with ancient kernels not including https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b87a267eb7291d075df76ebabd43c7f961b12f67 (like RHEL5), /proc/mounts does not include mount options for devpts, so when trying to set up a RAP prefix on these machines the test at the end of sys-libs/glibc/files/eblits/pkg_preinst.eblit fails:

    # Make sure devpts is mounted correctly for use w/out setuid pt_chown.
    if in_iuse suid && ! use suid ; then
        if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
            eerror "In order to use glibc with USE=-suid, you must make sure that"
            eerror "you have devpts mounted at /dev/pts with the gid=5 option."
            eerror "Openrc should do this for you, so you should check /etc/fstab"
            eerror "and make sure you do not have any invalid settings there."
            die "mount & fix your /dev/pts settings"
        fi
    fi

A possible solution is to check /etc/mtab in addition to /proc/mounts and only fail if the option is missing from both files.

$ grep devpts /proc/mounts
devpts /dev/pts devpts rw 0 0
$ grep devpts /etc/mtab
devpts /dev/pts devpts rw,gid=5,mode=620 0 0

$ uname -r
2.6.18-308.11.1.el5PAE

I suspect this would also affect non-prefix if someone was running a 5-year-old kernel on a normal Gentoo system.
Comment 1 William Throwe 2013-11-10 07:33:52 UTC
Created attachment 362948 [details, diff]
pkg_preinst patch

After thinking about this for a while I'm worried that checking /etc/mtab might break chroot installs or some other corner case I'm not thinking of, so I propose instead just skipping the /proc/mounts test for kernels that are too old.

The attached patch only contains the changes to the eblit.  The ebuilds also need to be modified to inherit linux-info.
Comment 2 John M. Drescher 2013-12-02 17:05:40 UTC
This is failing for me with openrc-0.12.X and 3.11.X.

datastore4 ~ # grep devpts /proc/mounts
devpts /dev/pts devpts rw,relatime,mode=600,ptmxmode=000 0 0
datastore4 ~ # grep devpts /etc/mtab
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
datastore4 ~ # uname -a
Linux datastore4 3.11.5-gentoo-datastore4 #1 SMP Wed Oct 16 12:29:53 EDT 2013 x8                                                              6_64 Intel(R) Xeon(R) CPU E31230 @ 3.20GHz GenuineIntel GNU/Linux
Comment 3 John M. Drescher 2013-12-03 18:04:32 UTC
For me the failure appears to be caused by lxc. 

http://forums.gentoo.org/viewtopic-t-977048-highlight-.html
Comment 4 Jan Matějka (RETIRED) gentoo-dev 2013-12-07 15:41:10 UTC
I'm experiencing this on normal amd64 gentoo too.

root@swanson.yac # grep pts /etc/mtab
/dev/pts /dev/pts devpts rw,relatime,mode=600 0 0
root@swanson.yac # grep pts /etc/fstab
/dev/pts                /dev/pts        devpts          defaults        0 
root@swanson.yac # uname -a
Linux swanson.yac 3.6.11-gentoo #4 SMP Sat Aug 24 02:53:37 CEST 2013 x86_64 Intel(R) Core(TM) i5-4570S CPU @ 2.90GHz GenuineIntel GNU/Linux
Comment 5 Jan Matějka (RETIRED) gentoo-dev 2013-12-07 15:43:14 UTC
maybe in my case it is because this is ancient system and I shouldn't have pts in fstab anymore.
Comment 6 Jan Matějka (RETIRED) gentoo-dev 2013-12-07 16:32:59 UTC
running::

    umount -l /dev/pts; mount devpts -t devpts /dev/pts -o rw,nosuid,noexec,relatime,gid=5,mode=620

fixed it for me.
Comment 7 SpanKY gentoo-dev 2014-03-14 00:28:04 UTC
Comment on attachment 362948 [details, diff]
pkg_preinst patch

unfortunately, yes, we cannot rely on /etc/mtab being correct.  if you do `mount -t devpts /foo`, you will break the mount options of /dev/dpts too (as all devpts instances are shared).  or if someone does a remount with the -n flag.
Comment 8 SpanKY gentoo-dev 2014-03-14 00:32:23 UTC
(In reply to William Throwe from comment #0)

that commit made it into 2.6.25.  the # of people who are using <2.6.25 is probably low, so we could just make it into a warning if your kernel is that old and hope for the best.
Comment 9 Jan Matějka (RETIRED) gentoo-dev 2014-03-15 18:54:16 UTC
I hit it again but now I at least know what may be causing messages::

    root@swanson.yac # xsel -b
    xsel: Can't open display: (null)
    : Success

It started right after the failed install of glibc.

Would it be possible to add a check on the proper devpts, *before* the glibc is compiled so it fails fast?
Comment 10 Jan Matějka (RETIRED) gentoo-dev 2014-03-15 18:58:11 UTC
Oh wait, I'm being an idiot, the xsel error is unrelated but the rest is still valid.
Comment 11 SpanKY gentoo-dev 2014-06-14 23:28:51 UTC
should be all set now in the tree; thanks for the report!

Commit message: Do not die when the devpts check fails and we are on an old kernel
http://sources.gentoo.org/sys-libs/glibc/files/eblits/pkg_preinst.eblit?r1=1.11&r2=1.12