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

비밀번호

댓글 작성자
 




... 76  77  78  79  80  81  82  83  84  85  86  [87]  88  89  90  ...
NoWriterDateCnt.TitleFile(s)
11810정성태2/11/201919923.NET Framework: 808. .NET Profiler - GAC 모듈에서 GAC 비-등록 모듈을 참조하는 경우의 문제
11809정성태2/11/201923025.NET Framework: 807. ClrMD를 이용해 메모리 덤프 파일로부터 특정 인스턴스를 참조하고 있는 소유자 확인
11808정성태2/8/201924587디버깅 기술: 123. windbg - 닷넷 응용 프로그램의 메모리 누수 분석
11807정성태1/29/201922284Windows: 156. 가상 디스크의 용량을 복구 파티션으로 인해 늘리지 못하는 경우 [4]
11806정성태1/29/201920984디버깅 기술: 122. windbg - 덤프 파일로부터 PID와 환경 변수 등의 정보를 구하는 방법
11805정성태1/28/201924036.NET Framework: 806. C# - int []와 object []의 차이로 이해하는 제네릭의 필요성 [4]파일 다운로드1
11804정성태1/24/201921609Windows: 155. diskpart - remove letter 이후 재부팅 시 다시 드라이브 문자가 할당되는 경우
11803정성태1/10/201920550디버깅 기술: 121. windbg - 닷넷 Finalizer 스레드가 멈춰있는 현상
11802정성태1/7/201922134.NET Framework: 805. 두 개의 윈도우를 각각 실행하는 방법(Windows Forms, WPF)파일 다운로드1
11801정성태1/1/201923047개발 환경 구성: 427. Netsh의 네트워크 모니터링 기능 [3]
11800정성태12/28/201822502오류 유형: 509. WCF 호출 오류 메시지 - System.ServiceModel.CommunicationException: Internal Server Error
11799정성태12/19/201824685.NET Framework: 804. WPF(또는 WinForm)에서 UWP UI 구성 요소 사용하는 방법 [3]파일 다운로드1
11798정성태12/19/201823239개발 환경 구성: 426. vcpkg - "Building vcpkg.exe failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++"
11797정성태12/19/201818503개발 환경 구성: 425. vcpkg - CMake Error: Problem with archive_write_header(): Can't create '' 빌드 오류
11796정성태12/19/201819882개발 환경 구성: 424. vcpkg - "File does not have expected hash" 오류를 무시하는 방법
11795정성태12/19/201823379Windows: 154. PowerShell - Zone 별로 DNS 레코드 유형 정보 조회 [1]
11794정성태12/16/201819247오류 유형: 508. Get-AzureWebsite : Request to a downlevel service failed.
11793정성태12/16/201822083개발 환경 구성: 423. NuGet 패키지 제작 - Native와 Managed DLL을 분리하는 방법 [1]
11792정성태12/11/201820501Graphics: 34. .NET으로 구현하는 OpenGL (11) - Per-Pixel Lighting파일 다운로드1
11791정성태12/11/201820667VS.NET IDE: 130. C/C++ 프로젝트의 시작 프로그램으로 .NET Core EXE를 지정하는 경우 닷넷 디버깅이 안 되는 문제 [1]
11790정성태12/11/201819973오류 유형: 507. Could not save daemon configuration to C:\ProgramData\Docker\config\daemon.json: Access to the path 'C:\ProgramData\Docker\config' is denied.
11789정성태12/10/201834448Windows: 153. C# - USB 장치의 연결 및 해제 알림을 위한 WM_DEVICECHANGE 메시지 처리 [2]파일 다운로드2
11788정성태12/4/201819951오류 유형: 506. SqlClient - Value was either too large or too small for an Int32.Couldn't store <2151292191> in ... Column
11787정성태11/29/201823974Graphics: 33. .NET으로 구현하는 OpenGL (9), (10) - OBJ File Format, Loading 3D Models파일 다운로드1
11786정성태11/29/201821042오류 유형: 505. OpenGL.NET 예제 실행 시 "Managed Debugging Assistant 'CallbackOnCollectedDelegate'" 예외 발생
11785정성태11/21/201822459디버깅 기술: 120. windbg 분석 사례 - ODP.NET 사용 시 Finalizer에서 System.AccessViolationException 예외 발생으로 인한 비정상 종료
... 76  77  78  79  80  81  82  83  84  85  86  [87]  88  89  90  ...