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

Bash auto complete not working #1040

Open
kcslb92 opened this issue Dec 11, 2024 · 4 comments
Open

Bash auto complete not working #1040

kcslb92 opened this issue Dec 11, 2024 · 4 comments

Comments

@kcslb92
Copy link

kcslb92 commented Dec 11, 2024

Hi Guys,

I vaguely recall that barman would work properly with bash auto-complete when I'd installed it some time ago on another system.

I've just recently installed it again and have found that bash auto-complete isn't working, is there something I can check/configure to ensure that this works?

Cheers.

@martinmarques
Copy link
Contributor

I've just tested this on a rocky8 system and auto-complete works fine. What is it that doesn't work? Which OS/distribution are you using? How did you install Barman?

@kcslb92
Copy link
Author

kcslb92 commented Dec 11, 2024

Hi @martinmarques,

It’s a Ubuntu build (22.04 I believe, I’ll need to check tomorrow when I am in the office). I used apt to install Barman 3.12.1.

Is there a bash auto complete file that I can drop into /etc/autocomplete.d/ or something to get this working? Curious if your rocky8 installation has an autocomplete file somewhere too?

Thanks

@martinmarques
Copy link
Contributor

$ rpm -ql barman
/etc/barman.conf
/etc/barman.d
/etc/barman.d/passive-server.conf-template
/etc/barman.d/ssh-server.conf-template
/etc/barman.d/streaming-server.conf-template
/etc/bash_completion.d
/etc/bash_completion.d/barman
/etc/cron.d/barman
/etc/logrotate.d/barman
. . . 

The bash_completion comes from here: https://github.com/EnterpriseDB/barman/blob/master/scripts/barman.bash_completion

I think you need to debug this in your system, and if there's a problem with the bash_completion on ubuntu, report it to the packagers (I suppose that would be PGDG)

@kcslb92
Copy link
Author

kcslb92 commented Dec 13, 2024

Hi @martinmarques, please see below:

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

$ dpkg-query -L barman | grep completion
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/barman

I worked out the issue in our environment, funnily enough it was that we were missing the python3-argcomplete package.

The contents of the /usr/share/bash-completion/completions/barman file is:

eval "$((register-python-argcomplete3 barman || register-python-argcomplete barman) 2>/dev/null)"

Running the first portion interactively showed the following:

$ register-python-argcomplete3 barman
Command 'register-python-argcomplete3' not found, but can be installed with:
apt install python3-argcomplete
Please ask your administrator.

I thought this mightl have happened because I told apt to not install "recommended" packages alongside barman. This is because it was installing a version of postgresql client tools that was not compatible with our environment, eg:

  • for apt-get use --no-install-recommends and --no-install-suggests
  • for aptitude use --without-recommends or -R

But upon looking further, that's not it at all:

xkcharl@arddvmotbm000:~$ apt show barman
Package: barman
Version: 3.12.1-1.jammy
Priority: optional
Section: database
Maintainer: Marco Nenciarini <[email protected]>
Installed-Size: 147 kB
Depends: python3-barman (= 3.12.1-1.jammy), python3-pkg-resources, adduser, rsync (>= 3.0.4~), python3:any
**Recommends: openssh-server, openssh-client, postgresql-client**
Suggests: barman-cli, repmgr
Homepage: http://www.pgbarman.org
Download-Size: 99.1 kB
APT-Manual-Installed: yes
APT-Sources: https://repo.arda.afp.gov.au/enterprisedb jammy/main amd64 Packages
Description: Backup and Recovery Manager for PostgreSQL
 Barman (Backup and Recovery Manager) is an open-source
 administration tool for disaster recovery of PostgreSQL
 servers written in Python.
 .
 It allows your organization to perform remote backups of
 multiple servers in business critical environments to
 reduce risk and help DBAs during the recovery phase.
 .
 Barman is distributed under GNU GPL 3 and maintained
 by EnterpriseDB.
 .
 This package provides barman binary.

