# Deploy squashfs on ubiblock partitions

**URL:** <https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852>\
**Category:** General Discussions\
**Created:** [April 28, 2020, 9:17am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852 "2020-04-28T09:17:28Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 28, 2020, 9:17am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/1 "2020-04-28T09:17:28Z")

</div>

Hi every one,

We want to use mender for our OTA service. I gone through the references, yocto mender layer and build-root but none of them are close to my requirement

my requirement is similar to discussion in the link

> [@Read only compressed rootfs in raw flash?](https://hub.mender.io/t/read-only-compressed-rootfs-in-raw-flash/950):
>
> On my platform I have NOR flash that is smaller than my rootfs size so would like to use a compressed rootfs that decompresses and runs out of RAM on boot. As far as I can tell, this doesn’t seem to be something that’s supported by Mender out of the box (please correct me if I’m wrong!) so I’ve been looking into how I can achieve this. I wanted to ask if I’m on the right track or if I’m missing anything with my current plan: I’m thinking of using squashfs to compress the rootfs, but am not st…

I made modifications in flash layout to fit the mender dual rootfs + kernel on raw ubi volume.  
kernel arguments are modified to mount the squashfs( rootfs) stored in /dev/ubiblock0\_3, the setup works fine mender recognize the active/inactive partition then one and tries to flash the the mender artifact,it come out with open permission failure message.further in our linux 4.4 kernel driver ‘driver/mnt/ubi/block.c’ driver only read-only support.investigating further on internet I found there are patches available for older version but I did’t see and thing equivalent for newer kernel.

Kindly guide on how I can solve this.

 ![Screenshot from 2020-04-28 14-47-07](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/1X/ff5614def6e09be6007d566c89c31cdbb3b76b23.png)

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 28, 2020, 9:35am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/2 "2020-04-28T09:35:31Z")

</div>

Hi @Ratheendran,

Welcome to Mender Hub and glad that you are are choosing Mender for your OTA needs.

Could you please share the content of `/proc/cmdline`? It could be that your MTD parts are marked as `RO` which could such an error that you have.

Also please share any log/output in clear text instead of pictures. Much easier to view/search

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 28, 2020, 9:43am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/3 "2020-04-28T09:43:44Z")

</div>

Appreciate your prompt response.

cat /proc/cmdline  
ubi.mtd=UBI,2048 ubi.block=0,ROOTFS1 root=/dev/ubiblock0\_3 ro rootfstype=squashfs init=/linuxrc rootwait=10 $(mtdparts)

cat /proc/mtd( here kernel and rootfs are ubi volume)  
ev: size erasesize name  
mtd4: 00080000 00020000 “UBOOT0”  
mtd5: 00080000 00020000 “UBOOT1”  
mtd6: 00040000 00020000 “ENV”  
mtd7: 07c00000 00020000 “UBI”  
mtd8: 00516000 0001f000 “KERNEL0”  
mtd9: 00516000 0001f000 “KERNEL1”  
mtd10: 0101b000 0001f000 “ROOTFS0”  
mtd11: 0101b000 0001f000 “ROOTFS1”

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 28, 2020, 9:46am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/4 "2020-04-28T09:46:20Z")

</div>

> [@Ratheendran](#):
>
> $(mtdparts)

What is the content of this?

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 28, 2020, 10:27am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/5 "2020-04-28T10:27:12Z")

</div>

Thanks  
mtdparts=nand0:768k@1280k(IPL0),384k(IPL\_CUST0),384k(IPL\_CUST1),512k(UBOOT0),512k(UBOOT1),256k(ENV0),124m(UBI)

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 28, 2020, 11:08am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/6 "2020-04-28T11:08:54Z")

</div>

> mtdparts=nand0:768k@1280k(IPL0),384k(IPL\_CUST0),384k(IPL\_CUST1),512k(UBOOT0),512k(UBOOT1),256k(ENV0),124m(UBI)

But this does not match the content of `/proc/mtd`? Do you have multiple NAND devices?

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 28, 2020, 11:44am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/7 "2020-04-28T11:44:15Z")

</div>

this is one flash, Partition info is correct, I am access env partition /dev/mtd6 from user space.  
dev: size erasesize name  
mtd0: 00140000 00020000 “UNKNOWN”  
mtd1: 000c0000 00020000 “IPL0”  
mtd2: 00060000 00020000 “IPL\_CUST0”  
mtd3: 00060000 00020000 “IPL\_CUST1”  
mtd4: 00080000 00020000 “UBOOT0”  
mtd5: 00080000 00020000 “UBOOT1”  
mtd6: 00040000 00020000 “ENV”  
mtd7: 07c00000 00020000 “UBI”  
mtd8: 00516000 0001f000 “KERNEL0”  
mtd9: 00516000 0001f000 “KERNEL1”  
mtd10: 0101b000 0001f000 “ROOTFS0”  
mtd11: 0101b000 0001f000 “ROOTFS1”

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 28, 2020, 5:00pm UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/8 "2020-04-28T17:00:16Z")

</div>

Thanks @mirzak for the support, any idea on what’s going wrong with my mender integration ,also I need clarity on how mender is going to write to /dev/ubiblock0\_2 , the lowlevel driver(/driver/mnt/ubi/block.c) support allows only read operation. please correct me if there is any misunderstanding.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 28, 2020, 5:07pm UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/9 "2020-04-28T17:07:52Z")

</div>

The Mender client will do the equivalent to what [ubiupdatevol](http://www.linux-mtd.infradead.org/doc/ubi.html#L_usptools) does, you could try with this tool first.

If `ubiupdatevol` does not work then you might have some non-standard modifications in you Linux kernel that disallows this and in which case I do not know if I can provide any additional guidance.

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 28, 2020, 6:00pm UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/10 "2020-04-28T18:00:27Z")

</div>

Thanks @mirzak for you time, really appreciate this.

I think mender integration on my board still have gaps.

My observations

This works on my board,  
ubiupdatevol /dev/ubi0\_2

Then I created a block device  
ubiblock -c /dev/ubi0\_2  
block ubiblock0\_2: created from ubi0:2(ROOTFS0)

This is not working on my board.  
ubiupdatevol /dev/ubiblock0\_2   
libubi: error!: “/dev/ubiblock0\_2” is not a character device  
ubiupdatevol: error!: error while probing “/dev/ubiblock0\_2”  
error 22 (Invalid argument)

I have yocto mender build for nor-vexpress-qemu for reference, mender works fine on this syste.

further I created test programme which is equivalent to ‘ubiupdatevol’.  
this neither works on my board nor on vexpress-qemu

int main()  
{  
char buf[] = “0123456789012345678901234567890123456789012345678901234567890123456789”;  
int fd = open("/dev/ubi0\_2",O\_RDWR);  
int image\_size=sizeof(buf);  
ioctl(fd, UBI\_IOCVOLUP, &image\_size);  
if(write(fd, buf, image\_size)\<0)  
perror("");  
close(fd);  
}

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 28, 2020, 7:38pm UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/11 "2020-04-28T19:38:24Z")

</div>

> ubiupdatevol /dev/ubiblock0\_2  
> libubi: error!: “/dev/ubiblock0\_2” is not a character device  
> ubiupdatevol: error!: error while probing “/dev/ubiblock0\_2”  
> error 22 (Invalid argument)

I apologize I missed/skipped some information you posted earlier, but UBI blocks are as you pointed out RO so you can not point the Mender client to `/dev/ubiblock0_2` devices, it has to be e.g `/dev/ubi0_2`. `/dev/ubi0_2` represents an UBI volume while `/dev/ubiblock0_2` is a raw visual representation of the NAND area.

I pointed this out in the other thread,

> For this reason I would suggest for you to use UBI volumes in “raw mode” where you store your squashfs images. This will work out of the box pretty much.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [April 28, 2020, 7:41pm UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/12 "2020-04-28T19:41:16Z")

</div>

Also from the other thread,

> Apologies, I mixed up the terminology. What I am referring to is static UBI volumes, from the UBI docs,

Making the same mistake again.

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 30, 2020, 8:53am UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/13 "2020-04-30T08:53:45Z")

</div>

Thanks for support, this channel is helping my mender integration effort.

The discussion on fit image in other threads caught my interest, I created a setup on which uboot loads the kernel and squashfs rootfs using FIT image.I believe, this case kernel will mount the rootfs as ramdisk.This approach requires ram space equivalent to rootfs size blocked,which other wise would have been available for application.

Can you please comment on a better way of using the fit images or different approach.

---

<div class="post-metadata">

