前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >腾讯云Ubuntu Server 16.04.1 LTS升级系统到Ubuntu 18.04.1 LTS

腾讯云Ubuntu Server 16.04.1 LTS升级系统到Ubuntu 18.04.1 LTS

原创
作者头像
用户1196360
修改2018-11-26 11:32:15
7.9K0
修改2018-11-26 11:32:15
举报
文章被收录于专栏:Ubuntu运维Ubuntu运维
代码语言:text
复制
说明:系统为腾讯云Ubuntu Server 16.04.1 LTS
目的:演示系统由Ubuntu Server 16.04.1升级到Ubuntu Server 18.0过程中遇到的问题与解决方式(非完美升级,仅供参考)。
注意:非完美升级,仅供参考
  1,升级系统过程中配置openssh-server的确认提示:
     如选择第二项(保持当前版本),会出现SSH无法连接的问题(SSH服务启动错误),需要用VNS连接登录,并重装openssh-server;
     如选择第一项(安装新版本),则系统升级重启后,SSH可正常连接登录系统。
  2,升级后apt update会报错 【临时解决方案】:
      需要修改DNS(/etc/resolv.conf),可在升级前查看并备份此文件,升级后还原。
      系统升级后/etc/resolv.conf文件修改前:
      nameserver 127.0.0.53
      系统升级后/etc/resolv.conf文件修改后(可在升级前查看并备份此文件,升级后还原):
      nameserver 10.112.65.31
      nameserver 10.112.65.32
  * /etc/resolv.conf【不建议修改:This file is managed by man:systemd-resolved(8). Do not edit】

1、SSH 登录Ubuntu 16.04.1 LTS

代码语言:javascript
复制
ubuntu@VM-000-000-ubuntu:~$ ssh ubuntu@000.00.00.00
ubuntu@000.00.00.00's password:
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-130-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
New release '18.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Fri Nov 23 21:09:29 2018 from 000.000.000.00

2、更新软件

代码语言:javascript
复制
ubuntu@VM-000-000-ubuntu:~$ sudo apt update && sudo apt upgrade
Hit:1 http://mirrors.tencentyun.com/ubuntu xenial InRelease
Hit:2 http://mirrors.tencentyun.com/ubuntu xenial-security InRelease
Hit:3 http://mirrors.tencentyun.com/ubuntu xenial-updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
221 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  libdrm-common libsnappy1v5 libxmlsec1 libxmlsec1-openssl libxslt1.1 linux-headers-4.4.0-139
  linux-headers-4.4.0-139-generic linux-image-4.4.0-139-generic linux-image-extra-4.4.0-139-generic
  ubuntu-advantage-tools
The following packages will be upgraded:
  accountsservice amd64-microcode apparmor apt apt-transport-https apt-utils base-files bind9-host binutils bsdutils
  btrfs-tools cloud-guest-utils cloud-initramfs-copymods cloud-initramfs-dyn-netconf console-setup console-setup-linux
  coreutils cpp-5 crash cryptsetup cryptsetup-bin curl dbus distro-info-data dns-root-data dnsmasq-base dnsutils dpkg
  dpkg-dev friendly-recovery fuse g++-5 gcc-5 gcc-5-base gettext-base git git-man gnupg gpgv grub-common
  grub-legacy-ec2 grub-pc grub-pc-bin grub2-common hdparm ifupdown init init-system-helpers initramfs-tools
  initramfs-tools-bin initramfs-tools-core intel-microcode iproute2 isc-dhcp-common kbd kdump-tools kexec-tools
  keyboard-configuration klibc-utils kmod krb5-locales language-selector-common less libaccountsservice0
  libapparmor-perl libapparmor1 libapt-inst2.0 libapt-pkg5.0 libasan2 libasprintf0v5 libatomic1 libaudit-common
  libaudit1 libbind9-140 libblkid1 libc-bin libcc1-0 libcilkrts5 libcryptsetup4 libcurl3-gnutls libdbus-1-3
  libdns-export162 libdns162 libdpkg-perl libdrm2 libfdisk1 libfuse2 libgcc-5-dev libglib2.0-0 libglib2.0-data
  libgnutls-openssl27 libgnutls30 libgomp1 libgssapi-krb5-2 libisc-export160 libisc160 libisccc140 libisccfg140
  libitm1 libk5crypto3 libklibc libkmod2 libkrb5-3 libkrb5support0 libldap-2.4-2 liblsan0 liblwres141 libmount1
  libmpx0 libmspack0 libnuma1 libp11-kit0 libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g
  libparted2 libpci3 libplymouth4 libpng12-0 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib
  libquadmath0 libsasl2-2 libsasl2-modules libsasl2-modules-db libseccomp2 libslang2 libsmartcols1 libstdc++-5-dev
  libstdc++6 libsystemd0 libtsan0 libubsan0 libudev1 libuuid1 libx11-6 libx11-data libxml2 linux-base linux-crashdump
  linux-firmware linux-generic linux-headers-generic linux-image-generic linux-libc-dev locales logrotate lshw lxcfs
  lxd lxd-client makedev makedumpfile mdadm mount multiarch-support nano ntp open-iscsi open-vm-tools openssh-client
  openssh-server openssh-sftp-server openssl os-prober overlayroot parted pciutils plymouth plymouth-theme-ubuntu-text
  policykit-1 python python-apt-common python-cryptography python-minimal python-openssl python-requests
  python-urllib3 python2.7 python2.7-minimal python3-apt python3-problem-report python3-requests
  python3-software-properties python3-update-manager python3-urllib3 python3.5 python3.5-minimal resolvconf
  shared-mime-info snapd software-properties-common sosreport squashfs-tools systemd systemd-sysv tzdata
  ubuntu-core-launcher ubuntu-minimal ubuntu-server ubuntu-standard udev unattended-upgrades update-manager-core
  update-notifier-common util-linux uuid-runtime vlan wireless-regdb xdg-user-dirs xfsprogs zlib1g
221 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 230 MB of archives.
After this operation, 360 MB of additional disk space will be used.
Do you want to continue? [Y/n]y
Get:1 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 base-files amd64 9.4ubuntu4.7 [65.9 kB]
Get:2 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 bsdutils amd64 1:2.27.1-6ubuntu3.6 [51.2 kB]
Get:3 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 coreutils amd64 8.25-2ubuntu3~16.04 [1,174 kB]
...
...
...
Get:228 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 xfsprogs amd64 4.3.0+nmu1ubuntu1.1 [597 kB]
Get:229 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 ubuntu-server amd64 1.361.2 [2,560 B]
Get:230 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 unattended-upgrades all 0.90ubuntu0.9 [32.3 kB]
Get:231 http://mirrors.tencentyun.com/ubuntu xenial-updates/main amd64 wireless-regdb all 2018.05.09-0ubuntu1~16.04.1 [11.7 kB]
Fetched 230 MB in 5s (40.1 MB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 66624 files and directories currently installed.)
Preparing to unpack .../base-files_9.4ubuntu4.7_amd64.deb ...
Unpacking base-files (9.4ubuntu4.7) over (9.4ubuntu4.2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for plymouth-theme-ubuntu-text (0.9.2-3ubuntu13.1) ...
...
...
...
Installing new version of config file /etc/console-setup/compose.ISO-8859-4.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-7.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-9.inc ...
Setting up console-setup (1.108ubuntu15.4) ...
update-initramfs: deferring update (trigger activated)
Setting up ubuntu-minimal (1.361.2) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for resolvconf (1.78ubuntu6) ...
Processing triggers for initramfs-tools (0.122ubuntu8.13) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-139-generic
cryptsetup: WARNING: failed to detect canonical device of /dev/vda1
cryptsetup: WARNING: could not determine root device from /etc/fstab
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
更新过程确的认提示1
更新过程确的认提示1
更新过程的确认提示2
更新过程的确认提示2
更新过程的确认提示3
更新过程的确认提示3
代码语言:shell
复制
ubuntu@VM-000-000-ubuntu:~$ sudo apt dist-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.

3、升级系统

代码语言:shell
复制
ubuntu@VM-000-000-ubuntu:~$ sudo do-release-upgrade
Checking for a new Ubuntu release
...
...
...
Reading cache

Checking package manager

Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?

Continue [yN]y
Starting additional sshd

To make recovery in case of failure easier, an additional sshd will
be started on port '1022'. If anything goes wrong with the running
ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As
this is potentially dangerous it's not done automatically. You can
open the port with e.g.:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'

To continue please press [ENTER]

Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://mirrors.tencentyun.com/ubuntu xenial InRelease
Hit http://mirrors.tencentyun.com/ubuntu xenial-security InRelease
Hit http://mirrors.tencentyun.com/ubuntu xenial-updates InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done

Updating repository information

No valid mirror found

While scanning your repository information no mirror entry for the
upgrade was found. This can happen if you run an internal mirror or
if the mirror information is out of date.

Do you want to rewrite your 'sources.list' file anyway? If you choose
'Yes' here it will update all 'xenial' to 'bionic' entries.
If you select 'No' the upgrade will cancel.

Continue [yN]y
...
...
...
Get:45 http://mirrors.tencentyun.com/ubuntu bionic-updates/multiverse amd64 Packages [5,692 B]
Get:46 http://mirrors.tencentyun.com/ubuntu bionic-updates/multiverse i386 Packages [5,844 B]
Get:47 http://mirrors.tencentyun.com/ubuntu bionic-updates/multiverse Translation-en [3,176 B]
Fetched 38.9 MB in 6s (6,299 kB/s)

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done

Calculating the changes

Calculating the changes

Do you want to start the upgrade?


3 installed packages are no longer supported by Canonical. You can
still get support from the community.

3 packages are going to be removed. 127 new packages are going to be
installed. 476 packages are going to be upgraded.

You have to download a total of 346 M. This download will take about
54 seconds with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

 Continue [yN]  Details [d]y
...
...
...
Get:601 http://mirrors.tencentyun.com/ubuntu bionic-updates/main amd64 ssh-import-id all 5.7-0ubuntu1.1 [10.9 kB]
Get:602 http://mirrors.tencentyun.com/ubuntu bionic-updates/main amd64 vlan amd64 1.9-3.2ubuntu6 [30.7 kB]
Get:603 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 zerofree amd64 1.0.4-1 [8,112 B]
Fetched 346 MB in 6s (22.6 MB/s)

Upgrading
Fetched 0 B in 0s (0 B/s)
  MarkInstall libc6 [ amd64 ] < 2.23-0ubuntu10 -> 2.27-3ubuntu1 > ( libs ) FU=1
    MarkInstall locales [ amd64 ] < 2.23-0ubuntu10 -> 2.27-3ubuntu1 > ( libs ) FU=0
    Installing libc-bin as Depends of locales
      MarkInstall libc-bin [ amd64 ] < 2.23-0ubuntu10 -> 2.27-3ubuntu1 > ( libs ) FU=0
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done

Upgrading
Fetched 0 B in 0s (0 B/s)
Preconfiguring packages ...
Preconfiguring packages ...
Preconfiguring packages ...
Preconfiguring packages ...
(Reading database ... 99266 files and directories currently installed.)
Preparing to unpack .../libc-dev-bin_2.27-3ubuntu1_amd64.deb ...
Unpacking libc-dev-bin (2.27-3ubuntu1) over (2.23-0ubuntu10) ...

Progress: [  7%]
Preparing to unpack .../libc6-dev_2.27-3ubuntu1_amd64.deb ...

Progress: [ 15%]
Unpacking libc6-dev:amd64 (2.27-3ubuntu1) over (2.23-0ubuntu10) ...

Progress: [ 23%]
Preparing to unpack .../locales_2.27-3ubuntu1_all.deb ...
Unpacking locales (2.27-3ubuntu1) over (2.23-0ubuntu10) ...
...
...
...
Calculating the changes

Calculating the changes

Upgrading
Fetched 0 B in 0s (0 B/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
Extracting templates from packages: 100%
Preconfiguring packages ...
Extracting templates from packages: 100%
Preconfiguring packages ...
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 99341 files and directories currently installed.)
Preparing to unpack .../base-files_10.1ubuntu2.3_amd64.deb ...
Unpacking base-files (10.1ubuntu2.3) over (9.4ubuntu4.7) ...
Processing triggers for plymouth-theme-ubuntu-text (0.9.2-3ubuntu13.5) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for initramfs-tools (0.122ubuntu8.13) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-139-generic
cryptsetup: WARNING: failed to detect canonical device of /dev/vda1
cryptsetup: WARNING: could not determine root device from /etc/fstab
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
Setting up base-files (10.1ubuntu2.3) ...
Installing new version of config file /etc/debian_version ...
Installing new version of config file /etc/issue ...
Installing new version of config file /etc/issue.net ...
Installing new version of config file /etc/lsb-release ...
Updating /etc/profile to current default.
motd-news.service is a disabled or a static unit, not starting it.
Processing triggers for plymouth-theme-ubuntu-text (0.9.2-3ubuntu13.5) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.122ubuntu8.13) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-139-generic
cryptsetup: WARNING: failed to detect canonical device of /dev/vda1
cryptsetup: WARNING: could not determine root device from /etc/fstab
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
(Reading database ... 99348 files and directories currently installed.)
Preparing to unpack .../debianutils_4.8.4_amd64.deb ...
Unpacking debianutils (4.8.4) over (4.7) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up debianutils (4.8.4) ...
(Reading database ... 99348 files and directories currently installed.)
Preparing to unpack .../bash_4.4.18-2ubuntu1_amd64.deb ...
Unpacking bash (4.4.18-2ubuntu1) over (4.3-14ubuntu1.2) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up bash (4.4.18-2ubuntu1) ...

Configuration file '/etc/bash.bashrc'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** bash.bashrc (Y/I/N/O/D/Z) [default=N] ?N
...
...
...
Installing new version of config file /etc/pam.d/systemd-user ...
Installing new version of config file /etc/systemd/journald.conf ...
Installing new version of config file /etc/systemd/logind.conf ...
Installing new version of config file /etc/systemd/resolved.conf ...

Configuration file '/etc/systemd/system.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** system.conf (Y/I/N/O/D/Z) [default=N] ?N
...
...
...
Setting up procps (2:3.3.12-3ubuntu1.1) ...
Installing new version of config file /etc/init.d/procps ...

Configuration file '/etc/sysctl.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** sysctl.conf (Y/I/N/O/D/Z) [default=N] ?N
...
...
...
升级系统过程中的确认提示1
升级系统过程中的确认提示1
代码语言:javascript
复制
...
...
...
Installing new version of config file /etc/dhcp/dhclient-exit-hooks.d/ntp ...
Installing new version of config file /etc/init.d/ntp ...

Configuration file '/etc/ntp.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** ntp.conf (Y/I/N/O/D/Z) [default=N] ?N
...
...
...
升级系统过程中的确认提示:配置SSH,选择第一项(安装新版本:升级后可正常SSH登录,选第二项(保留原版本:升级后SSH无法登录,需VNC登录)。
升级系统过程中的确认提示:配置SSH,选择第一项(安装新版本:升级后可正常SSH登录,选第二项(保留原版本:升级后SSH无法登录,需VNC登录)。
代码语言:javascript
复制
...
...
...
Installing new version of config file /etc/apparmor.d/usr.sbin.rsyslogd ...
Installing new version of config file /etc/init.d/rsyslog ...

Configuration file '/etc/logrotate.d/rsyslog'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** rsyslog (Y/I/N/O/D/Z) [default=N] ?N
...
...
...
代码语言:javascript
复制
...
...
...
Setting up libsnappy1v5:amd64 (1.1.7-1) ...
Setting up resolvconf (1.79ubuntu10) ...

Configuration file '/etc/resolvconf/resolv.conf.d/head'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** head (Y/I/N/O/D/Z) [default=N] ?N
...
...
...
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-39-generic
Found initrd image: /boot/initrd.img-4.15.0-39-generic
Found linux image: /boot/vmlinuz-4.4.0-139-generic
Found initrd image: /boot/initrd.img-4.4.0-139-generic
Found linux image: /boot/vmlinuz-4.4.0-130-generic
Found initrd image: /boot/initrd.img-4.4.0-130-generic
done
Processing triggers for sgml-base (1.29) ...
Processing triggers for resolvconf (1.79ubuntu10) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done

Searching for obsolete software
Reading state information... Done

Remove obsolete packages?


39 packages are going to be removed.

 Continue [yN]  Details [d]y
 ...
 ...
 ...
Purging configuration files for linux-image-4.4.0-139-generic (4.4.0-139.165) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-139-generic /boot/vmlinuz-4.4.0-139-generic
run-parts: executing /etc/kernel/postrm.d/kdump-tools 4.4.0-139-generic /boot/vmlinuz-4.4.0-139-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-139-generic /boot/vmlinuz-4.4.0-139-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-139-generic /boot/vmlinuz-4.4.0-139-generic
Removing python-ndg-httpsclient (0.4.4-1) ...
Removing python-pyasn1 (0.4.2-3) ...
Removing tcpd (7.6.q-27) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN]y

4、SSH登录系统

如连接失败,多尝试几次。

代码语言:javascript
复制
ubuntu@VM-000-000-ubuntu:~$ ssh ubuntu@000.00.00.00
The authenticity of host '000.00.00.00 (000.00.00.00)' can't be established.
ECDSA key fingerprint is SHA256:0QC1fWjbAjJ1prAQLGAgUGYLvaDAZ88MQuYO0kbdxxw.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/ubuntu/.ssh/known_hosts).
Connection closed by 000.00.00.00 port 22
ubuntu@000.000.00.00's password:
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-39-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Fri Nov 23 22:21:28 CST 2018

  System load:  0.03              Processes:           83
  Usage of /:   5.1% of 49.09GB   Users logged in:     0
  Memory usage: 6%                IP address for eth0: 00.000.000.000
  Swap usage:   0%

Last login: Fri Nov 23 21:09:56 2018 from 000.000.00.00

5、修改DNS【临时方案】

代码语言:javascript
复制
ubuntu@VM-000-000-ubuntu:~$ sudo apt update
Err:1 http://mirrors.tencentyun.com/ubuntu bionic InRelease
  Temporary failure resolving 'mirrors.tencentyun.com'
Err:2 http://mirrors.tencentyun.com/ubuntu bionic-security InRelease
  Temporary failure resolving 'mirrors.tencentyun.com'
Err:3 http://mirrors.tencentyun.com/ubuntu bionic-updates InRelease
  Temporary failure resolving 'mirrors.tencentyun.com'
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://mirrors.tencentyun.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'mirrors.tencentyun.com'
W: Failed to fetch http://mirrors.tencentyun.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'mirrors.tencentyun.com'
W: Failed to fetch http://mirrors.tencentyun.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'mirrors.tencentyun.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

ubuntu@VM-000-000-ubuntu:~$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (eth0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
代码语言:shell
复制
sudo vi /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
代码语言:text
复制
#nameserver 127.0.0.53
nameserver 10.112.65.31
nameserver 10.112.65.32
代码语言:javascript
复制
ubuntu@VM-000-000-ubuntu:~$ sudo apt update
Hit:1 http://mirrors.tencentyun.com/ubuntu bionic InRelease
Hit:2 http://mirrors.tencentyun.com/ubuntu bionic-security InRelease
Hit:3 http://mirrors.tencentyun.com/ubuntu bionic-updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

* 此修改方案为临时方案(/etc/resolv.conf文件系统重启后会自动还原),最终方案待定,下方为腾讯云原装Ubuntu 18.04.1 LTS系统镜像 systemd-resolve --status执行结果,仅供参考。

代码语言:shell
复制
ubuntu@VM-000-000-ubuntu:~$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 3 (eth0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.112.65.31
                      10.112.65.32

其他:SSH无法连接服务器,VNC连接

注:如升级系统系统重启后SSH无法连接(等待比较长时间后),需通过VNC登录到服务器,卸载重装SSH。

其他:重装SSH

代码语言:shell
复制
sudo apt update && sudo apt upgrade
sudo apt purge openssh-server
sudo apt install openssh-server

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、SSH 登录Ubuntu 16.04.1 LTS
  • 2、更新软件
  • 3、升级系统
  • 4、SSH登录系统
  • 5、修改DNS【临时方案】
    • 其他:SSH无法连接服务器,VNC连接
      • 其他:重装SSH
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档