LinuxMCE Forums

General => Installation issues => Topic started by: jamo on June 04, 2012, 08:55:40 am

Title: Re: 10.04 media directors not shutting down [Solved]
Post by: jamo on June 04, 2012, 08:55:40 am
Two of my old hardware media directors (ibm t30 notebook, hp xw4100 workstation) are not halting when I tell them to shut down (power off from UI). They reboot instead. I haven't tested with my 3rd MD (newer) but I was wondering where to start troubleshooting.
Title: Re: 10.04 media directors not shutting down
Post by: DragonK on June 04, 2012, 11:06:24 am
I normally set the to suspend in the webadmin. Then they boot up faster.
Its under advanced from the specific MD.

Karel
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 04, 2012, 06:52:55 pm
Obvious question: What are they set to do in BIOS? Reboot after power loss?

Also, I recall something about the halt script not being right for certain systems power management configurations. There was something about changing the halt script to -p (power down) instead of -h (halt) or something.
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 05, 2012, 03:16:29 pm
Had a quick peak when I was at home a moment ago and I thought I'd solved it - the script appears to call /sbin/poweroff on the media directory. When I had a look at that it was a symlink to /sbin/reboot! Simple, so I changed the simlink to /sbin/shutdown and tried to power off the md from it's onscreen orbiter but it still rebooted! Didn't have time to tinker further... perhaps I missed something. Will carry on digging. Thanks for the pointers JaseP.

When I get that sorted, I'll tinker with suspend....sounds like a good option as well.
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 05, 2012, 04:36:34 pm
Some machines need the shutdown to be:

Code: [Select]
shutdown -h now

Others need it to be:

Code: [Select]
shutdown -P now

All depends on how well their ACPI is implemented...

Note: Those commands must be issued with root authority, of course.

PS: I'm pretty sure the contents of sbin are scripts,... For you to fix it, you might have to edit the appropriate script after checking which command works properly from a terminal window or [Alt] + [F1] terminal (which command works is hardware dependent and a crap shoot).
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 05, 2012, 10:06:09 pm
crikey...

Code: [Select]
shutdown -h now
shutdown -P now
shutdown -h -P now
shutdown -H -P now

Tried the lot and all of them reboot. The only way to power off at the moment seems to be to run one of those and then hit the power button before the darned thing boots up again. Will try with my other media directors and see if the same problem exists...
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 05, 2012, 11:21:20 pm
Do a man page on the shutdown command to make sure there's no weirdness in Kubuntu's implementation of the shutdown command,... like a lowercase p instead of an uppercase P...

Else, it's either a weirdness of the particular system, or there's potentially some missing or changed library responsible. Also, try a Kubuntu 10.04 live CD to see if it shuts down normally with that.
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 06, 2012, 08:51:44 am
Do a man page on the shutdown command to make sure there's no weirdness in Kubuntu's implementation of the shutdown command,... like a lowercase p instead of an uppercase P...

Else, it's either a weirdness of the particular system, or there's potentially some missing or changed library responsible. Also, try a Kubuntu 10.04 live CD to see if it shuts down normally with that.
Have been doing some reading.... had a look at the ACPI bios settings... nothing spectactular to report. Noted that my newer HP6710b notebook MD shuts down sweetly. I'm still not 100% sure what the "power off md" button on the onscreen orbiter actually runs but I guess until I can, from terminal, find a command that does what I want, I can't expect LMCE to do it either ;-)

Will try the live cd option to see if that works... good idea, JaseP.
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 06, 2012, 09:19:35 pm
Yeah,... A live CD will give you an indication of whether it's completely a hardware incompatibility problem, or whether it's some fluke associated with the shutdown script that can be fixed by tracking down and editing the right script...
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 06, 2012, 09:22:21 pm
OK, I tried booting 10.04 live disk on one of the MDs and then went to command prompt and issued the "poweroff" command as root. Worked like a charm. So there does seem to be something odd about my MD image/setup. Another notable possible symptom is that when I press the "power off md" button, they pretty much stop dead (before rebooting) whereas I notice my one working MD goes through a small splash screen shutdown (the pic of tux in the chair and the yellow progress bar). So definitely something wrong...

I'm trying an apt-get update; upgrade on the one now... see if that helps. Otherwise rebuild image? delete MD and recreate?
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 06, 2012, 09:31:44 pm
Maybe deleting and rebuilding is in order... I don't know where LinuxMCE stores its shutdown scripts, or what they do (in other words I don't know if it, excecutes a graceful exit that saves jobs in progress, or sends an abrupt signal 11, 15, 9 or whatever and cross fingers it doesn't break something). You might want the feedback from a dev on that issue.
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 07, 2012, 08:45:20 am
No dice on the apt-get update/upgrade. Although I had to use rule#1 there and go to bed it took so long. Still power off does same thing. Next step - rebuild image. Last step delete, recreate MD.... reluctant, though, because weekend approaches and inevitably people visit and you want to show off your snazzy system.... wife suggests you put on some tunes and you have to say...ahem.... just rebuilding that media director again darling....
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 07, 2012, 09:01:00 am
It should only take about an hour to rebuild the MD image,... if that...

You should just leave the MDs running when you have your guests over... I leave mine running all the time.
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 07, 2012, 09:29:08 am
Yes, will ultimately leave most of my MDs running and/or suspend as suggested by Karel. However at the moment things are experimental and my MDs are also rather power hungry beasts (old workstations and the like) so I do regularly power them off. Electricity is getting expensive in this part of the world ;-)
Title: Re: 10.04 media directors not shutting down
Post by: pigdog on June 12, 2012, 02:00:58 am
Hi,

I downloaded snapshot 20120608011426058.

From the menu on the unit MD named Home Theatre when I go to Power and select power off it shuts down.

From the menu on the Core/Hybrid when I select power off for "Core" MD it shuts down.

Cheers
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 12, 2012, 07:54:33 am
Thanks, pigdog... I don't think it is a snap / version issue because one of my MDs works. I think it is something to do with the particular image on each so I'll probably do a rebuild image and then, if that fails delete and recreate the MD from scratch. Will reportback.
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 12, 2012, 05:02:22 pm
It might not be the image. It might just be the way the hardware reacts to the scripts. ACPI is one of those voodoo areas in Linux.
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 12, 2012, 09:54:35 pm
It might not be the image. It might just be the way the hardware reacts to the scripts. ACPI is one of those voodoo areas in Linux.
Even given the fact that when I boot the same hardware with a 10.04 live cd, the command shuts the machine down properly?
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 12, 2012, 10:09:19 pm
That depends on whether they really are the same. Meaning,... One of the shutdown command line switches is deprecated,... either -h or -P, I don't know which one,... but they're supposed to do the same thing now... but they don't (not always, anyway).
If you're shutting down your system with shutdown -h now, but LinuxMCE does it with shutdown -P now, they may yield different behavior. Unless you are specifically looking at the scripts, you might assume one is used, when it is really the other,... That's what I mean...
Title: Re: 10.04 media directors not shutting down
Post by: jamo on June 13, 2012, 06:45:17 am
That depends on whether they really are the same. Meaning,... One of the shutdown command line switches is deprecated,... either -h or -P, I don't know which one,... but they're supposed to do the same thing now... but they don't (not always, anyway).
If you're shutting down your system with shutdown -h now, but LinuxMCE does it with shutdown -P now, they may yield different behavior. Unless you are specifically looking at the scripts, you might assume one is used, when it is really the other,... That's what I mean...
I hear you, but if you look further back in the thread you will see I've tried every combination of command line switches in the known universe.... and I've done that on the direct binary executables (bypassing the commands that are just shellscripts) directly from command line as root. Now if I can't shut it down from there I presume LMCE can't, but I know that under standard (live) 10.04 I can...
also, there's been a lot of hacking going on on both these machines so I'll go for a clean build of the images to eliminate any issues there and then try again. Thanks for the pointers, though... will try all combinations again when I get the clean machines up.
Title: Re: 10.04 media directors not shutting down
Post by: l3mce on June 13, 2012, 07:16:40 am
That depends on whether they really are the same. Meaning,... One of the shutdown command line switches is deprecated,... either -h or -P, I don't know which one,... but they're supposed to do the same thing now... but they don't (not always, anyway).
If you're shutting down your system with shutdown -h now, but LinuxMCE does it with shutdown -P now, they may yield different behavior. Unless you are specifically looking at the scripts, you might assume one is used, when it is really the other,... That's what I mean...

I will give you a thousand dollars if you can tell me how MDs are shut down from the core.
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 13, 2012, 03:20:17 pm
Pretty darn well, from my experience...  ;D

Seriously, though, regardless of how it's done, the (internal) effect on the machine is similar, in terms of Posix standards. I'm guessing from your post that the DCE router is causing the the MD to catch a sigterm signal on all running processes, otherwise you wouldn't throw that "dare" out there like that... I'm guessing there's a script to kill off services cleanly, rather than leave the system in a messy state. So, I'm guessing that the system doesn't just throw a shutdown -h now at the MD.

If during what should be a normal power-off shutdown, the machine hangs or reboots, then the same or similar problem to what causes some systems to hang at a P versus an h shutdown is at play,... And that's usually something to do with ACPI. There's a known issue with this stuff in KDE based systems...

That's what's making me think this the problem he's encountering. One particular machine exhibiting odd behavior... Ocam's razor,... simplest solution is usually the correct one.
Title: Re: 10.04 media directors not shutting down
Post by: l3mce on June 13, 2012, 03:56:26 pm
If you have no idea how something works, applying Occam's razor, all things being equal, you should stop giving advice as you are as likely to do harm as good.

Developers, is for developers.
Installation issues, is for people with installation issues, or solutions for installation issues, which you do sometimes have... however if you have NO idea what you are talking about, we aren't interested in you talking to yourself about how you think things MIGHT work. Use that time figuring out how things DO work.

I offered you a thousand dollars dude.

