1 查看磁盘的使用
1.1 执行:fdisk -l
root@prd-devel-00:~
Disk /dev/xvda: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 220A9CAE-DBE1-4257-B914-ED96A7341E70
Device Start End Sectors Size Type
/dev/xvda1 2048 4095 2048 1M BIOS boot
/dev/xvda2 4096 167770111 167766016 80G Linux filesystem
Disk /dev/xvdb: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb5162423
Device Boot Start End Sectors Size Id Type
/dev/xvdb1 2048 104857599 104855552 50G 83 Linux
Disk /dev/xvdc: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x30a2dd50
Device Boot Start End Sectors Size Id Type
/dev/xvdc1 2048 1953791 1951744 953M 83 Linux
/dev/xvdc2 1953792 167770111 165816320 79.1G 83 Linux
1.2 查看是否有挂载:df -h
root@prd-devel-00:~
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 772K 1.6G 1% /run
/dev/xvda2 79G 35G 41G 46% /
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/xvdb1 49G 355M 47G 1% /data
tmpfs 1.6G 0 1.6G 0% /run/user/0
2 安装linux-image-4.15.0.112-generic
2.1 第一次安装
apt-get install linux-image-4.15.0.112-generic
提示: E: dpkg was interrupted, you must manually run ‘dpkg --configure -a’ to correct the problem.
通过执行
dpkg --configure -a
根据1中磁盘使用情况,选中【xvda】,点击【OK】
Installing for i386-pc platform.
Installation finished. No error reported.
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-144-generic
Found initrd image: /boot/initrd.img-4.15.0-144-generic
Found linux image: /boot/vmlinuz-4.15.0-143-generic
Found initrd image: /boot/initrd.img-4.15.0-143-generic
Found linux image: /boot/vmlinuz-4.15.0-142-generic
Found initrd image: /boot/initrd.img-4.15.0-142-generic
Found linux image: /boot/vmlinuz-4.15.0-112-generic
Found Ubuntu 16.04.7 LTS (16.04) on /dev/xvdc2
done
Processing triggers for linux-image-4.15.0-112-generic (4.15.0-112.113) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-112-generic
/etc/kernel/postinst.d/x-grub-legacy-ec2:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-4.15.0-144-generic
Found kernel: /boot/vmlinuz-4.15.0-143-generic
Found kernel: /boot/vmlinuz-4.15.0-142-generic
dpkg-query: error: package 'grub-legacy-ec2' is not installed
run-parts: /etc/kernel/postinst.d/x-grub-legacy-ec2 exited with return code 10
dpkg: error processing package linux-image-4.15.0-112-generic (--configure):
installed linux-image-4.15.0-112-generic package post-installation script subprocess returned error exit status 1
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for initramfs-tools (0.130ubuntu3.13) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-144-generic
Errors were encountered while processing:
linux-image-4.15.0-112-generic
root@prd-devel-00:~
2.2 第二次安装
执行:
apt-get install linux-image-4.15.0.112-generic
2.3 /etc/default/grub(没有修改前)
root@prd-devel-00:~
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"
GRUB_CMDLINE_LINUX=""
2.4 修改/etc/default/grub
2.4.1 /etc/default/grub(第一次修改)
注意:#把GRUB_DEFAULT=0 修改成Ubuntu, with Linux 4.15.0-112-generic
root@prd-devel-00:~
GRUB_DEFAULT="Ubuntu, with Linux 4.15.0-112-generic"
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"
GRUB_CMDLINE_LINUX=""
~
"/etc/default/grub" 34L, 1265C written
root@prd-devel-00:~
2.4.2 执行sudo update-grub
执行: sudo update-grub
root@prd-devel-00:~
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-144-generic
Found initrd image: /boot/initrd.img-4.15.0-144-generic
Found linux image: /boot/vmlinuz-4.15.0-143-generic
Found initrd image: /boot/initrd.img-4.15.0-143-generic
Found linux image: /boot/vmlinuz-4.15.0-142-generic
Found initrd image: /boot/initrd.img-4.15.0-142-generic
Found linux image: /boot/vmlinuz-4.15.0-112-generic
Found initrd image: /boot/initrd.img-4.15.0-112-generic
Warning: Please don't use old title `Ubuntu, with Linux 4.15.0-112-generic' for GRUB_DEFAULT, use `Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-112-generic' (for versions before 2.00) or `gnulinux-advanced-38face64-c681-40da-bd85-89e309309888>gnulinux-4.15.0-112-generic-advanced-38face64-c681-40da-bd85-89e309309888' (for 2.00 or later)
Found Ubuntu 16.04.7 LTS (16.04) on /dev/xvdc2
2.4.3 /etc/default/grub(第二次修改)
root@prd-devel-00:~
GRUB_DEFAULT='gnulinux-advanced-38face64-c681-40da-bd85-89e309309888>gnulinux-4.15.0-112-generic-advanced-38face64-c681-40da-bd85-89e309309888'
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"
GRUB_CMDLINE_LINUX=""
"/etc/default/grub" 34L, 1356C written
root@prd-devel-00:~
2.4.4 执行sudo update-grub
sudo update-grub
2.5 重启服务reboot
3 验证
查看内核:uname -r
注意:遇到内核没有更新过来,那就需要多重启几次。
4 安装过程中遇到问题
4.1 提示:E: Sub-process /usr/bin/dpkg returned an error code (1)
解决方法:
cd /var/lib/dpkg/
sudo mv info/ info-bak
sudo mkdir info
sudo apt-get update
sudo apt-get -f install
sudo mv info/* info-bak/
sudo rm -rf info
sudo mv info-bak info
|