Skip to contentSkip to conversation

Linux should better cope with power failure

DISCUSSION David Balazic 4 participants 10 messages Mar 23, 2001 – Mar 26, 2001

lore
Share & tools
lore
#0 lore raw

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Here I must note that the response you got on linux-kernel is shameful.

What I did was to write a kernel/apmd patch , that performed a proper shutdown when I press the power button ( which luckily works as long as the kernel works ).

Ask me for details, if interested.
The patch was for 2.2.x IIRC, so I would have to rewrite it almost from scratch.

Quoted 32 lines · Otto Wyss

Lately I had an USB failure, leaving me without any access to my system since I only use an USB-keyboard/-mouse. All I could do in that situation was switching power off and on after a few minutes of inactivity. From the impression I got during the following startup, I assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power failiure or manually switching it off. Not even if there wasn't any activity going on.

Shouldn't a good system allways try to be on the save side? Shouldn't Linux try to be more fail save? There is currently much work done in getting high performance during high activity but it seems there is no work done at all in getting a save system during low/no activity. I think this is a major drawback and should be addressed as fast as possible. Bringing a system to save state should allway have a high priority.

How could this be accomplished:
1. Flush any dirty cache pages as soon as possible. There may not be any dirty cache after a certain amount of idle time.
2. Keep open files in a state where it doesn't matter if they where improperly closed (if possible).
3. Swap may not contain anything which can't be discarded. Otherwise swap has to be treated as ordinary disk space.

These actions are not filesystem dependant. It might be that certain filesystem cope better with power failiure than others but still it's much better not to have errors instead to fix them.

Don't we tell children never go close to any abyss or doesn't have alpinist a saying "never go to the limits"? So why is this simple rule always broken with computers?

O. Wyss

Signature · 4 lines
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
#1 lore raw

This sounds very nice.. can such a thing be done with the reset switch as well?

Gerhard

Quoted 45 lines · David Balazic

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Here I must note that the response you got on linux-kernel is shameful.

What I did was to write a kernel/apmd patch , that performed a proper shutdown when I press the power button ( which luckily works as long as the kernel works ).

Ask me for details, if interested.
The patch was for 2.2.x IIRC, so I would have to rewrite it almost from scratch.

Quoted 27 lines · Otto Wyss

Lately I had an USB failure, leaving me without any access to my system since I only use an USB-keyboard/-mouse. All I could do in that situation was switching power off and on after a few minutes of inactivity. From the impression I got during the following startup, I assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power failiure or manually switching it off. Not even if there wasn't any activity going on.

Shouldn't a good system allways try to be on the save side? Shouldn't Linux try to be more fail save? There is currently much work done in getting high performance during high activity but it seems there is no work done at all in getting a save system during low/no activity. I think this is a major drawback and should be addressed as fast as possible. Bringing a system to save state should allway have a high priority.

How could this be accomplished:
1. Flush any dirty cache pages as soon as possible. There may not be any dirty cache after a certain amount of idle time.
2. Keep open files in a state where it doesn't matter if they where improperly closed (if possible).
3. Swap may not contain anything which can't be discarded. Otherwise swap has to be treated as ordinary disk space.

These actions are not filesystem dependant. It might be that certain filesystem cope better with power failiure than others but still it's much better not to have errors instead to fix them.

Quoted 17 lines
Quoted 5 lines

Don't we tell children never go close to any abyss or doesn't have alpinist a saying "never go to the limits"? So why is this simple rule always broken with computers?

O. Wyss

Signature · 9 lines
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

--
Gerhard Mack

[email protected]

<>< As a computer I find your faith in technology amusing.

#2 lore raw
Quoted 3 lines · Gerhard Mack

This sounds very nice.. can such a thing be done with the reset switch as well?

Don't think so.
I'm not sure , but I think that the reset button is directly connected to the reset pin of most chips and can not be overrided. Off course this is the first candidate for a "reboot properly" button, but there is no hardware support. That is why I used the power button, which is ( more or less ) under software control.

Quoted 73 lines

Gerhard

Quoted 51 lines · David Balazic

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Here I must note that the response you got on linux-kernel is shameful.

What I did was to write a kernel/apmd patch , that performed a proper shutdown when I press the power button ( which luckily works as long as the kernel works ).

Ask me for details, if interested.
The patch was for 2.2.x IIRC, so I would have to rewrite it almost from scratch.

Quoted 27 lines · Otto Wyss

Lately I had an USB failure, leaving me without any access to my system since I only use an USB-keyboard/-mouse. All I could do in that situation was switching power off and on after a few minutes of inactivity. From the impression I got during the following startup, I assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power failiure or manually switching it off. Not even if there wasn't any activity going on.

Shouldn't a good system allways try to be on the save side? Shouldn't Linux try to be more fail save? There is currently much work done in getting high performance during high activity but it seems there is no work done at all in getting a save system during low/no activity. I think this is a major drawback and should be addressed as fast as possible. Bringing a system to save state should allway have a high priority.

How could this be accomplished:
1. Flush any dirty cache pages as soon as possible. There may not be any dirty cache after a certain amount of idle time.
2. Keep open files in a state where it doesn't matter if they where improperly closed (if possible).
3. Swap may not contain anything which can't be discarded. Otherwise swap has to be treated as ordinary disk space.

These actions are not filesystem dependant. It might be that certain filesystem cope better with power failiure than others but still it's much better not to have errors instead to fix them.

Quoted 5 lines

Don't we tell children never go close to any abyss or doesn't have alpinist a saying "never go to the limits"? So why is this simple rule always broken with computers?

O. Wyss

Quoted 11 lines

--
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
Gerhard Mack

[email protected]

<>< As a computer I find your faith in technology amusing.

Signature · 4 lines
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
#3 lore raw
In reply to David Balazic
Quoted 7 lines

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Here I must note that the response you got on linux-kernel is shameful.

Thanks, but I expected it a little bit. All around Linux is centered around getting the highest performance out of it and very low (to low IMHO) is done to have a save system. The attitude "It doesn't matter making mistakes, they get fix anyhow" annoys me most, especially if it were easy to prevent them.

Quoted 4 lines

What I did was to write a kernel/apmd patch , that performed a proper shutdown when I press the power button ( which luckily works as long as the kernel works ).

Not with a AT power supply but certainly nice to have. See that it gets included into the kernel. I didn't lost anything important since it was just a testing machine. I was just shocked what fsck complained on a machine which hadn't done almost anything at all. If I'd run into this on a productive system I'd get immediately a serial keyboard or have at least a usable network connection. Besides USB-only is not ready yet.

Quoted 4 lines
Quoted 4 lines

Don't we tell children never go close to any abyss or doesn't have alpinist a saying "never go to the limits"? So why is this simple rule always broken with computers?

Is there a similar expression which could be hammered into any developers mind, i.e. "Don't make errors, others already do them for you".

O. Wyss

#4 lore raw
In reply to David Balazic
Quoted 4 lines · Otto Wyss
Quoted 4 lines

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Quoted 8 lines
Quoted 3 lines

Here I must note that the response you got on linux-kernel is shameful.

Thanks, but I expected it a little bit. All around Linux is centered around getting the highest performance out of it and very low (to low IMHO) is done to have a save system. The attitude "It doesn't matter making mistakes, they get fix anyhow" annoys me most, especially if it were easy to prevent them.

No, the correct answer is if you want a reliable recovery then run your disks in non write buffered mode. I.e. turn on sync in fstab.

It's all about RTFM and knowing the difference between buffered actions and nonbuffered.

Everything you need to have a safely clean and proper crash recovery system already is within your power, you just need to read the man pages and fix your fstab instead of blaming linux-kernel for bad attitudes.

Yes, it's very easy to prevent e2fsck runs. Run synchronous or journaled file systems.

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

Don't we tell children never go close to any abyss or doesn't have alpinist a saying "never go to the limits"? So why is this simple rule always broken with computers?

Is there a similar expression which could be hammered into any developers mind, i.e. "Don't make errors, others already do them for you".

There is also a very common expression...RTFM.

Please understand what you are doing before you do it, particularly before you bad mouth others for having a bad attitude. Don't blame race car makers for destructive engine failure when you expect it to act like a family car.

-d

--
There is a natural aristocracy among men. The grounds of this are virtue and talents. Thomas Jefferson The good thing about standards is that there are so many to choose from. Andrew S. Tanenbaum

#5 lore raw
In reply to David Balazic
Quoted 3 lines

No, the correct answer is if you want a reliable recovery then run your disks in non write buffered mode. I.e. turn on sync in fstab.

You probably haven't tried to use sync or you would have noticed the performace penalty. I think nobody really considers sync an alternative.

O. Wyss

#6 lore raw
In reply to David Balazic
Quoted 7 lines · Otto Wyss
Quoted 3 lines

No, the correct answer is if you want a reliable recovery then run your disks in non write buffered mode. I.e. turn on sync in fstab.

You probably haven't tried to use sync or you would have noticed the performace penalty. I think nobody really considers sync an alternative.

O. Wyss

You can't have the best of everything. There are tradeoffs. A viable option is a journaled filesystem. Linux boasts a few, two of which are at your fingertips by way of config options. Read up on JFS or ReiserFS.

-d

--
There is a natural aristocracy among men. The grounds of this are virtue and talents. Thomas Jefferson The good thing about standards is that there are so many to choose from. Andrew S. Tanenbaum

#7 lore raw
In reply to David Balazic
Quoted 7 lines
Quoted 4 lines

You probably haven't tried to use sync or you would have noticed the performace penalty. I think nobody really considers sync an alternative.

O. Wyss

You can't have the best of everything. There are tradeoffs. A viable option is > a journaled filesystem. Linux boasts a few, two of which are at your fingertips > by way of config options. Read up on JFS or ReiserFS.

How about the following solution: During high activity _any_ FS is treated as if it were mounted asynch, during low/no activity it's treaded as synch. This simple solution certainly will be acceptable for anyone.

O. Wyss

#8 lore raw
In reply to David Balazic
Quoted 14 lines · Otto Wyss
Quoted 8 lines

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Here I must note that the response you got on linux-kernel is shameful.

Thanks, but I expected it a little bit. All around Linux is centered around getting the highest performance out of it and very low (to low IMHO) is done to have a save system. The attitude "It doesn't matter making mistakes, they get fix anyhow" annoys me most, especially if it were easy to prevent them.

Quoted 6 lines
Quoted 4 lines

What I did was to write a kernel/apmd patch , that performed a proper shutdown when I press the power button ( which luckily works as long as the kernel works ).

Not with a AT power supply but certainly nice to have. See that it gets included into the kernel.

It was just a line or two bugfix, not a real patch. I will dig it up and send a patch for 2.4
When I have the time :-)

Signature · 4 lines
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
#9 lore raw
In reply to David Balazic

David ( Ford ) , I think you are misunderstanding a bit here.
The problem here is not that a fsck is needed after an unclean umount, but that users are forced to corrupt ( by unclean umount due to reset or poweroff ) their perfectly good file system on a "perfectly" working system, when their keyboard goes wacko ( happens more often than you might think, just remember those "log in over net and run 'shutdown -r'" advice's )

Quoted 47 lines · David Ford
Quoted 4 lines · Otto Wyss
Quoted 4 lines

I had a similar experience:
X crashed , hosing the console , so I could not initiate a proper shutdown.

Quoted 8 lines
Quoted 3 lines

Here I must note that the response you got on linux-kernel is shameful.

Thanks, but I expected it a little bit. All around Linux is centered around getting the highest performance out of it and very low (to low IMHO) is done to have a save system. The attitude "It doesn't matter making mistakes, they get fix anyhow" annoys me most, especially if it were easy to prevent them.

No, the correct answer is if you want a reliable recovery then run your disks in non write buffered mode. I.e. turn on sync in fstab.

It's all about RTFM and knowing the difference between buffered actions and nonbuffered.

Everything you need to have a safely clean and proper crash recovery system already is within your power, you just need to read the man pages and fix your fstab instead of blaming linux-kernel for bad attitudes.

Yes, it's very easy to prevent e2fsck runs. Run synchronous or journaled file systems.

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

Don't we tell children never go close to any abyss or doesn't have alpinist a saying "never go to the limits"? So why is this simple rule always broken with computers?

Is there a similar expression which could be hammered into any developers mind, i.e. "Don't make errors, others already do them for you".

There is also a very common expression...RTFM.

Please understand what you are doing before you do it, particularly before you bad mouth others for having a bad attitude. Don't blame race car makers for destructive engine failure when you expect it to act like a family car.

-d

--
There is a natural aristocracy among men. The grounds of this are virtue and talents. Thomas Jefferson The good thing about standards is that there are so many to choose from. Andrew S. Tanenbaum

Signature · 4 lines
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -