vim says "No protocol specified" and I have no idea what it means

2,979 views
Skip to first unread message

Kevin O'Gorman

unread,
May 2, 2012, 9:30:27 AM5/2/12
to vim...@googlegroups.com
I have a few files I use to script my backups. I've been tweaking
them as usual. Suddenly vim is acting very strange, and the files are
misbehaving.

The main symptoms are the message "No protocol specified" which
appears both on the editing session (with a different background) and
on the command-line.

For instance, this is cut-and-pasted directly from my terminal session:

root@treat:~/scripts# vim -i NONE -u NONE err
No protocol specified
No protocol specified
No protocol specified
root@treat:~/scripts#

The same phrase seems to appear randomly over the editing session. It
does not appear to be part of the text. I'd have to use a screen shot
to show it, which I'll do if need be. The -i and -u options are just
there for debugging.

I did not modify the file during the session, and its contents do not
appear to be the problem. Here's a dump:

root@treat:~/scripts# od -t x1c err
0000000 20 20 74 68 65 6e 0a 20 20 20 20 65 63 68 6f 20
t h e n \n e c h o
0000020 55 6e 69 64 69 65 6e 74 69 66 69 65 64 20 73 79
U n i d i e n t i f i e d s y
0000040 73 74 65 6d 2e 20 20 43 61 6e 6e 6f 74 20 63 6f
s t e m . C a n n o t c o
0000060 6e 74 69 6e 75 65 2e 0a 20 20 20 20 65 78 69 74
n t i n u e . \n e x i t
0000100 20 31 0a 20 20 65 6c 69 66 20 5b 20 21 20 2d 66
1 \n e l i f [ ! - f
0000120 20 2f 72 6f 6f 74 2f 73 63 72 69 70 74 73 2f 62
/ r o o t / s c r i p t s / b
0000140 6b 24 6d 65 2e 73 68 20 5d 0a
k $ m e . s h ] \n
0000152
root@treat:~/scripts#

I've been using vim for a *long* time and have never seen this. What
in the world happened to my vim?

--
Kevin O'Gorman, PhD

Tim Chase

unread,
May 2, 2012, 9:46:47 AM5/2/12
to vim...@googlegroups.com, Kevin O'Gorman
On 05/02/12 08:30, Kevin O'Gorman wrote:
> The main symptoms are the message "No protocol specified" which
> appears both on the editing session (with a different background) and
> on the command-line.
>
> For instance, this is cut-and-pasted directly from my terminal session:
>
> root@treat:~/scripts# vim -i NONE -u NONE err
> No protocol specified
> No protocol specified
> No protocol specified
> root@treat:~/scripts#

I believe this is Vim trying to talk to your X server and failing.
I suspect you're running X as non-root and then "su"'ed to root. A
couple options exist depending on the solution you want:

1) try starting Vim with "-X" to tell vim not to bother connecting
to the X server. It's fast, easy, and reliable, but loses the
ability for root to use the X clipboards

2) link the ~user/.Xauthority to ~root/.Xauthority with

ln -s ~user/.Xauthority ~root/.Xauthority

This will give Vim-as-root the ability to talk to the X session. It
has the small downside that, if you have multiple users logging into
the machine, and you sit down arbitrarily at one of them (rather
than always logging in as the same user), you'd have to relink the
file each time (easily done by using "-f" and changing the username
from "user" to "user2"). This is the solution I use on my Debian
boxes at home.

3) blithely ignore the warning secure in knowing that it's only
telling you that Vim-as-root can't talk to the X server.

> The same phrase seems to appear randomly over the editing session.

Subsequent messages (after startup) _might_ occur under situations I
can't readily confirm without reading the source or a good bit of
experimentation, but I'd suspect that efforts to read/write from the
clipboard registers ("+" and "*"), or perhaps losing and regaining
focus might be possible candidates. However, #1 or #2 above should
resolve the issue.

-tim




Tim Chase

unread,
May 2, 2012, 10:33:50 AM5/2/12
to Kevin O'Gorman, vim_use
On 05/02/12 09:03, Kevin O'Gorman wrote:
> This is cool, and I'll try your solution, but I've been working
> this way since Warty. Why is it happening now?

It's the sort of thing you might notice happening, but not the
context in which it was happening. I don't know whether issuing

bash$ su
bash# vim file.txt

behaves differently from

bash$ sudo vim file.txt

or if most of the time you edit as your user and the "I'm editing as
root" feels somewhat random without recognizing it for the
problem-context that it is.

AFAIK, it's happened in Vim-on-*nix as long as I've used it (back in
the late 5.x or early 6.x, about 12 years).

Alternatively, you might have switched from some non-GUI build of
Vim to a GUI build of Vim. The non-GUI version (or rather one built
with "-clipboard" instead of "+clipboard") doesn't display this
behavior, thinking that vim-is-vim-is-vim. Additionally, some
setups come with a minimal vim build by default ("vim-tiny" or
"vim-minimal" in most package managers) that would be built with
"-clipboard", and if you were used to using that and then
unwittingly upgraded to a more featureful version, the behavior
might surprise you.

>>> The same phrase seems to appear randomly over the editing session.
>>
>> Subsequent messages (after startup) _might_ occur under situations I
>> can't readily confirm without reading the source or a good bit of
>> experimentation, but I'd suspect that efforts to read/write from the
>> clipboard registers ("+" and "*"), or perhaps losing and regaining
>> focus might be possible candidates. However, #1 or #2 above should
>> resolve the issue.
>
> Does not sound quite right. In the above session, I entered "ZZ" as
> soon as vim started. So there were no editing or focus events beyond
> the bare minimum. I'm also not sure that I'm using the X clipboards,
> since this is vim, not gvim.

On startup (as my non-X user, omitting "-X" from the command-line),
doing nothing but quitting, I get the aforementioned message
repeated 3x. I don't recall ever getting it "randomly over the
editing session" as well. Those are where I suspect clipboard
registers or focus might be some sort of issue.

The same underlying build is usually used for both vim and gvim,
which detects its proper behavior based on the name by which you
invoke it. So the (non-g)vim will attempt to connect to the
clipboard unless (1) you use -X or (2) you use a build that was
compiled with "-clipboard".

> (I started with vi around 1984, still have my original vi manual from
> AT&T, and have found very little use for a mouse while editing -- I'm
> pretty sure I'm faster with my fingers in "home" position on the
> keyboard at all times.)

I too find little use for the mouse--especially as a laptop user
where the touchpad is less than helpful for most actions.

-Tim




Thilo Six

unread,
May 2, 2012, 1:48:21 PM5/2/12
to vim...@googlegroups.com



Excerpt from Tim Chase:
4)
,----[ ~/.bashrc ]--------

if [[ ${EUID} -eq 0 ]] ; then
[[ -n ${DISPLAY} ]] && unset DISPLAY
fi
`---------------------------------------------


,----[ man su ]--------

If --login is used, the $TERM, $COLORTERM, $DISPLAY,
and $XAUTHORITY environment variables are copied if
they were set.
`---------------------------------------------

>
>> The same phrase seems to appear randomly over the editing session.
>
> Subsequent messages (after startup) _might_ occur under situations I
> can't readily confirm without reading the source or a good bit of
> experimentation, but I'd suspect that efforts to read/write from the
> clipboard registers ("+" and "*"), or perhaps losing and regaining
> focus might be possible candidates. However, #1 or #2 above should
> resolve the issue.
>
> -tim
>
>
>
>

--
Regards,
Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


Thilo Six

unread,
May 2, 2012, 4:41:24 PM5/2/12
to vim...@googlegroups.com
Hello


Excerpt from Thilo Six:
-- <snip> --
i just realised i should add a little note. Sometimes<Esc>bdwiRepeatedly i send
emails with as little as that text with no surrounding information. Which might
let me come accross quite bold. Which indeed i am not me thinks.
I usually just find it boring to write comprehensive emails.

Erik Christiansen

unread,
May 3, 2012, 4:55:59 AM5/3/12
to vim...@googlegroups.com
On 02.05.12 19:48, Thilo Six did (boldly) proffer wisdom:
> 4)
> ,----[ ~/.bashrc ]--------
>
> if [[ ${EUID} -eq 0 ]] ; then
> [[ -n ${DISPLAY} ]] && unset DISPLAY
> fi
> `---------------------------------------------
>
>
> ,----[ man su ]--------
>
> If --login is used, the $TERM, $COLORTERM, $DISPLAY,
> and $XAUTHORITY environment variables are copied if
> they were set.
> `---------------------------------------------

That looks like a neat fix, Thilo.

But is there a weakness in the OP's access control config?
Here, on my ubuntu 10.04, unaltered and still as OOTB, starting X as
"erik", doing an "su -", then vimming anything which stands still, has
always worked, not least (I figure) because of:

$ xhost
access control enabled, only authorized clients can connect
SI:localuser:erik
SI:localuser:gdm
SI:localuser:root

So just doing an:

$ xhost +root

in ~/.bash_profile might just do it too?

Erik

--
I never pray before meals -- my mum's a good cook.

Thilo Six

unread,
May 3, 2012, 12:55:37 PM5/3/12
to vim...@googlegroups.com
Hello Erik,


Excerpt from Erik Christiansen:

-- <snip> --
> That looks like a neat fix, Thilo.
>
> But is there a weakness in the OP's access control config?
> Here, on my ubuntu 10.04, unaltered and still as OOTB, starting X as
> "erik", doing an "su -", then vimming anything which stands still, has
> always worked, not least (I figure) because of:
>
> $ xhost
> access control enabled, only authorized clients can connect
> SI:localuser:erik
> SI:localuser:gdm
> SI:localuser:root
>
> So just doing an:
>
> $ xhost +root
>
> in ~/.bash_profile might just do it too?
>
> Erik

I am not impolite but we are getting out of the focus of this list.
Please ask this question again on an appropriate list.

Kevin O'Gorman

unread,
May 4, 2012, 5:08:31 PM5/4/12
to vim...@googlegroups.com
On Thu, May 3, 2012 at 9:55 AM, Thilo Six <T....@gmx.de> wrote:
> Hello Erik,
>
>
> Excerpt from Erik Christiansen:
>
> -- <snip> --
>> That looks like a neat fix, Thilo.
>>
>> But is there a weakness in the OP's access control config?
>> Here, on my ubuntu 10.04, unaltered and still as OOTB, starting X as
>> "erik", doing an "su -", then vimming anything which stands still, has
>> always worked, not least (I figure) because of:
>>
>> $ xhost
>> access control enabled, only authorized clients can connect
>> SI:localuser:erik
>> SI:localuser:gdm
>> SI:localuser:root
>>
>> So just doing an:
>>
>> $ xhost +root
>>
>> in ~/.bash_profile might just do it too?
>>
>> Erik
>
> I am not impolite but we are getting out of the focus of this list.
> Please ask this question again on an appropriate list.

Huh? This was posted to vim_use, and it's about my difficulties using
vim. It's a permissions problem that seems not to affect anything
else, so we're talking about permissions and strategies and scriptlets
to fix my problem using vim.

I'll bite: where would it be more appropriate?

Tim Chase

unread,
May 4, 2012, 6:06:55 PM5/4/12
to vim...@googlegroups.com, Kevin O'Gorman
On 05/04/12 16:08, Kevin O'Gorman wrote:
> On Thu, May 3, 2012 at 9:55 AM, Thilo Six <T....@gmx.de> wrote:
>> I am not impolite but we are getting out of the focus of this list.
>> Please ask this question again on an appropriate list.
>
> Huh?

You have no complaints here...while the underlying cause was mostly
non-vim related (X permissions for accessing the clipboard as a
different user), it manifests itself in certain builds of vim and is
thus appropriate for discussion here. Even if it's only to learn
the main issue and research it elsewhere. Fortunately, this is a
generally friendly & knowledgeable mailing list, so hopefully you
received more than sufficient answer here.

-tim



Erik Christiansen

unread,
May 5, 2012, 1:45:10 AM5/5/12
to vim...@googlegroups.com
Hi Kevin,

Your difficulties, and the various ways to negate them informed me, and
I expect they gave you choice of ways out of strife.

Thilo seems to be sorely confused. My post included one passing
rhetorical question, as a lead-in to a proposal for another way to avoid
your problem, which Thilo himself attempted to solve. It was not asking
any real question, but offering vim-related help.

Perhaps Thilo can outline why he may try to help, but others may not.

Erik

--
Once it hits the fan, the only rational choice is to sweep it up,
package it, and sell it as fertilizer. - Anonymous?

Thilo Six

unread,
May 5, 2012, 8:11:07 AM5/5/12
to vim...@googlegroups.com
Hello Kevin,


Excerpt from Kevin O'Gorman:

-- <snip> --
> Huh? This was posted to vim_use, and it's about my difficulties using
> vim. It's a permissions problem that seems not to affect anything
> else, so we're talking about permissions and strategies and scriptlets
> to fix my problem using vim.

Which has been answered in several different ways. Choose the solution that fits
you best.

> I'll bite: where would it be more appropriate?

Sorry for creating confusion here. Asking here about error messages that appear
along the way when using vim is absolutely fine, even as Tim explained they are
caused by underlying mechanisms.

The 'we are getting out of the focus of this list' was meant toward a discussion
about different ways how to authenticate on a linux system.

personal EOT here.
Reply all
Reply to author
Forward
0 new messages