MATLAB Licence using both Window11 and WSL2

I have install the matlab 2021a on window11 and wsl2. But in WSL2 I got
MATLAB is selecting SOFTWARE OPENGL rendering.
License checkout failed.
License Manager Error -9
The hostid of your computer ("00155de21a38 6a0b4012aaac") does not match the hostid of the license
file (00155db048ba).
To run on this computer, you must run the Activation client to reactivate your license

Answers (1)

Hi, Chenguang Wan.
It is possible to use MATLAB inside WSL2, the problem is that everytime you open WSL2 its MAC Address changes! And your license is linked to it.
The solution is edit ".bash_profile" and add a few lines. On Linux, type:
$ nano ~/.bash_profile
Then insert these lines:
wantmac=00:15:aa:ad:aa:aa
mac=$(ip link show bond0 | awk '/ether/ {print $2}')
if [[ $mac != $wantmac ]]; then
sudo ip link set dev bond0 address $wantmac
fi
Now you just need to activate your MATLAB again and it will work!
Reference: https://github.com/microsoft/WSL/issues/5866

Categories

Products

Release

R2021a

Tags

Asked:

on 14 Apr 2022

Answered:

on 20 Jun 2022

Community Treasure Hunt

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

Start Hunting!