su -c "killall test"

이런식으로 스크립트에서 실행이 되는데

어떠한 이유로 이런 에러가 발생하는지는 미지수.


root     2204    1  0 14:10 ?        00:00:03 /opt/bin/test

root     2212 2204  0 14:10 ?        00:00:00 [sh] <defunct>

root     2220 2204  0 14:10 ?        00:00:00 [sh] <defunct>

root     2228 2204  0 14:10 ?        00:00:00 [sh] <defunct>




...

알고보니 ps 버전이 busybox와 일반 버전의 출력포맷이 달라서 생긴 문제.. 헐.. -_-

'프로그램 사용 > busybox' 카테고리의 다른 글

sh: line 1: kill: root: no such pid  (0) 2015.01.05
busybox su가 안될 경우  (0) 2014.12.05
busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ash "cannot open /dev/ttyAS1: no such device"  (0) 2010.04.20
busybox ps는 BSD 스타일?  (0) 2010.01.12
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2014. 12. 5. 14:22
su -c 해서 명령어를 실행시 아래와 같은 에러가 발생하는데
setresgid: Operation not permitted 

해결책은..
$ chmod +s /bin/busybox

su는 SUID 명령으로 다른 사람의 퍼미션으로 변경이 가능해야 하는데
rwsr-sr-s가 아닌
rwxr-xr-x 이면 다른 사람으로 퍼미션으로 변경이 불가능 하므로
위와 같은 에러가 발생한다.

[링크 : https://forum.openwrt.org/viewtopic.php?id=30690]

'프로그램 사용 > busybox' 카테고리의 다른 글

sh: line 1: kill: root: no such pid  (0) 2015.01.05
busybox su가 안될 경우  (0) 2014.12.05
busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ash "cannot open /dev/ttyAS1: no such device"  (0) 2010.04.20
busybox ps는 BSD 스타일?  (0) 2010.01.12
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2013. 6. 18. 18:31

# tftp
BusyBox v1.2.2 (2007.03.11-00:56+0000) multi-call binary

Usage: tftp [OPTION]... HOST [PORT]

Transfers a file from/to a tftp server using "octet" mode.

Options:
        -l FILE Local FILE
        -r FILE Remote FILE
        -g      Get file
        -p      Put file 

# tftp -g -r uImage 192.168.10.33 

이렇게 써야 할거면..
 
 
# tftp
BusyBox v1.2.2 (2007.03.11-00:56+0000) multi-call binary

Usage: tftp [[OPTION1] [OPTION2]]... HOST [PORT]

Transfers a file from/to a tftp server using "octet" mode.

Option1:
        -l FILE Local FILE
        -r FILE Remote FILE

Option2:
        -g      Get file
        -p      Put file 

이렇게 하던가!!!

[링크 : http://blog.daum.net/heyjun/15705355]

'프로그램 사용 > busybox' 카테고리의 다른 글

sh: line 1: kill: root: no such pid  (0) 2015.01.05
busybox su가 안될 경우  (0) 2014.12.05
busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ash "cannot open /dev/ttyAS1: no such device"  (0) 2010.04.20
busybox ps는 BSD 스타일?  (0) 2010.01.12
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2011. 10. 21. 18:50
설명은 콘솔 출력을 /dev/console에서 다른걸로 돌려주는거라는데
kernel 부팅 인자로 console=ttyS0,115200n8 이런걸 넣어줘서
telnet 포트로 돌려줄려고 하니 안되는건 여전한듯..

# setconsole --help
BusyBox v1.14.2 (2011-01-24 14:35:28 KST) multi-call binary

Usage: setconsole [-r|--reset] [DEVICE]

Redirect system console output to DEVICE (default: /dev/tty)

Options:
        -r      Reset output to /dev/console 

# tty
/dev/pts/0

# setconsole /dev/pts/0
setconsole: TIOCCONS: Device or resource busy 


 

'프로그램 사용 > busybox' 카테고리의 다른 글

busybox su가 안될 경우  (0) 2014.12.05
busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ash "cannot open /dev/ttyAS1: no such device"  (0) 2010.04.20
busybox ps는 BSD 스타일?  (0) 2010.01.12
ifup / ifdown 을 통한 static <-> dhcp 변환  (0) 2009.12.29
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2010. 4. 20. 20:08
원인은 못찾았지만, 커널 옵션에서 quiet 주어도 나오길래, 최소한 커널 오류는 아닌것으로 판단
busybox에서 찾아보니

./shell/ash.c:4849:     ash_msg_and_raise_error("cannot open %s: %s", fname, errmsg(errno, "no such file"));

한녀석이 걸려 나온다.

특이한건, 이 소스가 있는 부분은 openredirect라는 함수.
음.. 머하는 녀석일려나?

static int
openredirect(union node *redir)
{
    char *fname;
    int f;

    switch (redir->nfile.type) {
    case NFROM:
        fname = redir->nfile.expfname;
        f = open(fname, O_RDONLY);
        if (f < 0)
            goto eopen;
        break;
    case NFROMTO:
        fname = redir->nfile.expfname;
        f = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
        if (f < 0)
            goto ecreate;
        break;
    case NTO:
        /* Take care of noclobber mode. */
        if (Cflag) {
            fname = redir->nfile.expfname;
            f = noclobberopen(fname);
            if (f < 0)
                goto ecreate;
            break;
        }
        /* FALLTHROUGH */
    case NCLOBBER:
        fname = redir->nfile.expfname;
        f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666);
        if (f < 0)
            goto ecreate;
        break;
    case NAPPEND:
        fname = redir->nfile.expfname;
        f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666);
        if (f < 0)
            goto ecreate;
        break;
    default:
#if DEBUG
        abort();
#endif
        /* Fall through to eliminate warning. */
    case NTOFD:
    case NFROMFD:
        f = -1;
        break;
    case NHERE:
    case NXHERE:
        f = openhere(redir);
        break;
    }

    return f;
 ecreate:
    ash_msg_and_raise_error("cannot create %s: %s", fname, errmsg(errno, "nonexistent directory"));
 eopen:
    ash_msg_and_raise_error("cannot open %s: %s", fname, errmsg(errno, "no such file"));
}


2010.04.21 추가
inittab에 ttyAS1을 초기화 하는 부분이 있었는데, 커널에서(?) 사용하지 않도록 해놔서 계속 에러가 난 모양이다.
아무튼, /bin/sh에 ttyAS1을 열도록 해놓았기 때문에, busybox에서 ash이 sh을 대체하고,
그러다 보니 ash에서 에러발생. 머.. 문제 해결 끝!

$ cat target/etc/inittab
# Example Busybox inittab
::sysinit:/etc/init.d/rcS
ttyAS0::askfirst:/bin/sh
ttyAS1::askfirst:/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
::restart:/sbin/init

'프로그램 사용 > busybox' 카테고리의 다른 글

busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ash "cannot open /dev/ttyAS1: no such device"  (0) 2010.04.20
busybox ps는 BSD 스타일?  (0) 2010.01.12
ifup / ifdown 을 통한 static <-> dhcp 변환  (0) 2009.12.29
udhcpd 용 interface 예제  (0) 2009.12.23
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2010. 1. 12. 13:39
# ps
  PID USER       VSZ STAT COMMAND
    1 root      3120 S    init
    2 root         0 SW<  [ksoftirqd/0]
    3 root         0 SW   [watchdog/0]
    4 root         0 SW<  [events/0]

STAT의 값들을 보면 ps의 BSD style의 내용과 같다.

PROCESS STATE CODES
Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to
describe the state of a process.
D    Uninterruptible sleep (usually IO)
R    Running or runnable (on run queue)
S    Interruptible sleep (waiting for an event to complete)
T    Stopped, either by a job control signal or because it is being traced.
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    Defunct ("zombie") process, terminated but not reaped by its parent.

For BSD formats and when the stat keyword is used, additional characters may be displayed:
<    high-priority (not nice to other users)
N    low-priority (nice to other users)
L    has pages locked into memory (for real-time and custom IO)
s    is a session leader
l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+    is in the foreground process group

그냥.. 안드로메다 스타일인가? -ㅁ-

아무튼, busybox의 ps에는 priority가 나오지 않는다.
이경우 수작업으로 확인하려면, /proc/{pid}/stat의 19번째 항목을 확인하면 된다.

stat - Status information about the process used by the ps(1) command. Fields are:

1. pid - Process id
2. comm - The executable filename
3. state - R (running), S(sleeping interruptable), D(sleeping), Z(zombie), or T(stopped on a signal).
4. ppid - Parent process ID
5. pgrp - Process group ID
6. session - The process session ID.
7. tty - The tty the process is using
8. tpgid - The process group ID of the owning process of the tty the current process is connected to.
9. flags - Process flags, currently with bugs
10. minflt - Minor faults the process has made
11. cminflt - Minor faults the process and its children have made.
12. majflt
13. cmajflt
14. utime - The number of jiffies (processor time) that this process has been scheduled in user mode
15. stime - in kernel mode
16. cutime - This process and its children in user mode
17. cstime - in kernel mode
18. counter - The maximum time of this processes next time slice.
19. priority - The priority of the nice(1) (process priority) value plus fifteen.
20. timeout - The time in jiffies of the process's next timeout.
21. itrealvalue - The time in jiffies before the next SIGALRM is sent to the process because of an internal timer.
22. starttime - Time the process started after system boot
23. vsize - Virtual memory size
24. rlim - Current limit in bytes of the rss of the process.
25. startcode - The address above which program text can run.
26. endcode - The address below which program text can run.
27. startstack - The address of the start of the stack
28. kstkesp - The current value of esp for the process as found in the kernel stack page.
29. kstkeip - The current 32 bit instruction pointer, EIP.
30. signal - The bitmap of pending signals
31. blocked - The bitmap of blocked signals
32. sigignore - The bitmap of ignored signals
33. sigcatch - The bitmap of catched signals
34. wchan - The channel in which the process is waiting. The "ps -l" command gives somewhat of a list.

[링크 : http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlproc.html]

# cat /proc/2/stat
2 (ksoftirqd/0) S 1 1 1 0 -1 32832 0 0 0 0 0 332 0 0 10 -5 1 0 5 0 0 4294967295 0 0 0 0 0 0 2147483647 0 0 2314662996 0 0 17 0 0 0

아무튼 이녀석은 -5 nice 값을 가지고, 0보다 우선권을 가지므로 ps에서
<를 출력해서 다른 것들보다 우선순위가 높음을 나타낸다.
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2009. 12. 29. 14:47
windows나 linux에서는 static / dhcp 변환이 자유롭다.
박스에서 이 기능을 구현하기 위해 ifup / ifdown 을 사용하여 구현을 하려고 했다.

일단 구현되어야 할 내용은
static -> dhcp
dhcp -> static
인데, 문제는 dhcp -> static이었다.

이유는 모르겠지만,
# ifdown -i interface.dhcp eth0
# ifup -i interface.static eth0
를 해도 dhcp에서 받아왔던 아이피로 남아있는데

일단 미봉책으로
# ifdown -i interface.dhcp eth0
# ifup -i interface.static eth0
# ifdown -i interface.static eth0
# ifup -i interface.static eth0
이렇게 static한 설정을 한번더 down/up 해주니 문제없이 아이피가 설정이 된다.

대부분의 예제 파일들이,

static up/down
dhcp up
예제만 있지,

dhcp down
static -> dhcp
는 존재하지 않는다.

아무튼, 일단은 되는게 장땡 -ㅁ-!
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2009. 12. 23. 15:58
udhcp는 dhcp client 겸, network setting tool이다.
아무튼 busybox에서 채택하고 있는 dhcp client 이며, 나름 쓸만한 녀석이다.

######################################################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
#
# A "#" character in the very first column makes the rest of the line
# be ignored. Blank lines are ignored. Lines may be indented freely.
# A "\" character at the very end of the line indicates the next line
# should be treated as a continuation of the current one.
#
# The "pre-up", "up", "down" and "post-down" options are valid for all
# interfaces, and may be specified multiple times. All other options
# may only be specified once.
#
# See the interfaces(5) manpage for information on what options are
# available.
######################################################################

# We always want the loopback interface.
#
# auto lo
# iface lo inet loopback

# An example ethernet card setup: (broadcast and gateway are optional)
#
# auto eth0
# iface eth0 inet static
#     address 192.168.0.42
#     network 192.168.0.0
#     netmask 255.255.255.0
#     broadcast 192.168.0.255
#     gateway 192.168.0.1

# A more complicated ethernet setup, with a less common netmask, and a downright
# weird broadcast address: (the "up" lines are executed verbatim when the
# interface is brought up, the "down" lines when it's brought down)
#
# auto eth0
# iface eth0 inet static
#     address 192.168.1.42
#     network 192.168.1.0
#     netmask 255.255.255.128
#     broadcast 192.168.1.0
#     up route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2
#     up route add default gw 192.168.1.200
#     down route del default gw 192.168.1.200
#     down route del -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2

# A more complicated ethernet setup with a single ethernet card with
# two interfaces.
# Note: This happens to work since ifconfig handles it that way, not because
# ifup/down handles the ':' any differently.
# Warning: There is a known bug if you do this, since the state will not
# be properly defined if you try to 'ifdown eth0' when both interfaces
# are up. The ifconfig program will not remove eth0 but it will be
# removed from the interfaces state so you will see it up until you execute:
# 'ifdown eth0:1 ; ifup eth0; ifdown eth0'
# BTW, this is "bug" #193679 (it's not really a bug, it's more of a
# limitation)
#
# auto eth0 eth0:1
# iface eth0 inet static
#     address 192.168.0.100
#     network 192.168.0.0
#     netmask 255.255.255.0
#     broadcast 192.168.0.255
#     gateway 192.168.0.1
# iface eth0:1 inet static
#     address 192.168.0.200
#     network 192.168.0.0
#     netmask 255.255.255.0

# "pre-up" and "post-down" commands are also available. In addition, the
# exit status of these commands are checked, and if any fail, configuration
# (or deconfiguration) is aborted. So:
#
# auto eth0
# iface eth0 inet dhcp
#     pre-up [ -f /etc/network/local-network-ok ]
#
# will allow you to only have eth0 brought up when the file
# /etc/network/local-network-ok exists.

# Two ethernet interfaces, one connected to a trusted LAN, the other to
# the untrusted Internet. If their MAC addresses get swapped (because an
# updated kernel uses a different order when probing for network cards,
# say), then they don't get brought up at all.
#
# auto eth0 eth1
# iface eth0 inet static
#     address 192.168.42.1
#     netmask 255.255.255.0
#     pre-up /path/to/check-mac-address.sh eth0 11:22:33:44:55:66
#     pre-up /usr/local/sbin/enable-masq
# iface eth1 inet dhcp
#     pre-up /path/to/check-mac-address.sh eth1 AA:BB:CC:DD:EE:FF
#     pre-up /usr/local/sbin/firewall

# Two ethernet interfaces, one connected to a trusted LAN, the other to
# the untrusted Internet, identified by MAC address rather than interface
# name:
#
# auto eth0 eth1
# mapping eth0 eth1
#     script /path/to/get-mac-address.sh
#     map 11:22:33:44:55:66 lan
#     map AA:BB:CC:DD:EE:FF internet
# iface lan inet static
#     address 192.168.42.1
#     netmask 255.255.255.0
#     pre-up /usr/local/sbin/enable-masq $IFACE
# iface internet inet dhcp
#     pre-up /usr/local/sbin/firewall $IFACE

