topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.82k stars 121 forks source link

Multiple Issues - Containers + Windows update #526

Open oenu opened 1 year ago

oenu commented 1 year ago

v12.0.2

Erroneous Behavior

Running from admin Powershell 7, have ubuntu installed via wsl2

~~~
── (Ubuntu) 13:49:54 - Containers ──────────────────────────────────────────────
The application panicked (crashed).
Message:  assertion failed: `(left == right)`
  left: `1`,
 right: `2`
Location: /home/oenu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/topgrade-12.0.2/src/steps/containers.rs:83

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
~~~
~~~
── 13:50:23 - winget ───────────────────────────────────────────────────────────
Winget is disabled by default. Enable it by setting enable_winget=true in the [windows] section in the configuration.

── 13:50:23 - Windows Update ───────────────────────────────────────────────────
Running Windows Update. Check the control panel for progress.
Windows update failed:
   0: Command failed: `C:\Windows\system32\UsoClient.EXE ScanInstallWait`
   1: `C:\Windows\system32\UsoClient.EXE` failed: exit code: 0x80070057

Location:
   C:\Users\(username)\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:157

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Retry? (y)es/(N)o/(s)hell/(q)uit
~~~

Expected Behavior

Steps to reproduce

topgrade -y

Problem persists without calling from topgrade



## Additional Details
- Operation System/Version
Windows 11 Pro, Wsl2 Ubuntu Jammy 

- Installation
  <!-- 
  How did you install topgrade: build from repo / crates.io (cargo install topgrade) 
  / package manager (which one) / other (describe)
  -->

- Topgrade version (`topgrade -V`)

## Verbose Output (`topgrade -v`)
<!-- 
Paste the verbose output into the pre-tags
-->

<details>
<pre>
── (Ubuntu) 13:57:31 - Containers ──────────────────────────────────────────────
The application panicked (crashed).
Message:  assertion failed: `(left == right)`
  left: `1`,
 right: `2`
