Closed Bug 1154956 Opened 5 years ago Closed 2 years ago

Build fails to build due to : ln: out/target/product/aries/root/sbin/sh: No such file or directory

Categories

(Firefox OS Graveyard :: General, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: nhirata, Unassigned)

Details

(Whiteboard: [spark])

Tried to build with : VARIANT=userdebug ./build.sh -j1

Copy: out/target/product/aries/root/init
# If /init is a file and not a symlink then rename it to /init.real
# and make /init be a symlink to /sbin/init.sh (which will execute
# /init.real, if appropriate.
echo "===== BEFORE ====="
===== BEFORE =====
ls -l out/target/product/aries/root
total 384
-rw-r--r--  1 nhirata  staff  195876 Apr 15 14:41 init
if [ ! -L out/target/product/aries/root/init ]; then \
	  echo "/init out/target/product/aries/root/init isn't a symlink"; \
	  mv out/target/product/aries/root/init out/target/product/aries/root/init.real; \
	  ln -s sbin/init.sh out/target/product/aries/root/init; \
	else \
	  echo "/init out/target/product/aries/root/init is already a symlink"; \
	fi
/init out/target/product/aries/root/init isn't a symlink
echo "===== AFTER ====="
===== AFTER =====
ls -l out/target/product/aries/root
total 392
lrwxr-xr-x  1 nhirata  staff      12 Apr 15 14:41 init -> sbin/init.sh
-rw-r--r--  1 nhirata  staff  195876 Apr 15 14:41 init.real
rm -f out/target/product/aries/root/sbin/sh
ln -s busybox out/target/product/aries/root/sbin/sh
ln: out/target/product/aries/root/sbin/sh: No such file or directory
make: *** [init.sh-post] Error 1
Priority: -- → P2
Whiteboard: [ignite]
Note: QA needs root access in a build similar to user build.  Otherwise they can't place on custom gaia builds as the user builds aren't rooted. ( ie adb root won't work )
Turns out it's because the sbin folder wasn't created.

cd out/target/product/aries/root/
mkdir sbin
ln -s busybox out/target/product/aries/root/sbin/sh

then rerun the VARIANT=userdebug ./build.sh -j1
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
actually, we should fix the script...
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Found out that this happens on 14.10 ubuntu as well.

in <project>/external/init_sh/Android.mk

added the following on line 35 ( before ln -s busybox $(TARGET_ROOT_OUT)/sbin/sh ):

        if [ ! -d $(TARGET_ROOT_OUT)/sbin ]; then \
          mkdir $(TARGET_ROOT_OUT)/sbin; \
        fi


Not sure if we want to change an external init_sh/Android.mk script.
Summary: VARIANT=userdebug fails to build on mac os → Build fails to build due to : ln: out/target/product/aries/root/sbin/sh: No such file or directory
Whiteboard: [ignite] → [spark]
Alexandre, fyi, I found this on linux and mac.  Should we do a patch to the repo or no?
Flags: needinfo?(lissyx+mozillians)
(In reply to Naoki Hirata :nhirata (please use needinfo instead of cc) from comment #5)
> Alexandre, fyi, I found this on linux and mac.  Should we do a patch to the
> repo or no?

I'm not sure and I'm quite surprised by this. Making sure /sbin exists should not be our problem, and you are the firt one hitting this. Dave landed this, so maybe he has another opinion, but I'd like first that we try to understand under which circumstances this might happen, as I'm not confident this should be fixed like this :).

FYI I do build userdebug on 14.10 too.
Flags: needinfo?(lissyx+mozillians) → needinfo?(dhylands)
/sbin isn't a normal directory that exists on the target.

I created the external/init_sh/ project, so we can make any changes we want in there.

busybox and extract_elf_ramdisk are both dependencies and they're supposed to be installed into the sbin directory, so maybe this is only problem with a totally clean tree?

Oh - maybe it has to do with the order that the targets exist in the Android.mk file.

busybox and extract_elf_ramdisk are after init.sh, so they'll get added to ALL_DEFAULT_INSTALLED_MODULES after the ALL_DEFAULT_INSTALLED_MODULES += $(LOCAL_MODULE)-post line.

So maybe all we need to do is to move that line to the end of the file.

But it still seems weird to me.
Flags: needinfo?(dhylands)
I ran into that too on ubuntu 15.04 this sunday. And indeed, i did an   ./build.sh clean before.
(In reply to Naoki Hirata :nhirata (please use needinfo instead of cc) from comment #2)
> Turns out it's because the sbin folder wasn't created.
> 

these commands from comment 2 helped me, but the symlink had to switch source and target so this helps:

cd out/target/product/aries/root/
mkdir sbin
ln -s out/target/product/aries/root/sbin/sh busybox

> 
> then rerun the VARIANT=userdebug ./build.sh -j1
ln wants the arguments to be 

ln -s real-file symlink1 symlink2 ...

or

ln -s source target

So it isn't clear to me how switching the target and source does anything useful.

If you do an ls -l on out/target/product/aries/root then sh should be a symlink to busybox (so busybox is the source and sh is the target).

> 2004 >ls -l out/target/product/aries/root/sbin
> total 1296
> -rwxrwxr-x 1 dhylands dhylands 166188 Jul 31 11:43 adbd*
> -rwxrwxr-x 1 dhylands dhylands 665916 Jul 31 11:38 busybox*
> -rwxrwxr-x 1 dhylands dhylands 198428 Jul 31 11:38 extract_elf_ramdisk*
> -rwxrwxr-x 1 dhylands dhylands 120724 Jul 31 11:43 healthd*
> -rw-rw-r-- 1 dhylands dhylands   2382 Jul 31 11:43 init.sh
> lrwxrwxrwx 1 dhylands dhylands      7 Jul 31 11:43 sh -> busybox*
> -rw-r--r-- 1 dhylands dhylands  87588 Jul 31 11:38 tad_static
> lrwxrwxrwx 1 dhylands dhylands      7 Jul 31 11:43 ueventd -> ../init
> -rw-r--r-- 1 dhylands dhylands  71204 Jul 31 11:38 wait4tad_static
> lrwxrwxrwx 1 dhylands dhylands      7 Jul 31 11:43 watchdogd -> ../init
Firefox OS is not being worked on
Status: REOPENED → RESOLVED
Closed: 5 years ago2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.