chromebooks
chromebooks copied to clipboard
Fails to run under toolbox
Currently when running the script under toolbox it fails with the following error
Problem opening /dev/sda for reading! Error is 13.
You must run this program as root or use sudo!
Problem opening '' for writing! Program will now terminate.
Warning! MBR not overwritten! Error is 2!
I suppose at worst, the script could detect if it is being run inside a container and bail out
You need root or sudo permissions. It says that clearly.
I don't have experience with toolbox, but as mentioned above this script requires 'sudo' privileges in order to write to disk & mount media. Is it possible to give such permissions to a script running under toolbox?
I don't have experience with toolbox, but as mentioned above this script requires 'sudo' privileges in order to write to disk & mount media. Is it possible to give such permissions to a script running under toolbox?
Yes, I am actually running the script with root inside toolbox (a podman container). I believe the error is caused by something else. I guess detecting that the script is running inside a container and bailing out is the only solution to this issue
Hi, wanting to discuss this a bit more, as might be interesting to run this insid toolbox if possible.
@bilelmoussaoui do you have write access to the host /dev/sda device inside toolbox?
The error above is a permission denied to that device.
The problem is that when a Toolbx container is created as a non-root user on the host, the container uses a user namespace that only inherits the non-root user from the host. So, the host's root isn't available inside the container, and the container's root is mapped to some other ordinary user on the host.
I suspect that /dev/sda
can only be accessed by root on the host, and inside the container's user namespace you will see that the host's root has been replaced by nobody because of the above problem. That's why you can't access it.
So, you either have to access /dev/sda
from the host, or you can create a Toolbx container as root on the host (ie., sudo toolbox create ...
).
I give-it a try creating a toolbx container as root but then partprobe is failing with:
Error: Partition(s) 1, 2 on /dev/sdb have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
I think partprobe
would need some extra permissions when running inside the container, so I'm not sure we will be able to run this script inside the container.
I give-it a try creating a toolbx container as root but then partprobe is failing with:
I see. I haven't yet tried it out myself. Did you run partprobe(8)
with some specific flags? Maybe the strace(1)
logs offer some hints?