如何修复最近 Ubuntu 软件升级后出现的问题

如何修复最近 Ubuntu 软件升级后出现的问题

我有 Ubuntu 20.04 LTS。几天前,我按照 Ubuntu 的建议安装了软件更新/升级。它警告我安装一些软件包,但安装完成了。所以我没有注意到这个警告是关于哪个软件包的。现在我遇到了以下问题,我不知道如何解决;

  1. Hypernet 问题:当我合上盖子时,笔记本电脑出现 Hypernet 问题。但不会恢复正常模式。所以我需要按住电源按钮关机,或者每天都需要正确关机。

  2. 我再也看不到亮度调节滑块了。

  3. 当我连接显示器时,它不显示双显示。

  4. 当我启动笔记本电脑时,屏幕上显示以下消息

    /dev/nvme0n1p4: Clearing orphaned inode 4860675 (uid=...
    /dev/nvme0n1p4: clean, 232285/7001424 files, 5575039/27951104 blocks
    

现在我以 Ubuntu 恢复模式重新启动笔记本电脑,然后恢复,它正常启动。我每次都需要这样做。

这些是我注意到的变化。我不确定是否还有其他问题。

更新

看完之后,我觉得问题与显卡有关。我遇到的另一个问题似乎也只与显卡有关。所以我尝试了以下方法

$ sudo ubuntu-drivers autoinstall

但这无法完成

$ sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode duplicity evince-common gstreamer1.0-gtk3 intel-microcode iucode-tool libbabeltrace1 libdazzle-1.0-0 libdjvulibre-text libdjvulibre21 libestr0 libfastjson4 libglu1-mesa libkpathsea6
  librsync2 libspectre1 libsynctex2 linux-headers-5.4.0-58 linux-hwe-5.8-headers-5.8.0-36 linux-image-generic-hwe-20.04 python3-bcrypt python3-fasteners python3-future python3-gpg python3-lockfile
  python3-louis python3-monotonic python3-netifaces python3-paramiko python3-pyatspi python3-speechd x11-apps x11-session-utils xbitmaps xinit
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460 libnvidia-decode-460 libnvidia-encode-460 libnvidia-extra-460 libnvidia-fbc1-460 libnvidia-gl-460 libnvidia-ifr1-460 libxnvctrl0
  linux-modules-nvidia-460-5.8.0-36-generic nvidia-compute-utils-460 nvidia-kernel-common-460 nvidia-kernel-source-460 nvidia-prime nvidia-settings nvidia-utils-460 screen-resolution-extra
  xserver-xorg-video-nvidia-460
Recommended packages:
  libnvidia-compute-460:i386 libnvidia-decode-460:i386 libnvidia-encode-460:i386 libnvidia-ifr1-460:i386 libnvidia-fbc1-460:i386 libnvidia-gl-460:i386
The following packages will be REMOVED:
  bind9-dnsutils command-not-found deja-dup eog evince gdb gdbserver gnome-calendar google-chrome-stable libc6-dbg libevdocument3-4 libevview3-3 libnetplan0 libreoffice-gnome libreoffice-gtk3
  libreoffice-math linux-generic-hwe-20.04 linux-headers-5.4.0-58-generic linux-headers-5.8.0-36-generic linux-headers-generic-hwe-20.04 linux-modules-nvidia-440-generic-hwe-20.04
  linux-modules-nvidia-450-generic-hwe-20.04 mesa-vulkan-drivers nautilus-dropbox netplan.io nvidia-kernel-common-450 orca python3-brlapi python3-commandnotfound python3-gdbm rsyslog simple-scan snapd
  spice-vdagent strace sudo thermald ubuntu-desktop ubuntu-desktop-minimal ubuntu-minimal ubuntu-standard vino wps-office xbrlapi xorg xvfb
The following NEW packages will be installed:
  libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460 libnvidia-decode-460 libnvidia-encode-460 libnvidia-extra-460 libnvidia-fbc1-460 libnvidia-gl-460 libnvidia-ifr1-460 libxnvctrl0
  linux-modules-nvidia-460-5.8.0-36-generic linux-modules-nvidia-460-generic-hwe-20.04-edge nvidia-compute-utils-460 nvidia-driver-460 nvidia-kernel-common-460 nvidia-kernel-source-460 nvidia-prime
  nvidia-settings nvidia-utils-460 screen-resolution-extra xserver-xorg-video-nvidia-460
0 upgraded, 21 newly installed, 46 to remove and 0 not upgraded.
Need to get 156 MB of archives.
After this operation, 1,263 MB disk space will be freed.
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-cfg1-460 amd64 460.32.03-0ubuntu0.20.04.1 [77.2 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-common-460 all 460.32.03-0ubuntu0.20.04.1 [9,168 B]
Get:3 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-compute-460 amd64 460.32.03-0ubuntu0.20.04.1 [21.8 MB]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-decode-460 amd64 460.32.03-0ubuntu0.20.04.1 [1,300 kB]                                                                 
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-encode-460 amd64 460.32.03-0ubuntu0.20.04.1 [39.6 kB]                                                                  
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-extra-460 amd64 460.32.03-0ubuntu0.20.04.1 [39.7 kB]                                                                   
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-fbc1-460 amd64 460.32.03-0ubuntu0.20.04.1 [45.4 kB]                                                                    
Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-gl-460 amd64 460.32.03-0ubuntu0.20.04.1 [80.6 MB]                                                                      
Get:9 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 libnvidia-ifr1-460 amd64 460.32.03-0ubuntu0.20.04.1 [67.6 kB]                                                                    
Get:10 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libxnvctrl0 amd64 440.64-0ubuntu1 [11.2 kB]                                                                                                   
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 linux-modules-nvidia-460-5.8.0-36-generic amd64 5.8.0-36.40~20.04.1 [24.1 MB]                                                   
Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 nvidia-kernel-common-460 amd64 460.32.03-0ubuntu0.20.04.1 [19.1 kB]                                                             
Get:13 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 linux-modules-nvidia-460-generic-hwe-20.04-edge amd64 5.8.0-36.40~20.04.1 [5,508 B]                                             
Get:14 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 nvidia-compute-utils-460 amd64 460.32.03-0ubuntu0.20.04.1 [105 kB]                                                              
Get:15 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 nvidia-kernel-source-460 amd64 460.32.03-0ubuntu0.20.04.1 [24.5 MB]                                                             
Get:16 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 nvidia-utils-460 amd64 460.32.03-0ubuntu0.20.04.1 [362 kB]                                                                      
Get:17 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 xserver-xorg-video-nvidia-460 amd64 460.32.03-0ubuntu0.20.04.1 [1,557 kB]                                                       
Get:18 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 nvidia-driver-460 amd64 460.32.03-0ubuntu0.20.04.1 [431 kB]                                                                     
Get:19 http://in.archive.ubuntu.com/ubuntu focal/main amd64 nvidia-prime all 0.8.14 [9,164 B]                                                                                                             
Get:20 http://in.archive.ubuntu.com/ubuntu focal/main amd64 screen-resolution-extra all 0.18build1 [4,456 B]                                                                                              
Get:21 http://in.archive.ubuntu.com/ubuntu focal/main amd64 nvidia-settings amd64 440.64-0ubuntu1 [963 kB]                                                                                                
Fetched 156 MB in 3min 1s (864 kB/s)                                                                                                                                                                      
Preconfiguring packages ...
(Reading database ... 210058 files and directories currently installed.)
Removing ubuntu-standard (1.450.2) ...
Removing bind9-dnsutils (1:9.16.1-0ubuntu2.4) ...
Removing command-not-found (20.04.4) ...
Removing deja-dup (40.7-0ubuntu1) ...
Removing eog (3.36.3-0ubuntu1) ...
Removing evince (3.36.7-0ubuntu1) ...
Removing gdb (9.2-0ubuntu1~20.04) ...
Removing gdbserver (9.2-0ubuntu1~20.04) ...
Removing gnome-calendar (3.36.2-0ubuntu1) ...
Removing google-chrome-stable (87.0.4280.141-1) ...
update-alternatives: using /usr/bin/firefox to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/firefox to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
Removing libc6-dbg:amd64 (2.31-0ubuntu9.1) ...
Removing libevview3-3:amd64 (3.36.7-0ubuntu1) ...
Removing libevdocument3-4:amd64 (3.36.7-0ubuntu1) ...
Removing ubuntu-minimal (1.450.2) ...
Removing netplan.io (0.100-0ubuntu4~20.04.3) ...
dpkg: warning: while removing netplan.io, directory '/etc/netplan' not empty so not removed
Removing libnetplan0:amd64 (0.100-0ubuntu4~20.04.3) ...
Removing libreoffice-gnome (1:6.4.6-0ubuntu0.20.04.1) ...
Removing libreoffice-gtk3 (1:6.4.6-0ubuntu0.20.04.1) ...
Removing libreoffice-math (1:6.4.6-0ubuntu0.20.04.1) ...
Removing linux-generic-hwe-20.04 (5.8.0.36.40~20.04.21) ...
Removing linux-headers-5.4.0-58-generic (5.4.0-58.64) ...
Removing linux-headers-generic-hwe-20.04 (5.8.0.36.40~20.04.21) ...
Removing linux-headers-5.8.0-36-generic (5.8.0-36.40~20.04.1) ...
Removing linux-modules-nvidia-440-generic-hwe-20.04 (5.8.0-36.40~20.04.1) ...
Removing linux-modules-nvidia-450-generic-hwe-20.04 (5.8.0-36.40~20.04.1) ...
Removing mesa-vulkan-drivers:amd64 (20.2.6-0ubuntu0.20.04.1) ...
Removing nautilus-dropbox (2019.02.14-1ubuntu1) ...
Dropbox isn't running!
Removing nvidia-kernel-common-450 (450.102.04-0ubuntu0.20.04.1) ...
update-initramfs: deferring update (trigger activated)
Removing orca (3.36.2-1ubuntu1~20.04.1) ...
Removing python3-brlapi:amd64 (6.0+dfsg-4ubuntu6) ...
Removing python3-commandnotfound (20.04.4) ...
Removing python3-gdbm:amd64 (3.8.5-1~20.04.1) ...
Removing rsyslog (8.2001.0-1ubuntu1.1) ...
/usr/sbin/policy-rc.d returned 101, not running 'stop dmesg.service rsyslog.service'
invoke-rc.d: policy-rc.d denied execution of stop.
Removing simple-scan (3.36.3-0ubuntu0.20.04.0) ...
Removing snapd (2.48+20.04) ...
Stopping snap.anbox.container-manager.service
Stopping unit snap.anbox.container-manager.service
Waiting until unit snap.anbox.container-manager.service is stopped [attempt 1]
snap.anbox.container-manager.service is stopped.
Stopping snap.canonical-livepatch.canonical-livepatchd.service
Stopping unit snap.canonical-livepatch.canonical-livepatchd.service
Waiting until unit snap.canonical-livepatch.canonical-livepatchd.service is stopped [attempt 1]
snap.canonical-livepatch.canonical-livepatchd.service is stopped.
Stopping snap.deluge-lukewh.deluge-web-service.service
Stopping unit snap.deluge-lukewh.deluge-web-service.service
Waiting until unit snap.deluge-lukewh.deluge-web-service.service is stopped [attempt 1]
snap.deluge-lukewh.deluge-web-service.service is stopped.
Stopping snap.deluge-lukewh.deluged-service.service
Stopping unit snap.deluge-lukewh.deluged-service.service
Waiting until unit snap.deluge-lukewh.deluged-service.service is stopped [attempt 1]
snap.deluge-lukewh.deluged-service.service is stopped.
/usr/sbin/policy-rc.d returned 101, not running 'stop snapd.apparmor.service snapd.autoimport.service snapd.core-fixup.service snapd.failure.service snapd.recovery-chooser-trigger.service snapd.seeded.service snapd.service snapd.snap-repair.service snapd.snap-repair.timer snapd.socket snapd.system-shutdown.service'
Removing ubuntu-desktop (1.450.2) ...
Removing ubuntu-desktop-minimal (1.450.2) ...
Removing spice-vdagent (0.19.0-2ubuntu0.2) ...
/usr/sbin/policy-rc.d returned 101, not running 'stop spice-vdagentd.service spice-vdagentd.socket'
invoke-rc.d: policy-rc.d denied execution of stop.
Removing strace (5.5-3ubuntu1) ...
Removing sudo (1.8.31-1ubuntu1.1) ...
You have asked that the sudo package be removed,
but no root password has been set.
Without sudo, you may not be able to gain administrative privileges.

If you would prefer to access the root account with su(1)
or by logging in directly,
you must set a root password with "sudo passwd".

If you have arranged other means to access the root account,
and you are sure this is what you want,
you may bypass this check by setting an environment variable 
(export SUDO_FORCE_REMOVE=yes).

Refusing to remove sudo.
dpkg: error processing package sudo (--remove):
 installed sudo package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 sudo
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新 2:在我使用 root 用户运行上述命令后,所有 4 个问题都解决了。但是,又出现了新的问题;

  1. sudo被删除了。所以我再次安装了它。
  2. 我无法运行任何应用程序。例如 Firefox。所以我重新安装了它,它运行正常。但现在我必须安装所有软件。有什么简单的方法吗?

答案1

当我检测到显卡问题时,我运行以下命令来解决问题;

$ sudo ubuntu-drivers autoinstall

它删除了 sudo 命令,我也无法运行已安装的软件。因此我重新安装snapd并执行了以下 3 条命令。

$ systemctl unmask snapd.service
$ systemctl enable snapd.service
$ systemctl start snapd.service

重启笔记本电脑后,一切都按预期运行。我不得不重新安装一些应用程序。但它们从临时目录中选择了配置。

相关内容