Upgrading PostgreSQL from 11.x to 16.x with pg_upgrade: failed to load shared libraries

TL;DR: Is it safe to provide shared libraries from multiple environments in LD_LIBRARY_PATH to pg_upgrade? If not, can I somehow tell pg_upgrade the directory it should take its shared libraries from only for the old-bindir?

I’m trying to upgrade a PostgreSQL server from 11.x to 16.x using pg_upgrade. I’m doing this inside a bitnami/postgresql container. Hence some paths are bitnami-specific. But it should not affect the actual upgrade (correct me if I’m wrong here).

pg_upgrade needs both the old and new binaries available. So I temporarily copied the binaries from the old 11.x container to the new one to /tmp/pg_upgrade/postgresql-11/bin/ and ran the following command:

pg_upgrade --link 
 --old-bindir=/tmp/pg_upgrade/postgresql-11/bin 
 --old-datadir=/bitnami/postgresql/data 
 --old-options="--config-file=$POSTGRESQL_CONF_FILE" 
 --old-options="--hba_file=$POSTGRESQL_PGHBA_FILE" 
 --new-bindir=/opt/bitnami/postgresql/bin 
 --new-datadir=/bitnami/postgresql/data_new 
 --new-options="--config-file=$POSTGRESQL_CONF_FILE" 
 --new-options="--hba_file=$POSTGRESQL_PGHBA_FILE"

This fails with “/tmp/pg_upgrade/postgresql-11/bin/postgres: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory”

postgres@defectdojo-postgresql-0:/bitnami/postgresql$ pg_upgrade --link 
 --old-bindir=/tmp/pg_upgrade/postgresql-11/bin 
 --old-datadir=/bitnami/postgresql/data 
 --old-options="--config-file=$POSTGRESQL_CONF_FILE" 
 --old-options="--hba_file=$POSTGRESQL_PGHBA_FILE" 
 --new-bindir=/opt/bitnami/postgresql/bin 
 --new-datadir=/bitnami/postgresql/data_new 
 --new-options="--config-file=$POSTGRESQL_CONF_FILE" 
 --new-options="--hba_file=$POSTGRESQL_PGHBA_FILE"
/tmp/postgresql-11/bin/postgres: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
no data was returned by command ""/tmp/postgresql-11/bin/postgres" -V"

check for "/tmp/pg_upgrade/postgresql-11/bin/postgres" failed: cannot execute
Failure, exiting
postgres@defectdojo-postgresql-0:/bitnami/postgresql$

Following this guide I also copied the shared libraries (/usr/lib/x86_64-linux-gnu) from the old 11.x image to the new 16.x container and configured them in the LD_LIBRARY_PATH variable, only to have a similar issue now with the new binaries

postgres@defectdojo-postgresql-0:/bitnami/postgresql$ LD_LIBRARY_PATH="/tmp/pg_upgrade/libs" pg_upgrade --link 
 --old-bindir=/tmp/pg_upgrade/postgresql-11/bin 
 --old-datadir=/bitnami/postgresql/data 
 --old-options="--config-file=$POSTGRESQL_CONF_FILE" 
 --old-options="--hba_file=$POSTGRESQL_PGHBA_FILE" 
 --new-bindir=/opt/bitnami/postgresql/bin 
 --new-datadir=/bitnami/postgresql/data_new 
 --new-options="--config-file=$POSTGRESQL_CONF_FILE" 
 --new-options="--hba_file=$POSTGRESQL_PGHBA_FILE"
/opt/bitnami/postgresql/bin/postgres: /tmp/pg_upgrade/libs/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libicuuc.so.72)
no data was returned by command ""/opt/bitnami/postgresql/bin/postgres" -V"

check for "/opt/bitnami/postgresql/bin/postgres" failed: cannot execute
Failure, exiting
postgres@defectdojo-postgresql-0:/bitnami/postgresql$

I got it working by adding both the old and the new shared library paths to the LD_LIBRARY_PATH variable

LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/tmp/pg_upgrade/libs" pg_upgrade --link 
  ...

But is this safe? If not, can I somehow tell pg_upgrade to use a specific shared libs directory only for the binaries from old-bindir?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật