[OpenIndiana-discuss] Split-root installations

Lionel Cons lionelcons1972 at gmail.com
Wed Nov 27 22:40:39 UTC 2013


On 27 November 2013 00:34, Lionel Cons <lionelcons1972 at gmail.com> wrote:
> On 26 November 2013 19:23, Irek Szczesniak <iszczesniak at gmail.com> wrote:
>> On Tue, Nov 26, 2013 at 7:07 PM, Jim Klimov <jimklimov at cos.ru> wrote:
>>> On 2013-11-26 17:25, Jim Klimov wrote:
>>>>
>>>> On 2013-11-17 03:50, Jim Klimov wrote:
>>>>>
>>>>>    For years I've mentioned "split-root" installations of Solaris-like
>>>>> systems in such a way that the root filesystem (the BE) is represented
>>>>> by several datasets, such as a split-off /usr dataset. Also there may
>>>>> be some datasets shared between boot environments, such as the sinks
>>>>> for logs and crashdumps, and not all of these are required to live on
>>>>> the rpool at all. There are cases when all such tweaks may be desirable.
>>>>
>>>>
>>>> WARNING
>>>>
>>>> As discussed in another thread, it was discovered that the SMF methods
>>>> for network/physical (both :default and :nwam) use many programs from
>>>> /usr, and are executed before the /usr filesystem is actually mounted
>>>> in case of a split-root installation. This tanks the NWAM setups, but
>>>> the default ones (based on static files in /etc) succeeds for both DHCP
>>>> and completely static addressing.
>>>>
>>>> I hope to fix this somehow, but a head-on approach failed: the "root"
>>>> filesystem and other FS services depend on svc:/system/identity:node
>>>> (indirectly via svc:/system/metainit:default) and that depends on
>>>> svc:/network/physical... loop and maintenance... Disabling the metainit
>>>> service does not help fix the dependency_cycle condition :\
>>>
>>>
>>> A similar problem is logged in "iptun" service as well:
>>>
>>> # grep 'not found' /etc/svc/volatile/*log
>>> /etc/svc/volatile/network-iptun:default.log:/lib/svc/method/net-iptun: line
>>> 81: /usr/bin/cut: not found
>>> /etc/svc/volatile/network-physical:default.log:/lib/svc/method/net-physical:
>>> line 722: /usr/bin/nawk: not found
>>> /etc/svc/volatile/network-physical:default.log:/lib/svc/method/net-physical[733]:
>>> /usr/bin/sort: not found [No such file or directory]
>>> /etc/svc/volatile/network-physical:default.log:/lib/svc/method/net-physical:
>>> line 733: cat: not found
>>> /etc/svc/volatile/network-physical:default.log:/lib/svc/method/net-physical[733]:
>>> /usr/bin/nawk: not found [No such file or directory]
>>> /etc/svc/volatile/network-physical:default.log:/lib/svc/method/net-physical[317]:
>>> /usr/bin/cut: not found [No such file or directory]
>>> ...
>>>
>>> But it does at least depend on "physical" and if that would be fixed
>>> by revised dependencies (to run when /usr is properly present) - so
>>> should be "iptun".
>>
>> cut, cat and grep are ksh builtins. Use builtin <cmdname> (run builtin
>> --man to read details) to enable them by default and then remove the
>> absolute paths so the shell doesn't search PATH for them.
>> Most nawk usage can be replaced by ksh pattern matching, leaving
>> sort(1) as the only command to worry about.
>
> Here is a small "nano" version of sort(1). More complex sorting can be
> archived by modifying the key= statement with printf, but be careful
> to consider duplicate keys (hence the use of counter variable k in my
> example):
>
> ksh -c 'function nanosort { typeset -A a ; integer k=0; while read i ;
> do key="$i$((k++))" a[$key]="$i" ; done ; printf "%s\n" "${a[@]}" ; }
> ; seq 14 | nanosort'
> 1
> 10
> 11
> 12
> 13
> 14
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9

The code has a bug: There must be a ; between key="$i$((k++))" and
a[$key]="$i", otherwise the shell is free to execute both statements
in parallel.

Lionel



More information about the OpenIndiana-discuss mailing list