Getting to the root of the problem

The previous set of posts have dealt with getting anacron and, in particular, Back In Time to run a daily backup job in the event that the computer is turned off when a scheduled task is set to occur. The problem has been narrowed down to the command line in the cron.daily folder failing to provide the correct configuration to the backintime utility since, when the job is run, the user is “unknown”. It’s finally time to fix this!

Some postings in the user forum (Questions) of Back In Time’s web site provide clues to both the specific problem, and the solution.

One of the suggestions to resolve a similar issue was: “When the application run from cron (as root) it will use /root/.config/… If you want to use the same config you can make a symbolic link from /home/user/.config/backintime to /root/.config/backintime. This way the config will be shared.

On my system, I created such a symbolic link (by right-clicking on the config file and using Make Link) and copied the resulting symlink to /root/.config/backintime. Unfortunately, this did nothing to change the situation with respect to an unknown user attempting to run backintime.

Another posting in the Questions’ forum related specifically to backintime running with an unknown user, but was also based on a later release (Version 1.0.6) of the Back In Time program than that currently available (Version 0.9.26) in Ubuntu’s Software Centre. Nevertheless, this posting gave a critical clue to the final solution by providing the following command line:

sudo -H backintime –profile-id 1 -b > /dev/null 2>&1

In the above command, the “profile-id” switch is only applicable to the later version of Back In Time (since profiles were introduced with Version 1.0). However, note the use of “sudo -H” in order to set the user’s profile to be that of root, as the following extract from man sudo indicates:

-H     The -H (HOME) option sets the HOME environment variable to the homedir of the target user (root by default)…

Including “sudo -H” on the command line in my backup script still failed to run backintime, but seemed to be getting closer to the truth as indicated by the resulting syslog entry:

Sep 11 11:15:49 Dell-XPS8300 backintime (root): WARNING: Not configured

In particular, note that I still have the “not configured” warning but backintime now knows that the user is root. Further reading of the sudo man page identified a further switch, namely:

-u user     The -u (user) option causes sudo to run the specified
command as a user other than root.

Eureka! How about combining a “-u toaster” switch with “-H” to, hopefully, run backintime as toaster, using toaster’s user profile?

This proved to be the solution to my problem. By including “sudo -u toaster -H” in the command line of the backup script, the daily job runs successfully through anacron any time the regularly scheduled task is prevented from running as a result of the computer not being turned on at the appropriate time. The final script file is as follows:

# Run Back In Time
sudo -u toaster -H nice -n 19 /usr/bin/backintime –backup-job

Finally – success!


not configured error

Unknown user-context after update to bit 1.06

BIT fails to run under anacron

This entry was posted in anacron, Applications, Backup, Bash script, Commands and tagged . Bookmark the permalink.

2 Responses to Getting to the root of the problem

  1. jwillar says:

    So here it is 2014 and like you, I am disapointed with BIT failing to be there for the common home computer and provide the anacron vice cron approach for schedualing. Any way, I just wanted to add this work if you configure through the ‘BIT’ vice ‘BIT (root)’ launcher.

    • Alan German says:

      Thank you for this suggestion. I leave it for others to check and use this “root” technique as they wish. My Back-in-Time scheduling has been working just fine for more than a year, and I’m a firm believer of “If it ain’t broke…”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s