Bug 7580 - Squeezecenter keeps restarting - mysql problem - AppArmor
: Squeezecenter keeps restarting - mysql problem - AppArmor
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Database
: 7.0.1
: PC Ubuntu Linux
: -- normal with 1 vote (vote)
: 7.x
Assigned To: Matt Wise
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-22 02:05 UTC by Darren Warner
Modified: 2009-09-08 09:31 UTC (History)
12 users (show)

See Also:
Category: ---


Attachments
check_apparmor.sh patch (try 1) (4.68 KB, patch)
2008-09-13 11:31 UTC, Ben Kochie
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darren Warner 2008-03-22 02:05:01 UTC
Squeezecenter fails to initialize and start listening to the http port in Ubuntu 8.04 beta (x86).

Here's /var/lib/squeezecenter.log:

2008-03-22 01:42:49 squeezecenter_safe started.
[08-03-22 01:43:19.7626] Slim::Utils::MySQLHelper::createSystemTables (433) FATAL: Couldn't connect to database: [Can't connect to local MySQL server through socket '/var/lib/squeezecenter/cache/squeezecenter-mysql.sock' (2)]
[08-03-22 01:43:19.7647] Slim::Schema::forceCommit (1363) Warning: Trying to commit transactions before DB is initialized!
2008-03-22 01:43:19 SqueezeCenter died. Restarting.
[08-03-22 01:43:50.6785] Slim::Utils::MySQLHelper::createSystemTables (433) FATAL: Couldn't connect to database: [Can't connect to local MySQL server through socket '/var/lib/squeezecenter/cache/squeezecenter-mysql.sock' (2)]
[08-03-22 01:43:50.6806] Slim::Schema::forceCommit (1363) Warning: Trying to commit transactions before DB is initialized!
2008-03-22 01:43:50 SqueezeCenter died. Restarting.

After enabling a shell for the squeeze-center user, I tried running "/usr/sbin/mysqld --defaults-file=/var/lib/squeezecenter/cache/my.cnf  --verbose", and got the following:

Could not open required defaults file: /var/lib/squeezecenter/cache/my.cnf
Fatal error in defaults handling. Program aborted

At this point, /var/log/syslog says:

Mar 22 01:45:25 washington kernel: [  841.102986] audit(1206175525.681:21): operation="inode_permission" request_mask="r::" denied_mask="r::" name="/var/lib/squeezecenter/cache/my.cnf" pid=30812 profile="/usr/sbin/mysqld" namespace="default"

(this is a new message for me, so I don't know if it actually means anything).

This happens with Squeezecenter v7.0 (stable), v7.0.1-17961 (testing), and v7.0.1-17957 (unstable)
Comment 1 Ben Kochie 2008-03-22 10:12:15 UTC
This is likely due to AppArmor: https://wiki.ubuntu.com/AppArmor

Add these lines to the file: /etc/apparmor.d/usr.sbin.mysqld

/var/lib/squeezecenter/cache/ r,
/var/lib/squeezecenter/cache/my.cnf r,
/var/lib/squeezecenter/cache/mysql.startup rw,
/var/lib/squeezecenter/cache/mysql-error-log.txt rw,
/var/lib/squeezecenter/cache/squeezecenter-mysql.pid w,
/var/lib/squeezecenter/cache/squeezecenter-mysql.sock w,
/var/lib/squeezecenter/cache/MySQL/ r,
/var/lib/squeezecenter/cache/MySQL/** rwk,

I think that should work, I don't have a Hardy machine to test on at the momemnt.
Comment 2 Ben Kochie 2008-03-22 10:17:06 UTC
Note, this should probably be done with an additional file added to /etc/apparmor.d, although I'm not sure exactly how to format these files.  (I'm just starting to play with AppArmor)
Comment 3 Mark Miksis 2008-03-22 12:29:51 UTC
How do most Debian/Ubuntu packages deal with AppArmor?  Should the SC deb package be installing a file to /etc/apparmor.d?
Comment 4 Darren Warner 2008-03-22 15:36:09 UTC
Thank you - that did the trick. After adding these entries, AppArmor must be reloaded:

$ sudo /etc/init.d/apparmor reload
Comment 5 Darren Warner 2008-03-26 01:24:19 UTC
I don't see any changes in the daily builds that indicate this problem is fixed. Sorry if I indicated this is now a non-issue, but Comment #2 needs to be addressed before SqueezeCenter will work on Ubuntu 8.04.
Comment 6 Darren Warner 2008-03-29 00:25:10 UTC
I thought this launchpad bug might be useful:

https://bugs.launchpad.net/ubuntu/+source/mysql-dfsg-5.0/+bug/197476

It discusses what appears to be the same problem with a different package (akonadi). The suggested solution is to hardlink /usr/bin/mysqld to something like /usr/bin/mysqld.squeezecenter. Running this version will bypass the appamor profile.

HTH
Comment 7 Darren Warner 2008-03-29 01:19:39 UTC
This works for me (as an alternative to the apparmor hack above):

$ sudo ln /usr/sbin/mysqld /usr/sbin/mysqld.squeezecenter

Then apply the following patch to /usr/share/perl5/Slim/Utils/MySQLHelper.pm:

--- MySQLHelper.pm~	2008-03-29 01:14:18.000000000 -0700
+++ MySQLHelper.pm	2008-03-29 01:12:09.000000000 -0700
@@ -228,9 +228,9 @@
 		return 0;
 	}
 
-	my $mysqld = Slim::Utils::Misc::findbin('mysqld') || do {
+	my $mysqld = Slim::Utils::Misc::findbin('mysqld.squeezecenter') || do {
 
-		$log->logdie("FATAL: Couldn't find a executable for 'mysqld'! Exiting.");
+		$log->logdie("FATAL: Couldn't find a executable for 'mysqld.squeezecenter'! Exiting.");
 	};
 
 	my $confFile = $class->confFile;
Comment 8 Blackketter Dean 2008-04-02 09:50:36 UTC
Matt: can you take a look at this on Debian?
Comment 9 Matt Wise 2008-04-02 10:25:48 UTC
Yeah I'll setup a VM image with this today or tomorrow. I think that addressing our issue with AppArmor is the better fix if thats going to be something that is supported long term in Debian. It's not hard to check for the existance of /etc/apparmor.d/usr.sbin.mysqld and add lines to it if necessary. 
Comment 10 Chris Owens 2008-04-09 09:28:35 UTC
Ping
Comment 11 Matt Wise 2008-04-09 11:07:39 UTC
Fixed in patch #18609. In the postinst and postrm files we check if the appamor directory and file exists, and if it does, we modify the file (keeping a backup of the original). 

Fix will show up in tomorrow's nightly. 
Comment 12 Robert Crosbie 2008-04-30 20:47:15 UTC
(In reply to comment #11)
> Fixed in patch #18609. In the postinst and postrm files we check if the appamor
> directory and file exists, and if it does, we modify the file (keeping a backup
> of the original). 
> 
> Fix will show up in tomorrow's nightly. 
> 

I just upgraded to Ubuntu Hardy and installed squeezecenter (previously using slimserver).

I found the changes were already made to /etc/apparmor.d/usr.sbin.mysqld but I also had to create the hardlinks and update MySQLHelper.pm or else squeezecenter would not start.

Creating the hardlinks got rid of the MySQLHelper errors:

[08-04-30 23:05:57.8809] Slim::Utils::MySQLHelper::createSystemTables (433) FATAL: Couldn't connect to database: [Can't connect to local MySQL server through socket '/var/lib/squeezecenter/cache/squeezecenter-mysql.sock' (2)]
2008-04-30 23:05:57 SqueezeCenter died. Restarting.
Comment 13 Billy Dickson 2008-05-06 08:44:15 UTC
Created the following file below called squeezecenter and put it into the /apparmor.d/abstractions/ directory. 

I also I added the following line:

#include <abstractions/squeezecenter>

to the file /etc/apparmor.d/usr.sbin.mysqld

Then reloaded apparmor "sudo /etc/init.d/apparmor reload". This seemed to fix the problem for me, hope it helps.

# ——————————————————————
#
#    Copyright (C) Billy Dickson 5/5/08
#
#    Filename: /etc/apparmor.d/abstractions/squeezecenter
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of version 2 of the GNU General Public
#    License published by the Free Software Foundation.
#
# ——————————————————————
        /var/lib/squeezecenter/cache/*/ r,
        /var/lib/squeezecenter/cache/MySQL/ib_logfile? krw,
        /var/lib/squeezecenter/cache/MySQL/ibdata1 krw,
        /var/lib/squeezecenter/cache/MySQL/linux.lower-test w,
        /var/lib/squeezecenter/cache/MySQL/mysql/* rw,
        /var/lib/squeezecenter/cache/MySQL/slimserver/* rw,
        /var/lib/squeezecenter/cache/my.cnf r,
        /var/lib/squeezecenter/cache/mysql-error-log.txt rw,
        /var/lib/squeezecenter/cache/squeezecenter-mysql.pid w,
        /var/lib/squeezecenter/cache/squeezecenter-mysql.sock w,
Comment 14 James Richardson 2008-05-12 14:47:21 UTC
Marking bug as closed
Comment 15 B Williams 2008-05-21 12:52:39 UTC
The new package is still not right, because it keeps the original file in /etc/apparmor.d/. This causes apparmor to attempt to load both the old and new files, which conflict. I had to move the copy of the original file and restart apparmor in order to get 7.0.1 to work again.
Comment 16 tim carlin 2008-06-18 22:36:17 UTC
The file:

 usr.sbin.mysqld.squeezecenter.orig

must be mv'ed from the apparmor directory. Almost there...
Comment 17 Patrick Dixon 2008-06-19 05:31:21 UTC
This still isn't fixed (19 June 2008).

I've just updated to Hardy and get the same problem even though the lines have been added to  /etc/apparmor.d/usr.sbin.mysqld


I've had to remove /etc/apparmor.d/usr.sbin.mysqld.squeezecenter.orig and reload apparmor to complete the process.

Please re-open, fix and test properly before closing!

Thanks.

Comment 18 happy 2008-09-04 08:07:45 UTC
It's still broken as described in comment #16.  Do comments after a bug is closed go to /dev/null?
Comment 19 Matt Wise 2008-09-05 08:19:15 UTC
Can you guys try putting a "." in front of that filename? Move it from "usr.sbin.mysqld.squeezecenter.orig" to ".usr.sbin.mysqld.squeezecenter.orig". 
Comment 20 Chris Thierman 2008-09-07 16:50:56 UTC
(In reply to comment #19)
> Can you guys try putting a "." in front of that filename? Move it from
> "usr.sbin.mysqld.squeezecenter.orig" to ".usr.sbin.mysqld.squeezecenter.orig". 

OK, I'm using Ubuntu 8.04 Hardy Heron, I also recently updated to the latest version of squeezecenter (which used to work on this machine) I started to get the message 
 "Could not open required defaults file: /var/lib/squeezecenter/cache/my.cnf"
and SqueezeCenter would reboot endlessly.  I followed the directions above and now It dies in a different way, here is the uname -a output, the version of perl I'm running and the output from squeezecenter. Any help to fix would be nice, since I either missed something, or the above didn't work.


Uname -a
Linux thierman-desktop 2.6.24-21-generic #1 SMP Mon Aug 25 17:32:09 UTC 2008 i686 GNU/Linux
perl verion 5.8.8


squeezecenter@thierman-desktop:~$ /usr/sbin/squeezecenter-server --debug d_startup --diag --verbose
Got @INC containing:
/usr/share/squeezecenter/CPAN
/usr/share/squeezecenter
/usr/sbin
/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
.

Extended @INC to contain:
/usr/share/squeezecenter/CPAN/arch/5.8/i386-linux-thread-multi
/usr/share/squeezecenter/CPAN/arch/5.8/i386-linux-thread-multi/auto
/usr/share/squeezecenter/CPAN/arch/5.8.8/i486-linux-gnu-thread-multi
/usr/share/squeezecenter/CPAN/arch/5.8.8/i486-linux-gnu-thread-multi/auto
/usr/share/squeezecenter/CPAN/arch/5.8/i486-linux-gnu-thread-multi
/usr/share/squeezecenter/CPAN/arch/5.8/i486-linux-gnu-thread-multi/auto
/usr/share/squeezecenter/CPAN/arch/i486-linux-gnu-thread-multi
/usr/share/squeezecenter/lib
/usr/share/squeezecenter/CPAN
/usr/share/squeezecenter
/usr/share/squeezecenter/CPAN
/usr/share/squeezecenter
/usr/sbin
/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
.

Loaded module: [version] ok!
Loaded module: [Time::HiRes] ok!
Loaded module: [DBD::mysql] ok!
Loaded module: [DBI] ok!
Loaded module: [XML::Parser::Expat] ok!
Loaded module: [HTML::Parser] ok!
Loaded module: [JSON::XS] ok!
Loaded module: [Compress::Zlib] ok!
Loaded module: [Digest::SHA1] ok!
Loaded module: [YAML::Syck] ok!
Loaded module: [GD] ok!
Loaded module: [Locale::Hebrew] ok!
The following modules are loaded after the first attempt:
        YAML/Syck.pm => /usr/share/squeezecenter/CPAN/YAML/Syck.pm
        IO/Handle.pm => /usr/lib/perl/5.8/IO/Handle.pm
        re.pm => /usr/lib/perl/5.8/re.pm
        HTML/Parser.pm => /usr/share/squeezecenter/CPAN/HTML/Parser.pm
        File/Spec/Functions.pm => /usr/share/perl/5.8/File/Spec/Functions.pm
        List/Util.pm => /usr/lib/perl/5.8/List/Util.pm
        POSIX.pm => /usr/lib/perl/5.8/POSIX.pm
        SelectSaver.pm => /usr/share/perl/5.8/SelectSaver.pm
        /usr/lib/perl/5.8/auto/POSIX/load_imports.al => /usr/lib/perl/5.8/auto/POSIX/load_imports.al
        Getopt/Long.pm => /usr/share/perl/5.8/Getopt/Long.pm
        GD/Polygon.pm => /usr/share/squeezecenter/CPAN/GD/Polygon.pm
        Compress/Zlib.pm => /usr/share/squeezecenter/CPAN/Compress/Zlib.pm
        Locale/Hebrew.pm => /usr/share/squeezecenter/CPAN/Locale/Hebrew.pm
        DBD/mysql.pm => /usr/share/squeezecenter/CPAN/DBD/mysql.pm
        Cwd.pm => /usr/lib/perl/5.8/Cwd.pm
        warnings.pm => /usr/share/perl/5.8/warnings.pm
        Slim/Utils/OSDetect.pm => /usr/share/perl5/Slim/Utils/OSDetect.pm
        B.pm => /usr/lib/perl/5.8/B.pm
        Digest/base.pm => /usr/share/squeezecenter/CPAN/Digest/base.pm
        Fcntl.pm => /usr/lib/perl/5.8/Fcntl.pm
        Symbol.pm => /usr/share/perl/5.8/Symbol.pm
        Scalar/Util.pm => /usr/lib/perl/5.8/Scalar/Util.pm
        UNIVERSAL.pm => /usr/share/perl/5.8/UNIVERSAL.pm
        Exporter.pm => /usr/share/perl/5.8/Exporter.pm
        version/vpp.pm => /usr/share/squeezecenter/CPAN/version/vpp.pm
        File/Spec.pm => /usr/share/perl/5.8/File/Spec.pm
        JSON/XS.pm => /usr/share/squeezecenter/CPAN/JSON/XS.pm
        File/Path.pm => /usr/share/perl/5.8/File/Path.pm
        /usr/lib/perl/5.8/auto/POSIX/autosplit.ix => /usr/lib/perl/5.8/auto/POSIX/autosplit.ix
        FindBin.pm => /usr/share/perl/5.8/FindBin.pm
        locale.pm => /usr/share/perl/5.8/locale.pm
        warnings/register.pm => /usr/share/perl/5.8/warnings/register.pm
        XSLoader.pm => /usr/lib/perl/5.8/XSLoader.pm
        Slim/bootstrap.pm => /usr/share/perl5/Slim/bootstrap.pm
        Digest/SHA1.pm => /usr/share/squeezecenter/CPAN/Digest/SHA1.pm
        Time/HiRes.pm => /usr/share/squeezecenter/CPAN/Time/HiRes.pm
        IO/Seekable.pm => /usr/lib/perl/5.8/IO/Seekable.pm
        XML/Parser/Expat.pm => /usr/share/squeezecenter/CPAN/XML/Parser/Expat.pm
        version.pm => /usr/share/squeezecenter/CPAN/version.pm
        B/Deparse.pm => /usr/lib/perl/5.8/B/Deparse.pm
        DBI.pm => /usr/share/squeezecenter/CPAN/DBI.pm
        GD/Image.pm => /usr/share/squeezecenter/CPAN/GD/Image.pm
        Config.pm => /usr/lib/perl/5.8/Config.pm
        File/Basename.pm => /usr/share/perl/5.8/File/Basename.pm
        IO.pm => /usr/lib/perl/5.8/IO.pm
        Carp.pm => /usr/share/perl/5.8/Carp.pm
        FileHandle.pm => /usr/share/perl/5.8/FileHandle.pm
        File/Spec/Unix.pm => /usr/share/perl/5.8/File/Spec/Unix.pm
        Exporter/Heavy.pm => /usr/share/perl/5.8/Exporter/Heavy.pm
        vars.pm => /usr/share/perl/5.8/vars.pm
        strict.pm => /usr/share/perl/5.8/strict.pm
        constant.pm => /usr/share/perl/5.8/constant.pm
        Config_heavy.pl => /usr/lib/perl/5.8/Config_heavy.pl
        IO/File.pm => /usr/lib/perl/5.8/IO/File.pm
        AutoLoader.pm => /usr/share/perl/5.8/AutoLoader.pm
        overload.pm => /usr/share/perl/5.8/overload.pm
        auto/Compress/Zlib/autosplit.ix => /usr/share/squeezecenter/CPAN/arch/5.8/i386-linux-thread-multi/auto/Compress/Zlib/autosplit.ix
        HTML/Entities.pm => /usr/share/squeezecenter/CPAN/HTML/Entities.pm
        lib.pm => /usr/lib/perl/5.8/lib.pm
        GD.pm => /usr/share/squeezecenter/CPAN/GD.pm
        DynaLoader.pm => /usr/lib/perl/5.8/DynaLoader.pm

The following modules are loaded after the second attempt:
        YAML/Syck.pm => /usr/share/squeezecenter/CPAN/YAML/Syck.pm
        IO/Handle.pm => /usr/lib/perl/5.8/IO/Handle.pm
        re.pm => /usr/lib/perl/5.8/re.pm
        HTML/Parser.pm => /usr/share/squeezecenter/CPAN/HTML/Parser.pm
        File/Spec/Functions.pm => /usr/share/perl/5.8/File/Spec/Functions.pm
        List/Util.pm => /usr/lib/perl/5.8/List/Util.pm
        POSIX.pm => /usr/lib/perl/5.8/POSIX.pm
        SelectSaver.pm => /usr/share/perl/5.8/SelectSaver.pm
        /usr/lib/perl/5.8/auto/POSIX/load_imports.al => /usr/lib/perl/5.8/auto/POSIX/load_imports.al
        Getopt/Long.pm => /usr/share/perl/5.8/Getopt/Long.pm
        GD/Polygon.pm => /usr/share/squeezecenter/CPAN/GD/Polygon.pm
        Compress/Zlib.pm => /usr/share/squeezecenter/CPAN/Compress/Zlib.pm
        Locale/Hebrew.pm => /usr/share/squeezecenter/CPAN/Locale/Hebrew.pm
        DBD/mysql.pm => /usr/share/squeezecenter/CPAN/DBD/mysql.pm
        Cwd.pm => /usr/lib/perl/5.8/Cwd.pm
        warnings.pm => /usr/share/perl/5.8/warnings.pm
        Slim/Utils/OSDetect.pm => /usr/share/perl5/Slim/Utils/OSDetect.pm
        B.pm => /usr/lib/perl/5.8/B.pm
        Digest/base.pm => /usr/share/squeezecenter/CPAN/Digest/base.pm
        Fcntl.pm => /usr/lib/perl/5.8/Fcntl.pm
        Symbol.pm => /usr/share/perl/5.8/Symbol.pm
        Scalar/Util.pm => /usr/lib/perl/5.8/Scalar/Util.pm
        UNIVERSAL.pm => /usr/share/perl/5.8/UNIVERSAL.pm
        Exporter.pm => /usr/share/perl/5.8/Exporter.pm
        version/vpp.pm => /usr/share/squeezecenter/CPAN/version/vpp.pm
        File/Spec.pm => /usr/share/perl/5.8/File/Spec.pm
        JSON/XS.pm => /usr/share/squeezecenter/CPAN/JSON/XS.pm
        File/Path.pm => /usr/share/perl/5.8/File/Path.pm
        /usr/lib/perl/5.8/auto/POSIX/autosplit.ix => /usr/lib/perl/5.8/auto/POSIX/autosplit.ix
        FindBin.pm => /usr/share/perl/5.8/FindBin.pm
        locale.pm => /usr/share/perl/5.8/locale.pm
        warnings/register.pm => /usr/share/perl/5.8/warnings/register.pm
        XSLoader.pm => /usr/lib/perl/5.8/XSLoader.pm
        Slim/bootstrap.pm => /usr/share/perl5/Slim/bootstrap.pm
        Digest/SHA1.pm => /usr/share/squeezecenter/CPAN/Digest/SHA1.pm
        Time/HiRes.pm => /usr/share/squeezecenter/CPAN/Time/HiRes.pm
        IO/Seekable.pm => /usr/lib/perl/5.8/IO/Seekable.pm
        XML/Parser/Expat.pm => /usr/share/squeezecenter/CPAN/XML/Parser/Expat.pm
        version.pm => /usr/share/squeezecenter/CPAN/version.pm
        B/Deparse.pm => /usr/lib/perl/5.8/B/Deparse.pm
        DBI.pm => /usr/share/squeezecenter/CPAN/DBI.pm
        GD/Image.pm => /usr/share/squeezecenter/CPAN/GD/Image.pm
        Config.pm => /usr/lib/perl/5.8/Config.pm
        File/Basename.pm => /usr/share/perl/5.8/File/Basename.pm
        IO.pm => /usr/lib/perl/5.8/IO.pm
        Carp.pm => /usr/share/perl/5.8/Carp.pm
        FileHandle.pm => /usr/share/perl/5.8/FileHandle.pm
        File/Spec/Unix.pm => /usr/share/perl/5.8/File/Spec/Unix.pm
        Exporter/Heavy.pm => /usr/share/perl/5.8/Exporter/Heavy.pm
        vars.pm => /usr/share/perl/5.8/vars.pm
        strict.pm => /usr/share/perl/5.8/strict.pm
        constant.pm => /usr/share/perl/5.8/constant.pm
        Config_heavy.pl => /usr/lib/perl/5.8/Config_heavy.pl
        IO/File.pm => /usr/lib/perl/5.8/IO/File.pm
        AutoLoader.pm => /usr/share/perl/5.8/AutoLoader.pm
        overload.pm => /usr/share/perl/5.8/overload.pm
        auto/Compress/Zlib/autosplit.ix => /usr/share/squeezecenter/CPAN/arch/5.8/i386-linux-thread-multi/auto/Compress/Zlib/autosplit.ix
        HTML/Entities.pm => /usr/share/squeezecenter/CPAN/HTML/Entities.pm
        lib.pm => /usr/lib/perl/5.8/lib.pm
        GD.pm => /usr/share/squeezecenter/CPAN/GD.pm
        DynaLoader.pm => /usr/lib/perl/5.8/DynaLoader.pm

[08-09-07 17:32:58.9205] Carp::confess (103) Warning: Uncaught exception from user code:
        Database error: Can't DROP 'rating'; check that column/key exists at /usr/share/squeezecenter/CPAN/DBIx/Migration.pm line 115.
 at /usr/share/squeezecenter/CPAN/DBIx/Migration.pm line 115
        DBIx::Migration::migrate('DBIx::Migration=HASH(0xaccab14)') called at /usr/share/perl5/Slim/Schema.pm line 421
        Slim::Schema::migrateDB('Slim::Schema') called at /usr/share/perl5/Slim/Schema.pm line 175
        Slim::Schema::init('Slim::Schema') called at /usr/share/perl5/Slim/Music/Info.pm line 76
        Slim::Music::Info::init() called at /usr/sbin/squeezecenter-server line 368
        main::init() called at /usr/sbin/squeezecenter-server line 479
        main::main() called at /usr/sbin/squeezecenter-server line 1043
[08-09-07 17:32:58.9210] Slim::Schema::forceCommit (1485) Warning: Trying to commit transactions before DB is initialized!
squeezecenter@thierman-desktop:~$
Comment 21 Chris Thierman 2008-09-07 21:25:18 UTC
Just an update. From reading in another discussion with a similair error, the suggestion was to delete the cache directory, so I renamed the cache directory to cache-. After having done this, everything came up fine.  
Comment 22 Chris Owens 2008-09-10 16:43:21 UTC
Are other users still seeing this issue?  I see there's lots of people on the CC list...
Comment 23 Eric 2008-09-12 15:45:40 UTC
(In reply to comment #22)
> Are other users still seeing this issue?  I see there's lots of people on the
> CC list...
> 
I'm seeing these lines in usr.sbin.mysqld, but I'm still not able to start squeezecenter.

/var/lib/squeezecenter/cache/ r,
/var/lib/squeezecenter/cache/my.cnf r,
/var/lib/squeezecenter/cache/mysql.startup rw,
/var/lib/squeezecenter/cache/mysql-error-log.txt rw,
/var/lib/squeezecenter/cache/squeezecenter-mysql.pid w,
/var/lib/squeezecenter/cache/squeezecenter-mysql.sock w,
/var/lib/squeezecenter/cache/MySQL/ r,
/var/lib/squeezecenter/cache/MySQL/** rwk,
Comment 24 Ben Kochie 2008-09-12 18:10:08 UTC
As I've been ranting on the thread in the forums there are still major problems with apparmor's install in the Debian package.  (http://forums.slimdevices.com/showthread.php?p=339851)

#1: The postinst script blindly adds the apparmor statments over and over again for each squeezecenter install

#2: The postinst script backs up the apparmor control file to the same directory. (/etc/apparmor.d)  Since this directory is loaded lexically, it breaks newly installed squeezecenter installs, and also breaks when people upgrade their server from pre-apparmor to 8.04 (and newer) without re-installing squeezecenter.

The later case in #2 is probably harder to solve, but everything else can be fixed with some simple patching to the postinst script.  I will post a proposed patch to the postinst shortly.

A possible better solution is to separate the apparmor stuff into a separate "check_apparmor.sh" script that is included and run by /etc/init.d/squeezecenter each time the server starts.
Comment 25 Ben Kochie 2008-09-13 11:31:26 UTC
Created attachment 3986 [details]
check_apparmor.sh patch (try 1)

Here's my proposed fix for the apparmor issues.  This script adds an additional file to the debian package to check for apparmor at each squeezecenter install.  This solves the problem where the OS is upgraded to include apparmor but the squeezecenter package is already installed.

part 1: remove apparmor code from the postinst
part 2: change apparmor backup file location in postrm
part 3: add check_apparmor.sh to init.d script
part 4: check_apparmor.sh script

Please note that check_apparmor.sh needs to be +x.
Comment 26 Chris Owens 2008-09-15 09:35:05 UTC
Matt does this look okay for inclusion in the Debian package?
Comment 27 Matt Wise 2008-09-15 10:03:32 UTC
Michael,
  Should we actually try to implement this AppArmor checking into your new OSDetect code? 
Comment 28 Michael Herger 2008-09-15 10:09:17 UTC
I'll have to read up on AppArmor before I can say anything. I have no idea about it except when I last tried to run SC on Ubuntu, it failed due to AppArmor...
Comment 29 Blackketter Dean 2008-09-15 10:29:04 UTC
The patch doesn't need the OSDetect stuff, right?  Shouldn't be necessary?
Comment 30 Matt Wise 2008-09-15 10:35:38 UTC
I was thinking that now that the OSDetect code is split into modules, that our 'intelligence' should be in these modules, not in the startup scripts. The startup scripts should be as simple as possible.

 That being said, without looking into it further, I am not sure its even possible. It might HAVE to be in the startup scripts.
Comment 31 Michael Herger 2008-09-15 15:58:31 UTC
IMHO it belongs into the startup script because it's about an OS configuration, not SC.
Comment 32 Matt Burkhardt 2008-09-27 08:34:39 UTC
Same problem - want to get a Squeezebox Duet but will wait for fix - just adding to get on the CC list
Comment 33 James Richardson 2008-10-08 15:00:59 UTC
*** Bug 9594 has been marked as a duplicate of this bug. ***
Comment 34 James Richardson 2008-10-10 10:13:21 UTC
*** Bug 9667 has been marked as a duplicate of this bug. ***
Comment 35 James Richardson 2008-10-10 10:14:45 UTC
See BUG 9667 comment #4
Comment 36 Joseph Van Riper 2008-10-11 14:59:04 UTC
This continues to be a problem for the latest version of Ubuntu (as of the date of this comment).  Man, I wish I could be more helpful than this, but perhaps some other poor guy reading this comment might be able to use my terrible workaround.

Steps to reproduce:

1. Install today's Ubuntu (Hardy Heron) server on a fresh machine (I expect you could use a VMWare machine for this, if you have that tool handy).
2. Browse to http://www.slimdevices.com/su_downloads.html, click 'Debium/Ubuntu', click "I agree", and then click Download SqueezeCenter.
3. Follow all directions on this web page, to install "latest stable release" of SqueezeCenter (currently 7.2).
4. Browse to port 9000 of your Ubuntu installation using your favorite browser, just like the directions suggest.

Expected results:

Spiffy-wonderful SqueezeCenter GUI comes up, and helps fill my ears with aural wonders.

Actual results:

Unable to access port.  A general feeling of hopelessness overcomes me, and I eat too much chocolate to compensate.

Workaround:

1. Called "sudo /etc/init.d/apparmor stop".
2. Called "sudo /etc/init.d/squeezecenter stop".
2. Removed /var/lib/squeezecenter/cache folder.
3. Called "sudo /etc/init.d/squeezecenter start".

NOTE: this workaround will not survive a reboot.

ALSO NOTE: you probably shouldn't eat this much chocolate.
Comment 37 Blackketter Dean 2008-10-11 16:19:17 UTC
Matt & Fletch: What's the plan on fixing this?
Comment 38 Mark Miksis 2008-10-13 05:34:04 UTC
(In reply to comment #37)
> Matt & Fletch: What's the plan on fixing this?
> 

To be honest, I haven't been looking at this.  In a forum thread, I volunteered to check in Ben's patch, but when Matt/Michael/etc discussed alternate fixes, I decided not to do so.
Comment 39 Matt Wise 2008-10-13 13:22:50 UTC
Hopefully fixed in change 23540. Please try that. 
Comment 40 Ben Kochie 2008-10-15 11:16:31 UTC
(In reply to comment #39)
> Hopefully fixed in change 23540. Please try that. 
> 

Can this be integrated into the 7.2 release deb?
Comment 41 Matt Wise 2008-10-15 11:40:48 UTC
Fixed in change 23584... 
Comment 42 Blackketter Dean 2008-10-15 11:46:55 UTC
Marking fixed for Matt.
Comment 43 tomasz 2008-10-20 03:36:09 UTC
Hello.

Sorry, but it's seems that the installation error happens with all packets that I am trying to install.

So, it's seem that the problem is with Adept or Synaptic installer.

Many thanks.
Comment 44 tomasz 2008-10-20 05:57:07 UTC
Hello again.

Now, when i execute squeezecenter.postinst it is produced the next output:

Reloading AppArmor profiles /sbin/apparmor_parser: Unable to replace "/usr/lib/cups/backend/cups-pdf".  Profile doesn't conform to protocol
 Profile /etc/apparmor.d/usr.sbin.cupsd failed to load
Warning: found /etc/apparmor.d/force-complain/usr.sbin.mysqld, forcing complain mode
/sbin/apparmor_parser: Unable to replace "/usr/sbin/mysqld".  Profile doesn't conform to protocol
 Profile /etc/apparmor.d/usr.sbin.mysqld failed to load
/sbin/apparmor_parser: Unable to replace "/usr/sbin/mysqld".  Profile doesn't conform to protocol
 Profile /etc/apparmor.d/usr.sbin.mysqld.squeezecenter.orig failed to load
: Failed.

Every time that I try to install or update any packet, it is produced this error.

Regards.

Comment 45 Ross Levine 2008-10-29 17:29:21 UTC
Verified to be working 7.2.1 - 23703, that is it installs and starts without issue. 
Comment 46 James Richardson 2008-12-15 12:35:16 UTC
This bug has been fixed in the 7.3.0 release version of SqueezeCenter!

Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already.  

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
Comment 47 Chris Owens 2009-07-31 10:18:20 UTC
Reduce number of active targets for SC
Comment 48 Patrick Dixon 2009-07-31 10:25:14 UTC
This is fixed/closed.  Why re-target it?