Invalid cross-device link (18) when saving a file on arch linux

152 ビュー (過去 30 日間)
Youp Lamb
Youp Lamb 2022 年 9 月 7 日
回答済み: FEDERICO 2023 年 3 月 30 日
I have installed matlab on arch linux. everything works fine, even simulink. I can also open files without a problem. But whenever i try to save a file, i get the error. I cant find anything about it online
Error writing file "[path]"Invalid cross-device link (18)".

採用された回答

Joshua Ortiga
Joshua Ortiga 2022 年 9 月 7 日
移動済み: Walter Roberson 2022 年 9 月 7 日
I am also using Arch Linux and having the same problem as well. Unfortunately this is an issue that is currently only resolved by downgrading your kernel to <=Linux 5.18.9
  4 件のコメント
Ali
Ali 2022 年 10 月 12 日
I reported this issue two weeks ago.
LP
LP 2023 年 1 月 13 日
Alos have error on 5.15.0-57-generic

サインインしてコメントする。

その他の回答 (9 件)

simone rotondi
simone rotondi 2022 年 10 月 12 日
I had the same behaviour.
Anyway i have figured out that a big problem are the temp files, if i set the matlab tempdir to a file system different wrt btrfs or tempfs and the file is also in a different file system it works with no problem.
If the filesystem of the temp files or the files you are working with is btrfs with a newer kernel it wont work. i have tried also to disable the COW on the folder i was working but no improvement at all.
For instance to change the temp dir of matlab
clear all
tempdir
setenv('TMPDIR','FOLDER FROM NTFS,EXT4..')
clear all
tempdir
and it should be fixed (for files not on btrfs)
  6 件のコメント
FEDERICO
FEDERICO 2023 年 3 月 21 日
Same for me, inside /home, works!
FEDERICO
FEDERICO 2023 年 3 月 30 日
Since It is needed to do it any time you open matlab.
Open (or create) startup.m in your userpath folder, with the following command:
edit(fullfile(userpath,'startup.m'))
And then place inside this file the following line (with the correct folder path):
setenv('TMPDIR','/home/youruser/yourtempdir');

サインインしてコメントする。


Jacek Jagosz
Jacek Jagosz 2022 年 11 月 9 日
To someone from Matlab, this is to help them fix this issue.
This seems to be the commit that introduced this issue, not only present in kernel 5.18 but even backported to 5.15 LTS https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=4d5055873e24bba9e01b3b5d16790714b0d38533
Some other applications broke with this change, not just Matlab. For example qBittorrent, they discussed the whole issue here: https://github.com/qbittorrent/qBittorrent/issues/17352
And they fixed it in this particular commit: https://github.com/arvidn/libtorrent/pull/6965
Hope Matlab can introduce the same fix, and hope it finds its way to the new release.
Can I ping someone so this gets to someone from Mathworks, this could probably help them fix this issue.
  3 件のコメント
Jacek Jagosz
Jacek Jagosz 2023 年 1 月 30 日
@Walter Roberson Could you check if this bug got fixed in R2022b Update 3 or maybe in the R2023a prerelease? I want to install a matlab release that is fully working.
Walter Roberson
Walter Roberson 2023 年 1 月 31 日
  • R2022a Update 6
  • R2022b Update 4
I am not authorized to comment on pre-releases.

サインインしてコメントする。


Adrian Dummermuth
Adrian Dummermuth 2022 年 9 月 22 日
I am getting this error while I try to save a .mlx file provided by the professor. I have write permissions in /tmp/ but I am not sure why saving the .mlx doesn't work but if I create a new file that works. Any suggestions?
Running on Pop!_OS 22.04 LTS
Linux pop-os 5.19.0-76051900-generic #202207312230~1660780566~22.04~9d60db1 SMP PREEMPT_DYNAMIC Thu A x86_64 x86_64 x86_64 GNU/Linux
Unable to save file ex_1_1_tmp.mlx.
java.lang.RuntimeException: Internal Exception in writing MLX file : Could not commit changes: copy failed: fl:filesystem:SystemError: /tmp/.ed28-df99-8888-aaaa.tmp Invalid cross-device link
  4 件のコメント
Youp Lamb
Youp Lamb 2022 年 9 月 27 日
i also get the tmp file in the directory
Maciej
Maciej 2022 年 9 月 29 日
You can save the .mlx file to your /tmp directory, and then move the file to your prefferred location. It is a poor workaround, though.

サインインしてコメントする。


Carlos Planelles Otero
Carlos Planelles Otero 2022 年 9 月 28 日
I have same issue on Pop!_OS 22.04, saving as a .m file works fine but not .mlx.

Lennart Guderian
Lennart Guderian 2022 年 11 月 30 日
Hey guys,
this issue has been bugging me too (on Garuda (Arch) Linux) and I just wanted to share a solution I came up with that doesn't require you to downgrade your kernel since that was something I wasn't really excited about. Thank you @simone rotondi for the information about the filesystem being the issue in conjunction with the temp dir!
Since on my main hard drive I have a btrfs, I just formatted a small USB-Stick with FAT, named it matlab, created a tmp and set the TMPDIR var to point to it (`/run/media/uname/matlab/tmp`). Then I save all matlab files on this usb stick - works like a charm. Surely not optimal (looking forward to a soon fix from the MathWorks Team) but for me that was the more chill option than downgrading and version locking my kernel.
Hope it helps someone!
Cheers
  2 件のコメント
Rishab Kumar
Rishab Kumar 2023 年 3 月 3 日
Could you send the CLI commands with which you set the TMPDIR var pointer
Lennart Guderian
Lennart Guderian 2023 年 3 月 3 日
The command to use in Matlab is setenv('TMPDIR','FOLDER FROM NTFS,EXT4..')as you can see in Simone's answer above. In Matlab there is a startup script you can write that is run automatically when you open the program, if you add this line in there, it will be set automatically on every start and the problem is solved (if you also have your external storage device with FAT filesystem connected).

サインインしてコメントする。


Eugene Feinberg
Eugene Feinberg 2022 年 12 月 8 日
After wasting (I hate to admit it) a few days trying to find a complete workaround to varients of this issue, I found that the root cause for me is the old version of the Java JRE that Mathworks packages with R2022b. Replacing the JRE with a newer version fixes every instance of the copy_file_range cross device problem (temporary directory, simulink saving issues, Xilinx blockset compile).
Process:
  • Download and untar or install java from https://www.java.com/en/download/manual.jsp
  • In the matlab install directory, rename R2022b/sys/java/jre/glnxa64 to R2022b/sys/java/glnxa64.orig
  • In the R2022b/sys/java/jre directory create a symlink to the download jre named glnxa64. There should now be a glnxa64/bin/java pointing to the new java binary.
The shipping version with R2022b update 2 is from January 2019
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
After installing the newer version
java version "1.8.0_351"
Java(TM) SE Runtime Environment (build 1.8.0_351-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode)
  1 件のコメント
simone rotondi
simone rotondi 2022 年 12 月 9 日
Hi, i thought this was a cool solution but i didnt manage to fix the problem.
I'm on fedora 37 and Matlab 2022b update1
I tried this trick with both the java oracle libraries and the openjdk libs .. but both of them didnt solved the error. (anyway i'll keep using it)
'Java 1.8.0_352-b08 with Red Hat, Inc. OpenJDK 64-Bit Server VM mixed mode'
'Java 1.8.0_351-b10 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode'
This could be totally my fault and i hope it is. I'll keep trying , thanks anyway!

サインインしてコメントする。


Eugene Feinberg
Eugene Feinberg 2022 年 9 月 27 日
I have the same problem on 22.04.1 LTS. MATLAB is installed on a different volume than /tmp. An strace shows the pattern below. By creating a temporary directory on the same disk volume that matlab is installed on and running matlab with the TMP variable set to that directory the error is resolved but that seems like a bad solution.
[pid 38662] openat(AT_FDCWD, "/opt/MATLAB/R2022b/toolbox/simulink/blocks/obsolete/simulink_need_slupdate.mdl", O_RDONLY|O_CLOEXEC) = 948
[pid 38662] fstat(948, {st_mode=S_IFREG|0444, st_size=164480, ...}) = 0
[pid 38662] openat(AT_FDCWD, "/tmp/.d1ee-e4b5-3401-aa22.tmp_extracted_package_simulink_need_slupdate.mdl/_mwopc_packageCopy.txt", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_CLOEXEC, 0100644) = 950
[pid 38662] fstat(950, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
[pid 38662] copy_file_range(948, NULL, 950, NULL, 164480, 0) = -1 EXDEV (Invalid cross-device link)

simone rotondi
simone rotondi 2022 年 9 月 30 日
On fedora 36 with btrfs file system there is the same error both in R2022a and in R2022b.
Linux 5.18.9 is the last one working well but is now 4 months old and from 5.18.10 to 5.19.12 the problem persists.
Everytime i have to save a slx file it gives me
Error writing file "[path]/name.slx": Failed to close the package: "Collegamento tra dispositivi non valido (18)".
Where "Collegamento tra dispositivi non valido" means "Invalid cross link device"
  6 件のコメント
Walter Roberson
Walter Roberson 2022 年 11 月 10 日
You would need to have a partition available on a hard disk or SSD or flash drive (such as USB stick). The command line command that would be used at the Linux console would be mkfs -- see https://www.howtogeek.com/443342/how-to-use-the-mkfs-command-on-linux/
If I recall correctly there is a GUI available that will invoke the command on your behalf, but it has been several years since I last booted Linux so unfortunately I do not know where the GUI would be located.
simone rotondi
simone rotondi 2022 年 11 月 11 日
編集済み: simone rotondi 2022 年 11 月 11 日
If you are on Fedora36 i would just recommend to go back to kernel 5.18.9
You can download and install it with
mkdir KernDown
cd KernDown
koji download-build kernel-5.18.9-200.fc36
sudo dnf install ./kernel-*
and lock it with
sudo dnf versionlock add kernel-5.18.9-200.fc36
then unlock when the problem will be fixed whith
sudo dnf versionlock delete kernel-5.18.200.fc36
Otherwise you should follow @Walter Roberson advice

サインインしてコメントする。


FEDERICO
FEDERICO 2023 年 3 月 30 日
SOLUTION, LATEST KERNEL, MATLAB R2022b
Make sure to chose a TMPDIR inside your /home partition:
Since It is needed to do it any time you open matlab.
Open (or create) startup.m in your userpath folder, with the following command:
edit(fullfile(userpath,'startup.m'))
And then place inside this file the following line (with the correct folder path):
setenv('TMPDIR','/home/youruser/yourtempdir');

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by