我是 ubuntu 新手,安装了 Ubuntu 22.04.2 LTS 64 位和 Gnome 版本 42.5。我在 Windows 旁边安装了 Linux。大学里的导师要求我使用 ubuntu 版本。
但是当我尝试使用 GUI 或终端安装某些东西时,问题开始出现。例如,我现在无法打开“Ubuntu 软件”,我昨天曾经打开过它,但它也没有正常显示,当我单击任何东西时,软件中心就崩溃了。
我在 ubuntu 上做过的事情:安装主题https://itsfoss.com/best-gtk-themes/. 安装 deepin-winehttps://github.com/zq1997/deepin-winehttps://github.com/zq1997/deepin-wine安装微信。
顺便说一句,因为我在中国大陆,所以我必须设置代理,我使用“手动”设置网络代理 -> HTTP 代理:127.0.0.1; 7890 /// HTTPs 代理:127.0.0.1; 7890。我不知道这是不是正确的方法,因为我之前没有经验。但是我现在可以访问所有国外网站,例如 youtube,而这些网站没有代理是无法访问的。我在以下试验中添加的清华服务器也是我的导师推荐的,但它不能正常工作。
我也无法在终端中安装东西。例如,如果我输入
sudo apt install wine
终端告诉我
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
wine : Depends: wine64 (>= 6.0.3~repack-1) but it is not going to be installed or
wine32 (>= 6.0.3~repack-1)
Depends: wine64 (< 6.0.3~repack-1.1~) but it is not going to be installed or
wine32 (< 6.0.3~repack-1.1~)
E: Unable to correct problems, you have held broken packages.
在软件和更新中,我启用了前四个选项,并从 ubuntu 提供的测试中表现最好的马来西亚服务器下载。而在第二部分抱歉,我没有合适的截图软件,因为我也无法安装
我可能做了一些不恰当的事情,意外删除了一些服务器。
如果我输入
$ cat /etc/apt/sources.list
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb http://my.mirrors.thegigabit.com/ubuntu/ jammy main universe restricted multiverse
我还根据老师的要求成功安装了以下软件包(使用 sudo):
apt-get install build-essential # build-essential packages, include binary utilities, gcc, make, and so on
apt-get install man # on-line reference manual
apt-get install gcc-doc # on-line reference manual for gcc
apt-get install gdb # GNU debugger
apt-get install git # revision control system
apt-get install libreadline-dev # a library used later
apt-get install libsdl2-dev # a library used later
apt-get install llvm llvm-dev # llvm project, which contains libraries used later
apt-get install llvm-11 llvm-11-dev # only for ubuntu20.04
我尝试过的其他帖子提供的解决方案:
~$ sudo apt-get --purge --reinstall install software-center
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package software-center is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'software-center' has no installation candidate
$ sudo apt clean
$ sudo apt update && sudo apt upgrade
Hit:1 http://my.mirrors.thegigabit.com/ubuntu jammy InRelease
Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
libavcodec-extra libavdevice58 ffmpeg libpostproc55 libavcodec-extra58
libavutil56 libswscale5 libswresample3 libavformat58 libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo apt autoremove gnome-software && sudo apt install gnome-software
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
gnome-software gnome-software-common gnome-software-plugin-snap
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 3,251 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 241694 files and directories currently installed.)
Removing gnome-software-plugin-snap (41.5-2) ...
Removing gnome-software (41.5-2) ...
Removing gnome-software-common (41.5-2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libglib2.0-0:amd64 (2.72.1-1) ...
Processing triggers for libglib2.0-0:i386 (2.72.1-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
gnome-software-common gnome-software-plugin-snap
Suggested packages:
gnome-software-plugin-flatpak
The following NEW packages will be installed:
gnome-software gnome-software-common gnome-software-plugin-snap
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 655 kB of archives.
After this operation, 3,251 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 gnome-software-common all 41.5-2 [20.3 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 gnome-software amd64 41.5-2 [606 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 gnome-software-plugin-snap amd64 41.5-2 [28.8 kB]
Fetched 655 kB in 2s (305 kB/s)
Selecting previously unselected package gnome-software-common.
(Reading database ... 241633 files and directories currently installed.)
Preparing to unpack .../gnome-software-common_41.5-2_all.deb ...
Unpacking gnome-software-common (41.5-2) ...
Selecting previously unselected package gnome-software.
Preparing to unpack .../gnome-software_41.5-2_amd64.deb ...
Unpacking gnome-software (41.5-2) ...
Selecting previously unselected package gnome-software-plugin-snap.
Preparing to unpack .../gnome-software-plugin-snap_41.5-2_amd64.deb ...
Unpacking gnome-software-plugin-snap (41.5-2) ...
Setting up gnome-software-common (41.5-2) ...
Setting up gnome-software (41.5-2) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libglib2.0-0:i386 (2.72.1-1) ...
Processing triggers for libglib2.0-0:amd64 (2.72.1-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Setting up gnome-software-plugin-snap (41.5-2) ...
$ sudo snap remove snap-store
snap-store removed
$ sudo snap install snap-store
error: cannot install "snap-store": Post
https://api.snapcraft.io/v2/snaps/refresh: parse 127.0.0.1:7890: first
path segment in URL cannot contain colon
执行此操作后,我发现之前卸载的“软件”(而不是 Ubuntu 软件)又出现了。但它也无法正常运行。
索引页看起来不错,但当我点击目录中的任意项目时,就会出现错误。之后,如果我点击任何软件,它就会崩溃。
$ gnome-software
04:13:02:0302 GLib-GIO g_dbus_proxy_new: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
04:13:04:0191 Gs not handling error failed for action get-popular: status-code=500 kind=(null) message=Get https://api.snapcraft.io/v2/snaps/find?architecture=amd64&category=featured&confinement=strict%2Cclassic&fields=base%2Cconfinement%2Clinks%2Ccontact%2Cdescription%2Cdownload%2Clicense%2Cprices%2Cprivate%2Cpublisher%2Crevision%2Csummary%2Ctitle%2Ctype%2Cversion%2Cwebsite%2Cstore-url%2Cmedia%2Ccommon-ids%2Cchannel: parse 127.0.0.1:7890: first path segment in URL cannot contain colon
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Builder.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Calculator.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.clocks.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Dictionary.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Documents.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Evince/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.gedit.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Maps.desktop/* to plugin cache
04:13:04:0191 Gs adding wildcard app */*/*/org.gnome.Weather/* to plugin cache
04:13:04:0192 Gs Only 0 apps for recent list, hiding
04:13:04:0980 Gs Only 7 apps for popular list, hiding
04:13:05:0148 GsPluginSnap Failed to find refreshable snaps: status-code=500 kind=(null) message=cannot list updates: Post https://api.snapcraft.io/v2/snaps/refresh: parse 127.0.0.1:7890: first path segment in URL cannot contain colon
04:13:05:0193 Gtk Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
我也尝试了这两篇文章中包含的其他方法:https://www.maketecheasier.com/ubuntu-software-center-not-working-fixes/ https://itslinuxfoss.com/ubuntu-software-center-not-loading/ 我确信它们对我都不起作用。这应该是我的代理或网络设置的问题。实际上,当我第一次安装 ubuntu 时,我无法访问 ubuntu 所附带的“软件”,安装完成后,它告诉我我可以访问软件中心中的许多有用软件,但我当时无法打开它。
请帮帮我,这对我很重要!非常感谢。如果需要提供任何其他信息,请告诉我。
答案1
更改我的代理端口并相应地调整 Linux 中的代理设置(而不是默认的 7890)。我不知道其中的机制,中国以外的人不必关心这个问题。如果您知道原因或如何防止此类错误,请告诉我!
重置我的存储库设置。在对存储库定义有所了解之前,我无意中更改了它,结果发现这是主要问题之一。我还设置了代理并选择了 Ubuntu 建议的代理,结果发现它不可靠。我切换到“规则”模式并选择了中国大陆的一个,一切顺利。
如果您遇到同样的问题,您可以先使代理正常工作并确保您的存储库设置正确。