Pages

Showing posts with label fedora. Show all posts
Showing posts with label fedora. Show all posts

Monday, October 27, 2025

Enable Hibernation in Fedora 42 (With Power Menu Integration)

Fedora 42 is a leading-edge Linux distribution, but hibernation isn’t enabled out of the box. Here’s a step-by-step guide to enable hibernation, resolve common SELinux issues, and add a Hibernate button to the GNOME power menu.

Why Hibernation?

Hibernation saves your entire session by writing RAM to disk and powering off. Next time you boot, everything resumes exactly where you left off—perfect for laptops and desktop users who want to save battery or avoid losing work during shutdowns.​

Prerequisites

  1. UEFI System: Hibernation setup is simpler on UEFI. Run bootctl to confirm; if you see “Not booted with EFI,” a more manual approach is needed.​
  2. Adequate Disk Space: You’ll need a swap file at least as large as your RAM.
  3. SELinux Consideration: SELinux can block hibernation; check the troubleshooting below.

Step 1: Create and Enable Swap

Open your terminal and enter:

SWAPSIZE=$(free | awk '/Mem/ {x=$2/1024/1024; printf "%.0fG", (x<2 ? 2*x : x<8 ? 1.5*x : x) }')
sudo btrfs subvolume create /var/swap
sudo chattr +C /var/swap
sudo restorecon /var/swap
sudo mkswap --file -L SWAPFILE --size $SWAPSIZE /var/swap/swapfile
sudo bash -c 'echo /var/swap/swapfile none swap defaults 0 0 >>/etc/fstab'
sudo swapon -av

This ensures a reliable swap setup compatible with Btrfs and systemd.​

Step 2: Configure Dracut for Hibernation

To make systemd aware of your new swap location:

echo 'add_dracutmodules+=" resume "' | sudo tee /etc/dracut.conf.d/resume.conf
sudo dracut -f

Test it with:

systemctl hibernate

After reboot, your session should restore automatically.​

Step 3: Fix “Access Denied” (SELinux)

If you get Call to Hibernate failed: Access denied, fix permissions:

sudo semanage fcontext -a -t swapfile_t '/var/swap(/.*)?'
sudo restorecon -RF /var/swap

If issues persist, generate and install a SELinux policy:

sudo setenforce 0      # Temporarily disable enforcement for testing
sudo systemctl hibernate
sudo setenforce 1      # Return to enforcing mode


# If hibernate works, make it permanent

sudo audit2allow -b -M systemd_hibernate
sudo semodule -i systemd_hibernate.pp

This sets the required access permissions for hibernation and keeps SELinux enabled for security.​

Step 4: Add Hibernate Button to Power Menu (GNOME)

Fedora’s GNOME desktop doesn’t show Hibernate by default. Here’s how to add it:

Install the GNOME browser connector:

sudo dnf install gnome-browser-connector

Visit Hibernate Status Button Extension in your browser and toggle ON.


Enable the extension in the Extensions app, or via CLI:

gnome-extensions enable hibernate-status@dromi

Restart GNOME Shell (Alt+F2, type r, press Enter).

You’ll now see Hibernate in the top-right Power menu, making it easy to hibernate from the GUI.​

Step 5: Configure Power Button for Hibernate

Want the physical power button to hibernate? Edit /etc/systemd/logind.conf:

HandlePowerKey=hibernate

Restart logind to apply:

sudo systemctl restart systemd-logind

Troubleshooting

Swap too small? Use at least as much as your RAM, possibly up to 1.5x for systems under 8 GB.
Button won’t appear? Ensure systemctl hibernate works, and GNOME Shell extension is compatible.
SSD concerns: Hibernation writes the entire RAM to disk—great for convenience, but means more SSD writes over time. If worried, use suspend instead.​


Thursday, August 28, 2014

Windows 8 and fedora 20 Dual boot in HP

Recently I have moved to fedora 20 and window 8 which showed that HP laptops have a special bios which only allows windows EFI to be loaded as default so even after installing both the OS and making the EFI partition of fedora default the system boots from Windows EFI directory. To get the grub to boot first I did the following steps.

My disk partition are as below. Device           Start          End   Size Type
/dev/sda1         2048       616447   300M Windows recovery environment
/dev/sda2       616448       821247   100M EFI System
/dev/sda3       821248      1083391   128M Microsoft reserved
/dev/sda4      1083392    122882047  58.1G Microsoft basic data
/dev/sda5    122882048    123291647   200M EFI System
/dev/sda6    123291648    124315647   500M Microsoft basic data
/dev/sda7    124315648    548470783 202.3G Linux LVM
/dev/sda8    548470784    976771071 204.2G Microsoft basic data

Here I have two EFI partition /dev/sda2 (Windows) and /dev/sda5 (Fedora). As the setting is embedded in HP bios we needed a work around.

So I mounted the partititons first .

mount /dev/sda5 fedora/
mount /dev/sda2 win/

Now we copy the Fedora EFI content to Windows partions as follows

cp -rp fedora/EFI/fedora win/EFI/

In the windows partion you can find a default HP EFI content . Just rename it to some thing else.

Now rename the windows boot loader

mv win/EFI/Microsoft/Boot/bootmgfw.efi  win/EFI/Microsoft/Boot/bootmgfwB.efi

Now copy the grubloader into the place of windows bootloader

cp win/EFI/fedora/grubx64.efi win/EFI/Microsoft/Boot/bootmgfw.efi

Now recreate the grub.cfg and place it in win/EFI/fedora

grub2-mkconfig -o win/EFI/fedora/grub.cfg

It should be done by now reboot the machine and check it .

 

 

Monday, February 13, 2012

BYPASS FEDORA PASSWORD

1. Reboot the system
2. When you see the Grub menu, highlight your Fedora installation with the arrow keys and press ‘e’ to edit.
3. Again use the arrow keys to highlight the line saying ‘kernel’ at the beginning and press ‘e’ again, which will let you edit that line.
4. Append a space at the end of the line and type ’single’ without the quotes there. Press the Enter key.
5. Now press ‘b’ which will take you to the Linux single user mode where you’ll have privileged access without typing a password.
6. Now you do a passwd, and change your root password. Then reboot. You are done.

Now enter into TTY mode and login as root and use passwd "username" to change the password of needed password

enjoyyyyyyyy............

Friday, December 2, 2011

Enable Install Software Package from Fedora DVD/CD

List the file inside yum repo configuration directory... you can use the ll command as show on example below or replace the ll command with ls -l command.if needed first try "yum install repo"
 1.>>>>>>>>>ll /etc/yum.repos.d/

To make Fedora DVD as installation source... we need to create DVD repo file and edit this file to make the Fedora DVD as the installation source.  To make life little bit easier,  just copy the existing yum configuration file fedora.repo and name the copied file as fedora-dvd.repo
2.>>>>>>>>>cp -pr /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-dvd.repo

3.>>>>>>>>>ll /etc/yum.repos.d/

Execute command below to open and edit the fedora-dvd.repo configuration file using gedit editor... edit the configuration file.. rename the repo as "[fedora-dvd]", and "name=Fedora-dvd" add PATH to the Fedora 11 DVD "baseurl=file:///media/Fedora%2011%20i386%20DVD/" and enable the Fedora DVD repo file "enabled=1 "see... working example below... and then remove unwanted line from the fedora-dvd.repo configuration file.
4.>>>>>>>>>gedit /etc/yum.repos.d/fedora-dvd.repo &

[fedora-dvd]

name=Fedora-dvd $releasever - $basearch

failovermethod=priority

baseurl=file:///media/Fedora%2011%20i386%20DVD/

enabled=1

metadata_expire=7d

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

....Save and exit the editor

**change the baseurl as per the dvd version u use**
5.>>>>>>>>>yum clean all

To start to use Fedora installation DVD as installation source, execute yum command and temporary disable all other repo except Fedora DVD repo using the command that show on example below.  Change the gcc part to the software that you want to install in your box
 6.>>>>>>>>yum --disablerepo=\* --enablerepo=fedora-dvd install gcc*

 

 

CREATE LOCAL YUM REPOSITORY

1) Copy all the RPMS from the DVD to a particular folder lets say /root/os/RPMS

2) Install createrepo RPM from /root/os/RPMS directory using rpm command

3) Now, we will have to create repo of the directory in which we have coied the RPMS. Following is the command to create the repo
.........>createrepo /root/os/RPMS

Once the above command gets completed you will find repodata directory in /root/os/RPMS folder

4) configuing YUM to work with local repository. Create a new file in /etc/yum.repo.d/ or open /etc/yum.conf and paste following
[local repo]
 name = OS $release - MyLocalRepo
baseurl = file:///root/os/RPMS/
enabled=1
gpgcheck=0

Now Try to install any package using YU


Fedora 15 Broadcom 4313 wireless

There is a problem exiting that the Fedora 15 Broadcom 4313 wireless is not working when getting to network manager and selecting the wireless.

Below r the steps given for solving the problem...

1.>>>>>>>>>>>>Yum install kernel-devel

Remove any broadcom/wlan drivers in use

2.>>>>>>>>>>>>rmmod b43/ssb/wl

Blacklist the following drivers

3.>>>>>>>>>>>>echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf

4.>>>>>>>>>>>>echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf

Download the Broadcom Drivers from here
http://dl.dropbox.com/u/30579529/Fedora%2015%20bcm4313/hybrid-portsrc_x86_64-v5_100_82_38.tar.gz

If your kernel version is > 2.6.37, you should download the following  patch for compilation problem

http://dl.dropbox.com/u/30579529/Fedora%2015%20bcm4313/5_100_82_38.patch
If ur Kernel version is> 2.6.37 .Extract the Driver into a folder along with the patch and follow the steps from 5 below .else just make the driver and install the driver .follow the steps from no 6

5.>>>>>>>>>>>>>patch -p0 < 5_100_82_38.patch

6.>>>>>>>>>>>>>make

Load the driver with the followings

7.>>>>>>>>>>>>>modprobe lib80211 or ieee80211_crypt_tkip

8.>>>>>>>>>>>>>insmod wl_ko

Run the driver after boot process:load the driver

9.>>>>>>>>>>>>>cp wl.ko /lib/modules/'uname -r'/kernel/drivers/net/wireless

10.>>>>>>>>>>>>depmod -a

Reboot and enjoy wifi........