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.

2014/01/09

Creating Encrypted Directories With EncFS

> EncFS (Encrypted Filesystem) is a tool for encrypted filesystems in user space. It does not require any special permissions, since it uses FUSE.

Considering I will use encrypted folders mainly on things that need frequent backup, the advantages are:

  • per file encryption: will help on incremental backups;

  • encrypted folder can grow: a great advantage against a loopback filesystem (like TrueCrypt, where you need to allocate resources before using them;

  • do not need root permissions: on every host there is FUSE support, I can use EncFS and

  • the configuration is straightforward.

I have used eCryptfs before, but it does require configuring `fstab` or having root privileges for mounting the encrypted folders. The configuration is much more complicated.

Configuration

First of all, make sure you have FUSE and EncFS installed on your system.

You will need a directory for the encrypted data to be stored and another directory to mount the encrypted directory. For the example, let's call the directories `encrypted` and `decrypted`, respectively. Both on the home directory.

$ encfs ~/encrypted ~/decrypted

Notice that full paths are necessary. You will be prompted if you want the preconfigured options or to configure it yourself. I choose the defaults. At the end, you will be prompted for a password and confirmation.

To mount the encrypted folder again, the command is the same:

$ encfs /full/path/to/encrypted_folder /full/path/to/decrypted_folder

And to umount it:

$ fusermount -u /full/path/to/decrypted_folder

External Links

Revision History

Post built on: 2014-01-16 01:06:27
Last modified on: 2014-01-16 01:05:58
First published on: 2014-01-09

Revision Date Description
0.01 2014-01-09 Initial revision. Not verified.
1.00 2014-01-09 Minor modifications and corrections. Published.
1.01 2014-01-15 Adding new "syntax" for code examples.
1.02 2014-01-15 A link was not set to external.

Introduction

I'm Jean Waghetti and this is my personal blog. It will contain information of any kind related to things I do, from computer systems configuration to bicycle maintenance.

This is a way of sharing knowledge in a convenient way: I have information I may need in future concentrated here.

Enjoy!

Revision History

Post built on: 2014-01-09 23:38:41
Last modified on: 2014-01-09 23:38:37
First published on: 2014-01-09

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