7.6. Create essential system files

Create baseline compatibility links, host identity files, account databases, temporary directories, and initial log files inside chroot.

Goal: create mtab, hosts, passwd, and group, then add a test user, create temporary directories, and initialize core log files with usable default modes. If ownership tools are not yet available in the chroot, defer the utmp group assignment until later.

Run these commands as root inside chroot.

Create mtab compatibility link

ln -s /system/processes/self/mounts /system/configuration/mtab

Create hosts

printf '127.0.0.1  localhost %s\n::1        localhost\n' "<your_hostname>" > /system/configuration/hosts

Create passwd

printf '%s\n' \
"root:x:0:0:root:/system/charlie:/bin/oksh" \
"bin:x:1:1:bin:/dev/null:/system/binaries/false" \
"daemon:x:6:6:Daemon User:/dev/null:/system/binaries/false" \
"messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/system/binaries/false" \
"uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/system/binaries/false" \
"nobody:x:65534:65534:Unprivileged User:/dev/null:/system/binaries/false" \
> /system/configuration/passwd

Create group

printf '%s\n' \
"root:x:0:" \
"bin:x:1:daemon" \
"sys:x:2:" \
"kmem:x:3:" \
"tape:x:4:" \
"tty:x:5:" \
"daemon:x:6:" \
"floppy:x:7:" \
"disk:x:8:" \
"lp:x:9:" \
"dialout:x:10:" \
"audio:x:11:" \
"video:x:12:" \
"utmp:x:13:" \
"clock:x:14:" \
"cdrom:x:15:" \
"adm:x:16:" \
"messagebus:x:18:" \
"input:x:24:" \
"mail:x:34:" \
"kvm:x:61:" \
"uuidd:x:80:" \
"wheel:x:97:" \
"users:x:999:" \
"nogroup:x:65534:" \
> /system/configuration/group

Add test user and create its home

echo "tester:x:101:101::/system/users/tester:/bin/oksh" >> /system/configuration/passwd
echo "tester:x:101:" >> /system/configuration/group
mkdir -p /system/users/tester

Create temporary directories

install -d -m 1777 /tmp /system/variable/tmp

Initialize core log files

mkdir -p /system/variable/log

touch /system/variable/log/btmp \
      /system/variable/log/lastlog \
      /system/variable/log/faillog \
      /system/variable/log/wtmp

chmod 664 /system/variable/log/lastlog
chmod 600 /system/variable/log/btmp

Quick verification

ls -l /system/configuration/hosts \
      /system/configuration/passwd \
      /system/configuration/group \
      /system/configuration/mtab

grep '^tester:' /system/configuration/passwd /system/configuration/group

ls -ld /tmp /system/variable/tmp

ls -l /system/variable/log/btmp \
      /system/variable/log/lastlog \
      /system/variable/log/faillog \
      /system/variable/log/wtmp

Command Explanations