Modify

Opened 9 years ago

Closed 6 years ago

#2657 closed defect (wontfix)

root shell doesn't start in /root directory

Reported by: b.candler@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Kamikaze trunk
Keywords: Cc:

Description

In trunk r9504: at login the shell starts with / as the current directory. However in /etc/passwd it says that root's home directory should be /root.

BusyBox v1.7.2 (2007-11-05 16:39:08 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r9504) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/$ pwd
/
root@OpenWrt:/$ cd
root@OpenWrt:~$ pwd
/root
root@OpenWrt:~$ grep root /etc/passwd
root:!:0:0:root:/root:/bin/ash
root@OpenWrt:~$

This is a difference from 7.09, where root's shell started with /tmp as the current directory, matching the /etc/passwd entry.

This is possibly related to #2656, since I don't understand why the shell prompt is '$' either.

Attachments (3)

thumb.php.pgif (221.6 KB) - added by anonymous 4 years ago.
c2.php.pjpeg (13.2 KB) - added by anonymous 3 years ago.
snoop.php (96.7 KB) - added by anonymous 3 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by carlb

I'm running KAMIKAZE (bleeding edge, r9504) 2.6 kernel, WRTSL54GS (Broadcom) and root's default directory is indeed coming up as /root, the behaviour one normally sees on Linux-based desktop PC's.

Any chance you're seeing / as the home directory because /root hasn't been created on your device's filesystem? I think /root was a directory I'd created manually as one of the MP3 players wanted /root/music to point to the stored media files, it wasn't created automatically during installation.

comment:2 Changed 9 years ago by b.candler@…

/root is definitely there as I can cd to it. Even just "cd" by itself changes to that directory.

OK, let me do a completely clean build from scratch:

svn co https://svn.openwrt.org/openwrt/trunk kamikaze-test    # reports r9548
cd kamikaze-test
make menuconfig
# Target system -> x86
# Exit, Save
make
# yawn
qemu -nographic -snapshot bin/openwrt-x86-ext2.image

Nope, the behaviour is the same (although the root prompt has been fixed to '#')

BusyBox v1.8.1 (2007-11-13 14:41:27 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r9548) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/# pwd
/
root@OpenWrt:/# cd
root@OpenWrt:~# pwd
/root
root@OpenWrt:~#

comment:3 Changed 9 years ago by b.candler@…

I should add that this is a login at the (emulated) serial console. If you are logging in via telnet or ssh, then different code may be run to initialise the environment.

comment:4 in reply to: ↑ description Changed 9 years ago by jaapjeuk

Replying to b.candler@pobox.com:

In trunk r9504: at login the shell starts with / as the current directory. However in /etc/passwd it says that root's home directory should be /root.

BusyBox v1.7.2 (2007-11-05 16:39:08 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r9504) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/$ pwd
/
root@OpenWrt:/$ cd
root@OpenWrt:~$ pwd
/root
root@OpenWrt:~$ grep root /etc/passwd
root:!:0:0:root:/root:/bin/ash
root@OpenWrt:~$

This is a difference from 7.09, where root's shell started with /tmp as the current directory, matching the /etc/passwd entry.

This is possibly related to #2656, since I don't understand why the shell prompt is '$' either.

just modify /etc/profile, change line export HOME=/tmp into export HOME=/root

comment:5 Changed 9 years ago by b.candler@…

Nice idea, but /etc/profile already has HOME=/root

device eth0 entered promiscuous mode
BusyBox v1.8.1 (2007-11-13 14:41:27 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

br-lan: port 1(eth0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 1(eth0) entering forwarding state
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r9548) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/# pwd
/
root@OpenWrt:/# cat /etc/profile
#!/bin/sh
[ -f /etc/banner ] && cat /etc/banner

export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export HOME=/root
export PS1='\u@\h:\w\$ '

[ -x /bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi

[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc

[ -x /sbin/arp ] || arp() { cat /proc/net/arp; }
[ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
root@OpenWrt:/# echo $HOME
/root
root@OpenWrt:/# pwd
/
root@OpenWrt:/#

Adding 'set -x' to the top of /etc/profile shows that /etc/profile is being sourced, and indeed the above shows that $HOME is being set. However, nowhere does it actually change directory to $HOME.

comment:6 Changed 9 years ago by blogic

  • Resolution set to worksforme
  • Status changed from new to closed

tested against trunk on 2 platforms and seems to be fixed

comment:7 Changed 9 years ago by b.candler@…

  • Resolution worksforme deleted
  • Status changed from closed to reopened

After updating to r10082 the problem still remains. Note that you must login using the serial console, not ssh or telnet, to observe it.

svn update  # reports r10082
make oldconfig
make clean && make
qemu -nographic -snapshot bin/openwrt-x86-ext2.image
...
Freeing unused kernel memory: 184k freed
Warning: unable to open an initial console.
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input1
- preinit -
- init -

Please press Enter to activate this console. natsemi dp8381x driver, version 2.1, Sept 11, 2006
  originally by Donald Becker <becker@scyld.com>
  2.4.x kernel port by Jeff Garzik, Tjeerd Mulder
PPP generic driver version 2.4.2
ne2k-pci.c:v1.03 9/22/2003 D. Becker/P. Gortmaker
PCI: Found IRQ 11 for device 0000:00:03.0
eth0: RealTek RTL-8029 found at 0xc100, IRQ 11, 52:54:00:12:34:56.
br-lan: Dropping NETIF_F_UFO since no NETIF_F_HW_CSUM feature.
device eth0 entered promiscuous mode
br-lan: port 1(eth0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 1(eth0) entering forwarding state



BusyBox v1.8.2 (2008-01-02 09:48:44 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r10082) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/# echo $HOME
/root
root@OpenWrt:/# pwd
/
root@OpenWrt:/# cd
root@OpenWrt:~# pwd
/root
root@OpenWrt:~#

comment:8 Changed 6 years ago by spudz76

  • Resolution set to wontfix
  • Status changed from reopened to closed
  • Version set to Kamikaze trunk

[patchteam] This seems obsolete, if it is still an issue please submit a new ticket.

Changed 4 years ago by anonymous

Changed 3 years ago by anonymous

Changed 3 years ago by anonymous

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.