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

Changes needed to use crossbuilder on manjaro #59

Merged
merged 10 commits into from Oct 29, 2021
Merged

Conversation

jezek
Copy link
Contributor

@jezek jezek commented Sep 16, 2021

  • If no 'dpkg' command found, try to determine host architecture using
    other metod(s).
  • Don't check for 'dpkg-architecture' command at beginning. Run the
    command in container, if missing.
  • Don't check for 'dpkg-parsechangelog' command at beginning. Run the
    command in container or replace it by using grep+sed, if missing.
  • Run lxd daemon at startup, if not running.
  • Use current user/group id in lxd subuid/subgid setup & assurance.
  • If not 'apt' found, check for 'pacman' and use if present.
  • If container is missing network access, try to apply 'dhclient' hack.
    and then check again for network.

@mardy
Copy link
Member

mardy commented Sep 17, 2021

Hi @jezek, thanks for this! But please, split it into multiple commits, one per fix -- otherwise it makes it harder to review and to revert those bits that might turn out to be problematic.

You can keep everything in the same branch, or create multiple PRs -- as you prefer (the latter will make it easier to immediately land the trivial fixes).

@jezek jezek changed the title Changes needed to use crossbuilder on manjaro + other Changes needed to use crossbuilder on manjaro Sep 20, 2021
@jezek
Copy link
Contributor Author

jezek commented Sep 20, 2021

I've split the previous commit with manjaro + other fixes into this PR, which is only changes needed to run on manjaro linux and into PR #60, which are some minor syntax, indent and bug fixes.

Is it enough?

- If no 'dpkg' command found, try to determine host architecture using
  other metod(s).
- Don't check for 'dpkg-architecture' command at beginning. Run the
  command in container, if missing.
- Don't check for 'dpkg-parsechangelog' command at beginning. Run the
  command in container or replace it by using grep+sed, if missing.
- Run lxd daemon at startup, if not running.
- Use current user/group id in lxd subuid/subgid setup & assurance.
- If not 'apt' found, check for 'pacman' and use if present.
- If container is missing network access, try to apply 'dhclient' hack.
  and then check again for network.
Copy link
Member

@mardy mardy left a comment

Choose a reason for hiding this comment

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

Thanks Jezek, I left quite a few comments, but they are all minor; overall it looks very good, thanks!

crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated
fi
sudo usermod --add-subuids "10000-75536" `whoami`
sudo usermod --add-subuids "${USER_ID}-${USER_ID}" root
sudo usermod --add-subuids "10000-75536" root
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain why adding these ranges is needed? Is it so that if the owner of the files (outside the container) has a different ID than the user inside the container, the user inside the container will still be able to access these files?

If so, please add a comment to the code. And it's still not clear why this is done both for the current user and for root (the previous code was doing it for root only).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, the user part is not needed. It works without it.

Without the additional root part, the crossbuilder script ends with error when trying to install/configure container. After some search I found a tutorial which suggests adding the ranges. After adding the additional root ranges the container installs and the building script works.

Note, that I had a mistake in the ranges and added a range 10000, +65537, instead 100000, +65536 and it worked too. I've changed the ranges to reflect the arch manual page.

I really don't know why on ubuntu the additional ranges are not needed and on manjaro they are.

Here is a link to gist with crossbuilder output before the additional root subuid/subgid ranges and after.

crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
crossbuilder Outdated Show resolved Hide resolved
Copy link
Member

@mardy mardy left a comment

Choose a reason for hiding this comment

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

Hi Jezek! I'm terribly sorry for the delay, I hadn't time to try this in the last week. Now I did, and it seems to work fine :-)

@mardy mardy merged commit 9825466 into ubports:master Oct 29, 2021
@jezek jezek deleted the manjaro branch October 31, 2021 17:07
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

Successfully merging this pull request may close these issues.

None yet

2 participants