Windows 11

From Segfault
Jump to navigation Jump to search

Upgrade

Upgrading to Windows 11 can be done in various ways[1], the biggest hurdle may be the hardware requirements for running Windows 11. To upgrade to Windws 11 without supported hardware, we can set registry key to force the update:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\Setup\MoSetup]
"AllowUpgradesWithUnsupportedTPMOrCPU"=dword:00000001

After downloading Windows 11 we should verify the checksum:

$ Get-FileHash .\Win11_English_x64v1.iso
Algorithm       Hash
---------       ----
SHA256          4BC6C7E7C61AF4B5D1B086C5D279947357CFF45C2F82021BB58628C2503EB64E

$ Select-String -Pattern "4BC6C7E7C61AF4B5D1B086C5D279947357CFF45C2F82021BB58628C2503EB64E" .\Win11_English_x64v1.iso.sha256
Win11_English_x64v1.iso.sha256:1:English 64-bit 4BC6C7E7C61AF4B5D1B086C5D279947357CFF45C2F82021BB58628C2503EB64E

If the checksum is correct, the installation process can be started.

WSL

Install Linux on Windows with WSL:

$ wsl --install --distribution debian
The requested operation requires elevation.
Installing: Windows Subsystem for Linux
A specified logon session does not exist. It may already have been terminated.

While already reported[2], the fix is to install WSL as an optional feature first:

Settings => Apps => Optional Features => More Windows Features

Here, enable both Virtual Machine Platform and Windows Subsystem For Linux.

Or, via the command line:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

While we're at it, switch to WSL2:

wsl --set-default-version 2

Still, AlpineWSL would not install:

$ Downloads\Alpine\Alpine.exe
Using: C:\Users\ck\Downloads\Alpine\rootfs.tar.gz
Installing...
ERR: WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel
HRESULT: 0x800701bc
Press enter to exit...

Update the WSL2 kernel[3]

$ wsl --update
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.

With that, the installation should succeed and we will be able to start our distribution:

$ wsl -l
Windows Subsystem for Linux Distributions:
Alpine
$ wsl -d Alpine                                                               # Use "wsl  --set-default Alpine" to just use "wsl"
> uname -r
5.15.90.1-microsoft-standard-WSL2

SSH

ssh-agent

We need to enable the ssh-agent service first:

$ Get-Service ssh-agent | Select StartType
Disabled

$ Get-Service -Name ssh-agent | Set-Service -StartupType Automatic

$ Get-Service ssh-agent | Select StartType
Automatic

Permissions

PS C:\Users\bob> ssh-add .\Documents\ssh.key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for '.\\Documents\ssh.key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

We need to correct the permissions via icacls here:

PS C:\Users\bob> icacls .\Documents\ssh.key /inheritance:r                    # removes all inherited ACLs
PS C:\Users\bob> icacls .\Documents\ssh.key /grant:r bob:"(R)"                # Replaces ACLs with read-only access. Use M for read-write access.

Note: "$env:USERNAME":"(R)" doesn't seem to work.[4]

For an SSH server, we need to adjust the permissions for the authorized_keys file too:[5]

$ icacls.exe "$env:ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
processed file: C:\ProgramData\ssh\administrators_authorized_keys
Successfully processed 1 files; Failed processing 0 files

References