Speed up boot process of Trisquel 8

36 respostas [Última entrada]
GNUser
Desconectado
Joined: 07/17/2013

Hey everyone,

I want to check everything that runs at boot time, to maybe eliminate some stuff that is unnecessarily delaying the boot process. How would one do it?
To be clear, I don't use "network printers" or anything, I remember in T7 there was something about that.
Sorry to be "generic" in the question, but I don't know where to begin with :)

Thanks.

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

Install systemD, d only system there is, it will make your computer cumm faster \o/

Lennart_poettering_foss.in_2007.jpg
GNUser
Desconectado
Joined: 07/17/2013

LOL xD

Geshmy
Desconectado
Joined: 04/23/2015

I believe systemd is installed by default.

Here are a couple of commands with example responses from my laptop running Trisquel 8:

rally@silverbird:~/Desktop$ systemd-analyze
Startup finished in 7.907s (kernel) + 25.403s (userspace) = 33.311s

rally@silverbird:~/Desktop$ systemd-analyze blame
7.601s NetworkManager-wait-online.service
6.136s dev-sda4.device
5.032s apparmor.service
3.711s NetworkManager.service
3.294s postfix.service
3.257s accounts-daemon.service
2.894s lightdm.service
2.645s networking.service
2.441s console-setup.service
1.909s rsyslog.service
1.868s polkitd.service
1.832s grub-common.service
1.587s name at domaine
1.549s rc-local.service
1.299s keyboard-setup.service
1.146s irqbalance.service
1.038s systemd-journald.service
.....and lots of other suff taking less and less time to get started.

I noticed tor.service was starting at boot and I haven't been using it so I did...

rally@silverbird:~/Desktop$ systemctl status tor.service
rally@silverbird:~/Desktop$ sudo systemctl stop tor.service
rally@silverbird:~/Desktop$ sudo systemctl disable tor.service

rally@silverbird:~/Desktop$ systemctl | grep service
will also give a list of services starting up (configured in the /etc/rc. files)

All the services that start on mine seem necessary. 33 seconds isn't to bad but if my laptop booted faster that would be nice. The /etc/rc. files allow for changing the order in which different things boot. Tor had a problem because I don't hook up to the internet by default and it was trying to.

I know there is a lot more one can do with systemd and systemctl. I'm no expert.

Here's more info:
https://www.linux.com/learn/understanding-and-using-systemd

GNUser
Desconectado
Joined: 07/17/2013

Thanks. I didn't know anything about that, I knew systemD was the default (I remember the heated discussions back then...) but I didn't know much about it. Those commands will allow me to make some analysis and hopefully some improvements (or at least make sure that over time stuff is not added up). I remember in another installation I also had services starting up (like Tor and I2P) which I didn't use all that much and wanted to just start them manually but they were taking time at boot.
I will report back if I find anything interesting :)

Thanks!

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Systemd starts services in parallel. To graphically see not only the initialization times but also when every service starts:
$ systemd-analyze plot > systemd.svg
"systemd.svg" can then be opened with Eye of MATE (or any other viewer that understands SVG).

GrevenGull
Desconectado
Joined: 12/18/2017

nice

GNUser
Desconectado
Joined: 07/17/2013

Thanks everyone!
Great stuff on all posts!

I run systemd-analyze blame and got this:

Startup finished in 39.857s (kernel) + 40.379s (userspace) = 1min 20.236s

7.381s apt-daily-upgrade.service
7.179s dev-sda1.device
6.760s apt-daily.service
6.329s NetworkManager-wait-online.service
4.214s irqbalance.service
3.382s console-kit-log-system-start.service
2.949s ufw.service
2.839s lvm2-monitor.service
2.523s NetworkManager.service
2.322s accounts-daemon.service
2.152s lightdm.service
1.934s apparmor.service
1.695s systemd-udevd.service
1.665s keyboard-setup.service
1.601s grub-common.service
1.546s avahi-daemon.service
1.439s systemd-logind.service
1.394s ofono.service
1.343s rsyslog.service
1.334s systemd-tmpfiles-setup-dev.service
1.060s networking.service
1.015s mdadm.service

And a lot other stuff all under a second. I am wondering if any of these can be turned off and how to do it? I think I can get avahi off, and maybe apparmor? I don't have anything configured in apparmor, I only use firejail to restric programs (or maybe Trisquel has apparmor pre-configured??)
What is that ofono service?
Comparing to Geshmy I take a LOT of time to boot. Would like to get it under a minute at least :)

Thanks ahead for all the help guys

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

Startup finished in 18.434s (kernel) + 21.112s (userspace) = 39.546s

This is an 11 yr old laptop btw..

