| Fix me:
This tutorial was written in September 2007. It describes how to install a chrooted Gentoo on the Synology DS-107 NAS so that we will not break anything.
Firmware version : 0514.
In this procedure, we use the following settings :
- mount point on linux host : public
- nas hostname : nas
- chrooted gentoo root directory on nas : /volume1/public/gentoo
Warning : with this procedure, nas startup time becomes longer because of quota checks. Do not turn off the nas during startup or you might need to reformat the hdd.
This method uses 2006.1 stage (2005.0 stage does not work).
Steps to chroot
Also get last portage version :
Uncompress archive :
We also install portage :
Get some info from base system :
Chroot in the new gentoo environment :
Bonus : you can configure bashrc file.
Fix and Sync
Now we'd like to sync portage...
You can set your own local rsync server so that you will not abuse mirror and benefit from your local network bandwith. In this case, set your own local rsync mirror :
... but sync fails because python is actually broken. We need to manually install python to fix it :
When python is fine, we can use portage. The following commands will emerge portage and almost fix python :
pycrypto is broken :
File "/usr/lib/portage/pym/portage_checksum.py", line 59, in <module> md5hash = _generate_hash_function("MD5", MD5.new, origin="pycrypto") AttributeError: 'module' object has no attribute 'new'
... and portage relies on it. So we remove it, the hard way :
Sync should now work.
You can now add new services to your NAS.
Emerge and generate keys (this is usually done in the init.d script, but I am not able to launch it because of the chrooted environment) :
Fix ssh user updating /etc/passwd :
You might need to fix /var/empty owner :
Mount /dev/pts :
The -4 (ipv4) option is compulsory to avoid the "all ports in use effect".
You can analyze problems adding the -Ded :) options.
On client :
On the nas in /root/.ssh/authorized_keys (copy the line from .ssh/id_rsa.pub) :
And finally :
Improving ssh service
We fake net service status :
It is now seen as running :
nas ~ # /etc/init.d/net.eth0 status * status: started
Start sshd service as usual :
nas ~ # /etc/init.d/sshd start * Starting sshd ... [ ok ]
You can configure your nas to update French network weather data with grenouille.
And just update user.config with username and password.
Install ping :
Mount proc if needed :
Other usefull Gentoo packages :
linux backup with rsync
We mount volume1 in the root of the chroot system. Run under base system :
If you want to backup /etc to the nas :
You can configure backuping for other users :
- Create accounts on the NAS
- Update rsyncd.conf
- Allow ssh connection
- Configure rsync client (exclusions, etc.)
Important note : it seems that the kernel has been patched so that the file system is not aware of case : it is not possible to have two different files with their names only different in case. This may be a problem because afterwards it becomes really hard to remove the files (see Tips)
Add the following lines to /etc/fstab
Fake runlevel :
Fake rc-update data :
Add some services to current runlevel :
List status of all services :
root@nas ~ # rc-status -a Runlevel: boot keymaps [ started ] clock [ started ] urandom [ stopped ] hostname [ started ] net.lo [ started ] localmount [ started ] modules [ started ] checkfs [ stopped ] consolefont [ stopped ] rmnologin [ stopped ] bootmisc [ started ] checkroot [ started ] Runlevel: default local [ started ] net.eth0 [ started ] sshd [ stopped ] netmount [ started ] Runlevel: nonetwork local [ started ] Runlevel: single Runlevel: UNASSIGNED crypto-loop [ stopped ] dropbear [ stopped ] numlock [ stopped ] rsyncd [ stopped ] syslog-ng [ stopped ]
There may be some differences with your rc-status report as I have manually started some services...
We need to fix status of all services from boot level. Only these two ones are really needed :
It is now possible to start all services :
We will use the rc script to start everything. proc will not be automatically mounted. So we will use the following scripts :
It does not work if I run /sbin/rc. I need to explicitely call runner (/sbin/runscript) and I also need to redirect output ! I do not have time to fix this now...
I need to unmount /proc and /dev/pts before because I have not searched yet for a better way to either clean mount table or safely unmounting before reboot.
And finally, on base system, add the following startup script :
Telnet is not needed anymore : upload the DisableTelnet.pat firmware to your nas. YES !
- Upgraded successfully to firmware 0590, 0600 and 0728. Intermediary patches updates were not tested. You will need to create the S99zgentoo.sh startup script again.
File Input/Output Error
- Synology filesystem cannot handle two files in the same directory if they only differ in case :
- ls returns input/output errors in this folder.
- You are unable to remove any of the files.
- Solution :
- Move extra files to another folder.
- Remove the folder with rm -rf.