Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 729. WSL 2 - Mariner VM 커널 이미지 업데이트 방법 [링크 복사], [링크+제목 복사],
조회: 4972
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)
(시리즈 글이 7개 있습니다.)
개발 환경 구성: 713. "WSL --debug-shell"로 살펴보는 WSL 2 VM의 리눅스 환경
; https://www.sysnet.pe.kr/2/0/13650

개발 환경 구성: 715. Windows - WSL 2 환경의 Docker Desktop 네트워크
; https://www.sysnet.pe.kr/2/0/13659

Linux: 88. WSL 2 리눅스 배포본 내에서의 pid 네임스페이스 구성
; https://www.sysnet.pe.kr/2/0/13771

Linux: 89. pid 네임스페이스 구성으로 본 WSL 2 배포본의 계층 관계
; https://www.sysnet.pe.kr/2/0/13772

Linux: 90. pid 네임스페이스 구성으로 본 WSL 2 + docker-desktop
; https://www.sysnet.pe.kr/2/0/13773

Linux: 91. Container 환경에서 출력하는 eBPF bpf_get_current_pid_tgid의 pid가 존재하지 않는 이유
; https://www.sysnet.pe.kr/2/0/13774

개발 환경 구성: 729. WSL 2 - Mariner VM 커널 이미지 업데이트 방법
; https://www.sysnet.pe.kr/2/0/13779




WSL 2 - Mariner VM 커널 이미지 업데이트 방법

어차피 WSL 2 VM도,

"WSL --debug-shell"로 살펴보는 WSL 2 VM의 리눅스 환경
; https://www.sysnet.pe.kr/2/0/13650

리눅스 커널이 설치된 유형이고, 해당 커널을 업데이트하는 것이 가능합니다. 이에 대해서는 공식 문서에서 자세하게 설명하고 있는데요,

How to use the Microsoft Linux kernel v6 on Windows Subsystem for Linux version 2 (WSL2)
; https://learn.microsoft.com/en-us/community/content/wsl-user-msft-kernel-v6

현재(2024-10-22) 기준으로 WSL 2의 리눅스 커널로는 6.6 버전이 최신이므로,

linux-msft-wsl-6.6.36.6
; https://github.com/microsoft/WSL2-Linux-Kernel/releases/tag/linux-msft-wsl-6.6.36.6

(참고로, 리눅스 원본 커널은 6.11이 최신입니다.)

이렇게 clone을 받아,

$ git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1 -b linux-msft-wsl-6.6.y

다음과 같이 빌드 환경 구성 후,

$ sudo apt update && sudo apt upgrade -y
$ sudo apt update && sudo apt install build-essential flex bison libssl-dev libelf-dev bc python3 -y

// Ubuntu 20.04의 경우
$ sudo apt install dwarves -y

// Ubuntu 24.04의 경우
$ sudo apt install pahole -y

빌드를 하면 됩니다.

$ cd WSL2-Linux-Kernel

$ make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl
...[생략]...
* Mitigations for CPU vulnerabilities
*
Mitigations for CPU vulnerabilities (CPU_MITIGATIONS) [Y/n/?] (NEW)
  Remove the kernel mapping in user mode (PAGE_TABLE_ISOLATION) [Y/n/?] y
  Avoid speculative indirect branches in kernel (RETPOLINE) [Y/n/?] y
    Enable return-thunks (RETHUNK) [Y/n/?] y
      Enable UNRET on kernel entry (CPU_UNRET_ENTRY) [Y/n/?] y
  Mitigate RSB underflow with call depth tracking (CALL_DEPTH_TRACKING) [Y/n/?] y
    Enable call thunks and call depth tracking debugging (CALL_THUNKS_DEBUG) [N/y/?] n
  Enable IBPB on kernel entry (CPU_IBPB_ENTRY) [Y/n/?] y
  Enable IBRS on kernel entry (CPU_IBRS_ENTRY) [Y/n/?] y
  Mitigate speculative RAS overflow on AMD (CPU_SRSO) [Y/n/?] y
  Force GDS Mitigation (GDS_FORCE_MITIGATION) [N/y/?] n
  RFDS Mitigation (MITIGATION_RFDS) [Y/n/?] y
  Mitigate Spectre-BHB (Branch History Injection) (MITIGATION_SPECTRE_BHI) [Y/n/?] y