# A PCMCIA interface for a laptop that is used in different locations:
# (note the lack of an "auto" line for any of these)
#
# mapping eth0
#    script /path/to/pcmcia-compat.sh
#    map home,*,*,*                  home
#    map work,*,*,00:11:22:33:44:55  work-wireless
#    map work,*,*,01:12:23:34:45:50  work-static
#
# iface home inet dhcp
# iface work-wireless bootp
# iface work-static static
#     address 10.15.43.23
#     netmask 255.255.255.0
#     gateway 10.15.43.1
#
# Note, this won't work unless you specifically change the file
# /etc/pcmcia/network to look more like:
#
#     if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
#     get_info $DEVICE
#     case "$ACTION" in
#         'start')
#             /sbin/ifup $DEVICE
#             ;;
#         'stop')
#             /sbin/ifdown $DEVICE
#             ;;
#     esac
#     exit 0

# An alternate way of doing the same thing: (in this case identifying
# where the laptop is is done by configuring the interface as various
# options, and seeing if a computer that is known to be on each particular
# network will respond to pings. The various numbers here need to be chosen
# with a great deal of care.)
#
# mapping eth0
#    script /path/to/ping-places.sh
#    map 192.168.42.254/24 192.168.42.1 home
#    map 10.15.43.254/24 10.15.43.1 work-wireless
#    map 10.15.43.23/24 10.15.43.1 work-static
#
# iface home inet dhcp
# iface work-wireless bootp
# iface work-static static
#     address 10.15.43.23
#     netmask 255.255.255.0
#     gateway 10.15.43.1
#
# Note that the ping-places script requires the iproute package installed,
# and the same changes to /etc/pcmcia/network are required for this as for
# the previous example.

# Set up an interface to read all the traffic on the network. This
# configuration can be useful to setup Network Intrusion Detection
# sensors in 'stealth'-type configuration. This prevents the NIDS
# system to be a direct target in a hostile network since they have
# no IP address on the network. Notice, however, that there have been
# known bugs over time in sensors part of NIDS (for example see
# DSA-297 related to Snort) and remote buffer overflows might even be
# triggered by network packet processing.
#
# auto eth0
# iface eth0 inet manual
#     up ifconfig $IFACE 0.0.0.0 up
#       up ip link set $IFACE promisc on
#       down ip link set $IFACE promisc off
#       down ifconfig $IFACE down

# Set up an interface which will not be allocated an IP address by
# ifupdown but will be configured through external programs. This
# can be useful to setup interfaces configured through other programs,
# like, for example, PPPOE scripts.
#
# auto eth0
# iface eth0 inet manual
#       up ifconfig $IFACE 0.0.0.0 up
#       up /usr/local/bin/myconfigscript
#       down ifconfig $IFACE down

[링크 : http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/]

[링크 : http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html]

[링크 : http://pig.cs.upt.ro/cgi-bin/man/man2html?interfaces+5]
Posted by 구차니

댓글을 달아 주세요

프로그램 사용/busybox2009. 12. 2. 19:00
static / dhcp 로 변경하는 일련의 함수들을 만들었는데,

static -> interface 파일변경 -> ifdown -> ifup -> dhcp
dhcp -> interface 파일변경 -> ifdown -> ifup -> static

순서로 작동되도록 했는데,
static에서 dhcp로는 udhcp 프로세스가 이상없이 작동하는데
dhcp에서 static으로는 udhcp 프로세스가 죽지 않는다.

그래서 계속 순환하면 udhcp 프로세스가 쌓여간다(좀비는 아니고 Sleep 상태)


아무튼,

dhcp -> ifdown -> interface 파일변경 -> ifup -> static
으로 하니 제대로 작동한다.

아마 interface 파일 내용에
ifdown에 관련한 내용이 제대로 들어 있지않아 그랬던 것으로 보인다.


상관이 있을지 없을지 모르는 링크
[링크 : http://lists.busybox.net/pipermail/busybox/2007-July/062158.html]
Posted by 구차니

댓글을 달아 주세요



위의 옵션은 1.14.3에도 존재하는 녀석이다.
Shell - alias support를 선택해주면 된다.
Posted by 구차니

댓글을 달아 주세요