标签: windows-subsystem-for-linux

没有 Docker Desktop 的 WSL 下的 Docker

这是关于从 WSL 中运行 Docker 而不使用 Docker Desktop 的问题。对于WSL2是可行的,因此这个问题的重点是专门针对WSL1。根据我的研究,

\n
    \n
  • 有人说 “Docker 守护进程不能直接在 WSL 上运行”,而
  • \n
  • 另一篇文章称,在 Docker 社区版 17.09.0 的帮助下, Docker 可以“在 Windows 子系统 Linux 中无缝运行”,因为“对 WSL 内核进行了重大更改,允许使用 Docker 管理系统所需的 cgroup” \xe2\x80\x99s 资源放入容器中。”
  • \n
\n

我的docker在debian bullseye下是20.10.5。还会好吗?

\n

我尝试了一下,得到了:

\n
iptables can\'t initialize iptables table `nat\': Table does not exist\n
Run Code Online (Sandbox Code Playgroud)\n

Iptables v1.6.1 can'tinitialize iptables table `filter' Ubuntu 18.04 Bash Windows的答案是,

\n
\n

根据 github.com 上的 …

docker windows-subsystem-for-linux wsl-2

1
推荐指数
1
解决办法
3361
查看次数

在 WSL 上安装并运行 Airflow

我按照这篇文章中的过程在 WSL (Windows 10) 下的 Ubuntu 中安装了 Airflow 。

但运行时airflow db init,出现以下错误:

AttributeError: module 'wtforms.fields' has no attribute 'TextField'
Run Code Online (Sandbox Code Playgroud)

完整跟踪:

(airflow_env) sultani@Khalid:~/c/users/administrator/airflowhome$ airflow db init
DB: sqlite:///c/users/administrator/airflowhome/airflow.db
[2022-06-09 00:41:54,760] {db.py:1448} INFO - Creating tables
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Traceback (most recent call last):
  File "/home/sultani/.local/bin/airflow", line 8, in <module>
    sys.exit(main())
  File "/home/sultani/.local/lib/python3.8/site-packages/airflow/__main__.py", line 38, in main
    args.func(args)
  File "/home/sultani/.local/lib/python3.8/site-packages/airflow/cli/cli_parser.py", line 51, in command
    return func(*args, **kwargs)
  File "/home/sultani/.local/lib/python3.8/site-packages/airflow/cli/commands/db_command.py", line …
Run Code Online (Sandbox Code Playgroud)

windows ubuntu airflow windows-subsystem-for-linux

1
推荐指数
1
解决办法
2843
查看次数

Visual Studio Code - C/C++ 扩展命令不存在

我已经在 Visual Studio Code 上使用 WSL2 和 C/C++ 扩展有一段时间了,但最近它停止工作了。每当我尝试运行命令(例如编辑配置)时,都会弹出此错误:

错误消息(文字版本见下文)

文字版:

命令“C/C++:编辑配置 (UI)”导致错误(未找到命令“C_Cpp.ConfigurationEditUI”)

请注意,该扩展中的每个命令都会发生这种情况,而其他命令则可以正常工作(包括来自其他扩展的命令)。我的 IntelliSense 也停止正常工作(当我单击CTRL+SPACE等时什么也没有出现)。

我多次尝试重新安装扩展程序,包括转到以前的版本、删除文件夹、重新启动计算机等,但没有任何帮助。控制台中似乎也没有错误。

这种情况发生在我安装了VSCode 的 PROS 扩展之后,该扩展恰好依赖于clangd,我认为这就是问题所在(我使用的是 Linux 的 Windows 子系统,这意味着该扩展安装在 Ubuntu 上,并且我使用 GNU GCC /G++ 编译器)。有谁知道我该如何解决这个问题?(我不想重新安装 Visual Studio Code 或做任何激烈的事情,因为我有很多扩展和很多配置,如果这样做就会丢失)。

c++ visual-studio-code windows-subsystem-for-linux

1
推荐指数
1
解决办法
3434
查看次数

如何使用 WSL 配置文件在 WSL 启动时运行命令?

我在 WSL设置文件中添加了这些行

C:\Users\reynadan\.wslconfig

[boot]
command=bash /home/reynadan/scripts/startup.sh
Run Code Online (Sandbox Code Playgroud)

/etc/wsl.conf

[boot]
command=bash /home/reynadan/scripts/startup.sh
Run Code Online (Sandbox Code Playgroud)

/home/reynadan/scripts/startup.sh

[boot]
command=bash /home/reynadan/scripts/startup.sh
Run Code Online (Sandbox Code Playgroud)

我关闭并wsl --shutdown等待了超过 8 秒才再次运行它,但/home/reynadan/wslBootHistory.txt仍然是空的并且 docker 没有运行。

