SQlite readonly Problem on ME9210

Hello,

I`d like to use a SQlight Database in my website running on ME9210 Linux.
I use php to create/write/read the database.

I can create a connection, add a table and enter some columns in that table. When i try to change or delete a column (from another php-script), I allways get an error:

attempt to write a readonly database

I closed all connections to that database in the first script that creates and writes to that table and opened it with access rights 666.

What could be the problem or is there a workaround.

many thanks in advance,

regards,

Micha

Check http://ftp1.digi.com/support/documentation/EmbeddedLinuxPHP-SQLite.pdf

hello

try…

chmod 777 /usr/share/www

By default ME9210 uses Squashfs as a rootfs. Squashfs is a compressed read-only filesystem for Linux.
The module you are using has relatively little space available (compared to our other modules), so the main reason for using squashfs is because it is compressed. And the idea was that normally you do not need to modify rootfs during runtime anyways, and customers who need r/w space, use user jffs2 user partition to write. This is also a more safe approach because you cannot accidently corrupt rootfs when you write to it from your application. However it is fine to convert it to JFFS2 if you have enough space there for everything you need.
So basically you have 2 options: Create user JFFS2 partition and use it to store real time data there, or change rootfs partition type to writable JFFS2 (default is squashfs)

  1.  To change partition type use flpart command:
    

CME9210 # flpart
Nr | Name | Start | Size | Type | FS | Flags

0 | U-Boot | 0 | 192 KiB | U-Boot | | fixed
1 | NVRAM | 192 KiB | 128 KiB | NVRAM | | fixed
2 | Kernel | 320 KiB | 1280 KiB | Linux-Kernel | |
3 | RootFS-JFFS2 | 1600 KiB | 1536 KiB | Filesystem | ExFAT | rootfs
4 | User-JFFS2 | 3136 KiB | 960 KiB | Filesystem | JFFS2 |
Commands:
a) Append partition
d) Delete partition
m) Modify partition
p) Print partition table
r) Reset partition table
q) Quit
Cmd (? for help)> m
Then follow the prompts to change partition type of partition 3.

Those are simplified instruction as I did not delete the user JFFS2 partition 4, just converted rootfs to JFFS2.
First change the partition type in U-boot:
CME9210 # flpart
Nr | Name | Start | Size | Type | FS | Flags

0 | U-Boot | 0 | 192 KiB | U-Boot | | fixed
1 | NVRAM | 192 KiB | 128 KiB | NVRAM | | fixed
2 | Kernel | 320 KiB | 1280 KiB | Linux-Kernel | |
3 | RootFS-JFFS2 | 1600 KiB | 1536 KiB | Filesystem | SQUASHFS | rootfs
4 | User-JFFS2 | 3136 KiB | 960 KiB | Filesystem | JFFS2 |
Commands:
a) Append partition
d) Delete partition
m) Modify partition
p) Print partition table
r) Reset partition table
q) Quit
Cmd (? for help)> m
Modify Which Partition? 3
Name (RootFS-JFFS2): RootFS-JFFS2
Chip (0): 0
Start (in MiB, 0 for auto) (1600 KiB): 1600 KiB
Size (in MiB, 0 for auto, 2496 KiB max) (1536 KiB): 1536 KiB
Partition Types
Partition Type (Filesystem, ? for help)> ?
e) WinCE-EBoot
f) Filesystem
l) Linux-Kernel
n) NVRAM
o) NET+OS-Kernel
O) NET+OS-Loader
N) NET+OS-NVRAM
r) WinCE-Registry
s) Splash-Screen
u) U-Boot
w) WinCE-Kernel
F) FPGA
0) Unknown
Partition Type (Filesystem, ? for help)>
Fixed (n): n
Readonly (n): n
Filesystem Types
Filesystem (SQUASHFS, ? for help)> ?
j) JFFS2
s) SQUASHFS
c) CRAMFS
i) INITRD
r) ROMFS
f) FlashFX
e) ExFAT
y) YAFFS
0) Unknown
Filesystem (SQUASHFS, ? for help)> j
Root-FS (y): y
Mount Readonly (n): n
Nr | Name | Start | Size | Type | FS | Flags

0 | U-Boot | 0 | 192 KiB | U-Boot | | fixed
1 | NVRAM | 192 KiB | 128 KiB | NVRAM | | fixed
2 | Kernel | 320 KiB | 1280 KiB | Linux-Kernel | |
3 | RootFS-JFFS2 | 1600 KiB | 1536 KiB | Filesystem | JFFS2 | rootfs
4 | User-JFFS2 | 3136 KiB | 960 KiB | Filesystem | JFFS2 |
Cmd (? for help)> q
Partition table has been modified. Save? (y): y
Writing Parameters to NVRAM
CME9210 #

Now you can boot with JFFS2 rootfs.
Just make sure your rootfs file is not bigger than the partition size!
CME9210 # update rootfs tftp
TFTP from server 10.52.28.115; our IP address is 10.52.32.13; sending through gateway 10.52.32.1 Filename ‘rootfs-cme9210js-64.jffs2’.

You can explicitly do it from U-boot using
CME9210 # update rootfs tftp rootfs-cme9210js-64.jffs2
TFTP from server 10.52.28.115; our IP address is 10.52.32.13; sending through gateway 10.52.32.1
Filename 'rootfs-cme9210js.jffs2’.

Or from DigiESP, by selecting correct file in the “Update Flash” dialog.

If this work next step is to go back to u-boot/flpart, delete partition 4, then resize partition 3 to take advantage of free space.

  1.  For the second approach – to mount JFFS2 userfs partition:
    

Here is how I mounted user JFFS2 partition:
If you programmed/initialized your partition already, then skip this step till mount command:

Once Linux is up on the module create empty file:
/ # touch /tmp/usrfs.jffs2

Use it to init parttion 4:
/ # update_flash /tmp/usrfs.jffs2 4
Partition 4 is NOR ()
Full Size: 960 KiB
Good Size: 960 KiB
— JFFS2 partition 4 will be fully erased and clean markers written
Verifying File(s): /tmp/usrfs.jffs2
Updating:
/tmp/usrfs.jffs2 (0 KiB)
Erasing: complete
Flashing: complete
CRC32: 0x00000000
Done

/ # mount -tjffs2 /dev/mtdblock4 /mnt
/ # df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mtdblock4 960 196 764 20% /tmp/mnt
/ #

Regards,
Leonid