How do I run MATLAB inside a CHROOT partition?

7 views (last 30 days)
I am working on a large project where I am using "chroot" techniques on Linux and Solaris to define standard environments for software development and testing.
On Linux, MATLAB does not work well when it is started from a process that runs inside a "chroot" partition. I do not encounter problems running many standard UNIX processes and applications inside a chroot partition, including Perl and Java. MATLAB is able to startup, but I am unable to run code generators, build models, execute models etc.
When MATLAB starts up, I receive the following error message:
11899: 11899: 11899: initialize program: ./matlab
11899: 11899: 11899: transferring control: ./matlab
11899: ??? MATLAB was unable to open a pseudo-tty:
No such file or directory [2,1]
The unix() and ! commands will not work in this MATLAB session. Other
commands which depend upon unix() and ! will also fail. Your system may
be running low on resources. If the problem persists after a reboot,
check with your system administrator and confirm that your pty subsystem
is properly configured.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
MATLAB has a set of dependencies that are different from Java and Perl. If you are running your shell in the confinement of a CHROOT environment, you need to make sure that these dynamic dependencies are made available. Furthermore, SIMULINK also has dependencies, some of which are different from those of MATLAB.
You can run LDD on MATLAB and SIMULINK in the $MATLAB/bin/$ARCH directory, where $MATLAB = the MATLAB root directory on your machine and $ARCH is you system architecture. The executable files for MATLAB and SIMULINK are "matlab" and "libmwsimulink.so".
In particular, if you are not allowed to access /dev/ptmx or other pty devices under the /dev directory, MATLAB will not be able to use the bang (!) operator to shell out of MATLAB and run arbitrary shell commands.
Also note that /dev and directories such as /dev/pts are "two" file systems, so you have to mount each explicitly onto the CHROOT partition. The following set of commands is what you use to set up the CHROOT environment:
DIR=/data/rouquett/sandbox
mount -r --bind /bin ${DIR}/bin
mount -r --bind /lib ${DIR}/lib
mount -r --bind /dev ${DIR}/dev
mount -r --bind /dev/pts ${DIR}/dev/pts
mount -r --bind /etc ${DIR}/etc
mount -r --bind /export ${DIR}/export
mount -r --bind /opt ${DIR}/opt
mount -r --bind /proc ${DIR}/proc
mount -r --bind /sbin ${DIR}/sbin
mount --bind /tmp ${DIR}/tmp
mount -r --bind /usr ${DIR}/usr
mount -r --bind /var ${DIR}/var
For auto-mounted NFS volumes, you would have to do something like:
mount -t nfs <server>:<path-to-home file system> ${DIR}/home

More Answers (0)

Categories

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

Products

Community Treasure Hunt

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

Start Hunting!