dockur / windows

Windows inside a Docker container.
MIT License
15.51k stars 1.27k forks source link

Windows XP in Russian language installation issues #592

Closed arisudesu closed 2 weeks ago

arisudesu commented 3 weeks ago

Operating system

Alpine Linux 3.20

Description

  1. A product key entry appears during install. It doesn't appear in english (default) language. Russian windows doesn't accept the key you provide in define.sh. Screenshot 1: it tells "Invalid product key entered". It accepts the key that is published on massgrave site for WinXP VL x86, however, if manually typed. Then installation proceeds.

  2. WSH error happens during "Registring components" phase. The error tells: "Username not found" (screenshot 2). After I click "OK", installation proceeds to completion and booting to installed OS, but only to tell "Logon is not possible. Check username and domain and repeat password entry. Passwords are case-sensitive." (screenshot 3). After clicking "OK" it reverts to modern logon screen with Administrator account available. It is possible to logon with password from compose file into it. The system looks usable except missing drivers for VGA and PCI and SM buses.

Docker compose

services:
  windows:
    image: dockurr/windows
    container_name: windows
    environment:
      VERSION: "winxp"
      LANGUAGE: "ru"
#      CPU_CORES: 4
#      RAM_SIZE: 2G
      USERNAME: "arisu"
      PASSWORD: "1234"
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3389:3389/tcp
      - 3389:3389/udp
    stop_grace_period: 2m

Docker log

SeaBIOS (version 1.16.3-debian-1.16.3-2)
Booting from Hard Disk...

(yes this is complete output from docker logs windows)

Screenshots (optional)

изображение изображение изображение изображение

kroese commented 2 weeks ago

1.) Yes, this is because I could not find download mirrors for the Retail-versions in other languages. So I used links to the VLK (volume license) versions.

I even print a warning about this in the log: Warning: this version of Windows XP requires a volume license key (VLK), it will ask for one during installation..

It seems the part before SeaBIOS is missing from the logs. I think this happens because the BIOS clears the screen, but in my environment (Portainer) I can still view all the previous messages. I assumed docker logs would do the same, but seems not.

2.) Do you have this error only when using a customized username/password? Or also when they are not in the compose file?

arisudesu commented 2 weeks ago
  1. Did I miss this message anywhere? :) Because I never seen it appear. I could find it in the scripts, but it doesn't appear in log, or it does appear briefly on terminal and I missed the timing. Probably worth stating it in project README too.

    I've captured more of a log by piping docker-compose up | tee log.txt, included below. My env is plain tty (ssh).

  2. Yes, the issue persists without customized username/pass. I commented them out to have environment like this:

       environment:
         VERSION: "winxp"
         LANGUAGE: "ru"
    #      CPU_CORES: 4
    #      RAM_SIZE: 2G
    #      USERNAME: "arisu"
    #      PASSWORD: "1234"

    Same error, same behavior after install completes, what changed is logon to Administrator is now without password.

Log ``` Attaching to windows windows | ❯ Starting Windows for Docker v3.11... windows | ❯ For support visit https://github.com/dockur/windows windows | ❯ CPU: AMD Ryzen 3 4300GE with Radeon Graphics | RAM: 14/16 GB | DISK: 76 GB (ext4) | HOST: 6.6.32-0-lts... windows | windows | ❯ Downloading Windows XP in Russian from massgrave.dev... windows | ❯ Extracting Windows XP image... windows | ❯ Adding drivers to image... windows | ❯ Building Windows XP image... windows | ❯ Creating a 64G growable disk image in raw format... windows | ❯ Booting Windows (legacy)... windows | c[?7lSeaBIOS (version 1.16.3-debian-1.16.3-2) windows | Booting from Hard Disk... windows | Boot failed: not a bootable disk windows | windows | Booting from DVD/CD... windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | c[?7lDSsDSsDSsDSs❯ Windows started succesfully, visit http://localhost:8006/ to view the screen... windows | c[?7lc[?7lc[?7lSeaBIOS (version 1.16.3-debian-1.16.3-2) windows | Booting from Hard Disk... windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | c[?7lc[?7lc[?7lc[?7lSeaBIOS (version 1.16.3-debian-1.16.3-2) windows | Booting from Hard Disk... windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | windows | ```
kroese commented 2 weeks ago

I think the problem is with this line:

https://github.com/dockur/windows/blob/01935566eecd3f705623758eebd997ec42f57120/src/define.sh#L2223

I rename the account called "Administrator" there to Docker (or the custom name), but I think in the Russian version this account is not called Administator but some Russian word instead.

It should be easy to fix, for example here is the code to get the group name in a different language: https://stackoverflow.com/questions/20896115/get-administrotor-object-in-windows-in-different-language so I am sure something like that can be done for the accountname too.

If you can fix it yourself, please send a pull-request.

arisudesu commented 2 weeks ago

I don't think I will be able to fix it easily.

I modified vbs to retrieve Administrator name by its well-known SID:

diff --git a/src/define.sh b/src/define.sh
index 3c3121d..8a82b92 100644
--- a/src/define.sh
+++ b/src/define.sh
@@ -2217,13 +2217,19 @@ prepareInstall() {
     } | unix2dos >> "$dir/\$OEM\$/install.reg"
   fi

-  {       echo "Set WshShell = WScript.CreateObject(\"WScript.Shell\")"
+  {       echo "Set WMI = GetObject(\"winmgmts://./root/cimv2\")"
+          echo "For Each account In WMI.ExecQuery(\"SELECT * FROM Win32_UserAccount WHERE SID LIKE 'S-1-5-%-500'\")"
+          echo "  LocalAdminName = account.Name"
+          echo "  Exit For"
+          echo "Next"
+          echo ""
+          echo "Set WshShell = WScript.CreateObject(\"WScript.Shell\")"
           echo "Set WshNetwork = WScript.CreateObject(\"WScript.Network\")"
           echo "Set oMachine = GetObject(\"WinNT://\" & WshNetwork.ComputerName)"
-          echo "Set oInfoUser = GetObject(\"WinNT://\" & WshNetwork.ComputerName & \"/Administrator,user\")"
+          echo "Set oInfoUser = GetObject(\"WinNT://\" & WshNetwork.ComputerName & \"/\" & LocalAdminName & \",user\")"
           echo "Set oUser = oMachine.MoveHere(oInfoUser.ADsPath,\"$username\")"
           echo ""

but for some reason it doesn't work in install environment even in english OS and gives this error (screenshot), but it works in already installed system. I think something is wrong with using WMI in install env, I don't know much about Windows instrumentation to know how to fix this.

изображение

kroese commented 2 weeks ago

Your code looks very good, I dont know why it doesn't work during the installation.

Another (ugly) solution would be that we just include a lookup list in the code, where we store the translations for the word Administrator for all 20 languages. But it is not the prettiest solution and it will be a lot of work to figure out the correct translations in every language.

arisudesu commented 2 weeks ago

I came up with really ugly solution to avoid WMI at all, but it at least works.

It is possible to iterate over domain (local machine) items and extract each account's SID by accessing objectSID property: https://learn.microsoft.com/en-us/windows/win32/adsi/object-sid. The result is Byte() containing binary SID, so we need to convert it to understandable form with some functions from here: https://stackoverflow.com/a/32383970. This functions result is familiar "S-1-5-21..." string, which can be tested to start with "S-1-5-21-" and end with "-500" to look for Administrator user account and remember its ADsPath.

I did test my new code selectively with combinations:

In each combination, behavior was expected, no errors during installation and account name was either Docker or customized name.

I'll make a pull request with this code, despite it being ugly, to at least fix username customization, until someone provides better solution.

kroese commented 2 weeks ago

Great news! Thank you very much

arisudesu commented 2 weeks ago

Tried additionally with win2003, but since it doesn't have localized versions, only checked whether script doesn't break on English.

Minor issue found: localized usernames do not work (e.g. cyrillic "арисудесу"), but I think this may be solved separately if needed at all.