lixuewei / rt-n56u

Automatically exported from code.google.com/p/rt-n56u
0 stars 0 forks source link

Installing Entware on N56U -sh: opkg: not found #1324

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.USB erased
2.Partition created
3.Folders created

/home/root # opkg update
-sh: opkg: not found

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

RT-N56U_3.0.3.8-081_trmd & Windows 7

The rest of the putty Output:

login as: admin
admin@192.168.0.1's password:

BusyBox v1.22.1 (2014-04-12 19:32:26 KRAT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/root # cat /proc/partitions
major minor  #blocks  name

  31        0        192 mtdblock0
  31        1         64 mtdblock1
  31        2         64 mtdblock2
  31        3       1200 mtdblock3
  31        4       6607 mtdblock4
  31        5         64 mtdblock5
  31        6       7872 mtdblock6
   8        0    3944448 sda
   8        1    3942933 sda1
/home/root # fdisk -lu /dev/sda

Disk /dev/sda: 4039 MB, 4039114752 bytes
255 heads, 63 sectors/track, 491 cylinders, total 7888896 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1            2048     7887914     3942933+  b Win95 FAT32
/home/root # fdisk /dev/sda

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-491, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-491, default 491): Using default 
value 491

Command (m for help): p

Disk /dev/sda: 4039 MB, 4039114752 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1         491     3942933+ 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: 
Device or resource busy
/home/root # fdisk -lu /dev/sda

Disk /dev/sda: 4039 MB, 4039114752 bytes
255 heads, 63 sectors/track, 491 cylinders, total 7888896 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1            2048     7887914     3942933+ 83 Linux
/home/root # ejusb
/home/root # mkfs.ext4 -m 0 -T largefile -L Main /dev/sda1
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=Main
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3968 inodes, 985733 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1010827264
31 block groups
32768 blocks per group, 32768 fragments per group
128 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

/home/root # mkdir /media/Main
/home/root # mount -t ext4 /dev/sda1 /media/Main
/home/root # mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=8k)
tmpfs on /etc type tmpfs (rw,noatime,size=2048k)
tmpfs on /home type tmpfs (rw,relatime,size=1024k)
tmpfs on /media type tmpfs (rw,relatime,size=8k)
tmpfs on /mnt type tmpfs (rw,relatime,size=8k)
tmpfs on /tmp type tmpfs (rw,relatime,size=24576k)
tmpfs on /var type tmpfs (rw,relatime,size=4096k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/sda1 on /media/Main type ext4 
(rw,relatime,user_xattr,barrier=1,data=ordered)
/home/root # mkdir /media/Main/opt
/home/root # opkg update
-sh: opkg: not found
/home/root # mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=8k)
tmpfs on /etc type tmpfs (rw,noatime,size=2048k)
tmpfs on /home type tmpfs (rw,relatime,size=1024k)
tmpfs on /media type tmpfs (rw,relatime,size=8k)
tmpfs on /mnt type tmpfs (rw,relatime,size=8k)
tmpfs on /tmp type tmpfs (rw,relatime,size=24576k)
tmpfs on /var type tmpfs (rw,relatime,size=4096k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/sda1 on /media/Main type ext4 
(rw,relatime,user_xattr,barrier=1,data=ordered)
/home/root # opkg update
-sh: opkg: not found

Original issue reported on code.google.com by Iosif.Za...@gmail.com on 30 Aug 2014 at 5:10

GoogleCodeExporter commented 9 years ago
In the end I am interested to create a script file that will reboot the router 
each day at a specified time.

Thanks

Original comment by Iosif.Za...@gmail.com on 30 Aug 2014 at 5:13

GoogleCodeExporter commented 9 years ago
=)
You forgot to switch 'Use Entware' in web interface.

As for second question: read CommonTips in Wiki. There should be a tip how to 
create crontask or smth. like that.

For future, use search tools and read wiki before posting an issue. Thousands 
of such questions were discussed long time ago.

Original comment by d...@soulblader.com on 30 Aug 2014 at 5:27

GoogleCodeExporter commented 9 years ago
I didn't forgot. Entware is enabled in the web interface.

not funny

Original comment by Iosif.Za...@gmail.com on 30 Aug 2014 at 6:07

GoogleCodeExporter commented 9 years ago
Aparently I made it work (I have no serious idea how tough).

Related to the reboot script I've found only one link:

https://code.google.com/p/rt-n56u/issues/detail?id=562#c1

Any ideas how can i make it to reboot at a specific hour ?

Thanks.

Original comment by Iosif.Za...@gmail.com on 30 Aug 2014 at 7:47

GoogleCodeExporter commented 9 years ago
You searched in wrong place. I've written about Wiki 
https://code.google.com/p/rt-n56u/wiki/CommonTips?wl=en#Using_the_built-in_sched
uler_%28crond%29

specially for you. Add the following to /etc/storage/started_script.sh:

####
crond_env() {
 [ -x /usr/sbin/crond ] || return 1
 [ -d /var/spool/cron/crontabs ] || mkdir -p -m 700 /var/spool/cron/crontabs
 cat > /var/spool/cron/crontabs/admin << EOF
SHELL=/bin/sh
MAILTO=root
HOME=/
30 01 * * * /sbin/reboot
EOF
 chmod 600 /var/spool/cron/crontabs/admin
 [ -z "`pidof crond`" ] && /usr/sbin/crond
}

crond_env
###

then run:
# mtd_storage.sh save

The line:  30 01 * * * /sbin/reboot means - "execute /sbin/reboot every day at 
1:30".
See crontab man for details!

Original comment by d...@soulblader.com on 30 Aug 2014 at 8:27