Results 1 to 7 of 7

Thread: QML application on read only raspberry pi

  1. #1
    Join Date
    Oct 2015
    Posts
    6
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QML application on read only raspberry pi

    Hello everyone,

    I am developing a QML application that is to be used on raspberry pi. I also want to make file system read only so users can't mess something up and also I want to prolong micro SD card's life and prevent memory corruption in case of power loss.

    When the application is started in writeble mode it works fine, but when I mount the file system as read only and try starting application i get the following error after about a second of running it(so the interface is shown and everything is working as supposed):
    "QWidget: Cannot create a QWidgete without QApplication
    Aborted"

    I suppose that application tries to write something on file system and breaks when it fails. Can anyone help me by explaining how does it work under hood, and what must be kept writable so applications can work as supposed?

    I found a alternative solution to mounting as read only, That is to use chattr command to force immunity on files(still don't know which ones exactly). But I am not sure can OS itself still access them when it needs to or not. As I said corruption during power loss is my greatest problem at the moment.

    In addition I just want to say I am using Raspbian Jessie Lite, and Qt version is 5.6.0 if that means something to you.

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML application on read only raspberry pi

    The directory where an application is installed is usually read-only as far as the user running the program is concerned.

    You could run the program with strace and see which file it tries to write to, though I wonder why it would fail that way even if it can't.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    mefi100 (25th May 2016)

  4. #3
    Join Date
    Oct 2015
    Posts
    6
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QML application on read only raspberry pi

    Thanks for quick answer, I tried running it with strace, but I am not that good with linux so I don't really understand it well. I understood to some extent, but not last 50 lines. before that I saw some files were opened, so thats ok, The log includes little less then 5000 lines, but its mostly opening some files and using them for something. Here are last 50 or so lines so if you can see something there and share it with me I would appreciate it greatly.

    mmap2(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6b304000
    write(14, "\1\0\0\0\0\0\0\0", 8) = 8
    futex(0x1d7e8c0, FUTEX_WAKE_PRIVATE, 1) = 1
    futex(0x1d7e664, FUTEX_WAIT_PRIVATE, 23, NULL) = 0
    futex(0x1d7e648, FUTEX_WAKE_PRIVATE, 1) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6e334000
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6b303000
    brk(0x2004000) = 0x2004000
    mmap2(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6b1c0000
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6b302000
    brk(0x2025000) = 0x2025000
    clock_gettime(CLOCK_MONOTONIC, {3331, 491951609}) = 0
    write(3, "\1\0\0\0\0\0\0\0", 8) = 8
    mmap2(NULL, 8388608, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x68865000
    mprotect(0x68865000, 4096, PROT_NONE) = 0
    clone(child_stack=0x69063f88, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND| CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARE NT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x690644b8, tls=0x69064910, child_tidptr=0x690644b8) = 928
    futex(0x1ef6da0, FUTEX_WAKE_PRIVATE, 1) = 1
    write(3, "\1\0\0\0\0\0\0\0", 8) = 8
    write(3, "\1\0\0\0\0\0\0\0", 8) = 8
    mmap2(NULL, 8388608, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x68065000
    mprotect(0x68065000, 4096, PROT_NONE) = 0
    clone(child_stack=0x68863f88, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND| CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARE NT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x688644b8, tls=0x68864910, child_tidptr=0x688644b8) = 929
    clock_gettime(CLOCK_MONOTONIC, {3331, 499909732}) = 0
    poll([{fd=3, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=18, events=POLLIN}], 4, 0) = 1 ([{fd=3, revents=POLLIN}])
    write(3, "\1\0\0\0\0\0\0\0", 8) = 8
    write(3, "\1\0\0\0\0\0\0\0", 8) = 8
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    write(3, "\1\0\0\0\0\0\0\0", 8) = 8
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x75df7578, FUTEX_WAIT_PRIVATE, 3, NULL) = -1 EAGAIN (Resource temporarily unavailable)
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    brk(0x2046000) = 0x2046000
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 1
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x75df7578, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x1e407ac, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x1e407a8, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
    futex(0x1e40790, FUTEX_WAKE_PRIVATE, 1) = 1
    futex(0x1e404a4, FUTEX_WAKE_PRIVATE, 1) = 1
    futex(0x1e40474, FUTEX_WAKE_PRIVATE, 1) = 1
    futex(0x1e404d4, FUTEX_WAIT_PRIVATE, 3, NULLQWidget: Cannot create a QWidget without QApplication
    <unfinished ...>
    +++ killed by SIGABRT +++
    Aborted

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML application on read only raspberry pi

    Hmm, there is no file access in there.

    I assume /tmp is writable, most likely of type tmpfs?

    Which QPA are you using? XCB with an X-Server? Can you start any other application?

    Cheers,
    _

  6. #5
    Join Date
    Oct 2015
    Posts
    6
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QML application on read only raspberry pi

    You are correct about tmp, my fstab is like this

    proc /proc proc defaults 0 0
    /dev/mmcblk0p1 /boot vfat defaults,ro 0 2
    /dev/mmcblk0p2 / ext4 defaults,noatime,ro 0 1
    # a swapfile is not a swap partition, no line here
    # use dphys-swapfile swap[on|off] for that
    tmpfs /tmp tmpfs nosuid,nodev 0 0
    tmpfs /var/log tmpfs nosuid,nodev 0 0
    tmpfs /var/tmp tmpfs nosuid,nodev 0 0

    I tried running a few applications and they run ok as log as I dont use video qml elements. I am using a image found here http://thebugfreeblog.blogspot.rs/20...61712099995888 it is optimised for playing videos(which I must do in application), but it looks like it can't be run on read only system. for some reason...

    Looks like I will have to consult that image author about this problem.

    By the way thanks for ideas on what to try and what to do once again.

    [EDIT] - My mistake, other applications with video qml elements work, I just forgot to add a single directive on start, so it seams this is not problem with image...
    Last edited by mefi100; 25th May 2016 at 12:45.

  7. #6
    Join Date
    Aug 2016
    Location
    Bulgaria
    Posts
    1

    Default QML application on read only raspberry pi

    It is possible to connect LJ DAQ eg. U3 to Raspberry Pi and get it working?Raspberry uses Debian on ARM processor.I would like to control LJ U3 by Python application.

  8. #7
    Join Date
    Oct 2016
    Posts
    6
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QML application on read only raspberry pi

    You could run the program with strace and see which file it tries to write to, though I wonder why it would fail that way even if it can't.

Similar Threads

  1. Problems with Qt on Raspberry Pi 2
    By skypuppy in forum Newbie
    Replies: 7
    Last Post: 30th December 2015, 11:53
  2. Compiling qt 5.4 for raspberry
    By dram in forum Newbie
    Replies: 5
    Last Post: 16th February 2015, 00:21
  3. QML application slow on raspberry pi
    By ironexmaiden in forum Qt Quick
    Replies: 1
    Last Post: 14th October 2014, 14:33
  4. Replies: 1
    Last Post: 19th September 2011, 11:43
  5. How to read/write PDF file from Qt Application?
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 30th August 2007, 09:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.