卡在 ubuntu 的 tty 中

卡在 ubuntu 的 tty 中

我正在使用 Ubuntu 18.04,不知道如何进入 tty1。笔记本电脑上的 Ctrl+Fn+Alt+F7 只显示空白屏幕。

这一切都始于我错误地卸载了 Python3。它删除了我的终端、Chrome 浏览器和其他 Ubuntu 软件包。我不知怎么下载了所有内容,但无法下载 Chrome。

当我输入时,sudo apt-get update它显示错误。

当我安装 Ubuntu 桌面时,它显示“无法纠正问题,您持有损坏的软件包”错误消息。

我不知道该如何恢复。

答案1

这一切都始于我错误地卸载python3

Python 3 是许多 Ubuntu 软件包及其操作的重要组成部分。它应该绝不被移除,因为那会破坏事物。

恢复的最佳选择可能是使用实时会话,备份您的个人文件,然后重新安装 - 无需格式化您的分区。因此,挂载 / 和所有其他分区,但不要勾选“格式化”。


为了分享,这是它将在正在运行的安装中删除的软件包列表:

$ sudo apt remove python3
[sudo] password for rinzwind: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  accountsservice apg apport-symptoms aptdaemon-data attr avahi-utils
  budgie-core cinnamon-l10n command-not-found-data cups-pk-helper dc diffstat
  distro-info-data file-roller fonts-lato gettext gir1.2-atspi-2.0
  gir1.2-budgie-1.0 gir1.2-gmenu-3.0 gir1.2-gst-plugins-base-1.0
  gir1.2-gstreamer-1.0 gir1.2-gtksource-4 gir1.2-ibus-1.0 gir1.2-notify-0.7
  gir1.2-packagekitglib-1.0 gir1.2-peas-1.0 gir1.2-polkit-1.0 gir1.2-rb-3.0
  gir1.2-snapd-1 gir1.2-vte-2.91 gir1.2-wnck-3.0 gist gkbd-capplet
  gnome-control-center-data gnome-control-center-faces gnome-power-manager
  gnome-screensaver gnome-session-bin gnome-session-common gnome-shell-common
  gnome-software-common gnome-startup-applications hddtemp hwdata ibus-gtk
  ibus-gtk3 ibverbs-providers intltool-debian inxi ippusbxd libappstream-glib8
  libapt-pkg-perl libarchive-zip-perl libasync-mergepoint-perl
  libbudgie-private0 libbudgietheme0 libcapture-tiny-perl libcephfs2
  libcgi-fast-perl libcgi-pm-perl libclass-accessor-perl libclone-perl
  libdigest-bubblebabble-perl libdmapsharing-3.0-2 libemail-valid-perl
  libexempi8 libexporter-tiny-perl libfcgi-perl libfuture-perl libgail-3-0
  libglu1-mesa libgnome-menu-3-0 libgnomekbd-common libgnomekbd8
  libgoa-backend-1.0-1 libgpod-common libgpod4 libgrilo-0.3-0 libgsound0
  libibus-1.0-5 libibverbs1 libimagequant0 libio-async-perl libio-pty-perl
  libio-string-perl libipc-run-perl libldb1 liblightdm-gobject-1-0
  liblirc-client0 liblist-moreutils-perl liblua5.2-0 libmtp-common
  libmtp-runtime libmtp9 libmutter-4-0 libnet-dns-perl libnet-dns-sec-perl
  libnet-domain-tld-perl libnet-ip-perl libnfs12 libnl-route-3-200
  libparse-debianchangelog-perl libpath-tiny-perl libperlio-gzip-perl
  libpython3-stdlib libqt5positioning5 libqt5printsupport5 libqt5qml5
  libqt5quick5 libqt5script5 libqt5sensors5 libqt5webchannel5 libqt5webkit5
  libqt5xml5 librados2 libraven0 libruby2.5 libsane-hpaio
  libsereal-decoder-perl libsereal-encoder-perl libsereal-perl libsgutils2-2
  libstruct-dumb-perl libtalloc2 libtest-fatal-perl libtest-refcount-perl
  libtevent0 libtext-levenshtein-perl libunicode-utf8-perl libva-wayland2
  libvulkan1 libwbclient0 libwhoopsie-preferences0 libxatracker2 libxcb-res0
  libxklavier16 libxml-simple-perl libxnvctrl0 libxvmc1 libyaml-libyaml-perl
  libyelp0 lightdm lintian mesa-vulkan-drivers mscompress mutter-common
  patchutils phantomjs pkg-config python-apt-common python3-minimal python3.7
  python3.7-minimal qt5-style-platform-gtk2 qt5-style-plugin-blackberry
  qt5-style-plugin-cleanlooks qt5-style-plugin-gtk2 qt5-style-plugin-motif
  qt5-style-plugin-plastique qt5-style-plugins rake rtmpdump ruby
  ruby-did-you-mean ruby-json ruby-minitest ruby-net-telnet ruby-power-assert
  ruby-test-unit ruby-xmlrpc ruby2.5 rubygems-integration samba-common
  session-migration squashfs-tools t1utils tdb-tools tree whoopsie-preferences
  x11-apps x11-session-utils xbitmaps xbrlapi xinit xinput xprintidle
  xserver-xorg-legacy xserver-xorg-video-all xserver-xorg-video-amdgpu
  xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-intel
  xserver-xorg-video-nouveau xserver-xorg-video-qxl xserver-xorg-video-radeon
  xserver-xorg-video-vesa xserver-xorg-video-vmware xul-ext-ubufox
  yaru-theme-gnome-shell yelp-xsl
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libaudio2 libept1.5.0 libgtk2-perl libpango-perl libxapian30 synaptic
Suggested packages:
  nas libgtk2-perl-doc xapian-tools dwww menu apt-xapian-index tasksel
  software-properties-gtk
