Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 903703 - sys-libs/musl-9999 FileNotFoundError: [Errno 2] No such file or directory: b'/bin/bash'
Summary: sys-libs/musl-9999 FileNotFoundError: [Errno 2] No such file or directory: b'...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-04-02 16:56 UTC by hugegameartgd
Modified: 2024-01-01 02:11 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_903703.txt,403.53 KB, text/plain)
2023-04-02 17:28 UTC, hugegameartgd
Details
build.log (new-build.log,416.88 KB, text/plain)
2023-04-03 16:38 UTC, hugegameartgd
Details
emerge-info (new-emerge-info,13.98 KB, text/plain)
2023-04-03 16:39 UTC, hugegameartgd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hugegameartgd 2023-04-02 16:56:53 UTC
Upgrade to `sys-libs/musl-9999::gentoo` breaks while installing with `default/linux/amd64/23.0/musl/llvm` profile.

After installing Gentoo Linux won't boot as there is no `/bin/bash` (only `/usr/bin/bash`) and musl libc is not installed.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-02 17:00:00 UTC
Why do you not have a /bin/? It should be a symlink to /usr/bin if you're on a merged-usr system (like 23.0 profiles).

Also, please keep in mind, 23.0 profiles *are experimental* and not something people should be using yet unless they know wwhat they're doing.
Comment 2 hugegameartgd 2023-04-02 17:04:15 UTC
Yes, this is a bug with `merged-usr`.
Emerging sys-libs/musl works with `split-usr`, migrating to `merged-usr` also works but `sys-libs/musl` fails afterwards with `merged-usr`.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-02 17:08:11 UTC
Why do you not have a /bin symlink?

Please provide full instructions to reproduce from a stage3 (and which).
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-02 17:08:32 UTC
(In reply to hugegameartgd from comment #2)
> Yes, this is a bug with `merged-usr`.
> Emerging sys-libs/musl works with `split-usr`, migrating to `merged-usr`
> also works but `sys-libs/musl` fails afterwards with `merged-usr`.

You're likely not migrating correctly, the script creates symlinks?
Comment 5 hugegameartgd 2023-04-02 17:28:12 UTC
Created attachment 859440 [details]
build.log
Comment 6 hugegameartgd 2023-04-02 17:40:09 UTC
(In reply to Sam James from comment #4)
> (In reply to hugegameartgd from comment #2)
> > Yes, this is a bug with `merged-usr`.
> > Emerging sys-libs/musl works with `split-usr`, migrating to `merged-usr`
> > also works but `sys-libs/musl` fails afterwards with `merged-usr`.
> 
> You're likely not migrating correctly, the script creates symlinks?

Sorry, I forgot to attach build.log.
The symlinks `/bin` and `/lib` still exist after merging sys-libs/musl-9999, bash/sh is also installed but fails to run.
I've used the migration guide from https://www.gentoo.org/support/news-items/2022-12-01-systemd-usrmerge.html , additionally running
`eselect profile set --force default/linux/amd64/23.0/musl/llvm`
and
`emerge --oneshot --update --newuse --changed-used --deep --with-bdeps=y --keep-going @installed` for upgrade.
Adding
`sys-libs/musl **` to `package.accept_keywords` and upgrading to `sys-libs/musl` live ebuild breaks during installation (not reproducible with `musl-1.2.3-r7`).
Comment 7 immolo 2023-04-02 20:19:05 UTC
The process I use from a stage3 is:

1. emerge -va merge-usr
2. merge-usr
3. emerge -va sys-libs/musl-9999
4. Switch to 23.0 profile
5. emerge -vauDU @world

This system works for me everytime.

From what I'm seeing Sam is correct and your symlinks are wrong. You can unpack a stage3 on top to fix this issue following the steps above.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-02 21:59:36 UTC
> You can unpack a stage3 on top to fix this issue following the steps above.

Please don't unpack a stage3 over an existing system. You end up with orphaned/conflicting files which shouldn't be there and an inconsistent vdb.
Comment 9 hugegameartgd 2023-04-03 12:11:44 UTC
I think the bug is that the musl ebuilds from gentoo tree don't have a split-usr useflag that can be disabled for merged-usr.
Therefore symlink loops are installed to /usr/ instead of the actual binaries.
Renaming the musl-1.2.3-r7.ebuild from 12101111-overlay to musl-9999.ebuild (
See https://github.com/12101111/overlay/blob/master/sys-libs/musl/musl-1.2.3-r7.ebuild ) fixes the issue.
Comment 10 Mike Gilbert gentoo-dev 2023-04-03 14:33:07 UTC
I don't see any evidence of a bug here. Please start over with a full build log and emerge --info.
Comment 11 hugegameartgd 2023-04-03 16:38:10 UTC
Created attachment 859484 [details]
build.log
Comment 12 hugegameartgd 2023-04-03 16:39:14 UTC
Created attachment 859485 [details]
emerge-info
Comment 13 Mike Gilbert gentoo-dev 2023-04-03 17:02:34 UTC
I'm still seeing this:

FileNotFoundError: [Errno 2] No such file or directory: b'/bin/bash'

If you run /bin/bash from a command line, what happens?
Comment 14 Mike Gilbert gentoo-dev 2023-04-03 17:07:33 UTC
Hmm, I see that /usr/bin/sandbox also fails. I suppose the errno 2 might be coming from ld-musl-x86_64.so.1 when it fails to load some libraries?
Comment 15 hugegameartgd 2023-04-03 17:47:16 UTC
(In reply to Mike Gilbert from comment #14)
> Hmm, I see that /usr/bin/sandbox also fails. I suppose the errno 2 might be
> coming from ld-musl-x86_64.so.1 when it fails to load some libraries?
ld-musl-x86_64.so.1 should symlink to libc.so which is not the case when /lib is a symlink to /usr/lib

lrwxrwxrwx 1 root root 18 Apr  3 17:40 ld-musl-x86_64.so.1 -> ../usr/lib/libc.so
Comment 16 Mike Gilbert gentoo-dev 2023-04-03 17:56:07 UTC
Hmm, so does your filesystem look like this?

/lib -> usr/lib
/usr/lib/ld-musl-x86_64.so.1 -> ../usr/lib/libc.so

That would indeed be problematic.
Comment 17 Mike Gilbert gentoo-dev 2023-04-03 18:32:25 UTC
I confirmed the broken behavior by running merge-usr and reinstalling sys-libs/musl-1.2.3-r7.
Comment 18 Larry the Git Cow gentoo-dev 2023-04-03 19:06:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6de834d0aba32a86de1aee8806f8c03a815ad98e

commit 6de834d0aba32a86de1aee8806f8c03a815ad98e
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-04-03 18:13:02 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-04-03 19:06:20 +0000

    sys-libs/musl: fix ld-musl.so symlink with merged-usr
    
    To create a symlink relative to /lib/ld-musl.so, we must know if ${ROOT}
    will have /lib symlinked to /usr/lib. We rely on the split-usr USE flag to
    determine this.
    
    Closes: https://bugs.gentoo.org/903703
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-libs/musl/musl-1.2.3-r8.ebuild | 212 +++++++++++++++++++++++++++++++++++++
 sys-libs/musl/musl-9999.ebuild     |  18 ++--
 2 files changed, 223 insertions(+), 7 deletions(-)