Location: /home/oenu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/topgrade-12.0.2/src/steps/containers.rs:83

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
DEBUG Command failed: Err(
   0: Command failed: `C:\Windows\system32\wsl.EXE -d Ubuntu bash -c 'TOPGRADE_PREFIX=Ubuntu exec /home/oenu/.cargo/bin/topgrade
      '`
   1: `C:\Windows\system32\wsl.EXE` failed: exit code: 101

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:114

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Upgrading "Ubuntu": Err(
   0: Command failed: `C:\Windows\system32\wsl.EXE -d Ubuntu bash -c 'TOPGRADE_PREFIX=Ubuntu exec /home/oenu/.cargo/bin/topgrade
      '`
   1: `C:\Windows\system32\wsl.EXE` failed: exit code: 101

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:114

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Executing command `C:\Windows\system32\wsl.EXE -d docker-desktop-data bash -lc 'which topgrade'`
DEBUG Command failed: Err(
   0: Command failed: `C:\Windows\system32\wsl.EXE -d docker-desktop-data bash -lc 'which topgrade'`

      Stderr:
      <3>WSL (8) ERROR: CreateProcessEntryCommon:370: getpwuid(0) failed 2
      <3>WSL (8) ERROR: CreateProcessEntryCommon:374: getpwuid(0) failed 2
      <3>WSL (8) ERROR: CreateProcessEntryCommon:577: execvpe /bin/sh failed 2
      <3>WSL (8) ERROR: CreateProcessEntryCommon:586: Create process not expected to return
   1: `C:\Windows\system32\wsl.EXE` failed: exit code: 1

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:102

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Upgrading "docker-desktop-data": Err(
   0: Could not find Topgrade installed in WSL

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:100

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Executing command `C:\Windows\system32\wsl.EXE -d docker-desktop bash -lc 'which topgrade'`
DEBUG Command failed: Err(
   0: Command failed: `C:\Windows\system32\wsl.EXE -d docker-desktop bash -lc 'which topgrade'`

      Stderr:
      /bin/ash: bash: not found
   1: `C:\Windows\system32\wsl.EXE` failed: exit code: 127

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:102

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Upgrading "docker-desktop": Err(
   0: Could not find Topgrade installed in WSL

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:100

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Executing command `C:\Windows\system32\wsl.EXE -d '' bash -lc 'which topgrade'`
DEBUG Command failed: Err(
   0: Command failed: `C:\Windows\system32\wsl.EXE -d '' bash -lc 'which topgrade'`

      Stdout:
      There is no distribution with the supplied name.
      Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND

   1: `C:\Windows\system32\wsl.EXE` failed: exit code: 0xffffffff

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:102

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Upgrading "": Err(
   0: Could not find Topgrade installed in WSL

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:100

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)

── 13:57:34 - Windows Update ───────────────────────────────────────────────────
Running Windows Update. Check the control panel for progress.
DEBUG Executing command `C:\Windows\system32\UsoClient.EXE ScanInstallWait`
DEBUG Command failed: Err(
   0: Command failed: `C:\Windows\system32\UsoClient.EXE ScanInstallWait`
   1: `C:\Windows\system32\UsoClient.EXE` failed: exit code: 0x80070057

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:157

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.)
DEBUG Step "Windows update" failed:
   0: Command failed: `C:\Windows\system32\UsoClient.EXE ScanInstallWait`
   1: `C:\Windows\system32\UsoClient.EXE` failed: exit code: 0x80070057

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:157

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Windows update failed:
   0: Command failed: `C:\Windows\system32\UsoClient.EXE ScanInstallWait`
   1: `C:\Windows\system32\UsoClient.EXE` failed: exit code: 0x80070057

Location:
   C:\Users\uname\.cargo\registry\src\index.crates.io-6f17d22bba15001f\topgrade-12.0.0\src\steps\os\windows.rs:157

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Retry? (y)es/(N)o/(s)hell/(q)uit
</pre>
</details>
SteveLauC commented 1 year ago

The Windows update issue currently has no solution, see #525, #482.

For the container issue, would you like to provide the output of:

$ docker image ls --format "{{.Repository}}:{{.Tag}} {{.ID}}"
oenu commented 1 year ago

In wsl

oenu@orbital:~$ docker image ls --format "{{.Repository}}:{{.Tag}} {{.ID}}"

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

For details about using Docker Desktop with WSL 2, visit:

https://docs.docker.com/go/wsl2/

In windows

PS C:\Users\username> docker image ls --format "{{.Repository}}:{{.Tag}} {{.ID}}"
error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/images/json": open //./pipe/docker_engine: The system cannot find the file specified.

Sorry for the delay!

oenu commented 1 year ago

Docker wasnt started on the host machine, started it, ran the commands in both wsl and host, both returned nothing

SteveLauC commented 1 year ago

In WSL, would u like to provide the output of:

$ topgrade --dry-run -v --only containers

SteveLauC commented 1 year ago

Docker wasnt started on the host machine, started it, ran the commands in both wsl and host, both returned nothing

So, you do NOT have docker in WSL, but once it is started in the host, you can run the docker command even in WSL

oenu commented 1 year ago
oenu@orbital:~$ topgrade --dry-run -v --only containers
DEBUG Configuration at /home/oenu/.config/topgrade.toml
DEBUG No include paths found in /home/oenu/.config/topgrade.toml
DEBUG Loaded configuration: ConfigFile { include: Some(Include { paths: None }), misc: Some(Misc { pre_sudo: None, sudo_command: None, git_repos: None, predefined_git_repos: None, disable: None, ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, git_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: None, yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, no_retry: None, run_in_tmux: None, cleanup: None, notify_each_step: None, accept_all_windows_updates: None, skip_notify: None, bashit_branch: None, only: None, no_self_update: None }), pre_commands: Some({}), post_commands: None, commands: Some({}), python: Some(Python { enable_pip_review: None, enable_pip_review_local: None, enable_pipupgrade: None, pipupgrade_arguments: None }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: None, pull_predefined: None }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None, wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: None, vim: None, firmware: Some(Firmware { upgrade: None }), vagrant: None, flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }) }
DEBUG Version: 12.0.2
DEBUG OS: x86_64-unknown-linux-gnu
DEBUG Args { inner: ["topgrade", "--dry-run", "-v", "--only", "containers"] }
DEBUG Binary path: Ok("/home/oenu/.cargo/bin/topgrade")
DEBUG Self Update: false
DEBUG Detected "/usr/bin/git" as "git"
DEBUG Cannot find "pwsh"
DEBUG Cannot find "powershell"
DEBUG Path "/home/oenu/.config/emacs" doesn't exist
DEBUG Path "/home/oenu/.emacs.d" doesn't exist
DEBUG Cannot find "doas"
DEBUG Cannot find "please"
DEBUG Detected "/usr/bin/sudo" as "sudo"
DEBUG Step "Containers"
DEBUG Detected "/mnt/c/Program Files/Docker/Docker/resources/bin/docker" as "docker"
DEBUG Using container runtime '/mnt/c/Program Files/Docker/Docker/resources/bin/docker'

── 11:10:49 - Containers ───────────────────────────────────────────────────────
DEBUG Querying '/mnt/c/Program Files/Docker/Docker/resources/bin/docker image ls --format "{{.Repository}}:{{.Tag}}/{{.ID}}"' for containers
DEBUG Executing command `/mnt/c/Program Files/Docker/Docker/resources/bin/docker image ls --format '{{.Repository}}:{{.Tag}} {{.ID}}'`
DEBUG Using container ''
The application panicked (crashed).
Message:  assertion failed: `(left == right)`
  left: `1`,
 right: `2`
Location: /home/oenu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/topgrade-12.0.2/src/steps/containers.rs:83

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
oenu@orbital:~$
oenu commented 1 year ago

some more info, looks like the docker command exists on WSL, but is aliased to a special command

oenu@orbital:~$ docker ps

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

For details about using Docker Desktop with WSL 2, visit:

https://docs.docker.com/go/wsl2/
((====////Same session, just started WSL on the host machine///===))
oenu@orbital:~$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
oenu@orbital:~$

Now

oenu@orbital:~$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
oenu@orbital:~$ topgrade --dry-run -v --only containers
DEBUG Configuration at /home/oenu/.config/topgrade.toml
DEBUG No include paths found in /home/oenu/.config/topgrade.toml
DEBUG Loaded configuration: ConfigFile { include: Some(Include { paths: None }), misc: Some(Misc { pre_sudo: None, sudo_command: None, git_repos: None, predefined_git_repos: None, disable: None, ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, git_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: None, yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, no_retry: None, run_in_tmux: None, cleanup: None, notify_each_step: None, accept_all_windows_updates: None, skip_notify: None, bashit_branch: None, only: None, no_self_update: None }), pre_commands: Some({}), post_commands: None, commands: Some({}), python: Some(Python { enable_pip_review: None, enable_pip_review_local: None, enable_pipupgrade: None, pipupgrade_arguments: None }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: None, pull_predefined: None }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None, wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: None, vim: None, firmware: Some(Firmware { upgrade: None }), vagrant: None, flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }) }
DEBUG Version: 12.0.2
DEBUG OS: x86_64-unknown-linux-gnu
DEBUG Args { inner: ["topgrade", "--dry-run", "-v", "--only", "containers"] }
DEBUG Binary path: Ok("/home/oenu/.cargo/bin/topgrade")
DEBUG Self Update: false
DEBUG Detected "/usr/bin/git" as "git"
DEBUG Cannot find "pwsh"
DEBUG Cannot find "powershell"
DEBUG Path "/home/oenu/.config/emacs" doesn't exist
DEBUG Path "/home/oenu/.emacs.d" doesn't exist
DEBUG Cannot find "doas"
DEBUG Cannot find "please"
DEBUG Detected "/usr/bin/sudo" as "sudo"
DEBUG Step "Containers"
DEBUG Detected "/usr/bin/docker" as "docker"
DEBUG Using container runtime '/usr/bin/docker'

── 11:14:41 - Containers ───────────────────────────────────────────────────────
DEBUG Querying '/usr/bin/docker image ls --format "{{.Repository}}:{{.Tag}}/{{.ID}}"' for containers
DEBUG Executing command `/usr/bin/docker image ls --format '{{.Repository}}:{{.Tag}} {{.ID}}'`
DEBUG Containers to inspect: []
DEBUG /home/oenu/.ideavimrc does not exists
DEBUG /home/oenu/.intellimacs does not exists
DEBUG /home/oenu/.zshrc does not exists
DEBUG /home/oenu/.config/fish does not exists
DEBUG /home/oenu/.config/openbox does not exists
DEBUG /home/oenu/.config/bspwm does not exists
DEBUG /home/oenu/.config/i3 does not exists
DEBUG /home/oenu/.config/sway does not exists

── 11:14:41 - Summary ──────────────────────────────────────────────────────────
Containers: OK
DEBUG Desktop notification: Topgrade finished successfully
oenu@orbital:~$

Looks like an issue with detecting whether docker is running on the WSL install, probably needs a deeper check like --version or smt rather than which

oenu commented 1 year ago

Eg. WIth Docker desktop running on the host machine

oenu@orbital:~$ which docker
/usr/bin/docker
oenu@orbital:~$

With docker stopped on the host machine

oenu@orbital:~$ which docker
/mnt/c/Program Files/Docker/Docker/resources/bin/docker
oenu@orbital:~$

Done in the same session

oenu commented 1 year ago

Attached is entire session, info above for when Docker run or stopped

(Continued output from a pre-standup "topgrade -y" run) ``` ── 11:10:17 - Node Package Manager ───────────────────────────────────────────── changed 20 packages in 1s 28 packages are looking for funding run `npm fund` for details ── 11:10:19 - Yarn Package Manager ───────────────────────────────────────────── ── 11:10:19 - Performant Node Package Manager ────────────────────────────────── ── 11:10:19 - Containers ─────────────────────────────────────────────────────── The application panicked (crashed). Message: assertion failed: `(left == right)` left: `1`, right: `2` Location: /home/oenu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/topgrade-12.0.2/src/steps/containers.rs:83 Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. Run with RUST_BACKTRACE=full to include source snippets. oenu@orbital:~$ topgrade --dry-run -v --only containers DEBUG Configuration at /home/oenu/.config/topgrade.toml DEBUG No include paths found in /home/oenu/.config/topgrade.toml DEBUG Loaded configuration: ConfigFile { include: Some(Include { paths: None }), misc: Some(Misc { pre_sudo: None, sudo_command: None, git_repos: None, predefined_git_repos: None, disable: None, ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, git_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: None, yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, no_retry: None, run_in_tmux: None, cleanup: None, notify_each_step: None, accept_all_windows_updates: None, skip_notify: None, bashit_branch: None, only: None, no_self_update: None }), pre_commands: Some({}), post_commands: None, commands: Some({}), python: Some(Python { enable_pip_review: None, enable_pip_review_local: None, enable_pipupgrade: None, pipupgrade_arguments: None }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: None, pull_predefined: None }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None, wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: None, vim: None, firmware: Some(Firmware { upgrade: None }), vagrant: None, flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }) } DEBUG Version: 12.0.2 DEBUG OS: x86_64-unknown-linux-gnu DEBUG Args { inner: ["topgrade", "--dry-run", "-v", "--only", "containers"] } DEBUG Binary path: Ok("/home/oenu/.cargo/bin/topgrade") DEBUG Self Update: false DEBUG Detected "/usr/bin/git" as "git" DEBUG Cannot find "pwsh" DEBUG Cannot find "powershell" DEBUG Path "/home/oenu/.config/emacs" doesn't exist DEBUG Path "/home/oenu/.emacs.d" doesn't exist DEBUG Cannot find "doas" DEBUG Cannot find "please" DEBUG Detected "/usr/bin/sudo" as "sudo" DEBUG Step "Containers" DEBUG Detected "/mnt/c/Program Files/Docker/Docker/resources/bin/docker" as "docker" DEBUG Using container runtime '/mnt/c/Program Files/Docker/Docker/resources/bin/docker' ── 11:10:49 - Containers ─────────────────────────────────────────────────────── DEBUG Querying '/mnt/c/Program Files/Docker/Docker/resources/bin/docker image ls --format "{{.Repository}}:{{.Tag}}/{{.ID}}"' for containers DEBUG Executing command `/mnt/c/Program Files/Docker/Docker/resources/bin/docker image ls --format '{{.Repository}}:{{.Tag}} {{.ID}}'` DEBUG Using container '' The application panicked (crashed). Message: assertion failed: `(left == right)` left: `1`, right: `2` Location: /home/oenu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/topgrade-12.0.2/src/steps/containers.rs:83 Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. Run with RUST_BACKTRACE=full to include source snippets. oenu@orbital:~$ docker ps The command 'docker' could not be found in this WSL 2 distro. We recommend to activate the WSL integration in Docker Desktop settings. For details about using Docker Desktop with WSL 2, visit: https://docs.docker.com/go/wsl2/ oenu@orbital:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES oenu@orbital:~$ topgrade --dry-run -v --only containers DEBUG Configuration at /home/oenu/.config/topgrade.toml DEBUG No include paths found in /home/oenu/.config/topgrade.toml DEBUG Loaded configuration: ConfigFile { include: Some(Include { paths: None }), misc: Some(Misc { pre_sudo: None, sudo_command: None, git_repos: None, predefined_git_repos: None, disable: None, ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, git_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: None, yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, no_retry: None, run_in_tmux: None, cleanup: None, notify_each_step: None, accept_all_windows_updates: None, skip_notify: None, bashit_branch: None, only: None, no_self_update: None }), pre_commands: Some({}), post_commands: None, commands: Some({}), python: Some(Python { enable_pip_review: None, enable_pip_review_local: None, enable_pipupgrade: None, pipupgrade_arguments: None }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: None, pull_predefined: None }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None, wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: None, vim: None, firmware: Some(Firmware { upgrade: None }), vagrant: None, flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }) } DEBUG Version: 12.0.2 DEBUG OS: x86_64-unknown-linux-gnu DEBUG Args { inner: ["topgrade", "--dry-run", "-v", "--only", "containers"] } DEBUG Binary path: Ok("/home/oenu/.cargo/bin/topgrade") DEBUG Self Update: false DEBUG Detected "/usr/bin/git" as "git" DEBUG Cannot find "pwsh" DEBUG Cannot find "powershell" DEBUG Path "/home/oenu/.config/emacs" doesn't exist DEBUG Path "/home/oenu/.emacs.d" doesn't exist DEBUG Cannot find "doas" DEBUG Cannot find "please" DEBUG Detected "/usr/bin/sudo" as "sudo" DEBUG Step "Containers" DEBUG Detected "/usr/bin/docker" as "docker" DEBUG Using container runtime '/usr/bin/docker' ── 11:14:41 - Containers ─────────────────────────────────────────────────────── DEBUG Querying '/usr/bin/docker image ls --format "{{.Repository}}:{{.Tag}}/{{.ID}}"' for containers DEBUG Executing command `/usr/bin/docker image ls --format '{{.Repository}}:{{.Tag}} {{.ID}}'` DEBUG Containers to inspect: [] DEBUG /home/oenu/.ideavimrc does not exists DEBUG /home/oenu/.intellimacs does not exists DEBUG /home/oenu/.zshrc does not exists DEBUG /home/oenu/.config/fish does not exists DEBUG /home/oenu/.config/openbox does not exists DEBUG /home/oenu/.config/bspwm does not exists DEBUG /home/oenu/.config/i3 does not exists DEBUG /home/oenu/.config/sway does not exists ── 11:14:41 - Summary ────────────────────────────────────────────────────────── Containers: OK DEBUG Desktop notification: Topgrade finished successfully oenu@orbital:~$ where docker where: command not found oenu@orbital:~$ which docker /usr/bin/docker oenu@orbital:~$ which docker /mnt/c/Program Files/Docker/Docker/resources/bin/docker oenu@orbital:~$ ```
oenu commented 1 year ago

Attempted to write a fix (I do not know rust that well) https://github.com/oenu/topgrade/commit/0e941db0fde5c3cc8780dbc8dcd630e8ed97063d https://github.com/oenu/topgrade/commit/fa943eab471420cc099016bb352f6128f74b5a1f

SteveLauC commented 1 year ago

This docker binary is on your host, but it is actually in the $PATH of your WSL:

DEBUG Detected "/mnt/c/Program Files/Docker/Docker/resources/bin/docker" as "docker"

When the docker started, then you will have a docker command under /usr/bin (in WSL):

DEBUG Detected "/usr/bin/docker" as "docker"

And it seems that if the docker on your host is started, within the WSL, Topgrade can update it without any issues.


Looks like Microsoft aims to make the Windows host and the WSL fully integrated. Currently, I have the following questions to investigate:

  1. Should we update such commands in Windows or WSL

    prefer Windows since it is where the actual command is installed

  2. Within WSL, is there any way we can know if a tool is installed natively in the WSL or is actually installed on the Windows host, then exported to WSL

    If the binary is in the Windows partition (under "/mnt/c"), then it is easy to determine, but if a binary will be created under "/bin" (or other Linux bin paths), how can we tell if this is a WSL native app or not?

  3. This is actually the first issue that reports such problems to Topgrade, are there any other commands (tools) that are also suffering from this issue

BTW, thanks for attempting to get it fixed:), but I think we need further investigation now

oenu commented 1 year ago

Yeah I figured out the hacky warning script they put in was the cause of the issue, but my rust skills are woeful, hopefully it's the thought that counts 😅

niStee commented 2 weeks ago

The Windows update issue currently has no solution, see #525, #482.

For the container issue, would you like to provide the output of:

$ docker image ls --format "{{.Repository}}:{{.Tag}} {{.ID}}"

842