Bug 434882 - creation of stage2 breaks relative links -> broken HAL -> no disks
Summary: creation of stage2 breaks relative links -> broken HAL -> no disks
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: rawhide
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Anaconda Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-02-25 23:40 UTC by Will Woods
Modified: 2008-03-10 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-03-10 22:10:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Will Woods 2008-02-25 23:40:17 UTC
scripts/upd-instroot does the following:

    (cd $p/bin; find) | (cd $p/bin; /bin/cpio --quiet -pdmu $p/usr/bin)
    (cd $p/sbin; find) | (cd $p/sbin; /bin/cpio --quiet -pdmu $p/usr/sbin)

moving everything from /sbin to /usr/sbin will break any relative symlinks into
/bin or /sbin.. like /usr/bin/udevinfo (which is how HAL discovers devices):
    /usr/bin/udevinfo -> ../../sbin/udevadm
(this was changed 5 days ago for bug #432878)

A simple hack to work around this would be to do:
    ln -sf /sbin/udevadm $p/usr/bin/udevinfo
since we have udev in stage1 these days. On the other hand, here's a bash script
that should fix up the links:

    # Fix relative links like /usr/bin/udevinfo -> ../../sbin/udevadm
    for brokenlink in $(find $p/usr/{bin,sbin} -follow -lname '*'); do
        target="$(readlink $brokenlink)"
        for pathbit in bin sbin; do
            # if it starts with "../../sbin/", remove that
            newtarget="${target##../../$pathbit/}"
            # if we removed something, replace it with the proper path
            if [ "$newtarget" != "$target" ]; then
                # make it ../sbin/ instead
                ln -sf "../$pathbit/$newtarget" "$brokenlink"
            fi
        done
    done

Comment 1 Jeremy Katz 2008-02-26 02:13:08 UTC
Ugh.  Added in git

Comment 2 Will Woods 2008-03-10 22:10:39 UTC
Fixed in current rawhide, AFAICT.


Note You need to log in before you can comment on or make changes to this bug.