
所以前段時間,我用 Windows 10 和 Linux Mint 18:Sarah 雙重啟動了我的電腦。當我使用 Windows 重新啟動功能時,Windows 10hiberfil.sys
預設建立了一個檔案(用於保存系統快照或其他什麼?)。由此產生的問題是,它使我的電腦無法識別管理我的系統分割區的 grub,並立即啟動到 Windows。
我透過使用“啟動修復”解決了這個問題,所以現在我可以訪問兩個系統分區。但後來就壞了apt-get
,所以現在我無法安裝任何軟體sudo apt-get install ___
或執行sudo apt-get upgrade
損壞的是我的 grub,或者好吧,系統需要另一個名為 grub2-common 的 grub 版本,但它卻安裝了 2.02~beta2-36ubuntu3.1 版本的 grub。
現在我將向您展示運行幾個命令時的輸出:
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
grub-pc : Depends: grub2-common (= 2.02~beta2-36ubuntu3.2) but 2.02~beta2-36ubuntu3.1 is installed
grub2-common : Depends: grub-common (= 2.02~beta2-36ubuntu3.1) but 2.02~beta2-36ubuntu3.2 is installed
E: Unmet dependencies. Try using -f.
所以我會嘗試推薦的指令:
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
grub2-common
The following packages will be upgraded:
grub2-common
1 upgraded, 0 newly installed, 0 to remove and 244 not upgraded.
3 not fully installed or removed.
Need to get 0 B/511 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] yes
(Reading database ... 288732 files and directories currently installed.)
Preparing to unpack .../grub2-common_2.02~beta2-36ubuntu3.2_amd64.deb ...
Unpacking grub2-common (2.02~beta2-36ubuntu3.2) over (2.02~beta2-36ubuntu3.1) ...
dpkg: error processing archive /var/cache/apt/archives/grub2-common_2.02~beta2-36ubuntu3.2_amd64.deb (--unpack):
trying to overwrite '/usr/sbin/grub-install', which is also in package lupin-support 0.57
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/grub2-common_2.02~beta2-36ubuntu3.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
當我嘗試安裝軟體時怎麼樣?我正在嘗試安裝防毒軟體。
sudo apt-get install clamav
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
clamav : Depends: clamav-freshclam (>= 0.99.2+dfsg) but it is not going to be installed or
clamav-data
Depends: libclamav7 (>= 0.99~rc1) but it is not going to be installed
grub-pc : Depends: grub2-common (= 2.02~beta2-36ubuntu3.2) but 2.02~beta2-36ubuntu3.1 is to be installed
grub2-common : Depends: grub-common (= 2.02~beta2-36ubuntu3.1) but 2.02~beta2-36ubuntu3.2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
同樣,grub 也有同樣的問題。
最後,我想再發表一則評論:我無法用來sudo apt-get
安裝任何東西......其中包括更新 grub 儲存庫!
也許,你想知道資質的狀態是什麼?
sudo aptitude install clamav
The following NEW packages will be installed:
clamav clamav-base{a} clamav-freshclam{a} libclamav7{a} libllvm3.6v5{ab}
The following partially installed packages will be configured:
grub-pc{b} python-pyaudio python-simplejson
0 packages upgraded, 5 newly installed, 0 to remove and 245 not upgraded.
Need to get 9,109 kB of archives. After unpacking 36.8 MB will be used.
The following packages have unmet dependencies:
grub2-common : Depends: grub-common (= 2.02~beta2-36ubuntu3.1) but 2.02~beta2-36ubuntu3.2 is installed.
grub-pc : Depends: grub2-common (= 2.02~beta2-36ubuntu3.2) but 2.02~beta2-36ubuntu3.1 is installed and it is kept back.
libllvm3.6v5 : Conflicts: libllvm3.6 but 1:3.6-2ubuntu1~trusty1 is installed.
Conflicts: libllvm3.6:i386 but 1:3.6-2ubuntu1~trusty1 is installed.
The following actions will resolve these dependencies:
Remove the following packages:
1) grub-gfxpayload-lists
2) grub-pc
3) grub2-common
4) libllvm3.6
5) libllvm3.6:i386
Accept this solution? [Y/n/q/?] Y
The following NEW packages will be installed:
clamav clamav-base{a} clamav-freshclam{a} libclamav7{a} libllvm3.6v5{a}
The following packages will be REMOVED:
grub-gfxpayload-lists{a} grub-pc{a} grub2-common{a} libllvm3.6{a} libllvm3.6:i386{a}
The following partially installed packages will be configured:
python-pyaudio python-simplejson
0 packages upgraded, 5 newly installed, 5 to remove and 244 not upgraded.
Need to get 9,109 kB of archives. After unpacking 29.9 MB will be freed.
Do you want to continue? [Y/n/?] Y
[ ERR] Writing extended state information
E: Failed to execute process to save dpkg selections, dpkg or trying to execute it exited with status/errno: 2
E: failed to save selections to dpkg database
資質似乎更進一步了。但選擇兩次yes後,仍然無法安裝我的軟體。
我該如何收拾亂局?
答案1
也出現了這個錯誤:
E: Failed to execute process to save dpkg selections, dpkg or
trying to execute it exited with status/errno: 2
好吧,這是necroposting,但我透過以下方式解決了它:
- 建立當前 apt 狀態的備份(也保留它)。
- 將備份副本複製到目前副本。
- apt-get 更新
- 刪除上面建立的備份。
命令列表:
root@host# cd /var/lib/dpkg
root@host# cp status status.backup
root@host# cp status-old status-old.backup
root@host# cp status-old status
root@host# apt-get update
root@host# apt-get upgrade
root@host# rm status.backup
root@host# rm status-old.backup
為什麼 apt 資料庫被破壞超出了我的知識範圍,有些字元似乎被破壞了(即“c”變成了“@”等)。我猜想一些壞的 RAM 模組可能會導致這種情況,但它們都測試正常。
答案2
我也遇到錯誤:
E: Failed to execute process to save dpkg selections, dpkg or
trying to execute it exited with status/errno: 2
就我而言,問題在於/var/lib/dpkg/available
缺少了。修復是針對touch
遺失的檔案。重建可用文件是可能的,但不是必需的。
答案3
首先,在 Linux Mint 終端機中,取得 grub-common 的 .deb;
wget http://archive.ubuntu.com/ubuntu/pool/main/g/grub2/grub-common_2.02-2ubuntu8_amd64.deb
然後解壓縮文件,
sudo dpkg -i grub-common_2.02-2ubuntu8_amd64.deb
grub-common 需要:gettext-base、libc6、libdevmapper1.02.1、libfreetype6、libfuse2、liblzma5、lsb-base
他們的 .deb 檔。
取得文字庫:http://archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext-base_0.19.8.1-6_amd64.deb
libc6:http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6_2.27-3ubuntu1_amd64.deb
libdevmapper1.02.1:http://archive.ubuntu.com/ubuntu/pool/main/l/lvm2/libdevmapper1.02.1_1.02.145-4.1ubuntu3_amd64.deb
libfreetype6:http://archive.ubuntu.com/ubuntu/pool/main/f/freetype/libfreetype6_2.8.1-2ubuntu2_amd64.deb
libfuse2: http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/libfuse2_2.9.7-1ubuntu1_amd64.deb
liblzma5:http://archive.ubuntu.com/ubuntu/pool/main/x/xz-utils/liblzma5_5.2.2-1.3_amd64.deb
LSB 基:http://archive.ubuntu.com/ubuntu/pool/main/l/lsb/lsb-base_9.20170808ubuntu1_all.deb
它們都有依賴關係,有些可能是預先安裝的,有些可能需要安裝。
如果您有任何錯誤,請告訴我,以便我提供解決方案。
答案4
我不確定這是否是一個虛擬邏輯或其他什麼。但是,我嘗試了這個,它對我來說很順利:
sudo apt upgrade grub-common grub2-common