Amanda openhabian: Only empty "amanda.conf" file after setup via openhabian-config

Tags: #<Tag:0x00007f74645261f8> #<Tag:0x00007f7464526130> #<Tag:0x00007f7464526068>

Hi all,
I went through the setup procedure of Amanda in openhabian-config. At the end I got a confirmation message that the backup will happen. But it only created an empty amanda.config file.
Any idea what I did wrong? Any advise highly appreciated.
Thanks
Simon

What I did in detail:

  1. mounted a SD card in an USB adapter in /mnt/backup01
  2. proceded the amanda menu item in openhabian-config. This results in a amanda.conf file (besides others) in
    “/etc/amanda/openhab-dir backup %ADMIN 15 68 /mnt/backup01”.
  • Platform information:
    • Hardware: Pi 3 B
    • OS: Openhabian
    • openHAB version: 2.5 M3

??
now is there an empty amanda.conf or not ?

Try installing again. You probably have skipped an input (entered blank?).

Hi Markus,

Thanks for your response.

There are four files in the directory:
amanda-client.conf
amanda.conf
disklist
tapelist

The file amanda.conf is empty.

These were my inputs in the openhabian-config configuration tool (50 Amanda Backup):

  1. Admin reports: “%ADMIN”
  2. Authentication Setup: a password (60 characters with digits and symbols). Entered it twice with copy and paste in the confirmation dialog
  3. Create file storage area based backup: Yes
  4. Storage directory: “/mnt/backup01”
  5. Storage capacity: “1024”
  6. Storage container creation: Continue
  7. Create Amazon S3 based backup: No
  8. (and final dialog) Operation Successful!: Ok

There were no other dialogs showing up. I did this several times. Also uninstalled and reinstalled Amanda.

Best,
Simon

I assume that caused the problem.
You are asked for a mail address so enter one.
There’s nothing like that asked for or mentioned in the README, is there ?
Please explain where the heck does one get the idea from to enter THAT string and why you never thought about trying a different input although installation failed every time?

From you my friend!


The referred amanda.config - that you approved - uses THAT string.

Oh dear. If you did read more closely that was in a different context.
And a config to use that string in the final file is not the same as to enter that string during installation :roll_eyes:
Docs read and install asks for a mail address, so why don’t you enter one but try to be more clever than the programmer ?

Guess what. Sometimes I’m indeed cleverer than the programmer. Sorry to hear this never happened to you.

All jokes aside. I DID use a proper "electronic@mail.de" address in the first place. The result was the same. But since I read (“closely”) the other topic, I tried (next to many other variants) also one with “%ADMIN”. “Probieren geht über studieren”.

So thanks for your hint. But this wasn’t the problem. Any other expedient thoughts?

Ok, then go bake your own amanda.conf. The source is in /opt/openhabian/includes/amanda.conf_template and the code is in /opt/openhabian/functions/backup.bash.
Good luck.

Thanks. I will give it a try.

Hello everybody,
I can confirm the amanda-installation problem is still not fixed. I run into the same issu while installing amanda backup. First on OH2.4.0 I did it from the Marianne Spillers instructions (chapter26), then after it fails more times, I installed a completeley fresh OH installation and tried to install again with the official openhab amanda documentation. Also failed again, then i tried with openHAB 2.5.0~M3-1 (Milestone Build), but every time the same. Installation said “OK”, but there are problems accessing and creating configuration files (resulting in a created, but empty amanda.configuration file). It seems to be a thing of user rights? (but i could´t fix that…)
Mount of the USB-Stick is ok, please see the code snippet with the failures:

 login as: openhabian
openhabian@openhabianpi's password:
Linux openhab 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Oct  5 11:04:52 2019 from 192.168.178.30

###############################################################################
###############  openhab  #####################################################
###############################################################################
##        Ip = 192.168.178.37
##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 4.19.66-v7+
##  Platform = Raspberry Pi 3 Model B Rev 1.2
##    Uptime = 0 day(s). 10:50:55
## CPU Usage = 0% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.07, 5m: 0.07, 15m: 0.02
##    Memory = Free: 0.06GB (7%), Used: 0.88GB (93%), Total: 0.95GB
##      Swap = Free: 0.09GB (99%), Used: 0.00GB (1%), Total: 0.09GB
##      Root = Free: 25.50GB (91%), Used: 2.36GB (9%), Total: 29.07GB
##   Updates = 0 apt updates available.
##  Sessions = 1 session(s)
## Processes = 123 running processes of 32768 maximum processes
###############################################################################

              Welcome to            __  _____    ____  _
            ____  ____  ___  ____  / / / /   |  / __ )(_)___ _____
           / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  / / __ `/ __ \
          / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ / / /_/ / / / /
          \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/_/\__,_/_/ /_/
              /_/
                  openHAB 2.5.0~M3-1 (Milestone Build)


Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openhab:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

[11:26:40] openhabian@openhab:~$
[11:36:51] openhabian@openhab:~$
[11:36:52] openhabian@openhab:~$ df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root        30G    2,4G   26G    9% /
devtmpfs        484M       0  484M    0% /dev
tmpfs           488M       0  488M    0% /dev/shm
tmpfs           488M    7,5M  481M    2% /run
tmpfs           5,0M    4,0K  5,0M    1% /run/lock
tmpfs           488M       0  488M    0% /sys/fs/cgroup
/dev/mmcblk0p1  253M     40M  213M   16% /boot
/dev/sda1        29G     45M   28G    1% /mnt/backup
tmpfs            98M       0   98M    0% /run/user/1000
[11:37:01] openhabian@openhab:~$
[11:37:03] openhabian@openhab:~$
[11:37:03] openhabian@openhab:~$
[11:37:03] openhabian@openhab:~$ sudo openhabian-config
[sudo] Passwort für openhabian:
2019-10-05_11:37:13_CEST [openHABian] Checking for root privileges... OK
OK:1 http://archive.raspberrypi.org/debian buster InRelease
OK:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Ign:3 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing InRelease
OK:4 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing Release
Paketlisten werden gelesen... Fertig
2019-10-05_11:37:20_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2019-10-05_11:37:20_CEST [openHABian] openHABian configuration tool version: [master]v1.5-522(67339f9)
2019-10-05_11:37:20_CEST [openHABian] Checking for changes in origin... OK
2019-10-05_11:37:40_CEST [openHABian] Setting up the Amanda backup system ...
$ apt-get -y install amanda-common amanda-server amanda-client
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
amanda-client ist schon die neueste Version (1:3.5.1-2+b3).
amanda-common ist schon die neueste Version (1:3.5.1-2+b3).
amanda-server ist schon die neueste Version (1:3.5.1-2+b3).
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr benötigt:
  rpi.gpio-common triggerhappy
Verwenden Sie »sudo apt autoremove«, um sie zu entfernen.
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
openhabian:x:1000:1000:,,,:/home/openhabian:/bin/bash
/bin/chown: Zugriff auf '/etc/amanda/openhab-dir backup heinecke@example.de 15 546 /mnt/backup /var/lib/amanda/openhab-dir backup heinecke@example.de 15 546 /mnt/backup/curinfo /var/log/amanda/openhab-dir backup heinecke@example.de 15 546 /mnt/backup /var/lib/amanda/openhab-dir backup heinecke@example.de 15 546 /mnt/backup/index' nicht möglich: Datei oder Verzeichnis nicht gefunden
seq: ungültiges Fließkommaargument: „“
„seq --help“ liefert weitere Informationen.
/bin/sed: -e Ausdruck #7, Zeichen 101: Unbekannte Option für »s«
/opt/openhabian/functions/backup.bash: Zeile 93: [: : Ganzzahliger Ausdruck erwartet.
2019-10-05_11:38:11_CEST [openHABian] Checking for default openHABian username:password combination... OK
2019-10-05_11:38:12_CEST [openHABian] We hope you got what you came for! See you again soon ;)
[11:38:12] openhabian@openhab:~$

any suggestions?
Rgds, Nikolas

Change /opt/openhabian/functions/backup.bash like here or wait for PR #722 to get merged.

1 Like

still some error using the new script with empty conf files created.

openhabian:x:1000:1000:,,,:/home/openhabian:/bin/bash
/bin/chown: cannot access ‘/etc/amanda/openhab-dir /var/lib/amanda/openhab-dir/curinfo /var/log/amanda/openhab-dir /var/lib/amanda/openhab-dir/index’: No such file or directory

after doing what ?

And of course you mustn’t let openhabian-config upgrade itself when it asks you to (obvious, isn’t it).

I replaced the bash script from the link you provided.
openhabian-config does not try to update itself after bash script replaced.

looks like some syntax errors in the script.
For example I replaced
/bin/mkdir -p "$infofile $logdir $indexdir" /bin/chown -R "${backupuser}":backup /var/backups/.amandahosts "${confdir} $infofile $logdir $indexdir"

with:
/bin/mkdir -p "$infofile" "$logdir" "$indexdir" /bin/chown -R "${backupuser}":backup /var/backups/.amandahosts "${confdir}" "$infofile" "$logdir" "$indexdir"

there also seems to be some error in the SED command line but my knowledge for fixing it is limited:
/bin/sed: -e expression #7, char 91: unknown option tos’`

edited the line:
/bin/sed -e "s|%CONFIG|${config}|g" -e "s|%CONFDIR|${confdir}|g" -e "s|%ADMIN|${adminmail}|g" -e "s|%TAPES|${tapes}|g" -e "s|%SIZE|${size}|g" -e "s|%TAPETYPE|${tapetype}|g" -e "s|%TPCHANGER|${tpchanger}|g" "${BASEDIR}"/includes/amanda.conf_template >"${confdir}"/amanda.conf

Please help fix the script, my backups are failing.
I am not backing up the whole SD just the openhab files to a USB stick storage.
Here is a failing log:

Hostname: openHABianPi
Org     : openHABian openhab-dir
Config  : openhab-dir
Date    : October 5, 2019

*** A TAPE ERROR OCCURRED: [No acceptable volumes found].
No dumps are left in the holding disk.

The next 10 tapes Amanda expects to use are: 10 new tapes.
FAILURE DUMP SUMMARY:
  openHABianPi /etc/openhab2 lev 0  FAILED [can't do degraded dump without holding disk]
  openHABianPi /var/lib/openhab2 lev 0  FAILED [can't do degraded dump without holding disk]



STATISTICS:
                          Total       Full      Incr.   Level:#
                        --------   --------   --------  --------
Estimate Time (hrs:min)     0:00
Run Time (hrs:min)          0:00
Dump Time (hrs:min)         0:00       0:00       0:00
Output Size (meg)            0.0        0.0        0.0
Original Size (meg)          0.0        0.0        0.0
Avg Compressed Size (%)      --         --         --
DLEs Dumped                    0          0          0
Avg Dump Rate (k/s)          --         --         --

Tape Time (hrs:min)         0:00       0:00       0:00
Tape Size (meg)              0.0        0.0        0.0
Tape Used (%)                0.0        0.0        0.0
DLEs Taped                     0          0          0
Parts Taped                    0          0          0
Avg Tp Write Rate (k/s)      --         --         --

NOTES:
  planner: Adding new disk openHABianPi:/etc/openhab2.
  planner: Adding new disk openHABianPi:/var/lib/openhab2.
  planner: WARNING: no history available for openHABianPi:/var/lib/openhab2; guessing that size will be 102400 KB
  planner: WARNING: no history available for openHABianPi:/etc/openhab2; guessing that size will be 102400 KB
  driver: Taper error: "No acceptable volumes found"
  taper: Slot 14 with label openHABian-openhab-dir-016 is not in the tapelist
  taper: Slot 15 with label openHABian-openhab-dir-017 is not in the tapelist
  taper: Slot 1 with label openHABian-openhab-dir-005 is not in the tapelist
  taper: Slot 2 with label openHABian-openhab-dir-006 is not in the tapelist
  taper: Slot 3 with label openHABian-openhab-dir-007 is not in the tapelist
  taper: Slot 4 with label openHABian-openhab-dir-008 is not in the tapelist
  taper: Slot 5 with label openHABian-openhab-dir-018 is not in the tapelist
  taper: Slot 6 with label openHABian-openhab-dir-009 is not in the tapelist
  taper: Slot 7 with label openHABian-openhab-dir-010 is not in the tapelist
  taper: Slot 8 with label openHABian-openhab-dir-011 is not in the tapelist
  taper: Slot 9 with label openHABian-openhab-dir-012 is not in the tapelist
  taper: Slot 10 with label openHABian-openhab-dir-013 is not in the tapelist
  taper: Slot 11 with label openHABian-openhab-dir-014 is not in the tapelist
  taper: Slot 12 with label openHABian-openhab-dir-019 is not in the tapelist
  taper: Slot 13 with label openHABian-openhab-dir-015 is not in the tapelist


DUMP SUMMARY:
                                                         DUMPER STATS   TAPER STATS
HOSTNAME     DISK              L ORIG-kB  OUT-kB  COMP%  MMM:SS   KB/s MMM:SS   KB/s
-------------------------------- ---------------------- -------------- -------------
openHABianPi /etc/openhab2                                  FAILED                 
openHABianPi /var/lib/openhab2                              FAILED                 

(brought to you by Amanda version 3.3.6)

and here is the conf file generated:

org "openHABian openhab-dir"                            # Organization name for reports
mailto "MYEMAIL@gmail.com"                                               # Email address to receive reports
netusage 90000 Kbps                                     # Bandwidth limit, 90M
dumpcycle 2 weeks                                       # Backup cycle is 14 days
runspercycle 7                                          # Run 7 times every 14 days
tapecycle 15 tapes                                      # Dump to this number of different tapes during the cycle
runtapes 10                                             # number of virtual containers to use at most per backup run
tpchanger "chg-disk:/storage/usbstick-linux/slots"    # The tape-changer glue script
taper-parallel-write 2
autolabel "openHABian-openhab-dir-%%%" empty
tapelist "/etc/amanda/openhab-dir/tapelist"                             # The tapelist file
tapetype DIRECTORY
infofile "/var/lib/amanda/openhab-dir/curinfo"          # Database directory
logdir "/var/log/amanda/openhab-dir"                    # Log directory
indexdir "/var/lib/amanda/openhab-dir/index"            # Index directory
define tapetype SD {
    comment "SD card size"
    length 16 gbytes                                    # default SD card size (1 bucket = 1 SD d)
}
define tapetype DIRECTORY {                             # Define our tape behaviour
        length 200 mbytes                               # size of every virtual container (= max. usage per directory)
}
define tapetype AWS {
    comment "S3 Bucket"
    length 200 mbytes                                   # actual bucket size 5GB (Amazon default for free S3)
}

amrecover_changer "changer"                             # Changer for amrecover

# don't use any holding disk for the time being
#holdingdisk hd {
#    directory "/holdingdisk/openhab-dir"
#    use 1000 Mb
#}

define dumptype global {                                # The global dump definition
        maxdumps 2                                      # maximum number of backups run in parallel
        holdingdisk no                                  # Dump to temp disk (holdingdisk) before backup to tape
        index yes                                       # Generate index. For restoration usage
}
define dumptype root-tar {                              # How to dump root's directory
        global                                          # Include global (as above)
        program "GNUTAR"                                # Program name for compress
        estimate server                                 # Estimate the backup size before dump
        comment "root partitions dumped with tar"
        compress none                                   # No compression
        index                                           # Index this dump
        priority low                                    # Priority level
}
define dumptype user-tar {                              # How to dump user's directory
        root-tar                                        # Include root-tar (as above)
        comment "user partitions dumped with tar"
        priority medium                                 # Priority level
}
define dumptype comp-user-tar {                         # How to dump & compress user's directory
        user-tar                                        # Include user-tar (as above)
        compress client fast                            # Compress in client side with less CPU (fast)
}
define application-tool app_amraw {                     # how to dump the SD card's raw device /dev/mmcblk0
        plugin "amraw"                                  # uses 'dd'
}
define dumptype amraw {
        global
        program "APPLICATION"
        application "app_amraw"
}
define dumptype comp-amraw {
        global
        program "APPLICATION"
        application "app_amraw"
        compress fast
}
# vim: filetype=conf

Your virtual tapes (storage directories /storage/usbstick-linux/slots/* according to your config) are not found, maybe the dir is wrong or you mounted the stick with wrong permissions or UID mapping.
Delete the directories in your storage area, verify permissions are good to go and install Amanda again.

Hey Markus,

thanks for your quick answer - back to the stable 2.4 - I changed the backup.bash as suggested and described and after reconfiguration via the openhabian-config now the amanda.conf file was written and the “virtual tapes and discs” are created. Thank you, first step is done…

…BUT, now if i want to do a “amdump openhab-dir” under the backup user I got the following error:

 [01:24:17] openhabian@openHABianPi:~$ sudo su - backup --shell=/bin/bash
 [sudo] password for openhabian:
 [01:24:28] backup@openHABianPi:~$ amdump openhab-dir
 amdump: could not open log file /var/log/amanda/openhab-dir/log: No such file or directory

then I created under root for testing the missing folder “/var/log/amanda/openhab-dir” , but there´s already again a permission problem:

[01:24:45] backup@openHABianPi:~$ amdump openhab-dir
amdump: could not open log file /var/log/amanda/openhab-dir/log: Permission denied

my mistake or have I do to correct ALL the shellcheck #722 changes?

Thanks in advance, Nikolas

Markus,
One update that seems missing in #722 changes is:

/bin/mkdir -p "$infofile $logdir $indexdir"
to:
/bin/mkdir -p "$infofile" "$logdir" "$indexdir"

This is why you have the log directory missing.

Yes. Simply replace backup.bash by https://raw.githubusercontent.com/mstormi/openhabian/shellcheck2/functions/backup.bash

PR #722 is merged now so please try again to use openhabian-config to install Amanda (have it update itself on start).

1 Like