Ruby RVM apt-get 更新错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23650992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ruby RVM apt-get update error
提问by Kshitiz Sharma
I get following error when trying to install anything with RVM:
尝试使用 RVM 安装任何东西时出现以下错误:
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/ubuntu/13.04/x86_64/ruby-2.1.1.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..kshitiz password required for 'apt-get --quiet --yes update':
............................
Error running 'requirements_debian_update_system ruby-2.1.1',
showing last 15 lines of /home/kshitiz/.rvm/log/1400047196_ruby-2.1.1/update_system.log
++ /scripts/functions/logging : rvm_pretty_print() 78 > case "${TERM:-dumb}" in
++ /scripts/functions/logging : rvm_pretty_print() 81 > case "" in
++ /scripts/functions/logging : rvm_pretty_print() 83 > [[ -t 2 ]]
++ /scripts/functions/logging : rvm_pretty_print() 83 > return 1
++ /scripts/functions/logging : rvm_error() 117 > printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
\n'
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
++ /scripts/functions/requirements/ubuntu : requirements_debian_update_system() 53 > return 100
Requirements installation failed with status: 100.
How can I fix this?
我怎样才能解决这个问题?
回答by Kshitiz Sharma
RVMdoesn't behave well if apt-get updatehas errors. If your aptsourceshave an invalid repository that gives 404 or GPG error, RVMwill refuse to work. This can be confusing because it happens even if the faulty repository has nothing to do with rubyor RVM.
RVM如果apt-get update有错误,则表现不佳。如果你aptsources有一个无效的存储库,给出 404 或 GPG 错误,RVM将拒绝工作。这可能会令人困惑,因为即使错误的存储库与ruby或无关,也会发生这种情况RVM。
The following fix worked for me (Ubuntu):
以下修复对我有用(Ubuntu):
Run apt-get updateand see if there are any errors. Edit your sources.listand precise.listin /etc/aptto remove the faulty repositories. Repeat until apt-get updatesucceeds without any errors. Then try running RVM.
运行apt-get update看看有没有错误。编辑您sources.list并precise.list在/etc/apt删除错误信息库。重复直到apt-get update成功没有任何错误。然后尝试运行RVM。
回答by MajiK
I also had to remove failing repositories but I had hard time spotting them and removing them based on instructions here. So I found this linkwhich explains exactly why this happens and how to remove failing repositories:
我还必须删除失败的存储库,但我很难根据此处的说明发现它们并删除它们。所以我找到了这个链接,它解释了为什么会发生这种情况以及如何删除失败的存储库:
In short, run following to find failing repositories:
简而言之,运行以下命令来查找失败的存储库:
sudo apt-get update | grep "Failed"
An example output can be like this:
示例输出可以是这样的:
:~# apt-get update | grep "Failed"
W: Failed to fetch http://ppa.launchpad.net/upubuntu-com/web/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/upubuntu-com/web/ubuntu/dists/trusty/main/binary-i386/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
And finally use this command to remove the failing repo(s):
最后使用此命令删除失败的 repo(s):
sudo add-apt-repository --remove ppa:{failing ppa}
for the example here it will look like this:
对于此处的示例,它将如下所示:
sudo add-apt-repository --remove ppa:upubuntu-com/web
回答by Tim Yao
You can try to skip the rvm updating system so apt-get won't be called.
您可以尝试跳过 rvm 更新系统,这样 apt-get 就不会被调用。
# Disable RVM from trying to install necessary software via apt-get
rvm autolibs disable
# Then try installing Ruby:
rvm install 2.4.0
回答by aanno
Alternative, it is also possible to cut the crap in rvm. I edited requirements_debian_update_system() in file /usr/share/rvm/scripts/functions/requirements/ubuntu like this:
或者,也可以在 rvm 中减少废话。我在文件 /usr/share/rvm/scripts/functions/requirements/ubuntu 中编辑了 requirements_debian_update_system() ,如下所示:
requirements_debian_update_system()
{
echo "*fake* apt-get update"
# __rvm_try_sudo apt-get --quiet --yes update ||
# {
# typeset __ret=$?
# case ${__ret} in
# (100)
# rvm_error "There has been error while updating 'apt-get', please give it some time and try again later.
#404 errors should be fixed for rvm to proceed. Check your sources configured in:
# /etc/apt/sources.list
# /etc/apt/sources.list.d/*.list
#"
# ;;
# esac
# return ${__ret}
# }
}
回答by racl101
This happened to me as well when I was trying to install a version of Ruby as a non-sudoer user. However, when I logged in as my admin user (with sudo privileges) and ran sudo apt-get update | grep "Failed"I would get no errors and, yet, rvm install x.x.xwould still result in asking for a password (when I ran rvm installas the non-sudoer user.)
当我尝试以非 sudoer 用户身份安装 Ruby 版本时,这也发生在我身上。但是,当我以管理员用户身份(具有 sudo 权限)登录并运行时,sudo apt-get update | grep "Failed"我不会出错,但rvm install x.x.x仍然会导致要求输入密码(当我rvm install以非 sudoer 用户身份运行时)。
I was banging my head with this for a while because I didn't want my rvm (regular user) user to have sudo privileges. Then after some putzing around on Google I figured out that I could log in as my admin user.
我对此感到困惑了一段时间,因为我不希望我的 rvm(普通用户)用户拥有 sudo 权限。然后在谷歌上闲逛之后,我发现我可以以我的管理员用户身份登录。
Go through the steps of installing RVM for that user (as per their documentation):
完成为该用户安装 RVM 的步骤(根据他们的文档):
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ \curl -sSL https://get.rvm.io| bash -s stable
$ source ~/.rvm/scripts/rvm
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ \curl -sSL https://get.rvm.io| bash -s 稳定
$ source ~/.rvm/scripts/rvm
Then (as the admin user) jump straight into installing the RVM required packages:
然后(作为管理员用户)直接安装 RVM 所需的软件包:
$ rvm requirements
$ rvm requirements
at which point it asks for my sudo password and installs the required apt packages for the entire system after I enter my password.
此时它会询问我的 sudo 密码并在我输入密码后为整个系统安装所需的 apt 包。
Then I log off from server as admin user and log back in as rvm user (with no sudo privileges) and try to install a version of Ruby.
然后我以管理员用户身份从服务器注销并以 rvm 用户身份重新登录(没有 sudo 权限)并尝试安装一个 Ruby 版本。
$ rvm install x.x.x
$ rvm install x.x.x
and now it works.
现在它起作用了。
回答by karns
I had the same issue. If none of the other answers work try this. I ran the following command to fix it:
我遇到过同样的问题。如果其他答案都不起作用,请尝试此操作。我运行以下命令来修复它:
sudo apt-get -f install
sudo apt-get -f install
Then I remembered that I failed installing a package earlier that day. What this command did was resolve the dependencies on that package and allowed RVM to do its thing.
然后我想起那天早些时候我没有安装软件包。这个命令的作用是解决对该包的依赖,并允许 RVM 做它的事情。
回答by Alexis_user
You don't need of apt-get to install rvm and to use it !
您不需要 apt-get 来安装 rvm 并使用它!
Just curl (apt-get install curl)
只是卷曲(apt-get install curl)
Launch \curl -sSL https://get.rvm.io | bash -s stable --ruby
发射 \curl -sSL https://get.rvm.io | bash -s stable --ruby
and rvm install 2.1.1or another ruby's version and it works ;)
和rvm install 2.1.1或另一个 ruby 的版本,它可以工作;)
gem update etc...
宝石更新等...
RVM will be independent of apt-get so you'll have no longer issu.
RVM 将独立于 apt-get,因此您将不再有问题。
For more informations : https://rvm.io/rvm/install
欲了解更多信息: https://rvm.io/rvm/install
回答by Tobias Snoad
I was getting an error similar to this while running curl -sSL https://get.rvm.io | bash -s stable --ruby. It took a while but I finally realised that I had synaptic open: the installer couldn't run because apt was locked
我在运行时遇到与此类似的错误curl -sSL https://get.rvm.io | bash -s stable --ruby。花了一段时间,但我终于意识到我打开了突触:安装程序无法运行,因为 apt 被锁定
回答by Muni
I just tried
我刚试过
sudo apt-get update and found some of them are failing; for example..
sudo apt-get update 并发现其中一些失败;例如..
Err http://extras.ubuntu.comraring/main Sources 404 Not Found
错误http://extras.ubuntu.comraring/main Sources 404 Not Found
I went ahead and deleted those items from the list here..
我继续从这里的列表中删除了这些项目..
sudo gedit /etc/apt/sources.list
须藤 gedit /etc/apt/sources.list
It worked!
有效!
回答by masterchief
I was also getting this error when my working directory was inside a mounted dir.
当我的工作目录位于已安装目录中时,我也收到此错误。
The fix was just to:
修复只是为了:
cd ~
cd ~
I figured this out by seeing this at the bottom of a sudo apt-get update
我在 sudo apt-get update 的底部看到了这个
E: Unable to change to /path/to/my/current/directory/ - chdir (13: Permission denied)
E: Unable to change to /path/to/my/current/directory/ - chdir (13: Permission denied)

