Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 729. WSL 2 - Mariner VM 커널 이미지 업데이트 방법 [링크 복사], [링크+제목 복사],
조회: 3740
글쓴 사람
정성태 (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

비밀번호

댓글 작성자
 




[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13893정성태2/27/2025351Linux: 115. eBPF (bpf2go) - ARRAY / HASH map 기본 사용법
13892정성태2/24/2025675닷넷: 2325. C# - PowerShell과 연동하는 방법파일 다운로드1
13891정성태2/23/2025838닷넷: 2324. C# - 프로세스의 성능 카운터용 인스턴스 이름을 구하는 방법파일 다운로드1
13890정성태2/21/20251007닷넷: 2323. C# - 프로세스 메모리 중 Private Working Set 크기를 구하는 방법(Win32 API)파일 다운로드1
13889정성태2/20/20251183닷넷: 2322. C# - 프로세스 메모리 중 Private Working Set 크기를 구하는 방법(성능 카운터, WMI) [1]파일 다운로드1
13888정성태2/17/20251050닷넷: 2321. Blazor에서 발생할 수 있는 async void 메서드의 부작용
13887정성태2/17/20251184닷넷: 2320. Blazor의 razor 페이지에서 code-behind 파일로 코드를 분리하는 방법
13886정성태2/15/20251260VS.NET IDE: 196. Visual Studio - Code-behind처럼 cs 파일을 그룹핑하는 방법
13885정성태2/14/20251264닷넷: 2319. ASP.NET Core Web API / Razor 페이지에서 발생할 수 있는 async void 메서드의 부작용
13884정성태2/13/20251387닷넷: 2318. C# - (async Task가 아닌) async void 사용 시의 부작용파일 다운로드1
13883정성태2/12/20251320닷넷: 2317. C# - Memory Mapped I/O를 이용한 PCI Configuration Space 정보 열람파일 다운로드1
13882정성태2/10/20251265스크립트: 70. 파이썬 - oracledb 패키지 연동 시 Thin / Thick 모드
13881정성태2/7/20251359닷넷: 2316. C# - Port I/O를 이용한 PCI Configuration Space 정보 열람파일 다운로드1
13880정성태2/5/20251151오류 유형: 947. sshd - Failed to start OpenSSH server daemon.
13879정성태2/5/20251418오류 유형: 946. Ubuntu - N: Updating from such a repository can't be done securely, and is therefore disabled by default.
13878정성태2/3/20251219오류 유형: 945. Windows - 최대 절전 모드 시 DRIVER_POWER_STATE_FAILURE 발생 (pacer.sys)
13877정성태1/25/20251720닷넷: 2315. C# - PCI 장치 열거 (레지스트리, SetupAPI)파일 다운로드1
13876정성태1/25/20251945닷넷: 2314. C# - ProcessStartInfo 타입의 Arguments와 ArgumentList파일 다운로드1
13875정성태1/24/20251899스크립트: 69. 파이썬 - multiprocessing 패키지의 spawn 모드로 동작하는 uvicorn의 workers
13874정성태1/24/20251912스크립트: 68. 파이썬 - multiprocessing Pool의 기본 프로세스 시작 모드(spawn, fork)
13873정성태1/23/20251825디버깅 기술: 217. WinDbg - PCI 장치 열거
13872정성태1/23/20251715오류 유형: 944. WinDbg - 원격 커널 디버깅이 연결은 되지만 Break (Ctrl + Break) 키를 눌러도 멈추지 않는 현상
13871정성태1/22/20251791Windows: 278. Windows - 윈도우를 다른 모니터 화면으로 이동시키는 단축키 (Window + Shift + 화살표)
13870정성태1/18/20252035개발 환경 구성: 741. WinDbg - 네트워크 커널 디버깅이 가능한 NIC 카드 지원 확대
13869정성태1/18/20252223개발 환경 구성: 740. WinDbg - _NT_SYMBOL_PATH 환경 변수에 설정한 경로로 심벌 파일을 다운로드하지 않는 경우
[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...