crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.26k stars 242 forks source link

'crc setup' unsuccessful when username has an "Umlaut" #4249

Closed moritzfl closed 4 months ago

moritzfl commented 5 months ago

General information

CRC version

CRC version: 2.37.1+36d451
OpenShift version: 4.15.14

CRC status

crc does not seem to be setup correctly, have you run 'crc setup'?

CRC config

Modifies crc configuration properties.
Properties:

* bundle                                               Bundle path/URI - absolute or local path, http, https or docker URI (string, like 'https://foo.com/crc_hyperv_4.15.14_amd64.crcbundle', 'docker://quay.io/myorg/crc_hyperv_4.15.14_amd64.crcbundle:2.37.1' default 'C:\Users\MoritzFlöter\.crc\cache\crc_hyperv_4.15.14_amd64.crcbundle' )
* consent-telemetry                                    Consent to collection of anonymous usage data (yes/no)
* cpus                                                 Number of CPU cores (must be greater than or equal to '4')
* disable-update-check                                 Disable update check (true/false, default: false)
* disk-size                                            Total size in GiB of the disk (must be greater than or equal to '31')
* enable-bundle-quay-fallback                          If bundle download from the default location fails, fallback to quay.io (true/false, default: false)
* enable-cluster-monitoring                            Enable cluster monitoring Operator (true/false, default: false)
* enable-emergency-login                               Enable emergency login for 'core' user. Password is randomly generated. (true/false, default: false)
* enable-experimental-features                         Enable experimental features (true/false, default: false)
* enable-shared-dirs                                   Mounts host's user profile folder at '/' in the CRC VM (true/false, default: false)
* host-network-access                                  Allow TCP/IP connections from the CRC VM to services running on the host (true/false, default: false)
* http-proxy                                           HTTP proxy URL (string, like 'http://my-proxy.com:8443')
* https-proxy                                          HTTPS proxy URL (string, like 'https://my-proxy.com:8443')
* ingress-http-port                                    HTTP port to use for OpenShift ingress/routes on the host (1024-65535, default: 80)
* ingress-https-port                                   HTTPS port to use for OpenShift ingress/routes on the host (1024-65535, default: 443)
* kubeadmin-password                                   User defined kubeadmin password
* memory                                               Memory size in MiB (must be greater than or equal to '10752')
* nameserver                                           IPv4 address of nameserver (string, like '1.1.1.1 or 8.8.8.8')
* no-proxy                                             Hosts, ipv4 addresses or CIDR which do not use a proxy (string, comma-separated list such as '127.0.0.1,192.168.100.1/24')
* persistent-volume-size                               Total size in GiB of the persistent volume used by the CSI driver for microshift preset (must be greater than or equal to '15')
* preset                                               Virtual machine preset (valid values are: [openshift okd microshift])
* proxy-ca-file                                        Path to an HTTPS proxy certificate authority (CA)
* pull-secret-file                                     Path of image pull secret (download from https://console.redhat.com/openshift/create/local)
* shared-dir-password                                  Password used while using CIFS/SMB file sharing (It is the password for the current logged in user)
* skip-check-admin-helper-service-running              Skip preflight check (true/false, default: false)
* skip-check-administrator-user                        Skip preflight check (true/false, default: false)
* skip-check-background-launcher-install               Skip preflight check (true/false, default: false)
* skip-check-bundle-extracted                          Skip preflight check (true/false, default: false)
* skip-check-crc-users-group-exists                    Skip preflight check (true/false, default: false)
* skip-check-daemon-task-install                       Skip preflight check (true/false, default: false)
* skip-check-daemon-task-running                       Skip preflight check (true/false, default: false)
* skip-check-hyperv-installed                          Skip preflight check (true/false, default: false)
* skip-check-hyperv-service-running                    Skip preflight check (true/false, default: false)
* skip-check-podman-in-ocbindir                        Skip preflight check (true/false, default: false)
* skip-check-ram                                       Skip preflight check (true/false, default: false)
* skip-check-ssh-port                                  Skip preflight check (true/false, default: false)
* skip-check-user-in-crc-users-and-hyperv-admins-group Skip preflight check (true/false, default: false)
* skip-check-vsock                                     Skip preflight check (true/false, default: false)
* skip-check-windows-edition                           Skip preflight check (true/false, default: false)
* skip-check-windows-version                           Skip preflight check (true/false, default: false)

Usage:
  crc config SUBCOMMAND [flags]
  crc config [command]

Available Commands:
  get         Get a crc configuration property
  set         Set a crc configuration property
  unset       Unset a crc configuration property
  view        Display all assigned crc configuration properties

Flags:
  -h, --help   help for config

Global Flags:
      --log-level string   log level (e.g. "debug | info | warn | error") (default "info")

Use "crc config [command] --help" for more information about a command.

Host Operating System


Hostname:                                      DEVNB022
Betriebssystemname:                            Microsoft Windows 10 Business
Betriebssystemversion:                         10.0.19045 Nicht zutreffend Build 19045
Betriebssystemhersteller:                      Microsoft Corporation
Betriebssystemkonfiguration:                   Eigenständige Arbeitsstation
Typ des Betriebssystembuilds:                  Multiprocessor Free
Registrierter Benutzer:                        nbadmin
Registrierte Organisation:
Produkt-ID:                                    00330-51468-78700-AAOEM
Ursprüngliches Installationsdatum:             05.01.2021, 16:20:29
Systemstartzeit:                               25.06.2024, 07:23:05
Systemhersteller:                              LENOVO
Systemmodell:                                  20M9CTO1WW
Systemtyp:                                     x64-based PC
Prozessor(en):                                 1 Prozessor(en) installiert.
                                               [01]: Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~2592 MHz
BIOS-Version:                                  LENOVO N2CET69W (1.52 ), 27.11.2023
Windows-Verzeichnis:                           C:\WINDOWS
System-Verzeichnis:                            C:\WINDOWS\system32
Startgerät:                                    \Device\HarddiskVolume1
Systemgebietsschema:                           de;Deutsch (Deutschland)
Eingabegebietsschema:                          de;Deutsch (Deutschland)
Zeitzone:                                      (UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien
Gesamter physischer Speicher:                  65.243 MB
Verfügbarer physischer Speicher:               44.245 MB
Virtueller Arbeitsspeicher: Maximale Größe:    74.971 MB
Virtueller Arbeitsspeicher: Verfügbar:         53.445 MB
Virtueller Arbeitsspeicher: Zurzeit verwendet: 21.526 MB
Auslagerungsdateipfad(e):                      C:\pagefile.sys
Domäne:                                        WORKGROUP
Anmeldeserver:                                 \\DEVNB022
Hotfix(es):                                    26 Hotfix(e) installiert.
                                               [01]: KB5037587
                                               [02]: KB5030841
                                               [03]: KB4562830
                                               [04]: KB4577586
                                               [05]: KB4580325
                                               [06]: KB4589212
                                               [07]: KB4593175
                                               [08]: KB4598481
                                               [09]: KB5000736
                                               [10]: KB5011048
                                               [11]: KB5012170
                                               [12]: KB5015684
                                               [13]: KB5039211
                                               [14]: KB5023794
                                               [15]: KB5028380
                                               [16]: KB5029709
                                               [17]: KB5031539
                                               [18]: KB5032392
                                               [19]: KB5032907
                                               [20]: KB5034224
                                               [21]: KB5036447
                                               [22]: KB5037018
                                               [23]: KB5037240
                                               [24]: KB5037995
                                               [25]: KB5005699
                                               [26]: KB5034441
Netzwerkkarte(n):                              9 Netzwerkadapter installiert.
                                               [01]: SonicWall NetExtender Adapter
                                                     Verbindungsname: LAN-Verbindung
                                                     DHCP aktiviert:  Nein
                                                     IP-Adresse(n)
                                               [02]: Hyper-V Virtual Ethernet Adapter
                                                     Verbindungsname: vEthernet (Default Switch)
                                                     DHCP aktiviert:  Nein
                                                     IP-Adresse(n)
                                                     [01]: 172.24.144.1
                                                     [02]: fe80::7278:e6ff:b511:def4
                                               [03]: Intel(R) Ethernet Connection (7) I219-LM
                                                     Verbindungsname: Ethernet
                                                     Status:          Medien getrennt
                                               [04]: Intel(R) Wireless-AC 9560 160MHz
                                                     Verbindungsname: WLAN
                                                     DHCP aktiviert:  Ja
                                                     DHCP-Server:     Nicht zutreffend
                                                     IP-Adresse(n)
                                               [05]: Hyper-V Virtual Ethernet Adapter
                                                     Verbindungsname: vEthernet (WSL)
                                                     DHCP aktiviert:  Nein
                                                     IP-Adresse(n)
                                                     [01]: 172.21.160.1
                                                     [02]: fe80::2f62:9f92:9be:839e
                                               [06]: DisplayLink Network Adapter NCM
                                                     Verbindungsname: Ethernet 4
                                                     DHCP aktiviert:  Ja
                                                     DHCP-Server:     192.168.1.1
                                                     IP-Adresse(n)
                                                     [01]: 192.168.1.57
                                                     [02]: fe80::71e4:204a:6aa6:1b36
                                               [07]: VirtualBox Host-Only Ethernet Adapter
                                                     Verbindungsname: Ethernet 5
                                                     DHCP aktiviert:  Nein
                                                     IP-Adresse(n)
                                                     [01]: 192.168.56.1
                                                     [02]: fe80::f8ad:2415:fea7:4117
                                               [08]: Hyper-V Virtual Ethernet Adapter
                                                     Verbindungsname: vEthernet (OpenShift)
                                                     Status:          Medien getrennt
                                               [09]: Microsoft Network Adapter Multiplexor Driver
                                                     Verbindungsname: Netzwerkbrücke
                                                     DHCP aktiviert:  Ja
                                                     DHCP-Server:     192.168.10.1
                                                     IP-Adresse(n)
                                                     [01]: 192.168.10.45
                                                     [02]: fe80::6867:45f2:aac9:8241
Anforderungen für Hyper-V:                     Es wurde ein Hypervisor erkannt. Features, die für Hyper-V erforderlich sind, werden nicht angezeigt.

Steps to reproduce

  1. Have a username with an Umlaut and login with that user (ÄÖÜäöü)
  2. Try 'crc setup' and reboot
  3. Do 'crc setup' again, reboot again
  4. It will keep telling you to reboot and never actually finish the setup because it can not find your user

Expected

A user in the crc-users group is created and recognized as such by crc.

Actual

A user in the crc-users group is created but not recognized as such by crc.

INFO Checking if current user is in crc-users and Hyper-V admins group
DEBU Running '(Get-LocalGroupMember -Group 'crc-users').Name'
DEBU Checking current user is in the 'crc-user' group
DEBU group members: AzureAD\MoritzFl�ter
DEBU Could not find: MoritzFlöter in the 'crc-users' group
PS C:\Users\MoritzFlöter> Get-LocalGroupMember -Group 'crc-users'

ObjectClass Name                 PrincipalSource
----------- ----                 ---------------
Benutzer    AzureAD\MoritzFlöter AzureAD

Logs

C:\Users\MoritzFlöter>crc setup --log-level debug
DEBU CRC version: 2.37.1+36d451
DEBU OpenShift version: 4.15.14
DEBU Running 'crc setup'
INFO Using bundle path C:\Users\MoritzFlöter\.crc\cache\crc_hyperv_4.15.14_amd64.crcbundle
INFO Checking minimum RAM requirements
DEBU Total memory of system is 68412473344 bytes
INFO Check if Podman binary exists in: C:\Users\MoritzFlöter\.crc\bin\oc
INFO Checking if running in a shell with administrator rights
DEBU Running '$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent());$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)'
INFO Checking Windows release
DEBU Running '(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId'
INFO Checking Windows edition
DEBU Running '(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").EditionID'
DEBU Running on Windows Professional edition
INFO Checking if Hyper-V is installed and operational
DEBU Running '@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent'
DEBU Running '@(Get-Service vmms).Status'
INFO Checking if Hyper-V service is enabled
DEBU Running '@(Get-Service vmms).Status'
INFO Checking if crc-users group exists
DEBU Running 'Get-LocalGroup -Name crc-users'
INFO Checking if current user is in crc-users and Hyper-V admins group
DEBU Running '(Get-LocalGroupMember -Group 'crc-users').Name'
DEBU Checking current user is in the 'crc-user' group
DEBU group members: AzureAD\MoritzFl�ter
DEBU Could not find: MoritzFlöter in the 'crc-users' group
INFO Adding logon user to crc-users and Hyper-V admins group
INFO Will run as admin: adding current user to crc-users and Hyper-V admins group
DEBU Running 'C:\Users\MORITZ~1\AppData\Local\Temp\crcScripts2241918683\runAsAdmin.ps1'
Please reboot your system and run 'crc setup' to complete the setup process
adrianriobo commented 5 months ago

yeah indeed this can be replicated consistently

PS C:\Users\MoritzFlöter> crc setup --log-level debug
DEBU CRC version: 2.37.1+36d451
DEBU OpenShift version: 4.15.14
DEBU Running 'crc setup'
INFO Using bundle path C:\Users\MoritzFlöter\.crc\cache\crc_hyperv_4.15.14_amd64.crcbundle 
INFO Checking minimum RAM requirements
DEBU Total memory of system is 34358562816 bytes  
INFO Check if Podman binary exists in: C:\Users\MoritzFlöter\.crc\bin\oc 
INFO Checking if running in a shell with administrator rights 
DEBU Running '$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent());$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)' 
INFO Checking Windows release
DEBU Running '(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId' 
INFO Checking Windows edition
DEBU Running '(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").EditionID' 
DEBU Running on Windows Enterprise edition        
INFO Checking if Hyper-V is installed and operational 
DEBU Running '@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent' 
DEBU Running '@(Get-Service vmms).Status'
INFO Checking if Hyper-V service is enabled       
DEBU Running '@(Get-Service vmms).Status'
INFO Checking if crc-users group exists
DEBU Running 'Get-LocalGroup -Name crc-users'     
INFO Checking if current user is in crc-users and Hyper-V admins group 
DEBU Running '(Get-LocalGroupMember -Group 'crc-users').Name' 
DEBU Checking current user is in the 'crc-user' group 
DEBU group members: maptba4a3dfd\MoritzFl�ter     
DEBU Could not find: moritzflöter in the 'crc-users' group 
INFO Adding logon user to crc-users and Hyper-V admins group 
INFO Will run as admin: adding current user to crc-users and Hyper-V admins group 
DEBU Running 'C:\Users\MoritzFlöter\AppData\Local\Temp\crcScripts3862165135\runAsAdmin.ps1' 
Please reboot your system and run 'crc setup' to complete the setup process
cfergeau commented 5 months ago

I fixed a similar issue several years ago https://github.com/crc-org/crc/commit/b00ee5b2e15f0d628bd4c03ee8acdb8d65cfb9c0

anjannath commented 4 months ago

https://github.com/crc-org/crc/blob/25b6eb96fdf3ecb50ff8e156a8a3581b95bf5e60/pkg/crc/preflight/preflight_checks_windows.go#L160-L167 the function adding the user is also using powershell.ExecuteAsAdmin which should add the utf-8 BOM

anjannath commented 4 months ago

Hi @moritzfl could you please try out the installer from https://github.com/crc-org/crc/actions/runs/9789510458/artifacts/1666812981 and verify if it fixes the issue, thanks!

moritzfl commented 4 months ago

@anjannath seems to work fine. Thanks for the fix!

anjannath commented 4 months ago

@anjannath seems to work fine. Thanks for the fix!

thanks very much for testing it! we'll try to include this in the next release