digint / digint/btrbk

BTRBK on CentOS 7: many errors got when dryrunning

Open
#419 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

Hello,
this could not be an issue, but I cannot further investigate.

I installed BTRBK on a CentOS7 system with btrfs file system. When I run btrbk I get these errors:

```
Use of ?PATTERN? without explicit operator is deprecated at /bin/btrbk line 5128.
Not enough arguments for grep at /bin/btrbk line 2488, near "$vol_root_id)"
Too many arguments for main::eval_quiet at /bin/btrbk line 5129, near "eval_quiet { require Encode; } ? sub "
(Might be a runaway multi-line ?? string starting on line 5128)
syntax error at /bin/btrbk line 5129, near "eval_quiet { require Encode; } ? sub "
Global symbol "$no_header" requires explicit package name at /bin/btrbk line 5133.
Global symbol "@keys" requires explicit package name at /bin/btrbk line 5133.
Global symbol "$data" requires explicit package name at /bin/btrbk line 5135.
Global symbol "@keys" requires explicit package name at /bin/btrbk line 5137.
Global symbol "%hide_column" requires explicit package name at /bin/btrbk line 5141.
Global symbol "$empty_cell_char" requires explicit package name at /bin/btrbk line 5142.
Global symbol "$termwidth" requires explicit package name at /bin/btrbk line 5144.
Global symbol "%hide_column" requires explicit package name at /bin/btrbk line 5149.
Global symbol "@keys" requires explicit package name at /bin/btrbk line 5149.
Global symbol "$title" requires explicit package name at /bin/btrbk line 5152.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5153.
Global symbol "$title" requires explicit package name at /bin/btrbk line 5153.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5154.
Global symbol "$title" requires explicit package name at /bin/btrbk line 5154.
Global symbol "$no_header" requires explicit package name at /bin/btrbk line 5158.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5161.
Global symbol "$pretty" requires explicit package name at /bin/btrbk line 5163.
Global symbol "%ralign" requires explicit package name at /bin/btrbk line 5165.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5166.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5169.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5171.
Global symbol "$table_spacing" requires explicit package name at /bin/btrbk line 5173.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5175.
Global symbol "$pretty" requires explicit package name at /bin/btrbk line 5178.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5180.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5181.
Global symbol "$table_spacing" requires explicit package name at /bin/btrbk line 5182.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5184.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5195.
Global symbol "$termwidth" requires explicit package name at /bin/btrbk line 5196.
Global symbol "%ralign" requires explicit package name at /bin/btrbk line 5197.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5198.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5201.
Global symbol "$table_spacing" requires explicit package name at /bin/btrbk line 5202.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5204.
Global symbol "%args" requires explicit package name at /bin/btrbk line 5208.
Global symbol "$fh" requires explicit package name at /bin/btrbk line 5209.
syntax error at /bin/btrbk line 5211, near "}"
/bin/btrbk has too many errors.
```
Here is the `btrfs subvolume list /` command output:
```
ID 257 gen 227 top level 5 path root
ID 258 gen 225 top level 5 path home
ID 260 gen 222 top level 257 path var/lib/machines
```

Here is the fstab file:
```
#
# /etc/fstab
# Created by anaconda on Sun Oct 3 22:08:05 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=xxxxx /mnt/btrfs_pool btrfs subvolid=5,defaults,noatime,space_cache 0 0
UUID=xxxxx / btrfs subvol=root,defaults,noatime,space_cache 0 0
UUID=zzzzz /boot xfs defaults 0 0
UUID=xxxxx /home btrfs subvol=home,defaults,noatime,space_cache 0 0
UUID=www swap swap defaults 0 0
```
The `/mnt/btrfs_pool` directory has the following structure:
```
[username@server ~]$ tree /mnt -L 3
/mnt
└── btrfs_pool
├── home
│   └── username
├── root
│   ├── bin -> usr/bin
│   ├── boot
│   ├── dev
│   ├── etc
│   ├── home
│   ├── lib -> usr/lib
│   ├── lib64 -> usr/lib64
│   ├── media
│   ├── mnt
│   ├── opt
│   ├── proc
│   ├── root
│   ├── run
│   ├── sbin -> usr/sbin
│   ├── srv
│   ├── sys
│   ├── tmp
│   ├── usr
│   └── var
└── _snaps
```
the `_snaps` directory is the one choosen for btrbk snapshots.

Finally, this is the `btrbk.conf` file:
```
[username@server ~]$ cat /etc/btrbk/btrbk.conf
#
# Example btrbk configuration file
#
#
# Please refer to the btrbk.conf(5) man-page for a complete
# description of all configuration options.
# For more examples, see README.md included with this package.
#
# btrbk.conf(5):
# README.md:
#
# Note that the options can be overridden per volume/subvolume/target
# in the corresponding sections.
#

# Enable transaction log
transaction_log /var/log/btrbk.log

# Use long timestamp format (includes hour/minute)
timestamp_format long

# Enable stream buffer. Adding a buffer between the sending and
# receiving side is generally a good idea.
# NOTE: If enabled, make sure to install the "mbuffer" package!
stream_buffer 512m

# Directory in which the btrfs snapshots are created. Relative to
# of the volume section.
# If not set, the snapshots are created in .
#
# If you want to set a custom name for the snapshot (and backups),
# use the "snapshot_name" option within the subvolume section.
#
# NOTE: btrbk does not autmatically create this directory, and the
# snapshot creation will fail if it is not present.
#
#snapshot_dir _btrbk_snap

# Always create snapshots. Set this to "ondemand" to only create
# snapshots if the target volume is reachable. Set this to "no" if
# snapshot creation is done by another instance of btrbk.
#snapshot_create always

# Perform incremental backups (set to "strict" if you want to prevent
# creation of non-incremental backups if no parent is found).
#incremental yes

# Specify after what time (in full hours after midnight) backups/
# snapshots are considered as a daily backup/snapshot
preserve_hour_of_day 18

# Specify on which day of week weekly/monthly backups are to be
# preserved.
preserve_day_of_week sunday

# Preserve all snapshots for a minimum period of time.
#snapshot_preserve_min 1d

# Retention policy for the source snapshots.
#snapshot_preserve h d w m y

# Preserve all backup targets for a minimum period of time.
#target_preserve_min no

# Retention policy for backup targets:
#target_preserve h d w m y

# Retention policy for archives ("btrbk archive" command):
#archive_preserve_min no
#archive_preserve h d w m y

# Specify SSH private key for "ssh://" volumes / targets:
ssh_identity /etc/btrbk/ssh/id_file
ssh_user root
#ssh_compression no
#ssh_cipher_spec default

# Enable compression for remote btrfs send/receive operations:
#stream_compress no
#stream_compress_level default
#stream_compress_threads default

# Enable lock file support: Ensures that only one instance of btrbk
# can be run at a time.
lockfile /var/lock/btrbk.lock

# Don't wait for transaction commit on deletion. Set this to "after"
# or "each" to make sure the deletion of subvolumes is committed to
# disk when btrbk terminates.
#btrfs_commit_delete no

# Volume section (optional): "volume "
#
# Base path within a btrfs filesystem
# containing the subvolumes to be backuped
# (usually the mount-point of a btrfs filesystem
# mounted with subvolid=5 option).
#
# Subvolume section: "subvolume "
#
# Subvolume to be backuped, relative to
# in volume section.
#
# Target section: "target "
#
# (optional) type, defaults to "send-receive".
# Directory within a btrfs filesystem
# receiving the backups.
#
# NOTE: The parser does not care about indentation, this is only for
# human readability. All options apply to the last section
# encountered, overriding the corresponding option of the upper
# section. This means that the global options must be set on top,
# before any "volume", "subvolume" or "target section.

# Example retention policy:
#
snapshot_preserve_min 14d
snapshot_preserve 28d

target_preserve_min no
target_preserve 56d 24w *m

# Simple setup: Backup root and home to external disk
#
#snapshot_dir /btrbk_snapshots
#target /mnt/btr_backup
#subvolume /
#subvolume /home

# Complex setup
#
# In order to keep things organized, it is recommended to use "volume"
# sections and mount the top-level subvolume (subvolid=5):
#
# $ mount -o subvolid=5 /dev/sda1 /mnt/btr_pool
#
# Backup to external disk mounted on /mnt/btr_backup
volume /mnt/btrfs_pool
# Create snapshots in /mnt/btr_pool/btrbk_snapshots
snapshot_dir _snaps

# Target for all subvolume sections:
#target /mnt/btr_backup

# Some default btrfs installations (e.g. Ubuntu) use "@" for rootfs
# (mounted at "/") and "@home" (mounted at "/home"). Note that this
# is only a naming convention.
#subvolume @
subvolume root
#subvolume home
#subvolume kvm
# Use different retention policy for kvm backups:
# target ssh://target_ip_address/directory_name/server_name
# target_preserve 7d 4w

# Backup data to external disk as well as remote host
#volume /mnt/btr_data
# subvolume data
# Always create snapshot, even if targets are unreachable
# snapshot_create always
# target /mnt/btr_backup
# target ssh://backup.my-remote-host.com/mnt/btr_backup

# Backup from remote host, with different naming
#volume ssh://my-remote-host.com/mnt/btr_pool
# subvolume data_0
# snapshot_dir snapshots/btrbk
# snapshot_name data_main
# target /mnt/btr_backup/my-remote-host.com
#

# Resume backups from remote host which runs its own btrbk instance
# creating snapshots for "home" in "/mnt/btr_pool/btrbk_snapshots".
#volume ssh://my-remote-host.com/mnt/btr_pool
# snapshot_dir btrbk_snapshots
# snapshot_create no
# snapshot_preserve_min all
# subvolume home
# target /mnt/btr_backup/my-remote-host.com
```

I have other btrbk installation on Ubuntu Servers and they work, not in CentOS. Does anyone of you able to run on CentOS systems?
At this point I cannot understand how to proceed further.

Thank you.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported syntax errors in /bin/btrbk around lines 2488 and 5128-5211, then compare the installed script and dry-run behavior with the working Ubuntu installations. Identify whether the CentOS 7 environment exposes a compatibility problem in that code path, and confirm completion when btrbk can dry-run without the reported Perl errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.