QPKG Debian6 V 1.1.0 (Beta) Add a Debian chroot environment to your Qnap Available for : Arm Qnap except TS-x09 Intel Qnap First Print Please read post on forum for complete information Documentation version : 1.0 Author : Father_Mande QPKG-Debian6 V1.0-1/12 6. April 2011 Father_Mande
Why? : Qnap provide a full set of function, but with some restrictions due to the internal architecture and choice Some of this choice can't be modify kernel version, kernel module, even it's possible to recompile some of them but not clearly documented and sometime using cross-compiler not free. Starting services and system Internal tools not available outside (getcfg, setcfg, etc.) Disk format (all 4 primary partitions are used) BUT at application level, it's possible to play With QPKG for most integrated applications With (Optware) IPKG (also a QPKG) to add services, servers and tools, with the advantage of native executable, but with no control for long term life of programs provided, and a specific structure using /opt with lot of change in the architecture of programs supply.. so you have to wait for new version (for ex.) If you want to start server, you have to play with autorun.sh and some limitations (autorun.sh is executed before QPKG and before Optware (Ipkg) it's a QPKG. Chrooted Debian 6 Squeeze environment is to open the Qnap to all applications of Debian Ecosystem (more than 20 000 software) but restricted if kernel module is not provide by Qnap. In the chroot environment you have the same file structure than in original Debian so support is easy. Debian is keep up to date and solve security issue quickly. QPKG-Debian6 V1.0-2/12 6. April 2011 Father_Mande
How? : By adding a standard environment, using the chroot capability chroot is a specific space where all things are relative to the root (base directory) of the chroot env. The choice of this environment, depends of 2 things : 1 ) the capability to create the chroot easily from a standard Linux distro. 2 ) have a distro. Near in term of kernel and up to date I have choice Debian 6 (Squeeze) To add easily this environment to the Qnap, I choice QPKG 1 ) it's a standard approach in a Qnap 2 ) lot of help are possible by all expert in Forum's 3 ) Qpkg can integrate a start / stop script manageable from QPKG Admin menu with an auto-start during boot phase, so this script can also manage internal script in the chroot environment, to start / stop what you want, without any modification (in Qnap part) QPKG-Debian6 V1.0-3/12 6. April 2011 Father_Mande
Installation : Download in your workstation the debian-qpkg.zip from the Forum Unzip it Install thru the standard Admin / Qpkg menu. during the installation, the Qpkg install shell, download the file containing the chroot env. depends of you Hardware type.. the choice is based on /etc/default_config/boot.conf contents. If your Network is low you can use an alternative :. download the good file debian6_x86[or arm].tgz from qnapclub.fr and copy it inside your Public share So if the installer retrieve the file locally.. it don't download it again Remove QPKG : Use the standard Web Admin Qpkg menu First deactivate the Qpkg ; then remove it. Update from 1.0.0 : IMPORTANT : you MUST do one change before installing the New QPKG suppress ALL (Quote) in the debain6.conf actually under /etc/config change [debian6] DEB_BASE = VERSION="root6" to : [debian6] DEB_BASE = VERSION=root6 And do the normal update over the previous 1.0.0. QPKG version. QPKG-Debian6 V1.0-4/12 6. April 2011 Father_Mande
Important files and directories : I used MD0_DATA but adapt to your own configuration (for ex. HDA_DATA) Install folder : /share/md0_data/.qpkg/debian6 Base of chroot just after the installation : /share/md0_data/.qpkg/debian6/root6 Base of all script / program to manage the environment : /bin_deb This link to /share/md0_data/.qpkg/debian6/bin_deb is created when the system boot and start the chroot environment for the first time. This folder is added to the /etc/profile file.. so each time you open a session (ssh or telnet) all the script are directly callable without full Path During this phase (modification of /etc/profile) we add also an alias alias deb_cwd='cd /share/md0_data/.qpkg/debian6' to help you going in the good place for Debian Qpkg only by entering this command : deb_cwd Configuration file for Qpkg-Debian6 : /etc/config/debian6.conf Management script : /etc/init.d/debian6.sh QPKG-Debian6 V1.0-5/12 6. April 2011 Father_Mande
Some Concepts : (please read carefully) VERSION : A version is the name (and also the root directory) for an alternate or current chroot environment. YES, you can have multiple environment, one for running your application, one for test and development, one for what you want SO all command can used a [-v version] optional parameters to said the command is for this target chroot and not for the default one This feature, I think is reserved for few people Major users can only run at the same time ONE environment, the default one How can you create your own chroot ex. Create e directory for it, it's possible to create this directory outside the chroot Qpkg folder, after you only need to create a link at the QPKG base directory : Sample : mkdir /share/md0_data/x11 (for a x11 env.) cp -R /share/md0_data/.qpkg/debian6/root6/* /share/md0_data/x11 ln -s /share/md0_data/x11 /share/md0_data/.qpkg/debian6/x11 Now you have to add parameters in /etc/config/debian6.conf duplicate all under [root6] (look at hereafter) including this line change root6 to the new name x11 in this example keep the braket. BE SURE that DEB_BASE = is without any value after the = choice for other line the state you want. it's all you are ready to run (at the same time if you want) the second chroot environment.just remember to use -v version in each command to target the good environment. QPKG-Debian6 V1.0-6/12 6. April 2011 Father_Mande
CONFIGURATION FILE : Hereafter the basic debian6.conf created at installation : [debian6] DEFAULT_VERSION=root6 CURRENT_VERSION = [root6] ENABLE=TRUE DEB_BASE = INCL_EXT=TRUE INCL_HDA_ROOT=TRUE INCL_HOME=TRUE INCL_WEB=TRUE INCL_USB=FALSE INCL_MULTIMEDIA=TRUE INCL_DOWNLOAD=TRUE INCL_RECORDINGS=FALSE Explain : DEFAULT_VERSION is used when you start the chroot without parameters. The version name indicated must exist under CURRENT_VERSION is set when a version (even default one) is started with the name of the version so now all command without explicit -v version are run in this chroot version [root6] (or any name inside [] ) are a version ENABLE is to said that this version can be start (a command exist to change this status) DEB_BASE is set with the full PATH of the root base for chroot (so when you enter in the chroot it's the new / and all are relative to this new / INCL_XXX are to mount or not inside the chroot the optional QNAP folder EXT, HDA_ROOT, HOME are for specific usage for ex. /etc/config is a link to /mnt/hda_root/.config so mounting HDA_ROOT in the chroot authorize you to access to Qnap config files. PUBLIC, etc. are the respective default share in QNAP ATTENTION ALL this mount respect in the chroot the SAME PATH than in the Qnap environment so you can continue to access to folder using the same PATH even if you QPKG-Debian6 V1.0-7/12 6. April 2011 Father_Mande
are not in the same place Old and new form exist Qweb and Web,Qmultimedia and Multimedia, etc. HDA_DATA, MD0_DATA, etc. also exist For ex. Ajaxplorer use full Path name for it's repository.. so no change are need in the chroot environment because the Path are the same. IMPORTANT : If you need to add some private mount before starting the chroot environment you must add you own mount (and umount when stop) folder in this files, called during mount / umount operations when a chroot version is started. /share/md0_data/.qpkg/debian6/other_mount and /share/md0_data/.qpkg/debian6/other_umount DPKG (Debian Package) : this new concept is to create DPKG as the QPKG is for Qnap a set of automatized tools to install software, configure it with the specific Qnap environment, and start / stop with the Qnap boot We provide in the tools to create your own DPKG and provide a test_service DPKG that do nothing. Structure of a DPKG : install* shell executed in the chroot. pre_install* shell executed in the Qnap before the install shell post_install* shell executed in the Qnap after the install shell mgr_serv/ start / stop script (qnap side) and configuration file data/ contain data for dpkg We provide outside the QPKG a first DPKG name apache2 Install apache2, php5, php5-mysql, etc in the chroot debian6, change the configuration to have /share/web (or Qweb) as root for apache2, you can keep your actual Mysql bases because all base using TCP IP (localhost or remote) are supported.. Remember study the sample provide, if you want to create your own Dpkg. QPKG-Debian6 V1.0-8/12 6. April 2011 Father_Mande
How-to install a Dpkg : Dpkg is auto extractable, auto-install, auto-run program. Download the Dpkg, put it on a shared resource on Qnap (for ex. /share/public) Open a ssh or telnet console. Connect you admin / your own password go to /share/public : cd /share/public 2 possibilities. First possibilities : add execute rigth to dpkg : chmod +x my_package.dpkg then start it :./my_package.dpkg Second : start it using sh : /bin/sh my_package.dpkg [apache2] NUMBER=10 and it's all The Pkg is started or not depends of the configuration file INITIAL_ENABLE=TRUE START_IMMEDIATLY=NO Package name Start / Stop number Snnshell Knnshell this shell are use during boot and halt of Qnap and are linked to the shell provide by installation Default Initial status after a reboot Start immediately after installation ALL the information to manage the dpkg installed are in the folder /share/md0_data/.qpkg/debian6/services/{version_name} So the dpkg is installed for a specific version and run automatically, only when this version is started if the version is the default one services are started when the Qnap boot (based on service status). QPKG-Debian6 V1.0-9/12 6. April 2011 Father_Mande
Tools and Command : A help is provide for each command... debian6.sh or dmgr Manage the chroot version set default, manage QPKG status, etc.. help : # dmgr Usage : /bin_deb/dmgr (start stop restart set_default set_current) [-v version] Or /bin_deb/dmgr (stop_all setqpkg_enable setqpkg_disable status) start stop [-v version]... start/stop DEFAULT_VERSION or VERSION if -v version is set this start is call when Qnap boot if QPKG Debian6 is Enable. restart [-v version]... stop then start DEFAULT_VERSION or VERSION if -v version is set set_default -v version... set version as new default_version set_current -v version... set CURRENT_VERSION to another running version status... information about default running env. stop_all... stop all chroot version started setqpkg_enable setqpkg_disable... force QPKG Enable in qpkg.conf to TRUE FALSE environment deb_wd or dwd Return the current chroot directory, you can use -v version to target a specific deb_bash or dsh Start a chroot to enter command in debian6 [-v version] is optional. dsh [-v version] start /bin/bash in the debian chroot (current or version) dsh [-v version] command arg1 arg2 etc. start command with arguments in the chroot QPKG-Debian6 V1.0-10/12 6. April 2011 Father_Mande
ex. dsh /etc/init.d/apache2 start deb_conf or dconf Start a vi (vim editor) and open debian6.conf deb_install_serv Usage : deb_install_serv service_name [-v version] call by DPKG o install the service in the chroot environment install use : deb_run_serv pre-install script executed in Qnap environment install script executed in chroot environment post_install script executed in Qnap environment Usage : deb_run_serv service_name start stop restart status force_start force_stop enable_service disable_service [-v version] Or : deb_run_serv any_value list [-v version]... any_value... what you want, not used, BUT mandatory use to manage service in chroot environment deb_remove_serv Usage : deb_remove_serv service_name [-v version] remove qnap part of a dpkg not the debian part. QPKG-Debian6 V1.0-11/12 6. April 2011 Father_Mande
Some Debian basic : As Ipkg for Qnap to install a package : apt-get install package_name (some Meta package exist, so when you do apt-get install apache2 you install all software need to run apache2 immediately) to remove a package apt-get remove package_name to search a package (partial text in the package name are allowed ) apt-cache search package to know package and its version installed dpkg -l Interesting link : Debian for Newbies : http://newbiedoc.berlios.de/wiki/debian_newbie_help_documentation QPKG-Debian6 V1.0-12/12 6. April 2011 Father_Mande