Jump to content

Files Inside `/build/userpatches/overlay` Not Visible Inside Image File


FloatingSunfish
Go to solution Solved by FloatingSunfish,

Recommended Posts

We have added some custom files inside `/build/userpatches/overlay`, which is as follows:

 

    /build/userpatches/overlay
        /log-configurations
            log-config
        /scripts
            myscript.sh
        /services
            myservice.service
            
We are building our image with the following command:

 

    sudo ./compile.sh  CLEAN_LEVEL="" BOARD=zeropi BRANCH=dev RELEASE=buster BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img
    
The build completes successfully, but when we open the Image file in PowerISO, we cannot locate our custom files inside the Image.

 

We have the assumption that custom files should be located somewhere in the built Image.
Is this assumption correct? If so, where should we expect to see our custom files?

Link to comment
Share on other sites

The userpatches folder is actually for patches that should be applied before building stuff like U-Boot or the kernel.

If you want to include specific files into your image before it gets packed try utilizing the  customization script:

 

https://docs.armbian.com/Developer-Guide_User-Configurations/#user-provided-image-customization-script

Link to comment
Share on other sites

  

7 minutes ago, Werner said:

The userpatches folder is actually for patches that should be applied before building stuff like U-Boot or the kernel.

If you want to include specific files into your image before it gets packed try utilizing the  customization script:

 

https://docs.armbian.com/Developer-Guide_User-Configurations/#user-provided-image-customization-script

 

We believe this is what we are already doing.

We are including custom files inside `/build/userpatches/overlay`, and we are using `/userpatches/customize-image.sh` to access said custom files from the `/tmp/overlay` directory.

 

We actually have 2 issues:

1. It seems `customize-image.sh` is not being run (we're creating a directory `/mydirectory` and it's not being created after installing the image).

2. Our custom files inside `/build/userpatches/overlay` are not being reflected inside the built Image.

 

We decided to ask the easier question first, which is #2.

 

Going back, is our assumption correct that our custom files should be visible somewhere inside the built Image?

Also, are we using `/build/userpatches/overlay` and `/userpatches/customize-image.sh` correctly?

We're going by what we understand from the link you provided.

Edited by FloatingSunfish
Link to comment
Share on other sites

30 minutes ago, FloatingSunfish said:

It seems `customize-image.sh` is not being run


It used to work not long time ago, but I don't use this feature very often - perhaps we broke it somehow. Making an image with adding some command there (to make a /test directory on / or similar) and see if it works is probably the first step, debugging requires more time ...

Link to comment
Share on other sites

8 minutes ago, Igor said:


It used to work not long time ago, but I don't use this feature very often - perhaps we broke it somehow. Making an image with adding some command there (to make a /test directory on / or similar) and see if it works is probably the first step, debugging requires more time ...

 

Our `customize-image.sh` contains the following custom code for `buster`:

 

buster)
    # Update Repositories
    apt-get -y update
    apt-get -y upgrade
    apt-get -y dist-upgrade

    # ------------------------------------------
    # Copy our files to the proper directories.
    # ------------------------------------------

    # ----------------
    # Logrotate Files
    # ----------------

    cp -TR /tmp/overlay/log-configurations/ /etc/logrotate.d/

    # --------
    # Scripts
    # --------

    mkdir -m 777 /scripts
    cp -TR /tmp/overlay/scripts/ /scripts/

    # Enable Network-checking.
    systemctl start systemd-networkd
    systemctl enable systemd-networkd

    # Make our scripts executable by services (do for each script file).
    chmod a+x /scripts/myscript.sh

    # ---------
    # Services
    # ---------

    cp -TR /tmp/overlay/services/ /etc/systemd/system/

    # Give our services the proper permissions.
    chmod 644 /etc/systemd/system/myservice.service

    systemctl daemon-reload

    # Start and run our services on startup (do for each service file).
    # Note that each line has TWO commands!
    systemctl start myservice && systemctl enable myservice
    ;;		

 

We're creating a new directory with `mkdir -m 777 /scripts`, but it is not being created.

Also, is there any code in the above section that is incorrect or should not be there?

Edited by FloatingSunfish
Link to comment
Share on other sites

1 hour ago, Igor said:


It used to work not long time ago, but I don't use this feature very often - perhaps we broke it somehow. Making an image with adding some command there (to make a /test directory on / or similar) and see if it works is probably the first step, debugging requires more time ...

 

UPDATE: We managed to create a new directory by changing `mkdir -m 777 /scripts` to `mkdir -m 777 $SDCARD/scripts`.

Although we are not sure if this will work for other developers, at least it resolved the "directories not being created" issue.

Link to comment
Share on other sites

26 minutes ago, FloatingSunfish said:

We managed to create a new directory by changing


And I wasted one hour for dealing with the bug that does not exits! Since I don't know who will pay that I might get seriously pissed off next time which is why I recommend you to get a subscription or hire someone that will deal with your problems https://www.debian.org/consultants/

Link to comment
Share on other sites

19 minutes ago, Igor said:


And I wasted one hour for dealing with the bug that does not exits! Since I don't know who will pay that I might get seriously pissed off next time which is why I recommend you to get a subscription or hire someone that will deal with your problems https://www.debian.org/consultants/

 

I wouldn't call it "wasting one hour," as not being able to create a directory with `mkdir -m 777 /scripts` feels like a legitimate issue.

`/` being the root directory on any Linux system, I can imagine other developers being confused if the above command does not work for them.

 

To be honest, `mkdir -m 777 $SDCARD/scripts` was a blind guess to see if something will work as we did not see it in the official documentation (or if it was, our apologies in advance if we somehow missed it).

If prefixing `$SDCARD` to directories is always needed (which it might be, given how Armbian runs on development boards on devices that will most likely use SD cards), then it might need to be added to the documentation if it's not there already.

 

Again, our apologies if we upset you.

Link to comment
Share on other sites

1 hour ago, FloatingSunfish said:

was a blind guess to see if something will work as we did not see it in the official documentation


We don't provide support for 3rd party applications that you plan to execute inside chroot on Debian or Ubuntu userspace. Which is why we don't provide documentation for that or help in case of troubles.

 

1 hour ago, FloatingSunfish said:

I wouldn't call it "wasting one hour,"

 

This is free software and there is zero warranty that this software works at all. 

Link to comment
Share on other sites

  • Solution

UPDATE: It seems that changing `mkdir -m 777 /scripts` to `mkdir -m 777 $SDCARD/scripts` has resolved both issues:

1. `customize-image.sh` is now running as expected.

2. We can now see our custom files inside `/build/userpatches/overlay`. These were "copied" to where we told `customize-image.sh` to place them.

Edited by FloatingSunfish
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines