从docker镜像导入wsl2虚拟机

一、下载镜像

docker run --name debian debian:unstable-slim

二、导出镜像tar文件

docker export debian -o debian.tar

三、导入wsl2虚拟系统

wsl --import debian D:\wsl2\debian\ D:\wsl2\debian.tar 
#查看导入系统 
wsl -l -v

三、systemd Error code: Wsl/Service/CreateInstance/E_UNEXPECTED报错处理

#安装systemd systemd-sysv 
apt install -y systemd systemd-sysv 
#如果还解决不了执行 
ln -s /usr/lib/systemd/systemd /sbin/init

四、archlinux wsl: Failed to start the systemd user session for ‘xxx’. See journalctl for more details.报错处理

  1. Cancel Stuck Jobs: Sometimes systemd-firstboot.service or systemd-networkd-wait-online.service hangs, blocking the user session.
    • Check for running jobs: systemctl list-jobs
    • Cancel the stuck job: sudo systemctl cancel <JOB_ID>
  2. Disable Problematic Services: Disable services known to cause timeouts in WSL:
    • sudo systemctl disable systemd-networkd-wait-online.service
  3. Check for UID Conflicts: WSL may fail to start systemd if multiple running distributions use the same default UID (usually 1000). Ensure your user zcluo has a unique UID if running multiple distros simultaneously.
  4. Clean Up Config: Corrupted user-level systemd configurations can prevent startup. Try renaming your user’s systemd config folder to see if it resolves the issue:
    • mv ~/.config/systemd ~/.config/systemd.bak
  5. Disable WSLg (If Graphical Apps aren’t needed): Conflicts with WSLg (GUI support) sometimes “nuke” the user runtime directory. You can disable it by adding guiApplications=false to your .wslconfig file in your Windows user profile folder.
    Arch Linux ForumsArch Linux Forums +4