Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

fix build problem of non-root user using script #9898

Merged
merged 9 commits into from
Jan 21, 2021
Merged

Conversation

softprofe
Copy link
Contributor

@softprofe softprofe commented Jan 11, 2021

Change Description

Start 9898 description ......

On a clean cloud instance, add a non-root user and then use this user to try to build eos using script, error will happen because libpqxx is not installed because there is no root permission.

The epe560 says the same problem, it is on 2.1 branch.

End 9898 description ......

Change Type

Select ONE

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

…eosio_build.sh. So, non root building will have problem to install dependency.

Add "sudo" to solve the problem.
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get update && apt-get -y install libpq-dev
sudo echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > sudo /etc/apt/sources.list.d/pgdg.list && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work properly? The redirection w/ sudo usually requires more care.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Per my test it can pass the build, however, the line 'echo "deb http://apt... ' more like did nothing after run.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't

sudo echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > sudo /etc/apt/sources.list.d/pgdg.list

create a file named sudo?

Copy link
Contributor Author

@softprofe softprofe Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, create nothing. just like no echo called. but if no sudo there, error will pops says no permission.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo echo "deb http://apt.postgresql.org/pub/repos/apt -pgdg main" > sudo hello
Creates file sudo with contents:

bash-3.2$ cat sudo
deb http://apt.postgresql.org/pub/repos/apt -pgdg main hello

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny it actual includes "hello", did not expect that. But pretty clear this is not what you want.

Copy link
Contributor Author

@softprofe softprofe Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, it didn't check carefully in currently directory, I checked /etc/apt/sources.list.d nothing changed, even no pgdg.list there.

@heifner
Copy link
Contributor

heifner commented Jan 13, 2021

Please use standard PR template for your PR description providing a nice description that will be helpful when viewed at time of release.

… using sudo apt update and apt install works(per test on cloud instance).
@softprofe
Copy link
Contributor Author

softprofe commented Jan 14, 2021

Why not just add the required package into scripts/eosio_build_ubuntu_deps so it uses the 'standard' way packages are installed? Why invent a new way to install a package here?

This question is out or this PR, maybe you should ask Huangming(the author of ensure-libpq-and-libpqxx), I guess the things required more than 'standard way' can do. (I guess the reason is libpq and libpqxx are not a tool like make or git, it is a compile dependent libarary, so the things more than 'standard way' install it)

In this PR we would like to fix the problem of non-root user building by script.

@softprofe softprofe merged commit f6b9ccf into develop Jan 21, 2021
@softprofe softprofe deleted the keke_epe561_nonroot branch January 21, 2021 15:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants