Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

snap으로 설치한 "dotnet run" 실행 시 "undefined symbol: _dl_audit_symbind_alt, version GLIBC_PRIVATE" 오류

이상하군요, Ubuntu 24.04 환경에서 snap을 이용한 dotnet-sdk로, dotnet build도 되고 대상 DLL에 대한 실행도 잘 되는데,

$ sudo snap install dotnet-sdk --classic
...[생략]...

$ dotnet new console
$ dotnet build

$ dotnet /home/myuser/testapp/bin/Debug/net8.0/testapp.dll
Hello, World!

이것을 "dotnet run" 명령어로 수행하면 오류가 발생합니다. (2대의 Ubuntu 24.04 환경 중 한 곳에서만 발생했습니다.)

$ dotnet run
/home/myuser/testapp/bin/Debug/net8.0/testapp: symbol lookup error: /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6: undefined symbol: _dl_audit_symbind_alt, version GLIBC_PRIVATE

$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.42
Copyright (C) 2024 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

$ ldd --version
ldd (Ubuntu GLIBC 2.39-0ubuntu8.4) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

가만 보니, 출력이 실행 파일인데 그것만으로 실행해도 문제가 재현됩니다.

$ /home/myuser/testapp/bin/Debug/net8.0/testapp
/home/myuser/testapp/bin/Debug/net8.0/testapp: symbol lookup error: /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6: undefined symbol: _dl_audit_symbind_alt, version GLIBC_PRIVATE

좀 더 자세한 바인딩 오류를 LD_DEBUG, LD_TRACE_LOADED_OBJECTS 환경 변수를 통해 확인할 수 있는데요,

$ LD_DEBUG=bindings ./bin/Debug/net8.0/testapp 2>&1 | grep GLIBC_PRIVATE | grep testapp
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_dl_argv' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `__libc_enable_secure' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_rtld_global_ro' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `__libc_dlerror_result' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_rtld_global' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_rtld_global' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_dl_find_dso_for_object' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_dl_deallocate_tls' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_dl_signal_error' [GLIBC_PRIVATE]
     82373:     binding file /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 [0] to /snap/core20/current/lib64/ld-linux-x86-64.so.2 [0]: normal symbol `_dl_signal_exception' [GLIBC_PRIVATE]
     82373:     /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6: error: symbol lookup error: undefined symbol: _dl_audit_symbind_alt, version GLIBC_PRIVATE (fatal)
./bin/Debug/net8.0/testapp: symbol lookup error: /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6: undefined symbol: _dl_audit_symbind_alt, version GLIBC_PRIVATE

$ LD_TRACE_LOADED_OBJECTS=1 ./bin/Debug/net8.0/testapp 
        linux-vdso.so.1 (0x00007ffd9e133000)
        libpthread.so.0 => /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007dcd00bd5000)
        libdl.so.2 => /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libdl.so.2 (0x00007dcd00bd0000)
        libstdc++.so.6 => /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007dcd00800000)
        libm.so.6 => /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007dcd00ae7000)
        libgcc_s.so.1 => /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007dcd00ab9000)
        libc.so.6 => /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007dcd00400000)
        /snap/core20/current/lib64/ld-linux-x86-64.so.2 (0x00007dcd00bdc000)

그러니까 "libc.so.6" 파일에서 _dl_audit_symbind_alt 심벌을 참조하고 있지만,

$ readelf -Ws /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 | grep _dl_audit_symbind_alt
    10: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _dl_audit_symbind_alt@GLIBC_PRIVATE (42)

$ objdump -T /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 | grep _dl_audit_symbind_alt
0000000000000000      DF *UND*  0000000000000000 (GLIBC_PRIVATE) _dl_audit_symbind_alt

$ nm -D /home/myuser/testapp/bin/Debug/net8.0/../../../../../../usr/lib/x86_64-linux-gnu/libc.so.6 | grep _dl_audit_symbind_alt
                 U _dl_audit_symbind_alt@GLIBC_PRIVATE

/* so 파일에는 regular symbol table과 dynamic symbol table이 각각 다음과 같이 정의돼 있다고 합니다. (참고: nm vs "readelf -s")

regular symbol table:  // 디버깅 목적으로 사용 (심지어 static 함수에 대한 심벌 정보까지 포함)
    .symtab
    .strtab

dynamic symbol table: // dynamic loader에 의해 사용 (빠른 검색을 위해!)
    .dynsym
    .dynstr

strip 명령어는 regular 테이블을 삭제하고 dynamic 테이블은 남겨둔다고 합니다. 
"nm ..." 명령어는 regular table의 심벌을 출력하고, 
"nm -D ...", "readelf -s" 명령어는 dynamic table의 심벌을 출력하므로 
이를 통해 해당 so 파일이 strip 명령어로 제거된 것인지 확인할 수 있습니다.
*/

GLIBC_PRIVATE 버전의 공유 파일, 위의 경우 "/snap/core20/current/lib64/ld-linux-x86-64.so.2" 파일에는 해당 심벌이 없다고 하는 건데 실제로도 존재하지 않았습니다.

$ readelf -Ws /snap/core20/current/lib64/ld-linux-x86-64.so.2 | grep _dl_audit_symbind_alt
$

$ ls /snap/core20/current/lib64/ld-linux-x86-64.so.2 -l
lrwxrwxrwx 1 root root 34 May 27 07:13 /snap/core20/current/lib64/ld-linux-x86-64.so.2 -> ../lib/x86_64-linux-gnu/ld-2.31.so

$ ls /snap/core20/current/lib/x86_64-linux-gnu/ld-2.31.so -l
-rwxr-xr-x 1 root root 191504 Jan 29 23:41 /snap/core20/current/lib/x86_64-linux-gnu/ld-2.31.so

$ readelf -Ws /snap/core20/current/lib/x86_64-linux-gnu/ld-2.31.so | grep _dl_audit_symbind_alt
$

일단 문제는 확인했군요. ^^




그런데, ld-linux-x86-64.so.2 파일의 경로가 특이한데요, 해당 시스템의 일반적인 실행 모듈들은 이렇게 "/lib64/ld-linux-x86-64.so.2" 모듈에 의존성을 두고 있습니다.

$ LD_TRACE_LOADED_OBJECTS=1 dotnet
        linux-vdso.so.1 (0x00007ffc67afe000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ee1dce00000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ee1dd201000)

그리고 저 경로의 ld-linux-x86-64.so.2 파일에는 이렇게 _dl_audit_symbind_alt 심벌이 존재합니다.

$ readelf -Ws /lib64/ld-linux-x86-64.so.2 | grep _dl_audit_symbind_alt
     2: 000000000001ae50   789 FUNC    GLOBAL DEFAULT   11 _dl_audit_symbind_alt@@GLIBC_PRIVATE

희한하군요, 왜 dotnet이 빌드한 실행 파일만 /snap/core20/current/lib64/ld-linux-x86-64.so.2 파일을 참조하는 걸까요? 제가 아직 린알못이라 구체적인 이유는 모르겠지만, snap 패키지 관리자가 격리시킨 sandbox 환경의 영향으로 그렇게 된 것이 아닐까 싶습니다.

즉, dotnet 설치를 snap으로 설치하는 대신 apt로부터 설치해 문제를 우회했습니다.

$ sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0

...[생략]...

$ dotnet run
Hello, World!

$ /home/myuser/testapp/bin/Debug/net8.0/testapp
Hello, World!




lddtree로 보면, "interpreter"라는 항목으로 문제의 그 so 파일 경로를 알 수 있습니다.

// sudo apt install pax-utils

$ lddtree /home/myuser/testapp/bin/Debug/net8.0/testapp
/home/myuser/testapp/bin/Debug/net8.0/testapp (interpreter => /snap/core20/current/lib64/ld-linux-x86-64.so.2)
    libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0
    libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6
    libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
    libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6


$ readelf -Ws /snap/core20/current/lib64/ld-linux-x86-64.so.2 | grep _dl_audit_symbind_alt
$ 

해당 파일은 어떤 모듈보다도 먼저 로딩돼 loader로서의 역할을 한다고 하는데요, 여기 구현된 함수들을 바인딩할 때 사용하는 버전 정보가 바로 "GLIBC_PRIVATE"라고 합니다. 게다가, 해당 심벌은 GLIBC 내부에서만 사용되는 것으로 제한되며 사용자 프로그램에서 직접 사용해서는 안 된다고 합니다.

결국, snap으로 설치한 dotnet이 빌드한 실행 모듈은 /snap/core20/current/lib64/ld-linux-x86-64.so.2 파일을 interpreter로 사용하기 때문에 문제가 되는 건데요, 이것을 patchelf를 사용하면 interpreter 경로를 변경할 수 있다고 합니다.

patchelf 사용법.
; https://wyv3rn.tistory.com/81

가령 위에서 생성했던 /home/myuser/testapp/bin/Debug/net8.0/testapp 파일의 경우 이렇게 수정하면,

$ sudo apt install patchelf

$ patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 /home/myuser/testapp/bin/Debug/net8.0/testapp

동작하겠지만, 번거롭게 매번 저런 작업을 하기보다는 그냥 처음부터 apt로 설치하는 것이 더 편리할 것입니다. ^^;




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 7/17/2025]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 91  92  93  94  95  96  97  98  99  100  101  102  103  [104]  105  ...
NoWriterDateCnt.TitleFile(s)
11381정성태11/30/201720707.NET Framework: 702. 한글이 포함된 바이트 배열을 나눈 경우 한글이 깨지지 않도록 다시 조합하는 방법(두 번째 이야기)파일 다운로드1
11380정성태11/30/201720605디버깅 기술: 109. windbg - (x64에서의 인자 값 추적을 이용한) Thread.Abort 시 대상이 되는 스레드를 식별하는 방법
11379정성태11/30/201720295오류 유형: 435. System.Web.HttpException - Session state has created a session id, but cannot save it because the response was already flushed by the application.
11378정성태11/29/201722130.NET Framework: 701. 한글이 포함된 바이트 배열을 나눈 경우 한글이 깨지지 않도록 다시 조합하는 방법 [1]파일 다운로드1
11377정성태11/29/201721853.NET Framework: 700. CommonOpenFileDialog 사용 시 사용자가 선택한 파일 목록을 구하는 방법 [3]파일 다운로드1
11376정성태11/28/201726596VS.NET IDE: 123. Visual Studio 편집기의 \r\n (crlf) 개행을 \n으로 폴더 단위로 설정하는 방법
11375정성태11/28/201720045오류 유형: 434. Visual Studio로 ASP.NET 디버깅 중 System.Web.HttpException - Could not load type 오류
11374정성태11/27/201726311사물인터넷: 14. 라즈베리 파이 - (윈도우의 NT 서비스처럼) 부팅 시 시작하는 프로그램 설정 [1]
11373정성태11/27/201725291오류 유형: 433. Raspberry Pi/Windows 다중 플랫폼 지원 컴파일 관련 오류 기록
11372정성태11/25/201727660사물인터넷: 13. 윈도우즈 사용자를 위한 라즈베리 파이 제로 W 모델을 설정하는 방법 [4]
11371정성태11/25/201721602오류 유형: 432. Hyper-V 가상 스위치 생성 시 Failed to connect Ethernet switch port 0x80070002 오류 발생
11370정성태11/25/201721888오류 유형: 431. Hyper-V의 Virtual Switch 생성 시 "External network" 목록에 특정 네트워크 어댑터 항목이 없는 경우
11369정성태11/25/201723488사물인터넷: 12. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 키보드 및 마우스로 쓰는 방법 (절대 좌표, 상대 좌표, 휠) [1]
11368정성태11/25/201728848.NET Framework: 699. UDP 브로드캐스트 주소 255.255.255.255와 192.168.0.255의 차이점과 이를 고려한 C# UDP 서버/클라이언트 예제 [2]파일 다운로드1
11367정성태11/25/201729443개발 환경 구성: 337. 윈도우 운영체제의 route 명령어 사용법
11366정성태11/25/201721396오류 유형: 430. 이벤트 로그 - Cryptographic Services failed while processing the OnIdentity() call in the System Writer Object.
11365정성태11/25/201722576오류 유형: 429. 이벤트 로그 - User Policy could not be updated successfully
11364정성태11/24/201725632사물인터넷: 11. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 마우스로 쓰는 방법 (절대 좌표) [2]
11363정성태11/23/201725749사물인터넷: 10. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 마우스 + 키보드로 쓰는 방법 (두 번째 이야기)
11362정성태11/22/201720668오류 유형: 428. 윈도우 업데이트 KB4048953 - 0x800705b4 [2]
11361정성태11/22/201723937오류 유형: 427. 이벤트 로그 - Filter Manager failed to attach to volume '\Device\HarddiskVolume??' 0xC03A001C
11360정성태11/22/201724679오류 유형: 426. 이벤트 로그 - The kernel power manager has initiated a shutdown transition.
11359정성태11/16/201723818오류 유형: 425. 윈도우 10 Version 1709 (OS Build 16299.64) 업그레이드 시 발생한 문제 2가지
11358정성태11/15/201728973사물인터넷: 9. Visual Studio 2017에서 Raspberry Pi C++ 응용 프로그램 제작 [1]
11357정성태11/15/201729428개발 환경 구성: 336. 윈도우 10 Bash 쉘에서 C++ 컴파일하는 방법
11356정성태11/15/201731021사물인터넷: 8. Raspberry Pi Zero(OTG)를 다른 컴퓨터에 연결해 가상 마우스 + 키보드로 쓰는 방법 [4]
... 91  92  93  94  95  96  97  98  99  100  101  102  103  [104]  105  ...