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

비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  37  38  [39]  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
13015정성태3/26/202220432.NET Framework: 1182. C# 11 - ref struct에 ref 필드를 허용 [1]
13014정성태3/23/202216387VC++: 155. CComPtr/CComQIPtr과 Conformance mode 옵션의 충돌 [1]
13013정성태3/22/202214929개발 환경 구성: 641. WSL 우분투 인스턴스에 파이썬 2.7 개발 환경 구성하는 방법
13012정성태3/21/202214880오류 유형: 803. C# - Local '...' or its members cannot have their address taken and be used inside an anonymous method or lambda expression
13011정성태3/21/202218901오류 유형: 802. 윈도우 운영체제에서 웹캠 카메라 인식이 안 되는 경우
13010정성태3/21/202214679오류 유형: 801. Oracle.ManagedDataAccess.Core - GetTypes 호출 시 "Could not load file or assembly 'System.DirectoryServices.Protocols...'" 오류
13009정성태3/20/202217500개발 환경 구성: 640. docker - ibmcom/db2 컨테이너 실행
13008정성태3/19/202217468VS.NET IDE: 176. 비주얼 스튜디오 - 솔루션 탐색기에서 프로젝트를 선택할 때 csproj 파일이 열리지 않도록 만드는 방법
13007정성태3/18/202214976.NET Framework: 1181. C# - Oracle.ManagedDataAccess의 Pool 및 그것의 연결 개체 수를 알아내는 방법파일 다운로드1
13006정성태3/17/202218359.NET Framework: 1180. C# - ffmpeg(FFmpeg.AutoGen)를 이용한 remuxing.c 예제 포팅
13005정성태3/17/202216431오류 유형: 800. C# - System.InvalidOperationException: Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.
13004정성태3/16/202215869디버깅 기술: 182. windbg - 닷넷 메모리 덤프에서 AppDomain에 걸친 정적(static) 필드 값을 조사하는 방법
13003정성태3/15/202216232.NET Framework: 1179. C# - (.NET Framework를 위한) Oracle.ManagedDataAccess 패키지의 성능 카운터 설정 방법
13002정성태3/14/202218024.NET Framework: 1178. C# - ffmpeg(FFmpeg.AutoGen)를 이용한 http_multiclient.c 예제 포팅
13001정성태3/13/202218609.NET Framework: 1177. C# - 닷넷에서 허용하는 메서드의 매개변수와 호출 인자의 최대 수
13000정성태3/12/202217126.NET Framework: 1176. C# - Oracle.ManagedDataAccess.Core의 성능 카운터 설정 방법
12999정성태3/10/202217393.NET Framework: 1175. Visual Studio - 프로젝트 또는 솔루션의 Clean 작업 시 응용 프로그램에서 생성한 파일을 함께 삭제파일 다운로드1
12998정성태3/10/202214223.NET Framework: 1174. C# - ELEMENT_TYPE_FNPTR 유형의 사용 예
12997정성태3/10/202225024오류 유형: 799. Oracle.ManagedDataAccess - "ORA-01882: timezone region not found" 오류가 발생하는 이유
12996정성태3/9/202226282VS.NET IDE: 175. Visual Studio - 인텔리센스에서 오버로드 메서드를 키보드로 선택하는 방법
12995정성태3/8/202217411.NET Framework: 1173. .NET에서 Producer/Consumer를 구현한 BlockingCollection<T>
12994정성태3/8/202216826오류 유형: 798. WinDbg - Failed to load data access module, 0x80004002
12993정성태3/4/202216955.NET Framework: 1172. .NET에서 Producer/Consumer를 구현하는 기초 인터페이스 - IProducerConsumerCollection<T>
12992정성태3/3/202220428.NET Framework: 1171. C# - BouncyCastle을 사용한 암호화/복호화 예제파일 다운로드1
12991정성태3/2/202218008.NET Framework: 1170. C# - ffmpeg(FFmpeg.AutoGen)를 이용한 transcode_aac.c 예제 포팅
12990정성태3/2/202218425오류 유형: 797. msbuild - The BaseOutputPath/OutputPath property is not set for project '[...].vcxproj'
... 31  32  33  34  35  36  37  38  [39]  40  41  42  43  44  45  ...