parke / lxroot

A lightweight, flexible, and safer alternative to chroot and/or Docker.
GNU General Public License v3.0
100 stars 9 forks source link

Unit test fails with "error rdonly nr/ Operation not permitted" on Void Linux #3

Closed ArdvarkDev closed 3 years ago

ArdvarkDev commented 3 years ago

Upon running make unit, the test fails with the following message. I am running this on void linux.


-  test_no_home

--------

unit2.sh  test fail

  line     181

  expect   'foo'
  actual   'err  1  lxroot  error  rdonly  nr/
  Operation not permitted'

  cwd      /tmp/lxroot-unit
  env1     env -
  lxr1     ./lxr nr
  argv     -- echo foo
  cmd1
  command  env - ./lxr nr -- echo foo
  status   1

  stdout  lxroot  error  rdonly  nr/
  Operation not permitted
parke commented 3 years ago

Thank you for the bug report. I probably should have tested fully on Void before posting to Reddit. (Oops!)

Can you please tell me your kernel and libc versions?

It looks like the kernel is denying lxroot's request to remount nr/ (a test newroot directory) in read-only mode. (mount with flags MS_REMOUNT | MS_RDONLY.)

I will install Void on a VPS to investigate further.

parke commented 3 years ago

The error you reported is due to the unit tests being run in /tmp. There must be something about the way /tmp is mounted on Void that somehow interferes with Lxroot. Maybe limitations on bind mounts inside /tmp? Or something else? I'm not sure exactly. I have seen a similar issue previously, but I never identified the precise cause.

This particular unit test will pass if you change the setting of demo and unit at the top of Makefile as follows:

demo      ?=  $(HOME)/tmp/lxroot-demo
unit      ?=  $(HOME)/tmp/lxroot-unit

However, later unit tests will still fail.

It may take me a couple days to sort it all out, as I have some other commitments to take care of.

I'll post another update here once the unit tests and demos 1 and 2 are running on Void. Thank you for your patience.

parke commented 3 years ago

The unit tests and demos are now working on my headless Void Linux box. Please feel free to pull an update and try again.

If you are curious, here is the function I changed to fix the error you reported: https://github.com/parke/lxroot/blob/master/lxroot.cpp#L1415

Thanks again for submitting your bug report!

ArdvarkDev commented 3 years ago

Works as intended. Thanks!