2020-06-17

Feedburner の Twitter 連携が終了していた

…ので IFTTT からツイートするようにしました。

debconf を readline で使う人は libterm-readline-gnu-perl を

私は debconf は Readline で使う人種です。このとき libterm-readline-gnu-perl をインストールしておくと、選択肢の既定値(現在の値)が入力済みで表示されるので便利です。locale の選択なんかは ちょっとげんなりするかもしれない…。


debconf(7) Frontends readline より(強調は私)
The most traditional frontend, this looks quite similar to how Debian configuration always has been: a series of questions, printed out at the console using plain text, and prompts done using the readline library. It even supports tab completion. The libterm-readline-gnu-perl package is strongly recommended if you chose to use this frontend; the default readline module does not support prompting with default values.  At the minimum, you'll need the perl-modules package installed to use this frontend.

This  frontend  has  some  special hotkeys. Pageup (or ctrl-u) will go back to the previous question (if that is supported by the package that is using debconf), and pagedown (or ctrl-v) will skip forward to the next question.

This is the best frontend for remote admin work over a slow connection, or for those who are comfortable with unix.

2020-06-15

Windows Terminal のタブに表示する WSL ディストロのアイコンを設定する


良さそうなアイコンをダウンロードする。
PowerShell
1
2
3
4
>> -OutFile $ENV:LOCALAPPDATA\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState\icon-Debian.png
>> -OutFile $ENV:LOCALAPPDATA\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState\icon-Ubuntu.png
各プロファイルにアイコン ファイルを設定する。
settings.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"profiles":
{
    "list":
    [
        // 略
        {
            "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
            "hidden": false,
            "name": "Ubuntu",
            "source": "Windows.Terminal.Wsl",
            "icon": "ms-appdata:///Local/icon-Ubuntu.png"
        },
        {
            "guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
            "hidden": false,
            "name": "Debian",
            "source": "Windows.Terminal.Wsl",
            "icon": "ms-appdata:///Local/icon-Debian.png"
        },
        // 略
    ]
},

WSL のデフォルト Linux ディストリビューションを変更する

WSL に複数の Linux ディストリビューションを導入しているときに、bash や wsl コマンドで実行されるデフォルトのディストリビューションを変更する。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Linux ディストリビューションのリストを表示
PS C:\Users\yu-ji> wsl --list --verbose
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
  Debian    Running         2
 
# bash コマンドで実行されるのは Ubuntu
PS C:\Users\yu-ji> bash -c "cat /etc/os-release | grep VERSION="
VERSION="20.04 LTS (Focal Fossa)"
 
# デフォルトを Debian へ変更
PS C:\Users\yu-ji> wsl --set-default Debian
PS C:\Users\yu-ji> wsl --list --verbose
  NAME      STATE           VERSION
* Debian    Running         2
  Ubuntu    Stopped         2
 
# bash コマンドで実行されるのは Debian
PS C:\Users\yu-ji> bash -c "cat /etc/os-release | grep VERSION="
VERSION="10 (buster)"
 
# bash, wsl はどこ?
PS C:\Users\yu-ji> Get-Command bash, wsl
 
CommandType     Name        Version    Source
-----------     ----        -------    ------
Application     bash.exe    10.0.19... C:\Windows\System32\...
Application     wsl.exe     10.0.19... C:\Windows\System32\...

参考

以前は wslconfig.exe でやっていた

WSL の Debian 再インストール時にエラー Code: 0x80073D05

WSL の Debian を再インストールしようとしたら Code: 0x80073D05 のエラーとなって失敗する。
アンインストールしてもフォルダーが残っていて、これが原因で失敗するらしい。
削除することで無事再インストールできた。

再インストール時のエラー

Code: 0x80073D05

残っていたフォルダー

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
PS C:\Users\yu-ji> gci -Recurse -Path $ENV:APPDATA\..\Local\Packages\TheDebianProject* | sort
gci : Access to the path 'C:\Users\yu-ji\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\SystemApp
Data\Helium\Cache' is denied.
At line:1 char:1
+ gci -Recurse -Path $ENV:APPDATA\..\Local\Packages\TheDebianProject* | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\yu-ji\...ta\Helium\Cache:String) [Get-ChildItem], Unauthoriz
   edAccessException
    + FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
 
 
 
    Directory: C:\Users\yu-ji\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4
 
 
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2020/06/04      4:08                SystemAppData
 
 
    Directory: C:\Users\yu-ji\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\SystemAppData
 
 
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2018/03/10     12:07                Helium
 
 
    Directory: C:\Users\yu-ji\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\SystemAppData\Helium
 
 
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2018/03/10     12:07                Cache
-a----        2018/03/10     12:07           8192 User.dat
-a----        2018/03/10     12:07           8192 UserClasses.dat
 
 
    Directory: C:\Users\yu-ji\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4
 
 
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2018/03/10     12:07                TempState

残っていたフォルダーを消す

1
2
3
4
5
6
7
8
9
PS C:\Users\yu-ji> ri -Recurse -Path $ENV:APPDATA\..\Local\Packages\TheDebianProject* -Force
ri : Access to the path 'C:\Users\yu-ji\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\SystemAppD
ata\Helium\Cache' is denied.
At line:1 char:1
+ ri -Recurse -Path $ENV:APPDATA\..\Local\Packages\TheDebianProject* -F ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\yu-ji\...x_76v4gfsz19hv4:String) [Remove-Item], Unauthorized
   AccessException
    + FullyQualifiedErrorId : RemoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand
Helium の中が消せないので Explorer から手動で権限を取得して削除して…
1
2
3
PS C:\Users\yu-ji> ri -Recurse -Path $ENV:APPDATA\..\Local\Packages\TheDebianProject* -Force
PS C:\Users\yu-ji> gci -Recurse -Path $ENV:APPDATA\..\Local\Packages\TheDebianProject* | sort
PS C:\Users\yu-ji>

再インストールする

This product is installed.
できたっぽい。
Debian GNU/Linux
1
2
3
4
5
6
7
8
9
10
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: yu-ji
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
yu-ji@Cxaxukluth:~$ uname -a
Linux Cxaxukluth 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 GNU/Linux
できた。
1
2
3
4
PS C:\Users\yu-ji> wsl --list --verbose
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
  Debian    Running         2

2020-06-13

open WSL$ home directory in file explorer

WSL のホーム ディレクトリをファイル エクスプローラーで開く
PowerShell
1
PS C:\Users\yu-ji> wsl sh -c "cd && explorer.exe ."
Ubuntu の場合、以下のフォルダーが開かれる
UNC
1
\\wsl$\Ubuntu\home\yu-ji