Unattended openHABian setup no Amanda

In preparation for migration to OH4, I created a clean new install using openhabian. In the process, I had hoped based on xxxxx that both mirroring and Amanda would be set up, but it appears that only mirroring was actually set up.

I read this 2 year old thread openHABian unattended - amanda not installed - #18 by narf27. Rather than reopening an old thread, I thought i would start this new one.

Here is the relevant section of \boot\openhabian.conf


# external SD card device to backup and mirror the internal SD card to
backupdrive=/dev/sda
storageconfig=openhab-dir
storagedir=/storage
storagetapes=15
storagecapacity=1024

And from /boot/first-boot.log


$ install -m 755 /opt/openhabian/includes/SD/set-partuuid /usr/local/sbin 
2023-07-04_09:40:26_CDT [openHABian] Setting up automated SD mirroring and backup... 
$ apt-get install --yes -o DPkg::Lock::Timeout=60 gdisk 
Reading package lists...
Building dependency tree...
Reading state information...
gdisk is already the newest version (1.0.6-1.1).
gdisk set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Failed to stop storage.mount: Unit storage.mount not loaded.
Checking that no-one is using this disk right now ... OK

Disk /dev/sda: 58.24 GiB, 62534975488 bytes, 122138624 sectors
Disk model: Storage Device  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4d721b07

Old situation:

Device     Boot    Start       End  Sectors  Size Id Type
/dev/sda1           8192    532479   524288  256M  c W95 FAT32 (LBA)
/dev/sda2         532480  60751871 60219392 28.7G 83 Linux
/dev/sda3       60751872 122138623 61386752 29.3G 83 Linux

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0x5c840b2f.
/dev/sda1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 256 MiB.
Partition #1 contains a vfat signature.
/dev/sda2: Created a new partition 2 of type 'Linux' and of size 14.2 GiB.
Partition #2 contains a ext4 signature.
/dev/sda3: Created a new partition 3 of type 'Linux' and of size 43.8 GiB.
/dev/sda4: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x5c840b2f

Device     Boot    Start       End  Sectors  Size Id Type
/dev/sda1           8192    532479   524288  256M  c W95 FAT32 (LBA)
/dev/sda2         532480  30244863 29712384 14.2G 83 Linux
/dev/sda3       30244864 122138623 91893760 43.8G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

$ mke2fs -F -t ext4 /dev/sda3 
mke2fs 1.46.2 (28-Feb-2021)
Creating filesystem with 11486720 4k blocks and 2875392 inodes
Filesystem UUID: 6a2dea56-e977-4859-8781-f63e6ec34a3b
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done   


$ chmod 644 /etc/systemd/system/storage.mount 

$ systemctl -q daemon-reload 

$ systemctl enable --now storage.mount 
Created symlink /etc/systemd/system/local-fs.target.wants/storage.mount → /etc/systemd/system/storage.mount.
Created symlink /etc/systemd/system/zram-config.service.wants/storage.mount → /etc/systemd/system/storage.mount.
Taking a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card

$ dd if=/dev/mmcblk0p1 bs=1M of=/dev/sda1 status=progress 
226492416 bytes (226 MB, 216 MiB) copied, 5 s, 45.2 MB/s
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 36.7534 s, 7.3 MB/s

$ dd if=/dev/mmcblk0p2 bs=1M of=/dev/sda2 status=progress 
15211692032 bytes (15 GB, 14 GiB) copied, 1610 s, 9.4 MB/s 
14508+0 records in
14508+0 records out
15212740608 bytes (15 GB, 14 GiB) copied, 1686.7 s, 9.0 MB/s
yes: standard output: Broken pipe

$ e2fsck -y /dev/sda2 
e2fsck 1.46.2 (28-Feb-2021)
rootfs: clean, 75157/908352 files, 1161504/3714048 blocks

$ tune2fs /dev/sda2 -U random 
tune2fs 1.46.2 (28-Feb-2021)

This operation requires a freshly checked filesystem.

Please run e2fsck -f on the filesystem.

FAILED (set random UUID)

$ fsck -y -t ext4 /dev/sda2 
fsck from util-linux 2.36.1
e2fsck 1.46.2 (28-Feb-2021)
rootfs: clean, 75157/908352 files, 1161504/3714048 blocks

$ install -m 644 -t /etc/systemd/system /opt/openhabian/includes/SD/sdrawcopy.timer /opt/openhabian/includes/SD/sdrsync.timer 

$ install -m 755 /opt/openhabian/includes/SD/mirror_SD /usr/local/sbin 

$ systemctl -q daemon-reload 

From what I can tell, it looks like there was sufficient space allocated to sda3 for Amanda.

After rereading the documentation, I’m thinking that perhaps I might need to specify the amount of storage for Amanda to use:

“ Use storagecapacity=xxx to override how much space to consume at most for Amanda backup storage (in MB). openHABian will create partitions 1 and 2 to be mirrors of your internal card and will assign the remaining space to another partition that you can use for storage. NOTE: if you do and if the remaining space is sufficient, selecting this will also result in setting up the Amanda backup system on that extra space.”

Based on the advice to not back up the raw SD card if it has a capacity of greater than 8 GB (mine is 16 GB), and since I don’t have any idea how much space to use, it appears I should enter 1024, based on:
“ * “Backup raw SD card?” (not asked if you selected AWS S3 storage) Answer “yes” if you want to create raw disk backups of your SD card. This is only recommended if your SD card is 8GB or less in size, otherwise the backup can take too long. You can always add/remove this by editing ${confdir}/disklist at a later time.”

And

“ If you don’t have any idea and chose to NOT backup your SD card, enter 1024 (= 1 GByte).”

After going through all of the above, I see that I had storagecapacity=1024 in openhabian.conf, which brings me back to why I created this thread in the first place.

I’m sure I missed something, but I can’t figure out what it is.

Any suggestions on what I am missing on setting up Amanda in unattended mode?

Thanks

P.S. I’m running openHAB 4.0.1 on a Pi 4B running openhabian. Here is the system info from the UI:


runtimeInfo:
  version: 4.0.1
  buildString: Release Build
locale: en-US
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.7
  javaVendor: Raspbian
  osName: Linux
  osVersion: 6.1.21-v8+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 105993872
  totalMemory: 778567680
  startLevel: 100
bindings: null
clientInfo:
  device:
    ios: true
    android: false
    androidChrome: false
    desktop: false
    iphone: false
    ipod: false
    ipad: true
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    os: ios
    osVersion: 13.0.0
    webView: true
    webview: true
    standalone: true
    pixelRatio: 2
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: en-US
    languages:
      - en-US
    onLine: true
    platform: MacIntel
  screen:
    width: 1024
    height: 1366
    colorDepth: 32
  support:
    touch: true
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: true
    intersectionObserver: true
  themeOptions:
    dark: light
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15
    (KHTML, like Gecko)
timestamp: 2023-08-05T02:18:58.947Z

(I noticed that is says binds are null. I am using many bindings, and they all seem to be working, so I’m sure what’s up with the null.)

I guess you’re the first to ever attempt this so guess you won’t receive any response other than mine.

At first sight I don’t see anything wrong. Partition was created and /etc/systemd/system/storage.mount seems to exist so it should mount that on next boot.

Did you boot? Can you manually mount storage using systemctl start storage.mount ?
What does /etc/systemd/system/storage.mount look like ?

Thanks for the help.

Yes

Yes

openhabian@openhabian-spring4:/var/log/openhab $ systemctl start storage.mount
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'storage.mount'.
Authenticating as: ,,, (openhabian)
Password: 
==== AUTHENTICATION COMPLETE ===
openhabian@openhabian-spring4:/var/log/openhab $ 
openhabian@openhabian-spring4:/var/log/openhab $ cat /etc/systemd/system/storage.mount
[Unit]
Description=/storage mount
Before=zram-config.service

[Mount]
What=/dev/sda3
Where=/storage
Type=ext4

[Install]
WantedBy=local-fs.target zram-config.service
openhabian@openhabian-spring4:/var/log/openhab $ 

And the Problem is what, is it that /storage doesn’t mount? Does it exist?
Tey removing the conditional dependency from zram then systemctl daemon-reload

The problem is that Amanda does not appear to have been installed and is not running. Perhaps I was expecting too much in that I thought it would be like mirroring, where I didn’t have to do anything else to get it running (besides making the necessary changes in /boot/openhabian.conf).

Indeed the docs also tell you don’t they.

@BigGeorgeTx did you get it to work?
tried to setup ohab4 with a fresh openhabian image and

backupdrive=/dev/sda
storageconfig=openhab-dir
storagedir=/storage
storagetapes=15
storagecapacity=7168

but no luck…

first-boot.log says

Old situation:

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 31116287 31108096 14.8G  c W95 FAT32 (LBA)

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0xfbdfce73.
/dev/sda1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 256 MiB.
Partition #1 contains a vfat signature.
/dev/sda2: Created a new partition 2 of type 'Linux' and of size 7.1 GiB.
/dev/sda3: Created a new partition 3 of type 'Linux' and of size 7.4 GiB.
/dev/sda4: Done.

New situation:
Disklabel type: dos
Disk identifier: 0xfbdfce73

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1           8192   532479   524288  256M  c W95 FAT32 (LBA)
/dev/sda2         532480 15523839 14991360  7.1G 83 Linux
/dev/sda3       15523840 31116287 15592448  7.4G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

/storage is not mounted (just like on your setup)

and it doesn’t look like amanda wasn’t installed at all…

[22:26:37] backup@ohab4:~$ amcheck openhab-dir
-bash: amcheck: command not found

but here i says that “We highly recommend you to make use of this feature on initial openHABian installation” so there should be at least some users who use this great feature, right?