Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Downgrading glibc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Fri Sep 17, 2010 1:48 pm    Post subject: Downgrading glibc Reply with quote

I wonder why i only make topics for crazy weirdos that will break their gentoo...
But here's another "breakmygentoo" thread.

Downgrading glibc is really something you shouldn't do, as it will certainly break your gentoo but if you're like me and know that you will certainly break your gentoo BUT really wish to downgrade glibc anyway, here's how you can do it.

Portage will refuse to do it and stop with a security error message you should really follow instead of this thread.

WARNING: DO NOT DO THIS EXCEPT IF YOU CLEARLY UNDERSTAND THAT YOUR GENTOO WILL BE BROKEN !

So the purpose of this thread is to disable portage security and do downgrade your glibc (and i do hope you know well how your system works else you will just break your gentoo)

In my example i'll switch back from glibc-2.12.1-r1 to glibc-2.11.2

You will have good chance to success if you're just trying to get back to a previous glibc version your system was using, but if you are trying to downgrade to a previous glibc version nothing was build against, you're in the best path to break your system.

You have some safer (if downgrading glibc could be considered safe) ways to do that using another glibc version put on a directory to work with it... But this way is the gentoo way (by gentoo way, i'm not saying gentoo way to do it, as gentoo way is clear: portage don't allow you to do that ! But gentoo way as "doing it with portage"), to just let portage undo a bad glibc upgrade you didn't catch.


0: you better build a livecd, because chance you'll kill your gentoo are more than high

1: backup gcc & glibc
Code:
quickpkg gcc glibc


2: you should find a gcc that was built with the previous glibc, it's best way to success
If you don't know if you have a gcc that was built against a previous glibc then you will get in trouble as you should know what you are doing, else you can try finding it with genlop
2a: finding where the "bad" glibc was emerge
Code:
genlop -t glibc
     Fri Sep 17 00:55:01 2010 >>> sys-libs/glibc-2.12.1-r1
       merge time: 14 minutes and 40 seconds.

2b: same but for gcc
Code:
genlop -t gcc
     Thu Jul 15 13:25:12 2010 >>> sys-devel/gcc-4.3.2-r4
       merge time: 19 minutes and 44 seconds.

As that gcc version was emerge before the glibc one, it means it still use a previous glibc version, good candidate for me (even i didn't took time to check what glibc was used to build that one at that time, but hey! If you're still reading this, you should know you don't really care to break your gentoo

step3: optional, but this will prevent you getting again in trouble later, mask that fu@@@@@ glibc version
Code:
echo ">sys-libs/glibc-2.12.1" >> /etc/portage/package.mask

(check with an emerge -pv glibc run after that your masking is good, this one work to mask it because 2.12.1-r1 and no 2.12.1 exist)

step4: removing portage security
Code:
cd /usr/portage/sys-libs/glibc/files/eblits
nano pkg_setup.eblit

Now you'll have to find the checking, line 12 for me, you should see the portage warning
Code:
                        eerror "Sanity check to keep you from breaking your sys$
                        eerror " Downgrading glibc is not supported and a sure $
                        die "aborting to save your system" 

Just disable the die (a simple # to comment it out), message will still be output, but portage will continue so. Line will look like that then
Code:
#                        die "aborting to save your system"


step5: now bypass the portage checksum security
Code:
cd ../..
pwd
## just to output where you should be now
/usr/portage/sys-libs/glibc
ebuild glibc-2.11.2.ebuild digest
>>> Creating Manifest for /usr/portage/sys-libs/glibc


step6: switch to your "should work" gcc version
Code:
gcc-config i686-pc-linux-gnu-4.3.2
source /etc/profile


step7: downgrading glibc THIS IS YOUR LAST CHANCE TO STOP THE CARNAGE !
Code:
emerge -1 glibc


step8: cleaning your toolchain (if you're lucky enough)
Code:
emerge -1 gcc && emerge -1 glibc && emerge -1 gcc


step9:
9a: resync your tree to remove the changes you've made to the manifest & eblit file
9b emerge -e world or look for the thread i've made to rebuild only package that were build against the "bad" glibc version. ->> https://forums.gentoo.org/viewtopic-t-842667.html



If something goes bad, you can still use "emerge -k gcc/glibc" you've backup or you're dead and need tinderbox/livecd help.
Don't say you've didn't get warn before...
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Fri Sep 17, 2010 3:21 pm    Post subject: Re: Downgrading glibc Reply with quote

<trolling>
krinn wrote:
I wonder why i only make topics for crazy weirdos that will break their gentoo...

Being personally a krinn's topics reader, I take this as a personal attack I think I should report against ! :wink:
krinn wrote:
But here's another "breakmygentoo" thread.

What do you mean by another ? (Monty python 4.3 intonation)
Should I understand that the preceeding advice you gave me and other crazy-weirdos (while we were not known by ourselves as crazy-weirdos) was a trick to break our gentoo ?
Hmmm... should report you for this. :evil:
krinn wrote:
Downgrading glibc is really something you shouldn't do

Hmmm... who wrote recently some kind of howto I had personally found very interesting about how to restore a system to the state it had on a certain date ?
=> potentially downgrading glibc ? :twisted:
krinn wrote:
]Portage will refuse to do it and stop with a security error message you should really follow instead of this thread.
WARNING: DO NOT DO THIS EXCEPT IF YOU CLEARLY UNDERSTAND THAT YOUR GENTOO WILL BE BROKEN !

Gonna fill a bug about this and ask for some change in the wording : "Warning : You are following an advice from krinn you crazy weirdos !"
</trolling>
BTW... Thanks for the tip !
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Fri Sep 17, 2010 6:44 pm    Post subject: Reply with quote

You can report all you wish, but after that any mod could only agree with me you're a weirdo now :)

Guys that need to follow my advices are like me, users that update things without taking care of what they are doing, and then try to undo the mistakes.

I would say, noob user, sadly as i'm not really new at gentoo, i think "lame" may fit better.
So i prefer call me a "weirdo user" than "lame user", it looks more friendly and lesser the shame a bit.

Must be why i can only do howto for only a few audience, the ones as weird as me that keep crashing their gentoo but prefer tweak it to death instead of reinstalling it.
Jesus ! lame & lazy, i really prefer weirdo :D
Back to top
View user's profile Send private message
Jacekalex
Guru
Guru


Joined: 17 Sep 2009
Posts: 554

PostPosted: Wed Sep 22, 2010 5:09 am    Post subject: Thank You @krinn Reply with quote

Thank you
Very good Howto
In my broke after upgrading to glibc-2.12.1-r1, the system solved thanks to your howto. :D

My native language is Polish, sorry for bad English.

Thanks
:D
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Wed Sep 22, 2010 7:12 pm    Post subject: Reply with quote

Thank you, i could make 100 howtos easy to follow on how to break the distro also.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54596
Location: 56N 3W

PostPosted: Wed Sep 22, 2010 8:04 pm    Post subject: Reply with quote

krinn,

You have more followers than this guide
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Wed Sep 22, 2010 10:10 pm    Post subject: Reply with quote

Maybe some followers, but having some "crazy weirdos" followers isn't really a good sign :)

Ring me back if i ever get some workshippers
Back to top
View user's profile Send private message
jseymour
Apprentice
Apprentice


Joined: 23 Jun 2006
Posts: 202
Location: Gainesville Florida

PostPosted: Tue Nov 23, 2010 3:41 am    Post subject: Reply with quote

Here is another you have helped with this post. Thanks so much. And note to self -- stay with current stable glibc. :D
_________________
WebServerMasters
Gentoo Installation Flash Tutorials
Back to top
View user's profile Send private message
clytle374
Apprentice
Apprentice


Joined: 01 Aug 2006
Posts: 221

PostPosted: Mon Jan 23, 2012 4:14 pm    Post subject: Reply with quote

Thanks for the info. I'm trying to build Linuxcnc which requires a rtai(realtime) kernel. After trying and fighting kernel/rtai combos for a month, I decided it must be a glib/glibc/gcc issue. Since it builds but always exhibits the same failure during initializing a pci card.

I tried your guide as a last ditch effort. It was a new install, so everything was built against the new glibc. Even sh broke :) I was adequately warned, no hard feelings. And since it didn't work, I had nothing to loose anyway.

At this point I'm giving up, for now, on building a Gentoo system to run it. I'll have to use the Ubuntu disk it comes with.

Would it be possible to downgrade those packages during the install while still chrooted? Sorry, that answer is way beyond my state of awareness.

Thanks
Cory
_________________
NooB since RedHat 6.1
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Tue Jan 24, 2012 3:05 am    Post subject: Reply with quote

I'm sorry, except if you boostrap a new system from stage1 to have your own glibc version, you can't success, as soon as a newer glibc is install and criticals tools are build against it, you're dead. Just as an easy example, gcc should be first program you will rebuild with the downgraded glibc version, but to build it, you will need... gcc, and that gcc will be in a state where it expect all functions, files... that were provided by the newer glibc. Kinda a dead end.
Back to top
View user's profile Send private message
Kollin
Veteran
Veteran


Joined: 25 Feb 2006
Posts: 1139
Location: Sofia/Bulgaria

PostPosted: Thu Feb 16, 2012 4:07 pm    Post subject: Reply with quote

BIG FAT WARNING: WHEN YOU DO THIS WITH GLIBC-2.15--->GLIBC-2.14 THE FIRST THING THAT BREAKES IS BASH!!!
_________________
"Dear Enemy: may the Lord hate you and all your kind, may you be turned orange in hue, and may your head fall off at an awkward moment."
"Linux is like a wigwam - no windows, no gates, apache inside..."


Last edited by Kollin on Sun Apr 01, 2012 3:26 am; edited 1 time in total
Back to top
View user's profile Send private message
megabaks
Apprentice
Apprentice


Joined: 22 Jan 2012
Posts: 253
Location: Russia && Saint-Petersburg

PostPosted: Thu Mar 29, 2012 5:26 pm    Post subject: Reply with quote

o_O?
edit eblits...broken bash..."should work" gcc version ...are you crazy?
Code:
#!/bin/bash

[[ ${1} == "" ]] && echo -e "Usage: bash ${0} [VERSION] [ARCH] \nexample: bash ${0} 2.14.1-r2 32" && exit 1
[[ ${2} == "" ]] && echo -e "Usage: bash ${0} [VERSION] [ARCH] \nexample: bash ${0} 2.14.1-r2 32" && exit 1

AVAILABLE=`emerge -p glibc | awk '/sys-libs\/glibc/ {print $4}'`
[[ "${AVAILABLE/sys-libs\/glibc-/}" > "${1}" ]] && echo -e "you need mask:\n>sys-libs/glibc-${1}" && exit 1

##### find and define some stuff
export "$(emerge --info | grep 'PORTDIR=' | tr -d \")"
export "$(emerge --info | grep 'PORTAGE_TMPDIR=' | tr -d \")"
export "$(emerge --info | grep 'CFLAGS=' | tr -d \")"
export "$(emerge --info | grep 'CXXFLAGS=' | tr -d \")"
export "$(emerge --info | grep 'LDFLAGS=' | tr -d \")"

DIR="${PORTAGE_TMPDIR}/portage/sys-libs/glibc-${1}/image"

##### binary package for subj
quickpkg sys-libs/glibc

##### you need to make portage think that it has not installed glibc yet
rm -Rf /var/db/pkg/sys-libs/glibc-*

##### compile target glibc
ebuild ${PORTDIR}/sys-libs/glibc/glibc-${1}.ebuild clean install || exit 1

##### fix environment
case ${2} in
32 ) export LDFLAGS="-L${DIR}/lib -L${DIR}/usr/lib $LDFLAGS";;
64 ) export LDFLAGS="-L${DIR}/lib64 -L${DIR}/usr/lib64 -L${DIR}/lib32 -L${DIR}/usr/lib32 $LDFLAGS";;
esac

export CXXFLAGS="-I${DIR}/usr/include $CXXFLAGS"
export CFLAGS="-I${DIR}/usr/include $CFLAGS"

##### let's go
ALL_TARGETS="$(emerge -pve system | awk '/ebuild/ {print $4}' | grep -v libc | grep -v 'dev-lang/python' )"
for target in ${ALL_TARGETS};do
  export TARGETS+=" =${target}"
done

emerge -avO1 --keep-going=y ${TARGETS}

##### we need rebuild current python
VER="$(python -V 2>&1 | awk '{print $2}')"
CURRENT_PYTHON="$(ls -1 /var/db/pkg/dev-lang/ | grep python-${VER}*)"

ebuild ${PORTDIR}/dev-lang/python/${CURRENT_PYTHON}.ebuild clean configure

sed -e "s|BASECFLAGS=|BASECFLAGS= -I${DIR}/usr/include |" \
    -i ${PORTAGE_TMPDIR}/portage/dev-lang/${CURRENT_PYTHON}/work/Python-${VER}/Makefile

ebuild ${PORTDIR}/dev-lang/python/${CURRENT_PYTHON}.ebuild merge

##### unset previously defined vars
unset LDFLAGS CXXFLAGS CFLAGS

##### workaround for glib/pkgconfig
FFI_VER="$(ls -1 /var/db/pkg/dev-libs/ | grep libffi)"

