vim unable to write or quit

Asked by lee

History/Origin of issue:

This issue started a month ago, but in the terminal. It was enough time ago that I don't remember the issue, but it might have been my terminal window freezing. A restart fixed it only for a moment. This prompted me to upgrade, and when that didn't help, major upgrade to Xenial.

My present issue:

When I open the vim terminal, at times it will not let me write or quit. If I close the terminal and vim back into the document, changes are not saved.

If I type "top" in bash while this problem is occurring, gnome-s+ is the process using the most resources. 0.7 CPU.

Ubuntu release:
Ubuntu 20.04.3 LTS, Release 20.04

vim version:
  Installed: 2:8.1.2269-1ubuntu5
  Candidate: 2:8.1.2269-1ubuntu5
  Version table:
 *** 2:8.1.2269-1ubuntu5 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

Expected: vim to save and quit
Happened: vim showed that it was still in insert mode. Upon reopening the document, changes weren't saved.

Since I've considered that the problem could be gnome-s+ or bash, I've included version info. I didn't for gnome-s+ because of how long it was.

bash version v:
  Installed: 5.0-6ubuntu1.1
  Candidate: 5.0-6ubuntu1.1
  Version table:
 *** 5.0-6ubuntu1.1 500
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     5.0-6ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

If you open a normal terminal using CTRL + ALT + T then run:

vi /path/to/some/file

does it open OK and exit as you expect? or is this what you call the "vim terminal" ?

Revision history for this message
lee (leelemur) said (last edit ):
#2

That is what I call the vim terminal, if I use vim instead of vi. It opens normally. It will exit normally at times. It does seem the freeze issue is more of a problem the longer that the window is open. However, this is the matter of minutes, not hours.

Revision history for this message
Bernard Stafford (bernard010) said :
#3

While you were in vim you typed: wq
To save and quit on a new line.
My suggestion would be to file a bug report.
Please use apport in the terminal.
ubuntu-bug vim
Otherwise it may be considered incomplete.

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

"If I type "top" in bash while this problem is occurring, gnome-s+ is the process using the most resources. 0.7 CPU."

"gnome-s+" most probably stands for "gnome-shell" (cut off to fit the window). This usually is the process that uses most CPU and has nothing to do with vim.

"When I open the vim terminal, at times it will not let me write or quit."

1. In such case, can you quit without saving (q!)?
2. Do you have write access rights to the file(s) in question?
If you do not have write access to the file, then you definitely cannot save changes (nor in any other editor that I know). If you want to modify a system file where you do not have write access, you have to start vim with root privileges, e.g. "sudo vim filename"

Revision history for this message
lee (leelemur) said :
#5

To answer in order:

1. Quit without saving does not work. Any mode shifting or changing of the document does not work. I can still navigate by cursor, and type, so I wouldn't call it freeze either.
2. I have the same outcome if using root.

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

"Quit without saving does not work"

"does not work" in which sense?
Error message?
Program crash?
No effect at all?
...?

"Happened: vim showed that it was still in insert mode"
Maybe a broken escape key on the keyboard?

Revision history for this message
Bernard Stafford (bernard010) said (last edit ):
#7

Please answer last question.
"Happened: vim showed that it was still in insert mode"
'Maybe a broken escape key on the keyboard?'
Do you have another external keyboard?
You can also exit as q or wq (q =quit)
(qw=Quit & Save)
ESC Key= back to previous terminal screen.
You are presently on focal 20.04 LTS.
Could you open Terminal and paste output here:
cat /etc/os-release; uname -r
'"This issue started a month ago, but in the terminal. It was enough time ago that I don't remember the issue, but it might have been my terminal window freezing. A restart fixed it only for a moment."' : Quote]

Revision history for this message
lee (leelemur) said :
#8

I have not seen this issue since my last update, earlier this week. Sorry to not respond until now. I will add to this when/if I see this issue again.

Revision history for this message
lee (leelemur) said (last edit ):
#9

@Bernard:
 The esc key was not broken. It often worked for a few instances and it was over the course of vim running that I ran into problems.

I will try on an external keyboard if the issue pops up again.

wq, q!, or changing modes did not work. Again, like a freeze, except I could still type and move around with the cursor.

here is the output for cat /etc/os-release; uname -r:

~$: cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

~$ uname -r
5.4.0-84-generic

Keep in mind, the above is after the small update after which I did not see the issue. I update my computer at least every week. If there is a way to see what the last kernel I had was (if that was affected in my most recent update), I will be happy to know.

When I say terminal, I mean using Vim, opened from the terminal command line.

It has occurred to me to add something else. Sometimes I hit the touchpad on my laptop and this causes my cursor to jump around. Just in case this could be a possibility. So I can also test the issue by switching to a mouse. If that were the case, however, I would still be seeing the issue.

Hope any of this helps.

Revision history for this message
Bernard Stafford (bernard010) said :
#10

Ubuntu 20.04 is using the 5.4 series kernel, as you presently have.
The other kernel is: (hardware enablement) HWE stack updated to Linux release series 5.8.
changing kernels could cause other problems.
I suggest staying with 5.4 kernel.
I would still file a bug report.
Please use apport in the terminal.
ubuntu-bug vim

Can you help with this problem?

Provide an answer of your own, or ask lee for more information if necessary.

To post a message you must log in.