You Got A Question? Ask    GNOME Community!

gtk-theme2
 12012   |  Oct 25
gtk_logo2
 9553   |  Mar 17
arch
 8022   |  Mar 28
 6485   |  Jun 17

Speed up GNOME in Systemd Distributions

This post was made with an older stylesheet


Distros with Systemd

Distros are known to me that using Systemd is Fedora, OpenSUSE, latest Arch, Mageia 3 and all the derivatives of those.  Distros that don’t use Systemd are Ubuntu and all derivatives. I don’t know about Debian, but I think you can install it there, something you can’t do in Ubuntu.

Although GNOME makes a heavy use of Systemd, isn’t a dependency.


Weird Systemd fact!

Systemd was created in 2010 by the very famous OS programmers Lennart Poettering (Red Hat) and Kay Sievers (was at SUSE/Novell at that time -if I am not wrong-, Red Hat now) and is part of the FreeDesktop. At FOSDEM 2011 Lennard said in an interview:

Systemd is the first Linux init system which allows you to properly kill a service.

Surprised by this statement? Rightly so, but it is true. Properly killing a daemon on Linux is really hard and without systemd actually almost impossible to do correctly. (No, a simple “killall httpd” is due to many reasons unsuitable to kill Apache) If you want to know why I say that and what systemd does differently here, then make sure to attend my talk and ask me about it!


Speed Up booting times

The first task is to try to speed our GNOME boot time, by disabling some needless services. To measure the times of each service we can use <systemd-analyze>. If you don’t have it you can install it by

$ sudo yum install systemd-analyze

Of course you have to replace Fedora’s Yum to your Distro update manager. After installation you can run:

$ systemd-analyze

And this is my output. Pretty much that means that to get from Grub to my GDM GNOME Login Screen with all services loaded I need around 10″.

Startup finished in 2851ms (kernel) + 1334ms (initrd) + 5654ms (userspace) = 9840ms

Your numbers here can be quite different. Lets see why

$ systemd-analyze blame

Will give us a more detailed view in what happens to each service

   693ms akmods.service
   558ms plymouth-start.service
   515ms systemd-udev-settle.service
   391ms firewalld.service
   254ms iscsid.service
   234ms systemd-logind.service
   233ms chronyd.service
   229ms rtkit-daemon.service
   222ms mcelog.service
   215ms avahi-daemon.service
   205ms fedora-loadmodules.service
   202ms abrt-ccpp.service
   194ms ksm.service
   191ms accounts-daemon.service
   185ms abrt-vmcore.service
   177ms restorecond.service
   174ms systemd-udev-trigger.service
   165ms multipathd.service
   ........

Akmods.service takes so much to load and I don’t even need it since I have kmod. I also don’t need Plymouth and maybe you don’t need firewalld. Speaking of firewalld I have seen in a blog that the author recommends to completely remove it as there is no way to shut it down. Well, there is.

Disabling Services with Systemd is quite easy. For example for firewalld.

sudo systemctl stop firewalld.service //Stop it
sudo systemctl disable firewalld.service //Remove it from start up

This way by disabling some services you can achieve some better boot times, but you can also make a faster system overall. If you want to go into deeper modifications and insane bootup times you might want to check “Fedora 17 Boot Optimization (from 15 to 2.5 seconds)” great article from Harald Hoyer.

If you are willing to follow this guide, make sure you have a Live Image of your distro next to you, so you can restore your system in case that something goes wrong.

By the way if you wish to completely disable SELinux, which probably you don’t need in a normal home installation just:

$ sudo gedit /etc/selinux/config

and follow the options there.


Systemd Basics

There are many useful things you can do with Systemd, and the best part is that you don’t need to write any code. I will attach the sources you can read more, but lets have a quick view of it.

Activates a service immediately:

$ sudo systemctl start foo.service

Deactivates a service immediately:

$ sudo systemctl stop foo.service

Restarts a service:

$ sudo systemctl restart foo.service

Shows status of a service including whether it is running or not:

$ sudo systemctl status foo.service

Enables a service to be started on bootup:

$ sudo systemctl enable foo.service

Disables a service to not start during bootup:

$ sudo systemctl disable foo.service

Check whether a service is already enabled or not:

$ sudo systemctl is-enabled foo.service; echo $?

0 indicates that it is enabled, and 1 indicates that it is disabled. In Fedora 17, in addition to the return code, “enabled” or “disabled” will be printed to stdout.

Systemd also support <service>. So instead of

$ sudo systemctl start foo.service

You can use

$ sudo service foo start

Since Systemd 195 (present in Fedora 18) you can replace foo.service with foo.

$ sudo systemctl start foo

Creating a Plot Diagram

If you have installed <systemd-analyze> you can run:

$ systemd-analyze plot > plot.svg
$ eog plot.svg

That will create an SVG Plot of your services.
systemd-plot


GTK Interface

That is a bit confusing to me, it seems there is there are two packages. <systemd-gtk> or <systemd-ui> depending on the distro.  In Fedora 18 is the second one. Install it

$ sudo yum install systemd-ui

Run it

$ systemadm

systemd-ui

Systemd User Interface is not yet ready and it isn’t recommended for production use.


Sources

You will find much more on the bellow links. Systemd is not just for admins, it is a worth to give a look at it.  I am not someone that I fancy the idea that a Linux User should know lot of things for its box, but Systemd can be proven really useful to anyone.


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • http://varemenos.com/ Adonis K. (Varemenos)

    Nice and detailed article!

  • serdotlinecho
  • http://jeremy.bicha.net/ Jeremy Bicha

    Are you sure you don’t need akmods?

    • alex285

      Akmod builds the kernel modules for nVidia when there are missing kmods. But Fedora Fussion provides immediate kmod updates for newest kernels, so you hardly go into such issues. Even if I miss a kmod, I can boot with the older kernel, till Fusion Repo updates. But I rarely re-boot anyway ;)

      • alex285

        Ooops, yes you are a bit right. Basically I have installed kmod and akmod in parallel, that is why I dont need akmod service. Other people might do need it.

  • http://profiles.google.com/tshimulu Luya Tshimbalanga

    On Fedora 18 which uses systemd ver.195, you no longer need to add “.service” in foo.service . You can simply type:
    systemctl enable foo

    • alex285

      Thank you! I didn’t know that. Added.

  • chenxiaolong

    For the “Creating a plot diagram” section, I think you meant

    systemd-analyze plot > tmp.svg

    eog tmp.svg

    gedit is not very useful for a picture :)

    • alex285

      Oops! Thanks, I changed that!

      • chenxiaolong

        You’re welcome :)

  • Pingback: Links 19/1/2013: Links for the day | Techrights

  • http://twitter.com/medeoTL medeoTL

    isn’t 99876ms = ~100 seconds = 1’40″? you say that boot time is just 10″. Am I wrong?

    • alex285

      Well you are quite right. I will try to find out whats wrong on these number, because man systemd-analyze wasn’t much helpful.

    • alex285

      OK I found the issue, it was send-mail. I disabled it and I re-attach the startup. It is now:
      Startup finished in 2851ms (kernel) + 1334ms (initrd) + 5654ms (userspace) = 9840ms.

      I didn’t notice at first place, because I need 10″ to login screen and it seems that send-mail doesn’t prevent you from login. Thanks for noticing that!

  • Pingback: Using Fedora Rawhide | woGue

  • Frank Kaufmann

    s/Systemd/systemd/g