1 |
Thanks for the tip, Gareth; |
2 |
|
3 |
As a matter of fact, the unionfs in "/var" is not being mounted - as long |
4 |
as "/etc" also. |
5 |
|
6 |
Finally I got a verbose boot, and it is possible to read, as an error |
7 |
message: |
8 |
|
9 |
!! unable to mount none for /var |
10 |
|
11 |
in my "/etc/fstab", these are the related entries: |
12 |
|
13 |
|
14 |
/dev/sda2 / squashfs |
15 |
noatime,ro 0 1 |
16 |
/dev/sda3 /.var.rw ext4 |
17 |
noatime,defaults 0 2 |
18 |
none /var unionfs |
19 |
nonempty,cow,umask=022,dirs=/.var.rw/=rw:/.var.ro/=ro 0 0 |
20 |
|
21 |
Now I'm trying to find out on the manuals how to better tell the mount |
22 |
program there is no device to be mounted for "/var" . |
23 |
|
24 |
Thanks |
25 |
Francisco |
26 |
|
27 |
|
28 |
|
29 |
2013/10/20 Gareth McClean <disneysw@×××××××.com> |
30 |
|
31 |
> ** ** |
32 |
> |
33 |
> Check your /etc/mtab on the failing system to see how the kernel believes |
34 |
> the root partition has been mounted.**** |
35 |
> |
36 |
> ** ** |
37 |
> |
38 |
> I ended up including a fix-up in at the end of my init script to ensure |
39 |
> /etc/mtab correctly reflected my aufs root file system**** |
40 |
> |
41 |
> ** ** |
42 |
> |
43 |
> # Insert our new root into the mtab**** |
44 |
> |
45 |
> sed -i '1i none / aufs dirs=/rw=rw:/ro=ro' ${NEW_ROOT}/etc/mtab**** |
46 |
> |
47 |
> ** ** |
48 |
> |
49 |
> this is performed just before performing the “switch_root” process.**** |
50 |
> |
51 |
> ** ** |
52 |
> |
53 |
> ** ** |
54 |
> |
55 |
> ** ** |
56 |
> |
57 |
> Also are you sure "/etc/initramfs.mounts" is actually being processed? *** |
58 |
> * |
59 |
> |
60 |
> ** ** |
61 |
> |
62 |
> If you are passing the “aufs” option into the init script using grub then |
63 |
> the code to process "/etc/initramfs.mounts" is never called.**** |
64 |
> |
65 |
> ** ** |
66 |
> |
67 |
> It’s been a few years since I set this up but like you I use genkernel to |
68 |
> create the initramfs (yes I’m lazy). However I replace the default |
69 |
> genkernel init script with a slightly modified version using the |
70 |
> ‘--linuxrc’ option. This replacement script includes my additional aufs |
71 |
> mounts and manages a few additional functions such as performing software |
72 |
> updates which for obvious reasons can’t take place on a fully running |
73 |
> system. **** |
74 |
> |
75 |
> ** ** |
76 |
> |
77 |
> I use the ‘loop’, ‘looptype’, ‘ramdisk’ and ‘aufs’ init options which |
78 |
> are passed in via the grub boot manager. These options are normally used |
79 |
> for live CD builds to overlay a small ram disc on top of the CD using aufs. In |
80 |
> essence my change simply maps another physical partition over the top to |
81 |
> allow for permanent data storage.**** |
82 |
> |
83 |
> ** ** |
84 |
> |
85 |
> Gareth.**** |
86 |
> |
87 |
> ** ** |
88 |
> |
89 |
> ** ** |
90 |
> |
91 |
> ** ** |
92 |
> |
93 |
> *From:* Francisco Ares [mailto:frares@×××××.com] |
94 |
> *Sent:* 18 October 2013 18:16 |
95 |
> *To:* gentoo-embedded@l.g.o |
96 |
> *Subject:* Re: [gentoo-embedded] planning a flash DOM x86 embedded system* |
97 |
> *** |
98 |
> |
99 |
> ** ** |
100 |
> |
101 |
> Thanks, Gareth.**** |
102 |
> |
103 |
> But it is very interesting that with no special customizations, I am |
104 |
> almost able to have a fully functional system.**** |
105 |
> |
106 |
> That new thing about having to use a initramfs when the root filesystem |
107 |
> and the /usr directory are not present in the same physical partition, it |
108 |
> turns out that it helps on having the "genkernel" generated initramfs do |
109 |
> the job of mounting different arrangements for partitions, directories and |
110 |
> unionfs mounts. That is because of the file "/etc/initramfs.mounts" where |
111 |
> the specified mount entries, are extracted from the "/etc/fstab" and |
112 |
> mounted before the initram gives way to the real root environment.**** |
113 |
> |
114 |
> For instance, in this system, for now, there is the directory structure |
115 |
> bellow:**** |
116 |
> |
117 |
> /.var.rw - here a r/w ext4 partition is to be mounted;**** |
118 |
> |
119 |
> /.var.ro - here there are all files and directories expected to be on a |
120 |
> usual /var;**** |
121 |
> |
122 |
> /var - here a unionfs mount is to join the ones above**** |
123 |
> |
124 |
> The part from fstab for this is ("/.var.ro" is present on the squashfs |
125 |
> root file system):**** |
126 |
> |
127 |
> /dev/sda2 / squashfs |
128 |
> noatime,ro 0 1 |
129 |
> /dev/sda3 /.var.rw ext4 |
130 |
> noatime,defaults 0 2 |
131 |
> none /var unionfs |
132 |
> nonempty,cow,umask=022,dirs=/.var.rw/=rw:/.var.ro/=ro 0 0**** |
133 |
> |
134 |
> I said it is not yet fully functional because it seems there is something |
135 |
> wrong with permissions, because it ends up with a unknown user prompt from |
136 |
> which I could list the root directories (something similar is being made to |
137 |
> "/etc"): |
138 |
> |
139 |
> total 9,0K |
140 |
> drwxr-xr-x 23 root root 385 Out 18 14:18 ./ |
141 |
> drwxr-xr-x 4 root root 4,0K Set 24 09:46 ../ |
142 |
> drwxr-xr-x 47 root root 2,6K Out 17 16:03 .etc.ro/ |
143 |
> drwxr-xr-x 2 root root 40 Out 18 15:09 .etc.rw/ |
144 |
> drwxr-xr-x 11 root root 262 Out 17 16:03 .var.ro/ |
145 |
> drwxr-xr-x 6 root root 4,0K Out 18 14:33 .var.rw/ |
146 |
> drwxr-xr-x 2 root root 1,4K Out 7 14:46 bin/ |
147 |
> drwxr-xr-x 4 root root 1,0K Out 18 14:15 boot/ |
148 |
> d????????? 3 root root 2,3K Ago 1 00:17 dev/ |
149 |
> drwxr-xr-x 1 root root 2,6K Out 17 16:03 etc/ |
150 |
> drwxr-xr-x 3 root root 54 Ago 22 07:55 home/ |
151 |
> lrwxrwxrwx 1 root root 5 Out 7 14:05 lib -> lib64/ |
152 |
> drwxr-xr-x 12 root root 3,2K Out 17 08:51 lib64/ |
153 |
> drwxr-xr-x 2 root root 28 Ago 1 00:16 media/ |
154 |
> drwxr-xr-x 2 root root 28 Ago 1 00:16 opt/ |
155 |
> drwxr-xr-x 2 root root 3 Jul 31 22:22 proc/ |
156 |
> drwxr-xr-x 2 root root 136 Out 18 14:18 root/ |
157 |
> drwxr-xr-x 5 root root 120 Ago 30 08:59 run/ |
158 |
> drwxr-xr-x 2 root root 2,9K Out 17 08:51 sbin/ |
159 |
> drwxr-xr-x 2 root root 28 Ago 1 00:16 sys/ |
160 |
> drwxrwxrwt 2 root root 3 Out 18 14:18 tmp/ |
161 |
> drwxr-xr-x 13 root root 267 Out 17 11:18 usr/ |
162 |
> d????????? 1 root root 262 Out 17 16:03 var/**** |
163 |
> |
164 |
> Any hints or suggestions? I will post this to the "gentoo-user" list, |
165 |
> also, I guess it is an interesting thing that might be called a cool side |
166 |
> effect of the recent issues.**** |
167 |
> |
168 |
> Thanks |
169 |
> Francisco**** |
170 |
> |
171 |
> ** ** |
172 |
> |
173 |
> ** ** |
174 |
> |
175 |
> 2013/10/17 Gareth McClean <disneysw@×××××××.com>**** |
176 |
> |
177 |
> **** |
178 |
> |
179 |
> I do this using a slightly modified init script, aufs3 and a squashfs.**** |
180 |
> |
181 |
> **** |
182 |
> |
183 |
> Basically the system setups a tmpfs as a RW overlay on top of the |
184 |
> squashfs. Then for permanent storage there is a physical Ext4 partition |
185 |
> overlaid again on top of the /home directory. **** |
186 |
> |
187 |
> **** |
188 |
> |
189 |
> Symbolic links are then used for any configuration files (such as network |
190 |
> configuration) that require persistent storage. These links obviously |
191 |
> reference locations within the /home directory that is stored on an Ext4 |
192 |
> physical partition. **** |
193 |
> |
194 |
> **** |
195 |
> |
196 |
> My init script is slightly more complicated than this since it caters for |
197 |
> both live (squash plus aufs) and development (normal disc access) modes but |
198 |
> basically it boils down to:**** |
199 |
> |
200 |
> **** |
201 |
> |
202 |
> **** |
203 |
> |
204 |
> mount -t aufs aufs "${NEW_ROOT}" -o dirs=/rw=rw:/ro=rr**** |
205 |
> |
206 |
> **** |
207 |
> |
208 |
> # Mount RW_PERM**** |
209 |
> |
210 |
> echo "Mounting RW"**** |
211 |
> |
212 |
> mkdir -p /rw-perm**** |
213 |
> |
214 |
> mount "UUID=${RW_PERM_UUID}" /rw-perm**** |
215 |
> |
216 |
> mount -o bind /ro/home "${NEW_ROOT}/home"**** |
217 |
> |
218 |
> mount -t aufs aufs "${NEW_ROOT}/home" -o |
219 |
> dirs=/rw-perm=rw:/ro/home=rr**** |
220 |
> |
221 |
> **** |
222 |
> |
223 |
> where **** |
224 |
> |
225 |
> ro = squashfs**** |
226 |
> |
227 |
> rw = tmpfs**** |
228 |
> |
229 |
> rw-perm = physical Ext4 partition**** |
230 |
> |
231 |
> **** |
232 |
> |
233 |
> Note you need the “mount -o bind" command to allow an overlay on top of an |
234 |
> overlay with aufs3 otherwise you will get an error message.**** |
235 |
> |
236 |
> **** |
237 |
> |
238 |
> BTW, Unless you have a good reason for doing this I would not recommend |
239 |
> doing this since you have a physical hard drive. The reason I still do this |
240 |
> is mainly for backward compatibility. Of course it is nice to have the |
241 |
> ability to run our system from a liveUSB stick and it minimises software |
242 |
> download size when doing updates but debugging the init script is a very |
243 |
> time consuming process……**** |
244 |
> |
245 |
> **** |
246 |
> |
247 |
> **** |
248 |
> |
249 |
> **** |
250 |
> |
251 |
> **** |
252 |
> |
253 |
> *From:* Francisco Ares [mailto:frares@×××××.com] |
254 |
> *Sent:* 16 October 2013 13:49 |
255 |
> *To:* gentoo-embedded@l.g.o |
256 |
> *Subject:* [gentoo-embedded] planning a flash DOM x86 embedded system**** |
257 |
> |
258 |
> **** |
259 |
> |
260 |
> Hi.**** |
261 |
> |
262 |
> I am planning to build a system to be deployed in a SATA flash disk, and |
263 |
> most of the file system will be read-only. There will be a tempfs on /temp |
264 |
> and a read-write partition for /var (perhaps a unionfs with the static part |
265 |
> of /var and that read-write partition)**** |
266 |
> |
267 |
> Is there any resources on how to do this using Gentoo?**** |
268 |
> |
269 |
> There is already a development system with everything working as expected |
270 |
> on the final system. But when I put it to a squashfs, the system boots with |
271 |
> several errors, like when trying to write to /etc and /var.**** |
272 |
> |
273 |
> Looking on the new issue regarding /usr and / being on a different |
274 |
> partitions, I have found the file in /etc/initramfs.mounts. I have added |
275 |
> the needed fstab entries to be mounted before the system switches to the |
276 |
> real-root, (as the comments on top of this file claims) but there are |
277 |
> still errors during boot.**** |
278 |
> |
279 |
> **** |
280 |
> |
281 |
> Thanks |
282 |
> Francisco**** |
283 |
> |
284 |
> ** ** |
285 |
> |