2

After adding everything I have to add to my Pi to make my headless unit with raspbian jessie lite, how can I find out what all services/libraries my entire software stack is NOT using that comes with the Pi, so that I can go ahead and disable/delete them and make it snappier to boot, efficient to run and easier to maintain.

EDIT
To clarify about the snappier booting, I have noticed that after building a system like a music server playing over local LAN, installing with its dependencies, the boot time goes up from the bare metal jessie lite version from ~20 sec to your custom version to ~25 sec. Obviously, those initial 20 sec is loading a lot of services when you boot, which you can see. I just want to know how to find which ones are not needed, so only the required ones are left to run the custom version.

2

Removing libraries will NOT make it "make it snappier to boot, efficient to run".

Libraries are only loaded if called.

The only thing it will do is save a (very small) amount of space.

In general disabling services will make very little difference to boot time on a systemd computer, although not enabling services you do not use is not a bad idea, if you want to save memory.

If you want to explore boot time

systemd-analyze critical-chain

Will show what services are contributing.

  • I have made an edit to the question to be clear. – arjun Sep 26 '17 at 5:37
1

If you run service --status-all will show the services running on your Raspberry Pi.

What you need/can remove I can't advice you upon since it depends.

  • When you are apt-get installing libraries, is there a way to find what system services it depends on. Maybe that can help. FYI - I have edited the question. – arjun Sep 26 '17 at 5:39
0

Raspbian Lite is, not surprisingly, very light on startup. Memory usage is minimal on a fresh boot:

$ free -m
              total        used        free      shared  buff/cache   available
Mem:            434          23         356           3          54         361
Swap:            99           0          99

If you are overly concerned about it, you might try using DietPi, although in my experience, by the time I configure the system the way I want, there is very little actually memory gain. According to the DietPi pages, the actual difference in memory between their optimized configuration and a basic raspbian lite install is 4 MB. They claim 11 versus 18 processes running, and a 1.3 second faster boot time. I suspect much of those gains are due to running dropbear in place of "regular" services such as openssh.

There are specialized installs that are even lighter, but you sacrifice a lot (e.g. regularly updated and patched repository) for little actual memory gain.

There is something to be said for minimizing the packages on disk in order to speed up updates, but you're not going to see a lot of memory, performance or boot time gains by doing so.

Here is the output of systemd-analyze critical-chain:

$ systemd-analyze critical-chain
    The time after the unit is active or started is printed after the "@" character.
    The time the unit takes to start is printed after the "+" character.

    graphical.target @36.113s
    └─multi-user.target @36.112s
      └─ssh.service @35.298s +811ms
        └─network.target @35.283s
          └─dhcpcd.service @10.641s +24.627s
            └─basic.target @10.492s
              └─sockets.target @10.489s
                └─dbus.socket @10.480s
                  └─sysinit.target @10.427s
                    └─systemd-timesyncd.service @9.500s +882ms
                      └─systemd-tmpfiles-setup.service @8.589s +620ms
                        └─local-fs.target @8.375s
                          └─boot.mount @8.152s +196ms
                            └─systemd-fsck@dev-disk-by\x2dpartuuid-8d5379db\x2d01.se
                              └─dev-disk-by\x2dpartuuid-8d5379db\x2d01.device @7.499
  • I am more concerned about boot times, since on a fresh install of lite, it is loading lot of services which can be seen. I just want to find which ones are not needed maybe by finding which services when I apt-get install libraries they depend on. – arjun Sep 26 '17 at 5:42
  • I added the output of systemd-analyze critical-chain for a fresh raspbian lite install on a zero. There are not a lot of spurious services being loaded that will impact boot times, and most are separated by 1-2 seconds, with 25 seconds for the network to become ready taking the longest, in this case timing out on dhcp and setting up the usb gadget ethernet. A faster card (mine was a class 10) and possibly using a fixed ip probably make the most significant difference. Again, DietPi - which prides itself of "fast & light" - only manages a < 2 second speed gain. – bobstro Sep 26 '17 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.