
我剛安裝tree
透過
sudo apt-get install tree
我的終端突然決定更新grub
。上週我安裝了tree
,也發生了類似的事情。然而,當我那天晚上晚些時候重新啟動電腦時,它啟動到一個顯示窗口
Grub _
並沒有改變。
最終我重新安裝了我的作業系統(我使用的是 WattOS,上週二剛剛將其安裝在一台新電腦上,所以這並不是世界末日 - 只需 5 個小時即可重新設定所有內容)。
Grub 安裝時出現了一些錯誤,我依稀記得上次看到這些錯誤(包含在我的帖子的底部,以便於閱讀)。
我用谷歌搜尋了一下:
- 為什麼tree要更新grub?
- 為什麼 grub 升級/更新?
但我沒有任何運氣。我懷疑我可能遺漏了一些東西。
誰能解釋一下:
- 為什麼會發生這種情況
- 這是否意味著有什麼問題
- 如果我應該/可以做任何事情來解決它。
我不想重新安裝所有東西(出於顯而易見的原因!)
謝謝。
安裝時遇到的錯誤tree
:
sudo apt-get install tree
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
gimp-data libamd2 libbabl-0.1-0 libcamd2 libccolamd2 libcholmod3 libgegl-0.4-0 libgegl-common libgexiv2-2 libgimp2.0 libhpmud0 libimagequant0
libmetis5 libqt5designer5 libqt5help5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libsane-hpaio libumfpack5 printer-driver-hpcups
printer-driver-postscript-hp python3-dbus.mainloop.pyqt5 python3-notify2 python3- olefile python3-pexpect python3-pil python3-ptyprocess
python3-pyqt5 python3-pyqt5.sip python3-renderpm python3-reportlab python3-reportlab- accel vlc-plugin-samba xsane xsane-common
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
tree
0 upgraded, 1 newly installed, 0 to remove and 174 not upgraded.
1 not fully installed or removed.
Need to get 49.6 kB of archives.
After this operation, 118 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 tree amd64 1.8.0-1+b1 [49.6 kB]
Fetched 49.6 kB in 0s (110 kB/s)
Selecting previously unselected package tree.
(Reading database ... 123032 files and directories currently installed.)
Preparing to unpack .../tree_1.8.0-1+b1_amd64.deb ...
Unpacking tree (1.8.0-1+b1) ...
Setting up grub-pc (2.06-3~deb11u6) ...
Installing for i386-pc platform.
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
Installation finished. No error reported.
Generating grub configuration file ...
Found background: /usr/share/wattOS/splash.png
Found background image: /usr/share/wattOS/splash.png
Found linux image: /boot/vmlinuz-5.10.0-19-amd64
Found initrd image: /boot/initrd.img-5.10.0-19-amd64
Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. Found Debian GNU/Linux 11 (bullseye) on /dev/mmcblk0p2 done Setting up tree (1.8.0-1+b1) ...
Processing triggers for man-db (2.9.4-2) ...
更新
我不小心重開機了,我的電腦又當機了。然後我重新安裝了 WattOS 作為我硬碟上唯一的作業系統,一切正常。我剛剛看到@eyoung100的回答,我就跑了
sudo apt upgrade
運行沒有錯誤。
然後我跑了
sudo apt autoremove
進行到一半時,我看到了與上次相同的畫面:
The grub-pc package is being upgraded. This menu allows you to select which devices you'd like grub-install to be automatically run for, if any.
Running grub-install automatically is recommended in most situations, to prevent the installed GRUB core image from getting out of sync with
GRUB modules or grub.cfg.
If you're unsure which drive is designated as boot drive by your BIOS, it is often a good idea to install GRUB to all of them.
Note: it is possible to install GRUB to partition boot records as well, and some appropriate partitions are offered here. However, this forces GRUB to use the blocklist mechanism, which makes it less reliable, and therefore is not recommended.
我沒有選擇“確定”,因為上次給了我錯誤。
當我然後在另一個終端嘗試時
sudo apt upgrade
它的回應是
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 39623 (apt)
這並不奇怪。
我嘗試使用 ctrl-c 和 ctrl-x 關閉該 shell,但都沒有幫助。我可以關上窗戶,但我很擔心。
要求提供更多信息
- 的結果
sudo dmidecode -s bios-version
是
8GET38WW (1.15 )
- 的結果
sudo dmidecode -t 0 | grep UEFI
沒什麼。 (我想這意味著它不受支援)。
- 的結果
cpuid | less
是
bash: cpuid: command not found
我只能說這是一台聯想Thinkpad L520,是翻新的,而且我沒有換CPU。 (不知道前任主人怎麼樣)。
- 的結果
sudo parted --list
是
Model: ATA ADATA SU630 (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 231GB 231GB primary ext4 boot
2 231GB 240GB 9449MB primary linux-swap(v1)
我看不到任何關於fstype
或 的資訊gpt
。
正如我所說,我嘗試將其安裝到已擦除的磁碟上。
感謝您的時間!
答案1
縮小錯誤範圍
在我們擔心之前,我看到很多事情需要注意grub
- (至少)26 個包需要刪除。
- 174 個軟體包需要升級。
- 正如 oldfred 的評論所暗示的那樣,Grub 需要進行一些調查和可能的修復。
我們需要取消小步驟(1 和 2),以避免可能需要修復grub
兩次。我喜歡做這些類型的答案,原因有二:
- 我可以幫助 Linux 新用戶了解在 Linux 中重新啟動與在 Windows 中重新啟動有很大不同。
- 作為一個新的 Linux 用戶,我希望 OP 能夠傳授他的知識,就像我在這裡所做的那樣。
小事優先
僅通過查看輸出片段,我就知道套件管理器是 APT,是先進的封裝工具。如果你需要的話,可以試試看mam apt
。
apt update && apt autoremove
- 應刪除上面的 26 合 1。apt upgrade
- 應下載並安裝 2 中提到的 174 個軟體包(可能包括grub
)。這可能需要一段時間,具體取決於您的網路連線。
筆記:升級可能會因OP在其問題中貼上的相同錯誤而中止。我希望如此,但我們希望 174 個軟體包集能夠升級盡可能多的內容。如果升級中止,請繼續 大象 然後重複步驟2
現在房間裡的大象
奧德弗雷德,雖然他老了,但他是對的:
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
在我們能夠可靠地確定安裝類型之前,grub
我們需要滿足一些條件(排名不分先後):
- 您的 BIOS/UEFI 版本:
sudo dmidecode -s bios-version
- UEFI 是否已開啟/支援:
sudo dmidecode -t 0 | grep UEFI
- 您的CPU:
cpuid | less
- 您的分區清單和表格類型:
sudo parted --list
為了grub-efi-amd64
工作,您必須具有 FAT32 的 ESP/EFI 分割區類型和 64 位元 CPU。項目符號 3 可透過 google 搜尋等,如下所示:家族 X 型號 Y CPU 是否為 64 位,其中 X 和 Y 是家族和型號行中的整數。項目符號 4 必須包含 EFI 分割區的輸出fstype: fat32
和表格類型gpt
。第 2 項必須包含“支持”
從前面引用的錯誤來看,我假設您嘗試將 grub 引導程式碼嵌入到根分割區中,安裝程式將其格式化為ext2
.如果OP使用整個磁碟進行安裝,則grub
需要使用整個磁碟重新安裝。無論 EFI 與否,此選項都有效。如果存在EFI分割區,grub
只需在其中重新安裝即可。請將上述 4 個項目符號的輸出加入您的問題中,我將使用適當的命令更新此答案。
更新
根據 OP 提供的更新dmidecode
,parted
我可以有把握地說這grub-pc
是正確的 grub 架構。由於OP選擇只安裝瓦特作業系統在機器上,我們可以安全地嵌入grub
整個硬碟的引導磁區:
sudo grub-install /dev/sda && sudo update-grub
sudo reboot
重新啟動後,繼續:apt update && apt-upgrade
如果grub
需要再次升級,只需在每次升級時發出上述命令(在大約 15 年的各種 Linux 發行版中,我認為我升級了grub
不到10 次。這不是一個很常見的升級包在我看來)。
筆記:透過在命令中省略分割區號grub-install
,我們已經告訴 grub 可以嵌入整個磁碟。
如果update-grub
失敗(按順序發出這些):
sudo grub-install /dev/sda
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo reboot