Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTRBK on CentOS 7: many errors got when dryrunning #419

Open
TheNighthawk99 opened this issue Oct 5, 2021 · 6 comments
Open

BTRBK on CentOS 7: many errors got when dryrunning #419

TheNighthawk99 opened this issue Oct 5, 2021 · 6 comments

Comments

@TheNighthawk99
Copy link

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): <https://digint.ch/btrbk/doc/btrbk.conf.5.html>
#   README.md:     <https://digint.ch/btrbk/doc/readme.html>
#
# 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
# <volume-directory> of the volume section.
# If not set, the snapshots are created in <volume-directory>.
#
# 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          <NN>h <NN>d <NN>w <NN>m <NN>y

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

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

# Retention policy for archives ("btrbk archive" command):
#archive_preserve_min       no
#archive_preserve           <NN>h <NN>d <NN>w <NN>m <NN>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 <volume-directory>"
#
#   <volume-directory>  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-name>"
#
#   <subvolume-name>    Subvolume to be backuped, relative to
#                       <volume-directory> in volume section.
#
# Target section: "target <type> <volume-directory>"
#
#   <type>              (optional) type, defaults to "send-receive".
#   <volume-directory>  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.

@digint
Copy link
Owner

digint commented Oct 23, 2021

Looks like CentOS does not run btrbk as a perl script. Maybe related to #307. Does it help if you change the shabang (like here: 175049f)?

@TheNighthawk99
Copy link
Author

Looks like CentOS does not run btrbk as a perl script. Maybe related to #307. Does it help if you change the shabang (like here: 175049f)?

Hello, thanks your reply.
perl interpreter is in the /usr/bin directory. Here is the output:

[username@server btrbk]$ ls -l /usr/bin/perl
-rwxr-xr-x. 2 root root 11408 Feb  2  2021 /usr/bin/perl
[username@server btrbk]$

Also with this command:

[username@server btrbk]$ which perl
/usr/bin/perl
[username@server btrbk]$

I have also change the shabang as suggested in the 175049f commit.
I get the same long list error.

I don't know how to investigate further. I installed btrbk not with the CentOS repository, but from the version downloaded throught git from this github repository.
Thank you.

@TheNighthawk99
Copy link
Author

Ok, I have an update.
Instead of installing the most recent version available here, I played with the 0.25.1, which comes by default with CentOS 7.
Don't know why, but it looks like working, except for the remote backup, where I get this error:

ERROR: Failed to parse subvolume list (unsupported btrfs-progs) for: <remote_ip_address>:/backups/server-name-bkpdir
Offending line: ID 256 gen 902 cgen 8 top level 5 parent_uuid -                                    received_uuid -                                    uuid XXXXX path <FS_TREE>/raspberry01

As far as I understand, a conflict in the btrfs-progs version: in CentOS I have 4.9.1, while at the remote target I have 5.4.1.
Is it really this the issue?

@digint
Copy link
Owner

digint commented Nov 7, 2021

I think the issue is ancient perl version in CentOS 7 (according to pkgs.org it's 5.16.3: https://pkgs.org/download/perl).

Can you please provide me the exact btrbk version you were running (commit hash if running masater branch), so that I can match the error lines with the code.
Probably it's some code construct which is not understood correctly and easily fixable.

@TheNighthawk99
Copy link
Author

TheNighthawk99 commented Nov 9, 2021

I think the issue is ancient perl version in CentOS 7 (according to pkgs.org it's 5.16.3: https://pkgs.org/download/perl).

Can you please provide me the exact btrbk version you were running (commit hash if running masater branch), so that I can match the error lines with the code. Probably it's some code construct which is not understood correctly and easily fixable.

I am not a GIT expert, anyway, this is the output:

[username@hostname btrbk]$ git rev-parse HEAD
c5273a8745fa60fc52b3180fa210ec3048e6a419

[username@hostname btrbk]$ git log
commit c5273a8745fa60fc52b3180fa210ec3048e6a419
Author: znerol <lo+github@znerol.ch>
Date:   Mon Nov 1 14:27:50 2021 +0100

    documentation: fix openssh website URL

Is the information you need to investigate? If negative, let me know.
Thanks a lot.

@TheNighthawk99
Copy link
Author

Ok, just installed PERL v.5.34.0 from source, it works. Other test to come, but I was able to take snapshots and transfer to target on an Ubuntu server.
If you need more information let me know.
Thank you for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants