[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#646284: marked as done (dropping applets-fallback breaks initramfs images)



Your message dated Sat, 22 Oct 2011 23:17:32 +0000
with message-id <E1RHkom-0001na-Oe@franck.debian.org>
and subject line Bug#646284: fixed in busybox 1:1.19.2-2
has caused the Debian Bug report #646284,
regarding dropping applets-fallback breaks initramfs images
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
646284: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646284
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: busybox
Version: 1:1.19.2-1
Severity: grave
Justification: Breaks system booting using initramfs-tools in non-trivial ways.
Tags: patch
X-Debbugs-CC: Debian kernel team <debian-kernel@lists.debian.org>

Hi

Initramfs images generated by initramfs-tools 0.99 after busybox got 
upgraded to 1:1.19.2-1 fail to boot with the following error messages:

Loading, please wait...
/init: line 11: mount: not found
/init: line 12: mount: not found
/init: line 25: mount: not found
W: devtmpfs not available, falling back to tmpfs for /devtmpfs
/init: line 25: mount: not found
/init: line 27: mount: not found
/init: line 28: mount: not found
cat: can't open '/proc/cmdline': No such file or directory
cat: can't open '/proc/cmdline': No such file or directory
/scripts/init-top/udev: line 14: can't create /sys/kernel/uevent_helper: nonexistent directory
Begin: Loading essential drivers ... done
Begin: Running /scripts/init-premount ... done
Begin: Mounting root file system .. Begin: Running /scripts/local-top .. [    0.742185] device-mapper: uevent: version 1.0.3
[    0.746854] device-mapper: ioctl 4.21.0-ioctl (2011-07-06) initialised: dm-devel@redhat.com
done.
Begin: Running /scripts/local-premount ... [     0.765009] Btrfs loaded
done.
/init: line 5: mount: not found
Begin: Running /scripts/local-bottom ... done
done.
Begin: Running /scripts/init-bottom ... done
/init: line 239: mv: not found
/init: line 239: umount: not found
/init: line 242: mount: not found
/init: line 243: mount: not found
Target filesystem doesn't have requested /sbin/init.
/init: line 291: chvt: not found
No init found. Try passing init= bootarg.


BusyBox v1.19.2 (Debian 1:1.19.2-1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
(initramfs)


needed initramfs-tools hooks on this system:

$ dpkg -S /usr/share/initramfs-tools/hooks/*
initramfs-tools: /usr/share/initramfs-tools/hooks/busybox
dmsetup: /usr/share/initramfs-tools/hooks/dmsetup
initramfs-tools: /usr/share/initramfs-tools/hooks/keymap
initramfs-tools: /usr/share/initramfs-tools/hooks/klibc
lvm2: /usr/share/initramfs-tools/hooks/lvm2
initramfs-tools: /usr/share/initramfs-tools/hooks/thermal
udev: /usr/share/initramfs-tools/hooks/udev

Re-instating applets-fallback.patch in busybox 1:1.19.2-1 however fixes
this reproducable boot failure, quick'n'dirty rediff (tested on 
amd64 && i386, using systems with mdadm, lvm2 or nothing special at 
all) attached.

Regards
	Stefan Lippers-Hollmann

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.1-rc10-aptosid-amd64 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages busybox depends on:
ii  libc6  2.13-21

busybox recommends no packages.

busybox suggests no packages.

-- no debconf information
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -7394,23 +7394,8 @@ static int builtinloc = -1;     /* index
 
 
 static void
-tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **envp)
+tryexec(char *cmd, char **argv, char **envp)
 {
-#if ENABLE_FEATURE_SH_STANDALONE
-	if (applet_no >= 0) {
-		if (APPLET_IS_NOEXEC(applet_no)) {
-			clearenv();
-			while (*envp)
-				putenv(*envp++);
-			run_applet_no_and_exit(applet_no, argv);
-		}
-		/* re-exec ourselves with the new arguments */
-		execve(bb_busybox_exec_path, argv, envp);
-		/* If they called chroot or otherwise made the binary no longer
-		 * executable, fall through */
-	}
-#endif
-
  repeat:
 #ifdef SYSV
 	do {
@@ -7465,24 +7450,21 @@ shellexec(char **argv, const char *path,
 	int e;
 	char **envp;
 	int exerrno;
-#if ENABLE_FEATURE_SH_STANDALONE
-	int applet_no = -1;
-#endif
 
 	clearredir(/*drop:*/ 1);
 	envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
-	if (strchr(argv[0], '/') != NULL
-#if ENABLE_FEATURE_SH_STANDALONE
-	 || (applet_no = find_applet_by_name(argv[0])) >= 0
-#endif
-	) {
-		tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
+	if (strchr(argv[0], '/') != NULL) {
+		tryexec(argv[0], argv, envp);
 		e = errno;
 	} else {
+#if ENABLE_FEATURE_SH_STANDALONE
+		bb_execv_applet(argv[0], argv, envp);
+#endif
+
 		e = ENOENT;
 		while ((cmdname = path_advance(&path, argv[0])) != NULL) {
 			if (--idx < 0 && pathopt == NULL) {
-				tryexec(IF_FEATURE_SH_STANDALONE(-1,) cmdname, argv, envp);
+				tryexec(cmdname, argv, envp);
 				if (errno != ENOENT && errno != ENOTDIR)
 					e = errno;
 			}
--- a/libbb/execable.c
+++ b/libbb/execable.c
@@ -9,6 +9,9 @@
 
 #include "libbb.h"
 
+#include <alloca.h>
+#include <stdarg.h>
+
 /* check if path points to an executable file;
  * return 1 if found;
  * return 0 otherwise;
@@ -68,13 +71,60 @@ int FAST_FUNC exists_execable(const char
 }
 
 #if ENABLE_FEATURE_PREFER_APPLETS
+int FAST_FUNC bb_execv_applet(const char *name, char *const argv[], char *const envp[])
+{
+	const char **path = bb_busybox_exec_paths;
+
+	errno = ENOENT;
+
+	if (find_applet_by_name(name) < 0)
+		return -1;
+
+	for (; *path; ++path)
+		execve(*path, argv, envp);
+
+	return -1;
+}
+
 /* just like the real execvp, but try to launch an applet named 'file' first */
 int FAST_FUNC BB_EXECVP(const char *file, char *const argv[])
 {
-	if (find_applet_by_name(file) >= 0)
-		execvp(bb_busybox_exec_path, argv);
+	int ret = bb_execv_applet(file, argv, environ);
+	if (errno != ENOENT)
+		return ret;
+
 	return execvp(file, argv);
 }
+
+int FAST_FUNC bb_execlp(const char *file, const char *arg, ...)
+{
+#define INITIAL_ARGV_MAX 16
+	size_t argv_max = INITIAL_ARGV_MAX;
+	const char **argv = malloc(argv_max * sizeof (const char *));
+	va_list args;
+	unsigned int i = 0;
+	int ret;
+
+	va_start (args, arg);
+	while (argv[i++] != NULL) {
+		if (i == argv_max) {
+			const char **nptr;
+			argv_max *= 2;
+			nptr = realloc (argv, argv_max * sizeof (const char *));
+			if (nptr == NULL)
+				return -1;
+			argv = nptr;
+		}
+
+	argv[i] = va_arg (args, const char *);
+	}
+	va_end (args);
+
+	ret = bb_execvp(file, (char *const *)argv);
+	free(argv);
+
+	return ret;
+}
 #endif
 
 int FAST_FUNC BB_EXECVP_or_die(char **argv)
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -36,6 +36,15 @@ const char bb_msg_standard_output[] ALIG
 const char bb_hexdigits_upcase[] ALIGN1 = "0123456789ABCDEF";
 
 const char bb_busybox_exec_path[] ALIGN1 = CONFIG_BUSYBOX_EXEC_PATH;
+const char *bb_busybox_exec_paths[] ALIGN1 = {
+#ifdef __linux__
+	"/proc/self/exe",
+#endif
+#ifdef CONFIG_BUSYBOX_EXEC_PATH
+	CONFIG_BUSYBOX_EXEC_PATH,
+#endif
+	NULL
+};
 const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL;
 /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
  * but I want to save a few bytes here. Check libbb.h before changing! */
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -896,13 +896,11 @@ int exists_execable(const char *filename
  * but it may exec busybox and call applet instead of searching PATH.
  */
 #if ENABLE_FEATURE_PREFER_APPLETS
-int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
-#define BB_EXECLP(prog,cmd,...) \
-	do { \
-		if (find_applet_by_name(prog) >= 0) \
-			execlp(bb_busybox_exec_path, cmd, __VA_ARGS__); \
-		execlp(prog, cmd, __VA_ARGS__); \
-	} while (0)
+int bb_execv_applet(const char *name, char *const argv[], char *const envp[]) FAST_FUNC;
+int bb_execvp(const char *file, char *const argv[]) FAST_FUNC;
+int bb_execlp(const char *file, const char *arg, ...) FAST_FUNC;
+#define BB_EXECVP(prog,cmd)     bb_execvp(prog,cmd)
+#define BB_EXECLP(prog,cmd,...) bb_execlp(prog,cmd, __VA_ARGS__)
 #else
 #define BB_EXECVP(prog,cmd)     execvp(prog,cmd)
 #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
@@ -1683,6 +1681,7 @@ extern const char bb_path_wtmp_file[];
 
 #define bb_dev_null "/dev/null"
 extern const char bb_busybox_exec_path[];
+extern const char *bb_busybox_exec_paths[];
 /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
  * but I want to save a few bytes here */
 extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
--- a/Config.in
+++ b/Config.in
@@ -431,13 +431,10 @@ config FEATURE_PREFER_APPLETS
 
 config BUSYBOX_EXEC_PATH
 	string "Path to BusyBox executable"
-	default "/proc/self/exe"
+	default "/bin/busybox"
 	help
 	  When Busybox applets need to run other busybox applets, BusyBox
-	  sometimes needs to exec() itself. When the /proc filesystem is
-	  mounted, /proc/self/exe always points to the currently running
-	  executable. If you haven't got /proc, set this to wherever you
-	  want to run BusyBox from.
+	  sometimes needs to exec() itself.
 
 # These are auto-selected by other options
 
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -41,5 +41,7 @@ int chroot_main(int argc UNUSED_PARAM, c
 		/*argv[2] = NULL; - already is */
 	}
 
-	BB_EXECVP_or_die(argv);
+	execvp(argv[0], argv);
+	xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
+	bb_perror_msg_and_die("can't execute '%s'", argv[0]);
 }

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---
--- Begin Message ---
Source: busybox
Source-Version: 1:1.19.2-2

We believe that the bug you reported is fixed in the latest version of
busybox, which is due to be installed in the Debian FTP archive:

busybox-static_1.19.2-2_i386.deb
  to main/b/busybox/busybox-static_1.19.2-2_i386.deb
busybox-syslogd_1.19.2-2_all.deb
  to main/b/busybox/busybox-syslogd_1.19.2-2_all.deb
busybox-udeb_1.19.2-2_i386.udeb
  to main/b/busybox/busybox-udeb_1.19.2-2_i386.udeb
busybox_1.19.2-2.debian.tar.gz
  to main/b/busybox/busybox_1.19.2-2.debian.tar.gz
busybox_1.19.2-2.dsc
  to main/b/busybox/busybox_1.19.2-2.dsc
busybox_1.19.2-2_i386.deb
  to main/b/busybox/busybox_1.19.2-2_i386.deb
udhcpc_1.19.2-2_all.deb
  to main/b/busybox/udhcpc_1.19.2-2_all.deb
udhcpd_1.19.2-2_all.deb
  to main/b/busybox/udhcpd_1.19.2-2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 646284@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Tokarev <mjt@tls.msk.ru> (supplier of updated busybox package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 23 Oct 2011 02:47:35 +0400
Source: busybox
Binary: busybox busybox-static busybox-udeb busybox-syslogd udhcpc udhcpd
Architecture: source all i386
Version: 1:1.19.2-2
Distribution: unstable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Michael Tokarev <mjt@tls.msk.ru>
Description: 
 busybox    - Tiny utilities for small and embedded systems
 busybox-static - Standalone rescue shell with tons of builtin utilities
 busybox-syslogd - Provides syslogd and klogd using busybox
 busybox-udeb - Tiny utilities for the debian-installer (udeb)
 udhcpc     - Provides the busybox DHCP client implementation
 udhcpd     - Provides the busybox DHCP server implementation
Closes: 450895 646284
Changes: 
 busybox (1:1.19.2-2) unstable; urgency=low
 .
   * resurrect applets-fallback.patch for now,
     thank you Stefan Lippers-Hollmann for the rediff.
     This restores the (broken) initramfs usage
     (Closes: #646284)
   * s/XC-Package-Type/Package-Type/ in debian/control (lintian)
   * add default build, build-arch and build-indep targets
     to debian/rules (lintian), and remove old maintainerclean
   * forgotten for 1.19: (Closes: #450895)
Checksums-Sha1: 
 ad27edd30565544c4599556d260720d18a0d9541 1576 busybox_1.19.2-2.dsc
 2a8f8a9e1d1a9529e9fad3df1c3556ceacc2911c 41890 busybox_1.19.2-2.debian.tar.gz
 4ffe093a17fe122bb835f8b3511bc7e56be53e8c 13838 udhcpc_1.19.2-2_all.deb
 aefd92f7376bd763ae5a826efd5e7fb7c43bb984 17122 udhcpd_1.19.2-2_all.deb
 2e9d3f481d31e5b8fb8427a83115ca2886c92e78 16174 busybox-syslogd_1.19.2-2_all.deb
 7ac8f6bffb91f0e13b5945f001e6efcde383a14f 779958 busybox-static_1.19.2-2_i386.deb
 23c920b55a57cade4604b06a273418eed1772a09 340240 busybox_1.19.2-2_i386.deb
 d71c8c3e123bfb00a49952a8d8b7af92b9f11019 165496 busybox-udeb_1.19.2-2_i386.udeb
Checksums-Sha256: 
 82b51d5ffc93a3861db11417bf7b2bbb14eca345f5874f93beabfa0b24e7c267 1576 busybox_1.19.2-2.dsc
 f4c21919f28fdab74d9ec3f2bf5d5b816c2ee82897516bf09ac5a933ec1ebd81 41890 busybox_1.19.2-2.debian.tar.gz
 4a843cab57744e69bace21a333154b4d24a8d2d4e88cec38547923d80d59cbab 13838 udhcpc_1.19.2-2_all.deb
 5d66aebecf9ac6eaaf72baf33bea9f3b375efefd89367cec3065a58a7e70d1fb 17122 udhcpd_1.19.2-2_all.deb
 c526382f6237d308855ab4e9b428eeaad9cf45ef89bf2358abb460425046a23a 16174 busybox-syslogd_1.19.2-2_all.deb
 5ade580400915826e7870f87746ffb55352763ede198c3fea994e738afa2d626 779958 busybox-static_1.19.2-2_i386.deb
 234cbd00b3f05df03dd4e0ec9e5ce228d8296768ee1625896624e525f1f4b970 340240 busybox_1.19.2-2_i386.deb
 8f0d6759e03000138195ec417988a5fbd1dcda639f0e2fdb6d06fbe30b5a97d0 165496 busybox-udeb_1.19.2-2_i386.udeb
Files: 
 b28178a621b1c6653ffd924b60d2a555 1576 utils optional busybox_1.19.2-2.dsc
 8f49d7593f8159d97212b294fcc96d44 41890 utils optional busybox_1.19.2-2.debian.tar.gz
 8774eb2522ab0dabf71fce2343f6bbef 13838 net optional udhcpc_1.19.2-2_all.deb
 621916e0b173c7040f256026e4b052ba 17122 net optional udhcpd_1.19.2-2_all.deb
 a7996263821852f1e397807c866d5b9f 16174 utils optional busybox-syslogd_1.19.2-2_all.deb
 c63b904a91f07abedbeeb3f2a7aaa0b9 779958 shells extra busybox-static_1.19.2-2_i386.deb
 3434d4ff9307a6cc571a40b5320741cb 340240 utils optional busybox_1.19.2-2_i386.deb
 088edb7f9a8c6a8b692e3ef9dc1994cb 165496 debian-installer extra busybox-udeb_1.19.2-2_i386.udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iJwEAQECAAYFAk6jStoACgkQUlPFrXTwyDhsdAP9Hk3itVEydh4IJx5Q2z4pJSYH
FNSqH0snRu+Li/VF2sKZ8ZqKV7iiuTh5JVcZ22P5ne1c4c2g/pJDIhFTmBa/iRjd
mcrOEY8zllvIy5Ls9iQ6idejrTeDOG/7w3tLe/jmFf4c16SRsNfWgzsZB4taNdCK
NkMqzEgPraFiiWRIpH0=
=1Csd
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: