Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] hibernate... /bin/echo: write error: No such device
Date: Wed, 03 Aug 2022 23:17:18
Message-Id: 20220804001703.5f5581e8@digimed.co.uk
In Reply to: Re: [gentoo-user] hibernate... /bin/echo: write error: No such device by Walter Dnes
1 On Wed, 3 Aug 2022 17:30:54 -0400, Walter Dnes wrote:
2
3 > Next we look at file
4 > /usr/share/hibernate/scriptlets.d/sysfs_power_state which has a short
5 > function DoSysfsPowerStateSuspend(). Anyone remember ye old dayes of
6 > FORTRAN, where you'd throw in print statements to debug errors? I've
7 > added a few debug statements, like so...
8 >
9 > DoSysfsPowerStateSuspend() {
10 > if [ -z "$SYSFS_POWER_STATE_NO_SUSPEND" ] ; then
11 > vecho 1 "$EXE: Activating sysfs power state
12 > $USING_SYSFS_POWER_STATE ..." echo "1 ==> $USING_SYSFS_POWER_STATE"
13 > echo "2 ==> $SYSFS_POWER_STATE_POWERDOWN_METHOD"
14 > echo "3 ==> $SYSFS_POWERDOWN_METHOD_FILE"
15 > echo "4 ==> $SYSFS_POWER_STATE_FILE"
16 > [ -n "$SYSFS_POWER_STATE_POWERDOWN_METHOD" ] && \
17 > [ -f "$SYSFS_POWERDOWN_METHOD_FILE" ] && \
18 > /bin/echo $SYSFS_POWER_STATE_POWERDOWN_METHOD >
19 > $SYSFS_POWERDOWN_METHOD_FILE /bin/echo -n $USING_SYSFS_POWER_STATE >
20 > $SYSFS_POWER_STATE_FILE else
21 > vecho 1 "$EXE: Not actually suspending (--no-suspend given)"
22 > fi
23 > return 0
24 > }
25 >
26 > The output from hibernate is...
27 >
28 > 1 ==> disk
29 > 2 ==>
30 > 3 ==> /sys/power/disk
31 > 4 ==> /sys/power/state
32 > /bin/echo: write error: No such device
33
34 Which call to /bin/echo is failing? Instead of filling the script with
35 echo statements, add "set -x" near the top, then it will output each line
36 before executing it. That way you will not only see which echo call has
37 failed, but you will also see the values of the environments variables in
38 the call.
39
40
41 --
42 Neil Bothwick
43
44 Nothing is foolproof to a sufficiently talented fool.