我使用VMware在Windows 7中安装了ubuntu。我想在ubuntu中执行c程序。
当我尝试的时候,我得到了这样的结果,
b@ubuntu:~/examples$ vim a.c
The program 'vim' can be found in the following packages:
* vim
* vim-gnome
* vim-tiny
* vim-gtk
* vim-nox
Try: sudo apt-get install <selected-package>
b@ubuntu:~/examples$ sudo apt-get install vim
[sudo] password for b:
Reading package lists... Done
Building Dependency tree
Reading state information... Done
Package vim is not available, but is referred to by another Package.
This may mean that the package is missing, has been obseleted, or
is only available from another source
E: Package 'vim' has no installation candidate
I tried apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13:Permission denied)
E:unable to lock the administration directory (/var/lib/dpkg/), are you root?
当我尝试执行su
此操作时,它要求我输入密码。当我输入 root 密码时,它不接受它并显示“身份验证失败”
我无法安装 Vim 包。有什么方法可以安装它吗?请给我建议。如何恢复我的 root 密码。
答案1
当我尝试在 ubuntu 12.04 上安装 vim 时也出现了同样的问题。
我尝试了以下操作,它对我有用:-
sudo apt-get update
之后
sudo apt-get install vim
运行这些命令后,它开始正常工作。
答案2
当系统提示您输入密码时sudo command
,您必须输入你的密码非 root密码。从命令提示符来看,用户名似乎是b
,因此b
应该提供密码。当然,这只有在b
允许用户sudo
(例如成为admin
ubuntu 中的组成员)的情况下才有效。