Slow(ish) boot times, Mint 19

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
polymachine
Level 1
Level 1
Posts: 7
Joined: Fri Sep 22, 2017 2:20 pm

Slow(ish) boot times, Mint 19

Post by polymachine » Tue Sep 10, 2019 4:27 pm

Hi there,

I dual boot with a Win10 install i hardly ever use (only for those programs and games that flat out refuse to work with wine/proton), and everytime i start up Windows i'm blown away by how fast Windows throws the login screen at me, so I'm trying to optimize my startup time a bit.

My desktop PC started out with Mint 19.1, and I've recently upgraded to Mint 19.2
My boot times have always been somewhere around 1 min 10 sec, which is acceptable but not great, and Windows takes about 5 seconds to reach login from grub, so there seems to be some potential there.

systemd-analyze time shows that most of the time is taken up by the kernel and firmware:

Code: Select all

Startup finished in 18.304s (firmware) + 3.989s (loader) + 37.974s (kernel) + 1.838s (userspace) = 1min 2.108s
graphical.target reached after 1.833s in userspace
and systemd-analyze blame corroborated that with the highest time being 469ms systemd-resolved.service

is there any way of speeding the kernel and/or firmware loadtimes up?

Here's my system as per inxi -Fxz:

Code: Select all

System:    Host: workhorse Kernel: 4.15.0-62-generic x86_64 bits: 64 compiler: gcc v: 7.4.0 
           Desktop: Cinnamon 4.2.4 Distro: Linux Mint 19.2 Tina base: Ubuntu 18.04 bionic 
Machine:   Type: Desktop Mobo: Micro-Star model: Z370 GAMING PRO CARBON (MS-7B45) v: 2.0 serial: <filter> 
           UEFI: American Megatrends v: A.20 date: 12/14/2017 
CPU:       Topology: 6-Core model: Intel Core i5-8600K bits: 64 type: MCP arch: Kaby Lake rev: A 
           L2 cache: 9216 KiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 43200 
           Speed: 800 MHz min/max: 800/4300 MHz Core speeds (MHz): 1: 801 2: 800 3: 800 4: 800 5: 800 6: 800 
Graphics:  Device-1: NVIDIA GP104 [GeForce GTX 1080] driver: nvidia v: 430.40 bus ID: 01:00.0 
           Display: x11 server: X.Org 1.19.6 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa 
           resolution: 1920x1080~60Hz, 1920x1080~60Hz 
           OpenGL: renderer: GeForce GTX 1080/PCIe/SSE2 v: 4.6.0 NVIDIA 430.40 direct render: Yes 
Audio:     Device-1: Intel 200 Series PCH HD Audio vendor: Micro-Star MSI driver: snd_hda_intel v: kernel 
           bus ID: 00:1f.3 
           Device-2: NVIDIA GP104 High Definition Audio driver: snd_hda_intel v: kernel bus ID: 01:00.1 
           Device-3: Microsoft LifeCam HD-5000 type: USB driver: snd-usb-audio,uvcvideo bus ID: 1-2:2 
           Sound Server: ALSA v: k4.15.0-62-generic 
Network:   Device-1: Intel Ethernet I219-V vendor: Micro-Star MSI driver: e1000e v: 3.2.6-k port: f000 
           bus ID: 00:1f.6 
           IF: enp0s31f6 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 4.38 TiB used: 1.35 TiB (30.9%) 
           ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO 250GB size: 232.89 GiB 
           ID-2: /dev/sdb vendor: Seagate model: ST4000DM004-2CV104 size: 3.64 TiB 
           ID-3: /dev/sdc vendor: Western Digital model: WDS500G1B0A-00H9H0 size: 465.76 GiB 
           ID-4: /dev/sdi type: USB model: General USB Flash Disk size: 59.21 GiB 
Partition: ID-1: / size: 449.94 GiB used: 19.43 GiB (4.3%) fs: ext4 dev: /dev/sdc2 
           ID-2: /home size: 3.58 TiB used: 1.32 TiB (36.7%) fs: ext4 dev: /dev/sdb2 
           ID-3: swap-1 size: 7.63 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/dm-0 
Sensors:   System Temperatures: cpu: 29.8 C mobo: 27.8 C gpu: nvidia temp: 49 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 0% 
Info:      Processes: 235 Uptime: 11m Memory: 15.62 GiB used: 2.15 GiB (13.8%) Init: systemd runlevel: 5 
           Compilers: gcc: 7.4.0 Shell: bash v: 4.4.20 inxi: 3.0.32 

User avatar
karlchen
Level 20
Level 20
Posts: 11234
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Slow(ish) boot times, Mint 19

Post by karlchen » Tue Sep 10, 2019 4:52 pm

Hello, polymachine.

Looking at your kernel loading time (systemd-analyze output) and spotting this swap device line (inxi report),
ID-3: swap-1 size: 7.63 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/dm-0,
although all other disk partitions are normal partitions, no lvm involved, I suspect that you are one more victim of swap device configuration mismatch.

Such swap configuration mismatch may make the system spend a lot of time searching for something which in the end it cannot find.

Could you, please, post the screen output, generated by the following terminal commands:
  • cat /etc/fstab
  • swapon --show
  • lsblk -f
  • cat /etc/initramfs-tools/conf.d/resume
Regards,
Karl
Image
Linux Mint 19.2 32-bit xfce Desktop, Total Commander 9.22a 32-bit
Linux Mint 18.1 64-bit Cinnamon Desktop, Total Commander 9.22a 64-bit
Windows? - 1 window in every room

polymachine
Level 1
Level 1
Posts: 7
Joined: Fri Sep 22, 2017 2:20 pm

Re: Slow(ish) boot times, Mint 19

Post by polymachine » Wed Sep 11, 2019 10:20 am

Hi Karl,
thank you very much for the reply!

Here's the outputs:

Code: Select all

RESUME=UUID=ff75f7e5-0a8d-4c71-9cdd-d9f6f34f9c27

Code: Select all

NAME      TYPE      SIZE USED PRIO
/dev/dm-0 partition 7,6G   0B   -2

Code: Select all

NAME           FSTYPE LABEL          UUID                                 MOUNTPOINT
sda                                                                       
├─sda1         vfat   SYSTEM         0E6D-7075                            /boot/efi
├─sda2                                                                    
├─sda3         ntfs   Windows        06C86E33C86E20E3                     
└─sda4         ntfs   Recovery image 46D86E92D86E8053                     
sdb                                                                       
├─sdb1                                                                    
└─sdb2         ext4   home           fdf1e938-b9a2-4fa6-8b81-e1b4eac85346 /home
sdc                                                                       
├─sdc1         swap                  eb99fc99-a6f9-4520-9fa4-05094cdb56c9 
│ └─cryptswap1 swap                  e2fb4bb1-68f0-4787-963d-824819bf1e83 [SWAP]
└─sdc2         ext4                  5e857958-78b0-470f-a136-053791a44b64 /

Code: Select all

# /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/sdc2 during installation
UUID=5e857958-78b0-470f-a136-053791a44b64 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=0E6D-7075  /boot/efi       vfat    umask=0077      0       1
# /home was on /dev/sdb2 during installation
UUID=fdf1e938-b9a2-4fa6-8b81-e1b4eac85346 /home           ext4    defaults        0       2
# swap was on /dev/sdc1 during installation
#UUID=eb99fc99-a6f9-4520-9fa4-05094cdb56c9 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

User avatar
karlchen
Level 20
Level 20
Posts: 11234
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Slow(ish) boot times, Mint 19

Post by karlchen » Wed Sep 11, 2019 2:38 pm

Hello, polymachine.

What is the content of the file /etc/crypttab? Terminal command: cat /etc/crypttab

Regards,
Karl
Image
Linux Mint 19.2 32-bit xfce Desktop, Total Commander 9.22a 32-bit
Linux Mint 18.1 64-bit Cinnamon Desktop, Total Commander 9.22a 64-bit
Windows? - 1 window in every room

polymachine
Level 1
Level 1
Posts: 7
Joined: Fri Sep 22, 2017 2:20 pm

Re: Slow(ish) boot times, Mint 19

Post by polymachine » Thu Sep 12, 2019 4:27 pm

Hello Karl,

there's the crytpswap file:

Code: Select all

cryptswap1 UUID=eb99fc99-a6f9-4520-9fa4-05094cdb56c9 /dev/urandom swap,offset=1024,cipher=aes-xts-plain64
Regards

User avatar
karlchen
Level 20
Level 20
Posts: 11234
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Slow(ish) boot times, Mint 19

Post by karlchen » Fri Sep 13, 2019 8:14 am

Hello, polymachine.

On the one hand, the lsblk command output, the file /etc/crypttab and the file /etc/fstab seem to agree on where your encrypted swap space is:
lsblk

Code: Select all

sdc                                                                       
├─sdc1         swap                  eb99fc99-a6f9-4520-9fa4-05094cdb56c9 
│ └─cryptswap1 swap                  e2fb4bb1-68f0-4787-963d-824819bf1e83 [SWAP]
/etc/crypttab
cryptswap1 UUID=eb99fc99-a6f9-4520-9fa4-05094cdb56c9 [...] points to /dev/sdc1, UUID=eb99fc99-a6f9-4520-9fa4-05094cdb56c9, see lsblk output above.
/etc/fstab

Code: Select all

#UUID=eb99fc99-a6f9-4520-9fa4-05094cdb56c9 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0
points do cryptswap1 on /dev/sdc1 as well.

On the other hand, both the file /etc/initramfs-tools/conf.d/resume and the command swapon tell something totally different each.
And none of the two agrees with lslbk or /etc/fstab.
File resume mentions a UUID, which can be found nowhere else. So it will be simply incorrect.
And command swapon mentions /dev/dm-0, which cannot be spotted anywhere, either. So it will be incorrect as well.
No idea where the UUID and the device name come from.

The problem, which I am facing at the moment, is how to tell the file resume and command swapon that actually /dev/mapper/cryptswap1 UUID=e2fb4bb1-68f0-4787-963d-824819bf1e83 should be used.

Maybe someone, who uses an encrpyted swap device, will chime in.

Regards,
Karl
--
Maybe it is a simple as this:
1. sudo swapoff /dev/dm-0
2. sudo swapon /dev/mapper/cryptswap1
3. File resume: RESUME=UUID=e2fb4bb1-68f0-4787-963d-824819bf1e83
4. sudo update-initramfs -u
5. Reboot.
Image
Linux Mint 19.2 32-bit xfce Desktop, Total Commander 9.22a 32-bit
Linux Mint 18.1 64-bit Cinnamon Desktop, Total Commander 9.22a 64-bit
Windows? - 1 window in every room

polymachine
Level 1
Level 1
Posts: 7
Joined: Fri Sep 22, 2017 2:20 pm

Re: Slow(ish) boot times, Mint 19

Post by polymachine » Fri Sep 13, 2019 10:49 am

Maybe it is a simple as this:
1. sudo swapoff /dev/dm-0
2. sudo swapon /dev/mapper/cryptswap1
3. File resume: RESUME=UUID=e2fb4bb1-68f0-4787-963d-824819bf1e83
4. sudo update-initramfs -u
5. Reboot.
I'll give it a try, we'll see what happens.

EDIT:

Code: Select all

$ sudo swapoff /dev/dm-0

$ sudo swapon /dev/mapper/cryptswap1

$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.15.0-62-generic
W: initramfs-tools configuration sets RESUME=UUID=e2fb4bb1-68f0-4787-963d-824819bf1e83
W: but no matching swap device is available.

$ swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/dm-0 partition 7,6G   0B   -2

... well it's recognized the change in the resume file, at least.


EDIT2:

so, cryptswap1 seems to have changed UUID:

Code: Select all

$ lsblk -f
NAME           FSTYPE LABEL          UUID                                 MOUNTPOINT
sda                                                                       
├─sda1         vfat   SYSTEM         0E6D-7075                            /boot/efi
├─sda2                                                                    
├─sda3         ntfs   Windows        06C86E33C86E20E3                     
└─sda4         ntfs   Recovery image 46D86E92D86E8053                     
sdb                                                                       
├─sdb1                                                                    
└─sdb2         ext4   home           fdf1e938-b9a2-4fa6-8b81-e1b4eac85346 /home
sdc                                                                       
├─sdc1         swap                  eb99fc99-a6f9-4520-9fa4-05094cdb56c9 
│ └─cryptswap1 swap                  904351fc-d894-4e6d-a25d-a8f6fc1ec08a [SWAP]
└─sdc2         ext4                  5e857958-78b0-470f-a136-053791a44b64 /

and i don't know when that happened.

EDIT3:

so i updated resume again and tried updating initramsfs, with differing results:

Code: Select all

$ cat /etc/initramfs-tools/conf.d/resume
RESUME=UUID=904351fc-d894-4e6d-a25d-a8f6fc1ec08a

$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.15.0-62-generic
cryptsetup: WARNING: target cryptswap1 has a random key, skipped
EDIT4:

Jup, the UUID of /dev/mapper/cryptswap1 changes everytime the pc reboots. confused.

User avatar
karlchen
Level 20
Level 20
Posts: 11234
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Slow(ish) boot times, Mint 19

Post by karlchen » Fri Sep 13, 2019 4:50 pm

Hi,

then I assume that
+ either the device name /dev/mapper/cryptswap1 should used instead of the changing UUID
+ or the relevant device to point to is the /dev/sdc1, in which the cryptswap1 device is located?

Confirms what I had admitted: no idea how to make sure that the resume uses the right name and how to make swapon use cryptswap1.
(Seems I do not encrypt my swap space because I have never grasped what to put where. :oops: )

Karl
Image
Linux Mint 19.2 32-bit xfce Desktop, Total Commander 9.22a 32-bit
Linux Mint 18.1 64-bit Cinnamon Desktop, Total Commander 9.22a 64-bit
Windows? - 1 window in every room

polymachine
Level 1
Level 1
Posts: 7
Joined: Fri Sep 22, 2017 2:20 pm

Re: Slow(ish) boot times, Mint 19

Post by polymachine » Wed Sep 18, 2019 10:01 am

Hi Karl,

so I've looked around a bit and there's an article on the Arch wiki describing swap encryption, mentioning /etc/crypttab, which does indeed hold some information:

Code: Select all

cryptswap1 UUID=eb99fc99-a6f9-4520-9fa4-05094cdb56c9 /dev/urandom swap,offset=1024,cipher=aes-xts-plain64
which seems to be configured correctly for swap encryption.


but i don't know why swap is encrypted, nor how to un-encrypt it.

My next step will be to just switch to using a swap file; lets see what that does for performance.

EDIT
or simply turn off encryption first *facepalm*

polymachine
Level 1
Level 1
Posts: 7
Joined: Fri Sep 22, 2017 2:20 pm

Re: Slow(ish) boot times, Mint 19

Post by polymachine » Wed Sep 18, 2019 10:36 am

Well that did it.

Code: Select all

Startup finished in 14.633s (firmware) + 3.789s (loader) + 4.924s (kernel) + 1.968s (userspace) = 25.316s
graphical.target reached after 1.965s in userspace
the encrypted swap partition was was at fault, getting rid of cryptswap did it. I'll reproduce the solution quoted in the ask ubuntu forums here, since that is already down to being archived:
The idea is to turn off swap, remove the ecryptfs layer, reformat your partition with normal swap and enable it. We use sdc1 as an example for the swap partition, please use your own (fdisk -l will tell you which swap partition you are using - or in /etc/crypttab)

sudo swapoff -a
sudo cryptsetup cryptswap1
sudo nano /etc/crypttab
*remove the /dev/sdc1 line*
sudo mkswap /dev/sdc1
*this allocated a new UUID to /dev/sdc1*
sudo swapon /dev/sdc1
sudo nano /etc/fstab
*replace /dev/mapper/cryptswap1 with the UUID of /dev/sdc1*

If this is is useful, you can probably stick it in a script to turn on and off... maybe we could get an ecryptfs-unsetup-swap into ecryptfs.
lastly i updates the resume file with the UUID of /dev/sdc1/:

Code: Select all

sudo nano /etc/initramfs-tools/conf.d/resume

RESUME=UUID=<sdc1>
Thanks for joining me on this journey, Karl :wink:

now if i could only cut down on firmware times

Post Reply

Return to “Installation & Boot”