Notes on Ubuntu
要用Ubuntu的一些个环境: PettingZoo.
Win10下配置Ubuntu可视化窗口
Ubuntu on Windows
太长不看版, 下载安装到GUI运行一条龙: WSL2 Ubuntu GUI, 其代码见wsl2/ubuntu_gui_youtube.
安装WSL2和Ubuntu, Windows Subsystem for Linux Installation Guide for Windows 10.
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10, Windows 11,[2] and Windows Server 2019.
Ubuntu (/ʊˈbʊntuː/ uu-BUUN-too)[7] (Stylized as ubuntu) is a Linux distribution based on Debian and composed mostly of free and open-source software.[8][9][10] Ubuntu is officially released in three editions: Desktop,[11] Server,[12] and Core[13] for Internet of things devices[14] and robots.[15][16] All the editions can run on the computer alone, or in a virtual machine.[17] Ubuntu is a popular operating system for cloud computing, with support for OpenStack.[18] Ubuntu's default desktop has been GNOME, since version 17.10.
安装过程最麻烦的报错是Error 0x80370102 The Virtual machine could not be started because a required feature is not installed .... #436, 解决方法可参照ktmn的回答, 具体如下:
win+R
→ 键入msinfo32
后回车 → 查看BIOS Mode
的值, 见How to Fix UEFI Firmware Settings Missing Windows 10 [Partition Magic].- 若为
UEFI
,win+I
→ 搜索BIOS
→ 点击Advanced startup下的Restart now, 之后依次点击Troubleshoot
→Advanced options
→UEFI Firmware Settings
即可进入BIOS, 见How to enter the BIOS on a Windows 10 PC - 若为
Legacy
, 则只能重启电脑手动进入BIOS. 若电脑重启速度过快, 则按电源旁边的重启键强制重启, 按F2
进入 (按键因人而异). (因为不了解BIOS系统遇到过的白痴情况: 自然重启正常, 按F2
重启后主板boot绿灯常亮, 显示屏无输出, 折腾了半天技术人员怀疑到了显示器上, 还真是这样😵 我连了三个显示器, 其中一个不插电, 后来插了电发现BIOS界面就显示在这个屏幕上. 看了一眼主板, 发现绿灯常亮, 也就是说绿灯常亮是在BIOS界面内的意思)
- 若为
- 进入BIOS, 搜索
Virtualization
并启动.
GUI运行:
sudo /etc/init.d/xrdp start
, 详见WSL2 Ubuntu GUI.
云服务器
You are here:
Home / Tutorial / How To Check Your IP Address in Ubuntu [Beginner’s
Tip] How To Check Your IP Address in Ubuntu [Beginner’s Tip]:
给出了详细的步骤和图示, 并且有对ufw
的简单使用教程.
记录在Linux系统Ubuntu 20.04中安装xrdp远程桌面连接RDP: 唯一看了之后才成功的😠, 重要的几点如下:
- 安装桌面后重启服务器.
- 避开Windows的
3389
端口, 比如文中使用了13389
端口
同时需要注意IP (以下使用0.0.0.0
代替) 的获取方式有
ipconfig
后Ethernet adapter 以太网
中的IPv4 Address
.- 一直点你的网络直到进入
Settings
, 查看Properties
中的IPv4 address
.
具体的过程如下:
1 | sudo apt update |
1 | sudo ufw status |
1 | sudo sed -i 's/3389/13389/g' /etc/xrdp/xrdp.ini |
之后又会遇到很多问题:
打开黑屏或者报错😡
1
2
3- Sorry, Ubuntu 20.04 has experienced an internal error.
- Send problem report to the developers?
If you notice further rpoblems, try restarting the computer.解决方法为How did I connect to Ubuntu 18.04 Xfce 4 desktop from Windows 7 via xrdp?, 和Ubuntu on Windows的配置类似.
打不开命令行👿, 报错
1
2- Failed to execute default Ternimal Emulator.
Input/output error.解决方法见Getting input/output error running anything on remote desktop, 具体为安装并选择
xfce4-terminal
.1
2sudo apt-get install xfce4-terminal
sudo update-alternatives --config x-terminal-emulator
常用命令
AMD64 or Intel x86 - how to check?
Ununtu | Explaination | Reference |
---|---|---|
lsb-release -a | 查看Ubuntu版本 | |
sudo apt update && sudo apt -y upgrade | 更新 | |
clear | 清屏 | |
hostname -I | 查看IP | |
dpkg -s [package name] |grep '^Version:' | 查看包的版本 | How can I find the version number of an installed package via dpkg? |
wsl.exe –shutdown | 重启 | Rebooting Ubuntu on Windows without rebooting Windows? |
trash-empty | 清理垃圾 | Four Ways to Empty the Trash/Recycle Bin in Ubuntu |
explorer.exe . | 打开资源管理器 | How Do I Transfer Files from WSL to Windows - Linux Hint, How to open windows explorer from current working directory of WSL shell? |
... 2>&1 tee output.txt | 终端输出并存档 | What does 2>&1 | tee mean? |
grep -rnw '/path/to/somewhere/' -e 'pattern' | 查找内容 | How to find all files containing specific text (string) on Linux |
watch --interval 2 nvidia-smi | 周期执行命令 | watch - execute a program periodically, showing output fullscreen |
df -h | 查看储存空间 | How do I find the amount of free space on my hard drive? |
WSL | Explaination | Reference |
---|---|---|
wsl –shutdown | 关闭 | |
wsl –list –online | 查看可用的发布版本 | Change the default Linux distribution installed - Microsoft Docs |
wsl –install -d |
下载某发布版本 | 🔼 |
wsl –list –verbose | 查看版本 | Check which version of WSL you are running - Microsoft Docs |
wsl –set-default-version <Version#> | 设置版本 | 🔼 |
wsl –setdefault |
设置名字 | 🔼 |
wsl -d |
运行 | 🔼 |
Windows Manager
Screen | Tmux | |
---|---|---|
List | screen -ls | tmux ls / Ctrl+B+S (list-sessions), Esc |
New | screen -S [name] | tmux new -s [name] |
Detach | Ctrl+A+D (:detach) | Ctrl+B+D (:detach) |
Attach | screen -r [name] | tmux attach-session -t mysession / Ctrl+B+S, Enter |
Kill | screen -X -S [session to kill] quit | tmux kill-session -t mysession / Ctrl+B+X |
Reference | Screen
User’s Manual How To Use Linux Screen How To Set Up a Minecraft Server on Linux |
How
to Use tmux on Linux (and Why It’s Better Than Screen) Tmux Cheat Sheet & Quick Reference |
Find
Find | Explaination | Reference |
---|---|---|
find / -size +10M -size -12M -ls | Find files between 10MiB and 12MiB. | What's a command line way to find large files/directories to remove and free up space? |
常用快捷键
Switch 切屏
Setting special keys as keyboard shortcuts: 详细介绍了快捷键的设置方式, 如下三条就能搞定
1
2
3gsettings get org.gnome.desktop.wm.keybindings switch-windows
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
gsettings reset org.gnome.desktop.wm.keybindings switch-windowsHow to disable/rebind Super+` in Ubuntu 17.10 (gnome)?: Lpgfmk给出了置为空的方式, 即设置为"[]"
How to Fix the Alt Tab in Remote Desktop (RDP) Sessions: 搞了半天都不行, 发现不是Ubuntu设置的锅, 远程控制在
Local Resources
的Keyboard
中把设置改一下就好了
Installation
App: Run Linux GUI apps on the Windows Subsystem for Linux (preview)
.deb
:
Install/Uninstall .deb files
.tar.tz
:
若有
./config
, 见How do I install a .tar.gz (or .tar.bz2) file?, 具体为:1
2
3
4tar xvzf PACKAGENAME.tar.gz
./configure
make
sudo make install若无, 见How to Install Python IDE PyCharm in Ubuntu and Other Linux Distributions, 具体为
1
2
3
4
5tar -xzf file.tar.gz
cd file
cd bin
chmod u+x file.sh
sh file.sh
.sh
:
1 | chmod u+x file.sh |
装anaconda的例子, 见[How To Install Anaconda on Ubuntu 18.04 Quickstart]
1 | cd /tmp |
google-research/football
Imported target "Boost::filesystem" includes non-existent path "/include" in its interface_include_directories #311
1 sudo ln -s /usr/include /include
czet88/OCT_Benders
fatal error: cplex.h: No such file or directory
具体报错如下:
1 | (base) carlos@DESKTOP-R4H3HQA:~/Github/OCT_Benders/src$ make |
原因就是没装CPLEX, 保姆教程见How to install CPLEX
on Ubuntu 20.4,
装好后把Makefile
中的CPLEXDIR = ../../../../encs/pkg/cplex-12.7.1/root/cplex
改为CPLEXDIR = /opt/ibm/ILOG/CPLEX_Studio221/cplex/
.
undefined reference to `dladdr'
具体报错如下:
1 | (base) carlos@DESKTOP-R4H3HQA:~/Github/OCT_Benders/src$ make |
解决方法见Compilation of
MAX_HS solver with IBM CPLEX,
具体为把Makefile
中的CLNFLAGS = -lcplex -lm -lpthread
改为CLNFLAGS = -lcplex -lm -lpthread -ldl
.
CPLEX
Installation of IBM ILOG CPLEX Optimization Studio on Linux Platforms
The installer for IBM ILOG CPLEX Optimization Studio is distributed as a
.bin
filecplex_studioXXX.linux-x86-64.bin
..bin
files are Linux self extracting files. Once you download the installer, follow the steps below:- Make sure the
.bin
file is executable. If necessary, change its permission using the chmod command from the directory where the .bin is located:chmod +x cplex_studioXXX.linux-x86-64.bin
- Enter the following command to start the installation process:
./cplex_studioXXX.linux-x86-64.bin
- Make sure the
Installing CPLEX Optimization Studio
How do I download CPLEX Optimization Studio?
视频中How to
install CPLEX on Ubuntu
20.4使用的安装文件为cplex_studio128.linux-x86.bin
应是版本12.8.0.0
的CPLEX;
查找之前的安装路径是/opt/ibm/ILOG/CPLEX_Studio_Community201/cplex
.
然而现在最新的版本是22.1.0
, 而且免费版本可能有性能限制, czet88/OCT_Benders的奇怪报错可能是上述原因导致的.
先卸载旧版本的CPLEX, 见[Uninstalling CPLEX Optimization Studio](https://www.ibm.com/docs/en/icos/12.9.0?topic=v1290-uninstalling-cplex-optimization-studio):
1 | sudo find / -name cplex |
安装时的一些有用信息:
Default Install Folder:
/opt/ibm/ILOG/CPLEX_Studio221
Python:
1
2
3
4
5If you want to use the CPLEX or CP Optimizer engines through their Python
APIs, you need to tell Python where to find them. To do so, enter the
following command into a terminal :
<<<<<<
python /opt/ibm/ILOG/CPLEX_Studio221/python/setup.py install
Anacodna & Pycharm
How to install Anaconda on WSL Windows 10 using Ubuntu Linux App
Configure
an interpreter using WSL | PyCharm - JetBrains:
注意一定要浏览到可执行文件python
,
若浏览到环境所在文件夹会报错process finish with exit code 0
Pygame
Pettingzoo的Pistonball渲染后报错pygame.error: windows not available
;
而pygame.init()
后报错
1 | ALSA lib confmisc.c:767:(parse_card) cannot find card '0' |
尚未解决, 见pygame tries to use alsa.
Troubling Shooting
黑屏问题
Ubuntu 18.04, Blank screen after login from Windows 10 #1358
Jarez95好答案, 但没看.
affansaied给出了两种GUI的配置方法, 我没试成功.
- (没有效果)
更改
startwm.sh
的内容, 见How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP.原文内容见Restore contents of /etc/xrdp/startwm.sh, 有两处需要修改:- wsl2/ubuntu_gui_youtube
- How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP
更改后内容如下:
ERROR: No matching distribution found for setuptools
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
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence
if test -r /etc/profile; then
. /etc/profile
fi
if test -r /etc/default/locale; then
. /etc/default/locale
test -z "${LANG+x}" || export LANG
test -z "${LANGUAGE+x}" || export LANGUAGE
test -z "${LC_ADDRESS+x}" || export LC_ADDRESS
test -z "${LC_ALL+x}" || export LC_ALL
test -z "${LC_COLLATE+x}" || export LC_COLLATE
test -z "${LC_CTYPE+x}" || export LC_CTYPE
test -z "${LC_IDENTIFICATION+x}" || export LC_IDENTIFICATION
test -z "${LC_MEASUREMENT+x}" || export LC_MEASUREMENT
test -z "${LC_MESSAGES+x}" || export LC_MESSAGES
test -z "${LC_MONETARY+x}" || export LC_MONETARY
test -z "${LC_NAME+x}" || export LC_NAME
test -z "${LC_NUMERIC+x}" || export LC_NUMERIC
test -z "${LC_PAPER+x}" || export LC_PAPER
test -z "${LC_TELEPHONE+x}" || export LC_TELEPHONE
test -z "${LC_TIME+x}" || export LC_TIME
test -z "${LOCPATH+x}" || export LOCPATH
fi
# [How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP]
# (https://www.youtube.com/watch?v=0PlG6vCOmjc)
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
. $HOME/.profile
if test -r /etc/profile; then
. /etc/profile
fi
# test -x /etc/X11/Xsession && exec /etc/X11/Xsession
# exec /bin/sh /etc/X11/Xsession
# xfce
startxfce4 终极办法, 重启xrdp.
1
sudo /etc/init.d/xrdp restart
貌似解决了的办法, 进入
Xfce Power Manager
→Display
,Security
把会熄屏的选项调成Never
.
XX is Already Running
这是黑屏后附带产生的问题, 可以通过Applications
→
System
→ Task Manager
观察其运行状况,
也可以直接用pkill -f XX
关闭, 见Pycharm is "Already
running" while trying to launch from ubuntu terminal中 furas的评论.
curl: (60) SSL certificate problem: unable to get local issuer certificate
今天又被Ubuntu整破防了, 起因是想搞点DCMST的实验, 比如这个malbarbo/dcmstp-instances,
这次我学乖了直接上Ubuntu, make
时跳标题错误, 我就看了
- SSL Certificate Verification
- curl: (60) SSL certificate problem: unable to get local issuer certificate
- How do you add a certificate authority (CA) to Ubuntu?, 这里写了个命名坑
我滴操作如下
- 下载cacert.pem
- 运行
mv /home/carlos/downloads/mycert.crt /usr/local/share/ca-certificates/
移动并进入 - 用
sudo mv ca-certificates.crt mycert.crt
将其命名为mycert.crt
- 上述目录运行
sudo mv ca-certificates.crt mycert.crt
- 命名环境变量
export CURL_CA_BUNDLE="/usr/local/share/ca-certificates/mycert.crt"
搞不定了, 歇了...
好了我最后靠把Makefile
里所有的curl
都加上-k
解决了,
见curl: (60) SSL certificate
problem: unable to get local issuer certificate.
(然而这个库的链接挂了, 搞了半天还是用不了, 我暴哭😢)
ls: command not found
环境变量烂了, 每次进terminal都报错.
1 | ubuntu@VM-4-5-ubuntu:~$ ls |
解决方法见Command 'ls' is available in '/bin/ls', 具体为
.bashrc'中加入
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"`..profile
中加入PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
.- 保证
/etc/environment
为PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
.
Microsoft Store Erro Code 0x80190001
无法连接应用商城, 设置 → 选择网络和Internet → 代理
,
关闭后恢复正常, 见微软商店,打开就显示无法加载该页面
代码0x80131500,这个情况怎么解决? - 甘蔗的回答 - 知乎.
wsl failed to fetch archive
1 | Need to get 217 kB/54.7 MB of archives. |
-
Apt-get update
and apt-get upgrade fail #4435: 试了关VPN,
在
/etc/resolv.conf
里写入nameserver 8.8.8.8
, 都没有用 -
E:
Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing? [duplicate]:
指出
sudo apt-get clean
后sudo apt-get update
但没有解决问题 -
Unable to fetch some archives
- recently modified ubuntu package sources [duplicate]:
指出可能是要换个镜像,
观察报错信息得知是
http://archive.ubuntu.com/ubuntu focal/universe
无法连接, 于是在Change Ubuntu 18.04 update source to mirror site in China找到了阿里云镜像, 即把archive.ubuntu.com
替换为mirrors.aliyun.com
, 随后在/etc/apt/sources.list
中的focal/universe
项把网址替换一下就好了!
占用空间过大
How do I get back unused disk space from ubuntu on wsl2?: 减少
ext4.vhdx
的空间
title: Notes on Ubuntu date: 2021-09-17 16:49:17 tags:- Notes
- Ubuntu categories:
- [Notes] mathjax: False copyright: true
要用Ubuntu的一些个环境: PettingZoo.
Win10下配置Ubuntu可视化窗口
Ubuntu on Windows
太长不看版, 下载安装到GUI运行一条龙: WSL2 Ubuntu GUI, 其代码见wsl2/ubuntu_gui_youtube.
安装WSL2和Ubuntu, Windows Subsystem for Linux Installation Guide for Windows 10.
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10, Windows 11,[2] and Windows Server 2019.
Ubuntu (/ʊˈbʊntuː/ uu-BUUN-too)[7] (Stylized as ubuntu) is a Linux distribution based on Debian and composed mostly of free and open-source software.[8][9][10] Ubuntu is officially released in three editions: Desktop,[11] Server,[12] and Core[13] for Internet of things devices[14] and robots.[15][16] All the editions can run on the computer alone, or in a virtual machine.[17] Ubuntu is a popular operating system for cloud computing, with support for OpenStack.[18] Ubuntu's default desktop has been GNOME, since version 17.10.
安装过程最麻烦的报错是Error 0x80370102 The Virtual machine could not be started because a required feature is not installed .... #436, 解决方法可参照ktmn的回答, 具体如下:
win+R
→ 键入msinfo32
后回车 → 查看BIOS Mode
的值, 见How to Fix UEFI Firmware Settings Missing Windows 10 [Partition Magic].- 若为
UEFI
,win+I
→ 搜索BIOS
→ 点击Advanced startup下的Restart now, 之后依次点击Troubleshoot
→Advanced options
→UEFI Firmware Settings
即可进入BIOS, 见How to enter the BIOS on a Windows 10 PC - 若为
Legacy
, 则只能重启电脑手动进入BIOS. 若电脑重启速度过快, 则按电源旁边的重启键强制重启, 按F2
进入 (按键因人而异). (因为不了解BIOS系统遇到过的白痴情况: 自然重启正常, 按F2
重启后主板boot绿灯常亮, 显示屏无输出, 折腾了半天技术人员怀疑到了显示器上, 还真是这样😵 我连了三个显示器, 其中一个不插电, 后来插了电发现BIOS界面就显示在这个屏幕上. 看了一眼主板, 发现绿灯常亮, 也就是说绿灯常亮是在BIOS界面内的意思)
- 若为
- 进入BIOS, 搜索
Virtualization
并启动.
GUI运行:
sudo /etc/init.d/xrdp start
, 详见WSL2 Ubuntu GUI.
云服务器
You are here:
Home / Tutorial / How To Check Your IP Address in Ubuntu [Beginner’s
Tip] How To Check Your IP Address in Ubuntu [Beginner’s Tip]:
给出了详细的步骤和图示, 并且有对ufw
的简单使用教程.
记录在Linux系统Ubuntu 20.04中安装xrdp远程桌面连接RDP: 唯一看了之后才成功的😠, 重要的几点如下:
- 安装桌面后重启服务器.
- 避开Windows的
3389
端口, 比如文中使用了13389
端口
同时需要注意IP (以下使用0.0.0.0
代替) 的获取方式有
ipconfig
后Ethernet adapter 以太网
中的IPv4 Address
.- 一直点你的网络直到进入
Settings
, 查看Properties
中的IPv4 address
.
具体的过程如下:
1 | sudo apt update |
1 | sudo ufw status |
1 | sudo sed -i 's/3389/13389/g' /etc/xrdp/xrdp.ini |
之后又会遇到很多问题:
打开黑屏或者报错😡
1
2
3- Sorry, Ubuntu 20.04 has experienced an internal error.
- Send problem report to the developers?
If you notice further rpoblems, try restarting the computer.解决方法为How did I connect to Ubuntu 18.04 Xfce 4 desktop from Windows 7 via xrdp?, 和Ubuntu on Windows的配置类似.
打不开命令行👿, 报错
1
2- Failed to execute default Ternimal Emulator.
Input/output error.解决方法见Getting input/output error running anything on remote desktop, 具体为安装并选择
xfce4-terminal
.1
2sudo apt-get install xfce4-terminal
sudo update-alternatives --config x-terminal-emulator
常用命令
AMD64 or Intel x86 - how to check?
Ununtu | 含义 | 参见 |
---|---|---|
lsb-release -a | 查看Ubuntu版本 | |
sudo apt update && sudo apt -y upgrade | 更新 | |
clear | 清屏 | |
hostname -I | 查看IP | |
dpkg -s [package name] |grep '^Version:' | 查看包的版本 | How can I find the version number of an installed package via dpkg? |
wsl.exe –shutdown | 重启 | Rebooting Ubuntu on Windows without rebooting Windows? |
trash-empty | 清理垃圾 | Four Ways to Empty the Trash/Recycle Bin in Ubuntu |
explorer.exe . | 打开资源管理器 | How Do I Transfer Files from WSL to Windows - Linux Hint, How to open windows explorer from current working directory of WSL shell? |
... 2>&1 tee output.txt | 终端输出并存档 | What does 2>&1 | tee mean? |
grep -rnw '/path/to/somewhere/' -e 'pattern' | 查找内容 | How to find all files containing specific text (string) on Linux |
watch --interval 2 nvidia-smi | 周期执行命令 | watch - execute a program periodically, showing output fullscreen |
screen -S mc # 创建新的窗口 screen -ls # 查看运行列表 cd minecraft_server.1.15.2/ bash start-game.sh screen -X -S [session to kill] quit # 删除detached screen screen -r mc # 离线运行开始后,每次进入shell查看运行情况 |
后台运行进程 |
screen | tmux | |
---|---|---|
List | screen -ls | tmux ls / Ctrl+B+S (list-sessions), Esc |
New | screen -S [name] | tmux new -s [name] |
Detach | Ctrl+A+D (:detach) | Ctrl+B+D (:detach) |
Attach | screen -r [name] | tmux attach-session -t mysession / Ctrl+B+S, Enter |
Kill | screen -X -S [session to kill] quit | tmux kill-session -t mysession / Ctrl+B+X |
Reference | Screen
User’s Manual How To Use Linux Screen How To Set Up a Minecraft Server on Linux |
How
to Use tmux on Linux (and Why It’s Better Than Screen) Tmux Cheat Sheet & Quick Reference |
WSL | 含义 | 参见 |
---|---|---|
wsl –shutdown | 关闭 | |
wsl –list –online | 查看可用的发布版本 | Change the default Linux distribution installed - Microsoft Docs |
wsl –install -d |
下载某发布版本 | 🔼 |
wsl –list –verbose | 查看版本 | Check which version of WSL you are running - Microsoft Docs |
wsl –set-default-version <Version#> | 设置版本 | 🔼 |
wsl –setdefault |
设置名字 | 🔼 |
wsl -d |
运行 | 🔼 |
常用快捷键
Switch 切屏
Setting special keys as keyboard shortcuts: 详细介绍了快捷键的设置方式, 如下三条就能搞定
1
2
3gsettings get org.gnome.desktop.wm.keybindings switch-windows
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
gsettings reset org.gnome.desktop.wm.keybindings switch-windowsHow to disable/rebind Super+` in Ubuntu 17.10 (gnome)?: Lpgfmk给出了置为空的方式, 即设置为"[]"
How to Fix the Alt Tab in Remote Desktop (RDP) Sessions: 搞了半天都不行, 发现不是Ubuntu设置的锅, 远程控制在
Local Resources
的Keyboard
中把设置改一下就好了
Installation
App: Run Linux GUI apps on the Windows Subsystem for Linux (preview)
.deb
:
Install/Uninstall .deb files
.tar.tz
:
若有
./config
, 见How do I install a .tar.gz (or .tar.bz2) file?, 具体为:1
2
3
4tar xvzf PACKAGENAME.tar.gz
./configure
make
sudo make install若无, 见How to Install Python IDE PyCharm in Ubuntu and Other Linux Distributions, 具体为
1
2
3
4
5tar -xzf file.tar.gz
cd file
cd bin
chmod u+x file.sh
sh file.sh
.sh
:
1 | chmod u+x file.sh |
装anaconda的例子, 见[How To Install Anaconda on Ubuntu 18.04 Quickstart]
1 | cd /tmp |
google-research/football
Imported target "Boost::filesystem" includes non-existent path "/include" in its interface_include_directories #311
1 sudo ln -s /usr/include /include
czet88/OCT_Benders
fatal error: cplex.h: No such file or directory
具体报错如下:
1 | (base) carlos@DESKTOP-R4H3HQA:~/Github/OCT_Benders/src$ make |
原因就是没装CPLEX, 保姆教程见How to install CPLEX
on Ubuntu 20.4,
装好后把Makefile
中的CPLEXDIR = ../../../../encs/pkg/cplex-12.7.1/root/cplex
改为CPLEXDIR = /opt/ibm/ILOG/CPLEX_Studio221/cplex/
.
undefined reference to `dladdr'
具体报错如下:
1 | (base) carlos@DESKTOP-R4H3HQA:~/Github/OCT_Benders/src$ make |
解决方法见Compilation of
MAX_HS solver with IBM CPLEX,
具体为把Makefile
中的CLNFLAGS = -lcplex -lm -lpthread
改为CLNFLAGS = -lcplex -lm -lpthread -ldl
.
CPLEX
Installation of IBM ILOG CPLEX Optimization Studio on Linux Platforms
The installer for IBM ILOG CPLEX Optimization Studio is distributed as a
.bin
filecplex_studioXXX.linux-x86-64.bin
..bin
files are Linux self extracting files. Once you download the installer, follow the steps below:- Make sure the
.bin
file is executable. If necessary, change its permission using the chmod command from the directory where the .bin is located:chmod +x cplex_studioXXX.linux-x86-64.bin
- Enter the following command to start the installation process:
./cplex_studioXXX.linux-x86-64.bin
- Make sure the
Installing CPLEX Optimization Studio
How do I download CPLEX Optimization Studio?
视频中How to
install CPLEX on Ubuntu
20.4使用的安装文件为cplex_studio128.linux-x86.bin
应是版本12.8.0.0
的CPLEX;
查找之前的安装路径是/opt/ibm/ILOG/CPLEX_Studio_Community201/cplex
.
然而现在最新的版本是22.1.0
, 而且免费版本可能有性能限制, czet88/OCT_Benders的奇怪报错可能是上述原因导致的.
先卸载旧版本的CPLEX, 见[Uninstalling CPLEX Optimization Studio](https://www.ibm.com/docs/en/icos/12.9.0?topic=v1290-uninstalling-cplex-optimization-studio):
1 | sudo find / -name cplex |
安装时的一些有用信息:
Default Install Folder:
/opt/ibm/ILOG/CPLEX_Studio221
Python:
1
2
3
4
5If you want to use the CPLEX or CP Optimizer engines through their Python
APIs, you need to tell Python where to find them. To do so, enter the
following command into a terminal :
<<<<<<
python /opt/ibm/ILOG/CPLEX_Studio221/python/setup.py install
Anacodna & Pycharm
How to install Anaconda on WSL Windows 10 using Ubuntu Linux App
Configure
an interpreter using WSL | PyCharm - JetBrains:
注意一定要浏览到可执行文件python
,
若浏览到环境所在文件夹会报错process finish with exit code 0
Pygame
Pettingzoo的Pistonball渲染后报错pygame.error: windows not available
;
而pygame.init()
后报错
1 | ALSA lib confmisc.c:767:(parse_card) cannot find card '0' |
尚未解决, 见pygame tries to use alsa.
Troubling Shooting
黑屏问题
Ubuntu 18.04, Blank screen after login from Windows 10 #1358
Jarez95好答案, 但没看.
affansaied给出了两种GUI的配置方法, 我没试成功.
- (没有效果)
更改
startwm.sh
的内容, 见How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP.原文内容见Restore contents of /etc/xrdp/startwm.sh, 有两处需要修改:- wsl2/ubuntu_gui_youtube
- How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP
更改后内容如下:
ERROR: No matching distribution found for setuptools
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
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence
if test -r /etc/profile; then
. /etc/profile
fi
if test -r /etc/default/locale; then
. /etc/default/locale
test -z "${LANG+x}" || export LANG
test -z "${LANGUAGE+x}" || export LANGUAGE
test -z "${LC_ADDRESS+x}" || export LC_ADDRESS
test -z "${LC_ALL+x}" || export LC_ALL
test -z "${LC_COLLATE+x}" || export LC_COLLATE
test -z "${LC_CTYPE+x}" || export LC_CTYPE
test -z "${LC_IDENTIFICATION+x}" || export LC_IDENTIFICATION
test -z "${LC_MEASUREMENT+x}" || export LC_MEASUREMENT
test -z "${LC_MESSAGES+x}" || export LC_MESSAGES
test -z "${LC_MONETARY+x}" || export LC_MONETARY
test -z "${LC_NAME+x}" || export LC_NAME
test -z "${LC_NUMERIC+x}" || export LC_NUMERIC
test -z "${LC_PAPER+x}" || export LC_PAPER
test -z "${LC_TELEPHONE+x}" || export LC_TELEPHONE
test -z "${LC_TIME+x}" || export LC_TIME
test -z "${LOCPATH+x}" || export LOCPATH
fi
# [How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP]
# (https://www.youtube.com/watch?v=0PlG6vCOmjc)
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
. $HOME/.profile
if test -r /etc/profile; then
. /etc/profile
fi
# test -x /etc/X11/Xsession && exec /etc/X11/Xsession
# exec /bin/sh /etc/X11/Xsession
# xfce
startxfce4 终极办法, 重启xrdp.
1
sudo /etc/init.d/xrdp restart
貌似解决了的办法, 进入
Xfce Power Manager
→Display
,Security
把会熄屏的选项调成Never
.
XX is Already Running
这是黑屏后附带产生的问题, 可以通过Applications
→
System
→ Task Manager
观察其运行状况,
也可以直接用pkill -f XX
关闭, 见Pycharm is "Already
running" while trying to launch from ubuntu terminal中 furas的评论.
curl: (60) SSL certificate problem: unable to get local issuer certificate
今天又被Ubuntu整破防了, 起因是想搞点DCMST的实验, 比如这个malbarbo/dcmstp-instances,
这次我学乖了直接上Ubuntu, make
时跳标题错误, 我就看了
- SSL Certificate Verification
- curl: (60) SSL certificate problem: unable to get local issuer certificate
- How do you add a certificate authority (CA) to Ubuntu?, 这里写了个命名坑
我滴操作如下
- 下载cacert.pem
- 运行
mv /home/carlos/downloads/mycert.crt /usr/local/share/ca-certificates/
移动并进入 - 用
sudo mv ca-certificates.crt mycert.crt
将其命名为mycert.crt
- 上述目录运行
sudo mv ca-certificates.crt mycert.crt
- 命名环境变量
export CURL_CA_BUNDLE="/usr/local/share/ca-certificates/mycert.crt"
搞不定了, 歇了...
好了我最后靠把Makefile
里所有的curl
都加上-k
解决了,
见curl: (60) SSL certificate
problem: unable to get local issuer certificate.
(然而这个库的链接挂了, 搞了半天还是用不了, 我暴哭😢)
ls: command not found
环境变量烂了, 每次进terminal都报错.
1 | ubuntu@VM-4-5-ubuntu:~$ ls |
解决方法见Command 'ls' is available in '/bin/ls', 具体为
.bashrc'中加入
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"`..profile
中加入PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
.- 保证
/etc/environment
为PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
.
Microsoft Store Erro Code 0x80190001
无法连接应用商城, 设置 → 选择网络和Internet → 代理
,
关闭后恢复正常, 见微软商店,打开就显示无法加载该页面
代码0x80131500,这个情况怎么解决? - 甘蔗的回答 - 知乎.
wsl failed to fetch archive
1 | Need to get 217 kB/54.7 MB of archives. |
-
Apt-get update
and apt-get upgrade fail #4435: 试了关VPN,
在
/etc/resolv.conf
里写入nameserver 8.8.8.8
, 都没有用 -
E:
Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing? [duplicate]:
指出
sudo apt-get clean
后sudo apt-get update
但没有解决问题 -
Unable to fetch some archives
- recently modified ubuntu package sources [duplicate]:
指出可能是要换个镜像,
观察报错信息得知是
http://archive.ubuntu.com/ubuntu focal/universe
无法连接, 于是在Change Ubuntu 18.04 update source to mirror site in China找到了阿里云镜像, 即把archive.ubuntu.com
替换为mirrors.aliyun.com
, 随后在/etc/apt/sources.list
中的focal/universe
项把网址替换一下就好了!
占用空间过大
- How do I get back unused
disk space from ubuntu on wsl2?: 减少
ext4.vhdx
的空间 >>>>>>> dab0645bed89d54cfc87e455a69f2b83c991ce63