Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
unexpected reloc type in static binary
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Thu Jul 07, 2011 1:48 pm    Post subject: unexpected reloc type in static binary Reply with quote

Hi all, after making a general system upgrade I've noticed executing emerge (even with no args) prints "unexpected reloc type in static binary". I think this is a glibc issue as this message is printed directly to the terminal: `emerge &> /dev/null' still outputs this annoying thing. I remember oher cases where glibc outputs messages this way. I updated glibc from version 2.11.2-r3 to 2.12.2, both with this USEs: gd glibc-omitfp multilib nls.
Is this serious? should I worry about this or it's a dummy thing?

Thanks for reading!
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Jul 08, 2011 1:31 am    Post subject: Reply with quote

If you're using prelink, you could try undoing that, I tried googling that message and found some stuff about that... not sure if that's actually the issue though.
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Fri Jul 08, 2011 11:41 am    Post subject: Reply with quote

Ok, thanks for that. But it has just gotten scared.
Code:
# prelink -au
unexpected reloc type in static binarySegmentation fault

Before leaving yesterday I left an `emerge -qe world' because I had to change a CFLAG and CXXFLAG in a world basis (fortunatly this server is not yet in prod). May that have influenced?
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Jul 08, 2011 3:42 pm    Post subject: Reply with quote

What change did you make?
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Fri Jul 08, 2011 4:33 pm    Post subject: Reply with quote

I'm installing a xen dom0, still nothing working on it. I had copied a make.conf for an x86 dom0 I had previously used. I thought I had done all the changes to that file to adapt it to the new environment but I forgot to delete the '-mno-tls-direct-seg-refs' from my CFLAGS, which are also my CXXFLAGS. I know this is no major problem (none at all in fact) but I wanted to start a very clean and fresh install. I don't have much things installed, only the basics. This issue had already been happening before I change CFLAGS and CXXFLAGS. What I hadn't tried before the change is to unprelink the system. So, cronologically, this is what has happened:
  • system is happy
  • emerge --sync && emerge -qauDN world
    Of course there was a review in this step. Among the most important packages updated: glibc from version 2.11.2-r3 to 2.12.2 (which I think is causing the problem).
  • Problem appears. All I notice about this problem is that when I run emerge in any manner, I can see it outputs directly into the terminal "unexpected reloc type in static binary". Search about this. Nothing related specifically to this (in my search, I found this message in other contexts). Didn't think it had anything to do with prelink.
    I've got `buildpkg' in my FEATURES to be able to use the binaries produced in the domUs I create inside this dom0. I was preparing a stage4 for the domUs to be created. Chrooted into it. I did an `emerge -qek world' (same USEs as dom0, less ebuilds listed in world file) which didn't output the message and after this, emerge did. glibc where also reinstalled in this action.
  • Change variables in make.conf from this:
    Code:
    CFLAGS="-O2 -pipe -mno-tls-direct-seg-refs -fomit-frame-pointer"
    CXXFLAGS="${CFLAGS}"

    To this:
    Code:
    CFLAGS="-O2 -pipe -fomit-frame-pointer"
    CXXFLAGS="${CFLAGS}"

    And then recompile everything using `emerge -qe world'.
  • As BradN suggested prelink may be related to this, I try `prelink -au' and then `prelink -afmR', both failing with a segfault after showing the message.
  • Now I'm scared. This should be producing things soon.

Again, if you need to know something, just ask!
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Jul 08, 2011 6:04 pm    Post subject: Reply with quote

What happens if you start a chroot install and just install prelink in there, then use that prelink binary and libraries to try to un-prelink your main install?

Since obviously it will look for your current system libraries, you'll probably need a way to trick it into using the libraries from the chroot, maybe this can be done by copying all the libraries it uses (find them with ldd) into a directory and then overriding the ld library path (I haven't experimented a lot with that sort of thing).

I hate to say it, but in important installs, it's really a good idea to perform regular full OS backups as well as data to help reduce problem severity in cases like this. A tar command is cheap, spending hours/days rebuilding everything isn't :)
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Fri Jul 08, 2011 6:58 pm    Post subject: Reply with quote

BradN wrote:
What happens if you start a chroot install and just install prelink in there, then use that prelink binary and libraries to try to un-prelink your main install?

Well, thinking about it more quietly, I guess this issue may not be due to prelink. Think about this: before the first emerge (the one which brought the problem) I had the system prelinked. After the emerge, I didn't even think about prelink but for every package I had made a bin package. Already having this problem, I entered the chroot, which was working ok. Notice: main system has the issue and at the same time the chroot doesn't. The chroot at that time was a regular stage3, only modified in some configurations (mainly in /etc, emerge had never been touched nor prelink either). I run the system update and the problem starts in the chroot too. Notice that bin packages are never prelinked ergo chroot system is not prelinked and still exhibits the problem. So, I think that the fact that prelink segfaults after the update is just a consequence of the issue in glibc and not a consequence of any binary been prelinked. Also notice that I had reinstalled the whole system (all of it), so any prelinking would had been lost as it is just a piece of code at the beggining of binaries.

