Why can't I install openwrt on hard disk?

The previous status for sdb:

sudo fdisk -l  /dev/sdb
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST500DM002-1SB10
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xeb3ae1bb

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 482527231 482525184 230.1G 83 Linux
/dev/sdb2       482527232 976773119 494245888 235.7G 83 Linux

sudo blkid
/dev/sdb1: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" PARTUUID="eb3ae1bb-01"
/dev/sdb2: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" PARTUUID="eb3ae1bb-02"

Download img , vmlinuz file and extract :

wget https://downloads.openwrt.org/releases/19.07.7/targets/x86/64/openwrt-19.07.7-x86-64-vmlinuz
wget https://downloads.openwrt.org/releases/19.07.0/targets/x86/64/openwrt-19.07.0-x86-64-combined-ext4.img.gz
gunzip  openwrt-19.07.0-x86-64-combined-ext4.img.gz

Copy vmlinuz for booting:

sudo cp  openwrt-19.07.7-x86-64-vmlinuz  /boot

dd img into sdb:

sudo dd if=openwrt-19.07.7-x86-64-combined-ext4.img   of=/dev/sdb
558080+0 records in
558080+0 records out
285736960 bytes (286 MB, 272 MiB) copied, 5.68211 s, 50.3 MB/s

Show status in sdb after dding:

sudo fdisk -l /dev/sdb
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST500DM002-1SB10
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xeb3ae1bb

Device     Boot Start    End Sectors  Size Id Type
/dev/sdb1  *      512  33279   32768   16M 83 Linux
/dev/sdb2       33792 558079  524288  256M 83 Linux

It 's time to vim grub.cfg, add the following lines into /boot/grub/grub.cfg:

menuentry "OpenWRT" {
	linux /boot/openwrt-19.07.7-x86-64-vmlinuz root=PARTUUID=eb3ae1bb-01 rootfstype=ext4 rootwait console=tty0 console=ttyS0,115200n8 noinitrd
}
menuentry "OpenWRT (failsafe)" {
	linux /boot/openwrt-19.07.7-x86-64-vmlinuz failsafe=true root=PARTUUID=eb3ae1bb-01 rootfstype=ext4 rootwait console=tty0 console=ttyS0,115200n8 noinitrd
}

Reboot ,i can select the openwrt menu from grub,but can't install ,it will quit everytime.
Please watch the video:

Isn't combined kernel + rootfs?

Shouldn't you be using kernel + ext4?

Make sure root= is correct, it's pretty much the only thing pointing the kernel to the root FS.

2 Likes

01 > 02

maybe...

1 Like

blkid -o export /dev/sdxx

Seems blkid provides the information
Or change root= to UUID or LABEL

1 Like

The sdb1 contain mbr boot program which take no effect in grub, the openwrt-19.07.7-x86-64-vmlinuz do the job. So the root body locate in /dev/sdb2.

Fix

root=PARTUUID=eb3ae1bb-01

into

root=PARTUUID=eb3ae1bb-02

Solved.
wulfy23's suggestion is right.

root=/dev/sdb2 would probably work too.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.