Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Busybox overwrote Binutils
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
avdb
n00b
n00b


Joined: 16 Aug 2020
Posts: 65
Location: Netherlands

PostPosted: Sun Nov 01, 2020 8:42 pm    Post subject: Busybox overwrote Binutils Reply with quote

I was trying to install a Python program on Gentoo when all of a sudden literally my entire system broke. What happened is that I was following a guide and needed to run `chpst`. Found out with e-file that this file was part of Busybox, so decided to check if I had it installed. Turned out that Busybox was part of my @system tree so tried to flip some USE flags like usual.

`make-symlinks` was the most promising so I tried to apply it. Few minutes later and my entire system starts to malfunction. I tried to update, reconfigure my kernel, everything, but I kept getting odd warnings about wrong usage of commands like `grep` and `ar`

If you need more details, I still managed to save the output, you can find it here: https://dpaste.com/H6GGA2WYY

After that I turned off the USE flag, recompiled Busybox and Binutils, but without result. So I gave my computer a reboot with `loginctl reboot` ... Which didn't work. After running it again it just said that a restart was already scheduled.

So I forced my system off, and upon restart i got stuck in a loop which said `/dev/scX: no such file or directory` (X being 1 to 6). I can still chroot from the live ISO but other than that I actually have no clue how to troubleshoot this problem. If my system is broken beyond repair and a reinstall is necessary please tell me so.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Nov 01, 2020 9:04 pm    Post subject: Reply with quote

avdb,

make-symlinks overwrites the real commands with symlinks to busybox.
That's OK if you don't do that on your real filesystem. It can be useful for an initrd.

You need to install a binary binutils over the top of your real root filesystem.

It can be extracted from a stage3 tarball, you can make your own, or use a BINHOST.
Once your system is back to normal,
Code:
emerge -1av binutils

I'm sure that a few other things are broken too.
_________________
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
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2852

PostPosted: Sun Nov 01, 2020 9:09 pm    Post subject: Reply with quote

Hmm... the ebuild has a safeguard that "should" require you to set VERY_BRAVE_OR_VERY_DUMB=yes to let USE=make-symlinks work even if ROOT=/, however I just tested it (on a throwaway system, don't try this at home) and it made the symlinks despite I didn't set it. Nasty :|
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2852

PostPosted: Sun Nov 01, 2020 9:27 pm    Post subject: Reply with quote

Ionen wrote:
Hmm... the ebuild has a safeguard that "should" require you to set VERY_BRAVE_OR_VERY_DUMB=yes to let USE=make-symlinks work even if ROOT=/, however I just tested it (on a throwaway system, don't try this at home) and it made the symlinks despite I didn't set it. Nasty :|

Ah I see, it broke in the EAPI 7 transition due to the removal of trailing slash:
Code:
pkg_postinst() {
    # check whether we are installing to the host system

    # BAD: EAPI 6 form
    if [[ ${ROOT} == / ]]; then
        # ...
    fi

    # GOOD: EAPI 7 form
    if [[ -z ${ROOT} ]]; then
        # ...
    fi
}

The ebuild is doing the former despite EAPI=7:
Code:
    if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
        ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
        ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
        ewarn "If you are creating a binary only and not merging this is probably ok."
        ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
        die "silly options will destroy your system"
    fi

Edit: Took the liberty to open bug #752162 myself. Broken since this commit early this year. Unfortunate the ebuild couldn't stop this :(. Carefully replacing busybox symlinks by normal tools and re-installing affected packages could bring this back to shape, hope Neddy's post can help you.
Back to top
View user's profile Send private message
avdb
n00b
n00b


Joined: 16 Aug 2020
Posts: 65
Location: Netherlands

PostPosted: Mon Nov 02, 2020 1:13 pm    Post subject: Reply with quote

Well, that didn't go well. There was simply too much broken, again and it wasn't just my toolchain because I couldn't boot my system anymore. Thanks for opening the bug report, now let's hope that the Gentoo developers will put a big warning sign on that USE flag so that it won't happen to other users.
The only thing that currently really annoys me is that I have to recompile everything (yes, I made the situation even worse by extracting a stage3 tarball of over my root filesystem which in turn made it impossible to chroot) since I didn't backup my make.conf nor did I run quickpkg @world when I was still able to.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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