# ArgumentError: каталог для pid=/.../unicorn.pid не доступен для записи

**URL:** <https://meta.discourse.org/t/argumenterror-directory-for-pid-unicorn-pid-not-writable/274948>\
**Category:** Self-hosting\
**Created:** [13.Август.2023 13:53:52 UTC](https://meta.discourse.org/t/argumenterror-directory-for-pid-unicorn-pid-not-writable/274948 "2023-08-13T13:53:52Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Godmar\_Back](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/godmar_back/32/206246_2.png) [@Godmar\_Back](https://meta.discourse.org/u/Godmar_Back)\
**Post date:** [21.Август.2023 19:31:53 UTC](https://meta.discourse.org/t/argumenterror-directory-for-pid-unicorn-pid-not-writable/274948/14 "2023-08-21T19:31:53Z")

</div>

Вот дополнительная информация. В stderr gunicorn я вижу:

```plaintext
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.7/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client': connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (ActiveRecord::ConnectionNotEstablished)
	Is the server running locally and accepting connections on that socket?

```

В логе PG я вижу:

```plaintext
2023-08-21 19:24:00.721 UTC [1681] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-08-21 19:24:00.728 UTC [1681] LOG: could not open configuration file "/etc/postgresql/13/main/pg_hba.conf": Permission denied
2023-08-21 19:24:00.728 UTC [1681] FATAL: could not load pg_hba.conf
2023-08-21 19:24:00.741 UTC [1681] LOG: database system is shut down

```

Далее:

```plaintext
# ls -l /etc/postgresql/13/main/pg_hba.conf
-rw-r----- 1 root root 4846 Aug 21 19:05 /etc/postgresql/13/main/pg_hba.conf

```

Под каким пользователем работает postgres внутри контейнера? С учётом вышеуказанных прав доступа, это должен быть `root` или кто-то из группы `root`.

Хорошо, я выполнил `chmod o+r /etc/postgresql/13/main/pg_hba.conf`, и теперь контейнер снова запущен.

Это немного беспокоит — почему рекомендуемый метод установки не работает из коробки? Мой статус плагинов сейчас включает те, что перечислены выше, за исключением [Data Explorer](https://meta.discourse.org/t/32566?silent=true), который я отключил, так как он вызывал сбой в прошлый раз.

Перекрёстная ссылка на

> [@Filesystem permission issues after upgrade to 3.1.0](https://meta.discourse.org/t/filesystem-permission-issues-after-upgrade-to-3-1-0/274654):
>
> I upgraded from 3.0.x to 3.1.0 today. Updaring via the web UI failed, so I did git pull ./launcher rebuild app which finished fine, but all I got was an “invalid gateway” error when visiting the site. I tracked this down to filesystem permission errors: /var/www/discourse/tmp/pids was not writable, fixing that lead to /etc/postgresql/13/main/pg\_hba.conf not being readable. Having fixed those made the site work, but user avatars were missing. Again a temporary directoyr was missing, so I ma…

где сообщается о подобных симптомах.

Обновление: Я изменил команду `git` в секции `cmd` файла app.yml, чтобы использовать `sudo`, как описано в связанном посте.

Я считаю этот сбой прерывистым. Из трёх попыток (после каждой я полностью очищал директорию `shared`) один раз удалось, а два раза — нет. При сбое ручное исправление трёх проблемных прав доступа и последующая перезапуск контейнера приводили к тому, что система, судя по всему, работала нормально. Было бы неплохо иметь улучшенное логирование и более эффективные автоматические тесты для обнаружения сбоев при запуске контейнера.

---

_[View the full topic](https://meta.discourse.org/t/argumenterror-directory-for-pid-unicorn-pid-not-writable/274948)._
