I: Configuring initramfs-tools... I: Configuring ureadahead... I: Configuring resolvconf... I: Base system installed successfully.
即表示成功。否则重新尝试。
下面使用chroot进入/mnt/rootfs目录,并查看linux版本。本步骤亦可不做。
1 2 3 4 5 6 7 8 9 10 11 12 13
latelee@ubuntu:~$ cd /mnt/rootfs/ latelee@ubuntu: /mnt/rootfs$ ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var latelee@ubuntu: /mnt/rootfs$ sudo -s [sudo] password for latelee: root@ubuntu: /mnt/rootfs# chroot . root@ubuntu:/# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var root@ubuntu:/# cat etc/issue Ubuntu 16.04 LTS \n \l
root@ubuntu:/# uname -a Linux ubuntu 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# adduser latelee // 添加用户latelee perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). Adding user `latelee' ... Adding new group `latelee' (1000) ... Adding new user `latelee' (1000) with group `latelee' ... Creating home directory `/home/latelee' ... Copying files from `/etc/skel' ... Enter new UNIX password: // 输入密码 Retype new UNIX password: // 再输入密码 passwd: password updated successfully Changing the user information for latelee Enter the new value, or press ENTER for the default // 下面的直接回车即可 Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n]
root@ubuntu:/# passwd root // 添加root密码 Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=b07cf1a8-e1fa-45ba-a1fe-e7cc8e34586b / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation UUID=c1f47190-2158-494f-918c-941d314d716b none swap sw 0 0
修改(或新建)/boot/grub/grub.cfg 文件。
1 2 3 4 5 6 7 8 9 10
set default=0 set timeout=3 menuentry 'Late Lee Ubuntu' { set root='hd0,msdos2' echo "vmlinuz...." # linux /boot/vmlinuz-4.8.0-36-generic root=/dev/sda2 ro console=tty0 console=ttyS0,115200n8 linux /boot/vmlinuz-4.8.0-36-generic root=UUID=b07cf1a8-e1fa-45ba-a1fe-e7cc8e34586b ro find_preseed=/preseed.cfg auto noprompt priority=critical locale=en_US quiet splash $vt_handoff
$ sudo grub-install /dev/sdb $ sudo update-grub Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. Found linux image: /boot/vmlinuz-4.8.0-36-generic Found initrd image: /boot/initrd.img-4.8.0-36-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin Found Ubuntu 16.04 LTS (16.04) on /dev/sdb2 // !!!!! done
grub rescue> set cmdpath=(hd0) prefix=(hd0)/boot/grub root=hd0
可见,启动参数不正确,故无法成功引导系统。 将参数更改为前面确定的路径:
1 2 3 4
grub rescue> set root=hd0,msdos2 grub rescue> set prefix=(hd0,msdos2)/boot/grub grub rescue> insmod normal // 可理解为“安装normal命令” grub rescue> normal // 后会出现grub界面