The following packages will be REMOVED:
  apparmor apport apport-gtk aptdaemon budgie-desktop budgie-desktop-common
  budgie-desktop-environment budgie-dropby-applet
  budgie-keyboard-autoswitch-applet budgie-lightdm-theme
  budgie-lightdm-theme-base budgie-previews-applet budgie-rotation-lock-applet
  catfish cinnamon-desktop-data command-not-found firefox
  foomatic-db-compressed-ppds gedit gedit-common gnome-control-center
  gnome-menus gnome-mpv gnome-online-accounts gnome-software
  gnome-software-plugin-snap gnome-tweaks gnome-user-docs google-chrome-stable
  gvfs-backends hplip hplip-data ibus language-selector-common
  language-selector-gnome libcinnamon-desktop4 libmpv1 libsmbclient libxapp1
  lightdm-settings lsb-release menulibre mpv nemo nemo-data nemo-fileroller
  netplan.io networkd-dispatcher nvidia-prime nvidia-settings
  openprinting-ppds orca plymouth-theme-ubuntu-budgie-text
  plymouth-theme-ubuntu-text printer-driver-foo2zjs
  printer-driver-foo2zjs-common printer-driver-m2300w
  printer-driver-postscript-hp printer-driver-ptouch printer-driver-pxljr
  printer-driver-sag-gdi python3 python3-apport python3-apt python3-aptdaemon
  python3-aptdaemon.gtk3widgets python3-asn1crypto python3-blinker
  python3-brlapi python3-cairo python3-certifi python3-cffi-backend
  python3-chardet python3-commandnotfound python3-crypto python3-cryptography
  python3-cups python3-cupshelpers python3-dateutil python3-dbus
  python3-debconf python3-debian python3-defer python3-distro
  python3-distro-info python3-distupgrade python3-dnspython
  python3-entrypoints python3-gdbm python3-gi python3-gi-cairo
  python3-httplib2 python3-idna python3-jwt python3-keyring
  python3-launchpadlib python3-lazr.restfulclient python3-lazr.uri python3-ldb
  python3-louis python3-macaroonbakery python3-mako python3-markupsafe
  python3-nacl python3-netifaces python3-notify2 python3-oauthlib
  python3-olefile python3-pexpect python3-pil python3-pkg-resources
  python3-problem-report python3-protobuf python3-psutil python3-ptyprocess
  python3-pyatspi python3-pymacaroons python3-pyudev python3-pyxattr
  python3-renderpm python3-reportlab python3-reportlab-accel python3-requests
  python3-requests-unixsocket python3-rfc3339 python3-samba
  python3-secretstorage python3-setproctitle python3-simplejson python3-six
  python3-software-properties python3-speechd python3-systemd python3-talloc
  python3-tdb python3-tz python3-uno python3-update-manager python3-urllib3
  python3-wadllib python3-xapp python3-xdg python3-xkit python3-yaml
  rhythmbox-plugin-alternative-toolbar rhythmbox-plugins samba
  samba-common-bin samba-dsdb-modules samba-libs samba-vfs-modules
  screen-resolution-extra slick-greeter smplayer smplayer-l10n smplayer-themes
  snapd software-properties-common software-properties-gtk
  system-config-printer system-config-printer-common
  system-config-printer-udev ubuntu-advantage-tools ubuntu-budgie-desktop
  ubuntu-docs ubuntu-drivers-common ubuntu-minimal
  ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk ubuntu-standard
  ubuntu-system-service ufw unattended-upgrades update-manager
  update-manager-core update-notifier update-notifier-common xapps-common xorg
  xserver-xorg yelp youtube-dl
