You are not logged in.
Pages: 1
I'm trying to set up postgresql as instructed <a>here</a>.
After performing
[postgres@BitBox ~]$ initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgres/data -l logfile startsuccessfully, I returned to the my regular user using exit command.
[postgres@BitBox ~]$ exit
logoutThen, while trying to start postgresql.service, I got the following error:
[code_master5@BitBox ~]$ sudo systemctl start postgresql.service
Failed to start postgresql.service: Unit postgresql.service not found.I'm not even getting the status of the service:
[code_master5@BitBox ~]$ sudo systemctl status postgresql.service
Unit postgresql.service could not be found.Please help me out. I'm stuck!
Offline
[code_master5@BitBox UrlShortenerApi]$ pacman -Ql postgresql | grep systemd
postgresql /usr/lib/systemd/
postgresql /usr/lib/systemd/system/
postgresql /usr/lib/systemd/system/postgresql.serviceOffline
Hmm, that is odd. Perhaps it is masked, or otherwise modified/null.
What is the output of these commands?
find /etc/systemd/system /run/systemd/system -name 'postgresql.service'
ls -ld /usr/lib/systemd/system/postgresql.service
cat /usr/lib/systemd/system/postgresql.serviceOffline
Sorry for late replies. Due to bad weather I'm facing connection problems.
[code_master5@BitBox ~]$ find /etc/systemd/system /run/systemd/system -name 'postgresql.service'
/etc/systemd/system/multi-user.target.wants/postgresql.service[code_master5@BitBox ~]$ ls -ld /usr/lib/systemd/system/postgresql.service
-rw-r--r-- 1 root root 834 Nov 8 00:20 /usr/lib/systemd/system/postgresql.service[code_master5@BitBox ~]$ cat /usr/lib/systemd/system/postgresql.service
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
TimeoutSec=120
User=postgres
Group=postgres
Environment=PGROOT=/var/lib/postgres
SyslogIdentifier=postgres
PIDFile=/var/lib/postgres/data/postmaster.pid
RuntimeDirectory=postgresql
RuntimeDirectoryMode=755
ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
# killing Postgres, so adjust it downward
OOMScoreAdjust=-200
# Additional security-related features
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
NoNewPrivileges=true
[Install]
WantedBy=multi-user.targetLast edited by code_master5 (2017-01-26 15:38:33)
Offline
Removing the use of sudo what is the output of
$ systemctl status postgresql.serviceIf that fails what is the output of
$ type systemctlOffline
[code_master5@BitBox ~]$ systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor pre
Active: active (running) since Thu 2017-01-26 18:11:05 IST; 3h 29min ago
Process: 337 ExecStart=/usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 (cod
Process: 328 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=
Main PID: 340 (postgres)
Tasks: 6 (limit: 4915)
CGroup: /system.slice/postgresql.service
├─340 /usr/bin/postgres -D /var/lib/postgres/data
├─344 postgres: checkpointer process
├─345 postgres: writer process
├─346 postgres: wal writer process
├─347 postgres: autovacuum launcher process
└─348 postgres: stats collector process
Warning: Journal has been rotated since unit was started. Log output is incomplete[code_master5@BitBox ~]$ type systemctl
systemctl is hashed (/usr/bin/systemctl)Last edited by code_master5 (2017-01-26 16:20:34)
Offline
Hey! I figured it out! Thank you very much @ayekat @loqs and ARCH forum.
I simply deleted the postgresql-9.6.service file and restarted the system.
I guess it replaced it with postgresql.service file. Somehow it worked.
Hey can anyone please explain me why it worked? and what is the meaning of output:
[code_master5@BitBox ~]$ type systemctl
systemctl is hashed (/usr/bin/systemctl)Thanks again...
Offline
I simply deleted the postgresql-9.6.service file and restarted the system.
postgresql-9.6.service has not been mentioned before.
what is the meaning of output:
[code_master5@BitBox ~]$ type systemctl systemctl is hashed (/usr/bin/systemctl)
Means systemctl has been recorded by the hash command. The man pages for type and hash have more details, might also see the man page for the shell you use as type is provided as a shell builtin.
Offline
Thanks @loqs for reply.
I'm really sorry because I really didn't know that any postgresql-9.6.service file existed and I simply do not know how it came there! I simply took hint from your and other replies and digged into systemd folder. Then I just tried to start postgresql-9.6.service, which again failed. So, I just took a sort of risk here by deleting it as I didn't know what's gonna happen. Then I simply restarted system. Quite amazingly it worked!
Offline
Pages: 1