Send me bitcoins

GNUser
Desconectado
Joined: 07/17/2013

That's what I consider really strange. Mine is a Librebooted T400, with a brand new fresh Trisquel 8 installation, with a 7200rpm hard drive.
I don't understand why it takes so long... You take 40 secs I take more than a minute.

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

No. Send *me* bitcoins:
$ systemd-analyze
Startup finished in 8.298s (kernel) + 1.933s (userspace) = 10.231s

I cheat: SSD powa! :-p

GNUser
Desconectado
Joined: 07/17/2013

Ah ah ah. Tempting, but that still doesn't explain why my kernel takes 39 seconds to boot (kernel alone). Though I would maybe think about getting an SSD later.
Are you using the standard Trisquel 8 kernel, or is it another Linux-Libre (maybe the one provided by jxself?).
Thanks.

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Standard Trisquel 8 kernel:
$ uname -a
Linux atena 4.4.0-127-generic #153+8.0trisquel2 SMP Tue May 22 10:35:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

GNUser
Desconectado
Joined: 07/17/2013

Thanks! Just noticed I had my updates disabled, so I decided to update my system. Who knows, maybe the kernel updates make it faster?

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

/me sends MagiqueB all his bitcoins :)

*which is not much..I'm an europoor :'(

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Your objective being to "speedup the boot process", you should focus on the critical chain (systemd activates units in parallel, if they do not depend on each other, and your processor is probably multicore and hyperthreaded), as far as I understand. This command shows it:
$ systemd-analyze critical-chain
What follows the + sign is the activation time of the unit. On my system, apt-daily.service is what takes more time to activate. Nevertheless it is not part of the critical chain (and 'systemd-analyze plot' does not even have a bar for it, maybe because it is allowed to finish after the boot is over?). That is why, as far as I understand, disabling apt-daily.service would not significantly change the time my system takes to boot.

GNUser
Desconectado
Joined: 07/17/2013

Thanks for the info. I ran that command and got this

graphical.target @25.604s
└─multi-user.target @25.604s
└─unbound.service @25.263s +340ms
└─network-online.target @25.249s
└─NetworkManager-wait-online.service @19.048s +6.199s
└─NetworkManager.service @16.612s +2.415s
└─dbus.service @12.970s
└─basic.target @12.950s
└─sockets.target @12.950s
└─cups.socket @12.950s
└─sysinit.target @12.887s
└─apparmor.service @11.032s +1.822s
└─local-fs.target @11.018s
└─home.mount @10.367s +650ms
└─dev-mapper-trisquel\x2d\x2dvg\x2dhome.device @10.318

Some are printed in red and others in standard white.
Like I said to SuperTramp89, I don't understand why a default installation of Trisquel 8 takes so long, my hard drive is a 7200rpm one. Could it be because I have full disk encryption?
Other than that I would expect a T400 to boot faster...

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

>my hard drive is a 7200rpm one. Could it be because I have full disk encryption?

FDE here too and a 7200rpm HD..

GNUser
Desconectado
Joined: 07/17/2013

Are you running Trisquel 8 with the standard installation kernel? Or another Linux-Libre flavour?
Thanks.

GNUser
Desconectado
Joined: 07/17/2013

Are you running Trisquel 8 with the standard installation kernel? Or another Linux-Libre flavour?
Thanks.

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

I assume the question is directed to me - I'm running and been running for over 3 yrs now Debian Stable.

GNUser
Desconectado
Joined: 07/17/2013

Yes it was directed at you... So the kernel is different... Too bad, can't make a proper comparison. But you almost make me want to change for Debian again, lol, that is a great boot time.
Guess I will wait for MagicBanana to reply, I am curious if everyone is having the same long boot process...

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

>But you almost make me want to change for Debian again, lol, that is a great boot time.

Welcome back my friends to the show that never ends, it's called install, set and forget. :)

znavko
Desconectado
Joined: 06/11/2018

I have ssd, Intel(R) Pentium(R) CPU N3530 @ 2.16GHz, 4Gb RAM and I think my system boot faster. Faster then on Funtoo, Debian that I used before.

$ systemd-analyze
Startup finished in 13.248s (kernel) + 19.747s (userspace) = 32.995s

I think to disable unnecessary services, disable kernel modules such as bluetooth, ipv6. NetworkManager I think is not best for boot time. May be another free wifi service. And it should loads after boot and login or in login screen.

SSD is a very important thing to speed up.

GNUser
Desconectado
Joined: 07/17/2013

Thanks man. Yes, SSD would make huge difference, but I suspect there are things I can disable. I will have to try and discover how to disable certain items AND get them back up if I need to.
What did you mean about NetworkManager? Thanks.

znavko
Desconectado
Joined: 06/11/2018

rfkill loads on boot and take a time. you can see it. needs to try to configure os with no soft blocking necessary interfaces and disabling rfkill. also networkmanager takes time on boot process. but there are faster alternatives I think. I was using wpa_supplicant and had much joy about it. but I found on trisquel distribution wpa_supplicant is not free. ))