The following NEW packages will be installed:
  libaudio2 libept1.5.0 libgtk2-perl libpango-perl libxapian30 synaptic
0 upgraded, 6 newly installed, 182 to remove and 29 not upgraded.
Need to get 2122 kB of archives.
After this operation, 703 MB disk space will be freed.
Do you want to continue? [Y/n]  

答案2

首先,从您的主目录 ~/ 复制所有文件。如何在 tty4 终端中正确地将文件从硬盘复制到 USB 闪存驱动器?详细说明了步骤,让我们来讨论一下。顺便说一句,您可以从任何 tty 运行它,而不仅仅是 tty4。

上面链接的示例假设您将数据复制到闪存驱动器,但这不是唯一方法。您可以使用外部连接的 USB 硬盘驱动器或固态驱动器,或这两种类型的内部连接驱动器。重要的是避免覆盖源驱动器(可能是 /dev/sda ),但当您运行lsblk在步骤2中。

第 2 步可能已经找到目标驱动器的安装位置;那里的示例就是/media/me/4C45-110F。太好了;我们稍后会用到它。

如果您的 PC 在运行 lsblk 时没有发现目标驱动器自动挂载,那么我们将挂载它。它将出现在第 2 步的lsblk,只是没有挂载点,如果没有挂载。因此,我们通过步骤 3 的命令为其指定一个挂载点

udisksctl mount -b /dev/sdXY

在哪里X是分配给目标驱动器的字母,并且是该驱动器上的第一个分区。X可能会b但您需要通过查看其大小并将其与目标驱动器的已知大小进行匹配来仔细确认。可能会1,但可能2,根据 lsblk 显示的内容。

udisksctl 挂载将返回您要将文件复制到的驱动器分区的名称。记下它并仔细复制。在本例中,它是 /media/歇尔奇/A669-34EF歇尔奇将被您的用户名替换,并且A669-34EF将会随机不同。在下一行中,替换你找到的内容

rsync -av ~/ /media/xieerqi/A669-34EF/~ 

这与示例略有不同,但会捕获主目录中或下面的所有内容,或者~/

然后,完成后,步骤 5 将安全地卸载目标驱动器;请记住,它可能以不同的名称命名,具体取决于我们在步骤 2 中使用 lsblk 找到的内容。

复制这些文件后,请将目标驱动器带到另一台 Linux 计算机并查看其文件。

你得到了你期望的一切吗?太棒了!
你得到的比你预期的更多吗?你可以小心删除您不想保留的内容(或将其移至其他文件夹,这样更安全)。
如果您发现文件丢失,请在此处再次查看。

相关内容