Showing posts with label slackware. Show all posts
Showing posts with label slackware. Show all posts

2014/01/21

Suspending and Hibernating on Slackware:

It is very straightforward to make Slackware suspend to RAM or hibernate to disk using D-Bus. D-Bus is a message bus system, that allows applications communicate.

On Slackware, make sure your user is on power group. Check with:

$ groups your_user

Change your_user to your user name. If it is not in power group, add with

# usermod -aG power your_user

Suspending

In order to suspend to RAM, just run the following command from a user on power group:

$ dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Hibernating

CAUTION: this method does not work if you use [LVM extlink en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)]. If you do, take a look at external links at the end of the post.

The command to hibernate to hard disk is similar to the hibernating command:

$ dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

But, for the bootloader to know where to find the state saved on disk during hibernation, you'll need to tell it. On /etc/lilo.conf, append the line append="resume=/dev/sdX":

image = /boot/vmlinuz
 root = /dev/sdaY
 initrd = /boot/initrd.gz
 label = Slackware
 read-only
 append = "resume=/dev/sdaX

where /dev/sdaX is the swap partition.

Run

# lilo

to apply changes.

Just a Lil' Problem

When you suspend or hibernate only with those commands, when the computer restarts, your session will be unlocked.

To avoid it, call a lock or screensaver before taking those actions. I use xscreensaver and have the scripts dbus-suspend dbus-hibernate to lock computer:

xscreensaver-command -lock
sleep 7
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

Rebooting and Halting

With D-Bus, if you are in power group, you can reboot or halt your system too:

To reboot your system:

$ dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

And to halt:

$ dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

Revision History

Post built on: 2014-01-21 00:28:26
Last modified on: 2014-01-21 00:28:22
First published on: 2014-01-21

Revision Date Description
1.00 2014-01-09 Initial Version. Published.

2014/01/16

Starting Display Manager On Slackware Startup

The default runlevel for Slackware is 3: that means it will run with multiuser mode, on a standard text-based login.

But what is a runlevel? It defines the state of the machine after the boot. And, usually, for operating systems that implement System V initialization, runlevels are:

  • single user mode;
  • multiuser mode without network services started;
  • multiuser mode with network services started;
  • system shutdown and
  • system reboot.

    On Slackware, there are 7 runlevels:

runlevel Description
0 Halt.
1 Single user mode.
2 Unused (same as runlevel 3)
3 Multiuser mode without display manager (DEFAULT).
4 Multiuser mode with display manager.
5 Unused (same as runlevel 3).
6 Reboot.

To modify the default runlevel of Slackware, in the file /etc/inittab, look for a line like this:

# Default runlevel. (Do not set to 0 or 6)
id:3:initdefault:

As it was expected (on Slackware), the default runlevel is 3 (multiuser mode). Change it to runlevel 4 for GUI login when the system is started:

# Default runlevel. (Do not set to 0 or 6)
id:4:initdefault:

Save the file and that is it. Reboot your system and a graphical login prompt will be there (if you installed the packages for one, of course).

External Links

Revision History

Post built on: 2014-01-16 01:04:18
Last modified on: 2014-01-16 01:03:22
First published on: 2014-01-09

Revision Date Description
1.00 2014-01-16 Initial Revision. Published.

2014/01/14

Improving Slackware Boot Time

Booting Slackware may be slow compared to another operating systems. This tutorial is based on Slackware 14.1.

DHCP

Slackware waits for a DHCP response on boot. Look for the following lines

echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}" | $LOGGER
/sbin/dhcpcd -t {$DHCP_TIMEOUT[$i]: -10 ${DHCP_OPTIONS} ${1}

and just add a & on the end of the last line:

echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}" | $LOGGER
/sbin/dhcpcd -t {$DHCP_TIMEOUT[$i]: -10 ${DHCP_OPTIONS} ${1} &

bzImage Loading

If the message:

Loading Linux ..........

takes too long, the solution can be adding the compact parameter on /etc/lilo.conf:

# Start LILO global section
# Append any additional kernel parameters:
append="vt.default_utf8=1 resume=/dev/sda7
boot = /dev/sda
compact

Maybe there's already this parameter commented out, with another comment saying it will be faster, but won't work on all systems.

Don't forget to run the lilo command to modifications take place:

# lilo

External Links

Revision History

Post built on: 2014-01-15 21:32:28
Last modified on: 2014-01-15 21:30:24
First published on: 2014-01-14

Revision Date Description
1.00 2014-01-14 Initial revision. Published.
1.01 2014-01-15 Adding new "syntax" for code examples.