升级时突然出现问题

升级时突然出现问题

我正在运行 XUbuntu 14.04,今天我sudo apt-get upgrade在我的系统上发布了输出

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up sagemath-upstream-binary (6.7ppa7) ...
Running Sage once as root to set paths
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.7, Release Date: 2015-05-17                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
File "/usr/lib/sagemath/src/bin/sage-ipython", line 7, in <module>
from sage.repl.interpreter import SageTerminalApp
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/__init__.py", line 3, in <module>
from sage.repl.ipython_extension import load_ipython_extension
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/repl/ipython_extension.py", line 59, in <module>
from IPython.core.magic import Magics, magics_class, line_magic
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/__init__.py", line 45, in <module>
from .config.loader import Config
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/__init__.py", line 6, in <module>
from .application import *
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/application.py", line 9, in <module>
import json
File "/usr/lib/sagemath/local/lib/python/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/usr/lib/sagemath/local/lib/python/json/decoder.py", line 5, in <module>
import struct
File "/usr/lib/sagemath/local/lib/python/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing package sagemath-upstream-binary (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
sagemath-upstream-binary
E: Sub-process /usr/bin/dpkg returned an error code (1)

看起来确实有问题sage,确实发出了sage回报

┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.7, Release Date: 2015-05-17                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
File "/usr/lib/sagemath/src/bin/sage-ipython", line 7, in <module>
from sage.repl.interpreter import SageTerminalApp
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/__init__.py", line 3, in <module>
from sage.repl.ipython_extension import load_ipython_extension
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/repl/ipython_extension.py", line 59, in <module>
from IPython.core.magic import Magics, magics_class, line_magic
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/__init__.py", line 45, in <module>
from .config.loader import Config
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/__init__.py", line 6, in <module>
from .application import *
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/application.py", line 9, in <module>
import json
File "/usr/lib/sagemath/local/lib/python/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/usr/lib/sagemath/local/lib/python/json/decoder.py", line 5, in <module>
import struct
File "/usr/lib/sagemath/local/lib/python/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct

有人知道我的系统出了什么问题吗?如果有,我该如何修复它?

答案1

看起来上传到镜像的版本有问题。他们正在尝试修复它。临时修复方法是使用以下命令恢复到以前的版本

sudo apt-get install sagemath-upstream-binary=6.6ppa1
sudo apt-mark hold sagemath-upstream-binary 

有关更多信息,请访问此链接。您还可以关注那里的讨论,因为他们会在修复完成后发布修复信息。

答案2

嗯,看来单个应用程序由于缺少依赖项和/或包损坏而导致此问题。这种情况可能时有发生。

作为一种可能的修复方法,您可以尝试复制并执行下面的脚本,看看它是否能解决问题。由于脚本不会像运行单个命令那样将控制权交还给命令行界面,因此包管理器应该在执行脚本时构建并修复依赖项,而不会损坏包。

#! /bin/bash

sudo apt-get update

sudo apt-get -f install -y

sudo updatedb

sudo apt-get -f upgrade -y

sudo apt-get -f install -y 

sudo updatedb

exit

将脚本复制到 gedit 并保存。然后从命令行将访问模式更改为可执行,并使用 sudo 命令执行脚本:

:~$ chmod +x scriptname.sh

:~$ sudo ./scriptname.sh

如果这不能解决问题,请清除 Sage,它将删除应用程序的所有依赖项。然后重新安装 Sage。

:~$ sudo apt-get purge sage

:~$ sudo apt-get autoremove -y

:~$ sudo apt-get install sage

注意:我没有在 apt-get 清除序列中放置 -y 标志,因为 sage 可能会链接到 ubuntu-desktop 包,而这会占用您的整个桌面环境。为避免这种情况,系统将提示您 (是/否) 选项。如果您看到 *XUbuntu-desktop 是要删除的包之一,请输入 no 作为选项。

如果此操作不成功,请重新发布,Ubuntu Universe 将帮助您找到另一种解决方法!

祝你好运,Ubuntu 前进!

相关内容