我的启动速度非常慢,无法找出确切原因,但dmesg
显示 apparmor 配置文件加载大部分时间都在消耗资源。我不确定这是否真的导致这种情况,还是其他原因。我双启动了 Windows 10 和 Ubuntu 18.04,但由于启动速度慢,我删除了 Windows 并完全格式化了 Windows 驱动器。启动仍然需要一到两三分钟。
规格:
OS: Ubuntu 18.04.4 LTS 64-bit with GNOME 3.28.2
RAM: 7.7 GiB
CPU: [Intel® Pentium(R) CPU G3250 @ 3.20GHz][1] × 2
GPU: AMD® Cedar
systemd-分析时间
~$ systemd-analyze time
Startup finished in 4.106s (kernel) + 1min 32.843s (userspace) = 1min 36.950s
graphical.target reached after 52.928s in userspace
我的 Grub 文件详细信息:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DISABLE_OS_PROBER="true"
GRUB_DEFAULT="Ubuntu"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="0"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noresume"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
GRUB_SAVEDEFAULT="false"
/etc/fstab
文件详细信息
# /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/sda3 during installation
UUID=5d29f3ec-aff8-4903-ab70-b7f58471af1c / ext4 errors=remount-ro 0 1
sudo blkid
输出详细信息:
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: LABEL="System Reserved" UUID="08A428FBA428ED3E" TYPE="ntfs" PARTUUID="f066e382-01"
/dev/sda2: LABEL="New Born" UUID="1DFD554150872322" TYPE="ntfs" PTTYPE="dos" PARTUUID="f066e382-02"
/dev/sda3: UUID="5d29f3ec-aff8-4903-ab70-b7f58471af1c" TYPE="ext4" PARTUUID="f066e382-03"
/dev/sda5: LABEL="Free To Destroy" UUID="84C49E2AC49E1F0C" TYPE="ntfs" PARTUUID="f066e382-05"
/dev/sda6: LABEL="Talk With Ripon First" UUID="E642D35F42D33353" TYPE="ntfs" PARTUUID="f066e382-06"
/dev/sda7: LABEL="Mail" UUID="4418BE5E18BE4F24" TYPE="ntfs" PARTUUID="f066e382-07"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/loop13: TYPE="squashfs"
/dev/loop14: TYPE="squashfs"
/dev/loop15: TYPE="squashfs"
swap
细节:
free -m
total used free shared buff/cache available
Mem: 7920 2470 2986 213 2463 4967
Swap: 0 0 0
GParted 屏幕截图:
磁盘智能数据和自我检测:
关于从哪里开始以及我应该做什么的任何建议都会对我有帮助。
答案1
运行systemd-analyze blame
后您将看到哪些应用程序/程序在启动时花费了多少时间。
答案2
看来您缺少 /swapfile 或交换分区......
free -m
total used free shared buff/cache available
Mem: 7920 2470 2986 213 2463 4967
Swap: 0 0 0
让我们创建一个/swapfile...
在terminal
...
笔记:命令使用不当dd
可能导致数据丢失。建议复制/粘贴。
笔记:由于您没有 /swapfile,前两个命令可能会显示错误。
sudo swapoff -a # turn off swap
sudo rm -i /swapfile # remove old /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
sudo chmod 600 /swapfile # set proper file protections
sudo mkswap /swapfile # init /swapfile
sudo swapon /swapfile # turn on swap
free -h # confirm 8G RAM and 4G swap
将此行添加到/etc/fstab
...
/swapfile none swap sw 0 0
然后重新启动并确认正常运行。