VMware Horizon Community
khosrof_RP
Contributor
Contributor
Jump to solution

Horizon 2111 Linux RHEL7 VDI issue with /bin/tcsh

Hello community,

We are running RHEL 7.9 VDI machines on Horizon 8 2111 (latest release).  We have 2 user groups, one that uses the default shell (/bin/bash) and another group which needs tcsh (/bin/tcsh) as the default shell.

Everything appears to work fine for users with default shell of /bin/bash

For the users with default shell /bin/tcsh there are various issues. 

1- The DISPLAY is not set correctly so remote X windows do not work. 

2- The user profile ~/.cshrc files are not being sourced as they would be by default. 

3-Also the view-agent puts a script at /etc/profile.d/vmware-lang.sh which is a shell script which also references other shell scripts which do not seem to have any .csh compatible components.

We have some EDA software which requires the user shell be set to /bin/tcsh for the applications to launch.  I am wondering how others using RHEL Linux VDI are managing this shortcoming.

Labels (4)
Reply
0 Kudos
1 Solution

Accepted Solutions
Hangl
VMware Employee
VMware Employee
Jump to solution

Hello Khosrof,

Please save the following to the file /etc/profile.d/vmware-lang.csh which is the csh script equivalent of vmware-lang.sh and has been tested in my lab.

 

if ( $DISPLAY =~ 127.0.0.1:* ) setenv DISPLAY ${DISPLAY:s/127.0.0.1//}

set desktopInfoFile="/var/vmware/vmw_desktop/vmw_desktopid.${DISPLAY:s/://}"
if ( -f "$desktopInfoFile" ) then
   set language=`grep -i -m1 "LANG=" $desktopInfoFile` && setenv ${language:s/=/ /}
endif

unset desktopInfoFile
unset language

 

 

View solution in original post

7 Replies
Hangl
VMware Employee
VMware Employee
Jump to solution

We had identified this issue and will fix it in Horizon 8.6.

Before that, can you try below steps to modify /etc/profile.d/vmware-lang.sh ?

First, add a function as below

 

run_comlib_func()
{
/bin/bash -s <<EOF
. /usr/lib/vmware/viewagent/commonlib.sh
$@
EOF
}

 

Then, remove the line of

 

. "/usr/lib/vmware/viewagent/commonlib.sh"

 

After that, find the line of displayNum=$(extract_xdisplay_number "$DISPLAY") and change to

 

displayNum="$(run_comlib_func extract_xdisplay_number $DISPLAY)"

 

Then, find the line of if is_xdisplay_legal "$displayNum"; then and change to

 

if run_comlib_func is_xdisplay_legal "$displayNum"; then

 

Finally, save the file.

Reply
0 Kudos
khosrof_RP
Contributor
Contributor
Jump to solution

Hello Hangl,

I appreciate the quick reply. 

Seems like item 1 and item 3 in my post are the same issue.  The script /etc/profile.d/vmware-lang.sh is what sets the DISPLAY variable.

I tried your solution but it does not work.  The core issue here is that /bin/csh (also /bin/tcsh) does not support functions.  Your reply has a function so it is broken and the script just errors out.

Here is the error on the terminal:

Badly placed ()'s.

If you search the above text in relation to /bin/csh you see multiple results explaining that functions are not possible.

Furthermore, we would need to rewrite /etc/profile.d/vmware-lang.sh file for it to work as a csh script.  The if statement, parameter statements, and other are all invalid for a csh file.

Regarding item 2 I have identified the issue and corrected it.

There was an error with one of the /etc/profile.d/*.csh scripts which errored out and stopped the rest of the scripts from running.  Fixing the bad script now loads all the environment settings properly.  This does not fix the DISPLAY issue which is related to item 1 and item 3.

I look forward to your feedback on how next to proceed.  Considering all the changes needed to move from a /bin/sh script to /bin/csh it would be greatly appreciated if you could provide the script in full that I can copy/paste.

Thank you in advance for all your help,

Khosrof

Reply
0 Kudos
Hangl
VMware Employee
VMware Employee
Jump to solution

Hello Khosrof,

Please save the following to the file /etc/profile.d/vmware-lang.csh which is the csh script equivalent of vmware-lang.sh and has been tested in my lab.

 

if ( $DISPLAY =~ 127.0.0.1:* ) setenv DISPLAY ${DISPLAY:s/127.0.0.1//}

set desktopInfoFile="/var/vmware/vmw_desktop/vmw_desktopid.${DISPLAY:s/://}"
if ( -f "$desktopInfoFile" ) then
   set language=`grep -i -m1 "LANG=" $desktopInfoFile` && setenv ${language:s/=/ /}
endif

unset desktopInfoFile
unset language

 

 

khosrof_RP
Contributor
Contributor
Jump to solution

Hello Hangl,

Thank you very much for the latest script.

Initial testing shows that it is working properly.  I will need some time to validate that everything has been addressed with this.  I will update this thread by Tuesday of next week.

I appreciate the prompt support.

Khosrof

Reply
0 Kudos
khosrof_RP
Contributor
Contributor
Jump to solution

Hello Hangl,

Just wanted to follow up on your script.  It does seem to correct the issue I was experiencing.

Want to thank you for the prompt support.  It is challenging to get Linux VDI support but this has been excellent.

Thank again,

Khosrof

Reply
0 Kudos
jburwell
Contributor
Contributor
Jump to solution

One thing to consider is that placing this in /etc/profile.d will break csh/tcsh initialization if the DISPLAY variable isn't set.

For instance, if someone tries to ssh or scp into the box, it won't run the user's .cshrc because it bombs out in the /etc/profile.d/vmware-lang.csh file when it references the unset DISPLAY variable.

It appears this file was added to the viewagent-install script somewhere in 8.x, so it gets installed automatically on your VDI boxes when one installs view agent.

I've modified the /etc/profile.d/vmware-lang.csh script to check if DISPLAY is set before trying to reference it:

if ( $?DISPLAY ) then
  # Re-export DISPLAY
  if ( $DISPLAY =~ 127.0.0.1:* ) setenv DISPLAY ${DISPLAY:s/127.0.0.1//}
  if ( $DISPLAY =~ *.* ) setenv DISPLAY `echo $DISPLAY | cut -d '.' -f 1`
  
  # Set remote language to the desktop
  set desktopInfoFile="/var/vmware/vmw_desktop/vmw_desktopid.${DISPLAY:s/://}"
  if ( -f "$desktopInfoFile" ) then
     set language=`grep -i -m1 "LANG=" $desktopInfoFile` && setenv ${language:s/=/ /}
     unset language
  endif
  
  unset desktopInfoFile
endif

 This fixes the issue for logins where DISPLAY isn't being used.

Reply
0 Kudos
Hangl
VMware Employee
VMware Employee
Jump to solution

@jburwellThank you for reporting this and for your thorough investigation.

This issue has been fixed and will be released in the next release, which is expected to be Horizon 8.13.

See https://communities.vmware.com/t5/Horizon-for-Linux/RHEL8-Issue-with-bin-tcsh/td-p/3006219 for details.

Reply
0 Kudos