The officially official Devuan Forum!

You are not logged in.

#1 Today 20:07:27

greenjeans
Member
Registered: 2017-04-07
Posts: 1,163  
Website

Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

So both the folders mentioned in the title contain a dbus file for the session you're in, and generate a new one every time you re-boot, but it's not deleting the old ones, just checked my main partition which was installed in Nov. 2023 and it has over 750 files in that session-bus folder.

Root creates a new one too any time you log-in as root, and those build up as well.

Seems like something ought to clear the old one(s) out when you shutdown.

@fsmithred ; in the Refracta-Snapshot excludes file, /home/(user)/.dbus is excluded, and so when you boot/install the live iso it just has the new one created when you boot up. But root's version is not excluded by default, lol just found a lot of files in a new version of Vuu-do i'm making in root's .dbus directory, about 150 of 'em.

Could the /root/.dbus directory be safely excluded as well?

Bleachbit isn't set to clean the .dbus/session-bus folder because you can't remove all of them, you need the most recent one. But am wondering if something could/should be added to a shutdown script to remove the old files.


https://sourceforge.net/projects/vuu-do/ New Vuu-do isos uploaded August 2025!
Vuu-do GNU/Linux, minimal Devuan-based Openbox and Mate systems to build on. Also a max version for OB.
Devuan 5 mate-mini iso, pure Devuan, 100% no-vuu-do. wink Devuan 6 version also available for testing.
Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#2 Today 20:26:11

golinux
Administrator
Registered: 2016-11-25
Posts: 3,543  

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

Disk space is not an issue for me but I still I checked my stats for /.dbus/session-bus/:

125 items, totaling 56.2 KiB (57,552 bytes)

@fsmithred: Should I do some housecleaning?

Offline

#3 Today 21:13:59

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,703  

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

Nice find. I'll add it to the excludes file. You should probably keep the newest one, but the rest can be deleted.

I've got over 200 of them and I hardly ever reboot. The file name is your dbus machine-id which changes on every reboot in devuan unless you edit /etc/default/dbus or run a script that changes it for you. (I have one)

OK, I just ran my script and changed /var/lib/dbus/machine-id. The file in ~/.dbus/session-bus did not change, but when I switched to root in a terminal, the new id was in /root/.dbus/session-bus. I guess if I log out and in, then user will get the new number.

Maybe this needs another line or two. (Note: Most of this code was borrowed from a live-config script.)
EDIT: Note 2: no guarantee that it won't screw something up that needs a consistent machine-id. Also no guarantee that it will prevent your machine from being identified.

#!/bin/sh
# update-machineid
# Change /var/lib/dbus/machine-id manually.

MACHINEID=/var/lib/dbus/machine-id
UUIDGEN=/usr/bin/dbus-uuidgen
UUIDGEN_OPTS=--ensure

if [ "$(id -u)" -ne 0 ] ; then
        echo " You need to be root."
        exit 1
fi

if [ -f "${MACHINEID}" ] && [ -x "$UUIDGEN" ] ; then
	OLD_ID=$(cat $MACHINEID)
	rm -f "${MACHINEID}"
    $UUIDGEN $UUIDGEN_OPTS
	NEW_ID=$(cat $MACHINEID)
	notify-send -t 5000 "Changed dbus machine-id
 old: $OLD_ID
new: $NEW_ID" 
fi

exit 0

Offline

#4 Today 21:27:48

Altoid
Member
Registered: 2017-05-07
Posts: 1,825  

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

Hello:

greenjeans wrote:

Seems like something ought to clear the old one(s) out ...

Passed by, saw your post and decided to see what was up in my Daedalus installation:

~$ ls -h -l ~/.dbus/session-bus
total 12K
-rw-r--r-- 1 groucho groucho 462 Sep 17 17:32 26a708d3d7dc6778fc6ff9f55921b024-0
-rw-r--r-- 1 groucho groucho 462 Jun 10  2024 26a708d3d7dc6778fc6ff9f55921b024-1
-rw-r--r-- 1 groucho groucho 465 Mar 14  2019 26a708d3d7dc6778fc6ff9f55921b024-2
~$ 

Newest entry is from today, the time is (most probably) when I booted/logged in.
But there are two more: one from last year and yet another one but from 2019. (!)