**Author:** ![Ratheendran](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Ratheendran](https://hub.mender.io/u/Ratheendran)\
**Post date:** [April 30, 2020, 12:54pm UTC](https://hub.mender.io/t/deploy-squashfs-on-ubiblock-partitions/1852/14 "2020-04-30T12:54:31Z")

</div>

@mirzak  
I tried mender on uboot fit images and ramdisk, o/p on console is as below, how to get the right partition ?.

> Mender running on partition: /dev/root module=main

> etc/mender # mender -debug -install /tmp/release-1.mender  
> WARN[0000] Could not connect to syslog daemon: Unix syslog delivery error. (use -no-syslog to disable completely) module=main  
> DEBU[0000] Reading Mender configuration from file /var/lib/mender/mender.conf module=config  
> INFO[0000] Loaded configuration file: /var/lib/mender/mender.conf module=config  
> DEBU[0000] Reading Mender configuration from file /etc/mender/mender.conf module=config  
> INFO[0000] Loaded configuration file: /etc/mender/mender.conf module=config  
> WARN[0000] No server URL(s) specified in mender configuration. module=config  
> WARN[0000] Server entry 1 has no associated server URL. module=config  
> DEBU[0000] Merged configuration = &main.menderConfig{menderConfigFromFile:main.menderConfigFromFile{ClientProtocol:“”, ArtifactVerifyKey:“”, HttpsClient:struct { Certificate string; Key string; SkipVerify bool }{Certificate:“”, Key:“”, SkipVerify:false}, RootfsPartA:“ubi0\_2”, RootfsPartB:“ubi0\_3”, DeviceTypeFile:“/var/lib/mender/device\_type”, UpdatePollIntervalSeconds:0, InventoryPollIntervalSeconds:0, RetryPollIntervalSeconds:0, StateScriptTimeoutSeconds:0, StateScriptRetryTimeoutSeconds:0, StateScriptRetryIntervalSeconds:0, ModuleTimeoutSeconds:0, ServerCertificate:“”, ServerURL:“”, UpdateLogPath:“”, TenantToken:“”, Servers:client.MenderServer{client.MenderServer{ServerURL:“”}}}, ModulesPath:“/usr/share/mender/modules/v3”, ModulesWorkPath:“/var/lib/mender/modules/v3”, ArtifactInfoFile:“/etc/mender/artifact\_info”, ArtifactScriptsPath:“/var/lib/mender/scripts”, RootfsScriptsPath:“/etc/mender/scripts”} module=config  
> WARN[0000] Could not resolve path link: ubi0\_2 Attempting to continue module=partitions  
> WARN[0000] Could not resolve path link: ubi0\_3 Attempting to continue module=partitions  
> DEBU[0000] Have U-Boot variable: mender\_check\_saveenv\_canary=0 module=bootenv  
> DEBU[0000] List of U-Boot variables:map[mender\_check\_saveenv\_canary:0] module=bootenv  
> DEBU[0000] Have U-Boot variable: mender\_boot\_part=3 module=bootenv  
> DEBU[0000] List of U-Boot variables:map[mender\_boot\_part:3] module=bootenv  
> DEBU[0000] Setting active partition from mount candidate: /dev/root module=partitions  
> INFO[0000] Mender running on partition: /dev/root module=main  
> DEBU[0000] I/O read error for entry mender-agent.pem: open /var/lib/mender/mender-agent.pem: no such file or directory module=dirstore  
> DEBU[0000] private key does not exist module=keystore  
> DEBU[0000] ModuleTimeoutSeconds not set. Defaulting to 14400 seconds module=modules  
> DEBU[0000] Starting device update. module=standalone  
> INFO[0000] Start updating from local image file: [/tmp/release-1.mender] module=standalone  
> DEBU[0000] Fetching update from file results: [&{0x85ef00}], 14299136, module=standalone  
> Installing Artifact of size 14299136…  
> DEBU[0000] Read data from device manifest file: device\_type=emdev module=device  
> DEBU[0000] Current manifest data: emdev module=device  
> DEBU[0000] statescript: timeout for executing scripts is not defined; using default of 1h0m0s seconds module=executor  
> INFO[0000] no public key was provided for authenticating the artifact module=installer  
> INFO[0000] Update Module path “/usr/share/mender/modules/v3” could not be opened (open /usr/share/mender/modules/v3: no such file or directory). Update modules will not be available module=modules  
> DEBU[0000] checking if device [emdev] is on compatible device list: [emdev]  
> module=installer  
> DEBU[0000] installer: successfully read artifact [name: release-1; version: 3; compatible devices: [emdev]] module=installer  
> .DEBU[0000] Trying to install update of size: 14290944 module=dual\_rootfs\_device  
> DEBU[0000] Active partition: /dev/root module=partitions  
> ERRO[0000] Download failed: Payload: can not install Payload: rootfs.squashfs: Active root partition matches neither RootfsPartA nor RootfsPartB. module=standalone  
> DEBU[0000] statescript: timeout for executing scripts is not defined; using default of 1h0m0s seconds module=executor  
> ERRO[0000] Payload: can not install Payload: rootfs.squashfs: Active root partition matches neither RootfsPartA nor RootfsPartB. module=main
