access to database file denied

Asked by dbrb2

Hi - I have just built the latest stable release (0.7.10) of me-tv.
It compiled fine, but I have found that if I try to run it, I get the following error:

"
Failed to finalise statement: attempt to write a readonly database
"

Any ideas as to possible cause?

Cheers,

Ben

Question information

Language:
English Edit question
Status:
Solved
For:
Me TV Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Schlüter (johannes-s) said :
#1

Please check whether a file $HOME/.me-tv/me-tv.db exists and is readable. Additionally: Do you run Me TV for the first time or did you upgrade it?

Revision history for this message
dbrb2 (benjamin-barker) said :
#2

Hi - I did have a previous version, but I uninstalled it and checked the
./me-tv directory had vanished before reinstalling the new release.

On doing this (firstbuilding from source, then tried the repositories) the
.me-tv directory was recreated, but with no content, and with only root
allowed to edit it. I changed the permissions, but the directory was still
empty, and the error persisted.

Cheers,

Ben

2009/1/24 Johannes Schlüter <email address hidden>

> Your question #58601 on Me TV changed:
> https://answers.launchpad.net/me-tv/+question/58601
>
> Status: Open => Needs information
>
> Johannes Schlüter requested for more information:
> Please check whether a file $HOME/.me-tv/me-tv.db exists and is
> readable. Additionally: Do you run Me TV for the first time or did you
> upgrade it?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/me-tv/+question/58601
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) said :
#3

"with only root allowed to edit it" ... something gone wrong here. Did you run it as root? A program cannot set owner to root so I suggest that you've done something odd here. To avoid all confusion, remove the directory and then run the program as a normal user.

What distribution are you using?

Revision history for this message
dbrb2 (benjamin-barker) said :
#4

1) Removed existing .me-tv direcotyr from my home directory
2) bzr branch lp:me-tv
3) Entered me-tv directory just downloaded
4) ./autogen.sh
5) make

I need to install as root, otherwise I get errors such as cannot remove
`/usr/local/bin/me-tv`: Permission denied. So I run
6) sudo make install
No errors

I then run me-tv and get the originally reported error. I am running Ubuntu
8.10. The .me-tv diectory in my home directory does exist, but is empty.
However, contrary to my first attempt, I do now have full permissions to
access the folder - unsure what I changed between attempts.

Although the error message states the db can't be accessed, it looks like in
fact the db may not have been created at all...?

Cheers,

Ben

2009/1/24 Michael Lamothe <email address hidden>

> Your question #58601 on Me TV changed:
> https://answers.edge.launchpad.net/me-tv/+question/58601
>
> Status: Open => Needs information
>
> Michael Lamothe requested for more information:
> "with only root allowed to edit it" ... something gone wrong here. Did
> you run it as root? A program cannot set owner to root so I suggest
> that you've done something odd here. To avoid all confusion, remove the
> directory and then run the program as a normal user.
>
> What distribution are you using?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.edge.launchpad.net/me-tv/+question/58601
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) said :
#5

The database gets created at runtime if it does not exist.

How are you starting Me TV? As a test, try `touch ~/.me-tv/me-tv.db`.

Revision history for this message
dbrb2 (benjamin-barker) said :
#6

Hi - I tried running `touch ~/.me-tv/me-tv.db`, which as expected created a
file in the otherwise empty ~/.me-tv directory.

I had been running me-tv by simply typing me-tv at the terminal. I also
tried whereis me-tv, and then /usr/local/bin/me-tv - the effect was the
same:

Me TV 0.7.11
Failed to finalise statement: attempt to write a readonly database

Hmmm....

2009/1/25 Michael Lamothe <email address hidden>

> Your question #58601 on Me TV changed:
> https://answers.edge.launchpad.net/me-tv/+question/58601
>
> Status: Open => Needs information
>
> Michael Lamothe requested for more information:
> The database gets created at runtime if it does not exist.
>
> How are you starting Me TV? As a test, try `touch ~/.me-tv/me-tv.db`.
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.edge.launchpad.net/me-tv/+question/58601
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
dbrb2 (benjamin-barker) said :
#7

Ah...fixed :-)

I uninstalled me-tv, and removed sudo rm /usr/local/bin/me-tv, then
reinstalled. Works fine now :-)

2009/1/25 dbrb2 <email address hidden>

> Your question #58601 on Me TV changed:
> https://answers.launchpad.net/me-tv/+question/58601
>
> Status: Needs information => Open
>
> You gave more information on the question:
> Hi - I tried running `touch ~/.me-tv/me-tv.db`, which as expected created a
> file in the otherwise empty ~/.me-tv directory.
>
> I had been running me-tv by simply typing me-tv at the terminal. I also
> tried whereis me-tv, and then /usr/local/bin/me-tv - the effect was the
> same:
>
> Me TV 0.7.11
> Failed to finalise statement: attempt to write a readonly database
>
> Hmmm....
>
>
> 2009/1/25 Michael Lamothe <email address hidden>
>
> > Your question #58601 on Me TV changed:
> > https://answers.edge.launchpad.net/me-tv/+question/58601
> >
> > Status: Open => Needs information
> >
> > Michael Lamothe requested for more information:
> > The database gets created at runtime if it does not exist.
> >
> > How are you starting Me TV? As a test, try `touch ~/.me-tv/me-tv.db`.
> >
> > --
> > To answer this request for more information, you can either reply to
> > this email or enter your reply at the following page:
> > https://answers.edge.launchpad.net/me-tv/+question/58601
> >
> > You received this question notification because you are a direct
> > subscriber of the question.
> >
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
dbrb2 (benjamin-barker) said :
#8

...for some value of fixed. The version I installed from the repositories was 0.5.30 :-) It works fine, but same error as before when trying to build the latest release :-)

Revision history for this message
Luboš Staněk (lubek) said :
#9

I am sorry for the troubles caused by my latest changes.

Modify the source according to this patch until Michael updates the branch:

{{{--- src/application.cc 2009-01-22 12:15:23 +0000
+++ src/application.cc 2009-01-25 22:43:55 +0000
@@ -91,7 +91,7 @@
        set_int_configuration_default("width", 500);
        set_int_configuration_default("height", 500);

- Glib::ustring application_dir = Glib::build_filename(Glib::get_home_dir(), ".me-tv");
+ application_dir = Glib::build_filename(Glib::get_home_dir(), ".me-tv");
        Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(application_dir);
        if (!file->query_exists())
        {

--- src/data.cc 2009-01-22 12:15:23 +0000
+++ src/data.cc 2009-01-25 22:44:23 +0000
@@ -198,7 +198,7 @@

 Data::Data(gboolean initialise)
 {
- Glib::ustring database_path = Glib::build_filename(get_application().get_application_dir(),
"/me-tv.db");
+ Glib::ustring database_path = Glib::build_filename(Glib::get_home_dir(), ".me-tv/me-tv.db");

        if (sqlite3_open(database_path.c_str(), &database) != 0)
        {

}}}

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) said :
#10

Yes, my apologies for not actually trying this and finding the issue. The code should now work in the development branch.

Lubos, did I miss a patch?

Thanks,

Michael

Revision history for this message
dbrb2 (benjamin-barker) said :
#11

Cool - that has fixed things thanks :-)

I have noticed on way to reliably crash the program: Try to view a channel
currently off air. The only way to fix it is either to not do this, or to
delete the offending channel from the database, then re-scan for it :-)

cheers,

ben

2009/1/25 Michael Lamothe <email address hidden>

> Your question #58601 on Me TV changed:
> https://answers.edge.launchpad.net/me-tv/+question/58601
>
> Michael Lamothe proposed the following answer:
> Yes, my apologies for not actually trying this and finding the issue.
> The code should now work in the development branch.
>
> Lubos, did I miss a patch?
>
> Thanks,
>
> Michael
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.edge.launchpad.net/me-tv/+question/58601/+confirm?answer_id=9
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.edge.launchpad.net/me-tv/+question/58601
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) said :
#12

The original question has been resolved. I'll look into your other issue except that I don't think this ever happens for me here in Australia.

Revision history for this message
Johannes Schlüter (johannes-s) said :
#13

I could reproduce the last problem once (I can receive a channel only if the antenna is at the correct position) given some free time I can dig around in case Michael isn't faster. But I guess that should be tracked in a different ticket.

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) said :
#14

Thanks Johannes, let me know if you need a hand. I can't reproduce this.