Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running nginx on ARM64 Unikraft #2

Open
razvanvirtan opened this issue Jul 1, 2021 · 3 comments
Open

Running nginx on ARM64 Unikraft #2

razvanvirtan opened this issue Jul 1, 2021 · 3 comments

Comments

@razvanvirtan
Copy link
Contributor

After applying changes from @justin-he PR unikraft/unikraft#208 we can build and run nginx on an ARM64 emulated or physical environment, using the staging version of Unikraft, but we need to use this workaround:

diff --git a/src/core/nginx.c b/src/core/nginx.c
index 9fcb0eb..3afcb66 100644
@@ -1101,18 +1103,11 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void 
*conf)

     if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
         struct group   *grp;
-       struct passwd  *pwd;

         ngx_set_errno(0);
-       pwd = getpwnam(NGX_USER);
-       if (pwd == NULL) {
-           ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
-                         "getpwnam(\"" NGX_USER "\") failed");
-           return NGX_CONF_ERROR;
-       }

         ccf->username = NGX_USER;
-       ccf->user = pwd->pw_uid;
+       ccf->user = 0;

         ngx_set_errno(0);
         grp = getgrnam(NGX_GROUP);
@@ -1193,7 +1188,6 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void 
*conf)
     ngx_core_conf_t  *ccf = conf;

     char            *group;
-    struct passwd    *pwd;
     struct group     *grp;
     ngx_str_t  *value;

@@ -1214,14 +1208,8 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void 
*conf)

     ccf->username = (char *) value[1].data;

     ngx_set_errno(0);
-    pwd = getpwnam((const char *) value[1].data);
-    if (pwd == NULL) {
-       ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
-                          "getpwnam(\"%s\") failed", value[1].data);
-       return NGX_CONF_ERROR;
-    }

-    ccf->user = pwd->pw_uid;
+    ccf->user = 0;

     group = (char *) ((cf->args->nelts == 2) ? value[1].data : value[2].data);

and comment the following line in fs0/nginx/conf/nginx.conf: error_log logs/error.log debug;

@nderjung
Copy link
Member

nderjung commented Jul 1, 2021

Hi @razvanvirtan, thanks for opening the issue :)

If possible, can you please open a PR with this solution?

Thanks!

@nderjung nderjung transferred this issue from unikraft/unikraft Jul 1, 2021
@razvanvirtan
Copy link
Contributor Author

Yes, I'll try to integrate it asap.

@razvand
Copy link
Contributor

razvand commented Nov 19, 2022

@razvanvirtan , what is the state of this? Is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants