# błędy portage, problemy z pythonem i aktualizacją systemu

## zygikuleczka

Witam, długo nie aktualizowałem systemu i teraz mam masę problemów także nawet nie wiadomo od czego zacząć:

jako pierwsze zauważyłem błędy wynikające z wersji pythona aktywnej w systemie:

```
eselect python list

Available Python interpreters:

  [1]   python2.7 *

  [2]   python3.3

  [3]   python3.4
```

jeśli jest ta wersja ustawiona(wcześniej miałem i używałem tych nowszch) przy próbie emergowania czegokolwiek pokazuje się błąd:

```
[ebuild   R    ] sys-fs/ncdu-1.10  129 KiB

Total: 1 package (1 reinstall), Size of downloads: 129 KiB

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-fs/ncdu-1.10::gentoo

[sys-fs/ncdu-1.10] bash: /usr/lib/portage/python2.7/ebuild.sh: No such file or directory

 * The ebuild phase 'die_hooks' has been aborted since PORTAGE_BUILDDIR

 * does not exist: '/var/tmp/portage/sys-fs/ncdu-1.10'

>>> Failed to emerge sys-fs/ncdu-1.10
```

po przełączeniu na wersję 3.3 i puszczeniu python-updater pojawia się:

```
# python-updater

Traceback (most recent call last):

  File "/usr/lib/python-exec/python3.3/portageq", line 1206, in <module>

    commands = sorted(k for k, v in globals().items() \

  File "/usr/lib/python-exec/python3.3/portageq", line 1207, in <genexpr>

    if k not in non_commands and isinstance(v, types.FunctionType) and v.__module__ == "__main__")

  File "/usr/lib64/python3.3/site-packages/portage/proxy/objectproxy.py", line 22, in __getattribute__

    result = object.__getattribute__(self, '_get_target')()

  File "/usr/lib64/python3.3/site-packages/portage/proxy/lazyimport.py", line 130, in _get_target

    __import__(name)

  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load

  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper

  File "<frozen importlib._bootstrap>", line 1022, in load_module

  File "<frozen importlib._bootstrap>", line 1003, in load_module

  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper

  File "<frozen importlib._bootstrap>", line 853, in _load_module

  File "<frozen importlib._bootstrap>", line 967, in get_code

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 4: invalid start byte

Traceback (most recent call last):

  File "/usr/lib/python-exec/python3.3/portageq", line 1206, in <module>

    commands = sorted(k for k, v in globals().items() \

  File "/usr/lib/python-exec/python3.3/portageq", line 1207, in <genexpr>

    if k not in non_commands and isinstance(v, types.FunctionType) and v.__module__ == "__main__")

  File "/usr/lib64/python3.3/site-packages/portage/proxy/objectproxy.py", line 22, in __getattribute__

    result = object.__getattribute__(self, '_get_target')()

  File "/usr/lib64/python3.3/site-packages/portage/proxy/lazyimport.py", line 130, in _get_target

    __import__(name)

  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load

  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper

  File "<frozen importlib._bootstrap>", line 1022, in load_module

  File "<frozen importlib._bootstrap>", line 1003, in load_module

  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper

  File "<frozen importlib._bootstrap>", line 853, in _load_module

  File "<frozen importlib._bootstrap>", line 967, in get_code

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 4: invalid start byte

 * Python 2 and Python 3 not installed
```

a emerge wykazuje

```
Traceback (most recent call last):

  File "/usr/bin/emerge", line 50, in <module>

    retval = emerge_main()

  File "/usr/lib64/python3.3/site-packages/_emerge/main.py", line 1055, in emerge_main

    action=myaction, args=myfiles, opts=myopts)

  File "/usr/lib64/python3.3/site-packages/portage/proxy/objectproxy.py", line 30, in __call__

    result = object.__getattribute__(self, '_get_target')()

  File "/usr/lib64/python3.3/site-packages/portage/proxy/lazyimport.py", line 130, in _get_target

    __import__(name)

  File "/usr/lib64/python3.3/site-packages/_emerge/actions.py", line 70, in <module>

    from _emerge.depgraph import backtrack_depgraph, depgraph, resume_depgraph

  File "/usr/lib64/python3.3/site-packages/_emerge/depgraph.py", line 35, in <module>

    from portage.package.ebuild.config import _get_feature_flags

  File "/usr/lib64/python3.3/site-packages/portage/package/ebuild/config.py", line 63, in <module>

    from portage.package.ebuild._config.unpack_dependencies import load_unpack_dependencies_configuration

  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load

  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper

  File "<frozen importlib._bootstrap>", line 1022, in load_module

  File "<frozen importlib._bootstrap>", line 1003, in load_module

  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper

  File "<frozen importlib._bootstrap>", line 853, in _load_module

  File "<frozen importlib._bootstrap>", line 967, in get_code

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 4: invalid start byte
```

na wersji 3.4 python updater znajduje program mirage do updatowania ale nie robi aktualizacji bo wykazuje błąd:

```
  File "/usr/bin/emerge", line 41, in <module>

    import portage

ImportError: No module named 'portage'
```

i taki też pojawia się przy wywołaniu emerge z dowolną opcją.

