戻る

-bash-5.0# grub-install --target=i386-pc --debug --boot-directory=/boot /dev/sdd

今度は mount 先では無くて 通常の場所に grub を インストール してみる。

少し前に /mnt つまり /dev/sdd1 に /boot/grub ができていたのでこれを 別のものに 名前を変えて おきます。

-bash-5.0# mount /dev/sdd1 /mnt/
-bash-5.0# mount | head -1
/dev/sdd2 on / type ext3 (rw,relatime)
-bash-5.0# df | sed 3,4d
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7218560 5423280   1425260  80% /
/dev/sdd1         511720  115560    396160  23% /mnt
-bash-5.0# cd /mnt/
-bash-5.0# pwd
/mnt
-bash-5.0# mv boot/ 20220821_boot/
-bash-5.0# cd
-bash-5.0# umount /mnt/
-bash-5.0# mount | head -1
/dev/sdd2 on / type ext3 (rw,relatime)
-bash-5.0# df | head -2
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7218560 5423280   1425260  80% /

さて /boot 領域を見ておきます 過去の残渣も あるようです。

-bash-5.0# ls -l /boot  | sed 1d
drwxr-xr-x 4 root root    4096 Mar 23  2021 001_grub
drwxr-xr-x 4 root root    4096 Jun 28  2021 20210628_OLD_grub
-rw-r--r-- 1 root root  124015 Mar  3  2021 config-5.8.3
-rw-r--r-- 1 root root 4056685 Mar  3  2021 System.map-5.8.3
lrwxrwxrwx 1 root root      22 Aug 11 14:45 vmlinuz -> vmlinuz-5.8.3-lfs-10.0
-rw-r--r-- 1 root root 8547936 Mar  3  2021 vmlinuz-5.8.3-lfs-10.0

では 試行しましょう 

-bash-5.0# grub-install --target=i386-pc --debug --boot-directory=/boot /dev/sdd

-bash-5.0# grub-install --target=i386-pc --debug --boot-directory=/boot /dev/sdd
...
Installation finished. No error reported.
-bash-5.0# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.3-lfs-10.0
done

grub.cfg を 作成

-bash-5.1# grub-mkconfig -o /boot/grub/grub.cfg 2>&1 | tee log_grub_make_grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.16.9-lfs-11.1
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done

再起動確認 して見る

-bash-5.0# shutdown -r now && exit

はいお馴染みの Kernel Panic です。 grb.cfg 変更作業がまだでした そこで

無理やり起動させます。

grub.cfg の 変更

-bash-5.0# cd /boot/
-bash-5.0# cd grub/
-bash-5.0# cp -av grub.cfg  20220821_grub.cfg_dev_NOT_BOOT 
'grub.cfg' -> '20220821_grub.cfg_dev_NOT_BOOT'
-bash-5.0# blkid | grep sdd2
/dev/sdd2: UUID="f01dfb1e-1ce8-4e60-9846-cfde44208bfc" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="00085ab6-02"
-bash-5.0# pwd
/boot/grub
-bash-5.0# sed -n 's@root=/dev/sdd2 ro@root=PARTUUID=00085ab6-02 rootwait ro@pg' grub.cfg
        linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=PARTUUID=00085ab6-02 rootwait ro  
                linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=PARTUUID=00085ab6-02 rootwait ro  
                linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=PARTUUID=00085ab6-02 rootwait ro single 
-bash-5.0# sed -e 's@root=/dev/sdd2 ro@root=PARTUUID=00085ab6-02 rootwait ro@' grub.cfg >qqq
-bash-5.0# mv qqq grub.cfg 
-bash-5.0# diff -s grub.cfg 20220821_grub.cfg_dev_NOT_BOOT 
90c90
<       linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=PARTUUID=00085ab6-02 rootwait ro  
---
>       linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=/dev/sdd2 ro  
105c105
<               linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=PARTUUID=00085ab6-02 rootwait ro  
---
>               linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=/dev/sdd2 ro  
119c119
<               linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=PARTUUID=00085ab6-02 rootwait ro single 
---
>               linux   /boot/vmlinuz-5.8.3-lfs-10.0 root=/dev/sdd2 ro single 

これで 再起動させる。

bash-5.0# shutdown -r now && exit

再起動した様です。

侵入

$ ssh -l root 192.168.0.200
-bash-5.0# ip a | grep -A1 eth0
2: eth0:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:22:68:66:8b:12 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.200/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
-bash-5.0# df | head -2
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7218560 5426080   1422460  80% /
-bash-5.0# mount | head -1
/dev/sdd2 on / type ext3 (rw,relatime)
-bash-5.0# cat /etc/os-release 
NAME="Linux From Scratch"
VERSION="10.0"
ID=lfs
PRETTY_NAME="Linux From Scratch 10.0"
VERSION_CODENAME=" nyantarou USB IP 200 "

にゃんたろう 拝!

2022年 8月 22日 月曜日 21:03:21 JST 作成


戻る

Since 2006.-2022.--Copyright © nyantarou All Rights Reserved.