apt 更新后安装自定义 Ubuntu 时出现问题

apt 更新后安装自定义 Ubuntu 时出现问题

我一直在尝试构建一个使用 Ubuntu 14.04 和一些附加软件包的标准环境,并编写了一个快速脚本来更新 apt 并安装我需要的软件包。使用 Cubic,我加载最新的 iso 并进入 chroot 环境。

如果我只是将更新脚本复制到 chroot(在文件夹 /share 下),不做任何其他更改,然后使用 unetbootin 将 iso 放到闪存驱动器上,一旦我将其安装到笔记本电脑上,一切都会按预期运行。如果我运行修改 sources.list 文件、更新 apt 并安装大量软件包的脚本,那么我就会开始遇到问题。

我使用 Ubuntu 16.04.3 时遇到的第一个问题是在安装时出现错误,提示无法将 grub-efi-amd64-signed 安装到 /target/。启动修复无法修复此问题。

我将原始 iso 更新为 Ubuntu 16.04.4,并且如果我不做任何更改,它将按预期工作,如果我更新 apt 并安装附加软件包,它似乎会正确安装,但重新启动时我被带到 GNU GRUB 版本 2.02~beta2-36ubuntu3.17(最小 BASH 类行编辑)。

由于我的系统处于离线状态,我无法连接到互联网在安装期间下载,而能够使用 CUBIC 预安装附加软件包真是天赐之物。

我不确定我是否做错了什么,或者正在应用的更新是否会破坏正在传输到已安装环境的 chroot 环境中的某些内容。

我的脚本包含以下内容:

    #!/bin/bash

    set -eu -o pipefail # fail on error, debug all lines

    # update the sources.list file

    cat <<EOF > /etc/apt/sources.list

    # deb cdrom:[Ubuntu 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted

    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://au.archive.ubuntu.com/ubuntu/ xenial main restricted
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial main restricted

    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://au.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://au.archive.ubuntu.com/ubuntu/ xenial universe
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial universe
    deb http://au.archive.ubuntu.com/ubuntu/ xenial-updates universe
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-updates universe

    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://au.archive.ubuntu.com/ubuntu/ xenial multiverse
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial multiverse
    deb http://au.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://au.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

    ## Uncomment the following two lines to add software from Canonical's
    ## 'partner' repository.
    ## This software is not part of Ubuntu, but is offered by Canonical and the
    ## respective vendors as a service to Ubuntu users.
    # deb http://archive.canonical.com/ubuntu xenial partner
    # deb-src http://archive.canonical.com/ubuntu xenial partner

    deb http://security.ubuntu.com/ubuntu xenial-security main restricted
    # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
    deb http://security.ubuntu.com/ubuntu xenial-security universe
    # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
    deb http://security.ubuntu.com/ubuntu xenial-security multiverse
    # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
    EOF

    # Update APT and upgrade all packages
    apt update && apt upgrade -y

    # Install pre-determined software
    apt install aptitude k3b dc3dd dcfldd minicom samba virt-manager virtualbox p7zip-full p7zip-rar filezilla bless gcp tree pv grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed shim shim-signed -y

    # Remove guest login
    cat <<EOF > /etc/lightdm/lightdm.conf
    [SeatDefaults]
    user-session=ubuntu
    greeter-session=unity-greeter
    allow-guest=false
    EOF

    # Change user libvirt-qemu (virt-manager user) show it doesn't show in greeter
    usermod -u 499 libvirt-qemu

    # Download aptitude packages to enable operation on generic hardware profiles
    aptitude install --download-only initramfs-tools initramfs-tools-core linux-firmware linux-generic-hwe-16.04 linux-signed-image-4.10.0-40-generic init-system-helpers intltool-debian linux-base linux-headers-4.10.0-28 linux-headers-4.10.0-40 linux-headers-generic-hwe-16.04 linux-image-4.10.0-40-generic linux-image-extra-4.10.0-40-generic linux-image-generic-hwe-16.04 linux-signed-generic-hwe-16.04 linux-signed-image-4.10.0-28-generic linux-signed-image-4.10.0-40-generic linux-signed-image-generic-hwe-16.04 usb-modeswitch-data

aptitude 软件包可以支持此 iso 可能安装的各种硬件配置文件。

希望这是我遗漏的或需要删除的简单内容,以使其正常工作。

感谢你的帮助。

约翰

答案1

一切都已修复,花时间将脚本拆分并手动运行,然后使用稍作修改的脚本进行测试,一切似乎都正常。不确定根本原因是什么,但怀疑修改 lightdm.conf 文件以及删除 shim 和 efi-grub 包已修复该问题。

相关内容