Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Attempt to resolve windows installer problems with 'Failed to copy script', fixes #7485, for #7477#7493

Merged
rfay merged 2 commits intoddev:mainfrom
rfay:20250729_rfay_windows_installer
Jul 30, 2025
Merged

fix: Attempt to resolve windows installer problems with 'Failed to copy script', fixes #7485, for #7477#7493
rfay merged 2 commits intoddev:mainfrom
rfay:20250729_rfay_windows_installer

Conversation

@rfay
Copy link
Member

@rfay rfay commented Jul 29, 2025

The Issue

This is an experimental Windows Installer build to try to solve problems reported during "Failed to copy script" in the Windows installer.

How This PR Solves The Issue

As suggested by @nickchomey in #7477 this attempts to do the copying of scripts into the distro using the default user instead of root, and tries to get more information about what the failure might be

Manual Testing Instructions

  • Try to install on system where it's been problematic

Automated Testing Overview

No changes.

Release/Deployment Notes

@github-actions
Copy link

github-actions bot commented Jul 29, 2025

nsExec::ExecToStack 'wsl -d $R1 -u root cp "$WSL_WINDOWS_TEMP/ddev_installer/$R0" /tmp/'
; Remove any existing script first, then copy from Windows temp to WSL2 /tmp
nsExec::ExecToStack 'wsl -d $R1 -u root rm -f /tmp/$R0'
nsExec::ExecToStack 'wsl -d $R1 cp "$WSL_WINDOWS_TEMP/ddev_installer/$R0" /tmp/'
Copy link
Collaborator

@nickchomey nickchomey Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I suggest ~/tmp instead of /tmp? Would, of course, need to make the change elsewhere as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use ~/tmp also, but creating that means intrusive behavior on the user's distro, which is something we try not to do.

Thanks for reading and following.

Could you try the artifact in #7493 (comment) ? You have to click around the Windows Defender warning because PR builds aren't signed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll try it in an hour or two and report back

@nickchomey
Copy link
Collaborator

This seems to have worked. I dont see anything in the log - including that mkcert ran properly this time, since its not owned by root anymore.

20250729.084056
=== DDEV Installer Debug Log ===
Log location: C:\Users\nick_\AppData\Local\Temp\ddev_installer_debug_20250729.084056.log
Installer started at: 2025-07-29 08:40:56
Debug log initialized at: C:\Users\nick_\AppData\Local\Temp\ddev_installer_debug_20250729.084056.log
Command line parameters: 
Set default to WSL2 with Docker CE based on previous installation
Stored installation type: wsl2-docker-ce
Starting DistroSelectionPage...
Creating dialog...
Dialog create result: 592818
=== Starting GetUbuntuDistros ===
Checking registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss...
Registry key exists and is accessible
Found 1 total WSL distributions
Found distribution: Ubuntu2404
Found Flavor field for Ubuntu2404: 'ubuntu'
Found Ubuntu distribution (Flavor-based): Ubuntu2404
Registry enumeration complete. Final list: [Ubuntu2404]
Got distros: [Ubuntu2404]
Creating label...
Creating radio buttons...
Previously selected distro: Ubuntu2404
Adding radio button: [Ubuntu2404]
Selected distro: Ubuntu2404 (previous choice)
Added 1 radio buttons
About to show dialog...
Getting selected distro...
Selected distro: Ubuntu2404
Stored selected distro: Ubuntu2404
Copying all scripts to temp directory...
All scripts copied to temp directory
Starting GitCheckPage...
Skipping Git check for non-traditional install: wsl2-docker-ce
Starting DockerCheckPage...
Skipping Docker check for wsl2-docker-ce install (Docker CE will be installed)
Setting up mkcert.exe (Windows) for trusted HTTPS certificates...
Running mkcert.exe -install to create certificate authority...
mkcert.exe -install completed successfully
Setting up mkcert certificate sharing with WSL2...
CAROOT directory: C:\Users\nick_\AppData\Local\mkcert
EnVar::Delete CAROOT result: 0
EnVar::AddValue CAROOT result: 0
WSLENV cleaned and updated: [] -> [CAROOT/up]
mkcert certificate sharing with WSL2 configured successfully.
Adding DDEV installation directory to system PATH...
PATH before addition: C:\Python313\Scripts\;C:\Python313\;C:\Python312\Scripts\;C:\Python312\;C:\Python311\Scripts\;C:\Python311\;C:\Python39\Scripts\;C:\Python39\;C:\Python310\Scripts\;C:\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\chocolatey\bin;C:\tools\BCURRAN3;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\tools\php80;C:\tools\php74;C:\Program Files\Calibre2\;C:\tools\gsudo\Current;C:\Program Files\DDEV;C:\Program Files\Tailscale\;C:\Program Files\NVIDIA Corporation\NVIDIA App\NvDLISR;C:\Program Files\Git\cmd
EnVar::AddValue result: 0
PATH addition completed with result: 0
Starting WSL2 Docker installation for Ubuntu2404
Checking WSL2 version...
WSL version check output:   NAME          STATE           VERSION
* Ubuntu2404    Running         2

WSL version check exit code: 0
Checking selected distro Ubuntu2404...
Checking WSL2 kernel...
WSL kernel version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025