case ${2} in
32 ) export LIBFFI_LIBS="-L/usr/lib -lffi" && export LIBFFI_CFLAGS="-I/usr/lib/${FFI_VER}/include";;
64 ) export LIBFFI_LIBS="-L/usr/lib64 -L/usr/lib32/ -lffi" && export LIBFFI_CFLAGS="-I/usr/lib64/${FFI_VER}/include -I/usr/lib32/${FFI_VER}/include";;
esac

##### rebuild system
emerge -aveD --keep-going=y system
emerge -aveD --keep-going=y world
enjoy
for details use this ---> http://ru.gentoo-wiki.com/wiki/Откат_(downgrade)_glibc (russian)
sorry my bad english
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8722
Location: ~Brussels - Belgique

PostPosted: Sat May 12, 2012 9:02 pm    Post subject: Reply with quote

Hello,

The eblit hack don't work with binary packages. In my case, I had to temporary redefine die() in Portage in order to downgrade glibc (gcc was broken with the new version of glibc).
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
Moderato
n00b
n00b


Joined: 02 Jun 2006
Posts: 26
Location: Karlsruhe, Baden-Württemberg, Germany

PostPosted: Mon Mar 13, 2017 3:41 am    Post subject: Reply with quote

"Crazy" or not, but I sadly needed to downgrade my glibc package today, since I started with a multilib stage3, but (temporarily) switched to a no-multilib profile in order to update a few packages as the first thing in the clean stage3 system to cut down on dependencies. Due to stupidity, I haven't reverted to the multilib profile afterwards and instead went on with upgrading glibc. Later at some point I wondered about missing ABI_X86 expand flags, and sure enough the breakage only then struck me.

I wasn't able to just rebuild glibc in a multilib fashion, naturally, since it lacked the gnu/stubs-32.h header file and probably others as well.

Luckily I was able to rectify this situation by checkout out another clean stage3 instance, saving a binpkg of this glibc package, manipulating it to allow for downgrades and install it in the broken system. This unbroke my now-multilib-again system.

xaviermiller wrote:
Hello,

The eblit hack don't work with binary packages. In my case, I had to temporary redefine die() in Portage in order to downgrade glibc (gcc was broken with the new version of glibc).


Just to make that clear: naturally binpkgs won't be affected by any direct change in the portage tree, as all necessary scripts are (sanely) incorporated in the environment file that is saved in binpkgs. When binpkgs are installed, this (and other) metadata is unpacked and used. The "more correct" way would have been to edit the bundled package metadata in this case, instead of breaking the "die" command.

For sanity, I'll refrain from actually telling people how to do this in detail, but this pointer should help enough: https://wiki.gentoo.org/wiki/Binary_package_guide#Advanced_topics
Back to top
View user's profile Send private message
LdBeth
n00b
n00b


Joined: 09 Aug 2017
Posts: 16
Location: 浙江

PostPosted: Tue Sep 19, 2017 8:52 am    Post subject: Reply with quote

Static link most of your tool chains first, then you might get more chance to success .
Back to top
View user's profile Send private message
wim-x
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2004
Posts: 110
Location: Netherlands

PostPosted: Sun Jan 26, 2020 6:57 pm    Post subject: Reply with quote

In 2.29-r2, an I_ALLOW_TO_BREAK_MY_SYSTEM option was introduced to be able to downgrade when calling emerge.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54596
Location: 56N 3W

PostPosted: Sun Jan 26, 2020 8:00 pm    Post subject: Reply with quote

Moderato,

See also Fix My Gentoo
I've had to do use the tar method a number of times after distcc broke my glibc.
I've not tried it on a live filesystem. That would be very risky.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Tue Jan 28, 2020 10:58 am    Post subject: Reply with quote

i like the variable name chosen to allow this :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum