Habitat: Non-existent hab user/group results in `Failed to set permissions` error

Created on 12 Jun 2016  路  6Comments  路  Source: habitat-sh/habitat

I was missing the hab user/group and trying to run hab start core/postgresql. It would be nice to detect this state specifically from other generic failed to set permissions errors.

hab-sup(ER)[src/error.rs:321:8]: Failed to set permissions

impl From<hcore::Error> for SupError {
    fn from(err: hcore::Error) -> SupError {
        sup_error!(Error::HabitatCore(err))
    }
}
Bug

Most helpful comment

Another option here would be to use hab if it exists, or use nobody as a fallback.

All 6 comments

If I had to guess I would say:

pub fn create_svc_path(&self) -> Result<()> {
        let runas = format!("{}:{}", SERVICE_PATH_OWNER, SERVICE_PATH_GROUP);
       ...
        Ok(())
    }

Needs to check the service_path_owner, or service_path_group, or have these be checked prior to using them in the runas format string.

edit: Is it more appropriate to handle the error inside of create_svc_path, or outside of it, in run_internal?

Probably best to build a new error type, and then return it early. That will make the error message useful.

Another option here would be to use hab if it exists, or use nobody as a fallback.

Additionally, it would be very useful to if this requirement were documented in:

Just ran into this issue myself, I had seen the hab user mentioned in the docs. Would it make sense to make this a part of the cli configuration?

Here's the spot in the docs where it's mentioned as a requirement:
https://www.habitat.sh/docs/run-packages-overview/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juliandunn picture juliandunn  路  3Comments

ShalokShalom picture ShalokShalom  路  5Comments

smacfarlane picture smacfarlane  路  5Comments

apriofrost picture apriofrost  路  6Comments

baumanj picture baumanj  路  3Comments