rmdir /home/[user] in xessions errors XU1204.02

Asked by Galen Thurber on 2013-03-19

inside my .xsessions-errors file
I'm getting

openConnection: connect: No such file or directory
cannot connect to brltty at :0
rmdir: failed to remove `/home/west/': Permission denied
mv: `/home/west/Templates' and `/home/west/Templates' are the same file
Templates migration failed

I've used catfish and text searched (hidden, home folders, and with sudo catfish / folders) for any scripts that could be attempting to rmdir and have found nothing.
System reports clean with lynis & rkhunter
Any ideas?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Galen Thurber
Solved:
2013-03-26
Last query:
2013-03-26
Last reply:
2013-03-20
Nik.Th. (nick-athens30) said : #1

Hi Galen Thurber,

this seems to me like a startup script that attempts to remove the personal home folder of "west" .

If it was a strong script then the /home/west/ folder would have been already removed. Check in startup applications for a script.

   ls /etc/xdg/autostart/

OR

maybe it is a cronjob. See

   corntab -e

Regards
 NikTh

Galen Thurber (godfree2) said : #2

I'll manually check
/etc/xdg

at-spi-dbus-bus.desktop onboard-autostart.desktop
blueman.desktop polkit-gnome-authentication-agent-1.desktop
clipit-startup.desktop print-applet.desktop
gnome-keyring-gpg.desktop pulseaudio.desktop
gnome-keyring-pkcs11.desktop pulseaudio-kde.desktop
gnome-keyring-secrets.desktop update-notifier.desktop
gnome-keyring-ssh.desktop user-dirs-update-gtk.desktop
gsettings-data-convert.desktop xfce4-notes-autostart.desktop
jockey-gtk.desktop xfce4-power-manager.desktop
nm-applet.desktop xfce4-settings-helper-autostart.desktop
nvidia-autostart.desktop xfce4-volumed.desktop

cronjob is not a program on my XU

Galen Thurber (godfree2) said : #3

So far nothing found in /etc/xdg/autostart/ entries

I've also followed links and checked:

/usr/lib/at-spi2-core
those are binaries

gsettings-data-convert.desktop
to
/usr/share/GConf/gsettings

nothing found

and nothing in
/etc/xdg/xdg-xubuntu

Nik.Th. (nick-athens30) said : #4

Hi ,
try to empty the file .xsession-errors and see then reboot and see again if the message exists.

   > .xsession-errors

above command will empty the file .xsession-errors

Regards
 NikTh

Galen Thurber (godfree2) said : #5

it also exists in .xsession-errors.old

Galen Thurber (godfree2) said : #6

it happens every time I log in,
I've logged out and wiped .xsession-errors
and soon as I log in the
rmdir: failed to remove `/home/west/': Permission denied
is back

I've had an open tty and tried
lsof >lsof.txt
lsof |grep errors |less
but have not found anything odd
it runs: commands (trucated names) that access .xsession-errors
sh
xscreensa
xfce4-ses
xfwm4

I have also rechecked any xfce4-session scripts and have found nothing strange.
I will archive and delete those sessions to see if that helps

Galen Thurber (godfree2) said : #7

I have no sessions. Dead end

Galen Thurber (godfree2) said : #8

what happens after the lightDM starts login and the xfce4 session?
Is there something before xinitrc?
Is there something infecting bash that rkhunter and other rootkits that are not picking up?

Galen Thurber (godfree2) said : #9

089ed56cd74e63f461bef0fdfc2d159a /bin/bash

Galen Thurber (godfree2) said : #10

I've installed Icewm and logged in.
It does not create the weird entries that xfce4 does.

Galen Thurber (godfree2) said : #11

I asked over at XFCE4 forums

Solved. No reason what was going on.
I was not using sessions, but I decided to turn save session on and get prompted on login.
That cleared the faulty default session.
Wish there was a way to check for corrupt sessions.

Jerry West (jerry-west) said : #12

For anyone else who finds this...

The message comes from /etc/xdg/xfce4/xinitrc. This script runs every time you login (via the GUI) and yet tries to "migrate" various folders (a one off task) each time.

To ratify this, check the script /etc/xdg/xfce4/xinitrc, lines 70-77 or thereabouts or just grep for the error message:

   grep "Templates migration failed" /etc/xdg/xfce4/xinitrc

To fix:

There should be a hidden folder ".config" in your home directly. In that folder is a file called "user-dirs.dirs". Take a look at it.

This files defines various XDG_* environment variables, including XDG_TEMPLATES_DIR. You will see that in your case, this variable has been set to "$HOME/". It's the above mentioned script that tries to remove XDG_TEMPLATES_DIR (i.e. your home directory!). Fortunately it will only remove empty directories - it's attempting to clear the way for a later rename/mv.

The comments at the top of this user-dirs.dirs file are actually pretty helpful...

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.

So the fix is to edit the line to replace XDG_TEMPLATES_DIR="$HOME/" with XDG_TEMPLATES_DIR="$HOME/Templates".

The script will now notice that XDG_TEMPLATES_DIR is already set to "$HOME/Templates" and will not attempt the migration.

You might also check that XDG_DESKTOP_DIR points to "$HOME/Desktop" as well, as the script tries the same trick with that.

Hope that helps.

Jerry