我是靠谱客的博主 感性鸡翅,最近开发中收集的这篇文章主要介绍ubuntu遇到的一些棘手问题的巧妙处理方法,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

我的linux系统是ubuntu18.04LTS发行版以及我的树莓派3B+ubuntu16.04的mate,测试都是有效的。


                                                                              转载标明出处       谢谢!!!


1    当使用dpkg -i 安装deb软件包时,提示依赖错误dpkg: dependency problems prevent configuration of

如果提示只有几个依赖关系缺失还是比较好解决的,可以手动一个个安装,当时如果很多的话,或者你像我一样懒的话,可以使用如下指令让系统自己寻找并安装这些依赖项:

sudo apt --fix-broken install

安装完成后,再继续安装之前中断的包。

2    sudo apt-get grade时候提示running python rtupdate hooks for python3.5...

但是sudo apt-get update是完全正常的。解决办法是:

查看报错信息,提示缺失的包,安装上他们,dpkg提示的依赖关系可以不用管。当这些提示缺失的包都安装完成后,python3可以正常启动,dpkg的依赖关系也可以正常configure

举个栗子:

这是sudo apt-get update,完全正常:

$ sudo apt-get update
Hit:1 http://fr.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://ppa.launchpad.net/fingerprint/fprint/ubuntu xenial InRelease
Hit:3 http://fr.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://fr.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:5 http://fr.archive.ubuntu.com/ubuntu xenial-proposed InRelease
Get:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [192 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [186 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [65.6 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [63.4 kB]
Fetched 609 kB in 3s (201 kB/s)
Reading package lists... Done

当执行sudo apt-get grade时候或者安装其他软件的时候提示如下:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
11 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up python3 (3.5.1-3) ...
running python rtupdate hooks for python3.5...
dpkg-query: package 'onboard' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
Traceback (most recent call last):
File "/usr/bin/py3clean", line 210, in <module>
main()
File "/usr/bin/py3clean", line 196, in main
pfiles = set(dpf.from_package(options.package))
File "/usr/share/python3/debpython/files.py", line 53, in from_package
raise Exception("cannot get content of %s" % package_name)
Exception: cannot get content of onboard
error running python rtupdate hook onboard
dpkg-query: package 'python3-uno' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
Traceback (most recent call last):
File "/usr/bin/py3clean", line 210, in <module>
main()
File "/usr/bin/py3clean", line 196, in main
pfiles = set(dpf.from_package(options.package))
File "/usr/share/python3/debpython/files.py", line 53, in from_package
raise Exception("cannot get content of %s" % package_name)
Exception: cannot get content of python3-uno
error running python rtupdate hook python3-uno
dpkg-query: package 'rhythmbox-plugins' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
Traceback (most recent call last):
File "/usr/bin/py3clean", line 210, in <module>
main()
File "/usr/bin/py3clean", line 196, in main
pfiles = set(dpf.from_package(options.package))
File "/usr/share/python3/debpython/files.py", line 53, in from_package
raise Exception("cannot get content of %s" % package_name)
Exception: cannot get content of rhythmbox-plugins
error running python rtupdate hook rhythmbox-plugins
dpkg-query: package 'rhythmbox' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
Traceback (most recent call last):
File "/usr/bin/py3clean", line 210, in <module>
main()
File "/usr/bin/py3clean", line 196, in main
pfiles = set(dpf.from_package(options.package))
File "/usr/share/python3/debpython/files.py", line 53, in from_package
raise Exception("cannot get content of %s" % package_name)
Exception: cannot get content of rhythmbox
error running python rtupdate hook rhythmbox
dpkg-query: package 'totem-plugins' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
Traceback (most recent call last):
File "/usr/bin/py3clean", line 210, in <module>
main()
File "/usr/bin/py3clean", line 196, in main
pfiles = set(dpf.from_package(options.package))
File "/usr/share/python3/debpython/files.py", line 53, in from_package
raise Exception("cannot get content of %s" % package_name)
Exception: cannot get content of totem-plugins
error running python rtupdate hook totem-plugins
dpkg-query: package 'ubuntu-drivers-common' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
Traceback (most recent call last):
File "/usr/bin/py3clean", line 210, in <module>
main()
File "/usr/bin/py3clean", line 196, in main
pfiles = set(dpf.from_package(options.package))
File "/usr/share/python3/debpython/files.py", line 53, in from_package
raise Exception("cannot get content of %s" % package_name)
Exception: cannot get content of ubuntu-drivers-common
error running python rtupdate hook ubuntu-drivers-common
dpkg: error processing package python3 (--configure):
subprocess installed post-installation script returned error exit status 4
dpkg: dependency problems prevent configuration of python3-gi:
python3-gi depends on python3 (<< 3.6); however:
Package python3 is not configured yet.
python3-gi depends on python3 (>= 3.5~); however:
Package python3 is not configured yet.
dpkg: error processing package python3-gi (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gir1.2-ibus-1.0:amd64:
gir1.2-ibus-1.0:amd64 depends on python3:any (>= 3.3.2-2~); however:
Package python3 is not configured yet.
dpkg: error processing package gir1.2-ibus-1.0:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
hplip-data depends on python3:any (>= 3.3.2-2~); however:
Package python3 is not configured yet.
dpkg: error processing package hplip-data (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ibus:
ibus depends on gir1.2-ibus-1.0 (= 1.5.11-1ubuntu2); however:
Package gir1.2-ibus-1.0:amd64 is not configured yet.
ibus depends on python3-gi; however:
Package python3-gi is not configured yet.
ibus depends on python3:any (>= 3.3.2-2~); however:
Package python3 is not configured yet.

如上面提示的错误信息,安装dpkg-query后面提示的缺少的包,在这个错误信息中,安装以下包就可以解决这个问题了,仔细对照错误信息,寻找这些包的名字

$ sudo apt-get install onboard rhythmbox-plugins rhythmbox python3-uno totem-plugins ubuntu-drivers-common

注意install后面的内容要根据你的系统的提示选择安装。

3    去除ppa中的陈旧或者404 Failed的源

通过下面指令找到Failed的ppa源

$ sudo apt-get update | grep Failed

通过下面指令删除:

$ sudo add-apt-repository --remove ppa:<name/your name>

4    Ubuntu解决每次都要提示输入密码的方法

讲当前用户设置成sudoer用户,即永久root用户,指令如下:

sudo vim -f /etc/sudoers.d/<user name>

<user name>是你的用户名

这个文件的内容如下:

<user name> ALL=(ALL:ALL) NOPASSWD:ALL

2018-10-11 update


5    给ubuntu配置wifi,再开机时自动连接(适用于树莓派3,3B+)

第一步,首先配置一下network

sudo vim /etc/network/interfaces

内容如下:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
#The loopback network interface
auto lo
iface lo inet loopback

在结尾添加如下内容:

auto wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B

第二步,在文件夹etc/wpa_supplicant/下创建wpa_supplicant.conf,默认是没有的

wpa_supplicant.conf中内容如下:

network={
ssid="wifi name"
# scan_ssid=1/0
# 设为1时开启wifi扫描,如果连接隐藏wifi,必须设为1。默认为0,不扫描。
psk="WIFI密码"
# priority=2
# 连接到这个wifi的优先级
}

接下来重启即可。

2018年10月19日 更新

6    ubuntu18.04锁屏时,dash to dock不自动隐藏,尤其是在美化之后出现这个问题

解决办法

6.1    移动ubuntu-dock@ubuntu.com文件夹到隐藏文件.local中(通过ctrl+H显示隐藏文件)

sudo mv /usr/share/gnome-shell/extensions/ubuntu-dock@ubuntu.com ~/.local/share/gnome-shell/extensions

6.2    更改文件拥有者,默认是root拥有,改成当前用户拥有

sudo chown -R $USER:$USER ~/.local/share/gnome-shell/extensions/ubuntu-dock@ubuntu.com

6.3    重启dash to dock即可

快捷键alt+r,然后输入r,回车即可

7    updating

最后

以上就是感性鸡翅为你收集整理的ubuntu遇到的一些棘手问题的巧妙处理方法的全部内容,希望文章能够帮你解决ubuntu遇到的一些棘手问题的巧妙处理方法所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部