-sh: can't create /etc/opkg.conf: Read-only file system
When i look in the map /etc via WinSCP there is no file named opkg.conf also i can't chmod /etc
any body with the same problem?
I want to install a package wput, then my router can upload some file's to a FTP server. But now he only knows wget, and that is not enough ....
Posted: Sun Jul 22, 2012 17:20 Post subject: Re: [Howto] Install Optware on Atheros units (such as WNDR37
Quote:
Under DD-WRT’s web interface, Administration->Commands, input the following commands in the window then click "Save Startup":
#!/bin/sh
sleep 5
if [ -f /mnt/sda_part1/optware.enable ]; then
mount -o bind /mnt/sda_part1/etc /etc
mount -o bind /mnt/sda_part1/root /tmp/root
mount -o bind /mnt/sda_part1/opt /opt
else
exit
fi
if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi
As I'm new to DD-WRT and this forum, I just wanted to thank dynek for the simple and detailed tutorial and add a thing that came to my attention after I had completed the tutorial successfully.
I noticed that every time I make a change in the Web GUI and "apply changes" the startup script seems to run and add addidtional bind points every time.
Have a look at the output below after I made a change thru the Web GUI:
Code:
root@DD-WRT 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)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,size=512k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
devpts on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /tmp/mnt/sda_part1 type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /etc type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /tmp/root type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /opt type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /etc type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /tmp/root type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /opt type ext2 (rw,relatime,errors=continue,user_xattr)
As you can see, all bind points that the script executes are added again even thou they already exists.
Therefore, I added some code to the script that checks for the bind points and skips that step if the point already exists.
Code:
#!/bin/sh
sleep 5
if [ -f /mnt/sda_part1/optware.enable ]; then
if ! mount | grep "/dev/sda1 on /etc type" >/dev/null ; then
mount -o bind /mnt/sda_part1/etc /etc
fi
if ! mount | grep "/dev/sda1 on /tmp/root type" >/dev/null ; then
mount -o bind /mnt/sda_part1/root /tmp/root
fi
if ! mount | grep "/dev/sda1 on /opt type" >/dev/null ; then
mount -o bind /mnt/sda_part1/opt /opt
fi
else
exit
fi
if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi
This could probably be refined a bit more as I'm no guru in bourne scripting but it seems to work fine for me.
EDIT: I'm running DD-WRT v24-sp2 (06/08/12) std (19342) on a WNDR3700 v1. //EDIT
As fusiooon I went ahead and tried to install it with ipkg in step 5. This, not surprisingly, ended up giving me the same error as fusiooon when I install packages:
Code:
root@Colding-Dev root $ opkg install bash
Installing bash (4.2-3) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/bash_4.2-3_ar71xx.ipk.
Collected errors:
* satisfy_dependencies_for: Cannot satisfy the following dependencies for bash:
* libc * libc * libc *
* opkg_install_cmd: Cannot install package bash.
fusiooon's fix works perfectly. Install libc using opkg in/after step 8:
Code:
cd /tmp
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libc_0.9.33.2-1_ar71xx.ipk
opkg install libc_0.9.33.2-1_ar71xx.ipk
resulting in:
Code:
Installing libc (0.9.33.2-1) to root...
Installing libgcc (4.6-linaro-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libgcc_4.6-linaro-1_ar71xx.ipk.
Configuring libgcc.
Configuring libc.
Posted: Sat Jul 28, 2012 9:50 Post subject: Re: [Howto] Install Optware on Atheros units (such as WNDR37
I cannot replicate what you find martin.j. When I click "Apply settings" or "Save" no additional mount points are created.
I am using DD-WRT v24-sp2 (03/15/12) std - build 18740 on my TP-Link WR1043ND. It might be a bug in your build or ofcourse I could be unable to detect it. I am no linux guru
martin.j wrote:
Quote:
Under DD-WRT’s web interface, Administration->Commands, input the following commands in the window then click "Save Startup":
#!/bin/sh
sleep 5
if [ -f /mnt/sda_part1/optware.enable ]; then
mount -o bind /mnt/sda_part1/etc /etc
mount -o bind /mnt/sda_part1/root /tmp/root
mount -o bind /mnt/sda_part1/opt /opt
else
exit
fi
if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi
As I'm new to DD-WRT and this forum, I just wanted to thank dynek for the simple and detailed tutorial and add a thing that came to my attention after I had completed the tutorial successfully.
I noticed that every time I make a change in the Web GUI and "apply changes" the startup script seems to run and add addidtional bind points every time.
Have a look at the output below after I made a change thru the Web GUI:
Code:
root@DD-WRT 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)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,size=512k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
devpts on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /tmp/mnt/sda_part1 type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /etc type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /tmp/root type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /opt type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /etc type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /tmp/root type ext2 (rw,relatime,errors=continue,user_xattr)
/dev/sda1 on /opt type ext2 (rw,relatime,errors=continue,user_xattr)
As you can see, all bind points that the script executes are added again even thou they already exists.
Therefore, I added some code to the script that checks for the bind points and skips that step if the point already exists.
Code:
#!/bin/sh
sleep 5
if [ -f /mnt/sda_part1/optware.enable ]; then
if ! mount | grep "/dev/sda1 on /etc type" >/dev/null ; then
mount -o bind /mnt/sda_part1/etc /etc
fi
if ! mount | grep "/dev/sda1 on /tmp/root type" >/dev/null ; then
mount -o bind /mnt/sda_part1/root /tmp/root
fi
if ! mount | grep "/dev/sda1 on /opt type" >/dev/null ; then
mount -o bind /mnt/sda_part1/opt /opt
fi
else
exit
fi
if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi
This could probably be refined a bit more as I'm no guru in bourne scripting but it seems to work fine for me.
EDIT: I'm running DD-WRT v24-sp2 (06/08/12) std (19342) on a WNDR3700 v1. //EDIT
Posted: Sun Jul 29, 2012 21:19 Post subject: Re: [Howto] Install Optware on Atheros units (such as WNDR37
wuhtzu: Thanks for taking the time to try it out. The build I'm running could indeed be the issue or something I did as I consider myself as a complete noob here...
I'll try the most recent build (released a few days ago) but that have to wait a while. Just wanted to give some input if others notice the same behaviour.
The changes to the startup script have solved it for me for now and I'm happy. :LOL:
wuhtzu wrote:
I cannot replicate what you find martin.j. When I click "Apply settings" or "Save" no additional mount points are created.
I am using DD-WRT v24-sp2 (03/15/12) std - build 18740 on my TP-Link WR1043ND. It might be a bug in your build or ofcourse I could be unable to detect it. I am no linux guru
Posted: Mon Jul 30, 2012 22:13 Post subject: Update for Broadcom Units
Dynek, thanks for the tutorial. I've automated it with scripts to fix the Gob64 Symbol errors, and edited it for Broadcom units. (You can edit in athxxx back in to get it working for Atheros again.) Link to the scripts/tutorial here:
ERROR: File not found: //usr/local/lib/ipkg/lists/whiterussian
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/non-free
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/backports
You probably want to run `ipkg update'
/bin/ipkg: line 1184: sort: not found
Do someone has experienced it and found a solution ?
Turns out the USB drive was not mounting properly. Once I disabled Auto Drive Mount under Services > USB and put the startup script into Administration > Command I was able to complete the tutorial.
b. Set USB Support
Under Services->USB tab. Will disable “Automatic Drive Mount” here. After that, click “Apply Settings”usb-enable
sleep 2
if [ -f /mnt/optware.enable ]; then
mount -o bind /mnt/etc /etc
mount -o bind /mnt/root /tmp/root
mount -o bind /mnt/opt /opt
else
exit
fi
if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi
Mount code for the USB drive
Type the command in PuTTY or telnet window
ls /dev/discs/disc0/
and the result might look like this
Now here is the tricky part. If you’re using a USB flash drive with only one partition, most likely, you will only see “disc” but not “part1” and “part2”. If you’re using a USB HDD with multi partitions you might expect an output similar to mine. Both are OK.
If you see “disc” only, use the command line below to mount an ext3 USB drive to /mnt
mount -t ext3 -o noatime /dev/discs/disc0/disc /mnt
*Use mount -t ext2 /dev/discs/disc0/disc /mnt for ext2 drive
For USB drive with multi partition, the command below will mount the first partition to /mnt. Adjust accordingly.
mount -t ext3 -o noatime /dev/discs/disc0/part1 /mnt
*Use mount -t ext2 /dev/discs/disc0/part1 /mnt for ext2 partition
I have a single ext2 partition so I used mount -t ext2 /dev/discs/disc0/part1 /mnt
Hope this helps. It took me a little while to connect the dots.
i only get:
File not found libc_0.9.30.1-43.10_ar71xx.ipk
File not found opkg_576-1_ar71xx.ipk
if they are supposed to be written in /tmp, they are indeed not there?
What's wrong?
You do not mention changing directory to /tmp (cd /tmp). How ever it shouldn't matter where you download your files as long as you are in that directory when you call the ipkg install command.
Please try to verify that the ipk-files are actually in the dir you were in when you ran the wget commando by running the "ls -la" command to list files in current dir.
Sort of forget what I originally wrote in this post (see below). What I stated about further start up commands not being issued if optware was turned off is true. I have however learned that larger scripts needed at startup (or other events) should be placed elsewhere. So, maybe, never mind...
- - - - - Original post - - - - -
Am I the only one who thinks these "else exit"'s are not needed and/or not particularly well placed?
Code:
#!/bin/sh
sleep 5
if [ -f /mnt/sda_part1/optware.enable ]; then
mount -o bind /mnt/sda_part1/etc /etc
mount -o bind /mnt/sda_part1/root /tmp/root
mount -o bind /mnt/sda_part1/opt /opt
else
exit
fi
if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi
They will prevent further start up scripts (placed below the the above code) from executing in case optware is disabled. If optware is disabled the first exit will be reached and the rest of the startup script will not execute... This could cause some annoying debug time for people not noticing...