0

I edited a PostgreSQL config file:

vi /var/lib/pgsql/10/data/postgresql.conf

I didn't save it successfully then it created a .swp file.

Everytime I try to edit this file again, the terminal will stop without any aciton. I have to close the terminal.

I tried to stop the PostgreSQL process by root user:

sudo systemctl stop postgresql-10

Again, the terminal went to silent. Can't accept any input further more.

When I run:

sudo ls -la /var/lib/pgsql/10/data/

The same terminal stoped.

When I run:

sudo ls -la /var/lib/pgsql/10/

It works.

I don't know what happened in the data folder. I know the swp file exists there. But can't rm from that path now.

When I tried to edit the postgresql.conf file again, it shown:

E325: ATTENTION
Found a swap file by the name "~/10/data/.postgresql.conf.swp"
 owned by: postgres dated: Thu Feb 27 17:57:51 2020
 file name: ~postgres/10/data/postgresql.conf
 modified: YES
 user name: postgres host name: server
 process ID: 25896 (still running)
While opening file "/var/lib/pgsql/10/data/postgresql.conf"
 dated: Thu Feb 27 17:57:57 2020
 NEWER than swap file!
(1) Another program may be editing the same file. If this is the case,
 be careful not to end up with two different instances of the same
 file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
 If this is the case, use ":recover" or "vim -r /var/lib/pgsql/10/data/postgresql.conf"
 to recover the changes (see ":help recovery").
 If you did this already, delete the swap file "/var/lib/pgsql/10/data/.postgresql.conf.swp"
 to avoid this message.

I used this way killed that process number:

sudo kill -9 25896

Then can list the files under /var/lib/pgsql/10/data/ path.

But when tried to edit the postgresql.conf again, it stoped again!

I close the terminal and login to the server, did these things. They can't be deleted.

[user@server ~]$ ps aux | grep postgresql
postgres 12569 0.0 0.0 126476 1920 ? D 09:20 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 25896 0.0 0.0 126416 2156 ? D Feb27 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 26080 0.0 0.0 126320 1856 ? D Feb27 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 26542 0.0 0.0 126476 1916 ? D 13:35 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 26741 0.0 0.0 126472 1832 ? D 13:37 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
root 26924 0.0 0.0 241036 4552 ? S 13:39 0:00 sudo rm /var/lib/pgsql/10/data/postgresql.conf
root 26926 0.4 0.0 107984 640 ? D 13:39 0:00 rm /var/lib/pgsql/10/data/postgresql.conf
postgres 27027 0.0 0.0 126332 1828 ? D 13:40 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
user 27085 0.0 0.0 112684 1000 pts/14 S+ 13:40 0:00 grep --color=auto postgresql
[user@server ~]$ sudo kill -9 12569
[user@server ~]$ sudo kill -9 25896
[user@server ~]$ sudo kill -9 26080
[user@server ~]$ sudo kill -9 26542
[user@server ~]$ sudo kill -9 26741
[user@server ~]$ sudo kill -9 26924
[user@server ~]$ sudo kill -9 26926
[user@server ~]$ sudo kill -9 27027
[user@server ~]$ ps aux | grep postgresql
postgres 12569 0.0 0.0 126476 1920 ? D 09:20 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 25896 0.0 0.0 126416 2156 ? D Feb27 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 26080 0.0 0.0 126320 1856 ? D Feb27 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 26542 0.0 0.0 126476 1916 ? D 13:35 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
postgres 26741 0.0 0.0 126472 1832 ? D 13:37 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
root 26926 0.4 0.0 107984 640 ? D 13:39 0:00 rm /var/lib/pgsql/10/data/postgresql.conf
postgres 27027 0.0 0.0 126332 1828 ? D 13:40 0:00 vi /var/lib/pgsql/10/data/postgresql.conf
user 27155 0.0 0.0 112684 996 pts/14 S+ 13:41 0:00 grep --color=auto postgresql

What's the reason? How to fix it?

Erwin Brandstetter
186k28 gold badges463 silver badges636 bronze badges
asked Feb 28, 2020 at 1:03
5
  • sudo kill -9 postmaster_process_no? Commented Feb 28, 2020 at 4:01
  • @Vérace Yes, I tried. I added some detailed to the question. Commented Feb 28, 2020 at 4:50
  • This one has me puzzled root 26926 0.4 0.0 107984 640 ? D 13:39 0:00 rm /var/lib/pgsql/10/data/postgresql.conf - why is a file rm process enduring over several seconds - the time it took you to type all those kills? Have you tried the dreaded reboot? Can you? Is the server still responding to queries? Commented Feb 28, 2020 at 4:57
  • @Vérace I don't know the reason you asked. When I reboot system, tried to login again, can't login any more. ssh_exchange_identification: Connection closed by remote host . I created the instance by OpenStack, even from its console, can't login to the system:( Commented Feb 28, 2020 at 5:45
  • I don't know the reason you asked. Well, when a system goes wonky and even root can't kill things (zombies), normally a reboot is the way to go - unless a reboot is impossible. Is the OpenStack setup yours or is it remote? Restore from backup? Commented Feb 28, 2020 at 6:33

1 Answer 1

2

Your vi process is in “uninterruptable sleep” (state D), that's why you cannot kill it.

That is usually a sign that the I/O system has a problem, for example a hard NFS mount that has network problems.

There is nothing you can do except fix the underlying problem. You can reboot the machine, but if it is a hard, foreground NFS mount, booting will get stuck when the filesystems are mounted.

Using NFS with PostgreSQL is considered dangerous by many people because of weaknesses in Linux' NFS implementation.

answered Feb 28, 2020 at 7:16
1
  • Thank you very much. I reboot the system then it can't been accessed again. I just installed PostgreSQL on one VM which created by OpenStack. I think it isn't using NFS now. Commented Feb 28, 2020 at 7:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.