multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Bad unicode handling on Windows

Open samlopezic opened this issue 5 years ago • 22 comments

Trying to execute multipass GUI does nothing. Also from PowerShell any command related doesn't work.

multipass help

Return to the prompt and no output is sent.

In Windows event viewer the error are related with ucrtbase.dll

Nombre de la aplicación con errores: multipass.gui.exe, versión: 0.0.0.0, marca de tiempo: 0x5df97ce4 Nombre del módulo con errores: ucrtbase.dll, versión: 10.0.18362.387, marca de tiempo: 0x4361b720 Código de excepción: 0xc0000409

Windows 10 Pro 1909 12-12-2019 Compilation 18363.592 Hyper-V Enabled

samlopezic avatar Jan 20 '20 15:01 samlopezic

Hi @samlopezic

Could you please try uninstalling and reinstalling this version (if you can download again in case your earlier installer got corrupted)? And, before closing the installer, could you please click on the "details" button while the installer is running to view the install log, and attach it here?

Can you see the multipass daemon running in the services, or does it also fail to start? Is that the only error you see in the event log? That one concerns the GUI, but multipass also includes the command line client and the daemon. Do any of the errors say the path where ucrtbase.dll is being picked up from? Any other messages you could share with us, even if only warning/info/debug?

ricab avatar Jan 20 '20 16:01 ricab

Hi @ricab

Before uninstalling/reinstalling i've checked the service and the information says [service_main] service is running Other events related to the service are:

[rpc] gRPC listening on localhost:50051, SSL:on

[Qt] QIODevice::write (QFile, "C:\Windows\system32\config\systemprofile\AppData\Local\multipassd\cache\vault\multipassd-image-records.json"): device not open

[url downloader] Cannot retrieve last modified date for https://multipass.run/static/latest-release.json: Host multipass.run not found. Using cached data instead.

Both multipass.gui.exe and multipass.exe throws error related with ucrtbase.dll Ruta de acceso del módulo con errores: C:\Windows\System32\ucrtbase.dll

I've attached the logs but the install was a difficult one. The details page not remain open and change to final page so is not easy copy the details, but i think is almost complete. In the other hand uninstallation details can be easily copied.

install.log uninstall.log

samlopezic avatar Jan 20 '20 18:01 samlopezic

Thanks, the install log looks good.

[url downloader] Cannot retrieve last modified date for https://multipass.run/static/latest-release.json: Host multipass.run not found. Using cached data instead.

This message means that multipass failed to retrieve update data, and I wonder if it is feeding some junk to clients that they don't handle well. I tried a few things but so far I could not reproduce.

If you restart the multipass service, do you always get the multipass.run error in the log? And if you stop the service completely and then run multipass help, do you still get the same crash? What does $LASTEXITCODE say after that (in powershell)? BTW, is this all the same in cmd and an Admin PS?

ricab avatar Jan 22 '20 19:01 ricab

Answering your questions:

  • The service itself doesn't give me any error stoping or restarting.
  • After stopping the service i executed the commands (cmd and admin PS). Same results and error log in event viewer. Is this normal behavior? Doesn't need the service to run the commands?
  • The $LASTEXITCODE is -1073740791 Also i've attached a crash report. Maybe it'll be useful. ReportCrash.txt

Thank you.

samlopezic avatar Jan 23 '20 01:01 samlopezic

Thanks for the report. I am afraid I did not find any clue in there, except maybe the version mismatch below.

multipass help does not need to contact the daemon, it should work without it. So the failure getting update data is unrelated to this.

Exception 0xc0000409 means stack buffer overflow, which is apparently not the same as stack overflow. It seems it is designed not to give any more information for security reasons. The return code matches that:

$ python -c 'print hex(2**30-1073740791)'
0x409

This could be a problem with multipass in some elusive corner case that we can't reproduce or it could be an issue with your system (in particular the dll where the problem occurs). multipass help does not execute a whole lot of code, and I have never seen anything like this, so I would not discard a system issue. The mismatch between the versions of the dll (10.0.18362.387) and the OS (10.0.18362.592) could also be clue.

Do you have other errors when using your pc? Any other faulty applications, strange errors poping up?

I am going to discuss this a bit internally. Meanwhile, here are a few of things you could try:

  • Restart windows in safe mode and run Sfc /scannow
  • reinstall the latest windows update: https://www.windowscentral.com/how-uninstall-and-reinstall-updates-windows-10
  • find ucrtbase.dll from another installation of the same OS version and replace yours with it (backing it up first)
  • repair windows 10 with an in-place upgrade: https://www.tenforums.com/tutorials/16397-repair-install-windows-10-place-upgrade.html

ricab avatar Jan 23 '20 11:01 ricab

A couple more things that could be worth trying:

  • check your ucrtbase.dll for viruses
  • Fix Windows Update errors by using the DISM or System Update Readiness tool

ricab avatar Jan 23 '20 12:01 ricab

Yeah, i think it's something with my system. As developer i tend to install plenty of tools (Docker, some Visual Studio versions, Virtual Machines, etc.) and some of them could be the culprit. Multipass was another tool that get my attention but the final purpose was setting up a devops workflow with k8s on Ubuntu.

