vagrant Ubuntu server 12.04 dpkg: dependency problems prevent configuration of python-gi

Ubuntu server 12.04因为尝试安装过xfce,导致sudo apt-get install xxx 都会返回,如:

 vagrant@precise32:~$ sudo apt-get install phpunit
Reading package lists... Done
Building dependency tree
Reading state information... Done
phpunit is already the newest version.
The following packages were automatically installed and are no longer required:
libclass-isa-perl libswitch-perl
Use 'apt-get autoremove' to remove them.
upgraded, newly installed, to remove and not upgraded.
not fully installed or removed.
After this operation, B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: dependency problems prevent configuration of python-gi:
python-gi depends on python:any (>= 2.7.-0ubuntu2). dpkg: error processing package python-gi (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
python-gi
E: Sub-process /usr/bin/dpkg returned an error code ()

的错误信息,而且安装不到xxx软件,参考 Error 'Depends: python:any. Unmet dependencies' after installing python 2.7.5 之后,运行了

sudo apt-get install --reinstall python

解决了这个问题。

原来我已经安装了ant,phpunit的最新版本,总以为是没安装到,我才觉得我必须更新系统版本才能用,才出现了Ubuntu server 12.04升级到Ubuntu server 14.04.4 之后,出现vagnrat up之后,不能自动登录tty和virtualbox没有共享windows目录的问题,最终还是解决了,YES!

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

目前还是安装不到任何软件,我运行

 sudo apt-get dist-upgrade

进行更新。

vagrant Ubuntu server 12.04 dpkg: dependency problems prevent configuration of python-gi,运行之后,既然升级到14.04了。

在重启vagrant之后,因为重写了/etc/sudoers,启动时,会显示

vagrant Ubuntu server 12.04 dpkg: dependency problems prevent configuration of python-gi

因为看到最后的一句,我觉得是vagrant用户没有自动登录tty

在参考

  1. ubuntu的sudo操作出现下面提示,怎么办?

  2. vagrant up : The following SSH command responded with a non-zero exit status. #1659

  3. Ubuntu新添加用户无法sudo问题的解决:修改sudoers

  4. Linux/Ubuntu sudo不用输入密码的方法
  5. Win7在命令提示符(cmd.exe)中如何进行复制、粘贴工作

我修改了 /etc/sudoers

vagrant@precise32:~$ sudo su -
[sudo] password for vagrant:
root@precise32:~# chmod a+w /etc/sudoers
root@precise32:~# vi /etc/sudoers
root@precise32:~# chmod a-w /etc/sudoers
root@precise32:~# sudo shutdown -h now

我将/etc/sudoers中的root下添加了vagrant ,将%admin ALL=(ALL) ALL,%sudo ALL=(ALL) ALL

root    ALL=(ALL:ALL) ALL
vagrant ALL=(ALL) NOPASSWD: ALL
Defaults:vagrant !requiretty
# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD: NOPASSWD: ALL # Allow members of group sudo to execute any command
%sudo ALL=(ALL) NOPASSWD: NOPASSWD: ALL

重新vagrant up显示

 Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was: mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant |
vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant The error output from the last command was: stdin: is not a tty
/sbin/mount.vboxsf: mounting failed with the error: No such device

参考了:

Vagrant can't mount shared folder in VirtualBox 4.3.10 #3341

vagrant Ubuntu server 12.04 dpkg: dependency problems prevent configuration of python-gi

进行更新Ubuntu 14.04的linux-headers,linux-headers更新参考了:UBUNTU内核升级后,kernel headers问题的解决

 sudo apt-get install
cd /usr/src
apt-cache search linux-headers-$(uname -r)
sudo apt-get install linux-headers-$(uname -r)

然后关闭ubuntu 14.04, sudo shutdown -h now

在运行vagrant up,就可以看到virtualbox 更新Virtualbox的增强组件了,欧耶!!

vagrant Ubuntu server 12.04 dpkg: dependency problems prevent configuration of python-gi

参考链接:

  1. dpkg-reconfigure 重置Ubuntu包依赖

上一篇:Java常用调试技巧(转)


下一篇:C++复制控制:拷贝构造函数