Code: [Select]
svn co http://svn.linuxmce.org/svn/branches/LinuxMCE-1004/src/
grep -r 'shutdown' ./*
./BootScripts/HaltMDs.sh:       Msg="Not waiting for MDs to shutdown anymore. Continuing."
Code: [Select]
cat BootScripts/HaltMDs.shfor Host in $R; do
        ShutDownRemote "$Host" &
Code: [Select]
grep -r 'ShutDownRemote' ./*./BootScripts/pluto.func:ShutDownRemote() {
Code: [Select]
cat /BootScripts/pluto.funcShutDownRemote() {
  host=$1
  if ! [ $host ]; then
    return
  fi
  Logging $TYPE $SEVERITY_WARNING $module "Shutting down $host"
#  ssh $host "/sbin/init 0" &>/dev/null ||
  ssh $host "/sbin/poweroff" &>/dev/null ||
    Logging $TYPE $SEVERITY_WARNING $module "Couldn't shut down $host"
}

Code: [Select]
ls -l /sbin/po*lrwxrwxrwx 1 root root 6 Apr 26 11:27 /sbin/poweroff -> reboot

This
That depends on whether they really are the same. Meaning,... One of the shutdown command line switches is deprecated,... either -h or -P, I don't know which one,... but they're supposed to do the same thing now... but they don't (not always, anyway).
If you're shutting down your system with shutdown -h now, but LinuxMCE does it with shutdown -P now, they may yield different behavior. Unless you are specifically looking at the scripts, you might assume one is used, when it is really the other,... That's what I mean...

Is a waste of everyones time, time you could have spent actually figuring out how it works.

My goal is not continued harassment of you... it is to get you to look over the edge of the abyss, and see that it is just a really deep hole... and that you can climb down into it. You are a smart guy. Use it to learn rather than guess. You have almost half as many posts as I do, and I have been here for years. I have read every one of those posts. Those posts all take my and everyones time to read. Rather than burning our time, burn yours... pick up the light saber. Use the force.
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 13, 2012, 04:25:29 pm
Point taken, but in my defense,... My first inclination would have been to have a look in sbin. But I (mostly) post in between doing things at work,... Tough for me to look at how it works without the machine directly in front of me... Seems like jamo did have his right in front of him...

So back to the issue and me learning how this works (thanks for taking the time to post what is supposed to happen, by the way):
So, it's ultimately calling poweroff from sbin,... and poweroff is rebooting versus shutting down... Is that the expected behavior (auto-rebooting the MD), or is his system responding incorrectly to poweroff ?

If it is behaving badly to poweroff, one solution would be to rename poweroff to poweroff.old, and create an executable script in sbin with the correct shutdown command that's proven to work in that system. It's a hack,... but if poweroff is not working in a minority of machines, it's a good band-aid until someone can get around to deciding whether to change something.
Title: Re: 10.04 media directors not shutting down
Post by: l3mce on June 13, 2012, 04:31:59 pm
This is the same in kubuntu this poweroff symlinked to reboot... and it does shutdown, as opposed to reboot. I am not sure why this is setup this way... it is clearly very counterintuitive.

And you can download our source anywhere.

On my MDs it does shut them down. The idea behind your posts is very likely the issue... save the fact that a Kubuntu live CD execution of the same code does not produce the same result on the same hardware. I was just pointing out that at around post 4 he was already at square one, figuring out what the binaries do. More digging will have to be done as to WHY our implementation is behaving differently with regards to ACPI.
/me hands JaseP a shovel
Welcome to the dark side.
Title: Re: 10.04 media directors not shutting down
Post by: JaseP on June 13, 2012, 05:04:49 pm
ACPI is the dark side...

I long ago stopped asking why something behaved weird where ACPI is concerned. Many times it's quirky hardware. The answer could be PXE boot implementation on the machine, or it could be gremlins. He could have another identical machine with a different BIOS revision that behaves differently (I do,... not with this issue, but other things), or a similarly badged machine that has different internals (such as; newer version of a motherboard). OEMs do all kinds of crap where hardware is concerned (change chipsets without notice, make BIOS changes that break crap, change entire motherboards, etc.). You can look at two different versions of the same motherboard, and have one with components that the other doesn't have, like capacitors, jumpers, etc.

I had considered a side business of importing x86 tablets and installing Linux on them,... but I couldn't get any consistency from the Chinese on chipsets, pricing, or even the look of the machines... In the end, I just gave up, because after I nailed them down on chipsets that I knew worked, they charged more per unit than I could get a Dell Inspiron Duo for.
Title: Re: 10.04 media directors not shutting down [Solved]
Post by: jamo on June 16, 2012, 09:56:28 pm
At last.
Started with the globalupdate script which updated all my MDs nicely but didn't solve my shutdown problem.

So, I took out the bazooka-

Ran Diskless_CreateTBZ.sh to get the latest stuff for creating new MDs and deleted my existing MDs (the problematic ones) from webadmin and then recreated them- ie booted them up and let the scripts etc do their thang. And I have to say it all went *very* smoothly. My two old radeon cards that previously required many handsprings were now correctly identified and configured "out the box" and the MDs are running super smoothly. UI2 on one AND UI1 on the other, both running very smoothly and shutting down properly! Yay.

My conclusion is that somewhere in the messing about installing/re-installing/removing packages to try to get the video cards to work I must have messed something up in the base ubuntu packages which was causing the problem. It was impossible to shut them down properly from command line using any combination of /sbin/shutdown, /sbin/reboot or /sbin/poweroff commands and various parameters - they would reboot instead of shutting down and would do so immediately rather than going through a process....  however they could do it no problem when booted from a live 10.04 cd so I presumed it was something to do with the install/configuration. Anyway the clean install sorted them out.

In case someone hits a similar wall- take out the bazooka!