xz images problem

Hey,

When I download sdcard images for the BBB, I verify that the sum is correct.
after xzcat, I only find 1 partition in the image, which I cannot mount.

Does this sound familiar.
I cannot believe all images are bad, so it must be something wrong on my computer.
I fail to imagine how xz can be wrong.

Any other ideas?

Kind regards,
Kurt

What OS are you using? How are you expanding the xz file?

Greg

It's best to use losetup/kpartx to mount it:

$ unxz bone-debian-stretch-iot-armhf-2017-06-04-4gb.img.xz

$ sudo fdisk -l bone-debian-stretch-iot-armhf-2017-06-04-4gb.img
Disk bone-debian-stretch-iot-armhf-2017-06-04-4gb.img: 3.3 GiB,
3565158400 bytes, 6963200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd12441de

Device Boot Start End
Sectors Size Id Type
bone-debian-stretch-iot-armhf-2017-06-04-4gb.img1 * 8192 6963199
6955008 3.3G 83 Linux

Grab a Loop device:

$ sudo losetup -f
/dev/loop0

$ sudo losetup /dev/loop0 bone-debian-stretch-iot-armhf-2017-06-04-4gb.img

$ sudo kpartx -av /dev/loop0

$ ls /dev/mapper/
control loop0p1

$ mkdir disk
$ sudo mount /dev/mapper/loop0p1 disk/

$ mount | grep disk
/dev/mapper/loop0p1 on
/mnt/data/data/images/bb.org/testing/2017-06-04/stretch-iot/disk type
ext4 (rw,relatime,data=ordered)

$ cd disk/
disk$ ls
bbb-uEnv.txt boot etc ID.txt lost+found mnt opt root
sbin sys usr
bin dev home lib media nfs-uEnv.txt proc run
srv tmp var

Regards,

> Hey,
>
> When I download sdcard images for the BBB, I verify that the sum is correct.
> after xzcat, I only find 1 partition in the image, which I cannot mount.
>
> Does this sound familiar.
> I cannot believe all images are bad, so it must be something wrong on my
> computer.
> I fail to imagine how xz can be wrong.

It's best to use losetup/kpartx to mount it:

Well, I used nbd with 'qemu-nbd -c /dev/nbd0 bone....img.
that should work the same.

$ unxz bone-debian-stretch-iot-armhf-2017-06-04-4gb.img.xz

$ sudo fdisk -l bone-debian-stretch-iot-armhf-2017-06-04-4gb.img
Disk bone-debian-stretch-iot-armhf-2017-06-04-4gb.img: 3.3 GiB,
3565158400 bytes, 6963200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd12441de

Device Boot Start End
Sectors Size Id Type
bone-debian-stretch-iot-armhf-2017-06-04-4gb.img1 * 8192 6963199
6955008 3.3G 83 Linux

Ok, 1 partition. I supposed I needed a FAT :slight_smile:

Grab a Loop device:

$ sudo losetup -f
/dev/loop0

$ sudo losetup /dev/loop0 bone-debian-stretch-iot-armhf-2017-06-04-4gb.img

$ sudo kpartx -av /dev/loop0

$ ls /dev/mapper/
control loop0p1

$ mkdir disk
$ sudo mount /dev/mapper/loop0p1 disk/

This fails at my side.
I now wrote the sd card, and it boots, if I boot directly from sdcard (bypassing my old eMMC u-boot).
I may have forgotten to include an obscure ext4 option in my local kernel?

Am I right that the SoC can boot directly of an ext4? or is U-Boot
hidden in the first free blocks?

Kind regards,
Kurt

I confirm that the nbd way does not work with me.
I followed the losetup way, and then I can mount.
That was a hard lesson ...

Thanks for the help.

Kurt

> Hey,
>
> When I download sdcard images for the BBB, I verify that the sum is correct.
> after xzcat, I only find 1 partition in the image, which I cannot mount.
>
> Does this sound familiar.
> I cannot believe all images are bad, so it must be something wrong on my
> computer.
> I fail to imagine how xz can be wrong.

It's best to use losetup/kpartx to mount it:

Well, I used nbd with 'qemu-nbd -c /dev/nbd0 bone....img.
that should work the same.

$ unxz bone-debian-stretch-iot-armhf-2017-06-04-4gb.img.xz

$ sudo fdisk -l bone-debian-stretch-iot-armhf-2017-06-04-4gb.img
Disk bone-debian-stretch-iot-armhf-2017-06-04-4gb.img: 3.3 GiB,
3565158400 bytes, 6963200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd12441de

Device Boot Start End
Sectors Size Id Type
bone-debian-stretch-iot-armhf-2017-06-04-4gb.img1 * 8192 6963199
6955008 3.3G 83 Linux

Ok, 1 partition. I supposed I needed a FAT :slight_smile:

yeah, we've been using 1 partition by default for a couple years now..

Grab a Loop device:

$ sudo losetup -f
/dev/loop0

$ sudo losetup /dev/loop0 bone-debian-stretch-iot-armhf-2017-06-04-4gb.img

$ sudo kpartx -av /dev/loop0

$ ls /dev/mapper/
control loop0p1

$ mkdir disk
$ sudo mount /dev/mapper/loop0p1 disk/

This fails at my side.
I now wrote the sd card, and it boots, if I boot directly from sdcard (bypassing my old eMMC u-boot).
I may have forgotten to include an obscure ext4 option in my local kernel?

Am I right that the SoC can boot directly of an ext4? or is U-Boot
hidden in the first free blocks?

The bootrom, supports raw boot, so u-boot's stored inside the first
1MB of the drive.

Regards,

That’s an awesome set of command line tools I had never seen before. I had to install kpartx (Ubuntu 16.04) and reboot.
All works after that. rootfs even shows up in the GUI file browser.

Thanks!
Greg