Interestingly, python3-argcomplete is depended upon by python3-barman (as below):

$ apt-cache rdepends python3-argcomplete
python3-argcomplete
Reverse Depends:
  python3-mini-buildd
  python3-barman
  python3-barman
  python3-barman
  python3-barman
  python3-barman
  python3-barman
  python3-libmaas
  ansible-core
  yotta
  virtinst
  subdownloader
  sshoot
  sdkmanager
  python3-nox
  ansible
  python3-libmaas
  python3-lib389
  python3-knack
  python3-gffutils
  python3-barman
  python3-argh
  pipx
  pibootctl
  mailscripts
  linkchecker
  lesana
  gourmand
  git-phab
  dosage
  diffoscope-minimal
  diffoscope
  datalad
  cwltool
  cmake-format
  brutespray
  ansible-core

If we look at the python3-barman package we see:

$ apt show python3-barman
Package: python3-barman
Version: 3.12.1-1.jammy
Priority: optional
Section: python
Source: barman
Maintainer: Marco Nenciarini <[email protected]>
Installed-Size: 1,580 kB
Depends: python3-dateutil, python3-psycopg2, **python3:any**
Breaks: barman (<< 2.8~~), barman-cli (<< 2.8~~)
Replaces: barman (<< 2.8~~), barman-cli (<< 2.8~~)
Homepage: http://www.pgbarman.org
Download-Size: 254 kB
APT-Manual-Installed: no
APT-Sources: https://repo.arda.afp.gov.au/enterprisedb jammy/main amd64 Packages
Description: Backup and Recovery Manager for PostgreSQL - Python modules
 Barman (Backup and Recovery Manager) is an open-source
 administration tool for disaster recovery of PostgreSQL
 servers written in Python.
 .
 It allows your organization to perform remote backups of
 multiple servers in business critical environments to
 reduce risk and help DBAs during the recovery phase.
 .
 Barman is distributed under GNU GPL 3 and maintained
 by EnterpriseDB.
 .
 This package provides Python 3 modules only.

Checking all (recursively) dependencies for the barman package shows the following:

$ apt-rdepends barman
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
barman
  Depends: adduser
  Depends: python3-barman (= 3.12.1-1.jammy)
  Depends: python3-pkg-resources
  Depends: python3:any
  Depends: rsync (>= 3.0.4~)
adduser
  Depends: debconf (>= 0.5)
  Depends: debconf-2.0
  Depends: passwd
debconf
  PreDepends: perl-base (>= 5.20.1-3~)
perl-base
  PreDepends: dpkg (>= 1.17.17)
  PreDepends: libc6 (>= 2.35)
  PreDepends: libcrypt1 (>= 1:4.1.0)
dpkg
  Depends: tar (>= 1.28-1)
  PreDepends: libbz2-1.0
  PreDepends: libc6 (>= 2.34)
  PreDepends: liblzma5 (>= 5.2.2)
  PreDepends: libselinux1 (>= 3.1~)
  PreDepends: libzstd1 (>= 1.4.0)
  PreDepends: zlib1g (>= 1:1.1.4)
tar
  PreDepends: libacl1 (>= 2.2.23)
  PreDepends: libc6 (>= 2.34)
  PreDepends: libselinux1 (>= 3.1~)
libacl1
  Depends: libc6 (>= 2.33)
libc6
  Depends: libcrypt1 (>= 1:4.4.10-10ubuntu4)
  Depends: libgcc-s1
libcrypt1
  Depends: libc6 (>= 2.25)
libgcc-s1
  Depends: gcc-12-base (= 12.3.0-1ubuntu1~22.04)
  Depends: libc6 (>= 2.35)
gcc-12-base
libselinux1
  Depends: libc6 (>= 2.34)
  Depends: libpcre2-8-0 (>= 10.22)
libpcre2-8-0
  Depends: libc6 (>= 2.14)
libbz2-1.0
  Depends: libc6 (>= 2.4)
liblzma5
  Depends: libc6 (>= 2.34)
libzstd1
  Depends: libc6 (>= 2.14)
zlib1g
  Depends: libc6 (>= 2.14)
debconf-2.0
passwd
  Depends: libaudit1 (>= 1:2.2.1)
  Depends: libc6 (>= 2.34)
  Depends: libcrypt1 (>= 1:4.1.0)
  Depends: libpam-modules
  Depends: libpam0g (>= 0.99.7.1)
  Depends: libselinux1 (>= 3.1~)
  Depends: libsemanage2 (>= 2.0.3)
libaudit1
  Depends: libaudit-common (>= 1:3.0.7-1build1)
  Depends: libc6 (>= 2.33)
  Depends: libcap-ng0 (>= 0.7.9)
libaudit-common
libcap-ng0
  Depends: libc6 (>= 2.33)
libpam-modules
  PreDepends: debconf (>= 0.5)
  PreDepends: debconf-2.0
  PreDepends: libaudit1 (>= 1:2.2.1)
  PreDepends: libc6 (>= 2.34)
  PreDepends: libcrypt1 (>= 1:4.3.0)
  PreDepends: libdb5.3
  PreDepends: libnsl2 (>= 1.0)
  PreDepends: libpam-modules-bin (= 1.4.0-11ubuntu2.4)
  PreDepends: libpam0g (>= 1.3.2)
  PreDepends: libselinux1 (>= 3.1~)
  PreDepends: libtirpc3 (>= 1.0.2)
libdb5.3
  Depends: libc6 (>= 2.34)
libnsl2
  Depends: libc6 (>= 2.33)
  Depends: libtirpc3 (>= 1.0.2)
libtirpc3
  Depends: libc6 (>= 2.34)
  Depends: libgssapi-krb5-2 (>= 1.17)
  Depends: libtirpc-common (>= 1.3.2-2ubuntu0.1)
libgssapi-krb5-2
  Depends: libc6 (>= 2.33)
  Depends: libcom-err2 (>= 1.43.9)
  Depends: libk5crypto3 (>= 1.16)
  Depends: libkrb5-3 (= 1.19.2-2ubuntu0.4)
  Depends: libkrb5support0 (>= 1.15~beta1)
libcom-err2
  Depends: libc6 (>= 2.17)
libk5crypto3
  Depends: libc6 (>= 2.33)
  Depends: libkrb5support0 (>= 1.16)
libkrb5support0
  Depends: libc6 (>= 2.34)
libkrb5-3
  Depends: libc6 (>= 2.34)
  Depends: libcom-err2 (>= 1.43.9)
  Depends: libk5crypto3 (>= 1.15~beta1)
  Depends: libkeyutils1 (>= 1.5.9)
  Depends: libkrb5support0 (= 1.19.2-2ubuntu0.4)
  Depends: libssl3 (>= 3.0.0~~alpha1)
libkeyutils1
  Depends: libc6 (>= 2.14)
libssl3
  Depends: debconf (>= 0.5)
  Depends: debconf-2.0
  Depends: libc6 (>= 2.34)
libtirpc-common
libpam-modules-bin
  Depends: libaudit1 (>= 1:2.2.1)
  Depends: libc6 (>= 2.34)
  Depends: libcrypt1 (>= 1:4.3.0)
  Depends: libpam0g (>= 0.99.7.1)
  Depends: libselinux1 (>= 3.1~)
libpam0g
  Depends: debconf (>= 0.5)
  Depends: debconf-2.0
  Depends: libaudit1 (>= 1:2.2.1)
  Depends: libc6 (>= 2.34)
libsemanage2
  Depends: libaudit1 (>= 1:2.2.1)
  Depends: libbz2-1.0
  Depends: libc6 (>= 2.33)
  Depends: libselinux1 (>= 3.3)
  Depends: libsemanage-common (>= 3.3-1build2)
  Depends: libsepol2 (>= 3.3)
libsemanage-common
libsepol2
  Depends: libc6 (>= 2.33)
