conanwhf / RaspberryPi-script

RaspberryPi 2-B script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

运行脚本后SD卡不能正确启动问题;

jinsai0423 opened this issue · comments

运行脚本之后我的系统能够启动到uboot阶段。后面的文件系统无法加载。经过排查。脚本中替换UUID失败了。添加打印之后内容如下:
`
...Root partition done
device: /dev/mapper/loop0
opartuuidb:PARTUUID=1d0c9c64-01 opartuuidr:PARTUUID=1d0c9c64-02 npartuuidb: npartuuidr:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root= rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
proc /proc proc defaults 0 0
/boot vfat defaults 0 2
PARTUUID=1d0c9c64-02 / ext4 defaults,noatime 0 1

a swapfile is not a swap partition, no line here

use dphys-swapfile swap[on|off] for that

proc /proc proc defaults 0 0
/boot vfat defaults 0 2
/ ext4 defaults,noatime 0 1

a swapfile is not a swap partition, no line here

use dphys-swapfile swap[on|off] for that

==== All done. You can un-plug the backup device
所以是没有获取到新进项的UUID。需要在获取UUID的地方添加sudo 具体如下。

replace PARTUUID

echo "device: ${device}"
opartuuidb=sudo blkid -o export /dev/mmcblk0p1 | grep PARTUUID
opartuuidr=sudo blkid -o export /dev/mmcblk0p2 | grep PARTUUID
npartuuidb=sudo blkid -o export ${device}p1 | grep PARTUUID
npartuuidr=sudo blkid -o export ${device}p2 | grep PARTUUID
echo "opartuuidb:${opartuuidb} opartuuidr:${opartuuidr} npartuuidb:${npartuuidb} npartuuidr:$npartuuidr"
sudo sed -i "s/$opartuuidr/$npartuuidr/g" $mountb/cmdline.txt
cat $mountb/cmdline.txt
sudo sed -i "s/$opartuuidb/$npartuuidb/g" $mountr/etc/fstab
cat $mountr/etc/fstab
sudo sed -i "s/$opartuuidr/$npartuuidr/g" $mountr/etc/fstab
cat $mountr/etc/fstab
`