FAQ Category: Administration

Assuming you have created a backup file using setup.pl, you can restore your database using the command:

 $ pg_restore [options] your_backup.bak

It should be pointed out that it's not possible to restore a backup to a database with a different name than the one you made the backup from!

If the database to restore into doesn't exist: replace [options] with -C new_database.
If you want to restore replacing an existing database: replace [options] with --clean -C new_database.

Note: You need to restore the roles backup before restoring the data backup.

As of 1.3.7 the backup functionality moved to setup.pl, the database administration interface.

Login with your ledgersmb database user / admin user. This can't be done using your normal LedgerSMB login account since it doesn't have enough rights to backup db and roles. The default address for setup.pl is http://localhost/ledgersmb/setup.pl.

The setup.pl backup facility consists of two parts:

  1. Backup of the data (parts, customers, accounting records, etc)
  2. Backup of the roles (your login accounts and rights)

The backup can be mailed to an e-mail account, or you can download it with your browser, depending on your output selection in the backup screen.


Note that alternative methods include the use of autopostgresqlbackup and PostgreSQL's command line utility pg_dump. See the Restore FAQ item for an example of the latter.

In the 'setup.pl' administrative interface, there are 2 buttons:

  • Backup database
  • Backup roles

One creates a backup of the content of your database. The other creates a backup of the roles.

Roles are elements which are required to exist before creation of a database, and assign fine-grained access control.

When restoring, you need both files and you need to restore the roles before the database.

[work in progess...]
The PDF and PS invoices are generated using a program called LaTeX which handles the layout and typesetting. The actual LaTeX files are creating using Template Toolkit with extensions for LaTeX. These extensions are in the Template::Latex package available from CPAN. The software then generates a LaTeX file which is then processed to create a PDF or PS.

Typically the first thing to do is to install a LaTeX distribution like TexLive (distributed with many Linux distributions and available for OSX and Windows). This provides LaTeX and many of the modules needed. In general I recommend that if your distro has a texlive-extras package that you install this too.

After this is installed, you must then install Template::Latex. This can be done by typing on the command line:

Note: Debian & Ubuntu look below.

cpan Template::Latex

This will also install a number of dependencies including LaTeX::Driver, which will need to know where your LaTeX binaries are. It is usually pretty good at finding them.

If things go wrong and you can't get it to work, the following commands may provide useful diagnostic information when requesting help:

>From the LedgerSMB application directory:
perl -MLedgerSMB::Template::Latex -e print

>From the doc/manual directory in the LedgerSMB application directory:
pdflatex LedgerSMB-manual

Debian & Ubuntu note:
Template::Latex is included in Template::Plugin::Latex which is now in Debian as
libtemplate-plugin-latex-perl. (It has migrated to Debian Testing ('wheezy')).
Install with apt-get install libtemplate-plugin-latex-perl

Ref: Latex in templates & Debian squeeze and xelatex

How the LaTeX templates work

With answers from Chris Travers, Robert James Clay

I had created a second database. To delete it, do I just drop the database from postgresql?

On a GNU-ish *nix platform use the script:
it'll remove the roles and the database.

Copy db :
In psql or your sql client:

Note this will clone everything.
If you want to get rid of the transactions, you will need to delete everything in the acc_trans, ar, ap, and gl tables.

Also if goods and services are used, delete from invoice and inventory as well, and if wishing to clear out all orders, delete from
orderitems and oe.

Sql ledger has the option to add a barcode to a part.

In 1.4, you will be able to add a barcode per make/model record.

How are barcodes added when using LedgerSMB?

Sort term solution:
It's not optimal for a UPC management but it solves the immediate problem:

Add a space separated list with the barcodes to the partnumber field

The partnumber is the "Number" filed on the same line as "Description" in the "Add Part" page.
And yes, "space separated list" works in the POS interface. (If you scan one of the codes in the space separated list )

Here's how the partnumber and description fields work
It searches for any substring match for the entry.
If there is only one match it populates and moves on
If there are no matches it asks you if you want to create one
If there are multiple matches it gives you a list to choose from
same on the invoice screens

Long term solution:
- add a UPC field to the makemodel table.

Question from: Tau (2009)

No: Our templates are in LaTeX or HTML (your choice), and use TemplateToolkit for variable interpolation. No xslt, no xsssl, no programming language other than TT directives......


I have successfully installed LegerSMB and logged in. However, no matter the type of user (i.e. administrator, supervisor or user) the access control of them is always the same. I cannot amend the user access control rights. Therefore many functions such as amending the chart of account are not working. Are there any error on my installation?
[Chris Travers : the Role field in 1.2 affects some aspects of reports but not much more than that. use the check boxes to show/hide menu items. In 1.3, the roles are significantly different.]

In 1.3.x :
Go to the System -> Admin Users -> Search users page, click "Search" and select "[edit]" for the user you're trying to change.

You'll be presented with a long list of authorizations that can be assigned to the user.

There are a number of possible causes for login problems. Some of the more common causes are:

Login in 1.3.x is new. Take a look at this screen guide:

Magic Characters in passwords:
The legacy code from SQL-Ledger has some issues with parsing passwords that contain either the equals sign ("=") or the ampersand (&). This is gradually being resolved in the LedgerSMB codebase but for now avoid using either of these characters in your passwords. The issue is that the equals and ampersand characters are used as delimiters in query strings and posted content - this is being worked on so should not be an issue "soon".

Googlebait: Symptoms of this include "Error! Cannot connect to datasource" and "no database driver specified and DBI_DSN env var not set at LedgerSMB/Form.pm" (suspect this is for admin password).

Browser plugin
The noscript Firefox plugin can prevent the Super-user login and Password box from being created. Disable noscript on your login page.

Password "popup"
Installed in a fresh install of Ubuntu. All seemed fine on in the evening when I went home for the weekend. (I was able to login) Now when I login I get an other password request popup opening with: A username and password are being requested by The site says: "LedgerSMB"

The likely issue here is that the initial password creation temporarily valid, with the idea that the individual setting the password may not be the application user. Consequently the password has expired and you cannot log in.

To solve the Password "popup", you can do one of a couple things:
By: Chris Travers

1) You can locate your pg_hba.conf file and change the authentication type to "trust" briefly while logging in and changing your password. This requires telling PostgreSQL to reload its files (or restarting PostgreSQL)

2) You can log into PostgreSQL with something like: sudo -u postgres psql and then change the expiration date. (on Centos or Red Hat su to the postgres user and run psql: su - postgres) Something like:

ALTER USER 'myusername' WITH VALID UNTIL '2011-11-09';

Then when you log in, you should be able to change your password under the preferences screen or if it will expire within a week, it should pop up that screen when you log in, with a warning on top.

PostgreSQL authorization settings (pg_hba.conf)
Read the "pg_hba.conf settings for production"

The PostgreSQL doc about client authentication and pg_hba.conf