Speedup Boottime


(Richard DW Redcroft) #1

Hi,
Recently moved to Void from Arch (been an arch user for several years), and i feel like everything i dislike about Arch is solved with Void.
However i would like to speedup the boot time (no other reason than i like to tinker).
I’ve cut down the services i have, and the boot process itself is fairly quick, with the exception of loading the ramdisk which seems to take a while (4-5seconds).
Is there anyway i can slim down the ramdisk?


[SOLVED] Dracut.conf: Parameters with or without quotation marks?
Installing without initramfs and custom kernel
#2
echo "hostonly=yes" >> /etc/dracut.conf.d/hostonly.conf
xbps-reconfigure -f linux4.12

man dracut.conf /hostonly


(oliver) #3

@redsith Are you using bootchart to measure this or something else?


(Richard DW Redcroft) #4

No, just when i look at the boot. I pplied hostonly=yes to dracut, and cut down the modules. Set compression to cat and it loads much faster now, 1-2 seconds instead of the 4-5 before. Thanks guys


#5

Not recommended but if you want to tinker, a true host-only system doesn’t use initrd/initramfs.


#6

Hi,
You can also add in /etc/default/grub in the line GRUB_CMDLINE_LINUX_DEFAULT="… rd.luks=0 rd.lvm=0 rd.dm=0 rd.md=0… ". Naturally if You don’t use luks, lvm, etc.
Than update-grub and reboot.


#7

Using Xfce4 I had a few seconds delay before the desktop background and icons appearing due to some gvfs trash daemon going through my trash.

$ sudo xbps-remove gvfs gvfs-afc gvfs-mtp gvfs-smb

That fixed it but various things like /tmp /boot / and ~/ get shown as desktop icons now so it’s a big hammer solution. Right clicking on the desktop and unchecking “other devices” under default icons on the icons tab got rid of those though.
e4rat-lite works in Void on ext4, I built it last year and it worked well then on a non ssd HDD, losing 30% boot time or so.


(Richard DW Redcroft) #8

Hi guys,
how do i use bootchart under void? I’ve installed the package and added init=/usr/bin/bootchartd to the grub command line, but i cant find pybootchartgui or bootchart-render to generate a report

thanks


(oliver) #9

I was hoping you’d answer that when I mentioned it :slight_smile:

There are only two files in the pkg… bootchartd and a conf file (/usr/share/doc/bootchart/bootchartd.conf.example) which says it should be placed at /etc/bootchartd.conf

I do get a file in /var/log/bootchart* but it doesn’t look like what I was expecting


(Richard DW Redcroft) #10

I couldnt quite get bootchartd to work, but heres how i slimmed down my system

I compiled a custom kernel without initrd and module loading support. I’ve built all the modules and firmware into the kernel and stripped out anything that i dont need. I then compiled it and replaced my grub with the kernel for EFISTUB booting. (my laptop boots the $esp/EFI/Linux/BOOTX64.efi file, so i copied the bzImage to that file. I’ve also only got these services enabled
acpid, agetty-tty2, autox, dhcpcd, udevd

I’ve installed apulse instead of pulseaudio, and setup my desktop to be a bspwm session with no compositing. My Terminal is ST with minimal changes (just font/color).

Booting to console shows 11mb with ps_mem, and desktop boots to 46mb. This system feels incredibly quick and snappy. You wouldnt tell its running a low end dual core celeron.

Private + Shared = RAM used Program

108.0 KiB + 62.0 KiB = 170.0 KiB runsvdir
200.0 KiB + 83.0 KiB = 283.0 KiB sh
176.0 KiB + 117.0 KiB = 293.0 KiB acpid
360.0 KiB + 140.0 KiB = 500.0 KiB sxhkd
224.0 KiB + 336.0 KiB = 560.0 KiB autox (2)
624.0 KiB + 3.5 KiB = 627.5 KiB runit
504.0 KiB + 157.5 KiB = 661.5 KiB bspwm
344.0 KiB + 325.0 KiB = 669.0 KiB runsv (5)
472.0 KiB + 233.0 KiB = 705.0 KiB login
508.0 KiB + 226.5 KiB = 734.5 KiB xinit
764.0 KiB + 201.5 KiB = 965.5 KiB dhcpcd
900.0 KiB + 216.5 KiB = 1.1 MiB udevd
1.0 MiB + 340.0 KiB = 1.3 MiB sudo
1.6 MiB + 280.0 KiB = 1.8 MiB bash
1.9 MiB + 348.5 KiB = 2.2 MiB wpa_supplicant
30.1 MiB + 994.5 KiB = 31.1 MiB Xorg

                     43.6 MiB

=================================

While this is all mostly just ricing, thats what this little netbook is for. I have a desktop system that i actually work on. This is just a fun little toy


(mr. j) #11

Hi redsith, I’d like to know how did you “compiled a custom kernel without initrd and module loading support”. :smile:


(Richard DW Redcroft) #12

Hi spartan, ive detailed all of the tweaks i have done to my void setup here

hope this helps


#13

Great post!


(mr. j) #14

Arigato for the post


#15

How did you manage to make it work? The only way any of my PC’s boot the EFISTUB is when it’s placed into /boot/EFI/Boot/bootx64.efi.

If I replace Boot by anything else, it does not recognise the kernel.

Also, is there any way to report the name to UEFI without using any tools like efibootmgr? I don’t enjoy seeing UEFI OS as the boot name.


(Richard DW Redcroft) #16

Hi,

My acer system is a little weird, it doesnt boot from the UEFI list, its hard coded to only boot specific files.

I more elegant way of doing this is to keep the grubx64.efi file in $esp/EFI/void_grub, and use this command instead (taken from the Arch wiki, but i cant test on my system)

efibootmgr -d /dev/sdX -p Y -c -g -L “Void Linux Stub” -l /vmlinuz-linux

Where /dev/sdX and Y are the disk and partition where the ESP is located. Change the root= parameter to reflect your Linux root (disk UUIDs can also be used).
where sdX is your esp

you need to use efibootmgr to interact with the uefi list, if you wish to rename your currently booted entry you have to first delete then re-create it (use efibootmgr without option to get boot entry list - ill use 0005 for this example)

efibootmgr -b 0005 -B
efibootmgr -c -L “Void Rocks”

Hope this helps, ill update my blog to be a little more clear


#17

I believe adding and modifying firmware entries (including the entry label) requires some sort of boot manager (like efibootmgr).

I used to rely on efibootmgr since i don’t like grub enough to use it. When i used a modular kernel (modules + initramfs), my efibootmgr command-line would be:

efibootmgr -d /dev/sda -c -L “Void” -l \bootx64.efi -u “root=/dev/sda2 rw quiet initrd=/initramfs.img”

…with both the kernel and initramfs located directly on the ESP.

Nowadays, i am using neither grub, nor efibootmgr. I just build a minimal (non-modular) kernel with a built-in command-line and place it strictly under:

/boot/efi/boot/bootx64.efi

On a final note, changing the case on the ESP and/or the filename of the efi stub kernel, still results in a bootable state.


#18

Thanks, I use the same /boot/EFI/Boot/bootx64.efi path, but was curious whether there was some way to rename without any external programs.

For some time I thought it had to do with the folder name, like the “Windows” one, but it does not seem that way and Microsoft’s OS uses a bootloader anyway.


(Richard DW Redcroft) #19

Hi guys, updated the first post and i’ve also included a second post with more tweaks if your interested


(maxice8 alter) #20

Small minor nitpick, use /etc/sysctl.d/tweaks.conf instead of /usr/lib/sysctl.d/tweaks.conf

See Configuration Directories and Precedence