Page 4 of 6

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 00:50
by Nostalgist92
Updated the steps above again.
Added the make directory first but also changed the bottom command, maybe that is the issue.
Also added cd to new thebrig directory to eliminate any issues there.

I'll browse around the thebrig forums to see if anyone else is having the same issues.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 11:14
by jistme
Hithere,

Those changes helped, the jail is now operational again, but now I get stuck at the point where I have to execute '/tmp/owncloud_injail.sh'
As you can see it says: "command not found":

Image

edit,
just tried to ping the jail (192.168.2.101), and there seems to be a problem there:

Code: Select all

Pinging 192.168.2.101 with 32 bytes of data:
Reply from 192.168.2.101: bytes=32 time<1ms TTL=64
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.2.101:
    Packets: Sent = 4, Received = 1, Lost = 3 (75% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
    
edit2:

restarted nf4, started the jail manually (it doesn't seem to start automatically although that is set), but: /tmp/owncloud_injail.sh again results in the same error: "command not found".
Pinging the jail goes well now.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 12:12
by Nostalgist92
Sorry about that, wasn't a problem on your end.
The script was saved in Windows/DOS format (So bloody annoying when Brackets does that)

This causes a "command not found" error. It's been converted back to unix now! So redownload the script and you should be right to go!

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 12:37
by jistme
no problem
Started again with a new jail.
Now I get stranded here:

Code: Select all

 nas4free: thebrig# jexec owncloud csh
root@owncloud:/ # pkg install nano
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly, pl                ease wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly/Latest/pkg                .txz: Protocol not supported
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: 'ports-mgmt/pkg'.
root@owncloud:/ #

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 12:43
by Nostalgist92
Sigh, back at this problem with jails again huh?

It was an issue i had a while ago myself. Got a notepad file somewhere around with what i did to fix it but might take a while to find haha, will post back soon!

Edit: Thinking it isn't the same problem i had a while ago, might just be network config error.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 12:51
by jistme
I hope you don't mind that I chose to shutdown my own brain for this exercise. I am only following your lead, trying not to mess up things by thinking that I might be clever enough to find some solutions by myself, and perhaps forgetting to inform you what I did besides what you are telling me.
Call me Guinnee pig for the time being ;-)

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 13:47
by Nostalgist92
jistme wrote:I hope you don't mind that I chose to shutdown my own brain for this exercise
Haha no problem at all!
Although sometimes trying to think of clever ideas yourself makes you learn new things completely unrelated! Or is that just me? haha
jistme wrote:The new jail shows up correctly, but I can't get it started, it will remain 'stopped'.
This is usually due to incorrect network config, something as simple as missing the subnet at the end "/24" or fstab configuration in thebrig gui. You can fix that by running this command (inside the host system and replacing "owncloud" with your jail name):

Code: Select all

rm /var/run/jail_owncloud.id
Then make sure jail settings are correct and it should start up fine
_______________________________________________________________________________________
jistme wrote:restarted nf4, started the jail manually (it doesn't seem to start automatically although that is set)
This one is a bit decieving, you have to enable 2 things for automatic startups.
First thing is the "Allow start all jails" in the Globals section on the main webgui page of the brig
And second thing is the "Start on boot" setting ticked inside of the jails settings.
_______________________________________________________________________________________
Just a thought, potentially not related to any problems the least bit:
Not sure what router you are using/how many devices you have connected to it or however else you have it set up but some routers start assigning addresses at 192.168.1.100, other routers start at 192.168.1.2 etc. so depending on your setup it may be worth trying the higher ranges? Such as 192.168.1.200 and upwards for jails. If your jail attempts to use an ip that the router has already assigned to another device, bad things happen :P
_______________________________________________________________________________________
You have internet connectivity im guessing otherwise you wouldnt be able to download the script

Various things you can try:

Try 'pkg install nano' inside the host system to see if you can get packages there.
Double check your jail settings to make sure IP is set up right (Right down to the subnet [192.168.2.101/24])
Sometimes the jail doesn't always save the network settings properly so i tend to create the jail then go back in to the settings to make sure the network ip etc. is set up correctly.

Inside the jail try these things:
Make sure the jail itself can reach the internet

Code: Select all

ping 8.8.8.8

Code: Select all

pkg update -f
(Might be pkg upgrade -f instead)

Try the old pkg_add tool:

Code: Select all

pkg_add -r pkg
_______________________________________________________________________________________

That's all i got right now without rebooting my nas, accidentally locked myself out xD (partner will kill me if i do that before her movie finishes!)

We can also try installing directly from the ports tree (Will update this post soon with how to do that)
Alright, here we go for the port install:
First, head to thebrig gui, click on the "Updates" tab then "Central Ports"
Click "Fetch & Update" (I can't remember if there was a progress bar for this or not) once it's done, after refreshing the page the "Current Status" will say something like:

Code: Select all

The latest snapshot available for download is dated: Sat Mar 12 22:36:34 AEST 2016
You have downloaded a snapshot that was released: Tue Feb 16 00:20:58 AEST 2016
The last time you applied a downloaded snapshot was: Tue Feb 16 00:42:45 AEST 2016
Now we tick the box for your owncloud jail and hit "Save" down the bottom left.
You shouldn't have to restart the jail for it to take effect but for good measure, do that before proceeding.

Once that's all done, log in to the jail and run these commands (Might not need the first 2 lines, can't remember for jails):

Code: Select all

portsnap fetch extract
portsnap fetch update
cd /usr/ports/ports-mgmt/pkg && make UPGRADEPKG=1 install clean
_______________________________________________________________________________________

Surely something above will work! haha

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 12 Mar 2016 16:02
by jistme
I'm sorry, I am giving up on this for this weekend. I am sliding into a irritated and impatient mood, which isn't helpful.
It feels like taking 2 steps forward and three steps back every time.

With another new effort now I get stranded with new error messages.
Btw I tried ping 8.8.8.8 from the jail before, and that went well. Now I can't even get that to work.
Thnx again, and enjoy your weekend!

Code: Select all

Proceed with this action? [y/N]: y
[owncloud.local] Fetching nano-2.4.3.txz: 100%  398 KiB 407.5kB/s    00:01
[owncloud.local] Fetching indexinfo-0.2.4.txz: 100%    5 KiB   5.0kB/s    00:01                                                
[owncloud.local] Fetching gettext-runtime-0.19.6.txz: 100%  147 KiB 150.6kB/s                                                   00:01
Checking integrity... done (0 conflicting)
[owncloud.local] [1/3] Installing indexinfo-0.2.4...
[owncloud.local] [1/3] Extracting indexinfo-0.2.4: 100%
[owncloud.local] [2/3] Installing gettext-runtime-0.19.6...
[owncloud.local] [2/3] Extracting gettext-runtime-0.19.6: 100%
[owncloud.local] [3/3] Installing nano-2.4.3...
[owncloud.local] [3/3] Extracting nano-2.4.3: 100%
root@owncloud:/ # fetch -o /tmp/owncloud_injail.sh http://vengefulsyndicate.com/                                               download/12097/
fetch: http://vengefulsyndicate.com/download/12097/: No address record
root@owncloud:/ # fetch -o /tmp/owncloud_injail.sh http://vengefulsyndicate.com/download/12097/
/tmp/owncloud_injail.sh                        97% of   13 kB  107 kBps 00m01s
fetch: /tmp/owncloud_injail.sh appears to be truncated: 13618/13980 bytes
root@owncloud:/ # fetch -o /tmp/owncloud_injail.sh http://vengefulsyndicate.com/download/12097/
/tmp/owncloud_injail.sh                        97% of   13 kB  128 kBps 00m00s
fetch: /tmp/owncloud_injail.sh appears to be truncated: 13618/13980 bytes
root@owncloud:/ # root@owncloud:/ # fetch -o /tmp/owncloud_injail.sh http://vengefulsyndicate.com/                                               download/12097/
root@owncloud:/: Command not found.
root@owncloud:/ # fetch: http://vengefulsyndicate.com/download/12097/: No address record
fetch:: Too many arguments.
root@owncloud:/ # root@owncloud:/ # fetch -o /tmp/owncloud_injail.sh http://vengefulsyndicate.com/download/12097/
root@owncloud:/: Command not found.
root@owncloud:/ # /tmp/owncloud_injail.sh                        97% of   13 kB  107 kBps 00m01s
/tmp/owncloud_injail.sh: Permission denied.
root@owncloud:/ # fetch: /tmp/owncloud_injail.sh appears to be truncated: 13618/13980 bytes
fetch:: Too many arguments.
root@owncloud:/ # root@owncloud:/ # fetch -o /tmp/owncloud_injail.sh http://vengefulsyndicate.com/download/12097/
root@owncloud:/: Command not found.
root@owncloud:/ # /tmp/owncloud_injail.sh                        97% of   13 kB  128 kBps 00m00s
/tmp/owncloud_injail.sh: Permission denied.
root@owncloud:/ # fetch: /tmp/owncloud_injail.sh appears to be truncated: 13618/13980 bytes
fetch:: Too many arguments.
root@owncloud:/ # root@owncloud:/ #
root@owncloud:/: Command not found.
root@owncloud:/ # ping 8.8.8.8
ping: socket: Operation not permitted
root@owncloud:/ #

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 13 Mar 2016 02:29
by Nostalgist92
jistme wrote:

Code: Select all

fetch: /tmp/owncloud_injail.sh appears to be truncated: 13618/13980 bytes
Seems this was another error not on your end, apparently the file didn't reupload properly when converting to unix format. Reuploaded properly now!

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 14 Mar 2016 11:50
by jistme
Started again wit a clean slate. All steps went well this time.
The only issue I encountered this time, is that at the step where you enter the url of owncloud in your browser to finalize the settings there, the url was not found. I then also could not ping it's IP. I checked the jail settings, it was running, and all settings seemed fine. But thankfully after rebooting n4f, I could open owncloud.
But again, at entering the password (yes, using only 'test' as a password) I get the same error.

Image

So I am back at square one once again.

If this error is really about a wrong password, could it be something with Putty's keyboard handling or settings? Could it be my web browser?
This time I typed 'test' in all instances, but in previous attempts I have also used copy/paste for the password to make sure I made no errors. (when I was using a complicated password)


And to be sure and mention this:
I am using out of the box settings for the clean nf4 installations.
For nf4 itself I have not enabled https, changed user rights or groups, etc. etc.
Could it be I am missing some prerequisite in setting up nf4 before setting up the jail and owncloud?

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 14 Mar 2016 14:01
by Nostalgist92
Copying & pasting is a bit funky with PuTTY, highlighting text = copy and right mouse click = paste
Of course with passwords inside of putty you cannot see the input of the password so attempting to copy from the putty window wont work.
If you try using Ctrl+V to paste in to putty you got something like ^V instead of the expected result.

Unless that's what you were doing then you've got me stumped lol.

Have you tried logging in to the mysql instance from within putty using the same login details created during the script? (I think i put those steps in a post somewhere earlier)



Edit: Link to said post with the details on how to log in to mysql: viewtopic.php?f=79&t=9383&start=60#p66298 (#1 and #3)



Edit 2: Answering a couple questions:
jistme wrote:could it be something with Putty's keyboard handling or settings?
Potentially? See about the copy & pasting above.
jistme wrote:Could it be my web browser?
Unlikely. I normally use chrome but i'm pretty sure i've also used firefox successfully. Browser shouldn't affect anything.
jistme wrote:Could it be I am missing some prerequisite in setting up nf4 before setting up the jail and owncloud?
I don't think so, N4F itself doesn't need anything other than a jail, all other prerequisites for owncloud are installed via the script. Although, "Enable mount devfs" does need to be enabled in the jail otherwise mysql has problems sometimes (This should be enabled in new jails by default now but in case it isn't, you can find it in the jails settings by clicking the "more" button at the bottom left).

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 14 Mar 2016 14:08
by jistme
Thnx Nozza,
But as I have said, I have both tried typing, copy/paste, complicated passwords, simple passwords, etc.
I will try your other suggestions (not today), but I have a feeling the basic issue must lie somewhere else.
Or perhaps I am just a complete and total idiot.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 14 Mar 2016 14:21
by Nostalgist92
Haha i'm sure it's something so simple that it will make me look equally like an idiot.

If #3 fails of the post linked above then we will tackle this by using 2 jails instead of 1 and see how we go with that. The good news of this being you wont have to run the entire owncloud script again! :P Plus a dedicated sql jail you can hook anything in to :D

I'll retest my mysql script before posting the instructions for that to make sure it works fine and dandy and has all the right helpful information in it.

I'll actually try testingfrom scratch on a completely different rig that is just collecting dust at some point tomorrow as well, see if i can reproduce any errors there.

For now, sleep must be had!

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 20 Mar 2016 11:44
by jistme
I gave it another shot today. Upgraded my n4f (now rel.2433), reinstalled thebrig, followed all the usual steps.
At the end when trying to login to OwnCloud, again I got the same error.
But!... I then performed the suggested action #1 from your earlier post (#63)
And indeed, this time the password was accepted, and I believe OwnCloud then started to finalize some settings.
But then I got an OwnCloud page telling me:

Image

Pressing the "Add..." at the bottom doesn't help getting past this.

I earlier noticed that your script expects this might happen, and presents the question:
"Once the page reloads, do you have a 'untrusted domain' error? [Y/n]"

But at that moment, I pressed 'N', since it wasn't relevant at that moment yet.
And now, after having performing the 'password fix' commands, I don't know how to get back to that question, and answer 'Y' this time.

But it's good news, it seems we are getting very close to success here!
Do you have some magic commands for me to perform to also clear this 'untrusted domain' hurdle?
(I found some YT tutorials on this matter, but they were in reference to domain names, not to local ip numbers such as my case seems to be here)

Hopefully you are also able to figure out what causes the original password problem, now that we know that you suggestion #1 from post#63 fixed it?


edit:
And let me anticipate on my probably next request to you:
After the login is fixed, I will probably want to change the database password (currently 'test')
I am assuming that cannot be done from within OwnCloud, but has to be done with some terminal commands abracadabra?
Would you be so kind to provide that abracadabra too?

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 20 Mar 2016 22:26
by ernie
I have also an issue with same message than #104 post.

I see that the script asks such case:

Code: Select all

Make sure you click 'Storage & database'
 
 Database user = root | Database password = 
 the mysql password you chose earlier during the script.
 Database name = your choice (just owncloud is fine)
 
 Once the page reloads,
   do you have a 'untrusted domain' error? [Y/n] y
 
 Doing some last second changes to fix that..
 
cat: /usr/local/www/owncloud/config/old_config.bak: No such file or directory
 Done, continuing with the rest of the script
 
-------------------------------------------------------
 It looks like we finished here!!! NICE
I answered Yes but there is an error:
cat: /usr/local/www/owncloud/config/old_config.bak: No such file or directory

How can I solve this ?

If I tested the script with owncloud 8.2.2, no issue. Only with 9.0.0

I tested this: I change in the file usr/local/www/owncloud/config/config.php:
'trusted_domains' =>
array (
0 => '192.168.rrr.zzz:81',

by:
'trusted_domains' =>
array (
0 => '192.168.rrr.zzz',

And it works. It can help you in order to modify the script

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 06:17
by Nostalgist92
ernie wrote: I answered Yes but there is an error:
cat: /usr/local/www/owncloud/config/old_config.bak: No such file or directory
No reason for you to fix this, looks like I missed a command in the script, will update and reupload soon.
ernie wrote:If I tested the script with owncloud 8.2.2, no issue. Only with 9.0.0
I tested this: I change in the file usr/local/www/owncloud/config/config.php:
This was already fixed up in the script for 9.0.0 (8.2.2 doesn't get this error), the "No such file or directory" from before is why the fix didn't work correctly.

Thanks for pointing it out Ernie, i was sure i'd tested the script but i guess not fully. Your 2 problems are really just the 1 issue.

Edit: It's been updated and working as it should now.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 07:49
by Nostalgist92
jistme wrote:Pressing the "Add..." at the bottom doesn't help getting past this.
Sorry about that, i missed a command in the script that was part of fixing that.
Edit: i didn't read your post properly, oops, completely unrelated to my mistake of missing a command then xD

Without having to run the script again you can do the following to fix that:

Code: Select all

jexec yourowncloudjailid csh
nano /usr/local/www/owncloud/config/config.php
Once you are in there find the line that says:
"'192.168.1.215:81'"
You can either remove the ":81" or add another line so it looks like this:

Code: Select all

  array (
    0 => '192.168.1.215:81',
    '192.168.1.215',
  ),
jistme wrote:And let me anticipate on my probably next request to you:
After the login is fixed, I will probably want to change the database password (currently 'test')
I am assuming that cannot be done from within OwnCloud, but has to be done with some terminal commands abracadabra?
Would you be so kind to provide that abracadabra too?
Alright, pretty sure this alone should do it

Code: Select all

jexec owncloudjailid csh
mysqladmin -u root -p'CURRENTROOTPASSWORD' password 'NEWROOTPASSWORD'
No need to modify any owncloud files/settings to update changes
(root user at initial setup page is only used to create a new user called "oc_admin" and creates a password for it)

Edit: After actually going back and reading your post properly this time rather than just skimming over it.. lol i noticed you mentioned that you created an owncloud user in mysql following the steps from post 63, did you use "test" for this users password also?

If you did we might have to do a little bit more but otherwise, i think you should be pretty much right to go now!

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 12:04
by jistme
Nostalgist92 wrote: Once you are in there find the line that says:
"'192.168.1.215:81'"
You can either remove the ":81" or add another line so it looks like this:
Yes, yes, yes, yes!
I am in!
Thank you for your support and patience Nozza!

Alright, pretty sure this alone should do it

Code: Select all

jexec owncloudjailid csh
mysqladmin -u root -p'CURRENTROOTPASSWORD' password 'NEWROOTPASSWORD'
That works, well I think, I am not really sure actually.
When I ran it, it did not say something like "password successfully changed"
After pressing [Enter] it only gave this warning text.(see below)
Is that asking for a confirmation of the password, or has it been refused since it is 'insecure'? Or can I consider it to say that changing the password has been successful, but it also says I had better not done it over this 'insecure' command line interface?

Code: Select all

root@owncloud:/ # mysqladmin -u root -p'test' password '************'
Warning: Using a password on the command line interface can be insecure.
root@owncloud:/ #
i noticed you mentioned that you created an owncloud user in mysql following the steps from post 63, did you use "test" for this users password also?
If you did we might have to do a little bit more but otherwise, i think you should be pretty much right to go now!
I followed the instructions I created from the content of several postings and the YT video tutorial. I updated these instructions every time I encountered an issue, and a fix... So I don't really know if I actually used exact steps from that posting. (but if it's important at a later moment I can figure that out of course)
But I am pretty sure in all my last efforts I did not use Putty for creating an OwnCloud user. That only happened at the step where I enter OwnCloud through my web browser.

But for the sake of understanding (the mind of a noob ;-) , at the point where the script asks to enter a password for root, you first [Enter] with a blank because there is no password set yet, and then you enter a new one (where I did use 'test'), would you call that action:
1. setting a password for a user named 'root', who is granted access to that owncloud database.
2. setting a password for the MySQL database itself?
Maybe not important, or just semantics, but it might be good for me to understand and use the correct terminology and concepts here.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 12:29
by Nostalgist92
jistme wrote:

Code: Select all

Warning: Using a password on the command line interface can be insecure.
Yep, the password for root changed successfully, it's just saying that because of the way you changed it, it may not be secure as somebody can see the new password by watching over your shoulder / commands you have entered can be recalled by somebody witty enough (still requires root access to the jail by memory so not so much of an issue)

jistme wrote:So I don't really know if I actually used exact steps from that posting. (but if it's important at a later moment I can figure that out of course)
But I am pretty sure in all my last efforts I did not use Putty for creating an OwnCloud user. That only happened at the step where I enter OwnCloud through my web browser.
It should be fine either way, changing the password for the root user shouldn't have any effect on the user owncloud uses.
jistme wrote:But for the sake of understanding (the mind of a noob ;-) , at the point where the script asks to enter a password for root, you first [Enter] with a blank because there is no password set yet, and then you enter a new one (where I did use 'test'), would you call that action:
1. setting a password for a user named 'root', who is granted access to that owncloud database.
2. setting a password for the MySQL database itself?
Maybe not important, or just semantics, but it might be good for me to understand and use the correct terminology and concepts here.
Forgive any confusing parts here in advance, i'll try to keep it simple but at the same time explain why it does things the way it does.

For 1: Setting password for root part is correct, second half of the sentence is not quite right though,
"root" user should always exist (think of it as the "Admin" user that has access to all things mysql related).
When we fill out the root users credentials at the owncloud setup page in your web browser, by using "root" users credentials to access the mysql database we are basically giving owncloud permission to temporarily use this root account so that it may create another account and generate a random password to be used exclusively for owncloud ("oc_admin" is the user it creates). Once owncloud has created this new user and stored its credentials in the owncloud configuration file, it no longer uses the "root" users access (unless you force owncloud to by changing the database settings in the config.php file).
This "oc_admin" user has access to everything inside the "owncloud" database (or whatever database name you used at the setup page) but not complete access to everything like "root" does (Let's say you create another database in mysql, "root" will have access to it as it's the "primary admin", "oc_admin" user will not have access to this database unless you choose to allow it by using "root" to give it access").

It does this as an attempt to tighten security a little more. If owncloud only uses the new "oc_admin" account and somebody manages to hack it, they won't get full "root" privileges. They will only get all of "oc_admin's" privileges. It's not too much of a big deal when you are only using owncloud and its inside a jail but it becomes a risk when you have other databases inside mysql as well.

Hope that provides a bit of knowledge on how it works :)

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 12:48
by jistme
Nostalgist92 wrote: Forgive any confusing parts here in advance, i'll try to keep it simple but at the same time explain why it does things the way it does.
Hope that provides a bit of knowledge on how it works :)
Thnx, it certainly does.
Being a rather experienced and long-time Windows user, I tried to educate myself a bit on the different concepts of 'users' and 'groups' that unix-like languages have before.
But it's sometimes just a bit difficult to learn and really understand some new tricks and concepts.
Your explanation certainly helps to get some more sense in those pieces of that puzzle.

Thnx again, if it's beer time in your zone, drink one to your own health!
I'll do that in a couple of hours too ;-)

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 13:00
by Nostalgist92
Hehe, i was lucky to be naturally curious from a young age so i grew up learning *nix systems as well as windows. Tell you what, i broke a hell of a lot of things trying to learn other things! It does get overwhelming sometimes though. I'd be at a loss if i didn't store some of the more easily forgotten things/random tidbits in various word docs/notepad files..

Might have to save that beer for tomorrow, just about time for sleep! Need an early one before more scripting tomorrow.
Some small changes for this script and also maybe a menu system so that it uses menus with different actions such as Install/Update/Backup/multiple options for fixing things whenever a need for it pops up.
Also plan on merging other scripts in to it as well for other services such as Sonarr/CouchPotato/etc. Big project to keep me entertained. Should prove to be fun!

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 21 Mar 2016 14:02
by jistme
Great, have fun and success with all that.
Let me know if at a certain point you need a guinnee pig to try out a new owncloud script.
I am willing to do it from scratch again if it would help getting the perfect script.
(well, that is never gonna happen is it? There is always a new sort of idiot waiting around the corner ;-)

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 28 Mar 2016 11:26
by Nostalgist92
Yay for new things! New script for owncloud with menus. Because who doesn't like menus? I'll add more information in to the script as time goes on/as the need arises.
This hasn't been fully tested (I've been lazy as lol) so CREATE A NEW JAIL for this if you wish to help test, don't run it in a jail you have already installed owncloud in to.

1. Log in to your jail (substitute "1" with your own jails id or name):

Code: Select all

jexec 1 csh
2. Install nano (If you are asked about updating the package management system at this point, choose yes)

Code: Select all

pkg install nano
3. Get the script (Temporary URL):

Code: Select all

fetch --no-verify-peer -o /tmp/owncloud_injail.sh "https://raw.githubusercontent.com/Nostalgist92/misc-code/master/NAS4Free/OwnCloud/owncloud_injailv2.sh"
4. Make it executable

Code: Select all

chmod a+x /tmp/owncloud_injail.sh
5. Edit the script (Press Ctrl+X then Y then Enter to save your changes)

Code: Select all

nano /tmp/owncloud_injail.sh
6. Run it

Code: Select all

/tmp/owncloud_injail.sh
Still some unfinished parts of it but at least it's a start :P

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 28 Mar 2016 14:33
by jistme
Hey Nozza.

I gave it a try, but I stranded at step 4:

Code: Select all

login as: root
root@192.168.2.100's password:
Last login: Mon Mar 21 11:17:50 2016 from 192.168.2.2
Welcome to NAS4Free!
 nas4free: ~# jexec jail2 csh
root@jail2:/ # pkg install nano
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
[jail2.local] Installing pkg-1.6.2...
[jail2.local] Extracting pkg-1.6.2: 100%
Message from pkg-1.6.2:
If you are upgrading from the old package format, first run:

  # pkg2ng
Updating FreeBSD repository catalogue...
[jail2.local] Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
[jail2.local] Fetching packagesite.txz: 100%    5 MiB   5.5MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 24691 packages processed.
Updating database digests format: 100%
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        nano: 2.4.3
        indexinfo: 0.2.4
        gettext-runtime: 0.19.6

The process will require 3 MiB more space.
550 KiB to be downloaded.

Proceed with this action? [y/N]: y
pkg: http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly/All/nano-2.4.3.txz: No address record
root@jail2:/ # fetch --no-verify-peer -o /tmp/owncloud_injail.sh "https://raw.githubusercontent.com/Nostalgist92/misc-code/master/NAS4Free/OwnCloud/owncloud_injailv2.sh"
fetch: https://raw.githubusercontent.com/Nostalgist92/misc-code/master/NAS4Free/OwnCloud/owncloud_injailv2.sh: No address record
root@jail2:/ # chmod a+x /tmp/owncloud_injail.sh
chmod: /tmp/owncloud_injail.sh: No such file or directory

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 28 Mar 2016 23:20
by Nostalgist92
Hmmm seems something goes wrong with your jail after installing the package management tool.
Not sure why
Try rebooting the jail and try this command in the jail:

Code: Select all

pkg update -f
Maybe try comparing your host nas systems "/etc/resolv.conf" to the jails copy as well to see if that broke after updating pkg.
resolv.conf should something aloong the lines of "nameserver 192.168.1.1" in it (IP being whatever your routers IP address is normally)

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 29 Mar 2016 09:38
by jistme
Nostalgist92 wrote:Hmmm seems something goes wrong with your jail after installing the package management tool.
Not sure why
Try rebooting the jail and try this command in the jail:

Code: Select all

pkg update -f
Maybe try comparing your host nas systems "/etc/resolv.conf" to the jails copy as well to see if that broke after updating pkg.
resolv.conf should something aloong the lines of "nameserver 192.168.1.1" in it (IP being whatever your routers IP address is normally)
I found those two and compared them with norepad++, and they are completely identical:
domain local
nameserver 192.168.2.1

I noticed that after rebooting N4F, the jails don't automatically boot. (previously jail 1 did) I do have 'start on boot' checked at both the main page and the specific jail pages.
After I manually started them both, I get this when trying to enter jail2:

Code: Select all

login as: root
root@192.168.2.100's password:
Last login: Tue Mar 29 09:19:13 2016
Welcome to NAS4Free!
 nas4free: ~# jexec jail2 csh
jexec: jail "jail2" not found
 nas4free: ~#
The jail ip's are respectively set: 192.168.2.101/24 - 192.168.2.102/24

If you suspect this is due to my inexperience with (having more that one) jails, it wouldn't be a big problem for me to start over with a clean and single jail again.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 29 Mar 2016 09:50
by jistme
upd:
I just found that I couldn't even see my n4f and it's shares anymore under Windows network discovery.
After disabling jail2, it thankfully went back to normal.

edit:
I noticed this option field, but I left it at default settings since I don't understand exactly what it does.
Should I change something there?

http://i.imgur.com/cYYT9iV.png

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 30 Mar 2016 07:25
by Nostalgist92
jistme wrote:After I manually started them both, I get this when trying to enter jail2:

Code: Select all

login as: root
root@192.168.2.100's password:
Last login: Tue Mar 29 09:19:13 2016
Welcome to NAS4Free!
 nas4free: ~# jexec jail2 csh
jexec: jail "jail2" not found
 nas4free: ~#
 
Couple of things we can try for this one.
Here is a couple commands you can try out:

Code: Select all

service thebrig start jail2
service thebrig troubleshoot jail2
jexec jail2-ID-instead-of-name csh
When you attempt to stop either jail does the start/stop button change accordingly or does it get stuck as if jail is running? (See about /var/run i posted in some other post above) If this is case double check jail settings again as it usually means something isn't configured correctly (Normally IP, fstab entries or you may have forgotten to select the right "Official BSD Flavor" before creating the jail)
jistme wrote:If you suspect this is due to my inexperience with (having more that one) jails, it wouldn't be a big problem for me to start over with a clean and single jail again.
Multiple jails should never really be an issue no matter how new a user is to thebrig so long as you are using a different ip for each jail and said ip is not being used by anything else on the network.

Speaking of which, your router, is it set for dhcp? (Assign ip addresses to devices automatically). If it does i'd be double checking the ip's of devces assigned to the router to make sure there is no conflict there. Most routers also allow you to manually set the dhcp range of which ip's can be assigned automatically.
Mine for example has a default dhcp range of 192.168.1.100 to 192.168.1.255. I obviously won't ever have 155 devices connected to my router at one time for my home usage so i've changed it to 192.168.1.100 (1.2 to 1.99 are for manual assigned ip's) up to 192.168.1.199 (this ensures 1.200 and up will always be free for my jails usage).

Just some food for thought, may not be any issue there at all for you but without knowing the ins and outs of your setup it's worth a mention :)
jistme wrote: I just found that I couldn't even see my n4f and it's shares anymore under Windows network discovery.
After disabling jail2, it thankfully went back to normal.
Unsure about this one, can't say i've ever had this happen to myself, potentially an IP clash somewhere?
jistme wrote:I noticed this option field, but I left it at default settings since I don't understand exactly what it does.
Should I change something there?

http://i.imgur.com/cYYT9iV.png
That option is fine, i've never changed it at least anyway.

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 30 Mar 2016 09:58
by jistme
Nostalgist92 wrote: Speaking of which, your router, is it set for dhcp? (Assign ip addresses to devices automatically). If it does i'd be double checking the ip's of devces assigned to the router to make sure there is no conflict there. Most routers also allow you to manually set the dhcp range of which ip's can be assigned automatically.
Mine for example has a default dhcp range of 192.168.1.100 to 192.168.1.255. I obviously won't ever have 155 devices connected to my router at one time for my home usage so i've changed it to 192.168.1.100 (1.2 to 1.99 are for manual assigned ip's) up to 192.168.1.199 (this ensures 1.200 and up will always be free for my jails usage).

Just some food for thought, may not be any issue there at all for you but without knowing the ins and outs of your setup it's worth a mention :)
Oh damn.

All this time I have been so much focusing on working out the script and the installation stuff, I never thought for one second about that.
Yes. :oops:
My n4f is set to .100, and my routers' dhcp starts immediately after that at .101
So that might also have been affecting my first jail from the beginning.
I'm gonna give this whole thing a new shot (In a couple of days probably.)

Thank you for having a brain ;-)

Re: [HOWTO] Install Owncloud inside a Jail NAS4Free 10.x

Posted: 30 Mar 2016 10:06
by Nostalgist92
Hehe, in your case maybe use 192.168.2.2 to 192.168.2.99 for jails
Even though your dhcp starts at the 100's, any number below this is fine to use as well (just not 192.168.2.1 as that should be reserved for the router itself / any other ip you have assigned to an address in the lower range)
Also because it starts at 101 this eliminates a step of changing the dhcp range in the router settings yourself :) unless, of course, you wanted to.