Bugs solutions
即自己遇到的问题以及相应的解决方法。
Unix¶
ssh to WSL¶
- 从 macOS 到 Windows WSL
- ubuntu:
sudo systemctl start ssh
- ubuntu:
- SSH 访问 Windows 的 WSL2 Ubuntu
- kali-linux:
sudo /usr/sbin/service ssh start
- kali-linux:
- windows 上执行
netsh interface portproxy show all
查看开放端口
Wsl default user¶
法 1(终端中能运行对应发行版程序)¶
法 2(通用)¶
Wsl change disk¶
Wsl 越用越大,默认在 C 盘,如何移动到 D 盘自己指定的位置呢?
in cmd or powershell
wsl --shutdown # 关闭 wsl 上运行的发行版
wsl --export <Distro> <FileName> [选项] # 建议将分发版导出到 tar 文件。
wsl --unregister <Distro> # 将原来的卸载
wsl --import-in-place <Distro> <InstallLocation> <FileName>
显然迁移是需要打包、迁移、解包的,那么当然是发行版越小的时候迁移越方便。
wsl 磁盘压缩 ¶
wsl 不主动释放使用过的空间,可以使用 WSL2 虚拟磁盘文件 (.vhdx) 占用过大处理办法 解决。
忘记了 wsl root 权限密码 ¶
- https://learn.microsoft.com/zh-cn/windows/wsl/setup/environmentset-up-your-linux-username-and-password
忘记 Vmware-machine 密码 ¶
change version of JAVA in linux¶
sudo update-alternatives --config java
change version of GCC in linux¶
- https://blog.csdn.net/qq_39779233/article/details/105124478
- https://lindevs.com/install-gcc-on-ubuntu/
Kali linux install¶
windows¶
oh-my-posh 显示 python 虚拟环境 ¶
PowerShell 显示 Module 相关问题
注意 json 文件中实际不能够有注释:
JSON
{
"type": "python",
"foreground": "#ffffff",
"style": "plain",
"properties": {
"home_enabled": true,
"fetch_version": true,
"fetch_virtual_env": true,
"display_mode": "context",
"display_virtual_env": true,
"dispplay_default": true,
"display_version": false
},
"template": "(\uE235 {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }}{{ else }}{{ .Full }}{{ end }}{{ end }})"
},
windows 文件资源管理器中的 “网盘图标” 移除 ¶
注册表中:
Text Only
计算机\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\
也有些可能在 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\
电脑不使用后两分钟锁屏自动锁屏 ¶
- https://www.zhihu.com/question/55617612
在 Windows11 上隐藏任务栏中的 copilot ¶
最近在 windows 11 更新后,任务栏中出现了一个 copilot ,基于仍然是试用期,而且大陆不能直接访问,懒得用了,放那也碍眼:
Network¶
macOS clash 系统代理打开无效 ¶
missing cap_net_raw+p capability or setuid¶
Bash
$ ping github.com
ping: socktype: SOCK_RAW
ping: socket: Operation not permitted
ping: => missing cap_net_raw+p capability or setuid?
$ curl https://baidu.com
curl: (35) GnuTLS, handshake failed: The TLS connection was non-properly terminated.
ping
权限不够,sudo setcap cap_net_raw+ep /usr/bin/ping
提供权限。
From xxxx icmp_seq=n Destination Host Unreachable¶
WSL ping <domain>/<ip>
时出现无法找到的问题,但是宿主机是可以正常访问的,unreachable 似乎将问题指向了 DNS,最后通过修改 /etc/resolv.conf
中的 nameserver 后的 DNS 服务器 ip 解决(修改至与宿主机一致即可
连接需要登录的 wifi 时重定向界面错误 ¶
在登入企业 / 学校 wifi 时,需要账号登入;但是发现只是跳转到 http://www.msftconnecttest.com/redirect 之后显示失败了,在这里 找到了答案。
简而言之,先把 VPN 什么的关了,否则影响上述链接重定向。
vscode 中使用 copilot 登录失败 ¶
在更换学生认证包后,vscode 上的 copilot 突然间登入不上,体现在点击登陆后自动跳转到认证界面,确定后 vscode 这边却没反应。
搜索后有人指向了 setting.json,打开搜索,确实发现了:
JSON
"github.copilot.chat.localeOverride": "zh-CN",
"github.copilot.preferredAccount": "...", // 此处省略我的 GitHub 邮箱地址
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"scminput": false
},
尝试删除后重试,问题解决;建议 Ctrl x 剪切,万一问题不在这,也能复原。
Other¶
如何获取 Google 安全码?¶
- 热夏的博客
- 有些手机没有 google 官方给出的获取安全码的方式,我们可以在 google play 中下载 "google" 这个应用。
Tab Foucs in Vscode¶
- Q: 在 VSCode 中,Tab 键变成了在各选项间跳跃(即焦点切换
) ,而不是接受 AI 插件给出的建议。 - A: 使用
Ctrl M
快捷键切换了这一模式。
obsidian 文件保存失败?¶
Syncthing 跨设备同步工具 ¶
Deskflow¶
- Q:
NOTE: cursor is locked to screen, check scroll lock key
- (windows) 键盘上的
ScrLk
按键。