如何确保 WSL 在启动时运行我的脚本?

bash windows-subsystem-for-linux wsl-2

1
推荐指数
1
解决办法
3734
查看次数

如何使用 Windows PowerShell 列出 Windows 中适用于 Linux 的 Windows 子系统中可用的所有发行版?

我从 Microsoft 商店安装了 WSL,并尝试使用以下命令获取发行版列表。

wsl.exe --列表 --在线

在此输入图像描述

但我收到以下错误。

无法从“https://raw.githubusercontent.com/microsoft/WSL/master/distributions/DistributionInfo.json”获取列表分发。无法与服务器建立连接错误代码:Wsl/WININET_E_CANNOT_CONNECT

linux windows powershell windows-subsystem-for-linux

1
推荐指数
1
解决办法
5480
查看次数

在 Ubuntu 上使用 WSL2 安装 Ruby 时出现 RVM 错误:运行“__rvm_make -j16”时出错

我在重新安装 Windows 10 后重新安装我的环境。我得到了安装 WSL2 并使用 Ubuntu 发行版、nvm、node.js、rvm 和 ruby​​ 的说明。我的组织特别希望我们使用 ruby​​ 版本 2.7.4。我确信,如果我发布了不允许的完整说明,但我将发布他们告诉我们运行的代码,看看是否有人知道我为什么会收到此错误。我之前已经让它在这台机器上工作,并且这些步骤在其他 Windows 机器上是可重复的,因为我在我的笔记本电脑上设置了环境。

\n

以下是我被告知要遵循的步骤:

\n

1. Install Windows Subsystem for Linux (WSL) and Ubuntu\n\xe2\x80\xa2 Search for the "Command Prompt" application using the "Start" menu\n\xe2\x80\xa2 Select "Run as administrator" from the right side of the search window\n\xe2\x80\xa2 Allow the program to make changes to your device and wait for the "Command Prompt" application to open\n\xe2\x80\xa2 Type wsl --install -d Ubuntu and press \n\xe2\x80\xa2 The terminal should …

ubuntu development-environment windows-subsystem-for-linux

1
推荐指数
1
解决办法
4434
查看次数

Podman Desktop 无法初始化

在 Windows 上安装 Podman Desktop 并尝试初始化 podman 机器后,进程停止在“正在初始化”状态(无错误)。

当尝试手动初始化计算机(通过 CLI)时,会返回错误:

错误:来宾操作系统上的 Shadow-utils 包权限恢复失败:退出状态 0xffffffff

或者

错误:来宾操作系统的 WSL 导入失败

windows-subsystem-for-linux podman wsl-2

1
推荐指数
1
解决办法
1762
查看次数

使用GNU find递归创建具有随机内容的文件

我的目的是快速创建如下所示的目录树:

.
|-- dir1
|   |-- 01
|   |   `-- file_00
|   |       
|   |-- 02
|   |   `-- file_00
|   |       
|   |-- 03
|   |   `-- file_00
|   |       
|   |-- 04
|       `-- file_00
|           
`-- dir2
    |-- 01
    |   `-- file_00
    |       
    |-- 02
    |   `-- file_00
    |       
    |-- 03
    |   `-- file_00
    |      
    `-- 04
        `-- file_00
Run Code Online (Sandbox Code Playgroud)

我完成的是:

mkdir {dir1,dir2}
mkdir ./{dir1,dir2}/{01,02,03,04}
touch ./{dir1,dir2}/{01,02,03,04}/file_00
Run Code Online (Sandbox Code Playgroud)

但是当我想追加一个随机数时,$RANDOM随机就足够了,每次file_00我遇到问题.我试过了:

find . -type f -name 'file_00' …
Run Code Online (Sandbox Code Playgroud)

bash find windows-subsystem-for-linux

0
推荐指数
1
解决办法
44
查看次数

如何在Windows 10(WSL)上重置Ubuntu的颜色设置?

我玩过colortool.exe实用程序来更改终端的配色方案,然后将颜色重置为其默认值,但是现在Ubuntu的Bash显示了一些奇怪的颜色:

在此处输入图片说明

windows-subsystem-for-linux

0
推荐指数
1
解决办法
2488
查看次数

删除以双&符号和感叹号开头的文件

我有一个名为的文件 && !!

如何删除此文件.

On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    && !!
Run Code Online (Sandbox Code Playgroud)

rm -- "&& !!" 结果: rm: cannot remove '&& git st': No such file or directory

你可能已经猜到了git st是我的方式 git status

我怎么去?

打开vim

:e && !!

:wq

unix vim bash windows-subsystem-for-linux

0
推荐指数
2
解决办法
63
查看次数