LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-02-2009, 12:00 PM   #1
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 193

Rep: Reputation: 15
how to restart avahi-daemon after suspend to ram


I have found that printing to shared printers through CUPS fails after a suspend to RAM (on the client). Some probing revealed that if I restart the avahi-daemon, then printing works properly.

Is there some way to automatically restart this daemon when the system is resuming so it doesn't need to be done manually each time?
 
Old 07-03-2009, 06:14 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
From the Debian hibernate-.*/README: "The Debian version of the suspend script installs the standard scriptlets in /usr/share/hibernate/scriptlets.d, but also looks in /etc/hibernate/scriptlets.d and /usr/local/share/hibernate/scriptlets.d for any custom scriptlets that you may want to write. Documentation on writing scriptlets can be found in /usr/share/doc/hibernate/SCRIPTLET-API.gz". So it's possible to write a hook for this.

Last edited by unSpawn; 07-03-2009 at 06:23 AM.
 
Old 07-09-2009, 07:50 PM   #3
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 193

Original Poster
Rep: Reputation: 15
I can't discern any relationship between the hibernate utility, which makes use of /usr/share/hibernate, and the s2ram program that I'm actually using, whose documentation never mentions anything like that. The hibernate utility doesn't seem to have suspend to ram as an option, just suspend to disk---not what I want.

So does anybody know how to run something automatically when returning from s2ram?
 
Old 07-09-2009, 08:07 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Go find out what part s2ram plays in the generic suspend scheme. Then find out if any of those packages offer scripting hooks.
 
Old 07-09-2009, 08:28 PM   #5
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 193

Original Poster
Rep: Reputation: 15
As far as I can tell, s2ram is the low level program that causes the hardware to suspend. There is no mention anywhere that I can see of scripting hooks, or I wouldn't have posted here. It sounds like the recovery is done by the kernel itself, from what I can decipher in the documentation (which talks about how you have to recompile your kernel with the right patches, etc, etc).
 
Old 07-10-2009, 04:34 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by adrianmariano View Post
There is no mention anywhere that I can see of scripting hooks
S2ram doesn't work on its own. Looking at some HOWTO's should show its just one in a group of apps one would install to have suspend functionality. Regardless of that the generic principle remains AFAIK: once the system awaks stuff gets run, so about anything that has hooks for running arbitrary scripts or that runs periodically could do.
 
Old 07-10-2009, 07:21 AM   #7
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 193

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
S2ram doesn't work on its own. Looking at some HOWTO's should show its just one in a group of apps one would install to have suspend functionality. Regardless of that the generic principle remains AFAIK: once the system awaks stuff gets run, so about anything that has hooks for running arbitrary scripts or that runs periodically could do.
I'm not sure what you mean that s2ram doesn't work on its own. It works with the kernel, of course. But so what?

Here's a description of s2ram:

s2ram is a wrapper around the kernel's suspend-to-RAM mechanism allowing the user to perform some graphics adapter manipulations from the user land before suspending and after resuming

I suppose I could replace s2ram with a script that calls the original s2ram and then does stuff afterwords. For some reason this approach didn't occur to me. (The script would probably have to be suid root.)


Somehow it doesn't seem reasonable to restart a daemon periodically...what, every 10 seconds I restart it?
 
Old 07-10-2009, 07:54 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
http://wiki.debian.org/Suspend -> http://en.opensuse.org/Pm-utils#Creating_your_own_hooks and setuid root scripts don't work.
 
Old 07-16-2009, 08:50 PM   #9
adrianmariano
Member
 
Registered: Dec 2004
Distribution: Ubuntu Yakkety
Posts: 193

Original Poster
Rep: Reputation: 15
So pm-utils does indeed provide a suspend mechanism with hooks. And I set it up to restart the daemon, which seems to work as desired. Except that pm-suspend has to be run as root, so I still need a suid program to kick it off.

I thought perl could do suid scripts, but it gave me an error about being unable to run sperl, so I just wrote a C program instead. But something still goes wrong. Even though the pm-utils manual says that hooks run as root, when my hook runs the uid is 1000 and the daemon restart fails. (If I run pm-suspend as root then all works as planned and the daemon restarts.)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tiger warnings about avahi-daemon - should I be concerned? mark_alfred Linux - Security 5 04-30-2009 11:20 AM
(Ubuntu) Avahi-Daemon errors runneri.q Linux - Wireless Networking 1 08-07-2008 07:06 PM
(Ubuntu) Avahi-Daemon errors runneri.q Linux - Newbie 1 08-06-2008 07:18 AM
Avahi-daemon on startup OR13 Fedora 1 07-13-2006 12:24 PM
Ubuntu + avahi-daemon/tools Valhalla Linux - Software 0 12-10-2005 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration