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

비밀번호

댓글 작성자
 




... 16  17  [18]  19  20  21  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
13545정성태1/30/202412230닷넷: 2212. ASP.NET Core - 우선순위에 따른 HTTP/HTTPS 호스트:포트 바인딩 방법
13544정성태1/30/202411563오류 유형: 894. Microsoft.Data.SqlClient - Could not load file or assembly 'System.Security.Permissions, ...'
13543정성태1/30/202412069Windows: 254. Windows - 기본 사용 중인 5357 포트 비활성화는 방법
13542정성태1/30/202410330오류 유형: 893. Visual Studio - Web Application을 실행하지 못하는 IISExpress - 두 번째 이야기
13541정성태1/29/202411530VS.NET IDE: 188. launchSettings.json의 useSSL 옵션
13540정성태1/29/202410756Linux: 69. 리눅스 - "Docker Desktop for Windows" Container 환경에서 IPv6 Loopback Address 바인딩 오류
13539정성태1/26/202410469개발 환경 구성: 703. Visual Studio - launchSettings.json을 이용한 HTTP/HTTPS 포트 바인딩
13538정성태1/25/202411319닷넷: 2211. C# - NonGC(FOH) 영역에 .NET 개체를 생성파일 다운로드1
13537정성태1/24/202412754닷넷: 2210. C# - Native 메모리에 .NET 개체를 생성파일 다운로드1
13536정성태1/23/202412048닷넷: 2209. .NET 8 - NonGC Heap / FOH (Frozen Object Heap) [1]
13535정성태1/22/202413292닷넷: 2208. C# - GCHandle 구조체의 메모리 분석
13534정성태1/21/202411559닷넷: 2207. C# - SQL Server DB를 bacpac으로 Export/Import파일 다운로드1
13533정성태1/18/202411599닷넷: 2206. C# - TCP KeepAlive의 서버 측 구현파일 다운로드1
13532정성태1/17/202411840닷넷: 2205. C# - SuperSimpleTcp 사용 시 주의할 점파일 다운로드1
13531정성태1/16/202412153닷넷: 2204. C# - TCP KeepAlive에 새로 추가된 Retry 옵션파일 다운로드1
13530정성태1/15/202411842닷넷: 2203. C# - Python과의 AES 암호화 연동파일 다운로드1
13529정성태1/15/202411647닷넷: 2202. C# - PublishAot의 glibc에 대한 정적 링킹하는 방법
13528정성태1/14/202412413Linux: 68. busybox 컨테이너에서 실행 가능한 C++, Go 프로그램 빌드
13527정성태1/14/202412806오류 유형: 892. Visual Studio - Failed to launch debug adapter. Additional information may be available in the output window.
13526정성태1/14/202413064닷넷: 2201. C# - Facebook 연동 / 사용자 탈퇴 처리 방법
13525정성태1/13/202411662오류 유형: 891. Visual Studio - Web Application을 실행하지 못하는 IISExpress
13524정성태1/12/202411078오류 유형: 890. 한국투자증권 KIS Developers OpenAPI - GW라우팅 중 오류가 발생했습니다.
13523정성태1/12/202412335오류 유형: 889. Visual Studio - error : A project with that name is already opened in the solution.
13522정성태1/11/202413294닷넷: 2200. C# - HttpClient.PostAsJsonAsync 호출 시 "Transfer-Encoding: chunked" 대신 "Content-Length" 헤더 처리
13521정성태1/11/202411658닷넷: 2199. C# - 한국투자증권 KIS Developers OpenAPI의 WebSocket Ping, Pong 처리
13520정성태1/10/202411618오류 유형: 888. C# - Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`....' [1]
... 16  17  [18]  19  20  21  22  23  24  25  26  27  28  29  30  ...