The version mismatch also could be because my machine came with W10 Home and later upgraded to W10 Pro but not clean install. Aditionally, in some forums i've read that ucrtbase.dll errors can be related to Microsoft Visual C++ versions installed on the machine. Maybe i could try install/reinstall some specific version that Multipass was developed on.

I'll try some of your suggestions and report back but if none other users are reporting this better to wait until next version and give it a try or reinstall my system, i'll do it but not soon :)

Thank you for your support, you can close the issue if you like.

samlopezic avatar Jan 23 '20 12:01 samlopezic

OK, yeah please do let us know if you find anything else about this.

The visualcpp we use if you want to try it: https://chocolatey.org/packages/visualcpp-build-tools

I will keep this open for a while, in case someone else experiences the same thing.

ricab avatar Jan 23 '20 15:01 ricab

Hi again, Finally i've got it running. I was working with docker volumes and it seems that my local username was causing trouble in CLI C:\Users\Samuel López\ so i've created a new account C:\Users\Developer\ and after login the multipass notification icon appears (totally unexpected). To be sure, opened PS and ran multipass help and that works too.

samlopezic avatar Feb 13 '20 19:02 samlopezic

Thanks @samlopezic, that's great, and something that will guide us to a fix!

Saviq avatar Feb 14 '20 09:02 Saviq

I got a dump out from the crash, attached are the dump itself plus an analysis from WinDbg:

multipass.exe.7804.zip multipass.txt

Saviq avatar Feb 19 '20 09:02 Saviq

Hi again, Finally i've got it running. I was working with docker volumes and it seems that my local username was causing trouble in CLI C:\Users\Samuel López\ so i've created a new account C:\Users\Developer\ and after login the multipass notification icon appears (totally unexpected). To be sure, opened PS and ran multipass help and that works too.

Confirmed - the multipass.exe binary does not handle non-ASCII characters in the username "USERPROFILE" variable correctly. As a temporary workaround, the user can try to set USERPROFILE to the legacy 8.3 equivalent path name, but multipass.exe should really use appropriate unicode functions for processing the path components.

Ged-fi avatar Feb 24 '20 11:02 Ged-fi

The same issue also affects multipassd - mounting the users home directory into 'primary:Home' fails if the user's profile in Windows resides in a folder that uses non-ASCII characters. The root cause is most likely incorrect character encoding when using Windows paths in the API - windows paths are Unicode, not utf-8.

Ged-fi avatar Feb 25 '20 07:02 Ged-fi

Are there any editable settings I could change/modify to avoid that problem (without running 'multipass' from terminal which throws error even with 'multipass help')?

Windows 10 (with Microsoft Account) forced my user's unicode name (I'll never chose it consciously - as i'm from the dinosaur era when you've been used to name everything without spaces and latin-only characters), and usually (in other software) I could bypass it by using symlink path in settings (without unicode chars) to my user's folder (VirtualBox, Vagrant had this problem too and the symlink helped). Creating new Win10 username account for other reason than to just seeing it works makes no sense as I have all other things configured and prepared for my current user...

zielinskila avatar Aug 30 '20 11:08 zielinskila

@zielinskila did you try the workaround of setting "USERPROFILE" to the legacy 8.3 path name of your userprofile before launching multipass?

Ged-fi avatar Aug 31 '20 09:08 Ged-fi

@Ged-fi no I didn't. How can I modify it?

zielinskila avatar Aug 31 '20 13:08 zielinskila

This issue still persists in version 1.8.0.

Ged-fi avatar Dec 02 '21 06:12 Ged-fi

I have get the same problem on windows 10 , error log is

[error] [client] Caught an unhandled exception: failed to open file 'C:/Users/杜骏骅/AppData/Roaming/multipass/client-certificate/multipass_cert_key.pem': Illegal byte sequence(42)

it is about chinese char .

i work fine on my mac os .

hughwang-me avatar Dec 08 '21 08:12 hughwang-me

@Saviq this one really should get assigned and fixed. Multipass should translate utf-8 to unicode and use the unicode native APIs on Windows.

Ged-fi avatar Feb 07 '22 07:02 Ged-fi

@Saviq Update: This can be fixed by enabling the utf-8 code page support in the application manifest. Or by enabling the (beta) utf-8 code page for non-unicode programs. This is done in the Windows 10/11 region settings.

UTF-8 in the Windows API

Ged-fi avatar Feb 07 '22 15:02 Ged-fi

@Saviq Update: This can be fixed by enabling the utf-8 code page support in the application manifest. Or by enabling the (beta) utf-8 code page for non-unicode programs. This is done in the Windows 10/11 region settings.

UTF-8 in the Windows API

Unfortunately the joy was premature - there seems to be some dependencies that still prevent multipass from correctly connecting to the instances spun up. So it's possible to start instances, but not to actually use them for anything.

Ged-fi avatar Mar 09 '22 12:03 Ged-fi

@Saviq Any chance of getting this under work eventually? This really prevents Multipass from working in many international environments.

Ged-fi avatar Apr 10 '23 17:04 Ged-fi

Unfortunately, it seems impossible to have Multipass on machine whose username has non-ASCII characters (like Latin accents). Are there plans to fix it in any new releases?

ffkraemer avatar Jun 01 '23 17:06 ffkraemer