znavko
Desconectado
Joined: 06/11/2018

you know I disabled tor service and tor@default service and my systemd says this:

# systemd-analyze
Startup finished in 13.233s (kernel) + 2.998s (userspace) = 16.231s

This means minus 16 seconds from userspace as in my previous post. Now I search how to move this and other services loading to later time after I see login page to speed up boot.

kernel loads very slowly 13 seconds is far from best. needs to learn which services are unnecessary like CUPS (printer), openvpn and so on from here `systemctl list-units`

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

The kernel loads before the service. So disabling services will not speedup the time to load the kernel.

GNUser
Desconectado
Joined: 07/17/2013

What would help then? Is there anything that can make the kernel load faster, or the only option is a)replacing the kernel b)buying SSD ?

Also, if you can offer some input to the questions I posed below, I would be very grateful (meaning the Ofono service and such). Thanks.

GNUser
Desconectado
Joined: 07/17/2013

Ok, so, running systemctl list-units I noticed some things:

ofono.service loaded active running oFono Mobile telephony stack
openvpn.service loaded active exited OpenVPN service
avahi-daemon.socket loaded active running Avahi mDNS/DNS-SD Stack Acti

As far as I am aware, I don't use Mobile phone in my computer, neither do I use VPN (I tried using BitMask but it leaks DNS, so for now I don't use it) and I think avahi is meant for using network printers which I don't have. So, it should be ok to disable these right?
I mean, it's not like these are in the critical chain MagicBanana mentioned, but I guess having less stuff running would not be bad either way, right? The thing is, am I considering it right? I couldn't find much information online about Ofono for example.
How can one know what each entry on the list-units option does? Which ones are essential and which ones are not?
Thanks.

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

You can either search the Web or just "systemctl stop" the service and see. If you see no difference you can then "systemctl disable" the same service. That said you may not see at first sight that something is missing (typically if you do not test the interaction with a phone, you cannot see what oFono does). Anyway, you can always "systemctl enable" later.

GNUser
Desconectado
Joined: 07/17/2013

Would disabling some of those services prevent the booting of the system? As long as I can "systemctl disable / systemctl enable" I am okay with that.

znavko
Desconectado
Joined: 06/11/2018

I cannot know exactly cause I see names there for a first time now: gdomap, irqbalance, acpid, atd, setvtrgb, remote-fs-pre, nss-user-lookup.

You should have rescue usb flash to boot with it, to mount broken system and reconfigure it.

disabling ofono, openvpn is ok. disabling avahi is ok too https://ccm.net/faq/739-disabling-the-avahi-daemon

GNUser
Desconectado
Joined: 07/17/2013

I just ran systemd-analyze again and got this
Startup finished in 11.289s (kernel) + 30.593s (userspace) = 41.882s

Wtf?
The only thing I noticed different was that I was not running the laptop on battery but straight for the AC outlet. Does that even matter? I guess I will have to give it a few tests and see what is happening really.

GNUser
Desconectado
Joined: 07/17/2013

I just ran some tests, with a clock timer and systemd-analyze. Here are the results.

No battery on laptop, only straight AC power outlet
systemd-analyze
Startup finished in 10.333s (kernel) + 26.091s (userspace) = 36.425s
My clock counts 58 seconds (including the time it takes for me to type the 2 passwords)

Battery only at 8%, no AC power outlet in
systemd-analyze
Startup finished in 11.084s (kernel) + 26.310s (userspace) = 37.395s
My clock 59 seconds (again including the time it takes for me to type the passwords)

I swear I don't understand why it was giving me the time of 1 minute and some seconds before in systemd-analyze. Right now I get these consistent times in both systemd-analyze and real life time clock.
Well, in face of this, I would say that it's the best I will ever get without changing to an SSD. I will still try to disable some stuff, maybe it will get better or not, but I don't want services that are NOT needed running for nothing.

Thanks everyone anyway, I will let you guys know if something new comes up.

znavko
Desconectado
Joined: 06/11/2018

Trisquel as Ubuntu clone is user-friendly but is not good optimized. Please, any info you'll get will be quite useful.

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

>Trisquel as Ubuntu clone is user-friendly but is not good optimized. Please, any info you'll get will be quite useful.

netinstall and manually install only the DE.. LXDE?