Ubuntu22.04 CLI が壊れた時の対処法

sudo apt install ubuntu desktop を実行
1時間待ち…2時間待ち
それでも処理が終わらずに
結果としてUbuntuがうんともすんとも言わなくなってしまった…




①sudo apt update && sudo apt upgrade を実行してみる
ここで処理が停止
```
Failed to start apt-news.service: Transport endpoint is not connected
See system logs and 'systemctl status apt-news.service' for details.
Failed to start esm-cache.service: Transport endpoint is not connected
See system logs and 'systemctl status esm-cache.service' for details.
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Get:2 https://packages.microsoft.com/repos/code stable InRelease [3589 B]
Get:3 https://packages.microsoft.com/repos/code stable/main arm64 Packages [15.8 kB]
Get:4 https://packages.microsoft.com/repos/code stable/main amd64 Packages [15.7 kB]
Get:5 https://packages.microsoft.com/repos/code stable/main armhf Packages [15.7 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:7 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1155 kB]
Hit:10 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:11 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1371 kB]
Get:12 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [403 kB]
Get:13 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [212 kB]
Get:14 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [842 kB]
Get:15 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [592 kB]
Get:16 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [161 kB]
Get:17 http://archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [569 kB]
Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [272 kB]
Get:19 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1049 kB]
Get:20 http://archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [689 kB]
Get:21 http://archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [237 kB]
Fetched 7833 kB in 7s (1078 kB/s)
```




②sudo dpkg --configure -aを実行
→エラーメッセージが出て、処理が終了
```
Setting up whoopsie (0.2.77) ...
Failed to preset unit: Transport endpoint is not connected
/usr/bin/deb-systemd-helper: error: systemctl preset failed on whoopsie.path: No such file or directory
Failed to reload daemon: Transport endpoint is not connected
Failed to retrieve unit state: Transport endpoint is not connected
invoke-rc.d: could not determine current runlevel
Failed to start whoopsie.service: Transport endpoint is not connected
See system logs and 'systemctl status whoopsie.service' for details.
invoke-rc.d: initscript whoopsie, action "start" failed.
Failed to get properties: Transport endpoint is not connected
dpkg: error processing package who

opsie (--configure):
installed whoopsie package post-installation script subprocess returned error exit status 1
Setting up dbus (1.12.20-2ubuntu4.1) ...
Failed to reload daemon: Transport endpoint is not connected
Terminated
```




③これで解決しました！

```
sudo rm -rf /etc/acpi/events
```




【参考にした記事】
https://github.com/microsoft/WSL/issues/10322
Peng Wang氏に最大の敬意と感謝を申し上げます