bastille icon indicating copy to clipboard operation
bastille copied to clipboard

[BUG] mount ALL broken

Open kjelderg opened this issue 4 years ago • 5 comments

[MANDATORY] Describe the bug [MANDATORY] When trying to add a nullfs mount to ALL jails, bastille mangled the path resulting in invalid fstab entries.

[MANDATORY] Bastille and FreeBSD version (paste bastille -v && freebsd-version -kru output) root@generic:/usr/local/bastille/jails # bastille -v && freebsd-version -kru 0.8.20210115 13.0-RELEASE 13.0-RELEASE 13.0-RELEASE

[MANDATORY] How did you install bastille? (port/pkg/git) pkg

[optional] Steps to reproduce?

  1. Create two or more Bastille jails

$ sudo bastille create jail0 13.0-RELEASE 127.1.2.3 $ sudo bastille create jail1 13.0-RELEASE 127.1.2.4

  1. Run a mount ALL

$ sudo bastille cmd ALL mkdir /m $ sudo bastille mount ALL /m /m nullfs rw 0 0

[optional] Expected behavior The mount is created exactly the same in each jail.

[optional] Additional context Instead of matching mounts, it succeeded on the first one. On the successive ones, an artifact from the previous jail works its way into the fstab and causes a mount failure.

Example:

freebsd@generic:/usr/local/bastille % sudo bastille mount ALL /m /m nullfs rw 0 0
[jail0]:
/m /usr/local/bastille/jails/jail0/root//m nullfs rw 0 0

[jail1]:
Added: /m /usr/local/bastille/jails/jail1/root//usr/local/bastille/jails/jail0/root//m nullfs rw 0 0
mount: /usr/local/bastille/jails/jail0/root/usr/local/bastille/jails/jail1: No such file or directory

Workaround: In order to resolve this, I cleared out the erroneous line from each fstab file and then ran the mount command for each jail separately.

kjelderg avatar Apr 28 '21 00:04 kjelderg

Thank you for submitting this. Definitely looks like a bug.

Let me try and recreate; see what I can do.

cedwards avatar Apr 28 '21 01:04 cedwards

I had a quick look into this and seems that the bastille mount command was written/tested pointing to a single jail rather than working with bastille ALL.

This command will work best with a for loop rewrite to let the variables carry the needed info once per item to avoid nesting.

P.S. ATM I have several PR's in my repository so I will have a quick review of them to avoid further repo conflicts. Also note that this does happens with FreeBSD 12.x as well when tested.

Regards

JRGTH avatar Apr 28 '21 03:04 JRGTH

This issue has been fixed in the following PR 2c87c58a5b71f6753b79810f7a34144694e2b54f

Regards

JRGTH avatar Apr 29 '21 20:04 JRGTH

This was also fixed in #395.

chriswells0 avatar Jun 12 '21 14:06 chriswells0

Hi, I was just looking through the issues to see if there is one I could help fix, this here is still open despite having been fixed. Would be nice if someone could close it :)

zilti avatar Sep 02 '21 20:09 zilti

closing as fixed!!!!

bmac2 avatar Oct 19 '23 01:10 bmac2