WSL2 detected successfully.
Converting Windows TEMP path to WSL format...
Checking for root user in selected distro...
=== Checking for root user in distro: Ubuntu2404 ===
Installing script check_root_user.sh to WSL2 distro Ubuntu2404...
Using script check_root_user.sh from temp directory
Successfully installed script check_root_user.sh to /tmp/check_root_user.sh in distro Ubuntu2404
Running check_root_user.sh...
Root user check passed for distro Ubuntu2404 - output: 
Root user check passed
WSL(Ubuntu2404): Removing old Docker packages if present...
WSL(Ubuntu2404): Updating package database using apt-get update...
Please be patient - updating package database...
WSL(Ubuntu2404): Installing required linux packages...
Please be patient - installing required linux packages...
WSL(Ubuntu2404): Setting up keyrings directory...
WSL(Ubuntu2404): Adding Docker repository key...
WSL(Ubuntu2404): Adding Docker apt repository...
WSL(Ubuntu2404): Adding DDEV apt repository key...
WSL(Ubuntu2404): Adding DDEV apt repository...
WSL(Ubuntu2404): apt-get update...
Please be patient - updating package database...
WSL(Ubuntu2404): Installing essential packages (1/4)...
Please be patient - installing essential packages...
WSL(Ubuntu2404): Installing Docker components (2/4)...
Please be patient - installing Docker components...
WSL(Ubuntu2404): Installing WSL utilities (3/4)...
Please be patient - installing WSL utilities...
WSL(Ubuntu2404): Installing DDEV (4/4)...
Please be patient - installing DDEV...
WSL(Ubuntu2404): Overwriting DDEV binaries with bundled version...
WSL(Ubuntu2404): Overwriting ddev-hostname binary with bundled version...
WSL(Ubuntu2404): Overwriting mkcert binary with bundled version...
WSL(Ubuntu2404): Overwriting ddev-hostname.exe with bundled version...
WSL(Ubuntu2404): Overwriting mkcert.exe with bundled version...
WSL(Ubuntu2404): Getting username of unprivileged user...
WSL(Ubuntu2404): Adding user 'nick' to docker group...
Successfully added user 'nick' to docker group.
Verifying DDEV installation with 'ddev version'...
Setting up mkcert inside WSL2 distro: Ubuntu2404
Windows CAROOT environment variable: C:\Users\nick_\AppData\Local\mkcert
Installing script install_temp_sudoers.sh to WSL2 distro Ubuntu2404...
Using script install_temp_sudoers.sh from temp directory
Successfully installed script install_temp_sudoers.sh to /tmp/install_temp_sudoers.sh in distro Ubuntu2404
Running temporary sudoers installation...
Temporary sudoers created successfully
Installing script mkcert_install.sh to WSL2 distro Ubuntu2404...
Using script mkcert_install.sh from temp directory
Successfully installed script mkcert_install.sh to /tmp/mkcert_install.sh in distro Ubuntu2404
Running /tmp/mkcert_install.sh in WSL2 distro: Ubuntu2404
mkcert_install.sh script exit code: 0
mkcert_install.sh output: 'WINDOWS_CAROOT=C:\Users\nick_\AppData\Local\mkcert
The local CA is already installed in the system trust store! 👍
The local CA is already installed in the Firefox and/or Chrome/Chromium trust store! 👍

/mnt/c/Users/nick_/AppData/Local/mkcert
'
Removing temporary passwordless sudo...
Temporary sudoers entry removed successfully
Performing final validation of DDEV installation...
Configuring WSL2 security settings to prevent Windows executable warnings...
Configuring WSL2 security settings...
Adding file://*.wsl.localhost to Local Intranet security zone...
WSL2 ZoneMap Internet Domains settings configured successfully via registry
Marking installation as complete...
DDEV installation completed successfully
Cleaning up temporary files...
All done! Installation completed successfully and validated.
Installation completed successfully

@nickchomey
Copy link
Collaborator

nickchomey commented Jul 29, 2025

Though, i do see these .exe files - should they be there?

nick@wsl2:/usr/bin$ ls -lat
.rwxr-xr-x root root     4.7 MB Tue Jul 29 08:42:03 2025  mkcert.exe
.rwxr-xr-x root root     3.3 MB Tue Jul 29 08:42:02 2025  ddev-hostname.exe
.rwxr-xr-x root root     4.6 MB Tue Jul 29 08:41:51 2025  mkcert
.rwxr-xr-x root root     3.1 MB Tue Jul 29 08:41:50 2025  ddev-hostname
.rwxr-xr-x root root      18 MB Tue Jul 29 08:41:50 2025  ddev
drwxr-xr-x root root      36 KB Tue Jul 29 08:41:40 2025  .

@rfay
Copy link
Member Author

rfay commented Jul 29, 2025

Yay! Yes, those belong

@rfay rfay marked this pull request as ready for review July 29, 2025 15:34
@rfay rfay requested a review from a team as a code owner July 29, 2025 15:34
@rfay rfay requested a review from stasadev July 29, 2025 15:35
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@rfay rfay merged commit 0efc2d7 into ddev:main Jul 30, 2025
16 checks passed
@rfay rfay deleted the 20250729_rfay_windows_installer branch July 30, 2025 13:06
@rfay
Copy link
Member Author

rfay commented Jul 30, 2025

Now we'll have a signed version of the installer we can recommend to people if this crops up again. Thanks so much for all the work on this @nickchomey , looking forward to hearing your further experiences.

@nickchomey
Copy link
Collaborator

My pleasure.

I still do think that it would be good if the installer cleaned up the Windows Program Files side if/after it installed everything in wsl2. It's a minor thing, but would be in-line with what the blog post says and the general effort to streamline things and have ddev not overstep it's bounds.

@rfay
Copy link
Member Author

rfay commented Jul 30, 2025

The installer provides mkcert.exe and ddev-hostname.exe on the Windows side so that people don't have to have ddev-wsl2. But of course if they're using the installer, they will have it... But the installer itself uses mkcert.exe on the Windows side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments