It looks like there are utf8 issues with the selinux code. When I try to merge I get errors like: >>> Fetching (1 of 1) media-sound/rhythmbox-0.12.3-r1 Traceback (most recent call last): File "/usr/bin/emerge", line 40, in <module> retval = emerge_main() File "/usr/lib64/portage/pym/_emerge/main.py", line 1397, in emerge_main myopts, myaction, myfiles, spinner) File "/usr/lib64/portage/pym/_emerge/actions.py", line 463, in action_build retval = mergetask.merge() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 821, in merge rval = self._merge() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1125, in _merge self._main_loop() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1253, in _main_loop while self._schedule(): File "/usr/lib64/portage/pym/_emerge/PollScheduler.py", line 43, in _schedule return self._schedule_tasks() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1284, in _schedule_tasks if q.schedule(): File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 55, in schedule task.start() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start self._start() File "/usr/lib64/portage/pym/_emerge/MergeListItem.py", line 92, in _start self._start_task(build, self._default_final_exit) File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 118, in _start_task task.start() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start self._start() File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 70, in _start self._prefetch_exit(prefetcher) File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 83, in _prefetch_exit retval = fetcher.execute() File "/usr/lib64/portage/pym/_emerge/EbuildFetchonly.py", line 34, in execute mydbapi=portdb, tree="porttree") File "/usr/lib64/portage/pym/portage/__init__.py", line 6417, in doebuild fetchme, mysettings, listonly=listonly, fetchonly=fetchonly): File "/usr/lib64/portage/pym/portage/__init__.py", line 3981, in fetch if _userpriv_test_write_file(mysettings, write_test_file): File "/usr/lib64/portage/pym/portage/__init__.py", line 3616, in _userpriv_test_write_file returncode = _spawn_fetch(settings, args) File "/usr/lib64/portage/pym/portage/__init__.py", line 3579, in _spawn_fetch selinux.setexec(con) File "/usr/lib64/portage/pym/portage/_selinux.py", line 65, in setexec if selinux.setexeccon(ctx) < 0: TypeError: in method 'setexeccon', argument 1 of type 'security_context_t' where security_context_t is just a typedef of char *. The attached patch seems to fix it by adding additional ctx.encode("utf_8", "replace") calls like were added to the other functions. It also pushes a little more selinux stuff out of __init__.py into _selinux.py.
Created attachment 200842 [details, diff] portage-selinux-2.2rc38.diff
Thanks, this is in svn r13977.
After running into this bug I was unable to use portage to downgrade to a functional version of portage. So I downloaded the patch and applied it manually. Now I get a different error: >>> Emerging (1 of 53) media-sound/alsa-headers-1.0.20 >>> Downloading 'http://gentoo.chem.wisc.edu/gentoo/distfiles/alsa-driver-1.0.20.tar.bz2' Traceback (most recent call last): File "/usr/lib64/portage/bin/ebuild", line 249, in <module> debug=debug, tree=mytree) File "/usr/lib64/portage/pym/portage/__init__.py", line 6414, in doebuild fetchme, mysettings, listonly=listonly, fetchonly=fetchonly): File "/usr/lib64/portage/pym/portage/__init__.py", line 4419, in fetch myret = _spawn_fetch(mysettings, myfetch) File "/usr/lib64/portage/pym/portage/__init__.py", line 3576, in _spawn_fetch selinux.setexec(con) File "/usr/lib64/portage/pym/portage/_selinux.py", line 73, in setexec raise OSError("setexec: Failed setting exec() context \"%s\"." % ctx) OSError: setexec: Failed setting exec() context "user_u:user_r:portage_fetch_t". * Fetch failed for 'media-sound/alsa-headers-1.0.20', Log file: * '/var/tmp/portage/media-sound/alsa-headers-1.0.20/temp/build.log' I tried to correct this by running rlpkg to restore the security context for the newly patched files, but that didn't help. Downgrading to an old version of portage still fails. Do you have any advice as how to proceed?
(In reply to comment #3) > Do you have any advice as how to proceed? I'd recommend either portage-2.1.6.13 or 2.2_rc33. If it's too broken to install itself then you can do it manually: http://www.gentoo.org/proj/en/portage/doc/manually-fixing-portage.xml
(In reply to comment #3) > After running into this bug I was unable to use portage to downgrade to a > functional version of portage. So I downloaded the patch and applied it > manually. > Now I get a different error: [...] > OSError: setexec: Failed setting exec() context > "user_u:user_r:portage_fetch_t". This is not a portage error, you are running portage in the wrong role. You should be using sysadm_r or unconfined_r.
This is fixed in 2.2_rc39.