# ls -h -l ~/.dbus/session-bus
total 8.0K
-rw-r--r-- 1 root root 463 Sep 11 21:47 26a708d3d7dc6778fc6ff9f55921b024-0
-rw-r--r-- 1 root root 469 Oct 17  2018 26a708d3d7dc6778fc6ff9f55921b024-1
# 

I don't do too much root but I must have done something last 11/09.
And last 17/10/2018 also. (!)  <---  soon to be 7 years old, when Jesse was running this box.

I concurr, there may be some housekeeping to do.

@greenjeans: good catch ...
Q: these files are supposed to be temporary ie: belonging to the current session, right?

Edit:
I never leave my box on, just in case.
I boot the system early while I make my espresso and do not leave it on if I am not home or not doing something on it. eg: clonezilla backups
So it gets rebooted at least a half dozen times a day, sometimes more.

Probably the reason why my file count was so low compared to you, @golinux and @fsmithred.
But still, why did I have (nuked them) files from 2024, 2019 and 2018?

Best,

A.

Last edited by Altoid (Today 21:40:15)

Offline

#5 Today 21:45:13

greenjeans
Member
Registered: 2017-04-07
Posts: 1,163  
Website

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

So it gets rebooted at least a half dozen times a day, sometimes more.

You should have a ton of files then, for some reason yours is kicking out the old ones.

To clarify i'm running Daedalus too. weird.


https://sourceforge.net/projects/vuu-do/ New Vuu-do isos uploaded August 2025!
Vuu-do GNU/Linux, minimal Devuan-based Openbox and Mate systems to build on. Also a max version for OB.
Devuan 5 mate-mini iso, pure Devuan, 100% no-vuu-do. wink Devuan 6 version also available for testing.
Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#6 Today 21:56:44

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,703  

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

I should have mentioned this in my last post. Default behavior in devuan is for /var/lib/dbus/machine-id to be replaced on reboot. This can be disabled to revert to the upstream default by commenting the line that says: IDTYPE="RANDOM" in /etc/default/dbus. If you do that, the id number will be constant. I don't know if there are other situations where it will change. Maybe on update of dbus packages? That's just a guess.

Offline

#7 Today 22:36:55

Altoid
Member
Registered: 2017-05-07
Posts: 1,825  

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

Hello:

greenjeans wrote:

... should have a ton of files then ...

Why?

Not if it is (as you have mentioned) working properly.
ie: renewing the files on every boot.

Still, I did have those two very old files.

I rebooted after nuking the vintage files and the system replaced the previous valid one with a new one.
ie: just one file with the proper boot time/date present.

greenjeans wrote:

... for some reason yours is kicking out the old ones.

Lately I have mentioned that my present system ie: Daedalus started off as Jesse and from the date of the oldest file I found in the root didrectory, that would have been back in 2017.

Makes sense, my first post here is from that year.

The fact that this box has seen a succession of dist-upgrades, with all but one (a Beowulf to Chimaera nightmare) being reasonably smooth may have to be taken into account to evaluate this find.

Could it be that there was a change (or introduced bug) in how dbus managed those files and my system (at some point) retained a previous configuration? No idea, just a guess.

Let me know if you need more data.

Best,

A.

Offline

#8 Today 22:57:13

RedGreen925
Member
Registered: 2024-12-07
Posts: 162  

Re: Growing file bloat in ~/.dbus/session-bus and /root/.dbus/session-bus

Strange mine seems to work just fine without any of it in the root directory, the user directory seems to just have directories with nothing in them..

zeus@9600k:~$ du -h .dbus/
12K	.dbus/session-bus
16K	.dbus/

root@9600k:~# du -h .dbus/
du: cannot access '.dbus/': No such file or directory

root@9600k:~# cat /etc/os-release
PRETTY_NAME="Devuan GNU/Linux 6 (excalibur)"
NAME="Devuan GNU/Linux"
VERSION_ID="6"
VERSION="6 (excalibur)"
VERSION_CODENAME="excalibur"
ID=devuan
ID_LIKE=debian
HOME_URL="https://www.devuan.org/"
SUPPORT_URL="https://devuan.org/os/community"
BUG_REPORT_URL="https://bugs.devuan.org/"

Edit: I would add I did nothing special to disable any of it.

Last edited by RedGreen925 (Today 22:59:07)

Online

Board footer