VIM basic usage help for CoreOS

1,375 views
Skip to first unread message

Lantos István

unread,
Feb 8, 2015, 8:41:15 AM2/8/15
to coreo...@googlegroups.com
I'm installed CoreOS under Vagrant. I want to create the hello.service example file under VIM, but I really confused of the usage of VIM. I know I navigate with h, j, k, l. I can jump between words with w, e, b. I can escape from VIM with :q!. In theory, I'm entering in Insert Mode with letter I and escaping back to Normal Mode with ESC.

However, when I'm in Insert Mode, where I can actually edit the text with letter i, deleting characters with BACKSPACE causing "beeping error" and with w, e, b, its only showing the first word of the whole text. It's just really confusing.

How I start a new line? Hitting ENTER or SHIFT+ENTER making a margin between lines if it was a paragraph.

When I start VIM, I've got the following error message also:

core@core-01 ~ $ vim hello.service
E437: terminal capability "cm" required
Press ENTER or type command to continue

Can You write me a step by step guide from opening a new VIM text file, to creating few lines in and save it.

Thank You!

Seán C. McCord

unread,
Feb 8, 2015, 2:11:27 PM2/8/15
to coreo...@googlegroups.com
This should get you started:
http://vim.wikia.com/wiki/Tutorial

However, keep in mind that you have fleet available on CoreOS, with which you can submit units easily from your own machine, edited with whatever editor you prefer, using the `fleetctl` CLI tool.  Failing that, you can always `scp` a home-edited file to the CoreOS box.

Seán C. McCord

unread,
Feb 8, 2015, 2:14:14 PM2/8/15
to coreo...@googlegroups.com
...and somehow I missed the actual error you've got.

try running this instead:
TERM=xterm vim hello.service

Essentially, you are using a terminal which doesn't have a proper termcap entry on the CoreOS box.
If that works, then run the following to add it to your login script:

echo "export TERM=xterm" >> /home/core/.bashrc

Logout, log back in, and you should be fine.

Lantos István

unread,
Feb 8, 2015, 3:06:21 PM2/8/15
to coreo...@googlegroups.com
Thank You for your help!

So If I understand, with the "fleetctl submit" command, I can insert into Coreos my .service files from my personal computer? Can you give me a basic scenerio how to do this? I need to upload it to my webserver and give the url?

Seán C. McCord

unread,
Feb 8, 2015, 3:46:20 PM2/8/15
to coreo...@googlegroups.com
Correct on the former; fleetctl uses ssh to transfer the file internally, so you do not need a webserver.  `fleetctl submit` takes an argument which is the (local) unit file (with path) you wish to load.  Then, you can `fleetctl start` that unit to have fleet start it in the cluster.

This page summarizes it well, I think:

Lantos István

unread,
Feb 8, 2015, 4:08:49 PM2/8/15
to coreo...@googlegroups.com
Thank You! This command works!

When I try to add to the login script I've got this:

core@core-01 ~ $ echo "export TERM=xterm" >> /home/core/.bashrc
-bash: /home/core/.bashrc: Read-only file system

Seán C. McCord

unread,
Feb 8, 2015, 4:15:34 PM2/8/15
to coreo...@googlegroups.com
I'm not sure why you would be mounted read-only.  I haven't used the Vagrant variant, but I doubt that would be intentional.  What is the output of the `mount` command?

Lantos István

