Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the user has no internet connection lib.sh won't load causing wrong error to appear #200

Closed
enoch85 opened this issue Apr 13, 2017 · 22 comments

Comments

@enoch85
Copy link
Member

enoch85 commented Apr 13, 2017

I've got several reports lately that users get You are not root when in fact they are. The cause of this is that they have no internet connection and lib.sh won't load, which causes the the wrong error to appear. As soon as the fix their network connectivity the scripts load without any issues. We should make this failsafe instead somehow, or at least show that it's their connection that is failing rather than telling them that they are not root.

Maybe we should include lib.sh locally, or include the functions of network_ok is_root directly in the scripts instead of fetching them from lib.sh?

Do you have another solution in mind @morph027

@morph027
Copy link
Collaborator

Either this or add another check, if a function is declared....

@enoch85
Copy link
Member Author

enoch85 commented Apr 14, 2017

@morph027 You mean add a check in every script or in lib.sh?

@morph027
Copy link
Collaborator

Must be in scripts...will try to find the best solution.

By the way .... this would just work if the user clones the whole repo ;)

@morph027
Copy link
Collaborator

morph027 commented Apr 14, 2017

# Check if root
declare -F is_root &>/dev/null || ( echo "something went wrong fetching lib.sh, please check your internet connection" ; exit 1)
if ! is_root
 ...

@enoch85
Copy link
Member Author

enoch85 commented Apr 14, 2017

this would just work if the user clones the whole repo ;)

Sure, but that's not the intention here. :)

Let's add your fix to the setup script for now, and if I don't get any more mails regarding it then let's add it everywhere. Can you make a PR please? @morph027

@enoch85
Copy link
Member Author

enoch85 commented Apr 14, 2017

Created a FAQ entry for it: https://github.com/nextcloud/vm#faq

An even better solution would be to add the is_root + the network_ok function in the startup script becuase then the script would change IFACE and fix the issue. That's how it's designed before we started to import the lib file: https://github.com/nextcloud/vm/blob/master/nextcloud-startup-script.sh#L24-L37

That would require $IFACE as well btw...

morph027 pushed a commit that referenced this issue Apr 14, 2017
@enoch85
Copy link
Member Author

enoch85 commented Apr 14, 2017

This should be fixed now 157bac4

@enoch85 enoch85 closed this as completed Apr 14, 2017
@enoch85
Copy link
Member Author

enoch85 commented Apr 24, 2017

@morph027 I tested it, and it works, but it's not perfect. You have to rerun the script and there is an error message (can't see it properly to tell what it is) as well.

I was thinking, maybe we don't need https://github.com/nextcloud/vm/blob/master/nextcloud-startup-script.sh#L6-L7 +[ IFACE ] here https://github.com/nextcloud/vm/blob/master/nextcloud-startup-script.sh#L50 as the variables is already in the script. What do you think?

@morph027
Copy link
Collaborator

But they should be derived from lib.sh when it's being loaded...the second thing with lswh is some kind of fallback.

@enoch85
Copy link
Member Author

enoch85 commented Apr 24, 2017

I fixed it in the latest PR. Now it's perfect! :)

@morph027
Copy link
Collaborator

Great. Had not time to look into yet. We should probably leave the whole network configuration to the user (just too many varieties there) and only read values from the config instead of breaking the existing setup at every run.

@enoch85
Copy link
Member Author

enoch85 commented Apr 24, 2017

The thing with the VM is that everything is suppose to be automated. Most of the users come from Windows and don't even know what sudo is, so expecting them to set the correct network is a bit too much to ask.

This works, and have always worked, just needed to reload the lib once network was failing. :)

@enoch85
Copy link
Member Author

enoch85 commented Apr 24, 2017

Just checked, we give them the option to change interfaces if the network setup fails: https://github.com/nextcloud/vm/blob/master/nextcloud-startup-script.sh#L213 so all is good here. :)

@morph027
Copy link
Collaborator

👍

@jcconnell
Copy link

jcconnell commented Aug 26, 2017

UPDATE: Immediately after posting this I noticed the curl error. I installed curl and now the installation has started. Hope this helps anyone that comes after me.

I am having this issue on Ubuntu 16.04.03 with Proxmox as the hypervisor.

From the proxmox console:

sudo apt update && sudo apt upgrade && sudo adduser jcconnell
sudo adduser jcconnell sudo

After logging in via ssh as the jcconnell user

jcconnell@cloud:~$ sudo bash nextcloud_install_production.sh
nextcloud_install_production.sh: line 11: curl: command not found
nextcloud_install_production.sh: line 19: debug_mode: command not found
nextcloud_install_production.sh: line 22: is_root: command not found

Sorry, you are not root.
You must type: sudo bash /nextcloud_install_production.sh

I have network connectivity.

@enoch85
Copy link
Member Author

enoch85 commented Aug 26, 2017

curl is installed by default in Ubuntu 16.04 so your issue is odd, to say the least.

@jcconnell
Copy link

I'm using the Ubuntu 16.04 template provided by Proxmox. The template was downloaded several months ago.

I'm updating Proxmox and the templates now and I'll report back if the new template includes Curl.

@enoch85
Copy link
Member Author

enoch85 commented Aug 26, 2017

I can't answer for templates. The VM contains Ubuntu in it self, so I don't know why you bother with a template from Proxomox?

Just do what it says in the instructions and you'll be fine.

@jcconnell
Copy link

The templates are an easy way of provisioning an LXC container on a Proxmox host. It's effectively a fresh install of Ubuntu 16.04.

Am I incorrect in thinking that this script should be run on a clean install of Ubuntu 16.04? I've tried the install four times now and each time have had an issue. I'm never able to access the web interface upon completion.

@enoch85
Copy link
Member Author

enoch85 commented Aug 26, 2017

I don't use Proxmox so I really don't have a magic answer to your question. Sorry.

Though I know other users that successfully ran both the script and the VM (OVA) in Proxmox. I've also helped one guy installing it in Proxmox, but that was some time ago and I don't remember how I did. I don't know if Proxmox has a import funtion for OVAs? In that case, just import it and you're good (with the correct settings ofc).

Bottom line, the scripts work, the VM works. Often it's user configuration that makes it fail.

@jbelascoain
Copy link

@jcconnell
sudo apt-get install curl
sudo bash nextcloud_install_production.sh

@enoch85
Copy link
Member Author

enoch85 commented Oct 28, 2017

@jbelascoain curl is installed by default in Ubuntu Server, no need to install it as you described. Thanks for your input though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants