How do I return hung/stuck license keys back to the network license manager / How do I use the lmremove function?

158 views (last 30 days)
After quitting the MATLAB session, the license manager still reports that the license is checked out. How do I return the hung license key to the license server?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Jun 2022
Edited: MathWorks Support Team on 23 Jun 2022
Occasionally, license keys may not be checked back into the pool of available license keys even though the MATLAB session has ended. This would most likely happen as a result of a system crash. If this is the case it is advisable to restart the FLEXnet license manager.
It is also possible to manually check back hung/stuck license keys into the available pool by using the "lmremove" utility. If the MATLAB session is still running, the lmremove command will not work. In that case, you will need to end the MATLAB session to return the license key.
In order to use lmremove, you must first get the output of lmstat. To obtain this output, you can perform the following steps:
For Windows
1. Launch lmtools.exe located in $MATLAB\etc\win{32|64} ($MATLAB\flexlm for releases prior to 2010b) on the license server (where $MATLAB is the installation folder for MATLAB on that machine)
2. Go to the "Server Status" tab.
3. Click perform Status Enquiry button.
For Unix/Linux/Mac
1. Open a terminal window (for MAC, Terminal is located in Applications/Utilities)
2. Change directories to MATLAB's etc folder in the terminal by running the following command:
cd $MATLAB/etc
Where $MATLAB is the installation folder for MATLAB (for Mac OS X with R2008b or higher, $MATLAB is generally /Applications/MATLAB_R2022a.app).
3. Run the following command to obtain the lmstat output:
./lmstat -a
Both the lmstat and the lmtools, will list all of the users that have checked out licenses. For example:
License server status: 27000@server1
License file(s) on server1: C:\Program Files\MATLAB\R2010b\etc\license.dat:
server1: license server UP (MASTER) v11.4
Vendor daemon status (on server1):
MLM: UP v11.6.1
Feature usage info:
Users of MATLAB: (Total of 10 licenses issued; Total of 1 licenses in use)
"MATLAB" v20, vendor: MLM
nodelocked license, locked to "ID=123456"
johndoe johnpc johnpc (v20) (johnpc/27000 101), start Wed 3/11 10:06
The lmstat will output the username, then the computer name, and then the display name (usually the display is the same as the computer name). In order to use lmremove, you will need the feature name (ex: MATLAB), the host (computer name) and the display name.
To use lmremove, you will need to run the command (where <path to license file> is the path to the license.dat file):
lmremove [-c <path to license file>] feature Entry1(user) Entry2(host) Entry3(display)
For UNIX/Linux/Mac, lmremove is located in $MATLAB/etc. Thus, if you followed the steps above, you can execute it by running:
./lmremove [-c <path to license file>] feature Entry1(user) Entry2(host) Entry3(display)
Using the example above, to remove johndoe's license, you would run the following:
./lmremove -c license.dat MATLAB johndoe johnpc johnpc
For a Windows machine, to access lmremove, you will need to use a Windows command prompt. To run lmremove, you can take the following steps:
1. Open up a Windows Command Prompt by clicking on the Start Menu and go to All Programs, Accessories, and click on Command Prompt.
2. In the Command Prompt, change directories to the MATLAB's flexlm folder. For example:
cd C:\Program Files\MATLAB\R2010b\etc\win32
3. Launch lmremove through the lmutil.exe executable:
lmutil.exe lmremove -c license.dat (feature) (user) (host) (display)
Thus, for our example above, you would run:
lmutil.exe lmremove -c license.dat MATLAB johndoe johnpc johnpc
NOTE: If the username contains a space, you will find an error stating 'lmremove doesn't exist. The name will need to have quotes added:
lmutil.exe lmremove -c license.dat MATLAB "john doe" johnpc johnpc

More Answers (1)

Dave
Dave on 5 May 2014
I followed these instructions to the "tee" but they did not appear to have any effect. Matlab crashed while I was attempting to use the compiler app and, subsequently, I had to wait for the compiler license to time out in order to use it again.
  1 Comment
Dave
Dave on 5 May 2014
I called tech support today, and apparently the lmremove solution cannot be used when a "linger" time (30 minutes in my case) is in effect. This is unfortunate when developing code remotely because the license remains checked out for at least 30 minutes after logging off. Strangely enough, when I log back in the license is checked out to me still, but I cannot use the compiler again until the linger time expires. The net result is that there are up to (30*number_of_times_logged_off) minutes per day that the license is unavailable, even though no one else is using it!

Sign in to comment.

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!