Simbiology "Project Save Error"

For some reason I cannot save simbiology projects. When I try (for new files, and files I've loaded) I'm now getting:
"Project Save Error
Error occurred while saving the project
Could not move project"
This is in Ubuntu 22.04. ver gives me
MATLAB Version: 9.12.0.2009381 (R2022a) Update 4
MATLAB License Number: 4xxxxxxxxxxx
Operating System: Linux 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Pretty sure that this is a permissions error. BTW,
tempdir
returns
'/tmp/'

 Accepted Answer

Hi, Jim,
I'm sorry that you are running into issues while saving your project. The behavior you describe sounds like what we see when trying to save a project to a write-protected directory (SimBiology will force save over a write-protected file). We can confirm this if you try typing
[lastmsg, lastid] = lasterr;
at the MATLAB command line. If lastmsg is 'Error using movefile Operation not permitted' and lastid is 'MATLAB:MOVEFILE:OSError', then it is probably a permissions issue with the destination directory of the project. If you get a different lasterr output, please send us that information and we can investigate what else might cause such an error.
Best,
Priya

10 Comments

Sequence was
1) Open a sbproj file using simbiology('model.sbproj')
2) Attempt to save as 'model_new.sbproj')
3) Error dialog box opens (see original post).
4) Then the command suggested results in:
>> [lastmsg, lastid] = lasterr
lastmsg =
'Error using movefile
Invalid cross-device link'
lastid =
'MATLAB:MOVEFILE:OSError'
Priya Moorthy
Priya Moorthy on 16 Nov 2022
Edited: Priya Moorthy on 16 Nov 2022
Hi, Jim,
Thanks for the lasterr information; that helps identify the root cause of the issue.
There is a known issue with accessing the temp directory during save operations on certain Linux distributions in MATLAB versions R2022a and R2022b. The issue is being actively investigated.
There are three workarounds you could try:
  1. Change the temp directory before starting MATLAB or SimBiology (SimBiology caches the tempdir location when SimBiology is first used in a MATLAB session, so changing the tempdir afterwards will not have an effect in SimBiology). You can either change tempdir from the MATLAB command line before running your first SimBiology command, or you can just redefine the environment variable before launching MATLAB from the bash shell: "TMPDIR='~/tmp/' matlab".
  2. Switch to R2022b Update 1 to resolve the issue for SimBiology (but not MATLAB in general). A separate bug fix in this update release moved SimBiology away from using the temp directory to store app data, which will effectively resolve your issue as well.
  3. Switch to using a lower kernel version; this bug seems to occur in version 5.15.48-generic or higher.
I hope that one of these workarounds enables you to resume your work in SimBiology.
Best,
Priya
Priya,
Thanks. I am downloading R2022b. I did try this, which did not work:
Open matlab
tempdir = '~/tmp/'
simbiology('test.sbproj')
Then I tried to save test.sbproj as test_mod.sbproj and I get the same error dialog box. Perhaps I did this wrong? If so, please state explicit steps to try to patch this (e.g. do not say "change tempdir": please give me the exact commands and sequence I should use.)
There is another issue that I think is related, when I try to open other sbproj files in the directory, they don't load. So I think R2022a's foibles blew away several of my models. I can recover them, but the general issue (where matlab/simbiology destroys work) is truly unacceptable.
The behavior is that I use simbiology('modelfile.sbproj') for a model file that I've used before and ML/SB acts like its going to open the file. Then it stops: I have a blank model diagram and no model content.
Hi, Jim,
The exact steps for changing the temp dir location after starting MATLAB can be found here:
Basically, you will need to clear tempdir and then set the enviromment variable:
tempdir % to see the original location
clear tempdir
setenv('TMPDIR','~/tmp/')
tempdir % to see the new location
The same tempdir incompatibility could cause issues with load. If this fix doesn't address the load issue as well, we can investigate further. The SimBiology project should not be automatically resaved on load, so even if load fails, your already saved projects should not be corrupted. Can you clarify if the project contents are not shown in the app after loading or if you are seeing the original file disappear or change after loading?
Best,
Priya
Ok, with those commands run, now the system won't even load my sbproj file. We are going backward.
Is this a problem with everyone running Ubuntu 22.04, or just me?
If the problem is understood, can you say with certainty that installing ML R2022b will solve the problem?
Again, Matlab/Simbiology is useless to me unless this gets fixed. How to escalate?
Priya Moorthy
Priya Moorthy on 18 Nov 2022
Edited: Priya Moorthy on 18 Nov 2022
Jim,
We expect that installing MATLAB R2022b Update 1 should prevent you from encountering this bug in SimBiology (the 22b General Release will not have the change). As of 22b Update 1, SimBiology no longer uses the tempdir for temporary app storage to avoid other issues with data loss from the temp dir.
The bug will still be present in general MATLAB. The MathWorks is aware of and is actively working to address workarounds. I will update this thread when I can provide more details.
Priya
Hi Jim,
MATLAB version R2022a is not supported on Ubuntu 22.04 LTS. Even though most functionality works, there can be subtle (and severe) breaking incompatibilities.
We can reproduce the save issue with SimBiology in R2022a on Ubuntu 22.04. And I was able to work around the problem as follows:
  1. Start MATLAB
  2. Execute the following command in the MATLAB Command Window:
% This will cause MATLAB to use a tmp/ directory your home folder:
setenv('TMPDIR', '~/tmp');
It is important that this command is executed before you call anything related to SimBiology. SimBiology will cache the temp. directory otherwise and this change would not have any effect. This command has to be executed every time you start MATLAB; but you could change your tmp directory in the shell you are starting MATLAB from. Please let us know if this does not solve the save issue.
Even though this hopefully unblocks you from using SimBiology in MATLAB R2022a on Ubuntu 22.04, I strongly recommend upgrading to R2022b, the first MATLAB version supported on Ubuntu 22.04. I confirmed that SimBiology projects can be saved in R2022b. As Priya mentioned, when upgrading MATLAB please install the latest update release available for R2022b.
Let us know if you continue to see the issue.
Thanks,
Florian
I installed R2022b and this works.
Apparently trying to save files with R2022a r5 appears to have blown the model file away.
I could be wrong but the sequence
>simbiology('myfile.sbproj'); % this would open a file
Then trying to save the file using the simbiology tool bar (e.g. "Save as...") would fail with the dialog box noted above.
Then closing simbiology and repeating
>simbiology('myfile.sbproj');
Would fail to open the file: there would be no graphical file, and no model content in simbiology.
Same thing if one did not close simbiology but then tried to reopen the file from simbiology. Blank screen and content.
Priya Moorthy
Priya Moorthy on 29 Nov 2022
Edited: Priya Moorthy on 29 Nov 2022
Hi, Jim,
SimBiology tries to save a backup of your project file in *.sbproj.bak in the same directory as your original sbproj file. This backup may have your original model with diagram. However, given your current Linux version, you should continue to use R2022b Update 1 or later to avoid this bug altogether.
Best,
Priya
Priya Moorthy
Priya Moorthy on 5 Dec 2022
Edited: Walter Roberson on 31 Jan 2023
Jim,
I just wanted to inform you about the recently published bug report which consolidates all the different workarounds for this issue outside of SimBiology: https://www.mathworks.com/support/bugreports/2856360
Best,
Priya

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 15 Nov 2022
Edited: Walter Roberson on 15 Nov 2022
you are potentially seeing the relatively recent issues due to Linux kernel changes in how files are copied, changes that mostly affect tempfs.
The workaround is to create a temporary directory on an ordinary file system and create an environment variable TMPDIR or TEMP (if I recall correctly) pointing there, and start matlab with that in effect. If you are starting from an icon you might need additional steps to have the environment variable in effect at the time of program launch as icons do not go through the full login sequence that interactive shells go through.

4 Comments

Walter,
Thanks. There is code from the MW support team that seems to indicate that you set TMP for Windows and TMPDIR otherwise, see below. Does this sound right?
I followed your directions
Created ~/tmp
chmodded 777 ~/tmp
setenv('TMPDIR','~/tmp');
But weirdly, I got
tempdir
ans = '/tmp/'
No luck with saves.
I then did
clear tempdir
setenv('TMPDIR','~/tmp/')
tempdir
ans = '/home/jim/tmp/'
Still no luck saving.
Plus, my sbproj files all seem to have been corrupted when I try to open them... Is nobody else having problems with simbiology in Ubuntu 22.04? The product is unusable right now.
Example for changing tempdir, from the MW support team, here.
tempdir %show unchanged tempdir
clear tempdir
if ispc %check if Windows
setenv('TMP','NEW_DIRECTORY_PATH')
else
setenv('TMPDIR','NEW_DIRECTORY_PATH')
end
tempdir %show and refresh tempdir with new path
Walter Roberson
Walter Roberson on 16 Nov 2022
Edited: Walter Roberson on 5 Dec 2022
https://www.mathworks.com/matlabcentral/answers/97720-how-do-i-change-the-temporary-directory-that-matlab-uses#comment_2449208 where I point out the "after a restart". So the environment variable needs to exist when you start matlab. Which is why I talked about icons, since .bashrc and similar are not processed when you use icons so you may need to take additional steps. If the icon permits executing a script that sets the variable first that is probably the best approach.
So if I'm opening matlab using an icon, in ubuntu, with a .desktop file. How do I get the tempdir set permanently?
Also, I'm using zshell, and I suppose the same Bourne shell command would work in a .zshrc file.
Sorry to be so dense...

Sign in to comment.

Communities

More Answers in the  SimBiology Community

Products

Release

R2022a

Tags

Community Treasure Hunt

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

Start Hunting!