Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Anyone tried to make a Synology NAS a Gentoo sync mirror?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4922
Location: Dark side of the mood

PostPosted: Wed Jan 10, 2018 5:12 pm    Post subject: Anyone tried to make a Synology NAS a Gentoo sync mirror? Reply with quote

Hi all.

I have a Synology NAS DS416j, which I'd like to use as a Gentoo local rsync mirror, i.e. to be used with emerge --sync on local Gentoo machines. I can't seem to find my way into it and anything I can find seems convoluted and cumbersome. Has anyone tried that?

Thanks for any hint or suggestion.
_________________
Dealing with computers is the best way to get sucked into more troubles than any sane person can cope with!
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
Back to top
View user's profile Send private message
kite14
Apprentice
Apprentice


Joined: 07 Nov 2006
Posts: 194
Location: Pordenone/Italy

PostPosted: Wed Jan 10, 2018 8:04 pm    Post subject: Reply with quote

Hi VinzC,
I have a DS215J and I successfully set up a local portage mirror that works really well (and it's pretty easy to set up, too).
Everything is done mainly via GUI, but you need to ssh into the NAS to add some settings for the rsync server.

Fire up your preferred browser and login into your DSM, then:
1. click on the "Control Panel" icon;
2. activate the "Advanced Mode" (the link is on the upper-right angle of the "Control Panel"window): this will expose some more icon for advanced management;
3. click on the "Task Scheduler" icon;
4. click on the "Create" button and select "Scheduled Task → User defined script";
5. from the following pop-up window, select the "Task settings" tab and write the script to execute; mine looks like this:
Code:
rsync -vaxE --delete --ignore-errors rsync://rsync.gentoo.org/gentoo-portage /volume1/portage

/volume1/portage will be your local portage tree; you have to create this folder in the following steps.
6. select the "Schedule" tab to set the time and frequency you want to run the rsync script;
7. on the "General" tab, you can give your task a name;
8. click OK to save your settings.

This will basically create a cronjob to run according to your settings, but you can also run the script manually at any time by right-clicking on the task and selecting "run".

Now you need to ssh into your NAS as root (use the admin user password).
Create the "portage" folder in the root directory of your NAS:
Code:
mkdir /volume1/portage

Open the configuration file of the rsync deamon /etc/rsyncd.conf (the available text editors are vi and vim) and append the following lines to make the "portage" folder available to the rsync clients, under the label "gentoo-portage":
Code:
[gentoo-portage]
path = /volume1/portage
comment = Gentoo Linux local Portage tree
exclude = /distfiles /packages

Save and exit.
That's it.

To set up the local clients, just open the file /etc/portage/repos.d/gentoo.conf , comment out the sync-uri line and add the new mirror uri:
Code:
# sync-uri = rsync://rsync.gentoo.org/gentoo-portage
sync-uri = rsync://<NAS_IP_ADDRESS>/gentoo-portage


Happy sync'ing!
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4922
Location: Dark side of the mood

PostPosted: Thu Jan 11, 2018 2:45 pm    Post subject: Reply with quote

Thanks a lot kite14.

I must confess I ran into several issues, some of which I haven't been able to solve yet. The first one was that rsync seemed to stall on the NAS; I ran it on the command line and with the cron job, same results. It was only when I did
Code:
ping rsync.gentoo.org
that I saw the Synology NAS favoured IPv6. Problem is my ISP (*sighs*) still hasn't deployed IPv6 :evil: . Here's the command I run from the NAS:
Code:
rsync -4 -rlpthzOW --safe-links --force --delete --timeout=30 rsync://rsync.gentoo.org/gentoo-portage /volume1/Install/portage
which is exactly the same as that ran by a Gentoo machine.

The issue I have now is that one, when I run emerge --sync from a Gentoo client:
emerge --sync:
>>> Syncing repository 'gentoo' into '/portage.d/portage'...
>>> Starting rsync with rsync://192.168.x.y/gentoo-portage...
receiving incremental file list
rsync: change_dir "/metadata" (in gentoo-portage) failed: Permission denied (13)
...

I have tried using the rsync command you've given but there's no difference. Any hint?
_________________
Dealing with computers is the best way to get sucked into more troubles than any sane person can cope with!
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...


Last edited by VinzC on Thu Jan 11, 2018 2:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 6342
Location: Saint Amant, Acadiana

PostPosted: Thu Jan 11, 2018 2:56 pm    Post subject: Reply with quote

Is a full local repo the best solution for you? I do it much simpler, one machine syncs and shares /usr/portage over NFS, all other boxes mount it and there are no multiple copies of portage and distfiles on my LAN.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4922
Location: Dark side of the mood

PostPosted: Thu Jan 11, 2018 2:57 pm    Post subject: Reply with quote

Jaglover wrote:
Is a full local repo the best solution for you? I do it much simpler, one machine syncs and shares /usr/portage over NFS, all other boxes mount it and there are no multiple copies of portage and distfiles on my LAN.

Either is good enough. I just hate it when I don't understand why it doesn't work.
_________________
Dealing with computers is the best way to get sucked into more troubles than any sane person can cope with!
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 507
Location: Germany

PostPosted: Fri Jan 12, 2018 7:19 am    Post subject: Reply with quote

Have you checked permissions of rsync process on NAS and of /volume1/portage/metadata ?
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4922
Location: Dark side of the mood

PostPosted: Fri Jan 12, 2018 7:46 am    Post subject: Reply with quote

v_andal wrote:
Have you checked permissions of rsync process on NAS and of /volume1/portage/metadata ?

Yep, I have. They're just the same as the parent directory: 755 owned by root:root. Process rsync is running as root.
_________________
Dealing with computers is the best way to get sucked into more troubles than any sane person can cope with!
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
Back to top
View user's profile Send private message
kite14
Apprentice
Apprentice


Joined: 07 Nov 2006
Posts: 194
Location: Pordenone/Italy

PostPosted: Fri Jan 12, 2018 2:49 pm    Post subject: Reply with quote

Hi VinzC,
the permissions setting is the same as mine... I can't think why you get that error.

I see the location for the local repo on your NAS is /volume1/Install/portage, which is fine, but have you checked that this path is consistent with the configuration in /etc/rsyncd.conf ?
Code:
...
...

[gentoo-portage]
path = /volume1/Install/portage
comment = Gentoo Linux local Portage tree
exclude = /distfiles /packages


How do you run the sync command on your clients? Do you run it as root or as a normal user which is part of the "portage" group?
What are the permissions of /usr/portage on your clients?
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4922
Location: Dark side of the mood

PostPosted: Fri Jan 12, 2018 4:06 pm    Post subject: Reply with quote

Hi again kite14. I'm using emerge --sync as usual, stock permissions on my clients' portage directories, like I always do since I started Gentoo. FTR I've already setup local rsync mirrors without a hitch and one [notable] difference I spotted on the Synology NAS is the use chroot parameter... which was set to "no". I switched it to "yes" and *poof* no more errors!

Thanks a whole bunch for this wonderful tutorial, that said 8) .

Note that on my NAS configuration (Control panel > File services) I've had to check "Enable rsync service". It doesn't matter if "Enable rsync account" is checked or not.
_________________
Dealing with computers is the best way to get sucked into more troubles than any sane person can cope with!
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
Back to top
View user's profile Send private message
kite14
Apprentice
Apprentice


Joined: 07 Nov 2006
Posts: 194
Location: Pordenone/Italy

PostPosted: Fri Jan 12, 2018 7:45 pm    Post subject: Reply with quote

VinzC wrote:
...
FTR I've already setup local rsync mirrors without a hitch and one [notable] difference I spotted on the Synology NAS is the use chroot parameter... which was set to "no". I switched it to "yes" and *poof* no more errors!

Note that on my NAS configuration (Control panel > File services) I've had to check "Enable rsync service". It doesn't matter if "Enable rsync account" is checked or not.


Yeah, you're right for both the chroot parameter and enabling the rsync service: I should have pointed these out in my previous posts, I'm sorry... :oops:
I took for granted you were following the wiki page "Local Mirror", where the sample of /etc/rsyncd.conf shows "chroot = yes"

VinzC wrote:

Thanks a whole bunch for this wonderful tutorial, that said 8) .

It's a pleasure!
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2332

PostPosted: Fri Jan 12, 2018 7:58 pm    Post subject: Reply with quote

So with this working arrangement, the synology actually does the rsync? Or a gentoo box mounts an nfs share and does the sync, which all other gentoo boxes take advantage of?
Back to top
View user's profile Send private message
kite14
Apprentice
Apprentice


Joined: 07 Nov 2006
Posts: 194
Location: Pordenone/Italy

PostPosted: Fri Jan 12, 2018 9:20 pm    Post subject: Reply with quote

1clue wrote:
So with this working arrangement, the synology actually does the rsync?

Yes, that's exactly how my Synology works.

The NFS share solution, as suggested by Jaglover, looks convenient, but I have a couple of laptops that need a local copy of the portage tree, so I can update them even when they're not connected to my home LAN.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum