nextcloud/vm

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

enoch85 opened this issue · 22 comments

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

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

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

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 ;)

# 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
 ...

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

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...

This should be fixed now 157bac4

@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?

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

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

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.

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. :)

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. :)

👍

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.

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

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.

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.

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.

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.

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

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