Why do I get ERROR: Can't locate utf8.pm in @INC when using NX Server for Solaris
Message ERROR: Can't locate utf8.pm in @INC is related to perl and its use of the utf8 pragma.
In this case, trying to run a session on Solaris could come up with error:
HELLO NXSERVER - Version 3.2.0-11 - SES Evaluation
NX> 105
NX> 598 an unrecoverable exception occurred, a complete log of the error can be found in your system logs.
The logs report errors similar to:
NXSERVER-3.2.0-11[6930]: [ID 702911 user.info] ERROR: ED4645DE
Can't locate utf8.pm in @INC (@INC contains:
/usr/NX/lib/perl /usr/NX/lib/perl/include
/NX/perl/lib/5.8.0/sun4-solaris /NX/perl/lib/5.8.0
/NX/perl/lib/site_perl/5.8.0/sun4-solaris /NX/perl/lib/site_perl/5.8.0
/NX/perl/lib/site_perl .) at NXShell.pm line 285.
NXSERVER-3.2.0-11[6930]: [ID 702911
user.info] ERROR: ED4645DE EGIN failed--compilation aborted
Two possible workarounds are:
- Switch to POSIX rather than use language settings in the utf8 format.
- Create a wrapper for nxserver/nxnode which will unset LANG and LC_ALL variables and then run the nxserver/nxnode binaries.
Wrapper example:
Two wrappers need to be written for nxserver and nxnode.
- To create an nxserver wrapper execute the following command:
mv /usr/NX/bin/nxserver /usr/NX/bin/nxserver.bin
Next you should create a /usr/NX/bin/nxserver shell script which
contains:
#!/bin/sh
unset LANG
/usr/NX/bin/nxserver.bin "$@"
Then set correct permissions as:
chmod 0755 /usr/NX/bin/nxserver
chmod 0755 /usr/NX/bin/nxserver.bin
- The same procedure should be carried out for nxnode. First rename the binary to:
mv /usr/NX/bin/nxnode /usr/NX/bin/nxnode.bin
Create a /usr/NX/bin/nxnode shell script which contains:
#!/bin/sh
unset LANG
/usr/NX/bin/nxnode.bin "$@"
Then set correct permissions as:
chmod 0755 /usr/NX/bin/nxnode
chmod 0755 /usr/NX/bin/nxnode.bin
- Next the suided scripts need to be modified accordingly. Since the binaries were changed from nxnode to nxnode.bin, we need to modify two scripts.
Changes in /usr/NX/scripts/restricted/nxlicense.sh
line 27:
if [ "$command" != "$NODE_ROOT/bin/nxnode" ];
should be:
if [ "$command" != "$NODE_ROOT/bin/nxnode.bin" ];
Changes in /usr/NX/scripts/restricted/nxtmpperm.sh line 35:
if [ "$command" != "$NODE_ROOT/bin/nxnode" ];
should be:
if [ "$command" != "$NODE_ROOT/bin/nxnode.bin" ];
If you need to set the LANG variable for a Gnome or KDE desktop environment, then you will have to create a wrapper also for the desktop session.
Example:
In the node.cfg there is the following KEY:
CommandStartGnome="/usr/NX/scripts/gnome.wrapper.sh"
where you should place the wrapper which will then set the variable and
run Gnome directly.
In this file, write the shell script:
#!/bin/sh
export LANG="en_US.utf8"
gnome-session
chmod 755 /usr/NX/scripts/gnome.wrapper.sh
Note: example below is only a guide to how a wrapper could be implemented to fix this specific PERL problem.
