[SOLVED] Caja error when entering Mint 19, can't see files

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
trope
Level 4
Level 4
Posts: 320
Joined: Tue Feb 19, 2013 1:10 pm

[SOLVED] Caja error when entering Mint 19, can't see files

Post by trope »

I installed Mint 19 on an SSD (with the /home, /root, and /swap) and encrypted an HDD (using the Disks utility) with a data partition that prompts me for a password during boot to mount it. I modified the user-dirs.dirs file in .config to point all the traditional Home folders to the same named folders on the HDD. Because it was resetting after each boot and not showing the right folders, I made the file user-dirs.conf which includes enabled=False.

However now after I enter the regular Mint password and log-in, I get the error message:
Caja could not create the required folder "/media/name/data/Desktop".
Before running Caja, please create the following folder, or set permissions such that caja can create it.
When I look at the Desktop directory, it seems to have nothing in it when I open it. In fact, I thought it deleted all the files and spent 7 hours restoring them from a backup. But when I right-click on it and properties, it has the correct GB number, suggesting that the files are there (now duplicated due to my backup), but I don't see how I can access any of them.

I found a similar error message online and tried the code in it (with my name), but it did not help:
https://bbs.archlinux.org/viewtopic.php?id=130025

Code: Select all

sudo chown name:name ~/.config
Does anyone know what the error message means and how I can fix it? I would like the Desktop directory to be on the HDD. Much appreciate any help.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Caja error when entering Mint 19, can't see files

Post by smurphos »

The easiest way to achieve this is to leave user-dirs.dirs in it's default state and replace the default folders in home with symlinks of the same name pointing at the relevant folders in your Data Directory.

They won't break if the Data Disk is unavailable for any reason.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
trope
Level 4
Level 4
Posts: 320
Joined: Tue Feb 19, 2013 1:10 pm

Re: Caja error when entering Mint 19, can't see files

Post by trope »

I think some symlinks were created, or I created them in the process of doing something. How do I delete them so I can start over?

Code: Select all

ls -l
drwxrwxr-x 2 name name 4096 Sep  3 15:36 Desktop
drwxrwxr-x 2 name name 4096 Sep  3 15:28 Documents
drwxrwxr-x 3 name name 4096 Sep  4 00:28 Downloads
drwxrwxr-x 2 name name 4096 Sep  3 15:36 Music
drwxrwxr-x 2 name name 4096 Sep  3 15:36 Pictures
drwxrwxr-x 2 name name 4096 Sep  3 15:36 Public
drwxrwxr-x 2 name name 4096 Sep  3 15:35 Templates
drwxrwxr-x 2 name name 4096 Sep  4 15:52 Videos
name@name-Latitude-E6440:~$ unlink Desktop
unlink: cannot unlink 'Desktop': Is a directory
name@name-Latitude-E6440:~$ unlink Documents
unlink: cannot unlink 'Documents': Is a directory
name@name-Latitude-E6440:~$ unlink /media/name/Desktop
unlink: cannot unlink '/media/name/Desktop': No such file or directory
name@name-Latitude-E6440:~$ unlink /media/name/data/Desktop
unlink: cannot unlink '/media/name/data/Desktop': Is a directory
Next, when I make the symlink, how do I get it so that when I click on the directory in the Home folder, it shows the contents of the same directory on the data partition? Eg I used the following code for videos:

Code: Select all

 ln -s /media/name/data/Videos $HOME/Videos
But when I click on Videos in the Home folder, it shows a folder called Videos in the data partition which I then have to click on to see the contents.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Caja error when entering Mint 19, can't see files

Post by smurphos »

trope wrote: Tue Sep 04, 2018 4:08 pm

Code: Select all

 ln -s /media/name/data/Videos $HOME/Videos
But when I click on Videos in the Home folder, it shows a folder called Videos in the data partition which I then have to click on to see the contents.
ln -s /media/name/data/Videos $HOME/ is the correct syntax but as far as I know ln is not able to overwrite an empty folder with a symlink of the same name.

