OSDN Git Service

Update void-66-conf.md
[avyssos/void-66-services.git] / conf / void-66-conf.md
1 # 66
2
3 ## 1. Overview
4
5 > Sixty-six is a collection of system tools built around s6 and s6-rc created to make the implementation and manipulation of service files on your machine easier. It is meant to be a toolbox for the declaration, implementation and administration of services where separate programs can be joined to achieve powerful functionality with small amounts of code.
6
7 -- [project page](https://web.obarun.org/software/66/v0.6.0.0/)
8
9 66 manages services in *trees*: collections of services, analogous to runlevels or targets in other init systems/service managers.
10
11 ## 2. Installation
12
13 The `boot-66serv` and `void-66-services` packages are needed to boot and use 66 as init and service manager on Void Linux.
14
15 `boot-66serv` contains the `boot@` module service, which, along with other frontend files and scripts, are used for the first stage of booting a system. It is roughly analogous to the `runit-void` package for runit: it initialises the system (setting hostname, timezone, open LUKS devices, etc.) and starts `agetty` on TTYs 1-4 by default. The package was created as a portable stage1 for 66 and is used in the [Obarun](http://obarun.org/) distribution.
16
17 The package also contains some scripts written in order to make the services work for Void Linux.
18
19 `void-66-services` contains service frontend files for Void Linux.
20  
21 Currently these packages are in a [PR](https://github.com/void-linux/void-packages/pull/25743). In order to install them one can build them from the PR or install them from the unofficial void-66 repo. Packages are available for i686, x86_64, aarch64, x86_64-musl and aarch64-musl.
22
23 ### 2.1 Installing packages from the `void-unofficial-repo-66`.
24
25 Add the repo:
26
27 _(commands prefixed by `#` must be run with elevated privileges, as root)_
28 ```
29 # xbps-install --repository=https://avyssos.eu/repos/voidlinux/66/ -f void-unofficial-repo-66
30 ```
31
32 You will be prompted to accept the new key:
33 ```
34 https://codeberg.org/mobinmob/void-66/raw/branch/master' repository has been RSA signed by "mobinmob"
35 Fingerprint: c7:39:79:a3:2a:cf:f1:65:a6:df:3a:1a:6e:93:36:28
36 Do you want to import this public key? [Y/n]  
37 ```
38
39 After accepting it, install the new packages:
40 ```
41 # xbps-install -S boot-66serv void-66-services s6-rc
42 ```
43
44 ## 3. Configuration
45
46 There are two ways to create the recommended basic trees for 66: an automatic and a manual one. The automatic configuration is **strongly** recommended.
47
48 ### 3.1. Automatic configuration
49
50 Run the `66boot-initial-setup` script:
51
52 _(commands prefixed by `#` must be run with elevated privileges, as root)_
53 ```
54 # 66boot-initial-setup
55 ```
56
57 The script creates the necessary trees, enables in them some services and created the target for the basic configuration file symlink.
58
59 After running the `66boot-initial-setup` , you can run two other scripts:
60
61 - `66boot-storage-autoconf` which discovers *LVM*, *dmraid*, *LUKS*, *zfs* and *btrfs* volumes
62 for the current hw and configures the boot proccess automatically and
63
64 - `66boot-rcdotconf` that configures *boot@system* using the configuration of the standard voidlinux /etc/rc.conf.
65
66 After each of them or all of them you should finalise the configuration by running:
67
68 _(commands prefixed by `#` must be run with elevated privileges, as root)_
69
70 ```
71 # 66-enable -t boot -F boot@system
72 ```
73
74
75 ### 3.2 Manual configuration
76
77 ***Please do not try doing a manual configuration right after doing automatic configuration!***
78
79 #### 3.2.1 The `boot` tree
80
81 Create a mandatory **n**ew tree `boot` and enable the `boot@system` service in it:
82
83 ```
84 # 66-tree -n boot  
85 # 66-enable -F -t boot boot@system
86 ```
87
88 Create a permanent `boot@system` configuration file:
89
90 ```
91 # cp /etc/66/conf/boot@system/version/.boot@system /etc/66/conf/boot@system/version/boot@system
92 ```
93
94 #### 3.2.2 The `default` tree
95
96 More services can be enabled in a different tree, that starts after the boot tree. **default** is a nice name for it, as it is used for the ... default collection of services in void.
97
98 Create the **n**ew tree, **E**nable it and make it **c**urrent:
99
100 ```
101 # 66-tree -nEc default
102 ```
103
104 Enable services in the new tree -the `switch-initutils` service is recommended:
105
106 ```
107 # 66-enable switch-initutils
108 ```
109
110 #### 3.2.3 Using runit services
111
112 66 can work with the existing runit services. That is useful as there are not yet frontend service files for all the packages that have a runit service directory.
113
114 To use runit services, a separate runit tree can be created, the runit service enabled and started in it and make the tree start after default:
115
116 ```
117 # 66-tree -nE runit
118 # 66-enable -t runit runit
119 # 66-tree -S default runit
120 ```
121
122 The runit services are started the normal way, by symlinking the service directories under `/var/service/`.
123
124 ### 3.3 Finalising configuration
125
126 Both methods lead to the same basic trees created and services enabled. But before changing the init system, some more configuration must happen.
127
128 Edit `/etc/66rc.conf` with a text editor, save it and re-enable the `boot@system` service file in the `boot` tree:
129
130 _(commands prefixed by `#` must be run with elevated privileges, as root)_
131
132 ```
133 # 66-enable -t boot -F boot@system
134 ```
135
136 Please consult the `boot@` man page and the comments of the configuration file. Wrong configuration can result in an unbootable or problematic system!
137
138 ### 3.4 Switching to 66 from runit
139
140 To boot the system with 66 instead of runit after the configuration, you just add `init=/usr/bin/66` to the kernel command line. To switch back, remove it.
141
142 If a user decides that a permanent and clean switch to 66 is the way to go, they should consult [void-66-base-system.md](https://github.com/mobinmob/void-66-services/blob/master/conf/void-66-base-system.md).