> On Apr 25, 2018, at 1:47 PM,
ahas...@chromium.org wrote:
>
> Hi All,
>
> I'm looking for a solution for a problem I have. In a few words I need to write a file into a Chrome OS recovery USB stick's stateful partition from user space. Basically I need to create a config file and put it in the stateful partition after the recovery image is created. You can think of it as the Chrome OS recovery utility being able to write a file into the stateful partition of the recovery image after it creates it.
>
> However, the problem is I think since the recovery image was created in root, the uid and gid for the stateful partition are for root. When we insert the recovery USB in Chromebook, the OEM and stateful partitions are mounted as root. Hence, there is no write permission in the user space. For example, there would be no way to modify its content from Chrome. My question is, is mounting it as root really necessary? The USB drive is already mounted and why not allow write access in user space? Is there any way we can set the uid and gid of the recovery partition to root during recovery so we can set them as user space like chronos normally? Is there a security concern?
>
During recovery, chromeos-install will run as root, so there
shouldn't be any trouble reading from stateful, per se.
However the stateful partition isn't guaranteed to be mounted.
If there's content on the stateful partition to be installed
during recovery, that work has to be done at a particular
time. Look for the function install_stateful; any work to
read/install from stateful has to be done inside that function.
> Am I misunderstanding anything here?
>
> BTW, the stateful partition of the USB recovery seems to be ext2 as shown below:
>
> /dev/sdb1 on /media/ahassani/85979eec-b0fc-4ecd-aeef-fc83e73c547e type ext2 (rw,nosuid,nodev,relatime,block_validity,barrier,user_xattr,acl,uhelper=udisks2)
> /dev/sdb8 on /media/ahassani/OEM type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
>
> But the stateful partition on a device is ext4? Do we do any migration during chromeos-install?
>
During chromeos-install, the stateful partition on the target
storage is created from scratch (with mkfs) as ext4.
> Thanks,
> - Amin
>
> --
> --
> Chromium OS Developers mailing list:
chromiu...@chromium.org
> View archives, change email options, or unsubscribe:
>
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
>