```
emerge --info

Portage 2.2.14 (python 2.7.8-final-0, default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.20, 3.16.1-aufs x86_64)

=================================================================

System uname: Linux-3.16.1-aufs-x86_64-Intel-R-_Core-TM-_i5-2500K_CPU_@_3.30GHz-with-gentoo-2.2

KiB Mem:     4025720 total,     82764 free

KiB Swap:     995992 total,    981908 free

Timestamp of tree: Tue, 06 Jan 2015 10:15:01 +0000

ld GNU ld (Gentoo 2.24 p1.4) 2.24

app-shells/bash:          4.3_p30-r1

dev-java/java-config:     2.2.0

dev-lang/perl:            5.20.1-r3

dev-lang/python:          2.7.8, 3.3.5-r1, 3.4.2

dev-util/cmake:           3.0.2

dev-util/pkgconfig:       0.28-r2

sys-apps/baselayout:      2.2

sys-apps/openrc:          0.13.4

sys-apps/sandbox:         2.6-r1

sys-devel/autoconf:       2.13, 2.69

sys-devel/automake:       1.11.6, 1.14.1

sys-devel/binutils:       2.24-r3

sys-devel/gcc:            4.8.3

sys-devel/gcc-config:     1.8

sys-devel/libtool:        2.4.3-r2

sys-devel/make:           4.1-r1

sys-kernel/linux-headers: 3.17-r1 (virtual/os-headers)

sys-libs/glibc:           2.20

Repositories: gentoo x-portage

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -fomit-frame-pointer -march=native"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=native"

DISTDIR="/var/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://gentoo.mirror.pw.edu.pl/ http://gentoo.kiev.ua/ftp/ http://gentoo.supp.name/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j5"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cleartype cli consolekit cracklib crypt cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gadu gdbm gif glamor gpm gtk iconv ipv6 java jimtcl jpeg kernel-patch lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg multilib ncurses nls nptl nsplugin odbc ogg opengl openmp pam pango pcre pdf png policykit ppds python2 qt3support qt4 readline sdl sensord session spell spice sse sse2 ssl startup-notification svg symlink tcpd tiff truetype udev udisks unicode upcall upower usb vdpau vorbis wxwidgets x264 xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="devinput" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

USE_PYTHON="2.7 3.3"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

Jeśli nie ustawić zmiennej USE_PYTHON sytuacja wygląda dokładnie tak samo, podobnie w przypadku zmian opcji PYTHON_SINGLE_TARGET i PYTHON_TARGETS.

W przypadku opcji ACCEPT_KEYWORDS="amd64 ~amd64" zawsze miałem tylko niestabilną ustawioną i w make.conf widnieje jedna gałąź.

Pomóżcie proszę co z tym zrobić i uratować system.

----------

## zygikuleczka

Z błędami tu opisanymi już mam sprawę rozwiązaną, jednak nadal przy próbie kompilacji na każdej jednej paczce coś się wywala:

```
Using Python from environment variable $PYTHON

Creating Python environment

Traceback (most recent call last):

  File "/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/python/virtualenv/virtualenv.py", line 21, in <module>

    from distutils.util import strtobool

  File "/usr/lib64/python2.7/distutils/util.py", line 12, in <module>

    from distutils.spawn import spawn

  File "/usr/lib64/python2.7/distutils/spawn.py", line 16, in <module>

    from distutils import log

ValueError: bad marshal data (unknown type code)

Traceback (most recent call last):

  File "/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/python/mozbuild/mozbuild/virtualenv.py", line 473, in <module>

    manager.ensure()

  File "/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/python/mozbuild/mozbuild/virtualenv.py", line 128, in ensure

    return self.build()

  File "/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/python/mozbuild/mozbuild/virtualenv.py", line 371, in build

    self.create()

  File "/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/python/mozbuild/mozbuild/virtualenv.py", line 147, in create

    raise Exception('Error creating virtualenv.')

Exception: Error creating virtualenv.

------ config.log ------

This file contains any messages produced by compilers while

running configure, to aid debugging if configure makes a mistake.

configure:1184: checking host system type

configure:1205: checking target system type

configure:1223: checking build system type

configure:1299: checking for mawk

configure:1299: checking for gawk

*** Fix above errors and then restart with\

               "make -f client.mk build"

/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/client.mk:361: recipe for target 'configure' failed

make[2]: *** [configure] Error 1

make[2]: Leaving directory '/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release'

/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/client.mk:375: recipe for target '/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/ff/Makefile' failed

make[1]: *** [/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release/ff/Makefile] Error 2

make[1]: Leaving directory '/var/tmp/portage/www-client/firefox-34.0.5-r1/work/mozilla-release'

client.mk:171: recipe for target 'build' failed

make: *** [build] Error 2

 * ERROR: www-client/firefox-34.0.5-r1::gentoo failed (compile phase):

 *   emake failed
```

Może ktoś coś podpowie...

----------

## Jacekalex

Wersje pythona, to nie majtki, żeby je zmieniać co chwila.

Po każdej zmianie domyślnej wersji Pythona musisz  odpalić z roota:

```
python-updater
```

To by było na tyle

 :Cool: 

----------

