You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* also works on the 64-bit Raspberry OS
* state importance of the pathces in no uncertain terms
* rephrase assumptions in a more concise way
* extract small essay about sudo into its own "What is sudo?"-page
* move "updating from gcgarner"-link to the Home page
Many first-time users of IOTstack get into difficulty by misusing the `sudo` command. The problem is best understood by example. In the following, you would expect `~` (tilde) to expand to `/home/pi`. It does:
4
+
5
+
```bash
6
+
$ echo~/IOTstack
7
+
/home/pi/IOTstack
8
+
```
9
+
10
+
The command below sends the same `echo` command to `bash` for execution. This is what happens when you type the name of a shell script. You get a new instance of `bash` to run the script:
11
+
12
+
```bash
13
+
$ bash -c 'echo ~/IOTstack'
14
+
/home/pi/IOTstack
15
+
```
16
+
17
+
Same answer. Again, this is what you expect. But now try it with `sudo` on the front:
18
+
19
+
```bash
20
+
$ sudo bash -c 'echo ~/IOTstack'
21
+
/root/IOTstack
22
+
```
23
+
24
+
Different answer. It is different because `sudo` means "become root, and then run the command". The process of becoming root changes the home directory, and that changes the definition of `~`.
25
+
26
+
Any script designed for working with IOTstack assumes `~` (or the equivalent `$HOME` variable) expands to `/home/pi`. That assumption is invalidated if the script is run by `sudo`.
27
+
28
+
Of necessity, any script designed for working with IOTstack will have to invoke `sudo`**inside** the script **when it is required**. You do not need to second-guess the script's designer.
29
+
30
+
Please try to minimise your use of `sudo` when you are working with IOTstack. Here are some rules of thumb:
31
+
32
+
1. Is what you are about to run a script? If yes, check whether the script already contains `sudo` commands. Using `menu.sh` as the example:
33
+
34
+
```bash
35
+
$ grep -c 'sudo' ~/IOTstack/menu.sh
36
+
28
37
+
```
38
+
39
+
There are numerous uses of `sudo` within `menu.sh`. That means the designer thought about when `sudo` was needed.
40
+
41
+
2. Did the command you **just executed** work without `sudo`? Note the emphasis on the past tense. If yes, then your work is done. If no, and the error suggests elevated privileges are necessary, then re-execute the last command like this:
42
+
43
+
```bash
44
+
$ sudo !!
45
+
```
46
+
47
+
It takes time, patience and practice to learn when `sudo` is **actually** needed. Over-using `sudo` out of habit, or because you were following a bad example you found on the web, is a very good way to find that you have created so many problems for yourself that will need to reinstall your IOTstack. *Please* err on the side of caution!
Copy file name to clipboardExpand all lines: docs/Basic_setup/index.md
+14-73Lines changed: 14 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,27 +10,25 @@ Andreas Spiess Video #352: Raspberry Pi4 Home Automation Server (incl. Docker, O
10
10
11
11
[](https://www.youtube.com/watch?v=KJRMjUzlHI8)
12
12
13
-
## assumptions
13
+
## Assumptions
14
14
15
15
IOTstack makes the following assumptions:
16
16
17
17
1. Your hardware is a Raspberry Pi (typically a 3B+ or 4B).
18
18
19
-
Note:
20
-
21
19
* The Raspberry Pi Zero W2 has been tested with IOTstack. It works but the 512MB RAM means you should not try to run too many containers concurrently.
20
+
* Users have also [reported success
21
+
](https://github.com/SensorsIot/IOTstack/issues/375) on Orange Pi
22
+
Win/Plus.
22
23
23
-
2. Your Raspberry Pi has a reasonably-recent version of 32-bit Raspberry Pi OS (aka "Raspbian") installed. You can download operating-system images:
24
+
2. Your Raspberry Pi has a reasonably-recent version of 32-bit or 64-bit Raspberry Pi OS (aka "Raspbian") installed. You can download operating-system images:
: This offers only "Raspberry Pi OS with desktop" images.
27
30
28
-
Note:
29
-
30
-
* If you use the first link, "Raspberry Pi OS with desktop" is recommended.
31
-
* The second link only offers "Raspberry Pi OS with desktop" images.
32
-
33
-
3. Your operating system has been kept up-to-date with:
31
+
3. Your operating system has been updated:
34
32
35
33
```bash
36
34
$ sudo apt update
@@ -46,13 +44,7 @@ If the first three assumptions hold, assumptions four through six are Raspberry
46
44
47
45
Please don't read these assumptions as saying that IOTstack will not run on other hardware, other operating systems, or as a different user. It is just that IOTstack gets most of its testing under these conditions. The further you get from these implicit assumptions, the more your mileage may vary.
48
46
49
-
### other platforms
50
-
51
-
Users have reported success on other platforms, including:
52
-
53
-
*[Orange Pi WinPlus](https://github.com/SensorsIot/IOTstack/issues/375)
54
-
55
-
## new installation
47
+
## New installation
56
48
57
49
### automatic (recommended)
58
50
@@ -128,13 +120,9 @@ If you prefer to automate your installations using scripts, see:
128
120
129
121
*[Installing Docker for IOTstack](https://gist.github.com/Paraphraser/d119ae81f9e60a94e1209986d8c9e42f#scripting-iotstack-installations).
130
122
131
-
## migrating from the old repo (gcgarner)?
132
-
133
-
If you are still running on gcgarner/IOTstack and need to migrate to SensorsIot/IOTstack, see:
123
+
## Required system patches
134
124
135
-
*[Migrating IOTstack from gcgarner to SensorsIot](../Updates/gcgarner-migration.md).
136
-
137
-
## recommended system patches
125
+
Unless you know what you are doing, assume these are needed.
If you see the word "buster", proceed to step 2. Otherwise, skip this patch.
164
152
165
-
#### step 2: if you are running "buster" …
153
+
#### step 2: if you are indeed running "buster"
166
154
167
-
You need this patch if you are running Raspbian Buster. Without this patch, Docker images will fail if:
155
+
Without this patch on Buster, Docker images will fail if:
168
156
169
157
* the image is based on Alpine and the image's maintainer updates to [Alpine 3.13](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#time64_requirement); and/or
170
158
* an image's maintainer updates to a library that depends on 64-bit values for *Unix epoch time* (the so-called Y2038 problem).
@@ -189,53 +177,6 @@ Enable by running (takes effect after reboot):
189
177
echo $(cat /boot/cmdline.txt) cgroup_memory=1 cgroup_enable=memory | sudo tee /boot/cmdline.txt
190
178
```
191
179
192
-
## a word about the `sudo` command
193
-
194
-
Many first-time users of IOTstack get into difficulty by misusing the `sudo` command. The problem is best understood by example. In the following, you would expect `~` (tilde) to expand to `/home/pi`. It does:
195
-
196
-
```bash
197
-
$ echo~/IOTstack
198
-
/home/pi/IOTstack
199
-
```
200
-
201
-
The command below sends the same `echo` command to `bash` for execution. This is what happens when you type the name of a shell script. You get a new instance of `bash` to run the script:
202
-
203
-
```bash
204
-
$ bash -c 'echo ~/IOTstack'
205
-
/home/pi/IOTstack
206
-
```
207
-
208
-
Same answer. Again, this is what you expect. But now try it with `sudo` on the front:
209
-
210
-
```bash
211
-
$ sudo bash -c 'echo ~/IOTstack'
212
-
/root/IOTstack
213
-
```
214
-
215
-
Different answer. It is different because `sudo` means "become root, and then run the command". The process of becoming root changes the home directory, and that changes the definition of `~`.
216
-
217
-
Any script designed for working with IOTstack assumes `~` (or the equivalent `$HOME` variable) expands to `/home/pi`. That assumption is invalidated if the script is run by `sudo`.
218
-
219
-
Of necessity, any script designed for working with IOTstack will have to invoke `sudo`**inside** the script **when it is required**. You do not need to second-guess the script's designer.
220
-
221
-
Please try to minimise your use of `sudo` when you are working with IOTstack. Here are some rules of thumb:
222
-
223
-
1. Is what you are about to run a script? If yes, check whether the script already contains `sudo` commands. Using `menu.sh` as the example:
224
-
225
-
```bash
226
-
$ grep -c 'sudo' ~/IOTstack/menu.sh
227
-
28
228
-
```
229
-
230
-
There are numerous uses of `sudo` within `menu.sh`. That means the designer thought about when `sudo` was needed.
231
-
232
-
2. Did the command you **just executed** work without `sudo`? Note the emphasis on the past tense. If yes, then your work is done. If no, and the error suggests elevated privileges are necessary, then re-execute the last command like this:
233
-
234
-
```bash
235
-
$ sudo !!
236
-
```
237
-
238
-
It takes time, patience and practice to learn when `sudo` is **actually** needed. Over-using `sudo` out of habit, or because you were following a bad example you found on the web, is a very good way to find that you have created so many problems for yourself that will need to reinstall your IOTstack. *Please* err on the side of caution!
239
180
240
181
## the IOTstack menu
241
182
@@ -343,7 +284,7 @@ $ git checkout master
343
284
$ ./menu.sh
344
285
```
345
286
346
-
### <aname="menuOldMenuBranch"> old menu (old-menu branch)</a>
0 commit comments