make tar*-pkg considered dangerous
Hi,
We've had some incidents with people destroying Fedore 17 installs (to the point of reinstall) by installing a kernel tarball generated with make tar*-pkg
The problem is that the tarball includes /lib/{modules,firmware}, but on FC17 /lib is a symlink. tar when it unpacks the tarball replaces the symlink with the directory. So they end up
with a /lib which only contains the new kernel files, but nothing else,
And then the system doesn't boot anymore.
I'm not sure there is a good fix for this. I don't know of a way to convince tar to not do that. And putting everything into /usr would be very incompatible.
Disable these make targets or add warnings? If disabling people should use rpms or dpkgs instead?
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 14 lines · Andi Kleen
Hi,
We've had some incidents with people destroying Fedore 17 installs (to the point of reinstall) by installing a kernel tarball generated with make tar*-pkg
The problem is that the tarball includes
/lib/{modules,firmware}, but on FC17 /lib is a symlink. tar when it unpacks the tarball replaces the symlink with the directory. So they end up
with a /lib which only contains the new kernel files, but nothing else,And then the system doesn't boot anymore.
Quoted 9 lines
I'm not sure there is a good fix for this. I don't know of a way to convince tar to not do that. And putting everything into /usr would be very incompatible.
Disable these make targets or add warnings? If disabling people should use rpms or dpkgs instead?
-Andi
I dont use the dpkg/rpm variants myself, but unpack with -h should be enough?
HTH, Z.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: (fwd) make tar*-pkg considered dangerous
Quoted 11 lines · Henrique de Moraes Holschuh
I am forwarding this as a remider that, should we ever get to the point of moving around /lib or
/usr/lib, /sbin or/usr/sbin, and /bin or/usr/sbin, as well as any other such trunks, we really ought to consider whether we should be using symlinks or bind mounts [where possible] for such moves.Also, just in case, Debian users are gently reminded that there are less unsavory methods of packing custom kernel builds for later use in Debian boxes, including the Linux upstream "deb-pkg" make target (dpkg is a lot smarter than "tar"), and the make-kpkg command provided by the kernel-package Debian package (which IMHO tends to produce better kernel .deb packages than the upstream "deb-pkg" make target.
kernel-package is effectively unmaintained, so please don't recommend its use unless you intend to rectify that.
Quoted 8 lines
----- Forwarded message from Andi Kleen <[email protected]> -----
Date: Wed, 12 Sep 2012 05:16:46 +0200
From: Andi Kleen <[email protected]>
To: [email protected], [email protected]
Subject: make tar*-pkg considered dangerousHi,
Quoted 7 lines
We've had some incidents with people destroying Fedore 17 installs (to the point of reinstall) by installing a kernel tarball generated with make tar*-pkg
The problem is that the tarball includes
/lib/{modules,firmware}, but on FC17 /lib is a symlink. tar when it unpacks the tarball replaces the symlink with the directory.
[...]
Presumably the tarball also contains an entry for the directory lib, and that (not the subdirectory entries) triggers tar to replace the symlink. So this can be fixed by only including lib/{modules,firmware} in the tarball, not lib.
A quick experiment under F16 (tar 1.26) supports this.
Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert CamusHenrique de Moraes Holschuh dixit:
Quoted 7 lines
From: Andi Kleen <[email protected]>
To: [email protected], [email protected]The problem is that the tarball includes
/lib/{modules,firmware}, but on FC17 /lib is a symlink. tar when it unpacks the tarball replaces the symlink with the directory. So they end up
with a /lib which only contains the new kernel files, but nothing else,
Well, this is both a bug in Fedora IMHO, and (objectively) a fault of the users to not use “tar xzphf” for extracting.
bye,
//mirabilos
Signature · 4 lines
“It is inappropriate to require that a time represented as seconds since the Epoch precisely represent the number of seconds between the referenced time and the Epoch.” -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
PATCH 1/1 kbuild: Do not package /boot and /lib in make tar-pkg
In reply to Andi KleenThere were reports of users destroying their Fedora installs by a kernel tarball that replaces the /lib -> /usr/lib symlink. Let's remove the toplevel directories from the tarball to prevent this from happening.
--- arch/x86/Makefile | 2 +- scripts/Makefile.fwinst | 4 ++-- scripts/package/buildtar | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/Makefile +1 -1
@@ -138,7 +138,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,) KBUILD_CFLAGS += $(mflags-y) KBUILD_AFLAGS += $(mflags-y) -archscripts: scripts_basic +archscripts: $(Q)$(MAKE) $(build)=arch/x86/tools relocs ###
scripts/Makefile.fwinst +2 -2
@@ -27,7 +27,7 @@ endif installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) -installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./ +installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/. # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
@@ -42,7 +42,7 @@ quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@) $(installed-fw-dirs): $(call cmd,mkdir) -$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %) +$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $$(dir $(INSTALL_FW_PATH)/%) $(call cmd,install) PHONY += __fw_install __fw_modinst FORCE
scripts/package/buildtar +1 -1
@@ -109,7 +109,7 @@ esac if tar --owner=root --group=root --help >/dev/null 2>&1; then opts="--owner=root --group=root" fi - tar cf - . $opts | ${compress} > "${tarball}${file_ext}" + tar cf - boot/* lib/* $opts | ${compress} > "${tarball}${file_ext}" ) echo "Tarball successfully created in ${tarball}${file_ext}"
Signature · 1 line
1.7.3.1
Re: [PATCH] kbuild: Do not package /boot and /lib in make tar-pkg
Quoted 3 lines · Michal Marek
There were reports of users destroying their Fedora installs by a kernel tarball that replaces the /lib ->
/usr/libsymlink. Let's remove the toplevel directories from the tarball to prevent this from happening.
Looks good to me.
Please also submit to stable and all the longterms.
-Andi