unread,
Feb 8, 2015, 4:18:34 PM2/8/15
to coreo...@googlegroups.com
core@core-01 ~ $ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=498692k,nr_inodes=124673,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
/dev/sda9 on / type ext4 (rw,relatime,data=ordered)
/dev/sda3 on /usr type ext4 (ro,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
/dev/sda6 on /usr/share/oem type ext4 (rw,nodev,relatime,commit=600,data=ordered)

Seán C. McCord

unread,
Feb 8, 2015, 4:23:20 PM2/8/15
to coreo...@googlegroups.com
Never mind; I never noticed that .bashrc is a symbolic link to the default skeleton.  You could kill your .bashrc file and rewrite it, sourcing the /usr/share/skel/.bashrc, but it's probably best to fix your TERM at the source (your host/local machine).

If you are using the regular ssh CLI:

Most GUI ssh clients allow you to set the TERM (PuTTY, if I recall correctly).  If it's the Vagrant console, then I'll bet that's a bug.

Lantos István

unread,
Feb 8, 2015, 4:31:48 PM2/8/15
to coreo...@googlegroups.com
Sorry I wasn't specific: I use Git Bash embedded into ConEmu.

Seán C. McCord

unread,
Feb 8, 2015, 4:33:26 PM2/8/15
to coreo...@googlegroups.com
For reference, I added a PR to address this in a better way:

Lantos István

unread,
Feb 8, 2015, 4:33:43 PM2/8/15
to coreo...@googlegroups.com
And this is the structure of my home folder:

core@core-01 ~ $ ls -al
total 32
drwxr-xr-x 3 core core  4096 Feb  8 21:10 .
drwxr-xr-x 3 root root  4096 Feb  5 02:49 ..
-rw------- 1 core core   399 Feb  8 20:23 .bash_history
lrwxrwxrwx 1 core core    33 Feb  5 02:49 .bash_logout -> ../../usr/share/skel/.bash_logout
lrwxrwxrwx 1 core core    34 Feb  5 02:49 .bash_profile -> ../../usr/share/skel/.bash_profile
lrwxrwxrwx 1 core core    28 Feb  5 02:49 .bashrc -> ../../usr/share/skel/.bashrc
drwx------ 3 core core  4096 Feb  8 20:57 .ssh
-rw------- 1 core core 12288 Feb  8 11:04 .swp
-rw-r--r-- 1 core core   350 Feb  8 21:03 hello.service

Seán C. McCord

unread,
Feb 8, 2015, 4:37:00 PM2/8/15
to coreo...@googlegroups.com
Sorry, I've never heard of (or, more importantly, used) ConEMU.  A cursory glance at their docs doesn't suggest to me the ability to set the TERM environment variable, but that is what you want to look for, if possible.

Failing that, you can just write a script or an alias to always set the TERM environment variable before issuing the ssh command.

Lantos István

unread,
Feb 8, 2015, 4:43:16 PM2/8/15
to coreo...@googlegroups.com
I tried in the original Git Bash window and I've got the same message.

I think ConEmu not modifying anything on the emulated Git Bash terminal, just embedding. I use ConEmu because of the massive customization options on the typography, Mac Terminal like styling of the window and the ability to scroll with mousewheel and copy/paste with keyboard, plus copy out text by mouse click and drag. As opening a Git Bash window in it, I still able to do the mentoined things above plus I have SSH logging into CoreOS.

Lantos István

unread,
Feb 8, 2015, 4:47:43 PM2/8/15
to coreo...@googlegroups.com

Seán C. McCord

unread,
Feb 8, 2015, 5:21:21 PM2/8/15
to coreo...@googlegroups.com
Another option:  since your problem is with vim, you can override the TERM in your vim session, too.  On the CoreOS host, create the file /home/core/.vimrc with the following line:

set term=xterm

Seán C. McCord

unread,
Feb 8, 2015, 5:25:19 PM2/8/15
to coreo...@googlegroups.com

Lantos István

unread,
Feb 14, 2015, 2:59:39 PM2/14/15
to coreo...@googlegroups.com
Sorry for the late answer, I just not have enough free time for work on this.

I created .vimrc with this command as you said:
export TERM=xterm

But I got this error when I try to use VIM:

E437: terminal capability "cm" required
Error detected while processing /home/core/.vimrc:
-- More --
line    1:
-- More --
E492: Not an editor command: export TERM=xterm

Seán C. McCord

unread,
Feb 14, 2015, 3:01:37 PM2/14/15
to coreo...@googlegroups.com
You juxtaposed the entries.  In your .vimrc, put the line:

set term=xterm


Lantos István

unread,
Feb 14, 2015, 3:04:00 PM2/14/15
to coreo...@googlegroups.com
I changed it and it's the same message.

Lantos István

unread,
Feb 14, 2015, 3:05:14 PM2/14/15
to coreo...@googlegroups.com
Nope, it's solved. :) Doesn't it capitalized.

Lantos István

unread,
Feb 14, 2015, 3:06:49 PM2/14/15
to coreo...@googlegroups.com
*Doesn't like it capitalized.

Thank you for your help! Now I can use VIM properly without typing a lot.
Reply all
Reply to author
Forward
0 new messages