Software Manager
linux mint中root用户下 software manager 应用无法打开,对应的命令(mintinstall)在终端下执行,提示:
The software manager should not be run as root. Please run it in user mode
最快的解决方法是拿到限制:
修改文件/usr/lib/linuxmint/mintinstall/mintinstall.py
将上述提示所在的判断拿掉,例如:
# Don't let mintinstall run as root
# if os.getuid() == 0:
# print("The software manager should not be run as root. Please run it in user mode.")
# sys.exit(1)
强制改为国内源
Linux mint默认会访问https://geoip.ubuntu.com/lookup,获取当前国家代码,
但是如果系统开了代理,那么会读取到错误的国家代码,无法直接改为国内源
通过修改:
/usr/lib/linuxmint/mintSources/mintSources.py
强制修改为中国,不再联网获取
def run(self, mirrors, config, is_base):
self.config = config
self.is_base = is_base
if self.is_base:
self.codename = self.config["general"]["base_codename"]
self.default_mirror = self.config["mirrors"]["base_default"]
else:
self.codename = self.config["general"]["codename"]
self.default_mirror = self.config["mirrors"]["default"]
# Try to find out where we're located...
# agold remove
# try:
# lookup = requests.get('https://geoip.ubuntu.com/lookup').text
# cur_country_code = re.search('<CountryCode>(.*)</CountryCode>', lookup).group(1)
# if cur_country_code == 'None': cur_country_code = None
# except Exception as detail:
# cur_country_code = None # no internet connection
# self.local_country_code = cur_country_code or os.environ.get('LANG', 'US').split('.')[0].split('_')[-1] # fallback to LANG location or 'US'
# brettzhang for CN
self.local_country_code = 'CN'
self.bordering_countries = []
self.network_neighbors = []
ubuntu 源列表:/usr/share/python-apt/templates/Ubuntu.mirrors
linux mint 源列表:/usr/share/mint-mirrors/linuxmint.list
root用户桌面无法显示图标
run ’nemo-desktop’ in terminal:
nemo-desktop cannot be run as root, please try again as a normal user
默认情况下nemo-deesktop应用无法在root用户下运行
通过man nemo查询:
man nemo
# result:
NOTE ON THE ROOT USER
Ordinarily, nemo and nemo-desktop treat being run as the root user as special, with certain restrictions and UI changes. This behavior can be bypassed via a gsettings key. You can use the following command to enable/disable
this override:
gsettings set org.nemo.preferences treat-root-as-normal true|false
因此,在终端执行
gsettings set org.nemo.preferences treat-root-as-normal true
root 用户系统升级失败
系统升级如果最后报此错误,改为执行sudo mintupgrade(即使在root用户下也要加sudo)
Traceback (most recent call last):
File "/usr/lib/linuxmint/mintupgrade/checks.py", line 94, in run
self.do_run()
File "/usr/lib/linuxmint/mintupgrade/checks.py", line 839, in do_run
subprocess.Popen(cmd)
File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1796, in _execute_child
self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not NoneType
设置默认终端
首先查看默认终端:
gsettings get org.cinnamon.desktop.default-applications.terminal exec
- 如果是
x-terminal-emulator, 那么可以通过以下命令更换终端:
update-alternatives --config x-terminal-emulator
如果上述列表中没有所需要的终端,需要安装到该可选项中:
update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /root/.local/bin/kitty 50
# non-root
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /home/agold/.local/kitty.app/bin/kitty 50
- 也可以直接通过
gsettings将终端改为想要的终端:
gsettings set org.cinnamon.desktop.default-applications.terminal exec kitty
kitty 无法输入中文的问题
修改文件/etc/environment,添加以下代码:
# for kitty
GLFW_IM_MODULE=ibus
由于 ctrl+alt+T快捷键打开终端时,启动的是x-terminal-emualtor此时,不会执行kitty.desktop.因此对应文件中添加环境变量无法生效,需要修改全局的环境变量。==此需要添加这一个环境变量即可==
以下方案已经过时
修改对应的desktop文件,例如/root/.local/share/applications/kitty.desktop:
只需要修改:
Exec=env GLFW_IM_MODULE=ibus /root/.local/kitty.app/bin/kitty
因为kitty只支持ibus输入法,如果系统使用的fcitx5,所有需要添加ibus项,使用fcitx5对应的ibus兼容程序