Linux - Reddit – Telegram
Linux - Reddit
770 subscribers
4.19K photos
207 videos
39.9K links
Stay up-to-date with everything Linux!
Content directly fetched from the subreddit just for you.

Powered by : @r_channels
Download Telegram
Straightforward tutorial on how to set up hibernation without a swap partition (swapfile)

I had to consult multiple sources on how to do this so I thought it would be good to compile it all into one post. I don't have any blog site so I thought Reddit might be a good place to post this. It doesn't require update-initram2fs nor uswsusp (I accidentally overwrote my boot sector using these tools and plus they seem like magic, versus this method which seems more clear and obvious). It also does not require any other external tools other than the ones that come with Linux.

**Guide**

1. Create a swapfile. A good size would be more than your total RAM
1. `sudo fallocate -l 8G /swapfile`
2. `sudo mkswap /swapfile`
2. Set the permissions for the swapfile (only readable and writable by root)
1. `sudo chmod u=rw,go= /swapfile`
3. Enable the swapfile
1. `sudo swapon /swapfile`
4. Add an entry to /etc/fstab to enable swap at boot
1. `sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"`
5. Find out which drive your system boots from
1. `lsblk`
2. See Figure 1 below for output example
6. Find out the offset in bytes of the swapfile is located on your disk
1. Run `sudo filefrag -v /swapfile`
2. You should get some output like the below Figure 2. Note the number circled in red because that is the swapfile offset.
7. Tell GRUB where to resume the session from on boot
1. Open /etc/default/grub in your favorite editor (as sudo of course) and find the line "GRUB\_CMDLINE\_LINUX\_DEFAULT"
2. Add `resume=<your boot drive here>` and `resume_offset=<your swapfile offset>` to the things in that list and then save the file
1. See Figure 3 below for my example
8. Apply the GRUB changes
1. `sudo grub-mkconfig -o /boot/grub/grub.cfg`
9. Now hibernate should work. Test with either `sudo systemctl hibernate` or `pm-hibernate` if you have pm-utils
10. You can set up your machine to hibernate in your distro's power settings on laptop lid close or hibernate button press or whatever now. I won't cover that in this post.

&#x200B;

[Figure 1: lsblk output. I just have one partition so my system boots from \/dev\/sda1 \(resume value\)](https://preview.redd.it/vhoejij99zw31.png?width=584&format=png&auto=webp&s=7eab92d5285d91293617580ba0f221a106b65ccf)

[Figure 2: the number circled in red should be your resume\_offset for \/etc\/defaults\/grub](https://preview.redd.it/ygskmolg8zw31.png?width=827&format=png&auto=webp&s=5239057d79b5a681d3ae2e94cae873ec20be9a6e)

&#x200B;

[Figure 3: You need to add these two circled fields to the GRUB\_CMDLINE\_LINUX\_DEFAULT list](https://preview.redd.it/6wgh7tnq9zw31.png?width=831&format=png&auto=webp&s=aa590f1d0b9485a95fad9e74f81f8e88b46db2ba)

Sources:

[https://wiki.manjaro.org/index.php?noscript=Swap#Using\_a\_Swapfile](https://wiki.manjaro.org/index.php?noscript=Swap#Using_a_Swapfile)

[https://wiki.archlinux.org/index.php/Power\_management/Suspend\_and\_hibernate#Hibernation](https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation)

[https://bbs.archlinux.org/viewtopic.php?id=182392](https://bbs.archlinux.org/viewtopic.php?id=182392)

&#x200B;

&#x200B;

Let me know if you guys have any problems.

https://redd.it/ds9w9e
@r_linux
Why is it so hard to install packages on Linux?

There are so many ways to install packages on Linux, sometimes it can be so technical compared to Windows and Mac. Just double click the . exe or . dmg and next, next, next, finish.

With Linux sometimes you need to find and install dependencies, or use command line apt-get, snap, dpkg -i, sometimes add repositories, etc. It can really turn some people off from Linux.

Yes, there is the graphical software store to install programs and packages such as on Ubuntu but why doesn't Linux have a standard double click, simple installation process for all programs like OSX and Windows?

What are the benefits, if any, of having so many methods of installing software on Linux?

https://redd.it/dsdxuy
@r_linux
Sudo Pronounciation

How do you guys pronounce sudo? Is it su doo or su doh? Or something else? I have heard both and am curious! Thanks :)

https://redd.it/dskpci
@r_linux
Learning basic Linux fast

Hey all, I am looking for some references to some good sources to start my dive into the world of crazy. I am looking specifically for Ubuntu based resources. I am trying to learn how to use it for a job opportunity where the requirements are basic Linux usage. I have already spun up a Ubuntu VM. I have creating text files, moving through directories, moving and deleting down pretty well. Today was day one and I feel pretty good about it but I would love to find some good free resources to learn more.

https://redd.it/dsq4ej
@r_linux
Okay I know you're on here. WHO DID THIS?
https://redd.it/dsugvw
@r_linux
fuckup assessment form
https://redd.it/dsvdzu
@r_linux
Run Linux desktop on any rooted Android device

Hi,

We can now run Linux desktop on any rooted Android device.
It is done via two applications.

Here is a clip of VolksPC OS running on ODROID-N2:

https://www.youtube.com/watch?v=RbVtqfnRhwI&t=13s

And on ODROID-C2:

https://www.youtube.com/watch?v=mNzru9WAoYg&t=17s

Vasant

https://redd.it/dsza4a
@r_linux
Any: keyword based navigation, in bash

I recently worked on a bash package to enable shell navigation based on keywords.
`any <command> keyword` expands to `any <command> filename-matching-keyword`.

If the matching is not unique, any prompts a selection menu.

[GitHub Link: https://github.com/acorbe/any](https://github.com/acorbe/any)

Any works for bash shells, and aim at expanding the capabilities of auto-completion.
Although there exist shells with smarter auto-completion features (e.g. zsh), it is not always possible to use them (e.g. on supercomputers frontend). Any is usable everywhere.

It speeds up considerably my daily job. What do you guys think?

https://redd.it/dtc4jv
@r_linux