8

What are all of these PID files doing in my home directory?

$ ls -1 ~/upstart-*
/home/mark/upstart-dbus-bridge.4885.pid
/home/mark/upstart-file-bridge.4885.pid
/home/mark/upstart-udev-bridge.10317.pid
/home/mark/upstart-udev-bridge.4885.pid
/home/mark/upstart-udev-bridge.6044.pid
/home/mark/upstart-udev-bridge.6406.pid
/home/mark/upstart-udev-bridge.6650.pid

Most are current. If I try to remove them, they will (eventually) come back (albeit with new IDs, etc.).

ps shows the following, for example:

4 S mark      4885  5319  0  80   0 - 27317 poll_s Nov21 ?        00:00:00 /sbin/upstart --user

The same is happening for other users on the same system as well.

Per Jos's comment, the setups of /run / /var/run appear to be correct:

$ mount|grep run
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1633648k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)

$ ll /var/run
lrwxrwxrwx 1 root root 4 Oct 28  2013 /var/run -> /run/

Surely this isn't by design, or that there must be a better place to keep these? As-is, they are not hidden files, nor are they in a hidden directory. This is messy, and result in a longer listing of things I need to look through in what should otherwise be a very clean and organized ~.

I think this started after one of my last upgrades which included systemd. Is this typical, or do I maybe have something else here influencing this that I need to further investigate? (I have gotten a bit lazy here on this system, and haven't performed a clean install for the past few releases - maybe time for a clean install?)

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=15.10
DISTRIB_CODENAME=wily
DISTRIB_DESCRIPTION="Ubuntu 15.10"

(This would seem to be something that should be resolved by a simple search, but my Google-fu appears to be failing me with this concern.)

8
  • 1
    These pid files ought to be created in /var/run which is a symbolic link to /run. They are written every time you connect an USB device. I suspect the /run folder, in itself a tmpfs file system, is accidentally mounted in your home directory. Please edit your question and add the output of mount (or mount | grep run).
    – Jos
    Nov 23, 2015 at 7:09
  • @Jos - additional information provided as requested. They appear correct - but also, if one of these were mounted to inside my home directory, wouldn't this only affect my own home directory, and not the other accounts on the system as well?
    – ziesemer
    Nov 23, 2015 at 16:16
  • OK, different approach. I'm beginning to think that the upstart-udev-bridge process and the others are not executed as root, and are therefore not allowed to write the pid file to /var/run; they fall back to writing it to the user's home directory.
    – Jos
    Nov 23, 2015 at 17:56
  • @Jos - Agreed, which is also supported by the ps listing. So I'm curious if this is "normal"? I.E., do you or anyone else see the same on an Ubuntu 15.10 installation - or do I have something amiss here? I can understand the PID files needing to be in my home directory for user-owned processes - but they should be hidden somehow, and not cluttering the top of my home directory...
    – ziesemer
    Nov 23, 2015 at 22:18
  • I notice that on my 15.10 system I have all of these processes running as my user. I don't see any .pid files anywhere, but I have no USB-connected network devices. I'll take a closer look tomorrow.
    – Jos
    Nov 23, 2015 at 23:13

1 Answer 1

5

These files are there because several components in your system conform to the XDG Base Directory Specification and expect the environment variable XDG_RUNTIME_DIR to be set. If not set, the user's home directory is used.

pam-systemd is the component that sets XDG_RUNTIME_DIR to /run/user/$UID, where $UID is the effective user id for the user. In your case, pam-systemd has not run or has otherwise misbehaved, that is hard to tell. But you can easily set the XDG_RUNTIME_DIR at boot time yourself, as follows: sudo nano /etc/profile and add the following lines:

XDG_RUNTIME_DIR=/run/user/$UID
export XDG_RUNTIME_DIR

From the next reboot on, the .PID files will no longer clutter your home directory.

2
  • I have similar issues. I added the lines which you mentioned in .bashrc file, not in /etc/profile. Will that work ? Also is it safe to delete existing upstart pid files which are cluttering up home directory?
    – Kinjal
    Feb 16, 2016 at 5:57
  • 1
    I am not completely sure whether it will work. Nothing will break, however you may keep seeing .pid files in your home directory. In any case they can be safely deleted.
    – Jos
    Feb 16, 2016 at 9:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .