Error when saving MLX file

59 views (last 30 days)
Agustín
Agustín on 10 Oct 2022
Commented: Charles Ragan on 8 Aug 2023
I am using MATLAB R2022a in Ubuntu 20.04.5 LTS (Kernel 5.15), and whenever I try so save a .m script file I have no issues, however when I try to save a Live Editor file (.mlx), I get the next error:
Unable to save file myFile.mlx
java.lang.RuntimeException: Internal Exception in writing MLX file : Could not commit changes: copy failed: fl:filesystem:SystemError: /tmp/.bdae-ce03-39f3-5965.tmp invalid cross-device link
I have tried with R2022b, but the problem persists. I have another Ubuntu station (Kernel 5.4) and it does write the file. I have read about similar errors depending on the Kernel version. Is there any solution that does not include downgrading the Kernel?

Accepted Answer

Sailesh Kalyanapu
Sailesh Kalyanapu on 14 Oct 2022
I understand that you are getting an error when saving 'MLX' files in MATLAB R2022a and R2022b.
This is a known issue with MATLAB R2022 releases. Currently, these are the following workarounds other than downgrading the Linux kernel:
1) Change the temp directory of MATLAB to a new folder
The default temp directory of MATLAB on Linux is '/tmp/', to resolve the issue, you can create a new folder in a different file directory and set it as the new temp directory.
Please refer to the following example to change the temp directory of MATLAB in the MATLAB Command Window:
>> clear all
>> tempdir % ans = '/tmp/'
>> setenv('TMPDIR', 'FILE DIRECTORY FOR THE NEW FOLDER')
>> clear all
>> tempdir % ans = 'FILE DIRECTORY FOR THE NEW FOLDER'
You should be able to save all MLAPP files/ Simulink models/ Live Scripts as usual after changing to the new temp directory.
If the above workaround does not resolve the issue, try to
2) Use MATLAB Online:
MATLAB Online provides access to the latest version of MATLAB from a standard web browser using MathWorks-hosted computing resources and storage, which allows you to continue working with your previous files and related datasets.
Please refer to the following link to upload the files to MATLAB Online and download files from it: https://www.mathworks.com/help/releases/R2022b/matlab/matlab_env/access-files-in-matlab-online.html
If you would like to know more about what is MATLAB Online, please refer to the link below: https://www.mathworks.com/help/releases/R2022b/matlab/matlab_env/what-is-matlab-online.html
  7 Comments
Riccardo Scorretti
Riccardo Scorretti on 16 Jan 2023
Edited: Riccardo Scorretti on 17 Jan 2023
I'm sorry to say that it works for me, but only partially.
I run Fedora 37, kernel version = 6.1.5-200.fc37.x86_64.
I'm using the software gocrypt to ecrypt the directory which contains my work. Basically, it works like a volume which has to be mounted when I start my PC -- let say that /home/scorretti/private is the mounting point.
I created a directory in my home directory, then I set it as Matlab temporary directory:
mkdir /home/scorretti/.matlab_tmp_dir
setenv('TMPDIR', '/home/scorretti/.matlab_tmp_dir')
clear all
tempdir % just to check that the temporary directory is correctly set
Up to my understanding, the problem comes up when the temporary directory is on a different volume than the volume where the file has to be saved. The previous code doesn't allow me to save the in my enchrypted volume. In order to work, I must set as temporary directory a directory inside the enchrypted volume: that's work:
mkdir /home/scorretti/private/.matlab_tmp_dir
setenv('TMPDIR', '/home/scorretti/private/.matlab_tmp_dir')
clear all
This seems coherent with the observation by 隆支 鈴木. There is a technical discussion on a similar issue on unix.stackexchange.com:
I hope this problem will be solved in the next upgrade of Matlab.
Charles Ragan
Charles Ragan on 8 Aug 2023
I was having this issue with not being able to save mlx files in R2022b in MOS on OpenShift. The solution above worked for me.

Sign in to comment.

More Answers (1)

Charles
Charles on 24 Oct 2022
I am having this problem, too, but the above work-around does not work.
Without the work-around, I get this error dialog:
This mentions the "cross-device link".
Then I change the temp directory to one under my home dir: '/home/cwright/.matlab_tmp/'. I open a new model in Simulink, add one block and try to save. I get this error dialog:
Clearly, the new temp dir isn't good enough. So I close the file without saving, then attempt to exit Matlab. The GUI disappears, but the process never quits, in fact it starts taking 100% of the CPU (single core) and requires manually killing. This happens with or without the temp dir change.
This is pretty frustrating, as I'm on a trial Simulink license. Simulink works perfectly on my machine at work, but not my home machine. Both are running Linux Mint 20.3 with identical kernels:
Linux 5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
They are two different processors and mainboard. I guess the next step is to downgrade the kernel, but I'd appreciate other suggestions.
Charles

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!