guysoft / OctoPi

Scripts to build OctoPi, a Raspberry PI distro for controlling 3D printers over the web
GNU General Public License v3.0
2.49k stars 369 forks source link

Can't build OctoPi with Mac OS X #388

Closed klcjr89 closed 7 years ago

klcjr89 commented 7 years ago

Hello, ever since the file structure changed with the latest devel commits I am not able to build OctoPi anymore, and the instructions are pretty vague in the README.rst file in the root folder and they don't work for me using the latest Mac OS X Sierra 10.12.5.

I remember getting it setup initially with vagrant was quite a chore even before the changes, but I think it needs to be made easier to make/build the OctoPi img file such as double clicking on a .sh file or revising the readme file to give more clear instructions for Windows and OS X alike.

I would greatly appreciate help on this. :)

Thank you!

guysoft commented 7 years ago

I didn't know you could build it using a mac. Good to know! Since I did't test it for mac, its likely I changed something that works differently.

Can you post what you are trying to do, and what error you aarw getting? I need some more details how you are actually building with mac to support it. Output with errors would help!

klcjr89 commented 7 years ago

I don't remember how I got it work originally, since I had help from an amazon developer that lives across the country. I just remember having to use vagrant and finding the suitable Mac alternatives for apt-get and mod-probe nfs, etc that was mentioned in the readme.

It would be super helpful if we can figure out a way to make clickable script files that create the OctoPi img automagically for the large platforms: Mac, Windows.

That is my ideal dream instead of having to use the terminal everytime to cd and sudo up / provision etc.

Thank you for your work creating OctoPi!

klcjr89 commented 7 years ago

I was able to find the conversation my friend and I had on how we got it working originally.

1) Download & install Vagrant: https://www.vagrantup.com/downloads.html

2) In the OS X Terminal: sudo vagrant plugin install vagrant-share

3) sudo vagrant plugin install vagrant-nfs_guest

4) cd OctoPi/src/vagrant

5) sudo vagrant up

or if already provisioned, sudo vagrant provision

And step 5 automatically built the .img file, which was recently removed in the commit: https://github.com/guysoft/OctoPi/commit/bacf064f03a903149501046bb56411d3214451ce

I noticed you also changed the 'Vagrantfile' quite a bit from before.

The original one below worked:

`Vagrant.configure("2") do |o|

o.vm.box = "octopi-build"

o.vm.box= "ubuntu/zesty64"
o.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
o.vm.synced_folder "../../", "/OctoPi", create:true, type: "nfs"
o.vm.network :private_network, ip: "192.168.55.55"
o.vm.provision :shell, :path => "setup.sh", args: ENV['SHELL_ARGS']

end`

The new Vagrantfile in the latest commits results in these errors in the Terminal: Users-MacBook-Pro:~ user$ cd OctoPi/src/vagrant Users-MacBook-Pro:vagrant user$ sudo vagrant up Password: /Users/User/OctoPi/src/vagrant/Vagrantfile:6:in read': No such file or directory @ rb_sysopen - ../custompios_path (Errno::ENOENT) from /Users/User/OctoPi/src/vagrant/Vagrantfile:6:inblock in <top (required)>' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/config/v2/loader.rb:37:in load' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/config/loader.rb:125:inblock (2 levels) in load' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/config/loader.rb:119:in each' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/config/loader.rb:119:inblock in load' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/config/loader.rb:116:in each' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/config/loader.rb:116:inload' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/vagrantfile.rb:28:in initialize' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/environment.rb:810:innew' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/environment.rb:810:in vagrantfile' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/environment.rb:556:inhost' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/environment.rb:214:in block in action_runner' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/action/runner.rb:33:inrun' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/environment.rb:543:in hook' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/lib/vagrant/environment.rb:792:inunload' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/bin/vagrant:141:in ensure in <main>' from /opt/vagrant/embedded/gems/gems/vagrant-1.9.7/bin/vagrant:141:in

'

guysoft commented 7 years ago

Ok. So:

  1. You need to run ../../CustomPiOS/src/update-custompios-paths as stated in the readme. In case you didn't you need to git clone CustomPiOS too now, see the README.
  2. I removed the build command from the provision command, because its two seprate parts, so you need to use now vagrant/run_vagrant_build.sh after you run sudo vagrant up.

Hope that helps, post if you have any issues. It seems like its just you didn't see the new build steps that were added.

klcjr89 commented 7 years ago

I have no idea how to setup PiOS. It was nice that everything was within one repo before. If we can get to the point of avoiding the terminal and making an executable file you click on to build the images we are golden.

Edit 1: Just cloned PiOS, the only place in the OctoPi Readme it says ../../CustomPiOS/src/update-custompios-paths is for Debian, etc and not Vagrant.

Seriously cannot figure this out :(

guysoft commented 7 years ago

Its CustomPiOS. The reason is its a separate repo is because its a complete toolkit to build OSes now. I'll update the readme to include it also to say so for vagrant.

All that script does is add the path of CustomPiOS in custompios_path, which you can see in your vagrant its complaining about.

klcjr89 commented 7 years ago

Ok I got farther this time, and now this error/issue has appeared in the Terminal output:

The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!

mount -o vers=3,udp 192.168.55.1:/Users/Ken/CustomPiOS/src /CustomPiOS

Stdout from the command:

Stderr from the command:

mount.nfs: requested NFS version or transport protocol is not supported

guysoft commented 7 years ago

Ok, so good news and bad news. The good new is your a not alone, its a common OS X error and you can see it here: https://github.com/mitchellh/vagrant/issues/7646

The bad news is that there are several possible causes. After reading it the mains ones that stand out are:

  1. Someone writes: "I had 127.0.0.1 localhost commented out in my /etc/hosts file on my mac and I uncommented it and now nfs mounting works." - two users at the end report this fixes the issue for them.
  2. Try rebooting your NFS might be stuck
  3. Try figuring out if you have NFS 3 or 4. If its 4 you might need to update the Vagrantfile to include a 4 and not a 3.
klcjr89 commented 7 years ago

Looks like there was an extraneous newline character added to the custompios_path file which generated the above error, before you replied I typed this comment. I didn't experience what you described above, but I can confirm the newline character is what caused the previous issue I posted.

However, I have ran into a new issue:

==> default: Setting up realpath (8.26-3ubuntu3) ... ==> default: Setting up zip (3.0-11) ... ==> default: Processing triggers for systemd (232-21ubuntu5) ... ==> default: Setting up qemu-user-static (1:2.8+dfsg-3ubuntu2.3) ... ==> default: Processing triggers for man-db (2.7.6.1-2) ... Kens-MacBook-Pro:vagrant Ken$ run_vagrant_build -bash: run_vagrant_build: command not found -bash: run_vagrant_build.sh: command not found Kens-MacBook-Pro:vagrant Ken$

guysoft commented 7 years ago

try ./run_vagrant_build.sh Note it has a .sh and that some POSIX distros need the ./ at the beginning.

klcjr89 commented 7 years ago

That worked, it appears to be building now. Crosses fingers.

klcjr89 commented 7 years ago

I'm assuming I can make all of the above into a seperate .sh file I can just click on whenever I want to build an image.

guysoft commented 7 years ago

Sure. Script what ever you want and share it :) We are using Jenkins for continuous builds

klcjr89 commented 7 years ago

What about that newline character I mentioned, can this be patched in a new commit for OctoPi?

Maybe add a command to remove any newline in the file at the end of the script.

klcjr89 commented 7 years ago

Update: nevermind about that newline character, It wasn't an issue at all. :)