web-dev-qa-db-ja.com

/ lib64を壊した、救済可能? (ubuntu / mint12)

デバッグシンボルを使用してldを再コンパイルしようとした誤った試みで、/ libにシンボリックリンクされていない/ lib64になりました(Debian64ビットライブラリは/ lib/x84_64-linux-gnuにあります)。 aptを使用してlibc6を再インストールしようとしましたが、上記についての不満がエラーになりました。

私は(誤って)私はただmv /lib64 /tmp && ln -s /lib /lib64;最初のコマンドは機能し、壊れたシステムを残しました(/bin/ld not foundなど)。

これをその場で修正する方法はありますか? (つまり、レスキューディスクを実行せずに)

これを匿名で投稿できたら…[ため息]

3
mikewaters

これがその一部に役立つかどうかはわかりませんが、ランタイムリンカーを移動して、mv、cp、ln、rmなどが機能しなくなった場合でも、それらを実行できます(できれば自分で救助してください)。ランタイムリンカーを明示的に指定する。例えば。

 mv/lib64/tmp 
 ln -s/lib/lib64#失敗、ランタイムリンカーなし
 /tmp/lib64/ld-2.13.so/bin/ln -s/lib/lib64#成功するはずです
3
Don Hatch

他の誰かがこの問題を抱えている場合;リカバリディスクを使用してファイルを元の場所に戻すと、次のスクリプトを使用してlibcを再インストールできました。

#!/bin/bash

# Fix symlinks in a b0rked /lib64 (Debian).
# Libs in /lib64 should be symlinked to /lib/x86_64-linux-gnu;
# if a symlink is found in /lib64, try to redirect it to a
# file of the same name in /lib/x86_64-linux-gnu.
# Then remove the old symlink destination.
#
# The Problem:
# me@box # ls -l /lib64
# -rwxr-xr-x 1 root root  156683 2011-12-29 19:11 ld-2.13.so
# lrwxrwxrwx 1 root root      10 2011-12-29 19:11 ld-linux-x86-64.so.2 -> ld-2.13.so
#
# The Solution:
# lrwxrwxrwx 1 root root      10 2011-12-29 19:11 ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.13.so
#

set -e

libs=(/lib64/*)
bak=$HOME

for l in ${libs[@]}; do
    src=$(ls -l $l |awk '{print $10}');
    if [[ ! -z "$src" ]]; then
        if [[ ! -f "/lib64/$src" ]] || [[ ! -f "/lib/x86_64-linux-gnu/$src" ]]; then
            echo "error: $l src or dest not found:"
            echo `ls -l "/lib64/$src"` > /dev/null
            echo `ls -l "/lib/x86_64-linux-gnu/$src"` > /dev/null
            continue
        fi
        ln -si "/lib/x86_64-linux-gnu/$src" "$l";
        mv "/lib64/$src" $bak/;
    fi
done
0
mikewaters