Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

testing in chroots for multiple distributions

Zoltan Padrah edited this page · 10 revisions
Clone this wiki locally

Testing in chroots for multiple distributions and versions

Rationale

It is useful to test KTechLab different distributions and their versions, but without the overhead of virtual machines. In such cases, a different distribution in a chrooted environment can be very useful.

Table of contents

Chroot creation for debian and ubuntu based distribution

Original tutorials about chroot

Install packages on host

  host$ sudo apt-get install debootstrap schroot

Note: host$ is the command prompt. It should be not typed in manually. At a later point in this guide, another prompt, root@host# will also be used. That one also should not by typed in manually.

Create configuration files for the chroot envirnment

Ubuntu 14.04 Trusty

 host$ sudo editor /etc/schroot/chroot.d/trusty_i386.conf

Add the following contents to the file:

 [trusty_i386]
 description=Ubuntu 14.04 Trusty for i386
 directory=/srv/chroot/trusty_i386
 #personality=linux32 # deprecated
 root-users=your_username
 #run-setup-scripts=true # deprecated
 #run-exec-scripts=true # deprecated
 type=directory
 users=your_username

Disable mounting of /home in the chroot environment

host$ sudo editor /etc/schroot/mount-defaults

Comment out the line starting with /home:

# fstab: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point>   <type>  <options>   <dump>  <pass>
/proc       /proc       none    rw,bind        0       0
/sys        /sys        none    rw,bind        0       0
/dev            /dev            none    rw,bind         0       0
/dev/pts    /dev/pts    none    rw,bind     0   0
#/home      /home       none    rw,bind     0   0  # <-- comment out or remove here <----- <----
/tmp        /tmp        none    rw,bind     0   0
#
# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot.  However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
#/run       /run        none    rw,bind     0   0
#/run/lock  /run/lock   none    rw,bind     0   0
#/dev/shm   /dev/shm    none    rw,bind     0   0
#/run/shm   /run/shm    none    rw,bind     0   0

Run debootstrap

Ubuntu 14.04 Trusty in chroot

host$ sudo mkdir -p /srv/chroot/trusty_i386
host$ sudo debootstrap --variant=buildd --arch=i386 trusty /srv/chroot/trusty_i386 http://archive.ubuntu.com/ubuntu

Check the chroot

host$ schroot -l
chroot:trusty_i386

host$ cd /
host$ schroot -c trusty_i386 -u root
(trusty_i386)root@host:/#

(trusty_i386)root@host:/# uname -a
Linux host 3.2.0-61-generic #93-Ubuntu SMP Fri May 2 21:33:33 UTC 2014 i686 i686 i686 GNU/Linux
(trusty_i386)root@host:/# cat /etc/issue
Ubuntu 14.04 LTS \n \l

(trusty_i386)root@host:/# 

Install minimal system

Ubuntu 14.04 Trusty

inside chroot:

(trusty_i386)root@host:/#   apt-get install ubuntu-minimal

And verify that the system is working:

(trusty_i386)root@host:/#   lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:    14.04
Codename:   trusty

Set up home directory

Inside the chroot:

(trusty_i386)root@host:/# mkdir /home/user
(trusty_i386)root@host:/# chown user:user /home/user
(trusty_i386)root@host:/# logout
host$
host$ schroot -c trusty_i386 -u user
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

(trusty_i386)user@host:/$
(trusty_i386)user@host:/$ cd
(trusty_i386)user@host:~$ pwd
/home/user
(trusty_i386)user@host:~$

Installing KTechLab in a chroot

Add necessary repositories

Ubuntu 14.04 Trusty

(trusty_i386)user@host:~$  sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu trusty universe" > /etc/apt/sources.list.d/trusty-universe.list'
(trusty_i386)user@host:~$  sudo apt-get update

Install build-dependencies

Ubuntu 14.04 Trusty

(trusty_i386)user@host:~$  sudo apt-get install git cmake kdevplatform-dev libglib2.0-dev kate

This will install about 700 MB of packages.

Download KTechLab's sources

(trusty_i386)user@host:~$  git clone https://github.com/ktechlab/ktechlab.git
Cloning into 'ktechlab'...
...
Checking connectivity... done.
(trusty_i386)user@host:~$ 

Compile KTechLab

(trusty_i386)user@host:~$  cd ktechlab
(trusty_i386)user@host:~/ktechlab$ sh simple-setup.sh
....
kbuildsycoca4 running...
(trusty_i386)user@host:~/ktechlab$

Running KTechLab in chroot

Launch KTechLab from the chroot

(trusty_i386)user@host:~/ktechlab$ export DISPLAY=:0.0
(trusty_i386)user@host:~/ktechlab$ sh simple-launch.sh

KTechLab's main window should appear.

Recommended post-launch configuration for KTechLab

Enable all KTechLab plugins

Settings --> Configure KTechLab... --> Plugins tab, on the bottom right, there enter ktechlab in the search field, and enable all 3 plugins related to KTechLab. Click OK.

Show Components list

Right click on the empty space at left margin of the main window, below the Documents and Projects buttons; select Componens from the menu. Click on the newly appeared Components button.

Show Component Editor

Right click on the empty space at left margin of the main window, below the Documents, Projects and Components buttons; select Componen Editor from the menu. Click on the newly appeared Component Editor button.

Screenshots

KTechLab with one open circuit

KTechLab with empty main window

Something went wrong with that request. Please try again.