标签:4.19 57 Squashfs DESKTOP 编译 内核 singularity WSL2 squashfs
编译更新 WSL2 内核至4.19.57,增加 Squashfs 支持
前言
WSL是WIN10中内置的Linux子系统,WSL2是WSL技术的第二版。今天在WSL2环境中测试Singularity时遇到问题,无法启动sif格式镜像。经分析,原因是内核中没有squashfs文件系统所致。
当前内核版本:
root@DESKTOP-ASI6ES4:~# uname -r
4.19.43-microsoft-standard
错误表现:
root@DESKTOP-ASI6ES4:/opt/singularity# singularity shell busybox_latest.sif
FATAL: container creation failed: mount /proc/self/fd/3/usr/local/var/singularity/mnt/session/rootfs error: can’t mount image /proc/self/fd/3: failed to mount squashfs filesystem: no such device
准备编译环境
微软商店获取 Ubuntu(我使用的是16.04), 并转换成 VERSION2 (WSL2)模式
wsl.exe --list -v
NAME STATE VERSION
Ubuntu-16.04 Running 2
获取WSL2 Kernel最新代码
微软已经在GITHUB上开源了内核代码,GITHUB
安装依赖
sudo install build-essential flex bison libssl-dev libelf-dev
编译内核
查看 modules.builtin 文件,发现最新代码中已经增加了squashfs支持
kernel/fs/squashfs/squashfs.ko
所以直接编译
make KCONFIG_CONFIG=Microsoft/config-wsl
编译成功后,项目根目录会产生 vmlinux,把该文件复制到 windows 文件系统中,例如 c:\tmp
cp ./vmlinux /mnt/c/tmp/
替换内核
WIN10中以管理员身份运行 PowerShell
- 停止所有 WSL 实例
wsl.exe --shutdown
- 备份原内核
cd C:\Windows\System32\lxss\tools
move kernel kernel.back - 复制编译好的内核
cp c:\tmp\vmlinux .\kernel
重新启动 WSL2, 验证singularity
最新内核版本:
root@DESKTOP-ASI6ES4:/opt/singularity# uname -r
4.19.57-microsoft-standard+
重启ubuntu16.04
wsd.exe -d Ubuntu-16.04
再次运行singularity
root@DESKTOP-ASI6ES4:/opt/singularity# singularity shell busybox_latest.sif
Singularity>
工作正常
延伸阅读
WSL2 Announcing: https://devblogs.microsoft.com/commandline/announcing-wsl-2/
WSL2 使用入门: https://linux.cn/article-10972-1.html
Singularity3.3手册: https://sylabs.io/guides/3.3/user-guide/
标签:4.19,57,Squashfs,DESKTOP,编译,内核,singularity,WSL2,squashfs 来源: https://blog.csdn.net/weixin_44008092/article/details/96125560
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。