Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

[BUG] Boot sequence, IPFS before custom-cont-init.d #53

Closed
@hulkhaugen

Description

@hulkhaugen

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm trying to add a custom script to this container, but I'm facing some challenges. I'm very limited in this field, but it seems to me that the script(s) in custom-cont-init.d are ran after some IPFS related stuff. The issue for me personally is that I want to remove /data and make a symlink from a variable, let's say /share/emulatorjs to /data. I'm doing this for a Home Assistant Add-on, so I'm somewhat limited from the usual approaches.

Maybe i'm approaching this wrong, I just want to be able to move the roms folders to /share.

Expected Behavior

Run script before anything else inside the container

Steps To Reproduce

  • Fresh install 1.7.3-ls75
  • Make a script that deletes /data, and adds a symlink from /share/emulatorjs to /data
  • Include the script in custom-cont-init.d
  • What the logs that says: cannot remove 'data': Resource busy

Environment

- OS: HassOS
- How docker service was installed: Plain, only added said script

CPU architecture

arm64

Docker creation

ARG BUILD_VERSION
FROM lscr.io/linuxserver/emulatorjs:$BUILD_VERSION
# Add custom script
COPY rootfs / 

********************
* custom-script.sh *
********************

#!/bin/sh

# Read the target folder from /data/options.json
# Default value is /share/emulatorjs
TARGET_FOLDER=$(jq -r '.rom_folder' /data/options.json)

# Ensure the target folder is owned by root
mkdir -p "$TARGET_FOLDER"
chown root:root "$TARGET_FOLDER"

# Create a symlink from /data to the specified target folder
rm -rf /data
ln -s "$TARGET_FOLDER" /data

# Debugging: Print the current state
ls -la /data/

Container logs

[custom-init] No custom services found, skipping...
[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    0
User GID:    0
───────────────────────────────────────

generating ED25519 keypair...done
peer identity: 12D3KooWAEFs7wwHxD9PCRWTnwfi9KUbbqaQwNfpUpMHiMNXFFwK
initializing IPFS node at /data/.ipfs
to get started, enter:

	ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme

[custom-init] Files found, executing
[custom-init] 01-custom-data-folder.sh: executing...
rm: cannot remove '/data': Resource busy
total 8
drwxr-xr-x 2 root root 4096 Dec 16 20:33 .
drwxr-xr-x 1 root root 4096 Dec 16 20:33 ..
lrwxrwxrwx 1 root root   17 Dec 16 20:33 emulatorjs -> /share/emulatorjs
[custom-init] 01-custom-data-folder.sh: exited 0
Initializing daemon...
Kubo version: 0.19.2
Repo version: 13
System version: arm64/linux
Golang version: go1.20.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions