You MUST have a Debian unstable environment (physical/dual boot, virtual machine, container or a chroot with schroot) to create packages suitable for uploading to debian. See instructions given below to setup Debian Sid. You can use lxc, docker or a virtual machine for development.
Note: The target audience is, people just discovering debian.
If you already have a debian stable or debian-based distribution, this option is best for you.
sudo apt install schroot debootstrap
Create root file system:
mkdir -p /srv/chroot/debian-sid debootstrap sid /srv/chroot/debian-sid
Make a file /etc/schroot/chroot.d/debian-sid:
# schroot chroot definitions. # See schroot.conf(5) for complete documentation of the file format. # # Please take note that you should not add untrusted users to # root-groups, because they will essentially have full root access # to your system. They will only have root access inside the chroot, # but that's enough to cause malicious damage. # # The following lines are examples only. Uncomment and alter them to # customise schroot for your needs, or create a new entry from scratch. # [debian-sid] description=Debian Sid for building packages suitable for uploading to debian type=directory directory=/srv/chroot/debian-sid users=<your username> root-groups=root personality=linux preserve-environment=true
Where <username> is an underprivileged user on your host system.
To get root shell use,
sudo schroot -c debian-sid
W: Failed to change to directory '/ ... is ok.
apt-get update && apt-get install <some-package> exit
To get normal user shell (run schroot as normal user with -u option),
schroot -c debian-sid -u <username>
If you have trouble setting it up, skip this section and see docker section below.
If you already have a GNU/Linux system, lxc would be the easiest to setup. Install lxc using this command.
sudo apt-get install lxc
If you have Ubuntu 14.04/trusty then install lxc from backports
sudo apt-get -t trusty-backports install lxc
Arch/Manjaro users see https://wiki.archlinux.org/index.php/Linux_Containers
Now install some necessary packages for networking support for the container.
sudo apt-get install -qy libvirt-clients libvirt-daemon-system iptables ebtables dnsmasq-base # if libvirt-client is not available, try libvirt-bin
Check status of libvirt daemon (service)
systemctl status libvirtd
and start if not running
systemctl start libvirtd
Now start the networking service using
sudo virsh net-start default sudo virsh net-autostart default
Check LXC#Network_setup_in_buster for buster specific changes.
Now create the container named debian-sid
sudo lxc-create -n debian-sid -t download -- --dist debian --release sid
You might have to use lxc-attach instead of lxc-console to connect to the container. After attaching yourself you could set your root password using passwd.
Before connecting to the container, you might want to start the container
sudo lxc-start -n debian-sid
To connect to the container
sudo lxc-attach -n debian-sid
This is assuming that you have named your container 'debian-sid' as per the previous instructions.
lxc-attach would not setup the tty session for other users and ask pass, what that means is, no sudo, if you switch using su - <username> (see next step). Use lxc-console if you want to use sudo.
See http://blog.scottlowe.org/2013/11/25/a-brief-introduction-to-linux-containers-with-lxc/ for more info on using lxc.
Create a new user with adduser and switch to that user with su - <username>. See https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-debian-8. Easiest way to create a user with permission to run sudo would be:
useradd -m -g sudo <username>
It is worth noting that you need to install sudo as it does not come default. Also the -m tag creates a home folder for the user, this is not trivial and can be skipped.
If you already setup a container with lxc as instructed above, you can skip this step.
Install docker either from your OS's package repositories
sudo apt install docker.io
or check out https://docs.docker.com/engine/installation/linux/. If you have a Debian-based host system, you could run apt-cacher-ng and sbuild on your host system, but otherwise you need to install them inside the container.
Docker with Debian-based host
Pull the development docker image that FSCI provides
docker pull registry.gitlab.com/fsci/resources:debian-dev
Create a container with it and run bash on it
docker run --privileged --name "sid" -it registry.gitlab.com/fsci/resources:debian-dev bash
If needed, update and upgrade to latest versions of packages
apt-get update && apt-get upgrade
Create a normal user for packaging. See https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-debian-8
Exit after your work is done. If you need to connect to it later, use the following commands which will take you to the bash prompt
docker start sid docker attach sid
Docker with non-Debian-based host
If your host system is not Debian-based (for example arch), then you can follow the steps below (this will setup docker with systemd integration which allows you to run services like apt-cacher-ng easily),
docker pull jgoerzen/debian-base-standard:sid docker run -td --stop-signal=SIGRTMIN+3 \ --tmpfs /run:size=100M --tmpfs /run/lock:size=100M \ -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ --name=debian-sid jgoerzen/debian-base-standard:sid
You can start the container and get an interactive shell
docker start debian-sid docker exec -it debian-sid bash
Setup apt-cacher-ng (this will cache all the packages locally) and auto-apt-proxy (this will auto configure the installed proxy for apt).
apt install apt-cacher-ng auto-apt-proxy
auto-apt-proxy command should display http://172.17.0.1:3142 upon successful setup.
You will now get a root shell and it is better to create a normal user for packaging.
Now run this inside the container,
adduser <username> su - <username>
Install Virtual box and run Debian Sid in it.
sudo apt install virtualBox
For Manual installation, download Debian Testing ISO from Debian website and install it inside already installed VirtualBox. Once you have Debian Testing, you can upgrade it to Sid/unstable.
Edit /etc/apt/sources.list and change testing to sid or unstable.
apt update apt dist-upgrade
If you want to make your job easy just install vagrant
sudo apt install vagrant-libvirt libvirt-daemon-system
Make sure that you are having only single Hypervisor running otherwise be ready to see some error. Also, vagrant installation might ask you to install some other additional packages, allow it to do so.
Add your user to libvirt group to use vagrant without additional privillege prompts
sudo gpasswd -a <your user> libvirt
Create a new directory from where you want to start VM. vagrant will store some configuration file in that directory and then switch to that directory
mkdir /path/to/directory/packaging cd /path/to/directory/packaging
Now we need to tell vagrant where we need to fetch Vagrant box (VM image)
You can find recent Debian Testing vagrant box on the following URL https://app.vagrantup.com/debian/boxes/testing64
vagrant init debian/testing64 vagrant up
Note: This can take some time depending on your internet connection speed.
Then you can connect to the VM by
Note: Current image is very old, so you will need to run apt update and apt dist-upgrade (to update debian-archive-keying) before you can upgrade to sid.
You can update to Sid by replacing testing with sid in /etc/apt/sources.list and running
apt update apt dist-upgrade
Note: If you use nfs to share host directory with the vm, then you'll need rpc-statd service or you may get no locks available error message.
sudo systemctl enable rpc-statd # Enable statd on boot sudo systemctl start rpc-statd # Start statd for the current session