Ari Sundholm | 27 Nov 21:09 2015

[PATCH] blkdiscard: new applet

From: Ari Sundholm <ari <at>>

This applet discards blocks on a given device.
Tested with multiple 32-bit and 64-bit kernel versions and two different SSDs.

function                                             old     new   delta
blkdiscard_main                                        -     300    +300
.rodata                                           154690  154821    +131
packed_usage                                       30275   30310     +35
applet_names                                        2499    2510     +11
applet_main                                         2904    2912      +8
applet_nameofs                                       726     728      +2
(add/remove: 2/0 grow/shrink: 5/0 up/down: 487/0)             Total: 487 bytes

Signed-off-by: Ari Sundholm <ari <at>>
 util-linux/blkdiscard.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 util-linux/blkdiscard.c

diff --git a/util-linux/blkdiscard.c b/util-linux/blkdiscard.c
new file mode 100644
index 0000000..e952599
--- /dev/null
+++ b/util-linux/blkdiscard.c
 <at>  <at>  -0,0 +1,86  <at>  <at> 
+ * Mini blkdiscard implementation for busybox
+ *
(Continue reading)

Grant Edwards | 25 Nov 17:48 2015

uznip applet but no zip applet

I'm curious as to why there is an unzip applet but no zip applet?

Presumably there is extant busybox code to deal with the zip file data
structures, crc32 checksums, directory tree walking, and various
compression routines (IIRC, gzip and zip 'deflate' are the same
algorithm, and zip 'store' is simply memcpy()).

Adding a zip applet would seem trivial.

Is there some technical reason why there is no zip applet?  

Or is it simply that nobody has wanted one bad enough to do it?

[Since one was lacking, I wrote a simple-minded stand-alone 'zip' from
scratch in about a day and half (including time spent researching and
reverse engineering the file format). It only supports the 'store'
compression method, always operates recursively, has no command line
options (no update/delete capabilities), and always creates a new
archive from scratch, so it's a bit limited.  For deployment logistics
reasons to dull to explain, adding a stand-alone 'zip' to my product's
firmware build at this point in the life-cycle is a lot less work than
adding one to busybox.]


Grant Edwards               grant.b.edwards        Yow! I joined scientology
                                  at               at a garage sale!!
Wei, Catherine | 23 Nov 02:40 2015

how to use ntp in busybox

     In our system, we're considering if we could use ntp in busybox to 
replace the ntp supported by, which has large footprint, so I'm 
doing some investigation about ntp in busybox recently but I met some 
problems. I found that there's only ntpd in busybox, no ntpdate and ntpq.
     In our current system, we have a ntp wrapper to control ntp 
behavior based on our requirement. We use ntpdate to sync time when 
system is started, and we use ntpq to monitor and control the ntpd 
behavior. For example:
      1. After ntpdate synced time, use ntpq to enable ntp.
      2. When we add our own ntp server to the server list, we will use 
something like this "ntpq -c "keyid id" -c "passwd pwd" -c ":config 
server minpoll 3 maxpoll 4 burst"

      I don't know if there's some tools related to ntpq in busybox, so 
we can remove the current ntp in our system and use ntpd in busybox. 
Appreciate your quick response, thank you very much.

Best regards
Aaro Koskinen | 16 Nov 21:14 2015

Re: [PATCH v2] nandwrite: implement -n (read/write without ecc)


On Mon, Nov 16, 2015 at 06:20:51AM +0200, Baruch Siach wrote:
> On Mon, Nov 16, 2015 at 02:10:53AM +0200, Aaro Koskinen wrote:
> >  <at>  <at>  -144,6 +147,9  <at>  <at>  int nandwrite_main(int argc UNUSED_PARAM, char **argv)
> >  	fd = xopen(argv[0], IS_NANDWRITE ? O_RDWR : O_RDONLY);
> >  	xioctl(fd, MEMGETINFO, &meminfo);
> >  
> > +	if ((opts & OPT_n) && ioctl(fd, MTDFILEMODE, MTD_FILE_MODE_RAW))
> > +		bb_simple_perror_msg_and_die("MTDFILEMODE");
> Why not just use xioctl instead of open coding it?

xioctl() takes pointer argument.

Laurent Bercot | 16 Nov 11:06 2015

Re: anyone interested in bringing launchd to BusyBox?

  The technical impact of Denys's change was actually extremely small,
which is the main reason why it was not discussed (much) on the list.

  The change was meant to send a political message, and it has done so
quite successfully. The message is: Busybox will not yield to
aggressive expansionism.
  The message is not "Busybox needs a new init system" or "Busybox needs
a service manager".

  So far Busybox has done a good job of focusing on mechanism and
keeping away from policy decisions or endorsing a system more than
another. (And even though I like the model and have personal
interests in seeing it spread widely, I think adding tcpserver and
runit as busybox applets was unwise, because contrary to that

  I would like it to remain that way, *especially* when it's about
such a politically heavy weighted subject as a service manager.

  Busybox is useful when it's about providing clean, small
implementations of standard tools other implementations of would be
too big to fit on embedded platforms.
  Good system software will naturally compile and fit into integration
projects without needing to be rewritten and be provided as a part of
Busybox. It is true for runit, it is true for the s6 family of tools,
it may be true for relaunchd (if you remove the build-time Ruby

  Integrating that kind of software into busybox has no technical benefits,
(Continue reading)

Alexander | 13 Nov 21:36 2015

How to download the mtd block via TFTP?

I tried download mtdblock from remote device (embedded Linux) to local computer via TFTP (telnet), but
download fails.

tftp -l /dev/mtdblock3 -p

Download starts, but only downloads about ~900KB, then falls. TFTP show timeout, and also errors tftp:
server says: 'Access violation' or 'Illegal TFTP operation'.

mtd blocks:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00010000 "U-Boot"
mtd1: 00010000 00010000 "env1"
mtd2: 00010000 00010000 "env2"
mtd3: 003a0000 00010000 "UBFI1"
mtd4: 003a0000 00010000 "UBFI2"
mtd5: 000cf6f4 00010000 "Kernel"
mtd6: 002cc800 00010000 "RootFileSystem"
mtd7: 00070000 00010000 "nvram"

# cd dev
# ls -l

brw-rw----    1 0        0         31,   3 mtdblock3
brw-rw----    1 0        0         31,   4 mtdblock4
crw-rw----    1 0        0         90,   6 mtd3
crw-rw----    1 0        0         90,   7 mtd3ro
crw-rw----    1 0        0         90,   8 mtd4
(Continue reading)

Mike Dean | 12 Nov 19:37 2015

syslogd logging


I'm trying to get system logging to work the way we'd like it to work for our embedded Linux distribution.  I'm hoping to make it log to the buffer and to the filesystem simultaneously, allowing our customers to use logread or look through /var/log/, at their option, without changing any configuration settings.  I can't seem to get Busybox to log to both simultaneously.  Can this be configured somehow?

Additionally, I'd like to also be able to configure syslogd to log to a remote syslog server without losing this local logging and buffering.  Is this possible?

Thank you,
Mike Dean

System Engineer

EMAC, Inc.
618-529-4525 Ext. 330
618-457-0110 Fax
2390 EMAC Way
Carbondale, Il 62901

busybox mailing list
busybox <at>
Lélio | 10 Nov 20:24 2015

1.24.x Regression: Cannot compile with glibc<2.12(MNT_DETACH is not defined)


glibc2.2+ is supported according to the FAQ, but the symbol MNT_DETACH is not defined in sys/mount.h in glibc<2.10 (this symbol is defined in the kernel (in fs.h) but has not been ported to glibc).

This prevents util-linux/umount.c from compiling. This regression has been introduced by the commit c919d561ad.

This is already worked around in init/bootchartd.c with a conditional include. In order to avoid redundant code, it might be better to fix this define in libbb.h. The attached patch fixes the issue.


Attachment (glibc-missing-defines-2.patch): application/octet-stream, 912 bytes
busybox mailing list
busybox <at>
Harald Becker | 9 Nov 21:13 2015

Good Bye

Hi All,

everything comes to an end. Looks like my active development has reached 
this end.

After a long and hard phase of decision I'm going to stop all of my 
development work, not only for Busybox, for all projects. The reasons 
for this are difficult, have just cumulated and don't belong only to the 
last discussions I had here.

So the last I want to say is, thank you to those who responded and gave 
input, in any way.

The mail address is unsubscripted from the list soon, but will stay 
valid until the end of this year. For those who like to stay in contact, 
send me a message, I will respond with a different address which should 
be kept valid.

Good Bye
Ignacio Hernandez | 6 Nov 20:46 2015

udhcpc infiniband support

Hi List,

I am seeing that the Infiniband topic has been brought up in the past,
just want to know if there is someone actively working on bringing
this support?

busybox mailing list
busybox <at>
Kaarle Ritvanen | 5 Nov 15:27 2015

[PATCH 1/3] login: move check_securetty to libbb

 include/libbb.h    |  1 +
 libbb/Kbuild.src   |  1 +
 libbb/securetty.c  | 27 +++++++++++++++++++++++++++
 loginutils/login.c | 19 -------------------
 4 files changed, 29 insertions(+), 19 deletions(-)
 create mode 100644 libbb/securetty.c

diff --git a/include/libbb.h b/include/libbb.h
index 82484f9..e607b8f 100644
--- a/include/libbb.h
+++ b/include/libbb.h
 <at>  <at>  -1354,6 +1354,7  <at>  <at>  extern void selinux_or_die(void) FAST_FUNC;
 #define SETUP_ENV_NO_CHDIR  (1 << 4)
 void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC;
 void nuke_str(char *str) FAST_FUNC;
+int check_securetty(const char *short_tty);
 int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC;
 int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC;
 int ask_and_check_password(const struct passwd *pw) FAST_FUNC;
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 7fb6872..0f09de7 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
 <at>  <at>  -84,6 +84,7  <at>  <at>  lib-y += safe_gethostname.o
 lib-y += safe_poll.o
 lib-y += safe_strncpy.o
 lib-y += safe_write.o
+lib-y += securetty.o
 lib-y += setup_environment.o
 lib-y += signals.o
 lib-y += simplify_path.o
diff --git a/libbb/securetty.c b/libbb/securetty.c
new file mode 100644
index 0000000..95edbc9
--- /dev/null
+++ b/libbb/securetty.c
 <at>  <at>  -0,0 +1,27  <at>  <at> 
+/* vi: set sw=4 ts=4: */
+ * /etc/securetty checking.
+ *
+ * Licensed under GPLv2, see file LICENSE in this source tree.
+ */
+#include "libbb.h"
+int check_securetty(const char *short_tty)
+	char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */
+	parser_t *parser = config_open2("/etc/securetty", fopen_for_read);
+	while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) {
+		if (strcmp(buf, short_tty) == 0)
+			break;
+		buf = NULL;
+	}
+	config_close(parser);
+	/* buf != NULL here if config file was not found, empty
+	 * or line was found which equals short_tty */
+	return buf != NULL;
+ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; }
diff --git a/loginutils/login.c b/loginutils/login.c
index 67fe82e..8d765fb 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
 <at>  <at>  -129,25 +129,6  <at>  <at>  static void die_if_nologin(void)
 # define die_if_nologin() ((void)0)

-static int check_securetty(const char *short_tty)
-	char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */
-	parser_t *parser = config_open2("/etc/securetty", fopen_for_read);
-	while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) {
-		if (strcmp(buf, short_tty) == 0)
-			break;
-		buf = NULL;
-	}
-	config_close(parser);
-	/* buf != NULL here if config file was not found, empty
-	 * or line was found which equals short_tty */
-	return buf != NULL;
-static ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; }
 static void initselinux(char *username, char *full_tty,
 						security_context_t *user_sid)