スワップ/ブートパーティション

スワップ/ブートパーティション

約6ヶ月前、私は新しいノートパソコンとKubuntuをインストールしました。私は今、別の/bootを選択し(デフォルトを受け入れました)、次のKubuntuバージョンにアップグレードしている間/ bootにスペースが足りません(クリーンで小さすぎます)

ブート=sda5ルート=sda7

だから私は別の/bootを捨て、ルートパーティションのディレクトリとして/bootを使うことにしました。だから:

  1. /newboot 生成 (ルートファイルシステムで)
  2. cp -a /boot/* /newboot (& rmdir /newboot/lost+found)
  3. 削除/開始
  4. mv /boot /oldboot, mv /newboot /boot
  5. /etc/fstab 編集 (以前 /dev/sd5 を /oldboot としてマウント)
  6. systemctlデーモンの再ロード
  7. アップデート-initramfs -u

次に、/boot/grub/grub.cfg を /oldboot/grub/grub.cfg と比較します。

同じです…まあ、設定がたくさんあると思います。「提案」grubは実際にファイルを探します。問題は、sda5(msdos5)とsda7(msdos7)に「良い」grub.cfgがあり、そのうちの1つを見つけることができることです。だから、grub.cfgでmsdos5へのすべての参照をmsdos7に対して手動で編集し、update-initramfs -uを再実行して再起動しましたが、すべて大丈夫でした...

しかし、疑わしい... "/boot"を使用しますか、それともまだ "/oldboot"を使用しますか? generic と vmlinuz -6.2).0-35-generic 名を NOT-vmlinuz-6.2.0-36-generic に変更して再起動しました。 ...失敗しました。 「35」のバージョンを選んだのは大丈夫でした...だからまだ/oldbootを読んでいます。

それでは、私が逃したステップは何ですか?。 UUIDを手動で編集する必要がありますか?失敗しやすいようです...単純な「grub.cfgの再生成」ステップがありません... grubを再インストールしますか?

ベストアンサー1

さて、なぜ誰も飛び出さず、速い答えをしなかったのか理解しています。はるかに複雑です。

だからこの些細なことは

grub-mkconfig -o /boot/grub/grub.cfg

しかし、それは全体の物語から遠いです。まず、より多くの情報が必要です。

  1. (レガシー) BIOS を使用したシステム起動
  2. ノートブックには従来の「スリープ」インストールがあり、初期ブートローダ+ BCDを使用します。

したがって、上記のすべての手順を最初に実行する必要があります。それでは上にあります。grub-mkconfig、これは次のように変更されます。

root@ThinkPad:/boot/grub# diff grub.cfg.5nov23 grub.cfg
173c173
<   set root='hd0,msdos5'
---
>   set root='hd0,msdos7'
175c175
<     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  7094b250-3ccf-436e-af52-6c0d828cc15c
---
>     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7  e8128f48-1ef6-44e6-b95c-1595c6ddf05c
177c177
<     search --no-floppy --fs-uuid --set=root 7094b250-3ccf-436e-af52-6c0d828cc15c
---
>     search --no-floppy --fs-uuid --set=root e8128f48-1ef6-44e6-b95c-1595c6ddf05c
179,180c179,180
<   linux   /vmlinuz-6.2.0-36-generic root=UUID=e8128f48-1ef6-44e6-b95c-1595c6ddf05c ro  quiet splash $vt_handoff
<   initrd  /initrd.img-6.2.0-36-generic
---
>   linux   /boot/vmlinuz-6.2.0-36-generic root=UUID=e8128f48-1ef6-44e6-b95c-1595c6ddf05c ro  quiet splash $vt_handoff
>   initrd  /boot/initrd.img-6.2.0-36-generic
191c191
...

デフォルトでは、SDA5をSDA7に変更し、パスを/ grubから/ boot / grubおよびUUIDに変更します。

しかし、(私の場合は)必要な最後のステップは次のとおりです。グラップインストール /dev/sda7

その理由は少し複雑です。 2つのケースを取り上げます。最初のものは私のもので、2番目のものは初期ブートローダーがgrub(スリープパーティションの有無にかかわらず)の場合より一般的です。

私の場合は次のようになります。

root@ThinkPad:/boot/grub# grub-mkconfig -o /boot/grub/grub.cfg
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.2.0-36-generic
Found initrd image: /boot/initrd.img-6.2.0-36-generic
Found linux image: /boot/vmlinuz-6.2.0-35-generic
Found initrd image: /boot/initrd.img-6.2.0-35-generic
Found memtest86+x64 image: /boot/memtest86+x64.bin
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 Windows 10 on /dev/sda1
done

root@ThinkPad:/boot/grub# grub-install /dev/sda7
Installing for i386-pc platform.
grub-install: warning: Filesystem `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-install: error: will not proceed with blocklists.


root@ThinkPad:/boot/grub# grub-install --force /dev/sda7
Installing for i386-pc platform.
grub-install: warning: Filesystem `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.

私の場合、ノートブックはDozeブートローダを使用して起動した後、BCD(Boot Utility)を使用してブートパーティションを選択できます。 )

したがって、これは grub ブートローダが /dev/sda7 にある必要があり、警告に含めることができないことを意味します (core.img のコピーはディスクブート間隔の初期に保存されます)、信頼できない方法を使用する必要があります (ため息!)前と同じですね。

他の多くのユーザーの場合は、初期ブートローダとして grub をインストールします。この場合、次のことができます。

# grub-install  /dev/sda

これは、グルーブがより一般的でよりうまく機能する場所です。

だからこれを起動し、起動オプションとしてkubuntu-SDA7を選択しましたが、正常に起動しました。上記のデバッグ変更を適用しました(名前を次に変更しました)。NOT-vmlinuz-6.2.0-36-一般)それでもまだうまく起動します。したがって、/oldboot を使用しなくなりました。

おすすめ記事