Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 305787

Summary: AttributeError: 'module' object has no attribute 'userpriv_groups'
Product: Portage Development Reporter: Noah McNallie <n0ah>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: major CC: rain
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: Sparc   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 335925    
Attachments: fix the AttributeError

Description Noah McNallie 2010-02-18 18:03:53 UTC
* i'm not sure if this is considered sparc or sparc64 as the kernel is sparc64 yet userland is sparc, including python.

i have a fresh install, after emerging gentoo-sources and compiling my adequate kernel i'm trying to remove gentoo-sources as this machine is an ultra 30 300MHz sparc64 2MB L2 cache with 512MB and only 4.2GB of disk (only about 3.9 usable). So any freed up room is pretty much a requirement here.

-- BEGIN UNEMERGE --
ark ~ # emerge --unmerge gentoo-sources
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in <module>
    from _emerge.main import emerge_main
  File "/usr/lib/portage/pym/_emerge/main.py", line 17, in <module>
    import portage
  File "/usr/lib/portage/pym/portage/__init__.py", line 8758, in <module>
    from portage.dbapi.vartree import vardbapi, vartree, dblink
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 28, in <module>
    from portage.data import portage_gid, portage_uid, secpass
  File "/usr/lib/portage/pym/portage/data.py", line 88, in <module>
    _("portage: 'portage' user or group missing.")) + "\n", noiselevel=-1)
  File "/usr/lib/portage/pym/portage/proxy/objectproxy.py", line 31, in __call__
    result = object.__getattribute__(self, '_get_target')()
  File "/usr/lib/portage/pym/portage/proxy/lazyimport.py", line 110, in _get_target
    _unregister_module_proxy(name)
  File "/usr/lib/portage/pym/portage/proxy/lazyimport.py", line 61, in _unregister_module_proxy
    object.__getattribute__(proxy, '_get_target')()
  File "/usr/lib/portage/pym/portage/proxy/lazyimport.py", line 106, in _get_target
    target = getattr(sys.modules[name], attr_name)
AttributeError: 'module' object has no attribute 'userpriv_groups'
ark ~ #
-- END UNEMERGE -- 

i'm guessing this has to do with something i've done strange, as i'm not too familiar with linux since i've been using solaris/bsd the past years, i don't know what it is. i'm thinking it has something to do with missing groups for some reason? because the only other error i'm getting with this installation is on boot, udevd spits out a bunch of 'unknown group' messages to the console about group 'tape' and 'disk' and 'cdrom' and 'video' and some more. 

please help!

n0ah



Reproducible: Always

Steps to Reproduce:
1. run emerge --unmerge gentoo-sources on my installation
2.
3.

Actual Results:  
i get the error described above

Expected Results:  
for it to unmerge gentoo-sources

sparc
Comment 1 Zac Medico gentoo-dev 2010-02-18 18:47:50 UTC
Created attachment 220205 [details, diff]
fix the AttributeError

Save as /tmp/userpriv_groups.patch and apply as follows:

  patch /usr/lib/portage/pym/portage/data.py /tmp/userpriv_groups.patch
Comment 2 Noah McNallie 2010-02-18 18:54:57 UTC
(In reply to comment #1)
> Created an attachment (id=220205) [details]
> fix the AttributeError
> 
> Save as /tmp/userpriv_groups.patch and apply as follows:
> 
>   patch /usr/lib/portage/pym/portage/data.py /tmp/userpriv_groups.patch
> 

now i get this, should i change it back and add the group or keep the patch (though the unmerge seems to be working in progress)

-- BEGIN PORTAGE OUTPUT --
portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.
-- END PORTAGE OUTPUT -- 

Comment 3 Noah McNallie 2010-02-18 18:55:25 UTC
why are all my groups missing?
Comment 4 Zac Medico gentoo-dev 2010-02-18 18:57:50 UTC
Maybe /etc/group got corrupted somehow?
Comment 5 Zdenek Behan 2010-02-22 03:51:21 UTC
I bumped into this installing @system on a (very) bare system, basically from scratch.

I verified that the patch indeed fixes it; Also, I'd like to note that merely remerging @system will reconstruct the most basic /etc/passwd and /etc/group contents, as part of the post-install functions of certain ebuilds (not sure which ones), in fact most of the basic /etc configs can be reconstructed this way, so it would seem to make sense to make portage immune to deficiency of those (or similar) seemingly vital files in general, setting up some sane defaults and carrying on. (which is what the patch does for /etc/group)