Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kernel/grub cleanup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
farmer.ro
Apprentice
Apprentice


Joined: 20 Aug 2016
Posts: 179

PostPosted: Sat Aug 20, 2016 7:50 am    Post subject: kernel/grub cleanup Reply with quote

i wanted to clean up some old kernels to save disk space with:

Code:
root #rm -r /usr/src/linux-3.X.Y
root #rm -r /lib/modules/3.X.Y
root #rm /boot/kernel-3.X.Y
root #rm /boot/System.map-3.X.Y
root #rm /boot/config-3.X.Y
root #eclean-dist"
root #eclean-dist --destructive


after running:

Code:
grub-mkconfig -o /boot/grub/grub.cfg


i got:

Code:
grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/kernel-genkernel-x86_64-4.7.1-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.7.1-gentoo
Found linux image: /boot/vmlinuz-4.7.1-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.7.1-gentoo
Found linux image: /boot/vmlinuz-4.7.0-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.7.0-gentoo
Found linux image: /boot/vmlinuz-4.4.6-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.4.6-gentoo
Found linux image: /boot/vmlinuz-4.4.6-gentoo.old
Found initrd image: /boot/initramfs-genkernel-x86_64-4.4.6-gentoo
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "vg0" not found
  Cannot process volume group vg0
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "vg0" not found
  Cannot process volume group vg0
/usr/sbin/grub-probe: error: disk `lvm/vg0-lvol1' not found.
done


after booting grub still shows the old kernel initramfs and vmlinuz.

Code:
ls /boot
System.map-4.7.1-gentoo                   initramfs-genkernel-x86_64-4.4.6-gentoo  vmlinuz-4.4.6-gentoo
System.map-genkernel-x86_64-4.7.1-gentoo  initramfs-genkernel-x86_64-4.7.0-gentoo  vmlinuz-4.4.6-gentoo.old
config-4.7.1-gentoo                       initramfs-genkernel-x86_64-4.7.1-gentoo  vmlinuz-4.7.0-gentoo
grub                                      kernel-genkernel-x86_64-4.7.1-gentoo     vmlinuz-4.7.1-gentoo
grub.cfg                                  lost+found


/boot/ still shows the old vmlinuz and initramfs.

Question: how do i clean up making that grub only will show the current 4.7.1 kernel ?

Question: what does "WARNING: Failed to connect to lvmetad. Falling back to internal scanning." errors mean? (might be the fact i am using lvm disk-encryption?) these errors about " Volume group "vg0" not found
Cannot process volume group vg0" also show up when booting the Desktop.

system runs fine, i am using it as a mmo-rpg gaming machine, but i am not sure if these errors can be ignored? (disk encryption seems to work fine )
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43198
Location: 56N 3W

PostPosted: Sat Aug 20, 2016 8:32 am    Post subject: Reply with quote

farmer.ro,

Welcome to Gentoo.

If you select a block of text in your post, then click the code button at the top of the Post a reply window, the text will be surrounded by code tags.
I've edited your post as an example. If you select the edit button at the top right of your post, you will see what it looks like in a message being composed.

A few things.
Kernel source code all goes into /usr/src
When you install a kernel, some of it is copied to /boot and some to /lib/modules/`uname -r`

Your
Code:
#rm -r /usr/src/linux-3.X.Y
removes the source code, which is not used after the two parts above are installed, so these parts remain.
Incidentally, Its better to use emerge to remove old kernel sources, as that will also tell portage that they are no longer installed.

Code:
grub-mkconfig -o /boot/grub/grub.cfg
looks in /boot to see what kernels are installed, not in /usr/src, so it found all of your old kernel binaries. You need to remove these, along with the matching initrd files.
At the same time, you can remove the matching /lib/modules/`uname -r` directory as that contains the loadable modules for a given kernel version.
Code:
uname -r
returns the version of the running kernel. Its a bad idea to remove those modules. :)

Keep two (or more) kernels at all times. Everyone builds a dud kernel from time to time and its much easier to fix a broken kernel by selecting a good one from the grub menu than it is to boot a rescue system and then chroot. You do not need to keep the kernel in /usr/src for this, just all the other bits.

Code:
/run/lvm/lvmetad.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
Tells that you are not running the lvmetad service. This warning can be ignored meanwhile.

Code:
Cannot process volume group vg0
may be more of an issue. It depends wat lvm was trying to do and why it failed.

You mentioned you wanted to free up some disk space. When emerge is not running, look at /var/tmp/portage. Broken emerges accumulate here. You can remove it.
Source downloads accumulate in /usr/portage/distfiles. If you are desperate for space this can be removed. However, any rebuilds will fetch the sources again. Try
Code:
eclean -d distfiles
first, which keeps the sources for all installed packages.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
farmer.ro
Apprentice
Apprentice


Joined: 20 Aug 2016
Posts: 179

PostPosted: Sat Aug 20, 2016 9:26 am    Post subject: Reply with quote

Code:
# ls /boot/
System.map-4.7.1-gentoo                   initramfs-genkernel-x86_64-4.4.6-gentoo  vmlinuz-4.4.6-gentoo
System.map-genkernel-x86_64-4.7.1-gentoo  initramfs-genkernel-x86_64-4.7.0-gentoo  vmlinuz-4.4.6-gentoo.old
config-4.7.1-gentoo                       initramfs-genkernel-x86_64-4.7.1-gentoo  vmlinuz-4.7.0-gentoo
grub                                      kernel-genkernel-x86_64-4.7.1-gentoo     vmlinuz-4.7.1-gentoo
grub.cfg                                  lost+found


Code:
# rm -rf initramfs-genkernel-x86_64-4.4.6-gentoo
# rm -rf initramfs-genkernel-x86_64-4.7.0-gentoo
# rm -rf vmlinuz-4.4.6-gentoo
# rm -rf vmlinuz-4.4.6-gentoo.old
# rm -rf vmlinuz-4.7.0-gentoo


Code:
# grub-mkconfig -o /boot/grub/gub.cfg
Generating grub configuration file ...
Found linux image: /boot/kernel-genkernel-x86_64-4.7.1-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.7.1-gentoo
Found linux image: /boot/vmlinuz-4.7.1-gentoo
Found trinity image: /boot/initramfs-genkernel-x86_64-4.7.1-gentoo
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "vg0" not found
  Cannot process volume group vg0
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "vg0" not found
  Cannot process volume group vg0
/usr/sbin/grub-probe: error: disk `lvm/vg0-lvol1' not found.
done


