openbmc / phosphor-webui

Web-based user interface for managing OpenBMC systems
Apache License 2.0
37 stars 25 forks source link

Uploading firmware images #107

Closed ytmhub closed 4 years ago

ytmhub commented 4 years ago

Hi,

I'm implementing a new layer for OpenBMC, and I'm trying to figure out what I need to do in order to support uploading firmware images via the web UI.

Right now, when trying to upload an image via "Server configuration" tab, I immediately receive an "Unable to upload image file" Error. I didn't see any log related to this in the journal, so I think it fails before even reaching 'bmcweb'.

Any idea what I might be missing?

gtmills commented 4 years ago

@ytmhub Anything in the browser console ?

https://support.airtable.com/hc/en-us/articles/232313848-How-to-open-the-developer-console

Looks like the error is coming from: https://github.com/openbmc/phosphor-webui/blob/432f02cd8355509a8a51fe2baf2097de78a831bf/app/configuration/controllers/firmware-controller.js#L193

ytmhub commented 4 years ago

@gtmills That's what I'm getting in the browser console:

`{data: null, status: -1, headers: ƒ, config: {…}, statusText: "", …} config: data: File {name: "obmc-phosphor-image-hls.static.mtd.tar", lastModified: 1579789524003, lastModifiedDate: Thu Jan 23 2020 16:25:24 GMT+0200 (Israel Standard Time), webkitRelativePath: "", size: 39802880, …} headers: {Content-Type: "application/octet-stream", Accept: "application/json; charset=utf-8", X-XSRF-TOKEN: "mRmwORc1pW6zU7CNB37E"} jsonpCallbackParam: "callback" method: "POST" paramSerializer: ƒ (n) timeout: 300000 transformRequest: [ƒ] transformResponse: [ƒ] url: "https://hls1-bmc03/upload/image" withCredentials: true proto: Object data: null headers: ƒ (t) arguments: (...) caller: (...) length: 1 name: "" prototype: {constructor: ƒ} proto: ƒ ()

status: -1 statusText: "" xhrStatus: "error" proto: Object`

I suspect it's due to "upload/image" interface that doesn't exist, since I also get an error when running the REST command for uploading an image.

Though I didn't figure out how to get this running.

gtmills commented 4 years ago

@ytmhub Are you using bmcweb as your webserver ? https://github.com/openbmc/bmcweb/blob/8251ffee18bc18b7cdda281b3ec137023aa79303/include/image_upload.hpp#L125

Is BMCWEB_ENABLE_DBUS_REST turned off? https://github.com/openbmc/bmcweb/blob/61dbeef97168db1a1f7a351c5f95e09afd361e48/src/webserver_main.cpp#L83

What layer is this?

@anoo1 Have any thoughts?

ytmhub commented 4 years ago

@ytmhub Are you using bmcweb as your webserver ? https://github.com/openbmc/bmcweb/blob/8251ffee18bc18b7cdda281b3ec137023aa79303/include/image_upload.hpp#L125

Yes

Is BMCWEB_ENABLE_DBUS_REST turned off?

It's on, I can run other REST commands via curl, such as activating an image, performing factory reset, rebooting, etc.

What layer is this?

It's not in upstream yet.

rockleesan commented 4 years ago

Hi, i have the same problem. After enabling -DCMAKE_BUILD_TYPE=Debug, I found that, firmware update doesn't work because of software version verification. "same version already exist" and terminates uploading process. What i would do is cut this part of verification from the code, because we have a lot of cases where we need to update existing version to the same version of bmc. My question is, will it be correct? if so, how should i implement it in a correct way?

gtmills commented 4 years ago

@rockleesan Why do you need to update an image with the same version as what is already on the system?

rockleesan commented 4 years ago

Because in some cases, in some reasons, bmc firmware could be corrupted , for example sensors could be unreadable.

@rockleesan Why do you need to update an image with the same version as what is already on the system?

ytmhub commented 4 years ago

Hi, i have the same problem. After enabling -DCMAKE_BUILD_TYPE=Debug, I found that, firmware update doesn't work because of software version verification. "same version already exist" and terminates uploading process. What i would do is cut this part of verification from the code, because we have a lot of cases where we need to update existing version to the same version of bmc. My question is, will it be correct? if so, how should i implement it in a correct way?

This is not my issue, I'm using tar packages that contain a different version in their manifest and os-release.

BTW, if you need to update outside of an official release (i.e., during development process, for instance), you can simply append os-release recipe, and add a timestamp suffix or something to VERSION_ID.

rockleesan commented 4 years ago

Hi, i have the same problem. After enabling -DCMAKE_BUILD_TYPE=Debug, I found that, firmware update doesn't work because of software version verification. "same version already exist" and terminates uploading process. What i would do is cut this part of verification from the code, because we have a lot of cases where we need to update existing version to the same version of bmc. My question is, will it be correct? if so, how should i implement it in a correct way?

This is not my issue, I'm using tar packages that contain a different version in their manifest and os-release.

BTW, if you need to update outside of an official release (i.e., during development process, for instance), you can simply append os-release recipe, and add a timestamp suffix or something to VERSION_ID.

I'm already did that. Thank you.

ytmhub commented 4 years ago

I think I've narrowed down the issue to my image being too large (more than 32 MB), since I did manage to upload an image tar in which I removed its rofs image.

Though I'm still not sure yet where is it tested in the code. Assuming I'm correct, where is this limit defined?

gtmills commented 4 years ago

@ytmhub, @anoo1 did some work here to allow for larger sizes: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27752 https://gerrit.openbmc-project.xyz/c/openbmc/meta-openpower/+/28242

ytmhub commented 4 years ago

Thanks!

That definition solved the issue.