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

由于内核问题,导致PG启动失败(error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb") #1061

Closed
4 of 6 tasks
ZDF64 opened this issue Mar 25, 2024 · 5 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ZDF64
Copy link

ZDF64 commented Mar 25, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已完整查看过项目 README,以及项目文档
  • 我使用了自己的 key,并确认我的 key 是可正常使用的
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

你的版本

  • 公有云版本
  • [x ] 私有部署版本

问题描述
按照docker-compose部署方法启动后,打印日志发现后台报错
pg | popen failure: Cannot allocate memory
pg | initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb"

这个问题导致ankane/pgvector:v0.5.0反复重启,无法正常运作
image

但同样,我在windows环境中部署则没有发生问题
FastGPT功能正常,log中也没有报错信息
复现步骤
环境:CentOS 7.9
image

预期结果

相关截图
image

@ZDF64 ZDF64 added the bug Something isn't working label Mar 25, 2024
@c121914yu
Copy link
Collaborator

内核太低了

@ZDF64
Copy link
Author

ZDF64 commented Mar 25, 2024

内核太低了

您的意思,就是系统版本太久了,是么

@ZDF64
Copy link
Author

ZDF64 commented Mar 25, 2024

折腾了一晚上,查阅到了相关一个资料
https://qiita.com/Y__Mori/items/51090da0fe13520ac14a
需要特殊的postgres版本,也就是postgres:15-bullseye
于是我下载了[email protected]:pgvector/pgvector.git
更改了Dockerfile
------------Dockerfile--------------

ARG PG_MAJOR=15-bullseye
FROM postgres:$PG_MAJOR
ARG PG_MAJOR
COPY . /tmp/pgvector
RUN apt-get update && \
apt-mark hold locales && \
apt-get install -y --no-install-recommends build-essential postgresql-server-dev-$PG_MAJOR && \
cd /tmp/pgvector && \
make clean && \
make OPTFLAGS="" && \
make install && \
mkdir /usr/share/doc/pgvector && \
cp LICENSE README.md /usr/share/doc/pgvector && \
rm -r /tmp/pgvector && \
apt-get remove -y build-essential postgresql-server-dev-$PG_MAJOR && \
apt-get autoremove -y && \
apt-mark unhold locales && \
rm -rf /var/lib/apt/lists/*
------------Dockerfile--------------
重新制作镜像放到本地库
image
image
然后在修改docker-compose.yml引入刚才做好的image
image
之后再启动就不报错了,FastGPT也能正常登陆了
image

@c121914yu
Copy link
Collaborator

折腾了一晚上,查阅到了相关一个资料
https://qiita.com/Y__Mori/items/51090da0fe13520ac14a
需要特殊的postgres版本,也就是postgres:15-bullseye
于是我下载了[email protected]:pgvector/pgvector.git
更改了Dockerfile
------------Dockerfile--------------

ARG PG_MAJOR=15-bullseye
FROM postgres:$PG_MAJOR
ARG PG_MAJOR
COPY . /tmp/pgvector
RUN apt-get update && \
apt-mark hold locales && \
apt-get install -y --no-install-recommends build-essential postgresql-server-dev-$PG_MAJOR && \
cd /tmp/pgvector && \
make clean && \
make OPTFLAGS="" && \
make install && \
mkdir /usr/share/doc/pgvector && \
cp LICENSE README.md /usr/share/doc/pgvector && \
rm -r /tmp/pgvector && \
apt-get remove -y build-essential postgresql-server-dev-$PG_MAJOR && \
apt-get autoremove -y && \
apt-mark unhold locales && \
rm -rf /var/lib/apt/lists/*
------------Dockerfile--------------
重新制作镜像放到本地库
image
image
然后在修改docker-compose.yml引入刚才做好的image
image
之后再启动就不报错了,FastGPT也能正常登陆了
image

大佬牛逼。
这个确实挺坑的,我之前 centos7 也初始化不了。
后面是找了个 unbuntu 运行后,直接把 data 目录拷贝回去,这样就不用初始化了。

@c121914yu c121914yu self-assigned this Mar 25, 2024
@c121914yu c121914yu added the good first issue Good for newcomers label Mar 25, 2024
@c121914yu c121914yu pinned this issue Mar 26, 2024
@c121914yu c121914yu changed the title docker-compose启动后,log显示:【pg | popen failure: Cannot allocate memory】 由于内核太低,导致PG启动失败(error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb") Mar 26, 2024
@c121914yu c121914yu changed the title 由于内核太低,导致PG启动失败(error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb") 由于内核问题,导致PG启动失败(error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb") Apr 26, 2024
@c121914yu
Copy link
Collaborator

引用之前 issue #784

据说增加 privileged=true 也可以解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants