xz images problem

33 views
Skip to first unread message

kurt.van....@gmail.com

unread,
Jun 8, 2017, 8:07:09 AM6/8/17
to BeagleBoard
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

Greg

unread,
Jun 8, 2017, 10:00:41 AM6/8/17
to BeagleBoard, kurt.van....@gmail.com
What OS are you using?  How are you expanding the xz file?

Greg

Robert Nelson

unread,
Jun 8, 2017, 10:15:36 AM6/8/17
to Beagle Board, kurt.van....@gmail.com
On Thu, Jun 8, 2017 at 7:05 AM, <kurt.van....@gmail.com> wrote:
> 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:

$ 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,

--
Robert Nelson
https://rcn-ee.com/

Robert Nelson

unread,
Jun 8, 2017, 10:45:47 AM6/8/17
to Kurt Van Dijck, Beagle Board
On Thu, Jun 8, 2017 at 9:33 AM, Kurt Van Dijck
<kurt.van....@gmail.com> wrote:
>> On Thu, Jun 8, 2017 at 7:05 AM, <kurt.van....@gmail.com> wrote:
>> > 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 :-)

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.

Greg

unread,
Jun 8, 2017, 11:38:18 AM6/8/17
to BeagleBoard, kurt.van....@gmail.com
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

Kurt Van Dijck

unread,
Jun 8, 2017, 2:20:00 PM6/8/17
to Robert Nelson, Beagle Board
> On Thu, Jun 8, 2017 at 7:05 AM, <kurt.van....@gmail.com> wrote:
> > 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 :-)

>
> 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

Kurt Van Dijck

unread,
Jun 8, 2017, 2:20:03 PM6/8/17
to Robert Nelson, Beagle Board
> > On Thu, Jun 8, 2017 at 7:05 AM, <kurt.van....@gmail.com> wrote:
> > > 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.

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
Reply all
Reply to author
Forward
0 new messages