ubuntu18.04(vmware)更换国内源并更新
1.VMware虚拟机Ubuntu18.04无法复制粘贴
在VMware@ Workstation 17 Pro安装自带的VMware-tools后无法复制粘贴,也无法屏幕自适应.
解决办法:使用 open-vm-tools
在 Ubuntu 中使用以下命令:
sudo apt-get autoremove open-vm-tools -y
sudo apt install open-vm-tools open-vm-tools-desktop -y
然后重启系统:
sudo reboot
虚拟机中的Wayland存在不完备性
编辑文件
sudo gedit /etc/gdm3/custom.conf
找到如下行 删除前面#
#WaylandEnable=false
虚拟机无法复制粘贴或拖拽文件,绝大多数是 VMware Tools 没装全或没启动。
Linux 装 open-vm-tools + open-vm-tools-desktop
参考文章虚拟机无法与主机进行复制粘贴、拖拽文件
2.Ubuntu 18.04 软件源修改成国内源
备份原source.list文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑source.list更改内容
sudo nano /etc/apt/sources.list
删除原内容,添加以下内容
## 在文件sources.list开头加
## 国内源清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
## 国内源结束
修改完成后,保存文件,运行下面的更新命令(不用管警告)
sudo apt-get update
sudo apt-get upgrade
3.更新命令报错
出现以下描述
~$ sudo apt-get update
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease
(appstreamcli:2621): GLib-CRITICAL **: 15:38:49.380: g_variant_builder_end: assertion '!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL || g_variant_type_is_definite (GVSB(builder)->type)' failed
(appstreamcli:2621): GLib-CRITICAL **: 15:38:49.380: g_variant_new_variant: assertion 'value != NULL' failed
(appstreamcli:2621): GLib-ERROR **: 15:38:49.381: g_variant_new_parsed: 11-13:invalid GVariant format string
Trace/breakpoint trap (core dumped)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code
修复命令sudo apt-get install --reinstall libappstream4
~$ sudo apt-get install --reinstall libappstream4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libdumbnet1
Use 'sudo apt autoremove' to remove it.
The following packages will be upgraded:
libappstream4
1 upgraded, 0 newly installed, 0 to remove and 751 not upgraded.
Need to get 0 B/97.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 128702 files and directories currently installed.)
Preparing to unpack .../libappstream4_0.12.0-3ubuntu1_amd64.deb ...
Unpacking libappstream4:amd64 (0.12.0-3ubuntu1) over (0.12.0-3) ...
Setting up libappstream4:amd64 (0.12.0-3ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
再次运行更新命令sudo apt-get update
~$ sudo apt-get update
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease
Reading package lists... Done
修复完成.
参考链接sudo apt-get update 报错:(appstreamcli:78643): GLib-CRITICAL **: 19:28:01.338: g_variant_builder_end: