简体   繁体   English

中断长时间的 MacPorts 安装

[英]Interrupting a long MacPorts installation

I'm currently installingqt4-mac and it's taking forever to build.我目前正在安装qt4-mac并且需要很长时间才能构建。 I've searched around and I've discovered that it's going to take anywhere from 2-5 hours to install.我四处搜索,发现安装需要 2-5 个小时。

Is there a way to interrupt this installation process and if so do I need to do some clean-up afterwards?有没有办法中断这个安装过程,如果是这样,我之后需要做一些清理吗?

Have you tried using control+c ?您是否尝试过使用control+c

Also, I'm not entirely sure about cleanup, but according to the MacPorts docs , the command sudo port -fp uninstall --follow-dependents [your port name here] should help (this page is about uninstalling MacPorts itself, but it's the same command).另外,我不完全确定清理,但根据MacPorts 文档,命令sudo port -fp uninstall --follow-dependents [your port name here]应该有帮助(这个页面是关于卸载 MacPorts 本身,但它是相同的命令)。 I'm not sure how MacPorts treats interrupted installations and if it treats "half-installed" items as uninstallable, but it's worth a try.我不确定 MacPorts 如何处理中断的安装,以及它是否将“半安装”的项目视为可卸载的,但值得一试。

This is an old thread, but I'd like to share my personal opinion on this.这是一个旧线程,但我想分享我对此的个人看法。

Once upon a time (two years ago I guess, not sure about the current state of affairs) I interrupted a MacPorts update ( sudo port upgrade outdated ) with not Ctrl+C (roughly SIGINT ), but rather SIGKILL , since I was running into some trouble with the hardware at that time.曾几何时(我猜是两年前,不确定当前的事态)我中断了 MacPorts 更新( sudo port upgrade outdated )而不是Ctrl+C (大致是SIGINT ),而是SIGKILL ,因为我SIGKILL了当时硬件有些问题。 I ended up with a completely broken install that defied all efforts of clean-up or recovery, and I ended up restoring a full backup of /opt/local .我最终得到了一个完全损坏的安装,它无视所有清理或恢复的努力,我最终恢复了/opt/local的完整备份。

I never dare to interrupt MacPorts install/upgrade since then, even with Ctrl+C 's.从那时起,即使使用Ctrl+C ,我也不敢中断 MacPorts 的安装/升级。

The moral of the story is: interrupting MacPorts installation process could be potentially pretty dangerous.这个故事的寓意是:中断 MacPorts 安装过程可能非常危险。 Leave it alone if it is simply running for a long time (sometimes building does take forever).如果它只是运行了很长时间,不要管它(有时构建确实需要永远)。 If you do believe it is hanging rather than actually building, make sure you have a backup, and proceed with caution (of course, it's too late to back up when you are already running the install).如果您确实认为它是挂起而不是实际构建,请确保您有备份,并谨慎操作(当然,当您已经在运行安装时备份为时已晚)。

I also would like to chime in. I think a good practice is to watch where you are in the installation before Ctrl+C ing, then clean the dependency you were on and redo the main install later.我也想插一句。我认为一个好的做法是在Ctrl+C之前观察您在安装中的位置,然后清除您所依赖的依赖项,然后重做主安装。 For example, I was installing kdenlive and killed it in the middle of the virtuoso (one of many dependencies) install.例如,我正在安装 kdenlive 并在安装 virtuoso(许多依赖项之一)的过程中将其杀死。 Later, I did a sudo port -v selfupdate , then a port clean virtuoso , then started the kdenlive install again with sudo port install kdenlive .后来,我做了一个sudo port -v selfupdate ,然后是一个port clean virtuoso ,然后用sudo port install kdenlive再次启动了 kdenlive 安装。 This seems to be a decent way to go;这似乎是一个不错的方法; it cruised through the first part and picked up at normal speed when it got to virtuoso.它在第一部分巡航并在达到演奏家时以正常速度回升。

Don't press Ctrl+C不要按 Ctrl+C

Building on the answer by 4ae1e1, while (s)he interrupted the process sending a SIGKILL signal, I interrupted it sending an actual SIGINT signal, ie the usual Ctrl+C , and now no MacPorts app are working so far.基于 4ae1e1 的答案,虽然他中断了发送SIGKILL信号的过程,但我中断了它发送了一个实际的SIGINT信号,即通常的Ctrl+C ,现在到目前为止没有 MacPorts 应用程序在工作。

So I completely agree with 4ae1e1.所以我完全同意4ae1e1。

If you need your machine如果您需要您的机器

If you need to suspend the installation, eg because you need your CPU to be available for other things, to send a SIGSTOP signal instead, in order to pause the installation.如果您需要暂停安装,例如因为您需要您的 CPU 可用于其他事情,请改为发送SIGSTOP信号,以便暂停安装。

kill -STOP installationPIDs

Once you are ready to resume it, you can send a SIGCONT signal and you can complete it.一旦你准备好恢复它,你可以发送一个SIGCONT信号,你就可以完成它。

kill -CONT installationPIDs

You should easily find the PIDs of the installation process, for example you can just run htop and look among the processes using most of the CPU.您应该很容易找到安装过程的 PID,例如,您可以运行htop并查看使用大部分 CPU 的进程。

If you change your mind about an installation如果您改变了安装的想法

Even if you change your mind and you do not want that port/package installed anymore, I strongly recommend to just complete the installation (pausing it when needed as suggested below) and just uninstall the port/package afterwards.即使您改变主意并且不想再安装该端口/包,我也强烈建议您完成安装(如下建议的需要时暂停),然后卸载该端口/包。 It sounds like a waste of time, but it is the safest thing to do.这听起来像是浪费时间,但这是最安全的做法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM