Mailing List Archive

Subtle difference in behavior of installation packages
Hi folks,

I've been working on a small Maemo app, and have reached the point where
I've pushed it up to Extras-Devel. Almost everything works perfectly,
except for one item: I've created a sudoers file for the app, in order
to allow it to call "modprobe" to load a kernel module. (This is the
"lirc_rx51" module, needed for access to the IR hardware.) This file
needs to go into the /etc/sudoers.d directory.

I can install and uninstall the file just fine using the debian package
I've constructed locally. When installing the app from the Extras-Devel
repository, however, the application manager can place the file into
/etc/sudoers.d, but seems unable to remove it when uninstalling.

I'm using the Qt SDK, and have recently upgraded to Qt Creator 2.4.1, so
maybe the latest Qt software creates debian packages differently than
the Extras system does...

So, I guess these are my questions:

1) Do I need to do something special to install/uninstall files to the
/etc directory in Maemo?

2) Should I even be using /etc/sudoers.d to let my app access modprobe?
What is the preferred way for an app to make requests of the kernel?

Thanks!

--John
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: Subtle difference in behavior of installation packages [ In reply to ]
Hi,

On Wednesday 08 February 2012 13:10:25 John Pietrzak wrote:
> Hi folks,
>
> I've been working on a small Maemo app, and have reached the point where
> I've pushed it up to Extras-Devel. Almost everything works perfectly,
> except for one item: I've created a sudoers file for the app, in order
> to allow it to call "modprobe" to load a kernel module. (This is the
> "lirc_rx51" module, needed for access to the IR hardware.) This file
> needs to go into the /etc/sudoers.d directory.
>
> I can install and uninstall the file just fine using the debian package
> I've constructed locally. When installing the app from the Extras-Devel
> repository, however, the application manager can place the file into
> /etc/sudoers.d, but seems unable to remove it when uninstalling.

Try to run apt-get remove <package> in xterm. This is what application manager
doing... Also see error in application manager log.

>
> I'm using the Qt SDK, and have recently upgraded to Qt Creator 2.4.1, so
> maybe the latest Qt software creates debian packages differently than
> the Extras system does...
>
> So, I guess these are my questions:
>
> 1) Do I need to do something special to install/uninstall files to the
> /etc directory in Maemo?

I think nothing special. Only add your /etc files to conffiles in debian
package, but this is done by debhelper script for dpkg-buildpackage. So really
nothing.

>
> 2) Should I even be using /etc/sudoers.d to let my app access modprobe?
> What is the preferred way for an app to make requests of the kernel?

Yes add sudoers file, run script for updating sudoers.d and use:
sudo modprobe <module>

>
> Thanks!
>
> --John

--
Pali Rohár
pali.rohar@gmail.com
Re: Subtle difference in behavior of installation packages [ In reply to ]
On Wed, 08 Feb 2012 19:21:16 +0100, Pali Rohár wrote:

> > I can install and uninstall the file just fine using the debian package
> > I've constructed locally. When installing the app from the Extras-Devel
> > repository, however, the application manager can place the file into
> > /etc/sudoers.d, but seems unable to remove it when uninstalling.
> Try to run apt-get remove <package> in xterm. This is what application manager
> doing... Also see error in application manager log.

apt-get remove without --purge won't remove conffiles, which would
explain why /etc/sudoers.d/foo is still there ...

And that's on purpose at least in Debian. If HAM can't be told to
purge a package there's not much that can be done (short of using
brute force in the postrm maintainer script. Ehh, this sounds ugly.).


Cheers,
gregor

--
.''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
: :' : Debian GNU/Linux user, admin, and developer - http://www.debian.org/
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Carole King: Will You Still Love Me Tomorrow
Re: Subtle difference in behavior of installation packages [ In reply to ]
On Wednesday 08 February 2012 21:04:26 gregor herrmann wrote:
> On Wed, 08 Feb 2012 19:21:16 +0100, Pali Rohár wrote:
> > > I can install and uninstall the file just fine using the debian package
> > > I've constructed locally. When installing the app from the Extras-Devel
> > > repository, however, the application manager can place the file into
> > > /etc/sudoers.d, but seems unable to remove it when uninstalling.
> >
> > Try to run apt-get remove <package> in xterm. This is what application
> > manager doing... Also see error in application manager log.
>
> apt-get remove without --purge won't remove conffiles, which would
> explain why /etc/sudoers.d/foo is still there ...
>
> And that's on purpose at least in Debian. If HAM can't be told to
> purge a package there's not much that can be done (short of using
> brute force in the postrm maintainer script. Ehh, this sounds ugly.).
>
>
> Cheers,
> gregor

You can create sudoers.d file in postinst file and remove it in postrm.
echo "..." > /etc/sudoers.d/...

Or you can force debhelper to not add that sudoers file to conffiles.

--
Pali Rohár
pali.rohar@gmail.com
Re: Subtle difference in behavior of installation packages [ In reply to ]
On 2/8/12 3:15 PM, Pali Rohár wrote:
> On Wednesday 08 February 2012 21:04:26 gregor herrmann wrote:
>
>> apt-get remove without --purge won't remove conffiles, which would
>> explain why /etc/sudoers.d/foo is still there ...
>>
>> And that's on purpose at least in Debian. If HAM can't be told to
>> purge a package there's not much that can be done (short of using
>> brute force in the postrm maintainer script. Ehh, this sounds ugly.).
>>

Yes, I tried the brute-force approach, and it was ugly. Ended up with
the package manager thinking the sudoers file still existed. :(

BTW, what is Debian's purpose on keeping conffiles around? Is there
value in having config info for nonexisting packages? (Should I not be
worried about leaving sudoers files in the sudoers.d directory?)

> You can create sudoers.d file in postinst file and remove it in postrm.
> echo "..."> /etc/sudoers.d/...

Thanks, tried that out, and it works fine! I guess I'll just go with
that for now...

Thanks,

--John
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: Subtle difference in behavior of installation packages [ In reply to ]
On Wed, 08 Feb 2012 18:38:53 -0500, John Pietrzak wrote:

> >>apt-get remove without --purge won't remove conffiles, which would
> >>explain why /etc/sudoers.d/foo is still there ...
> >>And that's on purpose at least in Debian.
> BTW, what is Debian's purpose on keeping conffiles around? Is there
> value in having config info for nonexisting packages? (Should I not
> be worried about leaving sudoers files in the sudoers.d directory?)

A package might be removed only temporarily or in error, and be
reinstalled again later. In that case the admin will be happy to find
their carefully tweaked config files instead of having to re-create
them from scratch (or grab them from a backup or an older git
revision).
And in general conffiles lying around in /etc/ don't hurt.


Cheers,
gregor

--
.''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
: :' : Debian GNU/Linux user, admin, and developer - http://www.debian.org/
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Bruce Springsteen: The Promised Land
Re: Subtle difference in behavior of installation packages [ In reply to ]
On 2/9/12 6:30 PM, gregor herrmann wrote:
> On Wed, 08 Feb 2012 18:38:53 -0500, John Pietrzak wrote:
>> BTW, what is Debian's purpose on keeping conffiles around? Is there
>> value in having config info for nonexisting packages? (Should I not
>> be worried about leaving sudoers files in the sudoers.d directory?)
> A package might be removed only temporarily or in error, and be
> reinstalled again later. In that case the admin will be happy to find
> their carefully tweaked config files instead of having to re-create
> them from scratch (or grab them from a backup or an older git
> revision).
> And in general conffiles lying around in /etc/ don't hurt.
>

Ah, I guess that makes sense.

Thanks!

--John
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers