CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [OpenFOAM.com] starting problem on mac: "xhost: command not found" (https://www.cfd-online.com/Forums/openfoam-installation/169099-starting-problem-mac-xhost-command-not-found.html)

azaria April 3, 2016 12:02

starting problem on mac: "xhost: command not found"
 
I followed the installation instruction for OpenFOAM binaries on mac. I followed and completed all the steps and seems all run successfully. Then I got stuck on the following step.

I attempted to run the following command:
Merons-MacBook-Pro:~ ban$ ./startOpenFOAM+

And I get the following message that I do not understand?
./startOpenFOAM+: line 8: xhost: command not found
of_v3.0_plus
bash-4.1$

May be the terminal is expecting me to enter "some command". I don't know what it is expecting or what is wrong.

your help is highly appreciated.

Thanks,

pgh April 4, 2016 10:12

Hi..
You have done it right . Enter command blockMesh , to check whether you have openfoam environment set i.e in bash-4.1$ . You can remove line xhost + from startOpenFOAM+ scripts and launch scripts again

azaria April 6, 2016 22:07

I did the following per your suggestion:

I removed the line xhost + from startOpenFOAM+ scripts and launch command again. And then run the command blockMesh at bash-4.1$ terminal and I got the following message:
Build : v3.0+-e941ee6c15e9
Exec : blockMesh
Date : Apr 07 2016
Time : 01:43:39
Host : "cbd5124db144"
PID : 190
Case : /Users/ban
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



--> FOAM FATAL IO ERROR:
cannot find file

file: /Users/ban/system/controlDict at line 0.

From function regIOobject::readStream()
in file db/regIOobject/regIOobjectRead.C at line 73.

FOAM exiting

It appears the blockMesh did not run successfully, however, I went ahead and run the following command: "run" per the installation instruction as follows, and I got the following error message:

bash-4.1$ run
bash: cd: /home/docker/OpenFOAM/docker-v3.0+/run: No such file or directory

Still went ahead and run the following command per the install instruction, and again run to Permission denied problem:

bash-4.1$ mkdir -p $FOAM_RUN
mkdir: cannot create directory `/home/docker': Permission denied

Since the blockMesh command did not run clean. There must be some problem or steps I missed.

Please any help is appreciated.

Thanks,
Azaria

pgh April 7, 2016 03:41

Hi Azaria
Running BlockMesh was to make sure that you were getting openfoam executables in path . Since you run outside any actual case , it was suppose to throw error.
For permission related issue and other see this thread.(see 1April post by pgh)
http://www.cfd-online.com/Forums/ope...tml#post593444

azaria April 7, 2016 22:38

Dear All,

I tried both options but I run to the old problem "Permission Denied". Below is the message I get.

Merons-MacBook-Pro:~ ban$ docker-machine ssh default $HOME/installOpenFOAM+ $HOME
sh: /Users/ban/installOpenFOAM+: Permission denied
exit status 126

My problem circles back to the original problem I started with.

Thanks,
Azaria

azaria April 7, 2016 23:09

Dear All:

I have comeback to this problem again:

Merons-MacBook-Pro:~ ban$ ./startOpenFoam+
of_v3.0_plus
bash-4.1$ mkdir -p $FOAM_RUN
mkdir: cannot create directory `/home/docker': Permission denied
bash-4.1$

I must be missing some thing here. I cannot get past this point.

Thanks,
Bereket

pgh April 8, 2016 03:29

1 Attachment(s)


Problem :

Issue : sh: /Users/ban/installOpenFOAM+: Permission denied
exit status 126

i) Make the install script executable chmod +x installOpenFOAM+

ii) mkdir -p $FOAM_RUN . Will not work directly . (Use attached script and follow instruction to install and use openfoam

Here is the solution :
i) Open the docker terminal via clicking on "Docker Quick Start" short cut .
ii) Delete old container: docker rm -f of_v3.0_plus
iii)Open installOpenFOAM_MAC scripts (attached here. unzip it before using )
in line 25, replace strings NAME with your user name as appears in mac i.e /Users/Name to /Users/alex assuming alex is user name
iv) run installOpenFOAM_MAC script as done earlier i.e
docker-machine ssh default $HOME/installOpenFOAM_MAC $HOME
v) Now run startOpenFOAM.sh script (http://openfoam.com/download/install-binary.php)
and you will be login as root.
vi) run following command to login as ofuser
su ofuser
Always work as ofuser to work on OpenFOAM

vii) Go inside the folder /home/ofuser/workingDir and follow following steps
a) mkdir OpenFOAM/ofuser-v3.0+/run
b) cd ..
c)ln -s workingDir/OpenFOAM (creating soft link to OpenFOAM/ofuser-v3.0+)

You can copy tutorial in /home/ofuser/workingDir
cd
/home/ofuser/workingDir
cp -ar $FOAM_TUTORIALS/incompressible/icoFoam/cavity .
run tutorial

Note: Please note that all changes inside container will be lost once you delete the container by command "docker rm -f contName" except content in /home/ofuser/workingDir . So if you are making changes in /opt/OpenFOAM better be careful .



azaria April 8, 2016 21:17

I managed to follow the instruction up until step vi as shown below but again I could not create the "OpenFOAM/ofuser-v3.0+/run" directory. See below the error message

Merons-MacBook-Pro:~ ban$ ./startOpenFOAM+
of_v3.0_plus
bash-4.1# su ofuser
[ofuser@c00e0cd0d15c ~]$ ls
workingDir
[ofuser@c00e0cd0d15c ~]$ cd workingDir
[ofuser@c00e0cd0d15c workingDir]$ mkdir OpenFOAM/ofuser-v3.0+/run
mkdir: cannot create directory `OpenFOAM/ofuser-v3.0+/run': No such file or directory
[ofuser@c00e0cd0d15c workingDir]$ mkdir OpenFOAM
mkdir: cannot create directory `OpenFOAM': Permission denied
[ofuser@c00e0cd0d15c workingDir]$

Your help is appreciated.

Thanks,
Azaria

pgh April 9, 2016 06:05

go inside folder

cd /home/ofuser/workingDir

and then follow steps. workingDir is same as C:\Users\ban . Even if permission is denied . change permission of folder

azaria April 10, 2016 14:32

I am in the workingDir but still I run into the same problem "Permission Denied". See below:

[ofuser@c00e0cd0d15c workingDir]$ mkdir OpenFOAM
mkdir: cannot create directory `OpenFOAM': Permission denied
[ofuser@c00e0cd0d15c workingDir]$

The directory has the permission to rwx. See below:

[ofuser@c00e0cd0d15c workingDir]$ cd ..
[ofuser@c00e0cd0d15c ~]$ ls
workingDir
[ofuser@c00e0cd0d15c ~]$ ls -l
total 0
drwxr-xr-x 1 1000 ftp 1054 Apr 9 00:40 workingDir

Can any one tell me why I am having "Permission Denied" error message. I as user have read, write and execute privilege.

Thanks,
Azaria





[ofuser@c00e0cd0d15c ~]$

pgh April 11, 2016 04:05

I am assuming , you are inside this directory /home/ofuser/workingDir
and then you are being denied permission . Please do ls -lhtr inside directory.
You can login as root (password : 0fuser2015) and change permission of directory
chmod 750 workingDir . See if this works for you

k13113y May 5, 2016 21:10

Exact Same Problem
 
Hey, I am having the exact same problem and am pretty new to programming in general.

I followed your steps verbatim and this is what I got:

[root@eba8e7f5a175 workingDir]# whoami
root
[root@eba8e7f5a175 workingDir]# pwd
/home/ofuser/workingDir
[root@eba8e7f5a175 workingDir]# chmod 750 workingDir
chmod: cannot access `workingDir': No such file or directory
[root@eba8e7f5a175 workingDir]#

I'm running on el Capitan, my professor is too, and we're both having permissions issues. Any help would be greatly appreciated :)

pgh May 6, 2016 08:21

1 Attachment(s)
Hi .. use this script and it should work fine .

i)delete old container
docker rm -f of_v3.0_plus

ii) run new script attached here (unzip the script first)
Please place script in home folder and then run command from docker terminal as

docker-machine ssh default $HOME/installOpenFOAM+ $HOME


It will login as docker user and you can run openfoam and there will be no permission issue
Also you can login as root now . password for root : 0fuser2015

Let me know if it works or you face any issue

k13113y May 6, 2016 08:27

Thats great!

I managed to make a new directory as root,
mkdir -p $FOAM_RUN

But I am using socat to watch for my DISPLAY variable, and I am unsure of which IP it needs.

Is there a command I can type into docker that will show me this?

I want to make a variable, export DISPLAY=xxx.xxx.xx.x:x

pgh May 6, 2016 08:53

i)You do not need root permission to run this command

mkdir -p $FOAM_RUN

can you please delete that folder and again run same command as normal user (no root)

ii) DISPLAY variable was removed from my script ..Please in line docker run etc as shown below
add this variable and rerun the script after deleting the container

docker run -ti -d .... -e DISPLAY=${displayVar} --workdir

(When you launch docker terminal box , the ip is shown that time .

Message read something like this ..

"docker is configured to use the default machine with IP 192.169.99.100" "

k13113y May 6, 2016 09:27

Great thanks I just ran the cavity simulation :o

pgh May 6, 2016 09:33

Hi
Can you confirm this
do you need to login as root to run command , mkdir -p $FOAM_RUN or
you were able run as normal user i.e docker

k13113y May 6, 2016 09:36

Yes this is the last issue I have...

I have to be root. I have made: su ofuser ...but he cannot make that directory. Maybe its an el Capitan issue?

k13113y May 6, 2016 09:37

And likewise the user: docker can't do it either.

pgh May 6, 2016 09:43

That's strange..
In my case, i can login as docker user directly . and then can type this command i.e mkdir -p $FOAM_RUN which make OpenFOAM/docker-v3.0+ folder in /C/Users i.e in home directory..

Can you do echo $FOAM_RUN and send the output

k13113y May 6, 2016 09:51

[root@eba8e7f5a175 cavity]# echo $FOAM_RUN
/root/OpenFOAM/ofuser-v3.0+/run

[ofuser@eba8e7f5a175 cavity]$ echo $FOAM_RUN
/home/ofuser/OpenFOAM/ofuser-v3.0+/run

...It worked? I'm sorry for the confusion I literally don't know why its working all of a sudden.

k13113y May 6, 2016 09:54

It seems to have happened when I downloaded the new version of virtual box

pgh May 6, 2016 10:08

1 Attachment(s)
Launch docker terminal box i)delete old container by running following command "docker rm -f of_v3.0_plus"

ii) run this command "docker ps -a " to see there is no container now

iii) unzip the latest script that i have provided and put in /C/Users
and use this command
docker-machine ssh default $HOME/installOpenFOAM_MAC_pgh $HOME

You will be login as docker (There is no ofuser involved in it)
then follow rest of instruction

k13113y May 6, 2016 10:41

Here's what happened when I followed your last comment.

taylor:~ myusername$ ./startOpenFoam+_MAC
of_v3.0_plus
bash-4.1$ whoami
whoami: cannot find name for user ID 1000
bash-4.1$ mkdir -p $FOAM_RUN
bash-4.1$ run

//so it was able to make the directory

bash-4.1$ export DISPLAY=my.ip
bash-4.1$ export LIBGL_ALWAYS_INDIRECT=y
bash-4.1$ paraFoam
Created temporary 'cavity.OpenFOAM'
paraview: cannot connect to X server my.ip

But it couldn't open the graphical interface like before for some reason

pgh May 6, 2016 10:49

I am not using paraFOAM from docker container. I will suggest to download paraview seprately for MAC and then work on it .

http://www.paraview.org/download/

Also did you add display variable as suggested earlier in your command i.e in script (Note just need to add -e DISPLAY=${displayVar} in script . and rerun it after deleting old container

docker run -ti .... -e DISPLAY=${displayVar} --workdir

k13113y May 6, 2016 11:14

I've now installed paraview and made the change to the script. My script reads:

docker run -it -d --name ${containerName} --user=${user} -e USER=${username} -e DISPLAY=${displayVar} --workdir -e QT_X11_NO_MITSHM=1 -e HOME=/home/docker/Users --workdir="/home/docker/Users" --volume="${home}:/home/docker/Users" -v=/tmp/.X11-unix:/tmp/.X11-unix ${imageName} /bin/bash --rcfile /opt/OpenFOAM/OpenFOAM-v3.0+/etc/bashrc

However now I can't even run the container:

taylor:~ myusername$ ./startOpenFOAM+_MAC
Error response from daemon: No such container: of_v3.0_plus
Error: failed to start containers: of_v3.0_plus
Error: No such container: of_v3.0_plus

pgh May 6, 2016 11:31

docker run -it -d --name ${containerName} --user=${user} -e USER=${username} -e DISPLAY=${displayVar} --workdir -e QT_X11_NO_MITSHM=1 -e HOME=/home/docker/Users --workdir="/home/docker/Users" --volume="${home}:/home/docker/Users" -v=/tmp/.X11-unix:/tmp/.X11-unix ${imageName} /bin/bash --rcfile /opt/OpenFOAM/OpenFOAM-v3.0+/etc/bashrc


remove --workDir that is highlightred above

k13113y May 6, 2016 12:01

Andd we have lift off! Thank you my friend, I am now running programs as user1000 and not as root:D

azaria May 7, 2016 14:58

Dear ugh,

I am back again, I used your latest script but I get the password incorrect. See below:

Merons-MacBook-Pro:~ ban$ ./startOpenFOAM+
of_v3.0_plus
bash-4.1$ su user
su: user user does not exist
bash-4.1$ su ofuser
Password:
su: incorrect password
bash-4.1$

I used the password ofuser2015 and Ofuser2015. Both did not work.

When I used the latest attached script I do not need to change users "Name".
any clue?

thanks,
Azaria

pgh May 7, 2016 15:39

Hi Azaria

1)Before launching script, make sure to run command docker rm -f of_v3.0_plus

to make sure you have deleted old container.


2. )please note that with latest script you do not need to login as ofuser..

3) command "echo $USER", will throw user name as docker.. check this please

4) run this command "mkdir -p $FOAM_RUN" and see whether there is permission issue .

5)Login as root ie su root and use password 0fuser2015 ...

azaria May 8, 2016 11:13

Dear pgh,

I have run the cavity tutorial successfully. Thank you so much.

Azaria

bbita May 13, 2017 18:26

Hi Pawan,

I am new to OpenFoam. I installed OPENFOAM for windows-v1612+. I am trying to run the first tutorial. I am in workingDir but when I enter" cp -ar $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity ." I receive the error of permission denied. Please advise.

Thanks

bbita May 14, 2017 22:32

I finally solved the issue. uninstall the whole thing, activate windows module installer, check for updates for windows and reinstall the openFoam and the problem resolved.


All times are GMT -4. The time now is 12:06.