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

Problem with setup an image on MAC USER: unbound variable #231

Open
EnvironCMO opened this issue Oct 10, 2024 · 8 comments
Open

Problem with setup an image on MAC USER: unbound variable #231

EnvironCMO opened this issue Oct 10, 2024 · 8 comments

Comments

@EnvironCMO
Copy link

Hello,

I am currently having big problems setting up an image under MAC. I have done the following steps:

  1. git clone https://github.com/guysoft/CustomPiOS.git
    Feedback:
    Clone to 'CustomPiOS'...
    remote: Enumerating objects: 5148, done.
    remote: Counting objects: 100% (1121/1121), done.
    remote: Compressing objects: 100% (404/404), done.
    remote: Total 5148 (delta 774), reused 862 (delta 685), pack-reused 4027 (from 1)
    Receive objects: 100% (5148/5148), 1.03 MiB | 12.80 MiB/s, done.
    Resolve differences: 100% (2773/2773), done.2nd command: ./src/make_custom_pi_os -g test
    Feedback:
    Settings:
    making dstro in test
    variant: raspios_lite_armhf
    sed: 1: “config”: command c expects \ followed by text

After that I wanted to switch to Docker

An alternative way I also tried:
create a docker-compose.yml file in the src directory

version: '3.6'
services:
custompios:
image: guysoft/custompios:devel
container_name: mydistro-builder
privileged: true
volumes:
- ./:/os_make
devices:
- /dev/loop-control
tty: true

-> docker-compose up -d

-> docker exec -it mydistro-builder CustomPiOS/make_custom_pi_os -g /os_make/ExampleDistro

Settings:
making dstro in /os_make/ExampleDistro
variant: raspios_lite_armhf
CustomPiOS/make_custom_pi_os: line 49: USER: unbound variable

Is this an error or is there a point by point guide to avoid running into this error

Translated with DeepL.com (free version)

@guysoft
Copy link
Owner

guysoft commented Oct 14, 2024

@unfixa1 Is this an advertisement? Its certainly not what I would recommend, docker is the supported method here. Give me a reason no to delete your comment not to confuse people.

@guysoft
Copy link
Owner

guysoft commented Oct 14, 2024

@EnvironCMO Your docker compose is missing the mounts to the distruction it should go in /distro
Like this:

    volumes:
      - ./:/distro

Here is a correct docker compose placed in your src folder if the "test" dir you wrote above:

services:
  custompios:
    image: guysoft/custompios:devel
    container_name: test-build
    tty: true
    restart: always
    privileged: true
    volumes:
      - ./:/distro
    devices:
      - /dev/loop-control
    # dns:
    #   - 8.8.8.8
    #   - 4.4.4.4

You called your distribution there test not ExampleDistro
(command I see that in is: command: ./src/make_custom_pi_os -g test)

Also note something about mac - dont run this in the /tmp folder. I just tried and found the mount didn't work because of that. make sure you are in your home directory or somewher that is not /tmp

@guysoft
Copy link
Owner

guysoft commented Oct 27, 2024

Closing if no reply

@EnvironCMO
Copy link
Author

sorry, i'm currently very busy with other topics. but i'll take a look at it.

@sharpn
Copy link

sharpn commented Oct 30, 2024

Hey, I just followed this thread and seemed to get this working by setting

 environment:
      - USER=root

in the docker file under custompios

full docker-compose as follows

services:
  custompios:
    image: guysoft/custompios:devel
    container_name: test-build
    tty: true
    restart: always
    privileged: true
    environment:
      - USER=root
    volumes:
      - ./:/distro
    devices:
      - /dev/loop-control

then running

cd CustomPiOS
./make_custom_pi_os -g /distro/testing

from inside the docker container

@guysoft
Copy link
Owner

guysoft commented Oct 30, 2024

@sharpn Strange, the user is already root. No need to set it. what error do you get without it?

@sharpn
Copy link

sharpn commented Oct 30, 2024

it seems to be because this line is expecting an environment variable called USER it would probably fix it by changing it to chown -R "(id -un")":"$(id -gn")" "${DEST}". Which would use the configured one inside the container. Or setting ENV USER=root when the docker image is built

@guysoft
Copy link
Owner

guysoft commented Oct 30, 2024

Hey,
It guess we could change it to

chown -R "$(id -un )":"$(id -gn )" "${DEST}"

I am not sure if it will break it for people in another way though. Since the user group ID might be different than the ones in the container

@guysoft guysoft changed the title Problem with setup an image on MAC Problem with setup an image on MAC USER: unbound variable Oct 30, 2024
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

4 participants
@guysoft @sharpn @EnvironCMO and others