3

I'm analyzing the systemd and I want to improve my system's booting speed.The number one service in the blame list of systemd-analyze by a clear gap is udisks2.service with almost 10 seconds ( those numbers might be misleading because of the dependencies but udisks doesn't have any ) . It's not a good solution to disable it since it's needed by another service :

$ cat /lib/systemd/system/udisks2.service
...
[Install]
WantedBy=graphical.target

I also tried disabling it in a test instance of ubuntu in VirtualBox , it booted completely and without problem but once the dbus-daemon got initialized , it automatically started it.

From man udisksd :

Users or administrators should never need to start this daemon as it will be automatically started by dbus-daemon(1) or systemd(1) whenever an application tries to access its D-Bus interfaces


In the `udisks2.conf` manpage it is stated that you can set the `modules_load_preference` option to `ondemand` and by default it is. It seems that currently it's in the most optimum form.

So the question is "Is it possible to safely speedup the execution of /usr/lib/udisks2/udisksd ?

Any suggestion would be appreciated.

Parsa Mousavi
  • 1,020
  • 2
  • 14
  • 27

1 Answers1

3

Do you have a block device/partition/LV that is not listed in /etc/fstab (and so looks like a candidate for udisksd management) but is encrypted or otherwise not easily identifiable?

Or maybe a CD drive or a memory card reader with a slow or non-existent detection of a "no media in drive" error? In the case of a memory card reader, a symptom of this situation might be I/O timeout errors for that device in dmesg output.

In these cases, you might want to exclude these problem devices from udisksd management, by creating an udev rule matching the problem device and adding the ENV{UDISKS_IGNORE}="1" attribute to it.

The rule could be as simple as

KERNEL=="sda6", ENV{UDISKS_IGNORE}="1"   # encrypted disk

or by device serial number

SUBSYSTEM=="block", ENV{ID_SERIAL_SHORT}=="S467NX0KB24459Y", ENV{UDISKS_IGNORE}="1"

or by any valid combination of udev attributes.

You might want to read [/usr]/lib/udev/rules.d/*-udisks2.rules for examples and informative comments, but you should add your own rules to /etc/udev/rules.d/*.rules so it won't be overwritten by system updates. udev will read both directories, and if there is a file with the exact same name in both, the file in /etc/udev/rules.d will override the corresponding system file. In this case, you probably won't need to override the system default rules files; just add your own rule file with a non-overlapping name.

You can use any filename as long as it is in the correct directory and has the .rules suffix, but remember that the rules are executed in the default US-ASCII sorting order of the filenames, so there is a convention to add a number prefix to the filename to make the rule ordering explicit.

telcoM
  • 87,318
  • 3
  • 112
  • 232
  • "Do you have a block device/partition/LV that is not listed in /etc/fstab?" : **Yes** . "but is encrypted or otherwise not easily identifiable?" : **No**. It doesn't happen most often however that was a nice guide.I didn't know the env variable ```UDISKS_IGNORE```.Thanks :) – Parsa Mousavi Jul 17 '20 at 08:31