Optware / Optware-ng

279 stars 52 forks source link

install netatalk with error to create nsswitch.conf #183

Closed radiumfu closed 6 years ago

radiumfu commented 7 years ago

I try to make time machine , reference this post. http://vena.net/post/86026368825/using-an-asus-router-as-a-time-capsule

on it's step 6 require install avahi-daemon avahi-utils, but I think it just need avahi-demon, since Optware-ng only have avahi, so I tried it first.

but I getting minal error at the end.

root@router:~# /opt/bin/ipkg list | grep avahi
avahi - 0.6.32-2 - A system for multicast DNS service discovery, an implementation of Zeroconf.
libavahi-client - 0.6.32-2 - Avahi client library
libavahi-common - 0.6.32-2 - Avahi common library
libavahi-core - 0.6.32-2 - Avahi core library
libavahi-glib - 0.6.32-2 - Avahi glib library
libavahi-gobject - 0.6.32-2 - Avahi gobject library
root@router:~# /opt/bin/ipkg install avahi
Installing avahi (0.6.32-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/avahi_0.6.32-2_arm.ipk.
Installing libavahi-common (0.6.32-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libavahi-common_0.6.32-2_arm.ipk.
Installing libintl (0.19.8.1-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libintl_0.19.8.1-1_arm.ipk.
Installing libiconv (1.13.1-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libiconv_1.13.1-1_arm.ipk.
Installing libavahi-client (0.6.32-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libavahi-client_0.6.32-2_arm.ipk.
Installing libavahi-core (0.6.32-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libavahi-core_0.6.32-2_arm.ipk.
Installing libavahi-glib (0.6.32-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libavahi-glib_0.6.32-2_arm.ipk.
Installing glib (2.47.3-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/glib_2.47.3-1_arm.ipk.
Installing zlib (1.2.8-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/zlib_1.2.8-2_arm.ipk.
Installing libffi (3.2.1-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libffi_3.2.1-1_arm.ipk.
Installing gettext (0.19.8.1-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/gettext_0.19.8.1-1_arm.ipk.
Installing libunistring (0.9.4-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libunistring_0.9.4-2_arm.ipk.
Installing libavahi-gobject (0.6.32-2) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libavahi-gobject_0.6.32-2_arm.ipk.
Installing libcap (2.24-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libcap_2.24-1_arm.ipk.
Installing attr (2.4.47-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/attr_2.4.47-1_arm.ipk.
Installing libdaemon (0.14-1) on /opt/.
Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/libdaemon_0.14-1_arm.ipk.
Configuring libiconv.
Configuring libintl.
Configuring libavahi-common.
Configuring libavahi-client.
Configuring libavahi-core.
Configuring zlib.
Configuring libffi.
Configuring libunistring.
Configuring gettext.
Configuring glib.
Generating /opt/share/glib-2.0/schemas/gschemas.compiled
No schema files found: doing nothing.
Configuring libavahi-glib.
Configuring libavahi-gobject.
Configuring attr.
Configuring libcap.
Configuring libdaemon.
Configuring x11.
//opt/lib/ipkg/info/x11.postinst: line 4: can't create /etc/nsswitch.conf: Read-only file system
chmod: /etc/nsswitch.conf: No such file or directory
Configuring avahi.
Collected errors:
 * pkg_run_script: package "x11" postinst script returned status 1.
 * opkg_configure: x11.postinst returned 1.

base on the error, seems it useing wrong path, it should be /opt/etc instead, then I opennd "//opt/lib/ipkg/info/x11.postinst",

#!/bin/sh

### fix missing nsswitch.conf, so "localhost" will resolve correctly
test -e /etc/nsswitch.conf || ( echo "hosts: files dns" >/etc/nsswitch.conf ; chmod a+r /etc/nsswitch.conf )

I replaced all /etc/ with /opt/etc/ , created nsswitch.conf under /opt/etc

then try start avahi-daemon, no luck.

root@router:/opt/etc/avahi/services# /opt/etc/init.d/S68avahi-daemon start
Starting the Avahi Daemon
root@router:/opt/etc/avahi/services# ps | grep avahi
 9618 root      1832 S    grep avahi
root@router:/opt/etc/avahi/services# /opt/etc/init.d/S68avahi-daemon reload
Reloading the Avahi Daemon
Failed to kill daemon: No such file or directory
sydneyjd commented 7 years ago

This is partially unrelated, but I was unable to get X11 to install properly(A MPD dep requires it for some reason), and changing the code does definately cause it to install correctly. test -e /etc/nsswitch.conf || ( echo "hosts: files dns" >/etc/nsswitch.conf ; chmod a+r /etc/nsswitch.conf ) test -e /etc/nsswitch.conf || ( echo "hosts: files dns" >/opt/etc/nsswitch.conf ; chmod a+r /opt/etc/nsswitch.conf )

alllexx88 commented 7 years ago

I believe, 853314f47f102c7e9c2d98593313f0030069a7fe should fix this. The change fixes avahi daemon trying to create /run/avahi-daemon dir, which usually fails on routers dut to read-only rootfs, and makes the daemon use /opt/var/run/avahi-daemon instead.

Also, since c5705651deb3896297b1378af909ffc37b75eb98, avahi doesn't depend on x11.

If you're still with me, please confirm this fixed