About overlays in the MPC filesystem - TheKikGen/MPC-LiveXplore GitHub Wiki
__ __| | | /_) | ___| | |
| __ \ _ \ ' / | | / | _ \ __ \ | _` | __ \ __|
| | | | __/ . \ | < | | __/ | | | ( | | |\__ \
_| _| |_|\___| _|\_\_|_|\_\\____|\___|_| _| _____|\__,_|_.__/ ____/
📁 About Overlays in the MPC Filesystem
In the Linux filesystem, an overlay filesystem combines two directories:
- An ‘upper’ filesystem
- A ‘lower’ filesystem
When a name exists in both, the object in the ‘upper’ filesystem is visible while the object in the ‘lower’ is either hidden or, in the case of directories, merged with the ‘upper’ object.
Then, whenever a lookup is requested in such a merged directory, the lookup is performed in each actual directory and the combined result is cached in the dentry belonging to the overlay filesystem. If both actual lookups find directories, both are stored and a merged directory is created. Otherwise, only one is stored: the upper if it exists, else the lower.
Still with me?
🔄 Firmware Updates & Overlays
The Akai update process replaces entirely the rootfs partition on the internal SSD: i.e., each time you update your MPC, the entire root filesystem is rewritten with the new one. Overlaying with the az01-internal rw partition on the internal disk avoids the user losing all their system settings (like WIFI configuration, Bluetooth peripherals, and for sure, SSH), while allowing updates in /etc and /var globally.
Logged into the MPC within an SSH session, if we look at mounted volumes with a mount command, we get:
(...)
overlay on /etc type overlay (rw,relatime,lowerdir=/etc,upperdir=/media/az01-internal/system/etc/overlay,workdir=/media/az01-internal/system/etc/.work)
overlay on /var type overlay (rw,relatime,lowerdir=/var,upperdir=/media/az01-internal/system/var/overlay,workdir=/media/az01-internal/system/var/.work)
(...)
💡 Note:
az01-internalis the data partition on the internal eMMC disk. The SD card is mounted to/media/az01-internal-sd.
So we have:
/var=/media/az01-internal/system/var/overlay(upper - from sdcard) +/var(lower - from ssd)/etc=/media/az01-internal/system/etc/overlay(upper - from sdcard) +/etc(lower - from ssd)
The workdir .work is an empty hidden directory on the same filesystem as upperdir caching the dentry belonging to the overlay filesystem.
🌳 The az01-internal Partition Tree
Have a closer look on the az01-internal disk partition:
cd /media/az01-internal/system
# /media/tkgl/mpcroot/bin/tree
.
|-- etc
| `-- overlay
| |-- dbus-1
| |-- group
| |-- group-
| |-- hostname
| |-- localtime -> ../usr/share/zoneinfo/Europe/Paris
| |-- machine-id
| |-- machine-info
| |-- mtab -> ../proc/self/mounts
| |-- passwd
| |-- passwd-
| |-- resolv.conf -> /run/connman/resolv.conf
| |-- shadow
| |-- shadow-
| |-- ssh
| | |-- ssh_host_dsa_key
| | |-- ssh_host_dsa_key.pub
| | |-- ssh_host_ecdsa_key
| | |-- ssh_host_ecdsa_key.pub
| | |-- ssh_host_ed25519_key
| | |-- ssh_host_ed25519_key.pub
| | |-- ssh_host_rsa_key
| | |-- ssh_host_rsa_key.pub
| | `-- sshd_config
| `-- systemd
| `-- system
| `-- multi-user.target.wants
| `-- sshd.service -> /usr/lib/systemd/system/sshd.service
`-- var
`-- overlay
|-- cache
| `-- private
|-- lib
| |-- bluetooth
| | `-- 43:39:00:00:1F:AC
| | |-- 11:22:33:43:76:57
| | | `-- info
| | |-- cache
| | | |-- 11:22:33:43:76:57
| | | |-- 58:51:00:53:3C:77
| | | |-- 74:DF:BF:A8:D4:76
| | | |-- 74:E1:B6:19:BB:02
| | | |-- A4:45:19:14:49:AB
| | | |-- C0:18:85:B6:DC:0F
| | | |-- D0:05:2A:AF:0F:6E
| | | |-- E4:22:A5:F0:CA:3E
| | | `-- E4:A9:B6:19:1A:C3
| | `-- settings
| |-- connman
| | |-- settings
| | `-- wifi_b0f1ecabe817_546f72676e65742d776972656c657373_managed_psk
| | |-- data
| | `-- settings
| |-- inMusic
| | `-- 9E0C3419-93E1-4E92-B8E3-79141B049228
| | `-- DCS_UserDefinedDeviceName.var
| |-- machines
| |-- portables
| |-- private
| |-- systemd
| | |-- backlight
| | | `-- platform-mipi-backlight:backlight:mipi-backlight
| | |-- catalog
| | | `-- database
| | |-- coredump
| | |-- random-seed
| | `-- rfkill
| | |-- platform-ff0d0000.dwmmc:wlan
| | `-- platform-ff180000.serial:bluetooth
| `-- udisks
| |-- mtab
| |-- mtab.H34IR0
| `-- mtab.ZVW2R0
|-- lock -> ../run/lock
|-- log
| |-- btmp
| |-- journal
| |-- lastlog
| |-- private
| `-- wtmp
|-- spool
`-- tmp
|-- com.akaipro.mpc.vcs-version
|-- com.akaipro.mpc.version
|-- juceAppLock_
|-- juceAppLock_MPC
|-- splicesync
`-- splicesync-log
🔒 Activating SSH Permanently
If we consider SSH for example, when sshd_config is missing on the az01-internal partition (I suppose being the "factory" default), the sshd_config from the rootfs is selected, so no SSH access is enabled. If an sshd_config exists on the az01-internal partition, it will be the one used by the sshd server, whatever the rootfs /etc/ssh conf is.
So to activate SSH, you need to either modify the sshd_config on the az01-internal partition if it exists (impossible without SSH ha ha ha ha...), or delete the file on the az01-internal partition, and modify the file of the updated image. This is what is done on modified images. This approach works for any other service managed from the /etc directory.
Step-by-step activation:
1. Stop the overlay on /etc
Because the sshd daemon is pre-started by the system before the overlay itself, it must be unmounted:
umount /etc
2. Remount the filesystem as read-write
mount -o rw,remount /
3. Enable the sshd service at boot time
Create a symbolic link in the multi-user.target.wants directory:
ln -s mpcmnt/usr/lib/systemd/system/sshd.service mpcmnt/etc/systemd/system/multi-user.target.wants/sshd.service
ℹ️ Info: The
sshd_configfile is located in the/etc/sshdirectory.