Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
1
answers
69
views
Failed to umount oldroot after `pivot_root` and `chroot` in Linux
I am working on an embedded Linux system (kernel-5.10.24), and `busybox` as `init`. I created 2 rootfs partitions in system, I want to use `pivot_root` and `chroot` to change rootfs between them. When the system firstly bootup, the `mount` showed. ``` # mount ubi0:rootfs on / type ubifs (rw,relatime...
I am working on an embedded Linux system (kernel-5.10.24), and
busybox
as init
. I created 2 rootfs partitions in system, I want to use pivot_root
and chroot
to change rootfs between them.
When the system firstly bootup, the mount
showed.
# mount
ubi0:rootfs on / type ubifs (rw,relatime,assert=read-only,ubi=0,vol=0)
devtmpfs on /dev type devtmpfs (rw,relatime,size=42008k,nr_inodes=10502,mode=755)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
Now, I mounted 2nd rootfs into /mnt, then I run pivot_root
and chroot
.
# mount -t ubifs /dev/ubi1_0 /mnt/
# cd /mnt
# pivot_root . oldroot
# chroot . sh
# umount /oldroot
umount: can't unmount /oldroot: Device or resource busy
I mount proc
after pivot_root
and chroot
, and mount
showed.
# mount -t proc proc /proc
# mount
ubi0:rootfs on /oldroot type ubifs (rw,relatime,assert=read-only,ubi=0,vol=0)
devtmpfs on /oldroot/dev type devtmpfs (rw,relatime,size=42008k,nr_inodes=10502,mode=755)
proc on /oldroot/proc type proc (rw,relatime)
tmpfs on /oldroot/tmp type tmpfs (rw,relatime)
tmpfs on /oldroot/run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /oldroot/sys type sysfs (rw,relatime)
devpts on /oldroot/dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /oldroot/dev/shm type tmpfs (rw,relatime)
/dev/ubi1_0 on / type ubifs (rw,relatime,assert=read-only,ubi=1,vol=0)
proc on /proc type proc (rw,relatime)
I checked the comments and answer of https://unix.stackexchange.com/questions/306406/unable-to-umount-after-pivot-root
and tried the script, but I still failed with the same error.
What should I do to umount /oldroot
after pivot_root
and chroot
?
## Updated.
I found umount -l /oldroot
can umount the oldroot. But how can I relaunch the init
in the new_root
and go through the /etc/inittab
??
wangt13
(631 rep)
Dec 21, 2024, 09:02 AM
• Last activity: Dec 21, 2024, 01:57 PM
9
votes
2
answers
21805
views
How to login automatically without typing the root username or password in 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 h...
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.
Ciro Santilli OurBigBook.com
(19628 rep)
Jul 31, 2016, 11:44 AM
• Last activity: Aug 31, 2024, 08:55 AM
1
votes
1
answers
160
views
How to start the busybox shell in initramfs in Linux?
I am working on an embedded Linux system (kernel-5.10.24), and now I am trying to create the initramfs where there is an interactive shell. The rootfs is mainly based on `busybox`, and the `initramfs source` has following layout. ``` ├── bin ├── dev ├── etc ├── lib ├── lib32 -> lib/ ├── linuxrc -> b...
I am working on an embedded Linux system (kernel-5.10.24), and now I am trying to create the initramfs where there is an interactive shell.
The rootfs is mainly based on
busybox
, and the initramfs source
has following layout.
├── bin
├── dev
├── etc
├── lib
├── lib32 -> lib/
├── linuxrc -> bin/busybox
├── mnt
├── root
├── sbin
├── sys
└── usr
and,
initramfs/dev/
├── console
├── fd -> ../proc/self/fd
├── log -> ../tmp/log
├── null
├── stderr -> ../proc/self/fd/2
├── stdin -> ../proc/self/fd/0
└── stdout -> ../proc/self/fd/1
The initramfs/etc/inittab is
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen
#
# Note: BusyBox init doesn't support runlevels. The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: :::
#
# id == tty to run on, or empty for /dev/console
# runlevels == ignored
# action == one of sysinit, respawn, askfirst, wait, and once
# process == program to run
# now run any rc scripts
::sysinit:/etc/init.d/rcS
#no login
::respawn:-/bin/sh
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
null::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
* When the kernel command line is
loglevel=8 console=ttyS0,115200 rdinit=/linuxrc
The kernel bootup showing,
[ 2.684513] Freeing unused kernel memory: 4156K
[ 2.689193] This architecture does not have kernel memory protection.
[ 2.695885] Run /linuxrc as init process
[ 2.699931] with arguments:
[ 2.703000] /linuxrc
[ 2.705610] with environment:
[ 2.708849] HOME=/
[ 2.711289] TERM=linux
[ 2.714262] process '/bin/busybox' started with executable stack
There is NO shell prompt for interaction.
* When the kernel command line is,
loglevel=8 console=ttyS0,115200 rdinit=/bin/sh
kernel booted up, showing
[ 2.684492] Freeing unused kernel memory: 4156K
[ 2.689172] This architecture does not have kernel memory protection.
[ 2.695861] Run /bin/sh as init process
[ 2.699818] with arguments:
[ 2.702888] /bin/sh
[ 2.705409] with environment:
[ 2.708646] HOME=/
[ 2.711086] TERM=linux
[ 2.714059] process '/bin/busybox' started with executable stack
[ 2.722175] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
[ 2.730109] Rebooting in 10 seconds..
Kernel panic!
* Thirdly, I built a hello
into initramfs/bin/hello, it printed out Hello World!
to its stdout
and looped forever.
The command line is set to
loglevel=8 console=ttyS0,115200 rdinit=/bin/hello
There is NO Hello World!
shown!!!
So, now I am wondering how can I start the busybox
shell in the initramfs, what configuration should I do?
Thanks,
wangt13
(631 rep)
Aug 8, 2024, 01:45 PM
• Last activity: Aug 8, 2024, 11:43 PM
0
votes
1
answers
989
views
How to set console for auto login in inittab of busybox?
I am working on an embedded Linux system (kernel-5.10.24) with busybox as `init`. The kernel log is disabled in serial console without setting `console=` in kernel command line. So is the logs from init scripts launched by `/etc/init.d/rcS`. Now the `/etc/inittab` is set as follows, and I want to en...
I am working on an embedded Linux system (kernel-5.10.24) with busybox as
init
.
The kernel log is disabled in serial console without setting console=
in kernel command line. So is the logs from init scripts launched by /etc/init.d/rcS
.
Now the /etc/inittab
is set as follows, and I want to enable the auto-login of root to the system.
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen
#
# Note: BusyBox init doesn't support runlevels. The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: :::
#
# id == tty to run on, or empty for /dev/console
# runlevels == ignored
# action == one of sysinit, respawn, askfirst, wait, and once
# process == program to run
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Put a getty on the serial port
##OK##::respawn:/sbin/getty -L ttyS0 115200 vt100
ttyS0::respawn:-/bin/login -f root
#no login
#::respawn:-/bin/sh
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
null::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
I set the line of ttyS0::respawn:-/bin/login -f root
in the /etc/inittab
, but I cannot see the login prompt in serial console.
So in this case of no valid console is set kernel command line, how to auto-login to the system on the correct serial console ?
Or is there a way to set the system console on the fly in user space (without using getty -L
) ?
wangt13
(631 rep)
Nov 15, 2023, 08:27 AM
• Last activity: Nov 15, 2023, 12:46 PM
1
votes
0
answers
2125
views
How to start and manage a process in busybox inittab, and rcS as early as possible?
I am working on an embedded Linux system where busybox is being used as init. I have 2 requirements on running my application. 1. My application needs to start as early as possible; 2. It needs to be managed by busybox (respawn if it exits). Firstly, I started my application in /etc/inittab as follo...
I am working on an embedded Linux system where busybox is being used as init.
I have 2 requirements on running my application.
1. My application needs to start as early as possible;
2. It needs to be managed by busybox (respawn if it exits).
Firstly, I started my application in /etc/inittab as follows,
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Put a getty on the serial port
#ttyS3::respawn:/sbin/getty -L ttyS3 57600 vt100 # GENERIC_SERIAL
#no login
::respawn:/usr/bin/myapp
::respawn:-/bin/sh
In this way myapp is managed by busybox, when it exits, busybox will start it automatically.
But I found lots of services/daemons are started by /etc/init.d/rcS
before starting myapp.
this does NOT meet the 1st requirement.
I created /etc/init.d/S02myapp
(which is started by /etc/init.d/rcS
) to start my application in it, but it does not meet the 2nd requirement (I don't know if it is possible for busybox to manage the application started by rcS
).
Then I got another way to meet both requirements as follows,
1. Change /etc/init.d/S02myapp
, to start another myapp.sh
as a background process.
2. Create myapp.sh
, where it has a while-loop, in which myapp is started as foreground process.
With it myapp is started as early as possible (launched by rcS
) and if it exits, the while-loop in myapp.sh
will start it again.
I verified it worked, but I think this way is alittle ugly, for it shows something in ps ax
as follows,
1539 root 0:00 {myapp.sh} /bin/sh /etc/init.d/myapp.sh
1544 root 0:00 /sbin/mdev -df
1545 root 1:21 myapp
I am wondering if there is a clear way to satisfy my requirements for the application?
wangt13
(631 rep)
Apr 19, 2023, 06:12 AM
• Last activity: Apr 26, 2023, 11:57 PM
1
votes
0
answers
91
views
syslogd not ouputting year information
I updated busybox to 1.35.0 and had the same settings as earlier but for some reasons the syslogd is not outputting year in the timestamp information. Prior to this I was using busybox 1.19.3 and it was working fine. I tried to find that if any information related to year got changed but not succesf...
I updated busybox to 1.35.0 and had the same settings as earlier but for some reasons the syslogd is not outputting year in the timestamp information. Prior to this I was using busybox 1.19.3 and it was working fine. I tried to find that if any information related to year got changed but not succesful with that.
Can you help in getting the 'year' information as well in the time stamp.Thanks!
Apr 10 07:59:51 mytestapp: Mytestapp started
Apr 10 07:59:51 mytestapp: Mytestapp log1
Older logs:
Apr 08 11:54:52 2023 mytestapp: Mytestapp started
Apr 08 11:54:52 2023 mytestapp: Mytestapp log1
PS: I cannot use rsylog/syslog-ng.
m4n07
(191 rep)
Apr 13, 2023, 12:08 PM
3
votes
4
answers
223
views
Protect against vanishing output redirection targets
I have a daemon running on an embedded Linux device with its output redirected to the serial console: ```sh my_daemon > /dev/ttyS0 ``` But now if a user `exit`s the shell running on the serial interface then the serial device gets recreated, which causes the serial device to temporary vanish and the...
I have a daemon running on an embedded Linux device with its output redirected to the serial console:
my_daemon > /dev/ttyS0
But now if a user exit
s the shell running on the serial interface then the serial device gets recreated, which causes the serial device to temporary vanish and therefore causes my daemon to break.
Would there be some (straightforward) way to prevent this from happening? Perhaps some wrapper (or named pipe in combination with a process) in-between which retries to reconnect to the pipe target once it is gone? Buffering for that "offline" time is not needed.
phk
(6083 rep)
Aug 29, 2022, 03:16 PM
• Last activity: Sep 6, 2022, 04:13 AM
1
votes
1
answers
689
views
OpenWRT BusyBox init does not create /etc/init.d/rcS
I'm building an OpenWRT image (Chaos Calmer) that needs BusyBox to be configured to use `init`. So, in the busybox configuration, I enter the Init Utilities menu, then enable `init`, as well as support for reading an inittab file. When my image finishes building, it contains the following `/etc/init...
I'm building an OpenWRT image (Chaos Calmer) that needs BusyBox to be configured to use
init
. So, in the busybox configuration, I enter the Init Utilities menu, then enable init
, as well as support for reading an inittab file.
When my image finishes building, it contains the following /etc/inittab
file:
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
::askconsole:/bin/ash --login
This looks fine to me, except that /etc/init.d/rcS
does not exist. If I load this image onto the router, it obviously fails to boot with the following messages:
init started: BusyBox v1.23.2 (2019-08-29 09:26:36 CDT)
Bad inittab entry at line 3
can't run '/etc/init.d/rcS': No such file or directory
How should this be resolved? Am I supposed to add my own /etc/init.d/rcS
? If so, how should that be done (i.e., as its own OpenWRT package)? Is there a standard/default rcS script I can use as a template? Is there a configuration option to include this file that I may have missed? And why does it think the inittab entry on line 3 is wrong?
maldata
(165 rep)
Aug 29, 2019, 03:42 PM
• Last activity: Nov 25, 2020, 03:10 AM
0
votes
1
answers
668
views
Get time after boot
When Linux is booting there are timestamps which time something was loaded etc, so I think that information about boot start time must be available. Is there a way to run in any moment command or something that shows how many seconds until boot is, like for example `10.3452232`? It should work on bu...
When Linux is booting there are timestamps which time something was loaded etc, so I think that information about boot start time must be available. Is there a way to run in any moment command or something that shows how many seconds until boot is, like for example
10.3452232
?
It should work on busybox init system.
IzZy
(135 rep)
Aug 28, 2020, 10:16 PM
• Last activity: Aug 28, 2020, 10:20 PM
1
votes
1
answers
639
views
Can the Busybox init start a process as unprivileged user
I have a tiny, tiny system comprised of Busybox, an executable application and its dependent libraries ONLY. I am using the Busybox `/etc/inittab` to start the application as an unprivileged user: ::sysinit:/sbin/ifup -a -f ::respawn:/bin/busybox su unpriv-user -s /bin/sh -c 'my-executable --arg val...
I have a tiny, tiny system comprised of Busybox, an executable application and its dependent libraries ONLY. I am using the Busybox
/etc/inittab
to start the application as an unprivileged user:
::sysinit:/sbin/ifup -a -f
::respawn:/bin/busybox su unpriv-user -s /bin/sh -c 'my-executable --arg val --arg val'
The system has nothing else, and I don't want to install anything else. Is there a better way to instruct the Busybox inittab to start a process as a given user, or is using su
like I have the correct way to do this ?
starfry
(7710 rep)
Aug 28, 2020, 06:44 AM
• Last activity: Aug 28, 2020, 11:08 AM
0
votes
1
answers
243
views
Busybox init, Kivy python application appears to block execution of ifup
I am experimenting with Buildroot, trying to create a minimal system to optimise cold boot time into a Python application (Kivy GUI). I chose to use Busybox init process because this is supposed to be optimal for embedded systems. I have a Sxx script in `/etc/init.d` that starts my app: `#!/bin/sh p...
I am experimenting with Buildroot, trying to create a minimal system to optimise cold boot time into a Python application (Kivy GUI). I chose to use Busybox init process because this is supposed to be optimal for embedded systems. I have a Sxx script in
/etc/init.d
that starts my app:
`#!/bin/sh
python myapp.py 2 > errlog.txt &`
This works when I pass loglevel=8
on kernel command line. The system boots into my Kivy app and I am able to ping/ssh into the Raspberry Pi2. However if I pass loglevel=1
then eth0 no longer comes up (everything else is ok). Numbering the startup script S99myapp so that it is executed after S40network
does not affect the outcome. I also tried giving myapp low priority by starting it with nice -n 19 python myapp.py 2 > errlog.txt &
but this again does not help. The problem is still there even with the simplest Kivy app possible - the 'Hello Word' example from Kivy home page.
It looks like the Kivy app is somehow preventing ifup
from completing, unless enough time is bought with printing log messages to console. Can someone please explain what is happening? Is there a way round this?
user362397
(1 rep)
Jul 15, 2019, 11:15 AM
• Last activity: Jul 19, 2019, 10:52 AM
0
votes
1
answers
5787
views
Ubuntu 18.10 boots into initramfs busy shell
I am getting booted into the initramfs shell directly in ubuntu 18.10 I have tried the `exit` command which leads to the `manual fsck is required on /dev/sda2` When I enter `fsck /dev/sda2` the shell returns `Either the superblock or the partition table is likely to be corrupt! `Abort ?` keep in min...
I am getting booted into the initramfs shell directly in ubuntu 18.10
I have tried the
exit
command which leads to the manual fsck is required on /dev/sda2
When I enter fsck /dev/sda2
the shell returns
`Either the superblock or the partition table is likely to be corrupt!
Abort?
keep in mind sudo
bash
fdisk
or any other shell commands return a not found error.
user79267
(21 rep)
Apr 27, 2019, 07:38 AM
• Last activity: Apr 28, 2019, 08:56 PM
1
votes
0
answers
264
views
What is needed to make a busybox init boot to a shell on an arm device/phone?
I compiled busybox with `arm-linux-gnueabihf` for and Cortex-A/armv7-a arm device/phone. When I run the binary on android it works well. I decided to modify the android boot image. In the boot image ramdisk I have > bin/busybox > init which is a link to busybox I tried to boot with `linuxrc` in the...
I compiled busybox with
arm-linux-gnueabihf
for and Cortex-A/armv7-a arm device/phone. When I run the binary on android it works well. I decided to modify the android boot image. In the boot image ramdisk I have
> bin/busybox
> init which is a link to busybox
I tried to boot with linuxrc
in the root of the ramdisk but the phone/device reboots on boot. After I used init
it boots and just hangs on the logo. My assumption is that it is actually doing something and just hangs when its finished. Is it because I need to have populated stuff in the /dev
and /proc
?
What would I need to make it show me the black screen for login?
Is it because init hasn't connected to the output monitor which is the phones lcd?
Do I have to call busybox login
or busybox something
in my /etc/init.d/rcS
Bret Joseph
(491 rep)
Dec 18, 2018, 01:54 PM
1
votes
0
answers
2022
views
File not found when running a simple busybox system
I'm running Linux 4.1 and booting into a simple busybox environment. Busybox and shadow packages have been built as static and installed in my rootFS. Busybox is used for the /sbin/init and shadow's login is used for the /bin/login. I used makedevs to create /dev, and created /etc/{group,shadow,pass...
I'm running Linux 4.1 and booting into a simple busybox environment. Busybox and shadow packages have been built as static and installed in my rootFS. Busybox is used for the /sbin/init and shadow's login is used for the /bin/login. I used makedevs to create /dev, and created /etc/{group,shadow,passwd,inittab,rc}.
I installed this on my board and it boots up and seems okay until I press Enter to login. I get that the file /bin/login is not found. Adding to my /etc/rc script I can see that /bin/login exist and is executable. So why can't the system find it?
[ 3.875852] devtmpfs: mounted
[ 3.880023] Freeing unused kernel memory: 464K (c0994000 - c0a08000)
init started: BusyBox v1.26.2 (2018-08-16 15:09:07 EDT)
Got the init message
-rwxr-xr-x 1 0 0 43752 Nov 2 2018 /bin/login
Please press Enter to activate this console.
can't run '/bin/login': No such file or directory
Please press Enter to activate this console.
This is what my /etc/inittab looks like:
::sysinit:/etc/rc init
::askfirst:/bin/login
And my /etc/rc script:
#!/bin/sh
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
echo "Got the init message"
mount -n -t proc proc /proc 2>/dev/null
mount -n -t sysfs sysfs /sys 2>/dev/null
mount -o remount,rw,sync /
ls -l /bin/login
dangeroushobo
(707 rep)
Nov 2, 2018, 08:30 PM
0
votes
0
answers
536
views
System V - Respawn service but don't launch at boot
I'm trying to have a System V service relaunched on exit. ***EDIT:*** Should have precised that I'm using busybox init system instead of classic systemV I found that It could be done using `/etc/inittab` with the keyword `respawn` as action ([man inittab][1]). > respawn > The process will be restart...
I'm trying to have a System V service relaunched on exit.
***EDIT:*** Should have precised that I'm using busybox init system instead of classic systemV
I found that It could be done using
/etc/inittab
with the keyword respawn
as action (man inittab ).
> respawn
> The process will be restarted whenever it terminates (e.g. getty).
This seems to be the right action to set, however with respawn
the service will be launched at boot.
I would like to have this service restarted but only after it has been launched from command line.
**Is this possible to configure the service to respawn but not to be launched at boot ?**
Arkaik
(1198 rep)
Jun 25, 2018, 03:29 PM
• Last activity: Jun 26, 2018, 12:10 PM
0
votes
1
answers
939
views
Opening raw UBI partition for writing on Linux if it's mounted and used by init
I need to update a raw UBI partition with a new UBIFS image from Linux userspace with superuser rights, however I'm getting EBUSY (Device or resource busy) error whenever I'm trying to open my corresponding /dev/ubiX_Y for writing, even if the current filesystem present on it is mounted as read-only...
I need to update a raw UBI partition with a new UBIFS image from Linux userspace with superuser rights, however I'm getting
EBUSY
(Device or resource busy) error whenever I'm trying to open my corresponding /dev/ubiX_Y
for writing, even if the current filesystem present on it is mounted as read-only. I suspect that an usual block partition with e.g. an ext4 filesystem could be opened for writing when it's mounted as read-only, seeing that utilities like zerofree and ext4magic work that way. That doesn't seem to be the case with UBI partitions.
Theoretically I could either terminate the processes using the partition or attach to them and forcibly close all files on it before unmounting the partition completely, but seems I can do neither to the busybox init
process which keeps constantly holding its /etc/inittab
open. And yes, the partition in question is a root /
mounted partition.
I also could implement a kernel module which would do the dirty work, but I'd like to retain as much binary forward compatibility for my update utility and basically keep it as much kernel version agnostic as I can, thus solving it in such a manner is highly undesirable. Is there any other way I can do this?
gsnoff
(3 rep)
Mar 5, 2018, 08:46 AM
• Last activity: Mar 5, 2018, 08:03 PM
2
votes
1
answers
2589
views
busysbox reboot doesn't work from init script
We have Beaglebone black based custom board with 256MB RAM and 4GB eMMC. We upgraded from Linux-3.12 to Linux-4.4 and busybox-1.20.2 to busybox-1.26.2. Now in busybox-1.26.2 we are seeing and issue which was not there in busybox-1.20.2 I added following code in the one of the last init script. if [...
We have Beaglebone black based custom board with 256MB RAM and 4GB eMMC.
We upgraded from Linux-3.12 to Linux-4.4 and busybox-1.20.2 to busybox-1.26.2.
Now in busybox-1.26.2 we are seeing and issue which was not there in busybox-1.20.2
I added following code in the one of the last init script.
if [ -f /home/ankur ] ; then
count=50
rm /home/ankur
echo "----Check Whoami----"
whoami #prints root
reboot
echo "--------------------"
while [ true ]
do
count=$((count - 1 ))
echo "Count = $count"
if [ $count -le 0 ];then
break;
fi
echo "Sleep 1"
sleep 1
done
fi
I touched the file in
/home/ankur
and then rebooted the board.
What I observed is, system didn't reboot but counter went down to 0 and then other init script executed and then board rebooted.
So it seems like busybox is getting signal for reboot
but handling only after init scripts executed.
Now my question, is there a way to reboot
the board before completion of all init scripts. Is there any busybox config which will disable this reboot blockage ?
reboot -f
(force reboot without going through init) works but we need to run the stop script also so can't use it.
ART
(1221 rep)
Dec 12, 2017, 01:58 PM
• Last activity: Dec 12, 2017, 02:36 PM
5
votes
2
answers
4097
views
How can I get /bin/login to not timeout
In my `/etc/inittab` I am using the following line: ttyS0::respawn:/bin/login This gives me a login prompt if I want to connect to the serial port. But it keeps echoing this: [hostname] login: Login timed out [hostname] login: Login timed out [hostname] login: How can I stop that and get it to not t...
In my
/etc/inittab
I am using the following line:
ttyS0::respawn:/bin/login
This gives me a login prompt if I want to connect to the serial port. But it keeps echoing this:
[hostname] login:
Login timed out [hostname] login:
Login timed out [hostname] login:
How can I stop that and get it to not timeout?
So to clarify what came up in the comments:
* The login timeout is the regular expected behaviour
* I want to change that behaviour on my machine, so that login
does not timeout anymore
* In other Linux distributions you can edit LOGIN_TIMEOUT
in /etc/login.defs
as explained in this answer: https://unix.stackexchange.com/questions/144303/change-tty-login-timeout-archlinux
* This does not work in Busybox
Dakkaron
(2127 rep)
Jan 26, 2017, 03:41 PM
• Last activity: Jan 26, 2017, 09:23 PM
7
votes
1
answers
10204
views
Set environment variable (TZ) for all startup scripts and inittab
I'm working on an embedded Linux system and looking for a way to set the time zone for all processes. The question is: Is there any possibility to set the `TZ` environment variable at boot time (init scripts) so that all other init scripts have `TZ` set at start up? The system is based on the BusyBo...
I'm working on an embedded Linux system and looking for a way to set the time zone for all processes.
The question is: Is there any possibility to set the
TZ
environment variable at boot time (init scripts) so that all other init scripts have TZ
set at start up?
The system is based on the BusyBox tools. I tried a script in /etc/profile.d/
folder.
export TZ="GMT-1"
But the init scripts do not have the variable set.
The only way I see is that *all* start scripts set this variable by themselves.
Are there other solutions for this problem?
Klaus
(73 rep)
Mar 1, 2016, 11:54 AM
• Last activity: Mar 2, 2016, 12:57 AM
Showing page 1 of 19 total questions