Skip to contentSkip to conversation

Remote installation over read-only NFS broken

kbuild regression, post-rc1 Rafael J. Wysocki 4 participants 7 messages Jun 7, 2010 – Jun 10, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi Michal,

Unfortunately, your commit 73d1393eb8507ed5fd7f8e696f6b1ecc18035ebe (kbuild: Generate modules.builtin in make modules_install) broke my testing environment that had always worked before.

Namely, I build kernels on a central machine and export the build directory along with the kernel sources over read-only NFS to test boxes. Then, on the test boxes I run "make modules_install", copy the kernel to /boot, run mkinitrd and so on. Now, after your commit above the "make modules_install" command on the test boxes doesn't work any more, because it tries to write to the build directory, which is mounted read-only.

Please fix or revert.

Rafael

#1 lore raw
Quoted 6 lines · Rafael J. Wysocki

Hi Michal,

Unfortunately, your commit 73d1393eb8507ed5fd7f8e696f6b1ecc18035ebe (kbuild: Generate modules.builtin in make modules_install) broke my testing environment that had always worked before.

Quoted 6 lines

Namely, I build kernels on a central machine and export the build directory along with the kernel sources over read-only NFS to test boxes. Then, on the test boxes I run "make modules_install", copy the kernel to /boot, run mkinitrd and so on. Now, after your commit above the "make modules_install" command on the test boxes doesn't work any more, because it tries to write to the build directory, which is mounted read-only.

I'll have a look, thanks for the report.

Michal

#2 lore raw
In reply to Rafael J. Wysocki
Quoted 9 lines · Rafael J. Wysocki

Namely, I build kernels on a central machine and export the build directory along with the kernel sources over read-only NFS to test boxes. Then, on the test boxes I run "make modules_install", copy the kernel to /boot, run mkinitrd and so on. Now, after your commit above the "make modules_install" command on the test boxes doesn't work any more, because it tries to write to the build directory, which is mounted read-only.

Please fix or revert.

Ahh. It's broken for another reason too. Even if it's a writable filesystem, it means that there's a lot of files that get written by root (since you have to be root to do the install). Which is very uncomfortable, and we've tried very hard to avoid that.

So it _should_ be possible to do a build as a normal user, and then do the install as root, and afterwards

find . -user root

should return the empty set (which in practice ends up being basically the same thing as Rafaels requirement that it work on a read-only build).

Linus

#3 lore raw
Quoted 11 lines · Linus Torvalds
Quoted 8 lines · Rafael J. Wysocki

Namely, I build kernels on a central machine and export the build directory along with the kernel sources over read-only NFS to test boxes. Then, on the test boxes I run "make modules_install", copy the kernel to /boot, run mkinitrd and so on. Now, after your commit above the "make modules_install" command on the test boxes doesn't work any more, because it tries to write to the build directory, which is mounted read-only.

Quoted 6 lines
Quoted 1 line

Please fix or revert.

Ahh. It's broken for another reason too. Even if it's a writable filesystem, it means that there's a lot of files that get written by root (since you have to be root to do the install). Which is very uncomfortable, and we've tried very hard to avoid that.

I can fix both issues by the below patch, but then it reintroduces the issue Eric reported to me with the original approach:

| And indeed it's strange - while scripts/Makefile.build doesn't fail
| since
| there seems to be a script that generates some Makefiles in between
| the build process, I'll get this figured out to see what is the root
| cause.

(the whole thread is at http://lkml.org/lkml/2010/1/6/16). Eric, does the above still hold, i.e. if you apply the below patch, does scripts/Makefile.modbuiltin fail again? If so, is it possible to fix the driver build process instead?

Here is the patch:

Subject: [PATCH] kbuild: Generate modules.builtin in make modules

Generating the file in make modules_install was broken as well, because it didn't work in a readonly filesystem and otherwise it generated a root-owned file which is not wanted.

Makefile +2 -2
index efdc3d0..2735465 100644
@@ -1095,7 +1095,7 @@ all: modules
 #	using awk while concatenating to the final file.
 
 PHONY += modules
-modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
+modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
 	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
 	@$(kecho) '  Building modules, stage 2.';
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@@ -1117,7 +1117,7 @@ PHONY += modules_install
 modules_install: _modinst_ _modinst_post
 
 PHONY += _modinst_
-_modinst_: modules.builtin
+_modinst_:
 	@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
 		echo "Warning: you may need to install module-init-tools"; \
 		echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
#4 lore raw
Quoted 35 lines · Michal Marek
Quoted 11 lines · Linus Torvalds
Quoted 8 lines · Rafael J. Wysocki

Namely, I build kernels on a central machine and export the build directory along with the kernel sources over read-only NFS to test boxes. Then, on the test boxes I run "make modules_install", copy the kernel to /boot, run mkinitrd and so on. Now, after your commit above the "make modules_install" command on the test boxes doesn't work any more, because it tries to write to the build directory, which is mounted read-only.

Quoted 6 lines
Quoted 1 line

Please fix or revert.

Ahh. It's broken for another reason too. Even if it's a writable filesystem, it means that there's a lot of files that get written by root (since you have to be root to do the install). Which is very uncomfortable, and we've tried very hard to avoid that.

I can fix both issues by the below patch, but then it reintroduces the issue Eric reported to me with the original approach:

| And indeed it's strange - while scripts/Makefile.build doesn't fail
| since
| there seems to be a script that generates some Makefiles in between
| the build process, I'll get this figured out to see what is the root
| cause.

(the whole thread is at http://lkml.org/lkml/2010/1/6/16). Eric, does the above still hold, i.e. if you apply the below patch, does scripts/Makefile.modbuiltin fail again? If so, is it possible to fix the driver build process instead?

Here is the patch:

Quoted 8 lines

Subject: [PATCH] kbuild: Generate modules.builtin in make modules

Generating the file in make modules_install was broken as well, because it didn't work in a readonly filesystem and otherwise it generated a root-owned file which is not wanted.

The patch works for me, thanks.

Quoted 14 lines
Makefile +1 -1
index efdc3d0..2735465 100644
@@ -1095,7 +1095,7 @@ all: modules
 #	using awk while concatenating to the final file.
 
 PHONY += modules
-modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
+modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
 	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
 	@$(kecho) '  Building modules, stage 2.';
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

Makefile PHONY += modules_install

Quoted 9 lines
Makefile +1 -2
@@ -1117,7 +1117,7 @@ PHONY += modules_install
 modules_install: _modinst_ _modinst_post
 
 PHONY += _modinst_
-_modinst_: modules.builtin
+_modinst_:
 	@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
 		echo "Warning: you may need to install module-init-tools"; \
 		echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
--

Rafael

#5 lore raw
In reply to Michal Marek

Hi Michal,

Quoted 10 lines · On Mon, 7 Jun 2010 23:16:30 +0200 Michal Marek <[email protected]> wrote:

I can fix both issues by the below patch, but then it reintroduces the issue Eric reported to me with the original approach:

| And indeed it's strange - while scripts/Makefile.build doesn't fail
| since
| there seems to be a script that generates some Makefiles in between
| the build process, I'll get this figured out to see what is the root
| cause.
Quoted 8 lines

(the whole thread is at http://lkml.org/lkml/2010/1/6/16). Eric, does the above still hold, i.e. if you apply the below patch, does scripts/Makefile.modbuiltin fail again? If so, is it possible to fix the driver build process instead?

Here is the patch:

Subject: [PATCH] kbuild: Generate modules.builtin in make modules

This patch breaks (at least) a powerpc ppc64_defconfig build with separate object directory (that starts completely empty).

/bin/sh: line 1: init/modules.builtin: No such file or directory

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#6 lore raw
Quoted 18 lines · Stephen Rothwell

Hi Michal,

Quoted 15 lines · On Mon, 7 Jun 2010 23:16:30 +0200 Michal Marek <[email protected]> wrote:

I can fix both issues by the below patch, but then it reintroduces the issue Eric reported to me with the original approach:

| And indeed it's strange - while scripts/Makefile.build doesn't fail
| since
| there seems to be a script that generates some Makefiles in between
| the build process, I'll get this figured out to see what is the root
| cause.

(the whole thread is at http://lkml.org/lkml/2010/1/6/16). Eric, does the above still hold, i.e. if you apply the below patch, does scripts/Makefile.modbuiltin fail again? If so, is it possible to fix the driver build process instead?

Quoted 8 lines
Quoted 3 lines

Here is the patch:

Subject: [PATCH] kbuild: Generate modules.builtin in make modules

This patch breaks (at least) a powerpc ppc64_defconfig build with separate object directory (that starts completely empty).

/bin/sh: line 1: init/modules.builtin: No such file or directory

Oops, this uncovered a bug in scripts/Makefile.modbuiltin. Following patch should fix that, I'll run a few randconfigs before pushing it though.

Michal

Subject: [PATCH] kbuild: Create output directory in Makefile.modbuiltin

scripts/Makefile.modbuiltin +5 -0
index 102a276..1adb974 100644
@@ -14,6 +14,11 @@ __modbuiltin:
 
 include scripts/Kbuild.include
 
+ifneq ($(KBUILD_SRC),)
+# Create output directory if not already present
+_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
+endif
+
 # The filename Kbuild has precedence over Makefile
 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)