this post was submitted on 20 Sep 2023
7 points (88.9% liked)

Pop!_OS (Linux)

5021 readers
51 users here now

Pop!_OS is an operating system developed by System76 for STEM and creative professionals who use their computer as a tool to discover and create. Unleash your potential on secure, reliable open source software. Based on your exceptional curiosity, we sense you have a lot of it.

Unleash your potential

Whether this is your first experience with Linux, or your latest adventure, all are welcome to discuss and ask questions about Pop!_OS and COSMIC. Keep the discussions friendly though, and remember to assume good intentions whenever you reply. We're all here because we have a shared love for Linux and open source software.

System76 Logo

Support us by buying System76 hardware for you or your company! Or by donating on the Pop!_OS website through the "Support Pop" button. Pop!_OS and COSMIC are fully funded by System76 hardware sales. All systems are assembled in the USA. With your support, we'll work to push the Linux desktop forward with COSMIC.

Links

Guides

Hardware

Recommended

Community Rules

Follow the Code of Conduct

All posts on pop_os must adhere to the Pop!_OS community Code of Conduct. https://github.com/pop-os/code-of-conduct

Be helpful

Posts to pop_os must be helpful. When responding to a user asking for help, do not provide tongue-in-cheek responses like "RTM" or links to LMGTFY. Linking to direct sources that answer the asker's question is fine, but it's advised to provide some explanation as to how you got to that source.

Critique should be constructive

We within the Pop!_OS community welcome helpful criticism or ideas on ways to improve. However, basic "It's bad" or other simple negative comments don't help anyone fix anything. When voicing a complaint about something, try to point out ways the complaint could be improved or worked around, so that we can make a better product for it.

This rule applies to both Pop!_OS and its projects as well as other products available from third-parties.

Don't post malicious "advice"

It can be funny to joke about malicious commands, however this is not the venue for it. Do not advise users to run commands which will lock up their systems, steal their data, or erase their drive. Examples of this include (but are not limited to) fork bombs, rm, etc.

Posts violating this rule will be removed, even if the post is clearly in jest. Repeated offences may lead to a ban. You may understand that the command isn't serious, but a new user might not.

No personal attacks

Posts making a personal attack on any user will not be tolerated.

No hate speech

Hate speech of any kind will not be tolerated. Any violations will be removed, and are grounds for a ban.

founded 1 year ago
MODERATORS
 

I'm exploring ways to shave a few seconds off of my boot time, and I came across a post that stated, "my initrd is pretty small--doesn’t really load much--and Arch also defaults to using zstd which is also faster to decompress versus gzip."

What compression does Pop! use for initrd and the kernel? When I run ls -al /boot, I see files such as 14M vmlinuz-6.4.6-76060406-generic and 119M initrd.img-6.4.6-76060406-generic. Are these compressed?

Lastly, is there a way to choose the compression of these boot files without a custom kernel build? Or is what I'm trying to do "off the beaten path" and going to lead to "you have to compile your own kernel from here on out"?

top 13 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 11 months ago (2 children)

Go to /etc/initramfs-tools/initramfs.conf and change:

compress=gzip

to

compress=ztsd

and run:

sudo update-initramfs -u -k all
[–] [email protected] 2 points 11 months ago (1 children)

There's nothing to change. zstd is already the default. Has been from the beginning.

[–] [email protected] 1 points 11 months ago (1 children)

Then the kernel should be ztsd. Try running file and see the output.

[–] [email protected] 1 points 11 months ago (1 children)

How would I check? Like this?

$ zstd -l vmlinuz-6.4.6-76060406-generic 
Frames  Skips  Compressed  Uncompressed  Ratio  Check  Filename
File "vmlinuz-6.4.6-76060406-generic" not compressed by zstd 
[–] [email protected] 2 points 11 months ago (1 children)

No. Like this:

file /boot/vmlinuz-6.4.6-76060406-generic
[–] [email protected] 1 points 11 months ago (1 children)

Wow, this told me much more than I expected; however, I'm still not sure if it's zstd:

/boot/vmlinuz-6.4.6-76060406-generic: Linux kernel x86 boot executable bzImage, version 6.4.6-76060406-generic ([email protected]) #202307241739~1694621917~22.04~ac5e1a8 SMP PREEMPT_DYNAMIC Wed S, RO-rootFS, swap_dev 0XD, Normal VGA

bzImage sounds like...bzip2, maybe?

[–] [email protected] 1 points 11 months ago (1 children)

No. BZ stands for Big zImange. The kernel is compressed.

To see what compression was used:

zgrep CONFIG_KERNEL_ /proc/config.gz

Try file on the initrd instead.

[–] [email protected] 1 points 11 months ago (1 children)

Ah, thanks! Slightly different location, but basically the same. Here we go:

$ grep CONFIG_KERNEL_ /boot/config-6.4.6-76060406-generic
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_KERNEL_ZSTD=y

So the kernel is "zstd" compressed.

OTOH, I'm not sure if this means anything about initrd (ASCII cpio archive??)

$ file /boot/initrd.img-6.4.6-76060406-generic 
/boot/initrd.img-6.4.6-76060406-generic: ASCII cpio archive (SVR4 with no CRC)
[–] [email protected] 1 points 11 months ago

Looks like your initrd isn't compressed. Huh?

[–] [email protected] 1 points 11 months ago

When I check this file, it is already set at COMPRESS=zstd. However, I'm not sure if it's working as I think, because the vmlinuz-6.4* kernel file is not a zstd file? Maybe it uses zstd for just a portion of the binary...

[–] [email protected] 4 points 11 months ago

Pop already uses zstd for its initramfs. You can check by looking at /etc/initramfs-tools/initramfs.conf.

There was an issue where they were considering switching to xz to save space, but when I tried that, it actually made things slower, so I'd avoid that if possible:

https://github.com/pop-os/default-settings/issues/168

[–] [email protected] 3 points 11 months ago

I'd be curious to know how uncompressed fairs if you test it. But i think you're really getting into minimal gains territory...

[–] [email protected] 2 points 11 months ago

I wouldn't focus on faster decompression.

Disk read speed is almost always the bottleneck. I think you'll find that smaller file sizes, even if the decompress takes slightly longer, are faster overall because they save disk I/O.

YMMV based on your hardware, of course.