최근에 Java jre 및 Java 컴파일러 버전 불일치 관련 문제를 해결하려고 했기 때문에 이 답변에서 제안된 내용을 시도했습니다. 이 답변은 상대적으로 무해해 보였고 찬성표가 많았으며 질문에 대한 정확한 답변이었습니다.https://stackoverflow.com/questions/10585091/resolving-version-contribute-Between-java-and-javac-on-ubuntu
그러나 불행하게도 나는 다음 명령을 실행하기 전에 내 두뇌를 사용하지 않았습니다. 내 경우에는 제안된 명령이 될 것입니다.
sudo ln -s -f /usr/bin/* /usr/bin
그것에 대해 좀 더 생각해 본 후에 나는 이것이 /usr/bin 디렉토리에 있는 모든 파일을 상위 디렉토리에 다시 상징적으로 연결하여 순환적인 순환 파일 구조를 생성한다는 것을 깨달았습니다. 악몽이군요.
/usr/bin 디렉토리에서 이를 시도하면 ls -l
다음과 같은 항목이 많이 표시됩니다.
-rwxr-xr-r 1 root root 5518 Feb 12 2014 xzcat -> /usr/bin/xzcat
하지만 확실히 이 문제를 해결하는 몇 가지 간단한 방법이 있을까요? 문제는 이 과정에서 실제로 추가된 파일이 없기 때문에 어떤 파일을 제거할 수 있는지 확신할 수 없다는 것입니다.
어떤 아이디어가 있나요?
이것은 내 명령의 결과입니다.
ln: ‘/usr/bin/[’ and ‘/usr/bin/[’ are the same file
ln: ‘/usr/bin/2to3-2.7’ and ‘/usr/bin/2to3-2.7’ are the same file
ln: ‘/usr/bin/2to3-3.4’ and ‘/usr/bin/2to3-3.4’ are the same file
ln: ‘/usr/bin/2to3-3.5’ and ‘/usr/bin/2to3-3.5’ are the same file
ln: ‘/usr/bin/a2p’ and ‘/usr/bin/a2p’ are the same file
ln: ‘/usr/bin/ab’ and ‘/usr/bin/ab’ are the same file
ln: ‘/usr/bin/aclocal-1.15’ and ‘/usr/bin/aclocal-1.15’ are the same file
ln: ‘/usr/bin/aconnect’ and ‘/usr/bin/aconnect’ are the same file
ln: ‘/usr/bin/acpi_listen’ and ‘/usr/bin/acpi_listen’ are the same file
ln: ‘/usr/bin/activity-log-manager’ and ‘/usr/bin/activity-log-manager’ are the same file
ln: ‘/usr/bin/add-apt-repository’ and ‘/usr/bin/add-apt-repository’ are the same file
ln: ‘/usr/bin/addpart’ and ‘/usr/bin/addpart’ are the same file
ln: ‘/usr/bin/addr2line’ and ‘/usr/bin/addr2line’ are the same file
ln: ‘/usr/bin/alsaloop’ and ‘/usr/bin/alsaloop’ are the same file
ln: ‘/usr/bin/alsamixer’ and ‘/usr/bin/alsamixer’ are the same file
ln: ‘/usr/bin/alsaucm’ and ‘/usr/bin/alsaucm’ are the same file
ln: ‘/usr/bin/amidi’ and ‘/usr/bin/amidi’ are the same file
ln: ‘/usr/bin/amixer’ and ‘/usr/bin/amixer’ are the same file
ln: ‘/usr/bin/amuFormat.sh’ and ‘/usr/bin/amuFormat.sh’ are the same file
ln: ‘/usr/bin/apg’ and ‘/usr/bin/apg’ are the same file
ln: ‘/usr/bin/apgbfm’ and ‘/usr/bin/apgbfm’ are the same file
ln: ‘/usr/bin/aplay’ and ‘/usr/bin/aplay’ are the same file
ln: ‘/usr/bin/aplaymidi’ and ‘/usr/bin/aplaymidi’ are the same file
ln: ‘/usr/bin/apport-bug’ and ‘/usr/bin/apport-bug’ are the same file
ln: ‘/usr/bin/apport-cli’ and ‘/usr/bin/apport-cli’ are the same file
ln: ‘/usr/bin/apport-unpack’ and ‘/usr/bin/apport-unpack’ are the same file
ln: ‘/usr/bin/appres’ and ‘/usr/bin/appres’ are the same file
ln: ‘/usr/bin/apt’ and ‘/usr/bin/apt’ are the same file
ln: ‘/usr/bin/apt-cache’ and ‘/usr/bin/apt-cache’ are the same file
ln: ‘/usr/bin/apt-cdrom’ and ‘/usr/bin/apt-cdrom’ are the same file
ln: ‘/usr/bin/apt-config’ and ‘/usr/bin/apt-config’ are the same file
ln: ‘/usr/bin/aptdcon’ and ‘/usr/bin/aptdcon’ are the same file
ln: ‘/usr/bin/apt-extracttemplates’ and ‘/usr/bin/apt-extracttemplates’ are the same file
ln: ‘/usr/bin/apt-ftparchive’ and ‘/usr/bin/apt-ftparchive’ are the same file
ln: ‘/usr/bin/apt-get’ and ‘/usr/bin/apt-get’ are the same file
ln: ‘/usr/bin/apt-key’ and ‘/usr/bin/apt-key’ are the same file
ln: ‘/usr/bin/apt-mark’ and ‘/usr/bin/apt-mark’ are the same file
ln: ‘/usr/bin/apt-sortpkgs’ and ‘/usr/bin/apt-sortpkgs’ are the same file
ln: ‘/usr/bin/apturl’ and ‘/usr/bin/apturl’ are the same file
ln: ‘/usr/bin/apturl-gtk’ and ‘/usr/bin/apturl-gtk’ are the same file
ln: ‘/usr/bin/ar’ and ‘/usr/bin/ar’ are the same file
ln: ‘/usr/bin/arch’ and ‘/usr/bin/arch’ are the same file
ln: ‘/usr/bin/arecordmidi’ and ‘/usr/bin/arecordmidi’ are the same file
ln: ‘/usr/bin/arm2hpdl’ and ‘/usr/bin/arm2hpdl’ are the same file
ln: ‘/usr/bin/arping’ and ‘/usr/bin/arping’ are the same file
ln: ‘/usr/bin/as’ and ‘/usr/bin/as’ are the same file
ln: ‘/usr/bin/aseqdump’ and ‘/usr/bin/aseqdump’ are the same file
ln: ‘/usr/bin/aseqnet’ and ‘/usr/bin/aseqnet’ are the same file
ln: ‘/usr/bin/aspell’ and ‘/usr/bin/aspell’ are the same file
ln: ‘/usr/bin/aspell-import’ and ‘/usr/bin/aspell-import’ are the same file
ln: ‘/usr/bin/atobm’ and ‘/usr/bin/atobm’ are the same file
ln: ‘/usr/bin/autoconf’ and ‘/usr/bin/autoconf’ are the same file
ln: ‘/usr/bin/autoheader’ and ‘/usr/bin/autoheader’ are the same file
ln: ‘/usr/bin/autom4te’ and ‘/usr/bin/autom4te’ are the same file
ln: ‘/usr/bin/automake-1.15’ and ‘/usr/bin/automake-1.15’ are the same file
...
이 오류는 다음과 같은 경우에는 발생하지 않습니다.모든문서는 대부분입니다.
이것은의 출력입니다
`ls -la | grep '\->'
lrwxrwxrwx 1 root root 13 May 23 19:16 2to3 -> /usr/bin/2to3
lrwxrwxrwx 1 root root 16 May 23 19:16 aclocal -> /usr/bin/aclocal
lrwxrwxrwx 1 root root 10 Sep 3 2015 add-patch -> edit-patch
lrwxrwxrwx 1 root root 21 May 23 19:16 appletviewer -> /usr/bin/appletviewer
lrwxrwxrwx 1 root root 23 May 23 19:16 apport-collect -> /usr/bin/apport-collect
lrwxrwxrwx 1 root root 16 May 23 19:16 apropos -> /usr/bin/apropos
lrwxrwxrwx 1 root root 27 May 23 19:16 apt-add-repository -> /usr/bin/apt-add-repository
lrwxrwxrwx 1 root root 16 May 23 19:16 arecord -> /usr/bin/arecord
lrwxrwxrwx 1 root root 18 May 23 19:16 assistant -> /usr/bin/assistant
lrwxrwxrwx 1 root root 2 Jan 10 2015 atq -> at
lrwxrwxrwx 1 root root 2 Jan 10 2015 atrm -> at
lrwxrwxrwx 1 root root 17 May 23 19:16 automake -> /usr/bin/automake
lrwxrwxrwx 1 root root 29 May 23 19:16 avahi-browse-domains -> /usr/bin/avahi-browse-domains
lrwxrwxrwx 1 root root 30 May 23 19:16 avahi-publish-address -> /usr/bin/avahi-publish-address
lrwxrwxrwx 1 root root 30 May 23 19:16 avahi-publish-service -> /usr/bin/avahi-publish-service
lrwxrwxrwx 1 root root 30 May 23 19:16 avahi-resolve-address -> /usr/bin/avahi-resolve-address
lrwxrwxrwx 1 root root 32 May 23 19:16 avahi-resolve-host-name -> /usr/bin/avahi-resolve-host-name
lrwxrwxrwx 1 root root 21 May 24 18:16 awk -> /etc/alternatives/awk
lrwxrwxrwx 1 root root 12 May 23 19:16 c++ -> /usr/bin/c++
lrwxrwxrwx 1 root root 12 May 23 19:16 c89 -> /usr/bin/c89
lrwxrwxrwx 1 root root 12 May 23 19:16 c99 -> /usr/bin/c99
lrwxrwxrwx 1 root root 12 May 23 19:16 cal -> /usr/bin/cal
lrwxrwxrwx 1 root root 18 May 23 19:16 captoinfo -> /usr/bin/captoinfo
lrwxrwxrwx 1 root root 11 May 23 19:16 cc -> /usr/bin/cc
lrwxrwxrwx 1 root root 17 May 23 19:16 cdrecord -> /usr/bin/cdrecord
lrwxrwxrwx 1 root root 14 May 23 19:16 chacl -> /usr/bin/chacl
lrwxrwxrwx 1 root root 16 May 23 19:16 chardet -> /usr/bin/chardet
lrwxrwxrwx 1 root root 17 May 23 19:16 chardet3 -> /usr/bin/chardet3
lrwxrwxrwx 1 root root 16 May 23 19:16 charmap -> /usr/bin/charmap
lrwxrwxrwx 1 root root 20 May 23 19:16 combinediff -> /usr/bin/combinediff
lrwxrwxrwx 1 root root 16 May 23 19:16 compose -> /usr/bin/compose
lrwxrwxrwx 1 root root 12 May 23 19:16 cpp -> /usr/bin/cpp
lrwxrwxrwx 1 root root 14 May 23 19:16 ctags -> /usr/bin/ctags
lrwxrwxrwx 1 root root 15 May 23 19:16 ctstat -> /usr/bin/ctstat
lrwxrwxrwx 1 root root 8 Sep 3 2015 cvs-debc -> cvs-debi
lrwxrwxrwx 1 root root 9 Sep 3 2015 dch -> debchange
lrwxrwxrwx 1 root root 4 Sep 3 2015 debc -> debi
lrwxrwxrwx 1 root root 17 May 23 19:16 designer -> /usr/bin/designer
lrwxrwxrwx 1 root root 26 May 23 19:16 desktop-file-edit -> /usr/bin/desktop-file-edit
lrwxrwxrwx 1 root root 16 May 23 19:16 dh_pypy -> /usr/bin/dh_pypy
lrwxrwxrwx 1 root root 19 May 23 19:16 dh_python3 -> /usr/bin/dh_python3
lrwxrwxrwx 1 root root 16 May 23 19:16 dotlock -> /usr/bin/dotlock
lrwxrwxrwx 1 root root 17 May 23 19:16 dumpkeys -> /usr/bin/dumpkeys
lrwxrwxrwx 1 root root 16 May 23 19:16 ebrowse -> /usr/bin/ebrowse
lrwxrwxrwx 1 root root 13 May 23 19:16 edit -> /usr/bin/edit
lrwxrwxrwx 1 root root 15 May 23 19:16 editor -> /usr/bin/editor
lrwxrwxrwx 1 root root 14 May 23 19:16 emacs -> /usr/bin/emacs
lrwxrwxrwx 1 root root 16 May 23 19:16 emacs24 -> /usr/bin/emacs24
lrwxrwxrwx 1 root root 20 May 23 19:16 emacsclient -> /usr/bin/emacsclient
lrwxrwxrwx 1 root root 14 May 23 19:16 etags -> /usr/bin/etags
lrwxrwxrwx 1 root root 11 May 23 19:16 ex -> /usr/bin/ex
lrwxrwxrwx 1 root root 17 May 23 19:16 extcheck -> /usr/bin/extcheck
lrwxrwxrwx 1 root root 12 May 23 19:16 f77 -> /usr/bin/f77
lrwxrwxrwx 1 root root 12 May 23 19:16 f95 -> /usr/bin/f95
lrwxrwxrwx 1 root root 17 May 23 19:16 fakeroot -> /usr/bin/fakeroot
lrwxrwxrwx 1 root root 16 May 23 19:16 firefox -> /usr/bin/firefox
lrwxrwxrwx 1 root root 17 May 23 19:16 flipdiff -> /usr/bin/flipdiff
lrwxrwxrwx 1 root root 23 May 23 19:16 foo2zjs-icc2ps -> /usr/bin/foo2zjs-icc2ps
lrwxrwxrwx 1 root root 21 May 23 19:16 foomatic-rip -> /usr/bin/foomatic-rip
lrwxrwxrwx 1 root root 12 May 23 19:16 frm -> /usr/bin/frm
lrwxrwxrwx 1 root root 13 May 23 19:16 from -> /usr/bin/from
lrwxrwxrwx 1 root root 12 May 23 19:16 ftp -> /usr/bin/ftp
lrwxrwxrwx 1 root root 12 May 23 19:16 g++ -> /usr/bin/g++
lrwxrwxrwx 1 root root 12 May 23 19:16 gcc -> /usr/bin/gcc
lrwxrwxrwx 1 root root 15 May 23 19:16 gcc-ar -> /usr/bin/gcc-ar
lrwxrwxrwx 1 root root 15 May 23 19:16 gcc-nm -> /usr/bin/gcc-nm
lrwxrwxrwx 1 root root 19 May 23 19:16 gcc-ranlib -> /usr/bin/gcc-ranlib
lrwxrwxrwx 1 root root 18 May 23 19:16 gconftool -> /usr/bin/gconftool
lrwxrwxrwx 1 root root 13 May 23 19:16 gcov -> /usr/bin/gcov
lrwxrwxrwx 1 root root 18 May 23 19:16 gcov-tool -> /usr/bin/gcov-tool
lrwxrwxrwx 1 root root 13 May 23 19:16 geqn -> /usr/bin/geqn
lrwxrwxrwx 1 root root 12 May 23 19:16 GET -> /usr/bin/GET
lrwxrwxrwx 1 root root 16 May 23 19:16 getfacl -> /usr/bin/getfacl
lrwxrwxrwx 1 root root 17 May 23 19:16 gfortran -> /usr/bin/gfortran
...
편집: @Stephen Kitt의 제안에 따라 이 문제를 해결하기 위해 debsum을 사용해 보았습니다. 손상된 프로그램 수를 고려하여 debsums 패키지를 올바르게 다운로드하는 데 시간이 걸렸지만 마침내 실행할 수 있었습니다 debsums -c
. 출력은 다음과 같습니다.
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
sh: 1: awk: Too many levels of symbolic links
따라서 debsum이 올바르게 설치되지 않은 것 같습니다.
편집: 문제를 해결한 후 awk
debsums를 실행할 수 있었고 이제 다음과 같은 출력이 표시됩니다.
/boot/vmlinuz-4.2.0-16-generic
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/__init__.cpython-34.pyc
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/config.cpython-34.pyc
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/cupshelpers.cpython-34.pyc
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/installdriver.cpython-34.pyc
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/openprinting.cpython-34.pyc
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/ppds.cpython-34.pyc
/usr/lib/python3/dist-packages/cupshelpers/__pycache__/xmldriverprefs.cpython-34.pyc
이는 고무적이지만, 다양성이 부족하다는 점이 조금 걱정됩니다. 모든 심볼릭 링크(>100)가 내 디렉토리의 여러 다른 부분에서 제거되었다는 점을 고려하면 /usr/bin
모든 변경 사항이 내 Python 라이브러리에 있다는 것이 약간 이상합니다. 이것이 불가능해 보입니까, 아니면 debsums
실제로 작동합니까?
좋아, 내가 해야 할 일은 Python3 설치를 교체하는 것뿐이라고 가정하면 어떻게 해야 합니까? 나는 아직도 이 파일을 다운로드하기 위해 dpkg를 사용하는 방법을 이해하지 못합니다. 를 사용하여 검색하면 dpkg -S python3
.deb 파일 대신 패키지 이름이 표시됩니다. 하지만 관련 .deb 파일을 검색하고 다운로드하는 것만으로는 파일이 올바른 위치에 배치되지 않습니다. 나는 이것이 어떤 사람들에게는 단순한 문제처럼 들릴 수 있다는 것을 알고 있지만, 문제를 해결하기 위해 이 기본적인 일을 수행하는 방법을 여전히 모릅니다.
답변1
상상할 수 있듯이 ln
기호 링크만 대체됩니다. 이 문제를 해결하려면 적어도 누락된 심볼릭 링크를 제공하는 패키지를 다시 설치해야 합니다...
테스트 와 결합된 find
옵션을 사용하면 대부분의 경우 해당 패키지가 식별됩니다.-L
-type l
dpkg -S
dpkg -S $(find -L /usr/bin -type l)
apt-get
패키지 재설치를 허용 하도록 필터링하고 제공합니다 .
apt-get --reinstall install $(dpkg -S $(find -L /usr/bin -type l) | grep -v "diversion by" | cut -d: -f1)
여전히 일부 깨진 심볼릭 링크가 남아 있으며 대부분은 /etc/alternatives
; 이러한 문제는 다음과 유사한 방법을 사용하여 해결할 수 있습니다.
for file in $(find -L /usr/bin -type l -printf "%f\n"); do \
if [ -e "/etc/alternatives/${file}" ]; then \
ln -sf "/etc/alternatives/${file}" "/usr/bin/${file}"; \
fi; \
done
( 무엇을 해야할지 확인하기 위해 ln -sf
로 바꿔야 할 수도 있습니다 ...)echo
(이전에 사용하라고 제안했지만 debsums
심볼릭 링크가 해시되지 않았기 때문에 작동하지 않습니다.)