*
* Analog to digital converters
*
Analog Devices AD7091R5 ADC Driver (AD7091R5) [N/m/?] n
Analog Devices AD7291 ADC driver (AD7291) [N/m/?] n
Analog Devices AD7606 ADC driver with parallel interface support (AD7606_IFACE_PARALLEL) [N/m/?] n
Analog Devices AD799x ADC driver (AD799X) [N/m/?] n
Analog Devices Generic AXI ADC IP core driver (ADI_AXI_ADC) [N/m/?] (NEW)
Envelope detector using a DAC and a comparator (ENVELOPE_DETECTOR) [N/m/?] n
AVIA HX711 ADC for weight cells (HX711) [N/m/?] n
Texas Instruments INA2xx Power Monitors IIO driver (INA2XX_ADC) [N/m/?] n
Linear Technology LTC2471 and LTC2473 ADC driver (LTC2471) [N/m/?] n
Linear Technology LTC2485 ADC driver (LTC2485) [N/m/?] n
Linear Technology LTC2497 ADC driver (LTC2497) [N/m/?] n
Maxim max1363 ADC driver (MAX1363) [N/m/?] n
Maxim max9611/max9612 ADC driver (MAX9611) [N/m/?] n
Microchip Technology MCP3421/2/3/4/5/6/7/8 driver (MCP3422) [N/m/?] n
Nuvoton NAU7802 ADC driver (NAU7802) [N/m/?] n
Richtek RTQ6056 Current and Power Monitor ADC (RICHTEK_RTQ6056) [N/m/?] n
Generic sigma delta modulator (SD_ADC_MODULATOR) [N/m/?] n
Texas Instruments ADC081C/ADC101C/ADC121C family (TI_ADC081C) [N/m/?] n
Texas Instruments ADS1015 ADC (TI_ADS1015) [N/m/?] n
Texas Instruments ADS7924 ADC (TI_ADS7924) [N/m/?] n
Texas Instruments ADS1100 and ADS1000 ADC (TI_ADS1100) [N/m/?] n
Freescale vf610 ADC driver (VF610_ADC) [N/m/?] n
Xilinx XADC driver (XILINX_XADC) [N/m/?] n
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
...[생략]...
  LD [M]  virt/lib/irqbypass.ko
  BTF [M] virt/lib/irqbypass.ko

$ sudo make modules_install headers_install

제가 했을 때는 중간에 2개의 질문이 나왔는데 그냥 엔터를 쳐서 진행했습니다. 이후, 빌드된 최종 이미지 파일인 bzImage를 윈도우 측의 c:\temp 경로를 통해 c:\ 루트에 복사했습니다.

$ cp arch/x86/boot/bzImage /mnt/c/temp

// c:\temp에 복사한 파일을 윈도우 탐색기에서 다시 "c:\" 루트 경로에 "bzImage-wsl2-6.6.36.6" 파일명으로 복사

마지막으로, 저 이미지 파일을 %USERPROFILE%\.wslconfig 파일에 다음과 같이 반영한 다음,

c:\temp> type %USERPROFILE%\.wslconfig
[wsl2]
kernel=C:\\bzImage-wsl2-6.6.36.6

wsl을 재시작합니다.

// 관리자 권한으로 실행
c:\temp> wsl --shutdown

이제 확인을 위해 아무 Linux 배포본이나 하나를 실행한 다음 uname 명령을 내리면,

$ uname -r
6.6.36.6-microsoft-standard-WSL2+

위와 같이 최신 커널이 적용된 것을 확인할 수 있습니다.




Ubuntu 20.04에서 이렇게 오류가 발생한다면?

$ sudo apt update && sudo apt install build-essential flex bison libssl-dev libelf-dev bc python3 pahole
...[생략]...
E Unable to locate package pahole

pahole 이름은 Ubuntu 22.04에서 변경된 것이라 하고,

BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
; https://stackoverflow.com/questions/61657707/btf-tmp-vmlinux-btf-pahole-pahole-is-not-available

그전에는 dwarves 패키지였다고 합니다. 따라서, 그냥 dwarves 패키지를 설치하면 된다고!

$ sudo apt install dwarves




본문에서 bzImage를 c:\temp를 경유해 복사했는데요, 왜냐하면 직접 c:\로 복사하는 경우 권한 오류가 발생하기 때문입니다.

$ cp arch/x86/boot/bzImage /mnt/c/
cp: cannot create regular file '/mnt/c/bzImage': Permission denied

$ sudo cp arch/x86/boot/bzImage /mnt/c/
cp: cannot create regular file '/mnt/c/bzImage': Permission denied




(현재 2024-10-22) 최신 커널 버전으로 업데이트 후, Docker Desktop이 실행되지 않는 문제가 발생합니다.

Docker Desktop - WSL distro terminated abruptly

A WSL distro that Docker Desktop relies on has exited unexpectedly. This usually happens as a result of an external entity terminating WSL (e.g. running wsl --shutdown). Restart Docker Desktop. If the issue persists,

error spotted in wslbootstrap log: "[2024-10-22T19:51:33.327836290Z][wsl-bootstrap][F] exit status 32"

wsl 버전을 보면,

C:\temp> wsl --version
WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.4317

저렇게 리눅스 커널이 5.15.153.1 버전으로 맞춰져 있는데요, 어쩌면 저것이 Docker Desktop의 오동작에 원인이 되는 듯합니다. 그렇긴 한데, 다른 Linux 배포본들은 아무 문제 없이 실행되는 것을 보면 또 그렇진 않을 것 같고. ^^;

참고로, microsoft / WSL 릴리스 노트를 보면, WSL 2.3.11 버전에서 리눅스 커널을 6.6.36.3에 맞춘 걸로 나오는데요,

2.3.11 Pre-release
Update Kernel to 6.6.36.3
Hundreds of new kernel modules added.

이후 2.3.17에서 다시 원복시켰습니다.

2.3.17 Pre-release
Revert Linux kernel to 5.15.153.1-2 while issues are being debugged

(현시점 가장 최신인) 2.3.24 버전까지 아직 6.6.x 커널로 업데이트를 안 시키고 있는데요, 나중에 이게 되면 Docker Desktop이 잘 되는지 한 번 더 테스트를 해봐야 할 것 같습니다. ^^





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

[연관 글]






[최초 등록일: ]
[최종 수정일: 10/22/2024]

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

비밀번호

댓글 작성자
 




... 106  107  108  109  110  111  112  113  114  115  116  117  118  [119]  120  ...
NoWriterDateCnt.TitleFile(s)
10949정성태4/28/201619899.NET Framework: 575. SharedDomain과 JIT 컴파일파일 다운로드1
10948정성태4/28/201623855.NET Framework: 574. .NET - 눈으로 확인하는 SharedDomain의 동작 방식 [3]파일 다운로드1
10947정성태4/27/201621737.NET Framework: 573. .NET CLR4 보안 모델 - 4. CLR4 보안 모델에서의 조건부 APTCA 역할파일 다운로드1
10946정성태4/26/201624531VS.NET IDE: 106. Visual Studio 2015 확장 - INI 파일을 위한 사용자 정의 포맷 기능 (Syntax Highlighting)파일 다운로드1
10945정성태4/26/201618303오류 유형: 327. VSIX 프로젝트 빌드 시 The "VsTemplatePaths" task could not be loaded from the assembly 오류 발생
10944정성태4/22/201619534디버깅 기술: 80. windbg - 풀 덤프 파일로부터 텍스트 파일의 내용을 찾는 방법
10943정성태4/22/201624385디버깅 기술: 79. windbg - 풀 덤프 파일로부터 .NET DLL을 추출/저장하는 방법 [1]
10942정성태4/19/201619705디버깅 기술: 78. windbg 사례 - .NET 예외가 발생한 시점의 오류 분석 [1]
10941정성태4/19/201619605오류 유형: 326. Error MSB8020 - The build tools for v120_xp (Platform Toolset = 'v120_xp') cannot be found.
10940정성태4/18/201622892Windows: 116. 프로세스 풀 덤프 시간을 줄여 주는 Process Reflection [3]
10939정성태4/18/201623906.NET Framework: 572. .NET APM 비동기 호출의 Begin...과 End... 조합 [3]파일 다운로드1
10938정성태4/13/201623475오류 유형: 325. 파일 삭제 시 오류 - Error 0x80070091: The directory is not empty.
10937정성태4/13/201631679Windows: 115. UEFI 모드로 윈도우 10 설치 가능한 USB 디스크 만드는 방법
10936정성태4/8/201642389Windows: 114. 삼성 센스 크로노스 7 노트북의 운영체제를 USB 디스크로 새로 설치하는 방법 [3]
10935정성태4/7/201626671웹: 32. Edge에서 Google Docs 문서 편집 시 한영 전환키가 동작 안하는 문제
10934정성태4/5/201625386디버깅 기술: 77. windbg의 콜스택 함수 인자를 쉽게 확인하는 방법 [1]
10933정성태4/5/201631018.NET Framework: 571. C# - 스레드 선호도(Thread Affinity) 지정하는 방법 [8]파일 다운로드1
10932정성태4/4/201623298VC++: 96. C/C++ 식 평가 - printf("%d %d %d\n", a, a++, a);
10931정성태3/31/201623568개발 환경 구성: 283. Hyper-V 내에 구성한 Active Directory 환경의 시간 구성 방법 [3]
10930정성태3/30/201621525.NET Framework: 570. .NET 4.5부터 추가된 CLR Profiler의 실행 시 Rejit 기능
10929정성태3/29/201631645.NET Framework: 569. ServicePointManager.DefaultConnectionLimit의 역할파일 다운로드1
10928정성태3/28/201637348.NET Framework: 568. ODP.NET의 완전한 닷넷 버전 Oracle ODP.NET, Managed Driver [2]파일 다운로드1
10927정성태3/25/201626549.NET Framework: 567. System.Net.ServicePointManager의 DefaultConnectionLimit 속성 설명
10926정성태3/24/201626094.NET Framework: 566. openssl의 PKCS#1 PEM 개인키 파일을 .NET RSACryptoServiceProvider에서 사용하는 방법 [10]파일 다운로드1
10925정성태3/24/201620398.NET Framework: 565. C# - Rabin-Miller 소수 생성 방법을 이용하여 RSACryptoServiceProvider의 개인키를 직접 채워보자 - 두 번째 이야기파일 다운로드1
10924정성태3/22/201621079오류 유형: 324. Visual Studio에서 Azure 클라우드 서비스 생성 시 Failed to initialize the PowerShell host 에러 발생
... 106  107  108  109  110  111  112  113  114  115  116  117  118  [119]  120  ...