BradN wrote:
I hate to say it, but in important installs, it's really a good idea to perform regular full OS backups as well as data to help reduce problem severity in cases like this. A tar command is cheap, spending hours/days rebuilding everything isn't :)

Sure, I always tell exactly that to everybody :x (I rarely do it) and in my defense, this was supposed to be a fresh install, so I thought there might be very little chances that something strange like this happens.

So, next question is "what the heck is causing the issue?". I'm going to try disabling some LDFLAGS (I use this LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--sort-common -s"). If you have some further suggestions I'm taking them for now.

Thanks!
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Sat Jul 09, 2011 12:53 am    Post subject: Reply with quote

Sounds like the kernel then.
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Thu Jul 14, 2011 2:10 pm    Post subject: Reply with quote

Look! Brand new server. Brand new system (stage3-amd64-20110609.tar.bz2, July 11th portage) and it's the first time this machine boots on it's own. I had only installed the utterly needed packages to boot and never still hadn't found the message. Prelink is not even considered yet. I made an `emerge -pve world' (with an empty world file because I forgot to modify it. Then it's the same than `emerge -pve system') and in another term started to make an `emerge' once in a while to see what happened. It's funny that I found the other glibc message I know of, but haven't seen in a long while:
Code:
>>> Emerging (59 of 131) app-arch/gzip-1.4
*** %n in writable segment detected ***
>>> Installing (59 of 131) app-arch/gzip-1.4

Nothing seemed to be happening to my emerge probes, but then I saw this:
Code:
>>> Emerging (114 of 131) sys-apps/util-linux-2.19.1
unexpected reloc type in static binary>>> Installing (114 of 131) sys-apps/util-linux-2.19.1
>>> Emerging (115 of 131) sys-fs/udev-164-r2

But my emerge is still ok after the successful emerge.
Then, I put packages into world file and make an `emerge -quDN world' and the problem starts. Suddenly! I realize that I had always installed prelink. I uninstall it with `emerge -C prelink' and the problem goes away!!!!!!!!!!! :D
What the heckkkkkkkkkkkcckckckckcccccccc!!!!!!!!!! This is good (you don't know how much people)

The offending prelink ebuild: sys-devel/prelink-20100106

It's only then that I figure out this prelink thing is about half and a year old (very old).
I should report this as a bug, right? I mean, if this package is no longer mantained and is causing problems, then it shouldn't be there.

Thanks!
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Thu Jul 14, 2011 3:26 pm    Post subject: Reply with quote

Definitely report it, it should be masked at least.
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Thu Jul 14, 2011 6:37 pm    Post subject: Reply with quote

Submited
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Thu Jul 14, 2011 11:40 pm    Post subject: Reply with quote

This is not closed! Please follow the bug.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Jul 15, 2011 5:11 am    Post subject: Reply with quote

It's my understanding that after you install prelink, other packages you emerge are automatically prelinked, and uninstalling prelink won't automatically undo it.

Normally this isn't a problem because if the prelinking is invalid it's supposed to fall back to the normal dynamic linking procedures, but something must be going wrong here.
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Fri Jul 15, 2011 1:32 pm    Post subject: Reply with quote

Hi, as suggested by Pacho Ramos in the bug, I recompiled everything with safer LDFLAGS (the default ones). It works now. I have to say that I have been using those ones since a couple of years with good results, but I'm betting on stability for now.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Jul 15, 2011 4:04 pm    Post subject: Reply with quote

Can you tell which ldflag it was that caused the problem? It may still be a bug in prelink (or something else) if it was working like that before but not now.
Back to top
View user's profile Send private message
diegoaugustomolina
n00b
n00b


Joined: 22 Mar 2010
Posts: 32

PostPosted: Fri Jul 15, 2011 6:29 pm    Post subject: Reply with quote

Code:
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common -s"

Those I used, now they're the default ones (except for some packages managed with /etc/portage/{bashrc,package.ldflags}). Also I forgot to say here that the problem didn't really go away. This is explained in comment 5 of the bug. After unmerging prelink the only two symptoms of the issue (message in emerge and message with segfault in prelink) went away but I surprisigly something else came up: I ocassionally run cryptsetup and it showed the message with segfault. I wanted to kick the wall. After this I recompiled everything with the normal ldflags and then that third symptom went away too and the emerge kept doing right.
Anyway, I thought this wasn't a valid bug because it was solved using a recommended practice, right? so I closed it as RESOLVED INVALID. Check out the bug for details.
If you think this is still a bug, I can reopen it and test further with a spare machine I've got in which the issue is still present.

Greetings!
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri Jul 15, 2011 11:59 pm    Post subject: Reply with quote

Well it's still a bug if prelink is supposed to work with those ldflags - I don't know enough about the specific details. But, if it's a ldflag that interferes with the process in a way that it's not reasonable to support that configuration, I'd guess it's not a bug then.

But perhaps an error/warning would be nice at prelink install time in that case though, seeing that prelink seems to be the main case where that ldflag breaks badly. To me, the whole idea is keeping the next person from running into the same troubleshooting :)

You may want to open a new bug or edit the subject (if possible) of it to be directly like "prelinked executables crash with LDFLAGS=-whatever" - then perhaps it will get the attention of someone who deals with linker stuff.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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