AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1012522
Accepted
Figgis1965
Figgis1965
Asked: 2018-03-07 12:53:00 +0800 CST2018-03-07 12:53:00 +0800 CST 2018-03-07 12:53:00 +0800 CST

我似乎无法在 Ubuntu 16.04 LTS 上安装任何软件包

  • 772

我最初在安装服务器时安装了 LAMP 包。我花了很长时间才让 Web 服务器工作,然后我发现 PHP 没有作为包的一部分安装,这很奇怪,因为它应该是。我还尝试安装 SSH 服务器,以便可以使用 Putty 登录。每当我尝试安装任何东西时,我都会得到以下信息:-

jim@Unseen:~$ sudo apt-get -f install php libapache2-mod-php php-mcrypt php-mysq
l                                                                               
Reading package lists... Done                                                   
Building dependency tree                                                        
Reading state information... Done                                               
libapache2-mod-php is already the newest version (1:7.0+35ubuntu6.1).           
php-mysql is already the newest version (1:7.0+35ubuntu6.1).                    
The following additional packages will be installed:                            
  libmcrypt4 php7.0 php7.0-mcrypt                                               
Suggested packages:                                                             
  libmcrypt-dev mcrypt                                                          
The following NEW packages will be installed                                    
  libmcrypt4 php php-mcrypt php7.0 php7.0-mcrypt                                
0 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade.             
Need to get 0 B/83.5 kB of archives.                                            
After this operation, 326 kB of additional disk space will be used.             
Do you want to continue? [Y/n] y                                                
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there     
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true             

我试过apt-get clean。我试过标准的apt-get。我已经运行了 apt-get update。我尝试的任何方法似乎都不起作用。任何人都可以提出任何建议来帮助我。我是 ubuntu 的新手,对此感到非常沮丧。提前致谢

编辑:

尽管我的服务器是 16.04.4,但我尝试了在引用 14.0* 的类似帖子中建议的修复:-

sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};' >> /etc/apt/apt.conf.d/70debconf"

这不起作用,并报告 70debconf 不存在。


编辑 2

我按照建议更正了命令字符串:-

sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {\"/usr/sbin/dpkg-preconf
igure --apt || true\";};' >> /etc/apt/apt.conf.d/70debconf"

它返回了一个没有消息的提示,所以我认为它有效

然后我运行以下命令: -

sudo apt-get install openssh-server

并返回与以前完全相同:-

Reading package lists... Done                                                   
Building dependency tree                                                        
Reading state information... Done                                               
The following additional packages will be installed:                            
  ncurses-term openssh-sftp-server python3-requests python3-urllib3             
  ssh-import-id                                                                 
Suggested packages:                                                             
  ssh-askpass rssh molly-guard monkeysphere python3-ndg-httpsclient             
  python3-openssl python3-pyasn1                                                
The following NEW packages will be installed                                    
  ncurses-term openssh-server openssh-sftp-server python3-requests              
  python3-urllib3 ssh-import-id                                                 
0 to upgrade, 6 to newly install, 0 to remove and 0 not to upgrade.             
Need to get 0 B/746 kB of archives.                                             
After this operation, 5,652 kB of additional disk space will be used.           
Do you want to continue? [Y/n] y                                                
Preconfiguring packages ...                                                     
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there     
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true  

编辑 3

在一些极好的帮助后,我想到了一个想法。在这些问题开始之前,我安装了 Webmin 作为从桌面远程访问服务器的快捷方式。我尝试通过 webmin 安装 Openssh-server,令我惊讶的是它成功了。所以结论看起来 webmin 以某种方式干扰了服务器上的本机功能。我确信这不应该发生,我想知道我是否应该报告它。

apt
  • 1 1 个回答
  • 790 Views

1 个回答

  • Voted
  1. Best Answer
    Kevin Mooney
    2018-03-07T14:59:44+08:002018-03-07T14:59:44+08:00

    初始答案有问题,内部双引号需要转义

    sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {\"/usr/sbin/dpkg-preconfigure --apt || true\";};' >> /etc/apt/apt.conf.d/70debconf"
    

    我可以确认 /etc/apt/apt.conf.d/70debconf 在我的 Ubuntu 16.04 和 Ubuntu 17.10 机器上都存在。我的 Ubuntu 16.04 盒子上这个文件的内容是

    // Pre-configure all packages with debconf before they are installed.
    // If you don't like it, comment it out.
    DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
    
    • 0

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve