bastille icon indicating copy to clipboard operation
bastille copied to clipboard

[BUG] "bastille rename" does not update fstab content for Linux container

Open tofazzz opened this issue 2 years ago • 4 comments

  • Bug: When renaming a Linux jail with "bastille rename "target" "new name" the command misses to update the paths located in the fstab file for the jail. If I manually update the paths in the file the jail starts fine.

  • Bastille and FreeBSD version: 0.9.20211225 13.0-RELEASE-p6

  • Bastille installed via pkg

  • Steps:

  1. Create Linux jail and make sure it runs fine
  2. Stop the jail
  3. Rename the jail with a new name
  4. Start the jail and the following error is shown: "mount: /usr/local/bastille/jails/"old jail name": No such file or directory jail: "new jail name": /sbin/mount -t devfs -o rw devfs /usr/local/bastille/jails/"old jail name"/root/dev: failed
  • Fix: The command should update the fstab file as well with the new jail name in all mount points

tofazzz avatar Jan 16 '22 16:01 tofazzz

Hello thanks for report.

This should fix the issue: https://github.com/BastilleBSD/bastille/pull/488

JRGTH avatar Jan 16 '22 18:01 JRGTH

Thank you very much! :)

tofazzz avatar Jan 16 '22 19:01 tofazzz

I can confirm. It's not just a Linux jail issue but for normal ones too. I found that manually editing the fstab to reflect the new directory name can sometimes cause the jail to to start up and then never stop without a full server restart too. That probably should be a separate bug, too.

EDIT: My bug was related to this and not Bastille-centric. Carry on

bedwardly-down avatar Jan 19 '22 23:01 bedwardly-down

I can confirm. It's not just a Linux jail issue but for normal ones too. I found that manually editing the fstab to reflect the new directory name can sometimes cause the jail to to start up and then never stop without a full server restart too. That probably should be a separate bug, too.

EDIT: My bug was related to this and not Bastille-centric. Carry on

Hi, yes you are correct, manually editing not only fstab but also jail.conf while container running is never advisable as anything who changes a path for example may cause the jail start/stop issues as expected.

Also the rename command will take care of the bastille related entries and the user need to update for customs, this is why the bastille rename requires the jail to be stopped on the first place.

Regards

JRGTH avatar Jan 20 '22 10:01 JRGTH

Since the fix for this got merged, it'd be good to close this issue.

zilti avatar Aug 26 '22 15:08 zilti