unifi-utilities / unifios-utilities

A collection of enhancements for UnifiOS based devices
GNU General Public License v3.0
3.86k stars 415 forks source link

Has /mnt/data changed to /data? #402

Closed rcambrj closed 1 year ago

rcambrj commented 1 year ago

Describe the bug In #401 I describe that a file which others appear to expect at /mnt/data/udapi-config/ubios-udapi-server/ubios-udapi-server.state, but on my UDMSE is located at /data/udapi-config/ubios-udapi-server/ubios-udapi-server.state

Does this indicate a critical change in how UDMSE is architected? Did it change in a recent update? Is it nothing to be concerned about? I only just installed the on_boot.d tools, so I have no idea whether my /mnt/data stuff is going to survive a firmware update.

To Reproduce

root@UDM-SE:~# ls /mnt/data/udapi-config/ubios-udapi-server/ubios-udapi-server.state
ls: cannot access '/mnt/data/udapi-config/ubios-udapi-server/ubios-udapi-server.state': No such file or directory

Expected behavior Unclear.

Screenshots N/A

UDM Information

Additional context

root@UDM-SE:~# ls -la /mnt/data
total 28
drwxr-xr-x 7 root root 4096 Aug 14 14:27 ./
drwxr-xr-x 1 root root 4096 May 31 04:01 ../
drwxr-xr-x 3 root root 4096 Aug 14 13:04 .cache/
drwxr-xr-x 2 root root 4096 Aug 14 15:06 on_boot.d/
drwxr-xr-x 3 root root 4096 Aug 14 13:04 podman/
drwxr-xr-x 2 root root 4096 Aug 14 15:11 scripts/
drwxr-xr-x 2 root root 4096 May 31 04:00 ulcmd/
root@UDM-SE:~# ls -la /data
total 52
drwxr-xr-x 10 root       root        4096 Aug 14 14:41 ./
drwxr-xr-x  1 root       root        4096 Aug 11 18:10 ../
-rw-r--r--  1 root       root           0 Aug 14 15:07 .postgresql.no_need_to_migrate
-rw-r--r--  1 root       root           0 Aug 14 15:07 .unifi-protect.no_need_to_migrate
-rw-r--r--  1 root       root           0 Aug 14 15:07 .unifi.no_need_to_migrate
drwxr-xr-x 40 root       root        4096 Aug 14 12:15 dpi-tracer/
drwx------  2 root       root       16384 May 31 04:00 lost+found/
lrwxrwxrwx  1 root       root          17 May 31 04:00 postgresql -> /ssd1/.postgresql/
drwxr-xr-x  3 root       root        4096 Jul 22 14:03 udapi-config/
drwxr-xr-x  2 root       root        4096 Jul 18 19:15 ui-db/
drwxr-xr-x  5 ulp-go     ulp-go      4096 Aug 14 15:08 ulp-go/
lrwxrwxrwx  1 root       root          12 Jul 19 03:21 unifi -> /ssd1/.unifi/
drwxr-xr-x  8 root       root        4096 Aug 14 15:08 unifi-core/
lrwxrwxrwx  1 root       root          20 Aug  7 15:33 unifi-protect -> /ssd1/.unifi-protect/
drwxrwx---  9 strongswan freeswitch  4096 Jul 19 03:23 unifi-talk/
drwxr-xr-x  3 root       root        4096 May 31 04:00 wifiman-server/
root@UDM-SE:~# lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0       7:0    0 828.5M  1 loop /mnt/.rofs
sda         8:0    0 119.2G  0 disk
├─sda1      8:1    0   512M  0 part
├─sda2      8:2    0     7G  0 part [SWAP]
└─sda5      8:5    0 111.2G  0 part /ssd1
mtdblock0  31:0    0   1.8M  0 disk
mtdblock1  31:1    0    64K  0 disk
mtdblock2  31:2    0    64K  0 disk
mtdblock3  31:3    0    64K  1 disk
mtdblock4  31:4    0    64K  1 disk
mtdblock5  31:5    0     6M  0 disk
boot      135:0    1  14.6G  0 disk
├─boot1   135:1    1    64M  0 part
├─boot2   135:2    1    32M  0 part
├─boot3   135:3    1     2G  0 part /boot/firmware
├─boot4   135:4    1     1G  0 part /var/log
├─boot5   135:5    1     4G  0 part /data
├─boot6   135:6    1     2G  0 part /persistent
└─boot7   135:7    1   5.5G  0 part /mnt/.rwfs

cc @opustecnica

an9rch1st commented 1 year ago

+1 - can also confirm on a vanilla UDM SE following the OS version previous to 2.5.11 there is no /mnt/data, everything is now in /data

I had to create a symbolic link for /mnt/data to /data for many of the items I had previously installed on reinstall after flattening and restoring to default to test what the default mounts and filesystem layout was such as peacey's split VPN and others as many of the scripts, systemctl etc hard code to /mnt/data. If I didnt have the symbolic link there were things getting created in /mnt/data but not /data, OS upgrade I lost /mnt/data and so on....

lbreggi commented 1 year ago

Maybe that's the reason why I can't make neither PiHole or AdGuard to work on my UDR?

alxwolf commented 1 year ago

To my knowledge, right now the UDM/P or UXG-Pro use /mnt/data and UDR and UDM-SE use /data.

lbreggi commented 1 year ago

I can share my UDR if someone is wiling to help!

bostonaholic commented 1 year ago

Can confirm on my UDM SE.

root@UDM-SE:~# info

Model:       UniFi Dream Machine SE
Version:     2.5.11.7956
MAC Address: <REDACTED>
IP Address:  <REDACTED>
Hostname:    UDM-SE
Uptime:      2373436 seconds

Status:      Connected (http://localhost:8080/inform)
root@UDM-SE:~# ls /mnt/data/udapi-config/ubios-udapi-server/ubios-udapi-server.state
ls: cannot access '/mnt/data/udapi-config/ubios-udapi-server/ubios-udapi-server.state': No such file or directory
root@UDM-SE:~# ls /data/udapi-config/ubios-udapi-server/ubios-udapi-server.state
/data/udapi-config/ubios-udapi-server/ubios-udapi-server.state
PsychoRS commented 1 year ago

To my knowledge, right now the UDM/P or UXG-Pro use /mnt/data and UDR and UDM-SE use /data.

Maybe the upcoming UniFi OS 2.0 update for UDM Base and UDM Pro will change that in the same sense as UDR and UDM-SE?

From the latest EA Firmware (1.12.30, 3 days ago) for UDM Base and UDM Pro: An upcoming version of UDM/UDM-Pro will migrate to UniFi OS 2.x. The process is currently being well-tested internally and will be released shortly, with no specific ETA.

NathanKun commented 1 year ago

I've noticed on my UDR the udm-boot.service is still searching on boot scripts in /mnt/data/on_boot.d

ExecStart=bash -c 'mkdir -p /mnt/data/on_boot.d && find -L /mnt/data/on_boot.d -mindepth 1 -maxdepth 1 -type f -print0 | sort -z | xargs -0 -r -n 1 -- bash -c \'if test -x "$0"; then echo "%n: running $0"; "$0"; else case "$0" in *.sh) echo "%n: sourcing $0"; . "$0";; *) echo "%n: ignoring $0";; esac; fi\''

I had to change it to /data/on_boot.d to make it work.

ewpratten commented 1 year ago

My UDM Pro is on 2.x and now uses /data fyi

root@DreamMachinePro:~# uname -a
Linux DreamMachinePro 4.19.152-ui-alpine #4.19.152 SMP Thu Jan 19 14:13:14 CST 2023 aarch64 GNU/Linux
cardoe commented 1 year ago

Yeah it seems like most scripts will need to have this snippet from https://github.com/unifi-utilities/unifios-utilities/blob/803e077f5df440fffe0dd26618214d5452dce1d3/on-boot-script/remote_install.sh at the top always now.

DATA_DIR="/mnt/data"
case "$(ubnt-device-info firmware || true)" in
    1*)
      DATA_DIR="/mnt/data"
      ;;
    2*)
      DATA_DIR="/data"
      ;;
    3*)
      DATA_DIR="/data"
      ;;
    *)
      echo "ERROR: No persistent storage found." 1>&2
      exit 1
      ;;
  esac
bruvv commented 1 year ago

https://github.com/unifi-utilities/unifios-utilities/pull/491