[Android Q&A, Help & Troubleshooting] Mortifix:
Hi, I am trying to make a custom stock rom for the SM-G925T. I have extracted the system.img from the new 6.0.1 stock MD5 firmware and used Rickeys Rom Kitchen to build the rom. I left pretty much everything stock except for changing the permissions from metadata to permission. After doing this I used the program to build the META-INF and installed Aroma. I am trying to flash the rom, but I am running into some issues. Here is a copy of my updater-script as well as the error log I am getting.

UPDATER-SCRIPT

ui_print("******************************************");
ui_print(" Installing Stock");
ui_print("******************************************");
ui_print(" BROUGHT TO YOU BY RICKYS KITCHEN");
ui_print(" BY RICKY310711");

unmount("/system");
ui_print("Mounting System");
run_program("/sbin/mount", "-t", "auto", "/system");
ui_print("Mounting Data");
run_program("/sbin/mount", "-t", "auto", "/data");
ui_print("Mounting Cache");
run_program("/sbin/mount", "-t", "auto", "/cache");

##BACKUPAPPSLINE##ui_print("Backing up apps");
##BACKUPAPPSLINE##package_extract_file("tmp/appbackup.sh", "/tmp/appbackup.sh");
##BACKUPAPPSLINE##set_perm(0, 0, 0777, "/tmp/appbackup.sh");
##BACKUPAPPSLINE##set_perm(0, 0, 0755, "/tmp/busybox");
##BACKUPAPPSLINE##run_program("/tmp/appbackup.sh");

ui_print("Wiping System");
delete_recursive("/system");
##WIPELINE1##ui_print("Wiping Data");
##WIPELINE1##package_extract_file("tmp/safewipe.sh", "/tmp/safewipe.sh");
##WIPELINE1##package_extract_file("tmp/bash", "/tmp/bash");
##WIPELINE1##set_perm(0, 0, 0777, "/tmp/safewipe.sh");
##WIPELINE1##set_perm(0, 0, 0777, "/tmp/bash");
##WIPELINE1##run_program("/tmp/safewipe.sh");
##WIPELINE2##ui_print("Wiping Cache");
##WIPELINE2##delete_recursive("/cache");

ui_print("Extracting System");
package_extract_dir("system", "/system");
##DATALINE##ui_print("Extracting Data");
##DATALINE##package_extract_dir("data", "/data");

ui_print("Symlinking");
symlink("dumpstate", "/system/bin/dumpcrash");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("logcat", "/system/bin/lolcat");
symlink("mksh", "/system/bin/sh");
symlink("app_process32", "/system/bin/app_process");
symlink("dalvikvm32", "/system/bin/dalvikvm");
symlink("debuggerd", "/system/bin/csview");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/chcon");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/clear");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/cp");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/du");
symlink("toolbox", "/system/bin/getenforce");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/getsebool");
symlink("toolbox", "/system/bin/grep");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/load_policy");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/md5");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/playback");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/restorecon");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/runcon");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/setenforce");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/setsebool");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/touchinput");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/wipe");
symlink("wiperiface_v02", "/system/bin/wiperiface");
symlink("/system/lib/libnfc_nci_jni.so", "/system/app/NfcNci/lib/arm/libnfc_nci_jni.so");
symlink("/system/lib/libprintspooler_jni.so", "/system/app/SPrintSpooler/lib/arm/libprintspooler_jni.so");
symlink("/system/lib/libsbrowser.so", "/system/app/SBrowser/lib/arm/libsbrowser.so");
symlink("/system/lib/libssecv8.so", "/system/app/SBrowser/lib/arm/libssecv8.so");
symlink("/system/lib/libstlport_sh_521.so", "/system/app/SBrowser/lib/arm/libstlport_sh_521.so");
symlink("/system/lib/libwbs.so", "/system/app/SBrowser/lib/arm/libwbs.so");
symlink("/system/lib/libbluetooth_jni.so", "/system/app/Bluetooth/lib/arm/libbluetooth_jni.so");
symlink("/system/lib/libcommonpawrapper.so", "/system/app/RootPA/lib/arm/libcommonpawrapper.so");
symlink("/system/lib/libjni_emailencryption.so", "/system/app/SecEmail_K/lib/arm/libjni_emailencryption.so");
symlink("/system/lib/libjni_pacprocessor.so", "/system/app/PacProcessor/lib/arm/libjni_pacprocessor.so");
symlink("/system/lib/libloadStylusCore.so", "/system/app/SamsungIME/lib/arm/libloadStylusCore.so");
symlink("/system/lib/libdefcontainer_jni.so", "/system/priv-app/DefaultContainerService/lib/arm/libdefcontainer_jni.so");

ui_print("Setting Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0755, 0644, "/system/bin");
set_perm_recursive(0, 0, 0755, 0644, "/system/etc/init.d");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/init.d");
set_perm_recursive(0, 0, 0755, 0644, "/system/lib");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 2000, 0755, "/system/bin/androidshmservice");
set_perm(0, 2000, 0755, "/system/bin/apaservice");
set_perm(0, 2000, 0755, "/system/bin/app_process");
set_perm(0, 2000, 0755, "/system/bin/at_distributor");
set_perm(0, 2000, 0755, "/system/bin/auditd");
set_perm(0, 2000, 0755, "/system/bin/bintvoutservice");
set_perm(0, 2000, 0755, "/system/bin/bootchecker");
set_perm(0, 2000, 0755, "/system/bin/bootanimation");
set_perm(0, 2000, 0755, "/system/bin/bugreport");
set_perm(0, 2000, 0755, "/system/bin/charon");
set_perm(0, 2000, 0755, "/system/bin/clatd");
set_perm(0, 2000, 0755, "/system/bin/connfwexe");
set_perm(0, 2000, 0755, "/system/bin/cs");
set_perm(0, 2000, 0755, "/system/bin/debuggerd");
set_perm(0, 2000, 0755, "/system/bin/dnsmasq");
set_perm(0, 2000, 0755, "/system/bin/drmserver");
set_perm(0, 2000, 0755, "/system/bin/dumpstate");
set_perm(0, 2000, 0755, "/system/bin/dumpsys");
set_perm(0, 2000, 0755, "/system/bin/hostapd");
set_perm(0, 2000, 0755, "/system/bin/icd");
set_perm(0, 2000, 0755, "/system/bin/installd");
set_perm(0, 2000, 0755, "/system/bin/insthk");
set_perm(0, 1000, 0750, "/system/bin/iptables");
set_perm(0, 2000, 0755, "/system/bin/jackservice");
set_perm(0, 2000, 0755, "/system/bin/keystore");
set_perm(0, 2000, 0755, "/system/bin/logwrapper");
set_perm(0, 2000, 0755, "/system/bin/mcDriverDaemon");
set_perm(0, 2000, 0755, "/system/bin/mdnsd");
set_perm(0, 2000, 0755, "/system/bin/mediaserver");
set_perm(0, 2000, 0755, "/system/bin/mtpd");
set_perm(0, 2000, 0755, "/system/bin/netd");
set_perm(0, 2000, 0755, "/system/bin/npsmobex");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 0755, "/system/bin/pppd");
set_perm(0, 2000, 0755, "/system/bin/prepare_param.sh");
set_perm(0, 2000, 0755, "/system/bin/racoon");
set_perm(0, 2000, 0755, "/system/bin/rild");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(0, 2000, 0755, "/system/bin/samsungpowersoundplay");
set_perm(0, 2000, 0755, "/system/bin/sdcard");
set_perm(0, 2000, 0755, "/system/bin/secure_storage_daemon");
set_perm(0, 2000, 0755, "/system/bin/sensorhubservice");
set_perm(0, 2000, 0755, "/system/bin/servicemanager");
set_perm(0, 2000, 0755, "/system/bin/smdexe");
set_perm(0, 2000, 0755, "/system/bin/ss_conn_daemon");
set_perm(0, 2000, 0755, "/system/bin/surfaceflinger");
set_perm(0, 1000, 0750, "/system/bin/tc ");
set_perm(0, 2000, 0755, "/system/bin/tima_dump_log");
set_perm(0, 2000, 0755, "/system/bin/vold");
set_perm(0, 2000, 0755, "/system/bin/wpa_supplicant");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/etc");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/BargeIn");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/mVoIP");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/mVoIPFMC");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/mVoIPSec");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm(0, 2000, 0755, "/system/vendor/lib/egl");
set_perm(0, 2000, 0755, "/system/vendor/lib/mediadrm");
set_perm(0, 0, 0644, "/system/vendor/lib/mediadrm/libwvdrmengine.so");
set_perm(0, 2000, 0755, "/system/vendor/media");
set_perm(0, 2000, 06755, "/system/xbin/debuggerd");

##ROOTLINE##ui_print("Initializing Root");
##ROOTLINE##set_perm(0, 0, 06755, "/system/xbin/su");
##ROOTLINE##set_perm(0, 0, 06755, "/system/xbin/supolicy");
##ROOTLINE##set_perm(0, 0, 06755, "/system/xbin/daemonsu");
##ROOTLINE##set_perm(0, 0, 0777, "/system/bin/.ext");
##ROOTLINE##set_perm(0, 0, 06755, "/system/system/bin/.ext/.su");
##ROOTLINE##set_perm(0, 0, 0755, "/system/etc/install-recovery.sh");
##ROOTLINE##set_perm(0, 0, 0755, "/system/etc/init.d/99SuperSUDaemon");
##ROOTLINE##set_perm(0, 0, 0644, "/system/etc/.installed_su_daemon");
##ROOTLINE##set_perm(0, 0, 0644, "/system/app/Superuser.apk");
##ROOTLINE##run_program("/system/xbin/su", "--install");

##BUSYBOXLINE##ui_print("Installing Busybox");
##BUSYBOXLINE##symlink("/system/xbin/busybox", "/system/bin/busybox");
##BUSYBOXLINE##run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");

##BACKUPAPPSLINE##ui_print("Restoring Apps");
##BACKUPAPPSLINE##package_extract_file("tmp/apprestore.sh", "/tmp/apprestore.sh");
##BACKUPAPPSLINE##set_perm(0, 0, 0777, "/tmp/apprestore.sh");
##BACKUPAPPSLINE##run_program("/tmp/apprestore.sh");

ui_print("Unpacking Kernel");
package_extract_file("boot.img", "/dev/block/platform/15570000.ufs/by-name/boot");

ui_print("******************************************");
ui_print(" Successfully Installed");
ui_print("******************************************");
set_progress(1.0);

ERROR LOG

AROMA INSTALLER version 3.00
(c) 2013-2015 by amarullz.com

ROM Name : Stock
ROM Version : 1.0
ROM Author : Mortifix
Device : SM-G925T
Start at : Sat Apr 16 22:57:59 2016

installing samsung updater extensions
******************************************
Installing Stock
******************************************
BROUGHT TO YOU BY RICKYS KITCHEN
BY RICKY310711
unmount of /system failed; no such volume
Mounting System
about to run program [/sbin/mount] with 4 args
Mounting Data
about to run program [/sbin/mount] with 4 args
mount: mounting /dev/block/sda17 on /data failed: Device or resource busy
run_program: child exited with status 255
Mounting Cache
about to run program [/sbin/mount] with 4 args
mount: mounting /dev/block/sda16 on /cache failed: Device or resource busy
run_program: child exited with status 255
Wiping System

Extract: /system/vendor/etc/nxp/WifiCallingHAC/Rx_ControlParams_NARROWBAND_SPEAKER.txt
Extract: /system/vendor/etc/nxp/WifiCallingHAC/Rx_ControlParams_NARROWBAND_WIRED_HEADPHONE.txt

Symlinking
symlink(): created [/system/app/NfcNci/lib/arm]
symlink(): created [/system/app/SPrintSpooler]
symlink(): created [/system/app/SPrintSpooler/lib]
symlink(): created [/system/app/SPrintSpooler/lib/arm]
symlink(): created [/system/app/SBrowser]
symlink(): created [/system/app/SBrowser/lib]
symlink(): created [/system/app/SBrowser/lib/arm]
symlink(): created [/system/app/SecEmail_K]
symlink(): created [/system/app/SecEmail_K/lib]
symlink(): created [/system/app/SecEmail_K/lib/arm]
symlink(): created [/system/app/PacProcessor/lib/arm]
symlink(): created [/system/app/SamsungIME]
symlink(): created [/system/app/SamsungIME/lib]
symlink(): created [/system/app/SamsungIME/lib/arm]
symlink(): created [/system/priv-app/DefaultContainerService/lib/arm]
Setting Permissions
set_perm: chown of /system/bin/tc to 0 1000 failed: No such file or directory
set_perm: chmod of /system/bin/tc to 750 failed: No such file or directory
script aborted: set_perm: some changes failed
set_perm: some changes failed

Installer Error (Status 7)

End at : Sat Apr 16 22:59:04 2016

(Had to shorten installation log, I have attached the full log)

I have tried removing the /system/bin/tc permisson entry but I get another error for /system/bin/debuggered which I removed as well. After doing this, the rom installed with no errors but after it reboot, it didn't go past the bootlogo. I have wiped all partitions and reformatted multiple times, but it will not go past the bootlogo. Now one thing I noticed is the permissions for those 2 files are different then the rest so I tried changing them to 0755 but that didn't make any difference.

Any suggestions on how to resolve this problem?

EDIT: I removed aroma and recreated the meta-inf using metadata permissions and everything installed successfully, however, after I reboot it will go past the bootlogo but the screen just turns black. I rebooted into TWRP and there is nothing in the system folder so it looks like nothing was copied.

I:Copying file /cache/recovery/log to /cache/recovery/last_log
tw_get_context got selinux context: u:object_r:media_rw_data_file:s0
I:Got default contexts and file mode for storage files.
I:Attempt to load settings from settings file...
I:InfoManager file '/data/media/0/TWRP/.twrps' not found.
I:Backup folder set to '/data/media/0/TWRP/BACKUPS/03157df32a81bf06'
I:Copying file /etc/recovery.fstab to /cache/recovery/recovery.fstab
I:Version number saved to '/cache/recovery/.version'
I:Can't probe device /dev/block/sda
I:Unable to mount '/usb-otg'
I:Actual block device: '/dev/block/sda', current file system: 'vfat'
__bionic_open_tzdata: couldn't find any tzdata when looking for CST6CDT,M3.2.0,M11.1.0!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
I:TWFunc::Set_Brightness: Setting brightness control to 255
I:PageManager::LoadFileToBuffer loading filename: '/twres/languages/en.xml' directly
parsing languageFile
parsing languageFile done
I:Translating partition display names
I:Backup folder set to '/data/media/0/TWRP/BACKUPS/03157df32a81bf06'
I:TWFunc::Fixup_Time: Pre-fix date and time: 2016-04-17--05-19-02
I:TWFunc::Fixup_Time: Setting time offset from file /sys/class/rtc/rtc0/since_epoch
I:TWFunc::Fixup_Time: Date and time corrected: 2016-04-17--05-19-02
I:Enabling MTP during startup
I:Starting MTP
Starting MTP
I:sending message to add 65537 '/data/media/0' 'Internal Storage'
I:Message sent, add storage ID: 65537
I:Can't probe device /dev/block/sda
I:Unable to mount '/usb-otg'
I:Actual block device: '/dev/block/sda', current file system: 'vfat'
MTP Enabled
I:Switching packages (TWRP)
I:Set page: 'system_readonly'
Using '/dev/usb_mtp_gadget' for MTP device.
created new mtpserver object
MtpServer::run fd: 31
mtppipe add storage 65537 '/data/media/0'
MtpStorage id: 65537 path: /data/media/0
I:Is_Mounted: Unable to find partition for path '/vendor'
I:operation_start: 'Toggle System Mount'
I:operation_end - status=1
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Switching packages (TWRP)
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'advanced'
I:Set page: 'confirm_action'
I:Set page: 'action_page'
I:operation_start: 'Copy Log'
I:Copying file /tmp/recovery.log to /data/media/0/recovery.log
Copied recovery log to /data/media/0.
I:Set page: 'action_complete'
I:operation_end - status=0
I:Set page: 'clear_vars'
I:Set page: 'advanced'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'install'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'mount'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
I:operation_start: 'Flashing'
Installing zip file '/sdcard/0/TWRP/stock.zip'
Checking for MD5 file...
Skipping MD5 check: no MD5 file found
I:Zip does not contain SELinux file_contexts file in its root.
I:Legacy property environment initialized.
******************************************unmount of /system failed; no such volume
about to run program [/sbin/mount] with 4 args

Installing stock
******************************************
BROUGHT TO YOU BY RICKYS KITCHEN
BY RICKY310711
Mounting System
about to run program [/sbin/mount] with 4 args
Mounting Data
mount: mounting /dev/block/sda17 on /data failed: Device or resource busy
run_program: child exited with status 255
about to run program [/sbin/mount] with 4 args
Mounting Cache
mount: mounting /dev/block/sda16 on /cache failed: Device or resource busy
run_program: child exited with status 255
Wiping System
Extracting System
I:TWFunc::Set_Brightness: Setting brightness control to 5
minzip: Extracted 3817 file(s)
Symlinking
symlink(): created [/system/app/NfcNci/lib/arm]
symlink(): created [/system/app/SPrintSpooler]
symlink(): created [/system/app/SPrintSpooler/lib]
symlink(): created [/system/app/SPrintSpooler/lib/arm]
symlink(): created [/system/app/SBrowser]
symlink(): created [/system/app/SBrowser/lib]
symlink(): created [/system/app/SBrowser/lib/arm]
symlink(): created [/system/app/SecEmail_K]
symlink(): created [/system/app/SecEmail_K/lib]
symlink(): created [/system/app/SecEmail_K/lib/arm]
symlink(): created [/system/app/PacProcessor/lib/arm]
symlink(): created [/system/app/SamsungIME]
symlink(): created [/system/app/SamsungIME/lib]
symlink(): created [/system/app/SamsungIME/lib/arm]
symlink(): created [/system/priv-app/DefaultContainerService/lib/arm]
Setting Metadata
Unpacking Kernel
******************************************
Successfully Installed
******************************************
Generated by Rickys Rom Kitchen I:Updater process ended with RC=0
I:Legacy property environment disabled.
Updating partition details...
I:Data backup size is 2MB, free: 53880MB.
I:Can't probe device /dev/block/sda
I:Unable to mount '/usb-otg'
I:Actual block device: '/dev/block/sda', current file system: 'vfat'
...done
I:Set page: 'flash_done'
I:TWFunc::Set_Brightness: Setting brightness control to 255
I:operation_end - status=0
I:Set page: 'clear_vars'
I:Set page: 'install'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'advanced'
I:Set page: 'confirm_action'
I:Set page: 'action_page'
I:operation_start: 'Copy Log'
I:Copying file /tmp/recovery.log to /data/media/0/recovery.log