[Android Q&A, Help & Troubleshooting] gyroheli:
Hello,

I'm having problems that seem to be related to the init process. I'm working on a ROM and it works fine if I install Magisk it works so I've been comparing the kernel logs between the two. I think I've narrowed it down to the file systems not being mounted properly. As that's the point where things start to diverge, and my ROM just never ends up booting.

So I want to be able to see what is actually being used to mount the filesystem. It'd also help if it printed the lines of the *.rc files that were being executed. But basically I think it is executing this init.target.rc:

on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
mount_all /vendor/etc/fstab.qcom
chown root system /mnt/vendor/persist
chmod 0771 /mnt/vendor/persist
restorecon_recursive /mnt/vendor/persist
mkdir /mnt/vendor/persist/data 0700 system system

on post-fs
# set RLIMIT_MEMLOCK to 64MB
setrlimit 8 67108864 67108864

start vendor.qseecomd
exec - system system -- /vendor/bin/init.qti.qseecomd.sh
write /dev/ipa 1

As can seen in the not working log:

init: wait for '/dev/block/platform/soc/7c4000.sdhci' took 0ms <<<<<<<------- here "on fs"
EXT4-fs (mmcblk0p59): Ignoring removed nomblk_io_submit option
EXT4-fs (mmcblk0p59): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit
e2fsck: e2fsck 1.43.3 (04-Sep-2016)\x0a
e2fsck: /dev/block/bootdevice/by-name/userdata: clean, 14/3317760 files, 287044/13252599 blocks\x0a
EXT4-fs (mmcblk0p59): mounted filesystem with ordered data mode. Opts: barrier=1,noauto_da_alloc,discard,lazytime
e2fsck: e2fsck 1.43.3 (04-Sep-2016)\x0a
e2fsck: Pass 1: Checking inodes, blocks, and sizes\x0a
e2fsck: Pass 2: Checking directory structure\x0a
e2fsck: Pass 3: Checking directory connectivity\x0a
e2fsck: Pass 4: Checking reference counts\x0a
e2fsck: Pass 5: Checking group summary information\x0a
e2fsck: /dev/block/bootdevice/by-name/cache: 18/65536 files (0.0% non-contiguous), 6214/65536 blocks\x0a
EXT4-fs (mmcblk0p20): mounted filesystem with ordered data mode. Opts: barrier=1
e2fsck: e2fsck 1.43.3 (04-Sep-2016)\x0a
EXT4-fs (mmcblk0p42): mounted filesystem with ordered data mode. Opts: barrier=1
init: 7 output lines suppressed due to ratelimiting
audit: type=1400 audit(12680376.000:3): avc: denied { setattr } for pid=476 comm="init" name="mmcblk0p5" dev="tmpfs" ino=22548 scontext=u:r:vendor_init:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=1
logd.auditd: start
logd.klogd: 3504139670
binder: 509:509 ioctl 4018620d 7fdf6e8190 returned -22
PMI: smblib_handle_typec_cc_state_change: IRQ: cc-state-change; Type-C SOURCE_DEFAULT detected
PMI: smblib_handle_typec_cc_state_change: IRQ: cc-state-change; Type-C SOURCE_DEFAULT detected
QSEECOM: qseecom_register_listener: Service 8192 is registered
...

vdc: Waited 30ms for vold
vdc: Failed: Status(-8): '0: '

Compared to the working log:

init: wait for '/dev/block/platform/soc/7c4000.sdhci' took 0ms
EXT4-fs (mmcblk0p56): mounted filesystem with ordered data mode. Opts: barrier=1
EXT4-fs (mmcblk0p20): mounted filesystem with ordered data mode. Opts: barrier=1
EXT4-fs (mmcblk0p42): mounted filesystem with ordered data mode. Opts: barrier=1
audit: type=1400 audit(12534039.483:4): avc: denied { setattr } for pid=479 comm="init" name="mmcblk0p5" dev="tmpfs" ino=23557 scontext=u:r:vendor_init:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=1
logd.auditd: start
logd.klogd: 4025458316
binder: 509:509 ioctl 4018620d 7fe26915c0 returned -22
QSEECOM: qseecom_register_listener: Service 8192 is registered
...

vdc: Waited 10ms for vold <<<--- note no fail log here

...

It seems to be trying to mount mmcblk0p59 for some reason, and it never does mount mmcblk0p56.

Then here is the fstab:

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/bootdevice/by-name/system / ext4 ro,barrier=1,discard wait,avb
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,noatime,nodev,barrier=1,noauto_da_alloc,discard,lazytime wait,check,forceencrypt=footer,quota,reservedsize=128M
/dev/block/bootdevice/by-name/cache /cache ext4 nosuid,noatime,nodev,barrier=1 wait
/devices/platform/soc/8804000.sdhci/mmc_host* auto auto defaults wait,voldmanaged=sdcard1:auto
/devices/platform/soc/1da4000.ufshc_card/host* auto auto defaults wait,voldmanaged=sdcard1:auto
/dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=0,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
/dev/block/bootdevice/by-name/dsp /vendor/dsp ext4 ro,nosuid,nodev,barrier=1 wait
/dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 nosuid,noatime,nodev,barrier=1 wait
/dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
/devices/platform/soc/a600000.ssusb/a600000.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto

Not sure what is happening, and it seems to be mounting the fstab strangely, or I'm not sure what it is doing. If I could get more detailed logs of what the `mount_all` is doing from init.target.rc, it would definitely help. I'm not sure how I can do that though.

Any ideas or suggestions of what I can try would be appreciated, thank you!