• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Startup
2
3## System Startup
4
5### Device Startup Interrupted Due to "parse failed!" Error
6
7**Symptom**
8
9During device startup, the error message "[Init] InitReadCfg, parse failed! please check file /etc/init.cfg format." is displayed, and the startup is interrupted, as shown in the following figure.
10
11  **Figure 1** Error information
12
13  ![en-us_image_0000001200053087](figures/en-us_image_0000001200053087.png)
14
15**Possible Cause**
16
17The content of the **init.cfg** file does not comply with the JSON specifications.
18
19**Solution**
20
21Check the **init.cfg** file and ensure that its format meets the JSON specifications.
22
23
24### Device Restarted Repeatedly
25
26**Symptom**
27
28The device restarts over and over again upon startup.
29
30**Possible Cause**
31
32Each service started by the init process has the **importance** attribute, as described in [Parameters](../subsystems/subsys-boot-init-service.md#parameters).
33
34- If the attribute value is **0**, the init process does not need to restart the device when the current service process exits.
35
36- If the attribute value is **1**, the init process needs to restart the device when the current service process exits.
37
38**Solution**
39
401. View logs to identify the service that encounters a process crash or exits due to an error, rectify the issue, and then burn the image again.
41
422. Change the value of **importance** to **0** for the service that exits due to a process crash or an error, and then burn the image again.
43
44
45### **SetParameter** or **GetParameter** Failed with Correct Parameters Passed
46
47**Symptom**
48
49Calling **SetParameter** or **GetParameter** fails when correct parameters are passed.
50
51**System Type**
52
53liteos-a
54
55**Possible Cause**
56
57Permission verification has been enabled for **SetParameter** and **GetParameter**. If the UID of the caller is greater than **1000**, that is, the caller does not have the API call permission, calling an API will fail even if correct parameters are passed.
58
59**Solution**
60
61No action is required.
62
63### ueventd Service Failed to Obtain a Socket upon Startup
64
65**Symptom**
66
67After the ueventd service is started, the error message "Failed to get uevent socket, try to create" is displayed, and the error information as shown in the following figure is logged.
68
69  **Figure 2** Failure to obtain a socket
70
71  ![ueventd_socket](figures/ueventd_socket.png)
72
73**Possible Cause**
74
75 The ueventd service is started on demand. Upon startup, it first needs to check the environment variables for **fd** of the socket created by the init process. The preceding error information will be displayed if the ueventd service fails to obtain environment variables. The possible causes are as follows:
761. No socket has been configured for the ueventd service in the **.cfg** file. As a result, the init process does not create a socket for the ueventd service, and no socket ID is present in environment variables.
772. If a socket has been configured for the ueventd service in the **.cfg** file, it is probable that the ueventd service is also configured in another **.cfg** file but no socket is designated for it.
78
79**Solution**
80
811. For case 1, configure a socket for the ueventd service in the **.cfg** file. For details, see [Socket Configuration for the ueventd Service](../subsystems/subsys-boot-init-service.md#parameters).
822. For case 2, check all **.cfg** files for any duplicate ueventd service and delete it. Retain only one ueventd service with valid configuration.
83
84### ueventd Service Exits Because of a Socket Polling Timeout
85
86**Symptom**
87
88After the ueventd service is started for a period of time, the error message "poll ueventd socket timeout, ueventd exit" is displayed and the ueventd service automatically exits.
89
90**Possible Cause**
91
92The ueventd service is started on demand. When a uevent is reported, the init process receives a socket message and starts the ueventd service to process the message. After processing the message, the ueventd service polls the corresponding socket handle for 30s. If a new socket message is reported within this period of time, the ueventd service continues to process the message. After processing the message, the ueventd service polls the socket handle for 30s once again. If no new socket message is reported within this period of time, the ueventd service exits and returns the socket to the init process for polling. In this case, the preceding error message is displayed.
93
94**Solution**
95
96This is a normal phenomenon and no action is required.
97
98### Service with the ondemand Attribute Failed to Start Because of a Configuration Parsing Error
99
100**Symptom**
101
102The service configuration in JSON format cannot be correctly parsed, and the error message "Service is invalid which has both critical and ondemand attribute" is displayed. When the service is started, the error message "Cannot find service" is displayed.
103
104**Possible Cause**
105
106When the **ondemand** attribute is configured, a service is started on demand by default. This attribute, however, is mutually exclusive with the **critical** attribute. If both of them are configured, a conflict will occur, resulting in a failure to resolve the service.
107
108**Solution**
109
1101. If a service does not need to be started on demand, leave the **ondemand** attribute unspecified.
1112. If a service needs to be started on demand, leave the **critical** attribute unspecified or disable the **critical** attribute after you configure the **ondemand** attribute.
112
113### Parallel Startup Is Not Effective for Services Configured with the ondemand Attribute
114
115**Symptom**
116
117Services configured with the **ondemand** attribute are not started in the parallel startup phase, regardless of the **start-mode** settings.
118
119**Possible Cause**
120
121Services configured with the **ondemand** attribute are started only when the startup conditions are met. Therefore, parallel startup is not effective for these services.
122
123**Solution**
124
125If you want to add a service to parallel startup, do not configure the **ondemand** attribute for it.
126
127### SA Services Cannot Be Started on Demand
128
129**Symptom**
130
131When an SA service is configured with the **ondemand** attribute, the samgr process does not start the SA service after the SA client sends a request.
132
133**Possible Cause**
134
135At the initial implementation of on-demand startup for SA services, **SystemAbilityManager::CheckSystemAbility(int32_t systemAbilityId)** is used for all SA services. To distinguish SA services that are started on demand, **LoadSystemAbility(int32_t systemAbilityId, const sptr& callback)** provided by the samgr process is added. If an SA service is not started on demand, it is probable that the original API is used by mistake.
136
137**Solution**
138
139Use **LoadSystemAbility(int32_t systemAbilityId, const sptr& callback)** for any SA service that needs to be started on demand.
140
141### Improper caps Configuration
142
143**Symptom**
144
145Improper caps configuration leads to a configuration error. The error information is as follows:
146 ```
1474.619955] [pid=1 0][Init][ERROR][init_capability.c:119]service=multimodalinput not support caps = CAP_DC_OVERRIDE caps 41
148[ 4.620014] [pid=1 0][Init][ERROR][init_service_manager.c:818]GetServiceSecon secon section not found, skip
149[ 4.620216] [pid=1 0][Init][ERROR][init_service_manager.c:818]GetServiceSecon secon section not found, skip
150[ 4.620608] [pid=1 0][Init][ERROR][init_capability.c:119]service=mmi_uinput_service  not support caps = CAP_DC_OVERRIDE caps 41
151 ```
152**Possible Cause**
153
1541. The caps configuration is not supported by the kernel.
1552. The configuration in the **.cfg** file is incorrect.
156
157**System Version**
158
159OpenHarmony-3.0-LTS
160
161**Solution**
162
1631. For case 1, leave **caps** unspecified.
1642. For case 2, correctly configure **caps** by referring to the definition of the **capStrCapNum** data structure in **base/startup/init/services/init/init_capability.c**.
165
166### Sandbox Not Enabled
167
168**Symptom**
169
170After **hdc shell param get const.sandbox** is run, it is found that the value of **const.sandbox** is not **enable**.
171
172**Possible Cause**
173
174None.
175
176**Solution**
177
178Set **const.sandbox** to **enable** in **base/startup/init/services/etc/param/ohos.para**. For details, see [Sandbox Management](../subsystems/subsys-boot-init-sandbox.md).
179
180### How to Check the Sandbox Mounting Status
181
182**Symptom**
183
184None.
185
186**Possible Cause**
187
188None.
189
190**Solution**
191
192Enter the hdc shell mode on the device. Then, run the **sandbox -s service_name** command to move the current service to the sandbox, and run shell commands such as **ls** to view the sandbox directory. For details, see the [sandbox command description](../subsystems/subsys-boot-init-plugin.md).
193
194### Timestamp in the Ready Phase of Some Bootevent Events Is 0
195
196**Symptom**
197
198In manual bootevent mode, after device startup is completed and the **dump_service all bootevent** command is executed, the timestamps in the ready phase of some events are 0.
199
200**Possible Cause**
201
2021. The service does not send the bootevent event.
2032. The service sends the bootevent event, but does not have the related permission.
204
205**Solution**
206
2071. For case 1, make sure the related service sends the bootevent in the code.
2082. For case 2, make sure the service has the permission to set the bootevent parameter.
209
210### Failed to Boot from Partition A/B
211
212**Symptom**
213
214After the image is burnt, the system cannot be started, and information similar to the following can be found in the serial port log:
215
216```
217wait for file:/dev/block/platform/fe310000.sdhci/by-name/system_b failed after 5 second.
218Mount /dev/block/platform/fe310000.sdhci/by-name/system_b to /usr failed 2
219```
220
221**Possible Cause**
222
223As indicated by the log, partition B is used as the boot partition. However, it is not found during startup, resulting in the startup failure. This issue occurs because the active slot value in the misc partition is set to 2 (partition B), but partition B is not burnt.
224
225**Solution**
226
2271. Clear the misc partition by burning the corresponding partition with an empty misc image, erase the active slot value, and restart the system from the default partition.
2282. Burn the **system_b** and **vendor_b** images to the development board by using the partition table configured with partition B. Then, the development board can boot from partition B.
229
230## Application Spawning
231
232### Failed to Start appspawn
233
234**Symptom**
235
236During system startup, the system stops at the startup animation and fails to launch the appspawn process.
237
238**Possible Cause**
239
2401. The startup animation does not exit properly.
2412. The attempt to start system applications has failed, resulting in a failure to start the appspawn process.
242
243**Solution**
244
245View logs to identify the service that encounters a process crash or exits due to an error, rectify the issue, and then burn the image again.
246
247### Cold Start of Applications Failed
248
249**Symptom**
250
251Applications fail to be started by running the cold start command.
252  ```
253  aa start -d 12345 -a $name -b $package -C
254  ```
255
256**Possible Cause**
257
2581. Cold start is not enabled.
2592. The parameter of the cold start command is incorrect.
2603. The socket request times out.
2614. SELinux is enabled.
262
263**Solution**
264
2651. For case 1, run **param get startup.appspawn.cold.boot** to check the cold start switch and run **param set startup.appspawn.cold.boot 1** to enable cold start.
2662. For case 2, correct the parameter of the cold start command.
2673. For case 3, run the **param set persist.appspawn.client.timeout 5** command to set the timeout period to 5.
2684. For case 4, run the **setenforce 0** command to disable SELinux.
269
270### Failed to Create the Application Sandbox
271
272**Symptom**
273
274The system UI freezes at the OpenHarmony startup animation, the calculator application does not respond after being touched, or the font is not displayed properly. The error information in the hilog file is as follows:
275 - bind mount `<src-path>` to `<sandbox-path>` failed errno `<errorCode>`
276 - private mount to `<sandbox-path>`  failed errno `<errorCode>`
277 - symlink failed, `<link-name>`, errno is `<errorCode>`
278
279**Possible Cause**
280
2811. The sandbox creation process is incorrect.
2822. The **com.ohos.systemui** sandbox fails to be created.
2833. The file on which the application sandbox depends is not configured correctly.
284
285**Solution**
286
2871. Check the error information in the hilog file, and correct the corresponding JSON files.
2882. Verify the PID of the application, the code logic of the sandbox creation process, and the JSON configuration.
289
290For details, see How to Develop in [Application Sandbox Development Procedure](../subsystems/subsys-boot-appspawn.md).
291