Skip to contentSkip to conversation

Strange error when set root password in buildroot

Buildroot Woody Wu 3 participants 9 messages Jul 25, 2013 – Jul 27, 2013

lore
Share & tools
lore

Woody Wu

author
#0 lore raw

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#1 lore raw

Hi,

Quoted 10 lines · Woody Wu

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

It seems that the mkpasswd on your system is not the same type as buildroot expects.
Buildroot runs mkpasswd with '-m <method>', which does not seem to be present on your mkpasswd.

What Linux system is this?
What is the output of:
which mkpasswd
and
mkpasswd -V

(I think the latter will not work in your case anyway, in my case it's:

$ mkpasswd -V
mkpasswd 5.0.19

Copyright (C) 2001-2008 Marco d'Itri
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks,
Thomas

author
#2 lore raw
Quoted 25 lines · Thomas De Schampheleire

Hi,

Quoted 10 lines · Woody Wu

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

It seems that the mkpasswd on your system is not the same type as buildroot expects.
Buildroot runs mkpasswd with '-m <method>', which does not seem to be present on your mkpasswd.

What Linux system is this?
What is the output of:
which mkpasswd
and
mkpasswd -V

Quoted 5 lines

(I think the latter will not work in your case anyway, in my case it's:

$ mkpasswd -V
mkpasswd 5.0.19

Maybe you don't understand what I mean. The build error are build-root build error, which happened on my host, not on the target.

Quoted 8 lines

Copyright (C) 2001-2008 Marco d'Itri
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks,
Thomas

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#3 lore raw
Quoted 26 lines · Woody Wu
Quoted 25 lines · Thomas De Schampheleire

Hi,

Quoted 10 lines · Woody Wu

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

It seems that the mkpasswd on your system is not the same type as buildroot expects.
Buildroot runs mkpasswd with '-m <method>', which does not seem to be present on your mkpasswd.

What Linux system is this?
What is the output of:
which mkpasswd
and
mkpasswd -V

Quoted 8 lines
Quoted 5 lines

(I think the latter will not work in your case anyway, in my case it's:

$ mkpasswd -V
mkpasswd 5.0.19

Maybe you don't understand what I mean. The build error are build-root build error, which happened on my host, not on the target.

Yes, I perfectly understand.
During the buildroot build, mkpasswd from the host is called to generate a hashed version of the root password. For this, 'mkpasswd -m <method>' is called, but it seems that mkpasswd on your host does not accept the '-m' option.

author
#4 lore raw
In reply to Thomas De Schampheleire
Quoted 25 lines · Thomas De Schampheleire

Hi,

Quoted 10 lines · Woody Wu

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

It seems that the mkpasswd on your system is not the same type as buildroot expects.
Buildroot runs mkpasswd with '-m <method>', which does not seem to be present on your mkpasswd.

What Linux system is this?
What is the output of:
which mkpasswd
and
mkpasswd -V

Quoted 5 lines

(I think the latter will not work in your case anyway, in my case it's:

$ mkpasswd -V
mkpasswd 5.0.19

sorry, now I understand what you mean. My linux is slackware linux, the mkpasswd located in /usr/bin/mkpasswd, which even don't support -V or --version to check its version number. And, yes, you are right, my 'mkpasswd' does not recognize '-m' option.

Thank you very much! And, is there a work around?

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#5 lore raw
Quoted 28 lines · Woody Wu
Quoted 27 lines · Thomas De Schampheleire

Hi,

Quoted 10 lines · Woody Wu

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

It seems that the mkpasswd on your system is not the same type as buildroot expects.
Buildroot runs mkpasswd with '-m <method>', which does not seem to be present on your mkpasswd.

What Linux system is this?
What is the output of:
which mkpasswd
and
mkpasswd -V

(I think the latter will not work in your case anyway, in my case it's:

Quoted 8 lines
Quoted 3 lines
$ mkpasswd -V
mkpasswd 5.0.19

sorry, now I understand what you mean. My linux is slackware linux, the mkpasswd located in /usr/bin/mkpasswd, which even don't support -V or --version to check its version number. And, yes, you are right, my 'mkpasswd' does not recognize '-m' option.

I'm not sure. Either we have to change buildroot to detect whether -m is available before using it (if not, it will probably default to md5). Or we need to find another solution.

Just a wild guess, can you check if there are other mkpasswd's available? ls -l /bin/mkpasswd /usr/bin/mkpasswd /sbin/mkpasswd /usr/sbin/mkpasswd

A workaround for you is to change buildroot to remove the -m thing, but it's better if we fix it completely, I think.

Thanks,
Thomas

author
#6 lore raw
Quoted 42 lines · Thomas De Schampheleire
Quoted 28 lines · Woody Wu
Quoted 27 lines · Thomas De Schampheleire

Hi,

Quoted 10 lines · Woody Wu

Hi,

Today I just set the root password in buildroot. Then I got strange error when building:

/usr/bin/sed -i -e 's,^root:[^:]*:,root:usage: mkpasswd [args] [user] where arguments are: -l # (length of password, default = 9) -d # (min # of digits, default = 2) -c # (min # of lowercase chars, default = 2) -C # (min # of uppercase chars, default = 2) -s # (min # of special chars, default = 1) -v (verbose, show passwd interaction) -p prog (program to set password, default = passwd):,' /home/woody/src/buildroot-2013.05/output/target/etc/shadow
/usr/bin/sed: -e expression #1, char 109: unknown option to `s'
make: *** [target-root-passwd] Error 1

What's the problem? Thanks.

It seems that the mkpasswd on your system is not the same type as buildroot expects.
Buildroot runs mkpasswd with '-m <method>', which does not seem to be present on your mkpasswd.

What Linux system is this?
What is the output of:
which mkpasswd
and
mkpasswd -V

(I think the latter will not work in your case anyway, in my case it's:

Quoted 8 lines
Quoted 3 lines
$ mkpasswd -V
mkpasswd 5.0.19

sorry, now I understand what you mean. My linux is slackware linux, the mkpasswd located in /usr/bin/mkpasswd, which even don't support -V or --version to check its version number. And, yes, you are right, my 'mkpasswd' does not recognize '-m' option.

I'm not sure. Either we have to change buildroot to detect whether -m is available before using it (if not, it will probably default to md5). Or we need to find another solution.

Quoted 8 lines

Just a wild guess, can you check if there are other mkpasswd's available? ls -l /bin/mkpasswd /usr/bin/mkpasswd /sbin/mkpasswd /usr/sbin/mkpasswd

A workaround for you is to change buildroot to remove the -m thing, but it's better if we fix it completely, I think.

Thanks,
Thomas

There is no other mkpasswd on my slackware box. The only one comes from the expect package. Would you please where to change the '-m' in buildroot and how? Thanks.

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#7 lore raw
Quoted 16 lines
Quoted 16 lines
Quoted 5 lines

sorry, now I understand what you mean. My linux is slackware linux, the mkpasswd located in /usr/bin/mkpasswd, which even don't support -V or --version to check its version number. And, yes, you are right, my 'mkpasswd' does not recognize '-m' option.

I'm not sure. Either we have to change buildroot to detect whether -m is available before using it (if not, it will probably default to md5). Or we need to find another solution.

Just a wild guess, can you check if there are other mkpasswd's available? ls -l /bin/mkpasswd /usr/bin/mkpasswd /sbin/mkpasswd /usr/sbin/mkpasswd

A workaround for you is to change buildroot to remove the -m thing, but it's better if we fix it completely, I think.

Quoted 6 lines
Quoted 2 lines

Thanks,
Thomas

There is no other mkpasswd on my slackware box. The only one comes from the expect package. Would you please where to change the '-m' in buildroot and how? Thanks.

In system/system.mk, if you change line

TARGET_GENERIC_ROOT_PASSWD_HASH = $(shell mkpasswd -m "$(TARGET_GENERIC_PASSWD_METHOD)" "$(TARGET_GENERIC_ROOT_PASSWD)")

in

TARGET_GENERIC_ROOT_PASSWD_HASH = $(shell mkpasswd "$(TARGET_GENERIC_ROOT_PASSWD)")

I guess it will work for you. But this is not an acceptable final solution.

Input from others would be great here.

Best regards,
Thomas

#8 lore raw

Dear Thomas De Schampheleire,

Quoted 3 lines · Thomas De Schampheleire

I guess it will work for you. But this is not an acceptable final solution.

Input from others would be great here.

I guess the only option would be to build our own mkpasswd and use it when the user enters a non-empty root password in the configuration.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com