omar's picture

tklbam seems not to work ??

today i have been testing tklbam ... I did follow the instructions in the case study:

1 - launch a turnkey appliance from amazon console (turnkey apache tomcat lucid)

2 - run tklbam init ; tklbam backup

2 - install some packages ... nxserver, lxde, chrome and sun java.

3 - run tklbam backup

4 - And now ... I start another instance of the same appliance  

5 - run tklbam init ; tklbam backup ; tklbam restore {id of the backup of the other appliance}

6- restart

The backup does not show any error but the instance seems no to work, in particular , I tried 

the command java -version , and i got the message "java command not found"

I do not know if I am doing something wrong. Please could any one bring some light ?


Thank you and kind regards.


Liraz Siri's picture

Could you share the backup and restore logs? Also it might be helpful to understand how exactly you installed additional packages. Was it all done through the package management system? Did you add any custom repositories?
omar's picture

Hi Liraz

Those are all the commands I typed in the server in order to install them mentioned packages (from the ./bach_history)


Init tklbam
tklbam init
tklbam bakcup
tklbam backup test
Install MX
mkdir NX
apt-get install libaudiofile0
dpkg -i nxclient_3.4.0-7_i386.deb
dpkg -i nxnode_3.4.0-14_i386.deb
dpkg -i nxserver_3.4.0-14_i386.deb
nano /usr/NX/bin/nxwrappe

nxnode=$(ps -o ppid= -p $PPID)

nxagent=$(pgrep -P $nxnode -u $USER -x nxagent)


exec kill $nxagent 

sudo chmod 755 /usr/NX/bin/nxwrapper
mv /usr/NX/bin/nxwrappe /usr/NX/bin/nxwrapper
chmod 755 /usr/NX/bin/nxwrapper
Installing lxde
apt-get install aptitude
aptitude install --without-recommends lxde-core
aptitude install gksu gnome-icon-theme manpages-dev openbox-themesaptitude install gksu gnome-icon-theme manpages-dev openbox-themes
sudo aptitude install synaptic
vim /usr/NX/etc/server.cfg
EnableAdministratorLogin = "1"
shutdown -r now
Installing Chrome
tklbam backup
vim /etc/apt/sources.list.d/sources.list
(adding at the end)deb stable main
apt-get update
apt-get install google-chrome-unstable
Install java sun
tklbam backup
vim /etc/apt/sources.list.d/sources.list
(adding at the end)deb lucid partner
aptitude update
aptitude install sun-java6-jdk
update-alternatives --config java
update-alternatives --config javac
java -version
tklbam backup
omar's picture


/root/.config/google-chrome/Local State
/root/.config/google-chrome/First Run
/root/.config/google-chrome/Default/Web Data
/root/.config/google-chrome/Default/Current Session
/root/.config/google-chrome/Default/Top Sites
/root/.config/google-chrome/Default/Visited Links
/root/.config/google-chrome/Default/Archived History
/root/.config/google-chrome/Default/Current Tabs
/root/.config/google-chrome/Default/History Index 2010-12
/root/.config/google-chrome/Default/User StyleSheets/Custom.css


mkdir -p /opt/google/chrome/extensions
mkdir -p /root/.config/lxpanel
mkdir -p /root/.config/lxpanel/LXDE
mkdir -p /root/.debtags
mkdir -p /root/.gnome2
mkdir -p /root/.gnome2/keyrings
mkdir -p /root/.local
mkdir -p /root/.local/share
mkdir -p /root/.local/share/openbox
mkdir -p /root/.local/share/openbox/sessions
mkdir -p /root/.nx/cache-desktop
mkdir -p /root/.thumbnails
mkdir -p /root/.thumbnails/normal
mkdir -p /root/Desktop
mkdir -p /root/NX
chmod 0700 /opt/google/chrome/extensions
chmod 0700 /root/.aptitude
chmod 0700 /root/.config/google-chrome
chmod 0700 /root/.config/google-chrome/Default
chmod 0700 /root/.config/google-chrome/Default/User StyleSheets
chmod 0700 /root/.config/lxpanel
chmod 0700 /root/.config/lxpanel/LXDE
chmod 0700 /root/.dbus
chmod 0700 /root/.dbus/session-bus
chmod 0700 /root/.gnome2
chmod 0700 /root/.gnome2/keyrings
chmod 0700 /root/.local
chmod 0700 /root/.local/share
chmod 0700 /root/.local/share/openbox
chmod 0700 /root/.local/share/openbox/sessions
chmod 0700 /root/.nx/cache-desktop
chmod 0700 /root/.pki
chmod 0700 /root/.pki/nssdb
chmod 0700 /root/.thumbnails
chmod 0700 /root/.thumbnails/normal
rm /etc/nologin

Restoring databases

database: mysql
table: mysql/time_zone_transition
table: mysql/proc
table: mysql/tables_priv
table: mysql/func
table: mysql/host
table: mysql/columns_priv
table: mysql/time_zone_name
table: mysql/procs_priv
table: mysql/help_category
table: mysql/help_relation
table: mysql/help_topic
table: mysql/event
table: mysql/plugin
table: mysql/db
table: mysql/user
table: mysql/time_zone_transition_type
table: mysql/time_zone_leap_second
table: mysql/servers
table: mysql/ndb_binlog_index
table: mysql/help_keyword
table: mysql/time_zone
omar's picture


A var/spool/postfix/pid/unix.cleanup
A var/spool/postfix/pid/unix.local
Uploading s3:// to STANDARD Storage
Processed volume 1
Uploading s3:// to STANDARD Storage
Uploading s3:// to STANDARD Storage
--------------[ Backup Statistics ]--------------
StartTime 1294270938.68 (Wed Jan  5 23:42:18 2011)
EndTime 1294270942.93 (Wed Jan  5 23:42:22 2011)
ElapsedTime 4.25 (4.25 seconds)
SourceFiles 2867
SourceFileSize 135552974 (129 MB)
NewFiles 264
NewFileSize 4313037 (4.11 MB)
DeletedFiles 14
ChangedFiles 85
ChangedFileSize 14062736 (13.4 MB)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 363
RawDeltaSize 5253140 (5.01 MB)
TotalDestinationSizeChange 2805919 (2.68 MB)
Errors 0
omar's picture

I have found that the nx server has not been backup, maybe due to the way i installed it :



dpkg -i nxclient_3.4.0-7_i386.deb
dpkg -i nxnode_3.4.0-14_i386.deb
dpkg -i nxserver_3.4.0-14_i386.deb
Please can anyone confirm that this type of manual installation wont be backup, so we can take care of them in another way ? 
Jeremy Davis's picture

AFAIK TKLBAM leverages the package management system to install any extra packages from default appliance state (ie any extra packages that aren't installed originally).

I'm not sure but I suspect that as this package isn't available from a repo, TKLBAM doesn't know where to get it from and hence its not included. It's a scenerio which probably should be accounted for.

If that's the case, you may be able to work around it by manually including the app path as part of the backup. Another possible workaround may be to host a repo locally for that deb (and any other custom ones).

Liraz Siri's picture

Try and configure the package repositories before performing the restore. If you want this to be done automatically, look into setting up a custom hook that runs on restore in the "pre" state. If packages are only available as downloadable *.deb files and are not installable through an APT repository (e.g., NX) I recommend you save the packages in /root/debs and install them from the custom hook in the "post" state.

$ cat /etc/tklbam/hooks.d/example

#!/bin/bash -e
# This is a disabled hook example.
# To enable, make it executable: chmod +x /etc/tklbam/hooks.d/example

# hooks are always called with two arguments

if [ "$op" = "restore" ]; then
    echo -n "A restore operation called this hook "
elif [ "$op" = "backup" ]; then
    echo -n "A backup operation called this hook "

if [ "$state" = "pre" ]; then
    echo "right BEFORE duplicity was invoked"
elif [ "$state" = "post" ]; then
    echo "AFTER the $op operation finished"

# `false` returns a non-zero exitcode
# Uncomment the next line to raise an error


As JedMeister correctly suspected, when you tklbam-restore from a new installation, TKLBAM is not aware of the new package repositories on your old installation and it doesn't attempt to synchronize them. This is by design, as otherwise we wouldn't be able to use TKLBAM to upgrade between different versions of Ubuntu or migrate between Ubuntu and the upcoming Debian versions, etc.

Alon Swartz's picture

One of my cloud servers uses packages from multiverse, which is not enabled by default in TKL, which means even though TKLBAM knows about them in the backup, they are not installed when I launch a new server from the backup.

I wanted everything to be automated, so I created the following TKLBAM hook, and thought that others might find it useful:

#!/bin/bash -e
# hooks are always called with two arguments
op=$1       # backup / restore
state=$2    # pre / post

if [ "$op" == "restore" ] && [ "$state" == "post" ]; then
    sed -i "/multiverse/ s/# //g" /etc/apt/sources.list.d/*.list
    export DEBIAN_FRONTEND=noninteractive
    apt-get update
    apt-get -y install PACKAGE1 PACKAGE2

Note that just enabling multiverse in state=pre and letting TKLBAM take care of the package installation won't work on a newly launched server because the backed up filesystem is not restored until after package installation.

Add new comment