Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 

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/16/2025]

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

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  8  9  10  [11]  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13719정성태8/28/20247652Linux: 79. C++ - pthread_mutexattr_destroy가 없다면 메모리 누수가 발생할까요?
13718정성태8/27/20249755오류 유형: 921. Visual C++ - error C1083: Cannot open include file: 'float.h': No such file or directory [2]
13717정성태8/26/20249388VS.NET IDE: 192. Visual Studio 2022 - Windows XP / 2003용 C/C++ 프로젝트 빌드
13716정성태8/21/20248271C/C++: 167. Visual C++ - 윈도우 환경에서 _execv 동작 [1]
13715정성태8/19/20249909Linux: 78. 리눅스 C/C++ - 특정 버전의 glibc 빌드 (docker-glibc-builder)
13714정성태8/19/20247872닷넷: 2295. C# 12 - 기본 생성자(Primary constructors) (책 오타 수정) [3]
13713정성태8/16/20249938개발 환경 구성: 721. WSL 2에서의 Hyper-V Socket 연동
13712정성태8/14/20248846개발 환경 구성: 720. Synology NAS - docker 원격 제어를 위한 TCP 바인딩 추가
13711정성태8/13/20249503Linux: 77. C# / Linux - zombie process (defunct process) [1]파일 다운로드1
13710정성태8/8/202410055닷넷: 2294. C# 13 - (6) iterator 또는 비동기 메서드에서 ref와 unsafe 사용을 부분적으로 허용파일 다운로드1
13709정성태8/7/20249289닷넷: 2293. C# - safe/unsafe 문맥에 대한 C# 13의 (하위 호환을 깨는) 변화파일 다운로드1
13708정성태8/7/20249590개발 환경 구성: 719. ffmpeg / YoutubeExplode - mp4 동영상 파일로부터 Audio 파일 추출
13707정성태8/6/20249440닷넷: 2292. C# - 자식 프로세스의 출력이 4,096보다 많은 경우 Process.WaitForExit 호출 시 hang 현상파일 다운로드1
13706정성태8/5/20249090개발 환경 구성: 718. Hyper-V - 리눅스 VM에 새로운 디스크 추가
13705정성태8/4/20249316닷넷: 2291. C# 13 - (5) params 인자 타입으로 컬렉션 허용 [2]파일 다운로드1
13704정성태8/2/202410425닷넷: 2290. C# - 간이 dotnet-dump 프로그램 만들기파일 다운로드1
13703정성태8/1/20248695닷넷: 2289. "dotnet-dump ps" 명령어가 닷넷 프로세스를 찾는 방법
13702정성태7/31/20249825닷넷: 2288. Collection 식을 지원하는 사용자 정의 타입을 CollectionBuilder 특성으로 성능 보완파일 다운로드1
13701정성태7/30/202410422닷넷: 2287. C# 13 - (4) Indexer를 이용한 개체 초기화 구문에서 System.Index 연산자 허용파일 다운로드1
13700정성태7/29/202410290디버깅 기술: 200. DLL Export/Import의 Hint 의미
13699정성태7/27/202410201닷넷: 2286. C# 13 - (3) Monitor를 대체할 Lock 타입파일 다운로드1
13698정성태7/27/20249916닷넷: 2285. C# - async 메서드에서의 System.Threading.Lock 잠금 처리파일 다운로드1
13697정성태7/26/20249019닷넷: 2284. C# - async 메서드에서의 lock/Monitor.Enter/Exit 잠금 처리파일 다운로드1
13696정성태7/26/20249014오류 유형: 920. dotnet publish - error NETSDK1047: Assets file '...\obj\project.assets.json' doesn't have a target for '...'
13695정성태7/25/20249254닷넷: 2283. C# - Lock / Wait 상태에서도 STA COM 메서드 호출 처리파일 다운로드1
13694정성태7/25/20249334닷넷: 2282. C# - ASP.NET Core Web App의 Request 용량 상한값 (Kestrel, IIS)
1  2  3  4  5  6  7  8  9  10  [11]  12  13  14  15  ...