In Cinnamon I find it easier to do it in the GUI filemanager Nemo. You might be able to emulate these steps in Mate/Caja.

Running with two panes, one open to my home folder with the default folders in place, empty with user-dirs.dirs in it's default state and one to the drive with the intended targets I right click on the target and click 'make link'. In nemo that creates a link called 'Link to <folder>'. I then temporarily cut and paste that link to a different location (anywhere it does not matter), then rename to Videos or Pictures or whatever. I then cut and paste the renamed symlink to the Home directory - it'll will warn about conflicts but will allow you to merge. Done.

To do this via the command line I think you would need to delete the default normal folders first, then use ln -s /media/name/data/<folder> $HOME/ for each folder in turn, and once done go back and rebuild the user-dirs.dirs to default.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
trope
Level 4
Level 4
Posts: 320
Joined: Tue Feb 19, 2013 1:10 pm

Re: Caja error when entering Mint 19, can't see files

Post by trope »

The procedure worked, as the other one did, only when I log in and out of Mint. But when I reboot, I got an error message that the /media/name/data/Desktop did not exist (but it obviously did exist and was accessible). The user-dirs file also got reset such that all home folders pointed to $HOME. I did more research and have not found anyone who has been able to use home folder symlinks to an encrypted partition:

https://askubuntu.com/questions/100020/ ... rnal-drive
https://askubuntu.com/questions/185290/ ... 412#607412

From what I have been able to gather from one of the above answers, the system accesses the /home folder BEFORE the auto-mount of the encrypted partition, even though it seems that I enter my passphrase first during boot, and then later the system loads up Mint. So I am not sure this problem is fixable. Would there be some code to change the order of those 2?

Another possible solution, but it seems clunky - could I use a script from within Mint (maybe that runs by itself on log-in), which replaces the user-dirs directory? I would then manually log out and log in again. Since the user-dirs file would be correct at that point, it would just be replaced by the same file by the previous script.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Caja error when entering Mint 19, can't see files

Post by smurphos »

I've just tested on my system disconnecting my external data directory before booting, I see the same issue. The symlinks survive and repair when the drive is made accessible again but user-dirs.dirs remains broken

I doubt my memory now as I thought this wasn't an issue in 18.3 but thinking about it that wouldn't make sense.

i think the start-up script idea to repair user-dirs.dirs is the answer. Here's one i just cooked up.... :)

You'll need to define a TESTDIR in the script - i.e a directory which is only accessible once the data drive is unencrypted. You'll also need a copy of the default user-dirs.dirs called user-dirs.backup in your $HOME/.config. I've just done a quick test with this and it works OK.

One thing I've not checked because I don't symlink out Desktop is whether Desktop is a special case....I think it might be given your error message presumably from caja when it can't find it initially.

Code: Select all

#!/bin/bash
#Script to repair user.dirs.dirs
#Test directory to check for
TESTDIR=/mnt/backup_drive/Documents
#Wait until the target drive is accessible
while [ ! -d "$TESTDIR" ]
do
	sleep 5
done
#Copy a backup of the default user-dirs.dir to user-dirs.dir
cp "$HOME/.config/user-dirs.backup" "$HOME/.config/user-dirs.dirs"
#Update user-dirs.dirs
xdg-user-dirs-update
exit
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
trope
Level 4
Level 4
Posts: 320
Joined: Tue Feb 19, 2013 1:10 pm

Re: [SOLVED] Caja error when entering Mint 19, can't see files

Post by trope »

@gm10 pointed out a way to turn off the resetting of the content-dirs file in the Startup Applications, another option is to create the user-dirs.conf and enabled=False, but in both cases, I realized I have to open the data partition in the file manager, and THEN log out and back into Mint, and the directories are okay and no Caja error message.
Locked

Return to “MATE”