How to login automatically without typing the root username or password in Buildroot BusyBox init?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
If I do:
git clone git://git.buildroot.net/buildroot
cd buildroot
git checkout 2016.05
make qemu_x86_defconfig
make BR2_JLEVEL=2
qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user
I have to type root
into QEMU before I can use the shell.
How to configure buildroot to skip that and login directly?
Tested on Ubuntu 16.04.
busybox buildroot busybox-init
add a comment |Â
up vote
2
down vote
favorite
If I do:
git clone git://git.buildroot.net/buildroot
cd buildroot
git checkout 2016.05
make qemu_x86_defconfig
make BR2_JLEVEL=2
qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user
I have to type root
into QEMU before I can use the shell.
How to configure buildroot to skip that and login directly?
Tested on Ubuntu 16.04.
busybox buildroot busybox-init
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
If I do:
git clone git://git.buildroot.net/buildroot
cd buildroot
git checkout 2016.05
make qemu_x86_defconfig
make BR2_JLEVEL=2
qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user
I have to type root
into QEMU before I can use the shell.
How to configure buildroot to skip that and login directly?
Tested on Ubuntu 16.04.
busybox buildroot busybox-init
If I do:
git clone git://git.buildroot.net/buildroot
cd buildroot
git checkout 2016.05
make qemu_x86_defconfig
make BR2_JLEVEL=2
qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user
I have to type root
into QEMU before I can use the shell.
How to configure buildroot to skip that and login directly?
Tested on Ubuntu 16.04.
busybox buildroot busybox-init
busybox buildroot busybox-init
edited Mar 26 at 20:09
asked Jul 31 '16 at 11:44
Ciro Santilli æ°çÂÂæ¹é ä¸Âå¿ å ÂÃ¥ÂÂäºÂ件 æ³Âè½®åÂÂ
4,43123938
4,43123938
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
::respawn:-/bin/sh
I was studying the examples/inittab
in Busybox 1_28_3 and found this, tried it out, and it worked, so it is the best solution I've found so far.
Don't forget the leading dash -
, or job control does not work as mentioned below.
The following is equivalent since console
is the default:
console::respawn:-/bin/sh
The leading dash gets magically parsed by BusyBox' init: https://github.com/mirror/busybox/blob/1_28_3/init/init.c#L439
I wonder if there is any advantage of using getty
over this method when you don't want to require a password.
Here is a sample setup.
Previous answer: getty -l
After almost two years, I've found it! :-)
Using BR2_ROOTFS_OVERLAY
, override / create the following files:
/etc/inittab: start from https://github.com/buildroot/buildroot/blob/2018.02/package/busybox/inittab and edit the console line to be:
console::respawn:/sbin/getty -n -L -l /loginroot.sh console 0 vt100
/loginroot.sh:
#!/bin/sh
exec /bin/login root
/bin/login
is the default executable if -l
is not given. What we did it to create an executable that calls /bin/login
with the user root
already specified.
This makes init
try to log in as the root user by default, and then since the default password is empty (BR2_TARGET_GENERIC_ROOT_PASSWD
), it automatically logs in.
This technique basically re-implements the -a <user>
option present in Ubuntu 14.04's getty
, which BusyBox' implementation doesn't have.
Then, to login as a different user, just run:
/bin/login
Here is a sample setup.
Previous answer: console::respawn:/bin/sh
I've asked on the mailing list and Thomas Petazzoni replied that the:
/etc/inittab
should contain:
console::respawn:/bin/sh
instead of:
console::respawn:/sbin/getty -n -L console 0 vt100 # GENERIC_SERIAL
With qemu_x86_defconfig
, the inittab
is being used by Busybox' init
system, due to BR2_INIT_BUSYBOX=y
.
This method does have a downside however: just after login, the message shows:
/bin/sh can't access tty; job control turned off
and as advertised, things like Ctrl+C
will have no effect.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
::respawn:-/bin/sh
I was studying the examples/inittab
in Busybox 1_28_3 and found this, tried it out, and it worked, so it is the best solution I've found so far.
Don't forget the leading dash -
, or job control does not work as mentioned below.
The following is equivalent since console
is the default:
console::respawn:-/bin/sh
The leading dash gets magically parsed by BusyBox' init: https://github.com/mirror/busybox/blob/1_28_3/init/init.c#L439
I wonder if there is any advantage of using getty
over this method when you don't want to require a password.
Here is a sample setup.
Previous answer: getty -l
After almost two years, I've found it! :-)
Using BR2_ROOTFS_OVERLAY
, override / create the following files:
/etc/inittab: start from https://github.com/buildroot/buildroot/blob/2018.02/package/busybox/inittab and edit the console line to be:
console::respawn:/sbin/getty -n -L -l /loginroot.sh console 0 vt100
/loginroot.sh:
#!/bin/sh
exec /bin/login root
/bin/login
is the default executable if -l
is not given. What we did it to create an executable that calls /bin/login
with the user root
already specified.
This makes init
try to log in as the root user by default, and then since the default password is empty (BR2_TARGET_GENERIC_ROOT_PASSWD
), it automatically logs in.
This technique basically re-implements the -a <user>
option present in Ubuntu 14.04's getty
, which BusyBox' implementation doesn't have.
Then, to login as a different user, just run:
/bin/login
Here is a sample setup.
Previous answer: console::respawn:/bin/sh
I've asked on the mailing list and Thomas Petazzoni replied that the:
/etc/inittab
should contain:
console::respawn:/bin/sh
instead of:
console::respawn:/sbin/getty -n -L console 0 vt100 # GENERIC_SERIAL
With qemu_x86_defconfig
, the inittab
is being used by Busybox' init
system, due to BR2_INIT_BUSYBOX=y
.
This method does have a downside however: just after login, the message shows:
/bin/sh can't access tty; job control turned off
and as advertised, things like Ctrl+C
will have no effect.
add a comment |Â
up vote
2
down vote
accepted
::respawn:-/bin/sh
I was studying the examples/inittab
in Busybox 1_28_3 and found this, tried it out, and it worked, so it is the best solution I've found so far.
Don't forget the leading dash -
, or job control does not work as mentioned below.
The following is equivalent since console
is the default:
console::respawn:-/bin/sh
The leading dash gets magically parsed by BusyBox' init: https://github.com/mirror/busybox/blob/1_28_3/init/init.c#L439
I wonder if there is any advantage of using getty
over this method when you don't want to require a password.
Here is a sample setup.
Previous answer: getty -l
After almost two years, I've found it! :-)
Using BR2_ROOTFS_OVERLAY
, override / create the following files:
/etc/inittab: start from https://github.com/buildroot/buildroot/blob/2018.02/package/busybox/inittab and edit the console line to be:
console::respawn:/sbin/getty -n -L -l /loginroot.sh console 0 vt100
/loginroot.sh:
#!/bin/sh
exec /bin/login root
/bin/login
is the default executable if -l
is not given. What we did it to create an executable that calls /bin/login
with the user root
already specified.
This makes init
try to log in as the root user by default, and then since the default password is empty (BR2_TARGET_GENERIC_ROOT_PASSWD
), it automatically logs in.
This technique basically re-implements the -a <user>
option present in Ubuntu 14.04's getty
, which BusyBox' implementation doesn't have.
Then, to login as a different user, just run:
/bin/login
Here is a sample setup.
Previous answer: console::respawn:/bin/sh
I've asked on the mailing list and Thomas Petazzoni replied that the:
/etc/inittab
should contain:
console::respawn:/bin/sh
instead of:
console::respawn:/sbin/getty -n -L console 0 vt100 # GENERIC_SERIAL
With qemu_x86_defconfig
, the inittab
is being used by Busybox' init
system, due to BR2_INIT_BUSYBOX=y
.
This method does have a downside however: just after login, the message shows:
/bin/sh can't access tty; job control turned off
and as advertised, things like Ctrl+C
will have no effect.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
::respawn:-/bin/sh
I was studying the examples/inittab
in Busybox 1_28_3 and found this, tried it out, and it worked, so it is the best solution I've found so far.
Don't forget the leading dash -
, or job control does not work as mentioned below.
The following is equivalent since console
is the default:
console::respawn:-/bin/sh
The leading dash gets magically parsed by BusyBox' init: https://github.com/mirror/busybox/blob/1_28_3/init/init.c#L439
I wonder if there is any advantage of using getty
over this method when you don't want to require a password.
Here is a sample setup.
Previous answer: getty -l
After almost two years, I've found it! :-)
Using BR2_ROOTFS_OVERLAY
, override / create the following files:
/etc/inittab: start from https://github.com/buildroot/buildroot/blob/2018.02/package/busybox/inittab and edit the console line to be:
console::respawn:/sbin/getty -n -L -l /loginroot.sh console 0 vt100
/loginroot.sh:
#!/bin/sh
exec /bin/login root
/bin/login
is the default executable if -l
is not given. What we did it to create an executable that calls /bin/login
with the user root
already specified.
This makes init
try to log in as the root user by default, and then since the default password is empty (BR2_TARGET_GENERIC_ROOT_PASSWD
), it automatically logs in.
This technique basically re-implements the -a <user>
option present in Ubuntu 14.04's getty
, which BusyBox' implementation doesn't have.
Then, to login as a different user, just run:
/bin/login
Here is a sample setup.
Previous answer: console::respawn:/bin/sh
I've asked on the mailing list and Thomas Petazzoni replied that the:
/etc/inittab
should contain:
console::respawn:/bin/sh
instead of:
console::respawn:/sbin/getty -n -L console 0 vt100 # GENERIC_SERIAL
With qemu_x86_defconfig
, the inittab
is being used by Busybox' init
system, due to BR2_INIT_BUSYBOX=y
.
This method does have a downside however: just after login, the message shows:
/bin/sh can't access tty; job control turned off
and as advertised, things like Ctrl+C
will have no effect.
::respawn:-/bin/sh
I was studying the examples/inittab
in Busybox 1_28_3 and found this, tried it out, and it worked, so it is the best solution I've found so far.
Don't forget the leading dash -
, or job control does not work as mentioned below.
The following is equivalent since console
is the default:
console::respawn:-/bin/sh
The leading dash gets magically parsed by BusyBox' init: https://github.com/mirror/busybox/blob/1_28_3/init/init.c#L439
I wonder if there is any advantage of using getty
over this method when you don't want to require a password.
Here is a sample setup.
Previous answer: getty -l
After almost two years, I've found it! :-)
Using BR2_ROOTFS_OVERLAY
, override / create the following files:
/etc/inittab: start from https://github.com/buildroot/buildroot/blob/2018.02/package/busybox/inittab and edit the console line to be:
console::respawn:/sbin/getty -n -L -l /loginroot.sh console 0 vt100
/loginroot.sh:
#!/bin/sh
exec /bin/login root
/bin/login
is the default executable if -l
is not given. What we did it to create an executable that calls /bin/login
with the user root
already specified.
This makes init
try to log in as the root user by default, and then since the default password is empty (BR2_TARGET_GENERIC_ROOT_PASSWD
), it automatically logs in.
This technique basically re-implements the -a <user>
option present in Ubuntu 14.04's getty
, which BusyBox' implementation doesn't have.
Then, to login as a different user, just run:
/bin/login
Here is a sample setup.
Previous answer: console::respawn:/bin/sh
I've asked on the mailing list and Thomas Petazzoni replied that the:
/etc/inittab
should contain:
console::respawn:/bin/sh
instead of:
console::respawn:/sbin/getty -n -L console 0 vt100 # GENERIC_SERIAL
With qemu_x86_defconfig
, the inittab
is being used by Busybox' init
system, due to BR2_INIT_BUSYBOX=y
.
This method does have a downside however: just after login, the message shows:
/bin/sh can't access tty; job control turned off
and as advertised, things like Ctrl+C
will have no effect.
edited 9 hours ago
answered Aug 3 '16 at 22:25
Ciro Santilli æ°çÂÂæ¹é ä¸Âå¿ å ÂÃ¥ÂÂäºÂ件 æ³Âè½®åÂÂ
4,43123938
4,43123938
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f299408%2fhow-to-login-automatically-without-typing-the-root-username-or-password-in-build%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password