python3-barman
  Depends: python3-dateutil
  Depends: python3-psycopg2
  Depends: python3:any
python3-dateutil
  Depends: python3-six (>= 1.5)
  Depends: python3:any
  Depends: tzdata
python3-six
  Depends: python3:any
python3:any
tzdata
  Depends: debconf (>= 0.5)
  Depends: debconf-2.0
python3-psycopg2
  Depends: libc6 (>= 2.15)
  Depends: libpq5 (>= 10~~)
  Depends: python3 (>= 3.10~)
  Depends: python3:any
libpq5
  Depends: libc6 (>= 2.33)
  Depends: libgssapi-krb5-2 (>= 1.17)
  Depends: libldap-2.5-0 (>= 2.5.4)
  Depends: libssl3 (>= 3.0.0~~alpha1)
libldap-2.5-0
  Depends: libc6 (>= 2.34)
  Depends: libgnutls30 (>= 3.7.2)
  Depends: libsasl2-2 (>= 2.1.27+dfsg2)
libgnutls30
  Depends: libc6 (>= 2.34)
  Depends: libgmp10 (>= 2:6.2.1+dfsg)
  Depends: libhogweed6 (>= 3.6)
  Depends: libidn2-0 (>= 2.0.0)
  Depends: libnettle8 (>= 3.7~)
  Depends: libp11-kit0 (>= 0.23.18.1)
  Depends: libtasn1-6 (>= 4.14)
  Depends: libunistring2 (>= 0.9.7)
libgmp10
  Depends: libc6 (>= 2.14)
libhogweed6
  Depends: libc6 (>= 2.14)
  Depends: libgmp10 (>= 2:6.2.1+dfsg)
  Depends: libnettle8
libnettle8
  Depends: libc6 (>= 2.17)
libidn2-0
  Depends: libc6 (>= 2.14)
  Depends: libunistring2 (>= 0.9.7)
libunistring2
  Depends: libc6 (>= 2.34)
libp11-kit0
  Depends: libc6 (>= 2.34)
  Depends: libffi8 (>= 3.4)
libffi8
  Depends: libc6 (>= 2.27)
libtasn1-6
  Depends: libc6 (>= 2.14)
libsasl2-2
  Depends: libc6 (>= 2.34)
  Depends: libsasl2-modules-db (>= 2.1.27+dfsg2-3ubuntu1.2)
libsasl2-modules-db
  Depends: libc6 (>= 2.14)
  Depends: libdb5.3
python3
  Depends: libpython3-stdlib (= 3.10.6-1~22.04.1)
  Depends: python3.10 (>= 3.10.6-1~)
  PreDepends: python3-minimal (= 3.10.6-1~22.04.1)
libpython3-stdlib
  Depends: libpython3.10-stdlib (>= 3.10.6-1~)
libpython3.10-stdlib
  Depends: libbz2-1.0
  Depends: libc6 (>= 2.34)
  Depends: libcrypt1 (>= 1:4.1.0)
  Depends: libdb5.3
  Depends: libffi8 (>= 3.4)
  Depends: liblzma5 (>= 5.1.1alpha+20120614)
  Depends: libmpdec3
  Depends: libncursesw6 (>= 6.1)
  Depends: libnsl2 (>= 1.0)
  Depends: libpython3.10-minimal (= 3.10.12-1~22.04.7)
  Depends: libreadline8 (>= 7.0~beta)
  Depends: libsqlite3-0 (>= 3.14.0)
  Depends: libtinfo6 (>= 6)
  Depends: libtirpc3 (>= 1.0.2)
  Depends: libuuid1 (>= 2.20.1)
  Depends: media-types
  Depends: mime-support
libmpdec3
  Depends: libc6 (>= 2.32)
  Depends: libgcc-s1 (>= 3.3.1)
  Depends: libstdc++6 (>= 5.2)
libstdc++6
  Depends: gcc-12-base (= 12.3.0-1ubuntu1~22.04)
  Depends: libc6 (>= 2.34)
  Depends: libgcc-s1 (>= 4.2)
libncursesw6
  Depends: libc6 (>= 2.34)
  Depends: libtinfo6 (= 6.3-2ubuntu0.1)
libtinfo6
  Depends: libc6 (>= 2.33)
libpython3.10-minimal
  Depends: libc6 (>= 2.14)
  Depends: libssl3 (>= 3.0.0~~alpha1)
libreadline8
  Depends: libc6 (>= 2.33)
  Depends: libtinfo6 (>= 6)
  Depends: readline-common
readline-common
  Depends: dpkg (>= 1.15.4)
  Depends: install-info
install-info
  Depends: libc6 (>= 2.34)
  PreDepends: dpkg (>= 1.16.1)
libsqlite3-0
  Depends: libc6 (>= 2.34)
libuuid1
  Depends: libc6 (>= 2.25)
media-types
mime-support
  Depends: mailcap
  Depends: media-types
mailcap
  Depends: media-types
  Depends: perl
perl
  Depends: libperl5.34 (= 5.34.0-3ubuntu1.3)
  Depends: perl-base (= 5.34.0-3ubuntu1.3)
  Depends: perl-modules-5.34 (>= 5.34.0-3ubuntu1.3)
  PreDepends: dpkg (>= 1.17.17)
libperl5.34
  Depends: libbz2-1.0
  Depends: libc6 (>= 2.35)
  Depends: libcrypt1 (>= 1:4.1.0)
  Depends: libdb5.3
  Depends: libgdbm-compat4 (>= 1.18-3)
  Depends: libgdbm6 (>= 1.18-3)
  Depends: perl-modules-5.34 (>= 5.34.0-3ubuntu1.3)
  Depends: zlib1g (>= 1:1.2.2.3)
libgdbm-compat4
  Depends: libc6 (>= 2.33)
  Depends: libgdbm6 (>= 1.16)
libgdbm6
  Depends: libc6 (>= 2.33)
perl-modules-5.34
  Depends: perl-base (>= 5.34.0-1)
  PreDepends: dpkg (>= 1.17.17)
python3.10
  Depends: libpython3.10-stdlib (= 3.10.12-1~22.04.7)
  Depends: media-types
  Depends: mime-support
  Depends: python3.10-minimal (= 3.10.12-1~22.04.7)
python3.10-minimal
  Depends: libexpat1 (>= 2.1~beta3)
  Depends: libpython3.10-minimal (= 3.10.12-1~22.04.7)
  Depends: zlib1g (>= 1:1.2.0)
  PreDepends: libc6 (>= 2.35)
libexpat1
  Depends: libc6 (>= 2.25)
python3-minimal
  Depends: dpkg (>= 1.13.20)
  PreDepends: python3.10-minimal (>= 3.10.6-1~)
python3-pkg-resources
  Depends: python3:any
rsync
  Depends: libacl1 (>= 2.2.23)
  Depends: libc6 (>= 2.34)
  Depends: liblz4-1 (>= 0.0~r130)
  Depends: libpopt0 (>= 1.14)
  Depends: libssl3 (>= 3.0.0~~alpha1)
  Depends: libxxhash0 (>= 0.8.0)
  Depends: libzstd1 (>= 1.4.0)
  Depends: lsb-base
  Depends: zlib1g (>= 1:1.1.4)
  PreDepends: init-system-helpers (>= 1.54~)
liblz4-1
  Depends: libc6 (>= 2.14)
libpopt0
  Depends: libc6 (>= 2.33)
libxxhash0
  Depends: libc6 (>= 2.14)
lsb-base
init-system-helpers
  Depends: perl-base (>= 5.20.1-3)

Thus I can deduce that it appears that there is an issue where python3-argcomplete doesn't get automatically installed as part of barman (in our environment w/ the EDB repo mirror) at least. The only thing I can think of is perhaps the output from apt show python3-barman where it lists python3:any?

Either way, if someone comes across this in future, hopefully the above will help them. If you have any other suggestions for further investigation please reach out.

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