Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Fast boot with swsusp and splash screen
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 24 Jul 2014
Posts: 70

PostPosted: Mon Dec 08, 2014 1:25 am    Post subject: HOWTO: Fast boot with swsusp and splash screen Reply with quote

One nice feature of Windows 8 is it's fast boot. It actually hibernates the system instead of cold booting everytime. This is how I implemented this feature on my Gentoo laptop using OpenRC with cgroup support to keep track of user processes and KDM with pm-utils. When you shutdown from your desktop it will kill all processes that users have started and their children, reset all services to their default runlevel state, restart KDM and hibernate.

It also uses plymouth to show a nice splash screen (with progress messages when possible) during hibernate, thaw, suspend, boot, and shutdown.

1. Enable cgroups on openrc. See

2. Enable cgroups and swsusp support on the kernel. Make sure that the resume partition is not hardcoded on the kernel.

3. Install required packages:

sys-boot/plymouth (make sure to enable the pango use flag)

4. Create a file /etc/pm/config.d/module:



5. Download required files:

- mkinitramfs (copy anywhere)
- (copy to /etc and make executable by root only)
- hiberdown.conf (copy to /etc)
- tux plymouth theme (copy contents of directory to /usr/share/plymouth/themes/tux)

6. Set plymouth default theme to tux


$ plymouth-set-default-theme tux

7. Build initramfs by executing mkinitramfs as root. It will generate an initramfs.img file in your current directory. Copy it to /boot (or to ESP partition if using EFI).

NOTE: This script create a simple initrd image with support for plymouth and swsusp. If your need other stuff on your initramfs then you need to either add what you need to this script or find a way to add the features on this script to your current initramfs.


$ mkinitramfs --disable-uswsusp

8. Add swsusp_resume=<swap partition> to your kernel command line on your bootloader configuration and make sure there's no resume= parameter. Also add initrd=/boot/initramfs.img and make sure to load the initramfs.img file on your bootloader config.

9. Modify /etc/inittab as follows:

- Call /etc/ instead of openrc for runlevels 0 and 6
- Use /usr/bin/cgexec -g "name=openrc":/ttys /sbin/agetty instead of /sbin/agetty.
- Do not launch a tty login on tty1 except for single user mode. This is optional and it's just so we don't get a flicker of the text in tty1 when switching to splash screen.

Here's mine:

# Default runlevel.

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit

# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/rc boot

l0:0:wait:/etc/ shutdown /sbin/rc shutdown
l0s:0:wait:/sbin/halt -dhp
l1:1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/etc/ shutdown /sbin/rc reboot
l6r:6:wait:/sbin/reboot -dk

# new-style single-user
su0:S:wait:/sbin/rc single

cs:1:respawn:/sbin/agetty 38400 tty1 linux
c1:2345:once:/bin/echo -e '\033[?17;0;0c' > /dev/tty1
c2:2345:respawn:/usr/bin/cgexec -g "name=openrc":/ttys /sbin/agetty 38400 tty2 linux
c3:2345:respawn:/usr/bin/cgexec -g "name=openrc":/ttys /sbin/agetty 38400 tty3 linux
c4:2345:respawn:/usr/bin/cgexec -g "name=openrc":/ttys /sbin/agetty 38400 tty4 linux

#c1:12345:respawn:/sbin/agetty 38400 tty1 linux
#c2:2345:respawn:/sbin/agetty 38400 tty2 linux
#c3:2345:respawn:/sbin/agetty 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux
#c7:2345:respawn:/sbin/agetty 38400 tty7 linux
#c8:2345:respawn:/sbin/agetty 38400 tty8 linux

#s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100

# What to do at the "Three Finger Salute".
#ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.

10. Create /etc/pm/sleep.d/01_hiberdown and make executable.



case $1 in
  suspend)   /etc/ suspend-hook ;;
  hibernate) /etc/ hibernate-hook ;;
  resume)    plymouth --quit ;;
  thaw)      plymouth --quit ;;

11. Create /etc/local.d/01_hiberdown.start and make executable. Also make sure that the local service is on your default runlevel.


exec /etc/ init

12. Open /usr/share/config/kdm/kdmrc, locate the HaltCmd= line on the Shutdown section and change it as follows:


HaltCmd=/etc/ poweroff

13. Optional. Patch sysvinit so that it doesn't output anything to console.


$ emerge --fetch-only sysvinit
$ tar -xf /etc/portage/distfiles/sysvinit-XXXXXXX.tar.gz
$ cd sysvinit-XXXXXXX/src

Now open init.h and change: #define L_CO 1 to #define L_CO 0. Then:


$ cd ..
$ make
$ mv /sbin/init /sbin/init.old
$ cp src/init /sbin/init

14. Reboot the system.


$ shutdown -r now

15. Login to your desktop and perform a shutdown. Power on your laptop and see how much faster it boots. On my slow netbook the time from power on to KDM screen was cut by about half and the time it takes to login to KDE by more than that.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum