Translation(s): English - espaƱol


A "porterbox" is a machine provided (generally) by the DSA team to help people port packages to various architectures (or ports as we call them) supported by the Debian project.

Search for "porterbox" on the Developer Machines page.

Porterboxes are generally configured to allow regular users to create new chroots using schroot. The DSA team has a short tutorial about how to use schroot on porterbox machines. By default, all DDs should have access to porterboxes, but you can request guest account accesses if necessary.

Short version is:

schroot -c sid

This will build a new chroot using the sid template and chroot into it. The environment will be destroyed when you exit.

It is recommended to use screen to switch between chroot and normal environment.

Blog post on how to debug on porterbox:

Some useful alias / snippet to append to your .bashrc:

# porterbox aliases start from 'p'
alias psetup='_alias_() { \
  count=$(schroot -l|grep chroot:sid_|wc -l); \
  arch_list=$(schroot -l|grep chroot:sid_|sed -e s/^chroot:sid_// -e s/-dchroot$//); \
  dist=sid; \
  [ -n "$pdist" ] && dist=$pdist; \
  if [ $count -eq 1 ]; then \
    arch=$arch_list; \
  else \
    if [ -n "$1" ]; then \
      arch="$1"; \
      [ -n "$2" ] && dist="$2"; \
    else \
      echo All schroot architectures supported on this host:; \
      echo $arch_list; \
      echo -n "Architecture to create: " && read arch; \
    fi; \
  fi; \
  set -x; \
  sessionID=${USER}-${dist}-${arch}; \
  schroot-list-sessions; \
  schroot -b -c ${dist}_${arch}-dchroot -n $sessionID; \
  dd-schroot-cmd -c $sessionID apt-get update; \
  dd-schroot-cmd -c $sessionID apt-get dist-upgrade -y; \
  dd-schroot-cmd -c $sessionID apt-get install -y eatmydata; \
  dd-schroot-cmd -c $sessionID apt-get install -y git-buildpackage; \
  dd-schroot-cmd -c $sessionID apt-get install -y pristine-tar bash-completion ccache vim; \
  set +x; \
  echo Chroot session ready to use: $sessionID; \
  unset -f _alias_; \
};_alias_'
alias pdist='_alias_() { \
  dist_list=$(schroot -l|grep chroot:|grep -v -- -source$|grep -- -dchroot|sed -e s/^chroot:// -e s/-dchroot$//|cut -d_ -f1|uniq); \
  if [ -n "$1" ]; then \
    pdist="$1"; \
  else \
    echo All schroot distributions supported on this host:; \
    echo $dist_list; \
    echo -n "Distribution to create: " && read pdist; \
  fi; \
  echo pdist=$pdist; \
  unset -f _alias_; \
};_alias_'
alias parch='_alias_(){ \
  count=$(schroot-list-sessions|cut -d: -f1|wc -l); \
  dist=sid; \
  [ -n "$pdist" ] && dist=$pdist; \
  arch_list=$(schroot-list-sessions|cut -d: -f1|sed s/${USER}-${dist}-//); \
  if [ $count -eq 0 ]; then \
    echo There is no schroot available, please use "psetup <arch>" to create one.; \
    unset -f _alias_; \
    return; \
  elif [ $count -eq 1 ]; then \
    arch=$arch_list; \
  else \
    if [ -n "$1" ]; then \
      arch="$1"; \
      [ -n "$2" ] && dist="$2"; \
    else \
      echo All schroot architectures created on this host:; \
      echo $arch_list; \
      echo -n "Architecture to use: " && read arch; \
    fi; \
  fi; \
  set -x; \
  sessionID=${USER}-${dist}-${arch}; \
  set +x; \
  echo Chroot session to use: $sessionID; \
  unset -f _alias_; \
};_alias_'
alias pdeps='_alias_(){ set -x;[ -n "$sessionID" ] && dd-schroot-cmd -c $sessionID apt-get build-dep -y "$1";set +x;unset -f _alias_;};_alias_'
alias pinstall='_alias_(){ set -x;[ -n "$sessionID" ] && dd-schroot-cmd -c $sessionID apt-get install -y "$@";set +x;unset -f _alias_;};_alias_'
alias pauu='set -x;[ -n "$sessionID" ] && (dd-schroot-cmd -c $sessionID apt-get update; dd-schroot-cmd -c $sessionID apt-get dist-upgrade -y); set +x'
alias pchroot='echo "Arch: $arch; Dist: $dist; Chroot session: $sessionID"; [ -n "$sessionID" ] && schroot -r -c $sessionID'
alias pend='[ -n "$sessionID" ] && (set -x; schroot-list-sessions; schroot -e -c $sessionID; echo; schroot-list-sessions; set +x)'
alias precover='[ -n "$sessionID" ] && (set -x; schroot --recover-session -c $sessionID; set +x)'
alias plist='set -x; schroot --list --all-sessions; echo; schroot-list-sessions; set +x'
[ -n "$SCHROOT_CHROOT_NAME" -a -f /usr/lib/*/libeatmydata.so ] && export LD_PRELOAD=$(ls /usr/lib/*/libeatmydata.so)
[ -n "$SCHROOT_CHROOT_NAME" ] && mkdir -p ~/tmp && export TMPDIR=~/tmp

With the snippet above, now you can create a new schroot and start to debug a new package <foo>:

$ psetup arm64
$ pdeps <foo> # install build-dep for package <foo>
$ pinstall lintian
$ pinstall <bar> # [optional] if you still need to install package <bar>
$ gbp clone --pristine-tar https://salsa.debian.org/debian/foo.git
$ pchroot
(dchroot)$ cd foo
(dchroot)$ gbp buildpackage -us -uc --git-ignore-branch --git-pristine-tar
(dchroot)$ logout
$ pend

In case you already have created the schroot, and login again:

$ parch arm64
$ pauu # [optional] apt-get update & upgrade
$ pchroot
(dchroot)$ cd foo
...
$ pend