当前位置: 首页>>技术教程>>正文


Ubuntu 桌面 17.04 64 位,带加密 home,启动速度慢

, ,

问题描述

我在笔记本电脑的硬盘上重新安装了 Ubuntu 17.04 桌面 64 位 UEFI。

笔记本电脑:英特尔酷睿 i5-5200U、英特尔高清显卡 5500、16 GB 内存。

启动大约需要 120 秒(从按下电源开关到登录屏幕,使用 SSD 上的 Ubuntu 16.04.2 只需不到 20 秒)。

syslog

$ systemd-analyze blame
          5.187s dev-sdb2.device
          4.268s ModemManager.service
          3.138s accounts-daemon.service
          2.852s fwupd.service
          2.688s grub-common.service
          2.421s irqbalance.service
          2.367s apport.service
          2.360s gpu-manager.service
          2.269s NetworkManager.service
          1.641s thermald.service
          1.632s polkit.service
          1.567s rsyslog.service
          1.336s keyboard-setup.service
          1.241s lightdm.service
          1.240s plymouth-quit-wait.service
          1.231s speech-dispatcher.service
          1.172s udisks2.service
          1.159s apparmor.service
          1.019s alsa-restore.service
           976ms repowerd.service
           957ms upower.service
           900ms bluetooth.service
           821ms systemd-resolved.service
           792ms dev-hugepages.mount
           792ms dev-mqueue.mount
           789ms avahi-daemon.service
           755ms sys-kernel-debug.mount
           689ms [email protected]
           663ms systemd-modules-load.service
           638ms rtkit-daemon.service
           599ms systemd-backlight@backlight:intel_backlight.service
           540ms systemd-rfkill.service
           511ms systemd-udevd.service
           505ms systemd-fsck@dev-disk-by\x2duuid-F685\x2d7079.service
           456ms systemd-machine-id-commit.service
           455ms openvpn.service
           444ms systemd-timesyncd.service
           386ms systemd-user-sessions.service
           326ms systemd-journald.service
           321ms kmod-static-nodes.service
           273ms systemd-logind.service
           243ms colord.service
           239ms systemd-udev-trigger.service
           227ms wpa_supplicant.service
           199ms networking.service
           192ms console-setup.service
           191ms systemd-tmpfiles-setup-dev.service
           188ms pppd-dns.service
           184ms systemd-hostnamed.service
           171ms [email protected]
           170ms systemd-localed.service
           165ms setvtrgb.service
           162ms systemd-tmpfiles-setup.service
           131ms dns-clean.service
           101ms systemd-journal-flush.service
            92ms resolvconf.service
            91ms sys-fs-fuse-connections.mount
            82ms systemd-sysctl.service
            79ms systemd-remount-fs.service
            70ms systemd-random-seed.service
            51ms ufw.service
            44ms systemd-update-utmp.service
            42ms boot-efi.mount
            37ms snapd.socket
            14ms plymouth-start.service
            11ms plymouth-read-write.service
             6ms snapd.autoimport.service
             4ms ureadahead-stop.service
             4ms dev-mapper-cryptswap1.swap
             3ms systemd-update-utmp-runlevel.service
             1ms swapfile.swap

systemd-analyze plot

有任何想法吗?

最佳思路

明白了,这是 Ubiquity problem with encrypted home option: system hangs because of ecryptfs-setup-swap not working with swapfiles

我像往常一样使用加密的 Home 设置 Ubuntu,按照链接中所述进行修复,引导从约 200 秒缩短到约 30 秒,这是在硬盘上。


编辑:问题是当使用加密的 home 安装 Ubuntu 时,17.04 创建一个交换文件而不是像以前版本那样的交换分区,然后安装程序会写入一个错误的配置文件。

引用原始错误报告:

\\n

In particular, ecryptfs-setup-swap puts in /etc/crypttab a line like\\n this:

\\n

cryptswap1 UID=XXXXXXXX /dev/urandom\\nswap,offset=1024,cipher=aes-xts-plain64\\n

\\n

(like there were a swap partition with UID=XXXXXXXX) while with a\\n swapfile it should put the following line:

\\n

cryptswap1 /swapfile /dev/urandom\\nswap,offset=1024,cipher=aes-xts-plain64\\n

\\n

If you manually change that line and reboot, you get rid of the\\n problem – before rebooting, check also that your /etc/fstab file ends\\n with:

\\n

#/swapfile none swap sw 0 0\\n/dev/mapper/cryptswap1 none swap sw 0 0\\n

\\n


由于这个错误,Ubuntu 花费了很长时间等待交换。

fixed systemd-analyze blame

fixed systemd-analyze plot

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/14059.html,未经允许,请勿转载。