Is there any tutorial of how we can use Codesys Control on Raspberry with read only SD card?
Maybe with use of "ramfs".
Can any one tell us witch folders we have to mount as "tmpfs"?
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
du kannst einfach Lib SysLibFile verwenden und mit File Open eine Datei im Read modus öffnen. Wenn es die Datei gibt, dann erhältst du ein gültiges Handle zurück. Mit diesem Handle kannst du dann mit der Funktion Read das File lesen.
Gesendet von iPhone mit Tapatalk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry maybe I'm wrong and you have misunderstood.
I ask how can work the CodesysControl runtime in a system with read only
sd card.
Because we take errors at boot time of Linux where not builded
some folders that needed from Codesys runtime.
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need specific information of Codesys runtime needs.
The rest of Linux functionality works fine after setup for
read only working mode of sd card.
The fail messages at boot up coming from Codesys runtime where
try to build some folders and files I thing at boot up time.
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
could you share the information how you set this up as readonly?
Could you paste the message where you see that part of the runtime fails... screenshot
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've done a quick test for read-only SD configurations, this will work, maybe we need some tuning on some directories according the licensing
... need some more time to do this in detail and write a how to then.
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all,
this might really a good possibility to make it more 'robust'... -> to be proved
In my case I use the following procedure including licensing the pi. (sure this is optional)
1. start point is: Image from store or from raspberrypi.org and the installed codesys debian package
2. Optional: install the license
3. In my case I use a USB-Key which is read/writeable, where later the plc boot application and all needed files which CODESYS create are stored ( visu files /trend files license) etc
4. mount the USB-Key (sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/)
to /media and copy the content of /root to /media (this include the license to if the Pi is licensed)
5. change the runtime application directory to /media
sudo nano /etc/init.d/codesyscontrol
see screenshot
and change the location of PlcConfigFile export PlcConfigFile=/media/CODESYSControl.cfg
and cd /media/
Step by step how from the link above slightly changed to have an addition USB Stick for application data, license Disable swap
dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile disable
Install UnionFS
aptitude install unionfs-fuse
Create mount script
nano /usr/local/bin/mount_unionfs
make it executable:
chmod +x /usr/local/bin/mount_unionfs
nano /etc/fstab
(D01F-8E5A is what you need to adapt to your stick - you get this ID by sudo blkid /dev/sdb1 or sudo blkid /dev/sda1)
cat /etc_org/fstab
proc      /proc      proc  defaults     0    0/dev/mmcblk0p1 /boot      vfat  ro        0    2/dev/mmcblk0p2 /        ext4  ro,noatime    0    1mount_unionfs  /etc      fuse  defaults     0    0mount_unionfs  /var      fuse  defaults     0    0none      /tmp      tmpfs  defaults     0    0UUID=[b]D01F-8E5A[/b]/media/vfatdefaults,auto,umask=000,users,rw0
you get:
/dev/root on / type ext4 (ro,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=219764k,nr_inodes=54941,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=44788k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=89560k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
ramdisk on /etc_rw type tmpfs (rw,relatime)
unionfs-fuse on /etc type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
ramdisk on /var_rw type tmpfs (rw,relatime)
unionfs-fuse on /var type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
none on /tmp type tmpfs (rw,relatime)
/dev/sdb1 on /media type vfat (rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
Connect with CODESYS Developmentsystem - download Webvisu example and check
1. if license is ok
2. all applications files are redirected to /media (Usb stick)
you should see Application.app, Application.crc visu directory etc on the USB Stick /media
Let me know if this work for you.
If anyone find the time a long term test like for example 1000 times switch on and randomly switch off the pi should prove if this is a real
robust solution for have a large SD card life cycle.
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I try your method with some difference to use a third partition on sd card but after reboot of application download i take the message "Application 'Application' does not exist on device 'Device'. Do you want to create it and proceed with download?".
Did you check your method?
I found that need more changes in "sudo nano /etc/init.d/codesyscontrol" because we have licence errors at boot.
Any help?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made the changes in CODESYSControl.cfg.
Sorry it doesn't works after rebbot.
All look ok, the application exist in new folder but not running and the CodesysV3 not finding with refresh list of applications.
Any idea?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This should work on your SD too. copy CODESYSControl.cfg and 3S.dat to the new location of your redirected path
If you are already readonly with your system, are you sure you have changed CODESYSControl.cfg in /etc_org/ ?
This was in my case the mistake.
so remount to rw and change /etc_org/CODESYSControl.cfg and /etc_org/init.d/codesyscontrol these two path changes
-> reboot
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
change the path settings in /etc/init.d/codesycontrol
then move the files of /root to /media
and move /etc/CODESYSControl.cfg and move /etc/3S.dat to /media
After this works -> the make it RO part should follow.
Regards
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there any tutorial of how we can use Codesys Control on Raspberry with read only SD card?
Maybe with use of "ramfs".
Can any one tell us witch folders we have to mount as "tmpfs"?
Regards
Hallo Isislsis,
du kannst einfach Lib SysLibFile verwenden und mit File Open eine Datei im Read modus öffnen. Wenn es die Datei gibt, dann erhältst du ein gültiges Handle zurück. Mit diesem Handle kannst du dann mit der Funktion Read das File lesen.
Gesendet von iPhone mit Tapatalk
Hi.
Sorry maybe I'm wrong and you have misunderstood.
I ask how can work the CodesysControl runtime in a system with read only
sd card.
Because we take errors at boot time of Linux where not builded
some folders that needed from Codesys runtime.
Regards
Hi,
sorry I'm wrong i misunderstood your question
Gesendet von iPhone mit Tapatalk
Hello,
I would search the forum on the Raspberry Pi organisation for that,
or ask this question there.
http://www.raspberrypi.org/forums/
Best Regards
plcmax
I need specific information of Codesys runtime needs.
The rest of Linux functionality works fine after setup for
read only working mode of sd card.
The fail messages at boot up coming from Codesys runtime where
try to build some folders and files I thing at boot up time.
Regards
Hi,
could you share the information how you set this up as readonly?
Could you paste the message where you see that part of the runtime fails... screenshot
BR
Edwin
http://blog.pi3g.com/2014/04/make-raspbian-system-read-only/
http://nutcom.hu/ipe-r1/
Hi,
I've done a quick test for read-only SD configurations, this will work, maybe we need some tuning on some directories according the licensing
... need some more time to do this in detail and write a how to then.
BR
Edwin
Hello all,
this might really a good possibility to make it more 'robust'... -> to be proved
In my case I use the following procedure including licensing the pi. (sure this is optional)
1. start point is: Image from store or from raspberrypi.org and the installed codesys debian package
2. Optional: install the license
3. In my case I use a USB-Key which is read/writeable, where later the plc boot application and all needed files which CODESYS create are stored ( visu files /trend files license) etc
4. mount the USB-Key (sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/)
to /media and copy the content of /root to /media (this include the license to if the Pi is licensed)
5. change the runtime application directory to /media
sudo nano /etc/init.d/codesyscontrol
see screenshot
and change the location of PlcConfigFile
export PlcConfigFile=/media/CODESYSControl.cfg
and
cd /media/
save the changed codesyscontrol
6.add/change to /etc/CODESYSControl.cfg
[SysFile]
FilePath.1=/etc/, 3S.dat
FilePath.2=/media/, .app, .crc
move CODESYSControl.cfg and 3S.dat to your new location - in my case /media/
Step by step how from the link above slightly changed to have an addition USB Stick for application data, license
Disable swap
dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile disable
Install UnionFS
aptitude install unionfs-fuse
Create mount script
nano /usr/local/bin/mount_unionfs
#!/bin/sh
[ -z "$1" ] && exit 1 || DIR=$1
ROOT_MOUNT=$(grep -v "^#" /etc/fstab | awk '$2=="/" {print substr($4,1,2)}')
if [ "$ROOT_MOUNT" != "ro" ]; then
/bin/mount --bind ${DIR}_org ${DIR}
else
/bin/mount -t tmpfs ramdisk ${DIR}_rw
/usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}_rw=RW:${DIR}_org=RO ${DIR}
fi
make it executable:
chmod +x /usr/local/bin/mount_unionfs
nano /etc/fstab
(D01F-8E5A is what you need to adapt to your stick - you get this ID by sudo blkid /dev/sdb1 or sudo blkid /dev/sda1)
cat /etc_org/fstab
Prepare the directories
cp -al /etc /etc_org
mv /var /var_org
mkdir /etc_rw
mkdir /var /var_rw
reboot
check if everything is readonly by
mount
you get:
/dev/root on / type ext4 (ro,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=219764k,nr_inodes=54941,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=44788k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=89560k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
ramdisk on /etc_rw type tmpfs (rw,relatime)
unionfs-fuse on /etc type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
ramdisk on /var_rw type tmpfs (rw,relatime)
unionfs-fuse on /var type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
none on /tmp type tmpfs (rw,relatime)
/dev/sdb1 on /media type vfat (rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
Connect with CODESYS Developmentsystem - download Webvisu example and check
1. if license is ok
2. all applications files are redirected to /media (Usb stick)
you should see Application.app, Application.crc visu directory etc on the USB Stick /media
Let me know if this work for you.
If anyone find the time a long term test like for example 1000 times switch on and randomly switch off the pi should prove if this is a real
robust solution for have a large SD card life cycle.
BR
Edwin
Hi.
I try your method with some difference to use a third partition on sd card but after reboot of application download i take the message "Application 'Application' does not exist on device 'Device'. Do you want to create it and proceed with download?".
Did you check your method?
I found that need more changes in "sudo nano /etc/init.d/codesyscontrol" because we have licence errors at boot.
Any help?
Hi,
you need to add your new location / redirection path to the CODESYSControl.cfg
in my case this was:
FilePath.2=/media/, .app, .crc
I've added this to the description above.
Not sure if a redirection to an separate partition on the same SD Card will prevent the SD card corruption.
BR
Edwin
Hi.
I made the changes in CODESYSControl.cfg.
Sorry it doesn't works after rebbot.
All look ok, the application exist in new folder but not running and the CodesysV3 not finding with refresh list of applications.
Any idea?
Hi,
sure missing in CODESYSControl.cfg
the FilePath.1 to set on your new location, because here CDS store the name of the Bootproject to load.
[SysFile]
FilePath.1=/media/, 3S.dat
FilePath.2=/media/, .app, .crc
additional you need to change the path in the config file in
/etc/init.d/codesyscontrol
export PlcConfigFile=/media/CODESYSControl.cfg
BR
Edwin
Nothing has changed.
This should work on your SD too. copy CODESYSControl.cfg and 3S.dat to the new location of your redirected path
If you are already readonly with your system, are you sure you have changed CODESYSControl.cfg in /etc_org/ ?
This was in my case the mistake.
so remount to rw and change /etc_org/CODESYSControl.cfg and /etc_org/init.d/codesyscontrol these two path changes
-> reboot
Hi
With copy of CODESYS Control.cfg and 3S.dat it works.
Now i try the same with usb device.
Do you think it needs all of them changes?
Regards
Hi,
change the path settings in /etc/init.d/codesycontrol
then move the files of /root to /media
and move /etc/CODESYSControl.cfg and move /etc/3S.dat to /media
After this works -> the make it RO part should follow.
Regards
Edwin
Hi.
I'm newbe in Linux but I tthink after many many tests that problems
begins from permissions of folders type "/etc" ,"/var" and "/media".
Finally I get it run and from third partition of sd card and from usb storage.
Regards
*The watchdog works ok.
I see green led of Raspberry Pi B+ flashes ( little flash ) continuously 1 time per second.
Is this normal?
Is this bad for sd card?
Hi,
would propose to install:
apt-get install nmon
or iotop
then check if there is any write activity.
BR
Edwin
Nmon don't show any activity at Disk I/O.
Only my Raspberry do this flashing?
Some times after reboots from watchdog i lose the webvisu connection and codesys visualization.
Any idea?
Hi,
please check the plc log for more information.
BR
Edwin
Do you mean "codesyscontrol.log" from "tmp" folder?
I can't understand it.