Basically following codes will be done in PowerShell
- Download the windows helper binaries from GitHub releases or uploaded artifacts in each workflow summary
- New session of pwsh
./winit-conf.exe run Install-Module -Name PSFzfHistory # $PROFILE is an "Automatic Variables", not ENV # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.4 ./winit-conf.exe generate -path="powershell/Profile.ps1" > "$PROFILE" ./winit-reg.exe list ./winit-reg.exe run --all
- Install some tools
# Basically this may be same output of above `winit-conf.exe` log # Pick-up the winget-*.json outputs $env:TMP # => C:\Users\YOU\AppData\Local\Temp winget import --import-file "C:\Users\YOU\AppData\Local\Temp\winitRANDOM1\winget-pkgs-basic.json" # Optional winget import --import-file "C:\Users\YOU\AppData\Local\Temp\winitRANDOM2\winget-pkgs-storage.json" winget import --import-file "C:\Users\YOU\AppData\Local\Temp\winitRANDOM3\winget-pkgs-entertainment.json"
- Remove needless pre-installed tools. Pick up from bulk-uninstall.ps
- Change Dropbox storage path from
C:\Users
, default path made problems in System Restore.
See https://zmzlz.blogspot.com/2014/10/windows-dropbox.html for detail - Enable Bitlocker and backup the restore key
AFAIK, %ENVNAME% can be replaced in PowerShell as follows
~ psh
> $env:APPDATA
C:\Users\YOU\AppData\Roaming
~ psh
> $env:TMP
C:\Users\YOU\AppData\Local\Temp
And golang source code is much helpful
winget does not support it, run as follows
wsl.exe --install --distribution "Ubuntu-24.04"
Loading personal and system profiles took 897ms.
- Make sure you are using PSFzfHistory, not PSFzf
- Make sure
pwsh -NoProfile
is fast - Restart the pwsh, if it is fast, cache maybe generated. The slow may happen when updated windows and/or the runtimes. (I guess)
- Do NOT consider about
ngen.exe
solution as Googling say. It looks old for me.
Reason: ngen.exe cannot compile latest pwsh
- Official: PowerShell/PowerShell#14374 (comment)
- Better: https://superuser.com/a/1411591/120469
- Didn't: https://stackoverflow.com/questions/59341482/powershell-steps-to-fix-slow-startup
- How: https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26
One more noting, if you cannot find ngen.exe, dig under "C:\Windows\Microsoft.NET\Framework" as "C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
winget export --output "\\wsl.localhost\Ubuntu-24.04\home\kachick\repos\dotfiles\config\windows\winget-pkgs-$(Get-Date -UFormat '%F')-raw.json"
It may be better to remove some packages such as Mozilla.Firefox.DeveloperEdition
.
- https://github.com/karakaram/alt-ime-ahk
- https://github.com/yuru7/PlemolJP
- https://www.realforce.co.jp/support/download/
- https://www.kensington.com/ja-jp/software/kensingtonworks/#download # winget cannot support v3.1.8+
- https://www.kioxia.com/ja-jp/personal/software/ssd-utility.html
- PowerShell: Using https://github.com/kelleyma49/PSFzf made much slow, prefer https://github.com/kachick/PSFzfHistory
- nushell: But it also does not have substring search like a zsh
No Japanese locale is registered in winget yet, official installer is supporting.
- kachick/times_kachick#235
- https://github.com/microsoft/winget-pkgs/tree/be851349a154acb14af6275812d79b70fadb9ddf/manifests/m/Mozilla/Firefox/DeveloperEdition/117.0b9
In WSL shell
explorer.exe .
z "$(wslpath 'G:\GoogleDrive')"
wsl --user root
https://account.microsoft.com/devices/recoverykey may help
- https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines
- https://github.com/MicrosoftDocs/PowerShell-Docs/blob/a5caf0d1104144f66ea0d7b9e8b2980cf9c605e9/reference/docs-conceptual/community/contributing/powershell-style-guide.md
- https://github.com/kachick/learn_PowerShell
Get-Help -Name New-Item
Or visit to https://learn.microsoft.com/ja-jp/powershell/module/microsoft.powershell.management/
No beautiful ways, I think. Read https://stackoverflow.com/questions/19853340/powershell-how-can-i-suppress-the-error-if-file-alreadys-exists-for-mkdir-com
If you faced following error, needed to enable the permission from Administrator's PowerShell terminal
.\windows\scripts\enable_verbose_context_menu.ps1: File \\wsl.localhost\Ubuntu-24.04\home\kachick\repos\dotfiles\windows\scripts\enable_verbose_context_menu.ps1 cannot be loaded. The file \\wsl.localhost\Ubuntu-24.04\home\kachick\repos\dotfiles\windows\scripts\enable_verbose_context_menu.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
Executing loccal scrips just requires "RemoteSigned", but in wsl path, it is remote, so needed to relax more.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Unrestricted
LocalMachine Undefined
After completed tasks, disable it as follows
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
If PowerShell in WindowsTerminal displaying as below,
PowerShell 7.3.6
Cannot load PSReadline module. Console is running without PSReadline.
I have faced this problem when called Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser
.
Try to set the permission as Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
microsoft/terminal#7257 (comment)
After registry editing, needs to restart windows or the process
Pros for Microsoft IME
- Preinstalled by Windows
- It is having cloud translations now (Called as "δΊζΈ¬ε€ζ")
Cons for Microsoft IME
- Needed to tab, not in space to get date as "γγγ"
- No way to get date with ISO 8601 format
#300 is the steps.
I now prefer podman over docker and singularity.
It needs special WSL distribution. How to run it from standard WSL ubuntu is written in this document.
Make sure you are using podman binary as podman-remote, nixpkgs product does not satisfy.
This repository aliases podman command to mise installed binary.
This is an worked example
# WSL - Ubuntu
podman system connection add --default podman-machine-default-user unix:///mnt/wsl/podman-sockets/podman-machine-default/podman-user.sock
# Since Ubuntu 24.04, you may need to update the usergroup of socket file
sudo chgrp "$(whoami)" /mnt/wsl/podman-sockets/podman-machine-default/podman-user.sock
# See wsl.nix for detail
# TODO: Update cmd/wsl-init
sudo systemctl enable ~/.config/systemd/user/mnt-wsl-instances-ubuntu24.mount --now
cdg irb-power_assert
podman run --volume /mnt/wsl/instances/ubuntu24/"$(pwd)":/workdir --workdir /workdir -it ghcr.io/ruby/ruby:master-dev-jammy-amd64-da66abc584a9a33693d1b5bbf70881a008b0935d
Error: Command execution failed with exit code 125 Command execution failed with exit code 125 Error: unable to load machine config file: "json: cannot unmarshal string into Go struct field MachineConfig.ImagePath of type define.VMFile"
It relates to podman#22144.
And might be happen in future major updating and the schema changes. So this snippet may help you.
Abandon current VM, images, containers. Then following steps are the how to fix
winget uninstall --exact --id RedHat.Podman-Desktop
winget uninstall --exact --id RedHat.Podman
wsl --list
wsl --unregister podman-machine-default
cd ${Env:USERPROFILE}\.config\containers\podman\machine\wsl\
Remove-Item .\podman-machine-*
winget install --exact --id RedHat.Podman
winget install --exact --id RedHat.Podman-Desktop
And create the new podman-machine-default
Track the official discussion, but there are no simple solutions for now.
This repository provides a mount based solution, mount from another instance as /mnt/wsl/..., then podman-machine also can access there.
- Ubuntu: Activate the home-manager with
--flake '.#kachick@wsl'
. - Look the definitions, it includes how to mount with systemd.
- podman-machine: Make sure podman-machine can read there
ls /mnt/wsl/instances/ubuntu24/home
- Ubuntu:
cdg project_path
- Ubuntu:
podman run -v /mnt/wsl/instances/ubuntu24/"$(pwd)":/workdir -it ghcr.io/ruby/ruby:master-dev-76732b3e7b42d23290cd96cd695b2373172c8a43-jammy
Get pubkey
cat ~/.ssh/id_ed25519.pub | clip.exe
Register the Ubuntu pubkey
vi ~/.ssh/authorized_keys
Get podman-machine port number
podman system connection list | Select-String 'ssh://\w+@[^:]+:(\d+)' | % { $_.Matches.Groups[1].Value }
You can login with the port number, for example 53061
ssh user@localhost -p 53061
After SSH setup as above steps
In WSL - Ubuntu
rclone config create podman-machine sftp host=localhost port=53061 publickey=~/.ssh/id_ed25519.pub user=user
# Make sure the connection
rclone lsd podman-machine:/home/user
z project_path
rclone mount --daemon "podman-machine:repos/$(basename "$(pwd)")" .
# If you want to unmount, use specific command instead of kill the background job
#
# Linux
fusermount -u /path/to/local/mount
# OS X
# umount /path/to/local/mount
This is just a note, prefer rclone mount
for easier
After SSH setup as above steps
In WSL - Ubuntu
z project_path
rclone sync --progress . "podman-machine:repos/$(basename "$(pwd)")"