# Is dbus really needed?



## Martillo1 (Jun 22, 2011)

Yesterday I installed 8.2 (with root on ZFS, btw) and began to compile ports: ports-mgmt/portmaster, ports-mgmt/portaudit... and x11/xorg without HAL option. Having read in these forums recently that HAL was no needed, I tried to start X without running hal or dbus and it worked. Added x11-wm/pekwm, x11/nvidia-driver and x11/nvidia-xconfig and it works well (I am using www/opera).

So the question is: Is dbus really needed? I am puzzled to see the water flowing upwards :q

P.S.: My USB mouse work flawlessly aswell.


----------



## wblock@ (Jun 22, 2011)

dbus isn't required for X.  It might be used by components of a given desktop environment to communicate with other programs.


----------



## jrm@ (Jun 22, 2011)

So for those of us not using a desktop environment, but a simple window manager like *fluxbox*, is there any value to having *dbus*?  Can anyone give a specific example where *dbus* is useful?

A lot seems to depend on it:

`% pkg_info -R dbus-1.4.6` 

```
Information for dbus-1.4.6:

Required by:
ORBit2-2.14.19
eggdbus-0.6_1
libgee-0.6.1
polkit-0.99
poppler-0.14.5
dbus-glib-0.88
py27-dbus-0.83.2
avahi-app-0.6.29
dconf-0.5.1_3
gconf2-2.32.0_2
librsvg2-2.32.1_1
emacs-23.3_1,2
auctex-emacs23-11.86
libgnome-keyring-2.32.0
libnotify-0.5.2
py27-notify-0.1.1_7
ibus-1.3.9
gegl-0.1.6_1
libsoup-gnome-2.32.2
gvfs-1.6.6_1
poppler-gtk-0.14.5
gnome-keyring-2.32.1
libwpd-0.9.1
libwpg-0.2.0_1
libwps-0.2.2
midori-0.3.6
wxgtk2-common-2.8.12
wxgtk2-2.8.12
wxgtk2-contrib-common-2.8.12
wxgtk2-contrib-2.8.12
treeviewx-0.5.1_6
wxgtk2-unicode-2.8.12
wxMaxima-11.04.0
chromium-12.0.742.91
libgsf-1.14.21
vlc-1.1.10,3
libpurple-2.8.0
libreoffice-3.3.3
pidgin-2.8.0
gimp-2.6.11,2
gimp-app-2.6.11_2,1
firefox-5.0,1
```


----------



## troberts (Jun 22, 2011)

I do not think it is "needed" to run an application, but it can definitely help. I compiled Thunar 4.8 without dbus and the image files (i.e. png) would not show unless I opened them in GIMP. If I opened an image and modified it, the old version would show and I would have to open the file again before I saw the change in Thunar. If I renamed a file that was showing in Thunar, it would disappear. After I built Thunar with dbus my image files show and if I make changes in GIMP the image gets updated as soon as I saved it.

I still cannot see my folder icons and the trash panel is missing so I have to use a terminal to navigate to where the deleted files are and use rm to permanently remove them.


----------



## wblock@ (Jun 23, 2011)

mingrone said:
			
		

> `% pkg_info -R bus-1.4.6`



A lot of those don't directly depend on dbus, but depend on things that in turn depend on dbus.  There's probably a better way to say it, but they're indirect dependencies.

Just off the top of my head, and because I don't like sh scripting but feel it's valuable to try:

```
#!/bin/sh

pkg="dbus-1.4.6"
pkgbase=${pkg%%-*}

depends=`pkg_info -R ${pkg}`
origins=`portmaster --list-origins ${depends}`

for origin in ${origins}
do
  mkfile="/usr/ports/${origin}/Makefile"
  egrep -Hi "${pkgbase}.*:" ${mkfile}
done
```

That will find Makefiles of the ports that really depend on dbus.  Or whatever you put in pkg.  That still may not find everything, but it's a starting point.  (A little tested, could stand some work.)


----------



## troberts (Jun 23, 2011)

You could also try

`# grep -l WITH_DBUS /var/db/ports/*/options`

and

`# grep -l WITHOUT_DBUS /var/db/ports/*/options`

to see which ports give you the option to include/exclude dbus.


----------



## jrm@ (Jun 23, 2011)

@troberts, your solution is helpful if one wanted to find *configured* (but not necessarily installed) ports that have a *DBUS* option.  Here's a slight modification:

`% egrep -l "WITH.*_DBUS" /var/db/ports/*/options`

@wblock, for some reason `% portmaster --list-origins` doesn't list everything.

`% portmaster --list-origins | wc -l`

```
96
```

but

`% pkg_info -aoq | wc -l`

```
595
```

Here's a minor update to your solution, which seems to work well:


```
#!/bin/sh

pkg="dbus-1.4.6"
pkgbase=${pkg%%-*}

depends=`pkg_info -qR ${pkg}`
#origins=`portmaster --list-origins ${depends}`
origins=`pkg_info -oq ${depends}`

for origin in ${origins}
do
  mkfile="/usr/ports/${origin}/Makefile"
  egrep -il "${pkgbase}.*:" ${mkfile}
done
```

The output with that script is:

```
/usr/ports/net/avahi-app/Makefile
/usr/ports/www/chromium/Makefile
/usr/ports/devel/dbus-glib/Makefile
/usr/ports/devel/eggdbus/Makefile
/usr/ports/editors/emacs/Makefile
/usr/ports/www/firefox/Makefile
/usr/ports/devel/gconf2/Makefile
/usr/ports/graphics/gimp-app/Makefile
/usr/ports/devel/gvfs/Makefile
/usr/ports/textproc/ibus/Makefile
/usr/ports/devel/libnotify/Makefile
/usr/ports/net-im/libpurple/Makefile
/usr/ports/sysutils/polkit/Makefile
/usr/ports/devel/py-dbus/Makefile
/usr/ports/multimedia/vlc/Makefile
```

Using @troberts script, I can see that of those ports, the ones with a *DBUS* configuration flag are:

`% for i in `sh find_depends.sh`; do newname=`echo $i | sed -e 's/\/usr\/ports\/[-a-z]*\/\([-a-zA-Z0-9]*\)\/Makefile/\1/'`; if [ -f /var/db/ports/$newname/options ]; then egrep -l "WITH.*_DBUS" /var/db/ports/$newname/options; fi; done;`


```
/var/db/ports/emacs/options
/var/db/ports/firefox/options
/var/db/ports/gimp-app/options
/var/db/ports/libpurple/options
/var/db/ports/vlc/options
```

That leaves a few ports that depend on *dbus* but cannot turn off that dependency.  I wonder what functionality would be lost if *dbus* where removed.


----------



## wblock@ (Jun 23, 2011)

--list-origins might have some logic to show only the highest leaf ports, filtering out all the lower dependencies because they'll be installed as dependencies of the leaf ports anyway.

If you dig into those ports where dbus isn't optional, you might find that it could be but just hasn't been set up as an option in the port.  And some ports would not be needed at all without dbus, like py-dbus.


----------



## DutchDaemon (Jun 23, 2011)

```
--list-origins
         list directories from /usr/ports for [B]root[/B] and [B]leaf[/B] ports.  This list
         is suitable for feeding to portmaster either on another machine or
         for reinstalling all ports.
```

It's really useful if you need to reinstall every port  from scratch. It pulls in the other ports by itself. In fact, it serves as my quick and dirty 'ports backup method'


```
0 22 * * *	/usr/local/sbin/portmaster --list-origins > /root/ports_today
```


----------



## Martillo1 (Jun 24, 2011)

In the end I installed devel/dbus for Libreoffice and for the sake of communication between applications. But not sysutils/hal.


----------



## mod3777 (Mar 29, 2019)

jrm@ said:


> So for those of us not using a desktop environment, but a simple window manager like *fluxbox*, is there any value to having *dbus*?  Can anyone give a specific example where *dbus* is useful?
> 
> A lot seems to depend on it:
> 
> ...



In case people wonders, it's 
`% pkg info -r dbus` now


----------



## SirDice (Mar 29, 2019)

mod3777 you are responding to an 8 year old thread.


----------



## mod3777 (Mar 29, 2019)

SirDice said:


> mod3777 you are responding to an 8 year old thread.



Intentionally did that. I was learning about dbus, and got this post.


----------



## neilulrich (Apr 19, 2020)

thanks


----------



## Voldedore (Oct 16, 2021)

jrm@ said:


> Can anyone give a specific example where *dbus* is useful?


For non-English speakers, especially users from eastern countries, dbus is one of many "requirements" to be productive on *nix systems.

I'm struggling with dbus, firefox, fcitx (and its clone zh-fcitx) but I only managed to type Vietnamese on st, which is not enough.

Sorry if my comment is not relevant due to a decade late.


----------

