# Gentoo Chroot

Gentoo is a free operating system based on either Linux or FreeBSD that can be automatically optimized and customized for just about any application or need. Gentoo Chroot allows you to install the Gentoo OS inside your DiskStation, alongside DSM. This package is intended for advanced users only.

## Installation

Once the package installation has finished in the Package Center, the installation of the chroot environment continues in the background. Open Gentoo Chroot from the Main Menu of DSM and you can see its status under Overview in the left pane. When the installation finishes, the status will automatically change to Installed.

### Initial Setup

Due to the custom nature of Gentoo, this package installs a very minimal Gentoo installation to your DiskStation and leaves the setup and configuration up to you.

As soon as the status of the chroot environment is Installed, you can begin configuring your new installation of Gentoo. To do so, connect to the DiskStation through SSH (root user) and use the following commands:

1. `/var/packages/gentoo-chroot/scripts/start-stop-status start`
2. `/var/packages/gentoo-chroot/scripts/start-stop-status chroot`
3. `env-update`
4. `source /etc/profile`
5. `export PS1="(chroot) $PS1"`

Unless you know what you are doing, it is strongly recommended that you to continue the setup of your installation of Gentoo by following from the relevant section of the official Gentoo handbook: here.

## App Usage

### Overview

From the Gentoo Chroot app, you can monitor how many services are running, perform update operations and manage services.

### Updates

Gentoo uses Portage to handle package updates.

Again, due to the custom nature of Gentoo, usually it's best to perform package updates via the command-line interface to Portage: `emerge`. As `emerge` generally provides a greater amount of control over the packages that are installed and updated in your installation of Gentoo, wherever possible it's advisable to update your Gentoo installation manually using via the command-line.

If you just want to quickly check for available updates for Gentoo, simply click Update and Portage will sync with the package tree, then inform you of how many updates are available.

Whilst it's generally better to update Gentoo via the command-line, you can perform a quick update by simply clicking Update.

### Services

Gentoo Chroot allows you to manage the packages you installed in the chroot directly from DSM.

Under Services in the left pane, you can manage services that you manually installed previously in the chroot: start and stop them easily.

#### Configuration

1. Manually install in the chroot the service you chose.
2. Configure it by editing the correct configuration files.
3. In the interface, click on Add and fill the form. The Launch script will be launched with the `start` argument to start the service and `stop` to stop it. The Status command should return exit code `0` (success) if the service is started, or `>0` (error) if it is stopped.

#### Example: SSH Server

1. Edit the configuration file: `/etc/ssh/sshd_config`.
2. Change the port number and other things if necessary.
3. Click on Add and put the name `SSHD`, the launch script `rc-service sshd` and the status command `rc-service sshd status`.