grub seems to pick up only the latest 4.7.1 kernel so that part is solved.

i already removed the previous kernel versions, so i only have 1 working kernel at this moment, guess i have to wait for new kernel sources get emerged.

about the lvmetad error: i have no idea what lvmetad means, i did not google it yet, but if i understand correctly you say it can safely be ignored?

about the volume group vg0 not found: i made the encrypted partitions with:

Code:
# parted -a optimal /dev/sda
# mklabel gpt
# unit mib
# mkpart primary 1 3
# name 1 grub
# set 1 bios_grub on
# mkpart primary 3 131
# name 2 boot
# mkpart primary 131 -1
# name 3 lvm
# set 2 boot on


Code:
# cryptsetup -c aes:cbc:essiv:sha256 -v luksFormat -s 256 /dev/sda3
# cryptsetup luksOpen /dev/sda3 sda3-luks
# lvm pvcreate /dev/mapper/sda3-luks
# lvm vgcreate vg0 /dev/mapper/sda3-luks
# lvm lvcreate -L 2048M vg0
# lvm vgcreate -L 109G vg0


and used /dev/mapper/vg0-lvol0 for /dev/sda3(swap) and /dev/mapper/vg0-lvol1 for /dev/sda4(root) during the install with the Gentoo Handbook

since everything seems to work just fine, i am not sure i have to look further into the error, or if the error can be ignored.
Back to top
View user's profile Send private message
farmer.ro
Apprentice
Apprentice


Joined: 20 Aug 2016
Posts: 179

PostPosted: Sat Aug 20, 2016 1:32 pm    Post subject: Reply with quote

Grub got sovled.

but still unsure about:

Code:
/run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "vg0" not found
  Cannot process volume group vg0
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  Volume group "vg0" not found
  Cannot process volume group vg0
/usr/sbin/grub-probe: error: disk `lvm/vg0-lvol1' not found.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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