View previous topic :: View next topic |
Author |
Message |
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Thu Nov 03, 2022 12:32 pm Post subject: Could not find a Makefile in the kernel source directory |
|
|
I'm new, so please bare with me! I updated recently (my update before this was 3 months ago) with emaint --auto sync, emerge --ask --verbose --update --deep --newuse @world and then cleaned up with emerge --depclean.
After it finished, it said:
Code: | * Could not find a Makefile in the kernel source directory.
* Please ensure that /usr/src/linux points to a complete set of Linux sources
* Unable to calculate Linux Kernel version for build, attempting to use running version |
When I do ls -ali /usr/src/linux (found the command from another post) it says:
Code: | 4853072 lrwxrwxrwx 1 root root 20 26 jun 20.26 /usr/src/linux -> linux-5.15.41-gentoo |
When I do eselect kernel list it says:
Code: | Available kernel symlink targets:
[1] linux-5.15.75-gentoo |
Also, when I do eselect news read it now says:
Code: | /usr/share/eselect/modules/news.eselect: line 36: /var/lib/gentoo/news/news-gentoo.read: Permission denied
!!! Error: Cannot update list of news items for repository "gentoo" |
What should I do? I used genkernel when I installed Gentoo, if it matters. And excuse my newness, I understand that I'm probably dealing with an intended feature.
Super thankful for your time!
Last edited by luzzekatt on Thu Nov 03, 2022 2:10 pm; edited 1 time in total |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23082
|
Posted: Thu Nov 03, 2022 12:48 pm Post subject: Re: Could not find a Makefile in the kernel source directory |
|
|
Welcome to the forums. I appreciate you showing the commands you used, and making them easy to spot. Not all new users think to do this without prompting.
luzzekatt wrote: | I updated recently (my update before this was 3 months ago) | That may be a bit long for an inexperienced user, though it seems to have succeeded for you. Going forward, I suggest trying to update every month or so. Regular updates make it likely you will get a smoother experience. Rarer updates may be more convenient personally, but you may encounter issues that require more experience to solve. If you don't mind the intermittent problem, some of which will require experience or forum assistance to solve, you can go much longer between updates. luzzekatt wrote: | After it finished, it said:
Code: | * Could not find a Makefile in the kernel source directory.
* Please ensure that /usr/src/linux points to a complete set of Linux sources
* Unable to calculate Linux Kernel version for build, attempting to use running version |
| What specifically said this? It probably came from a package that was built, but you don't say which one. It's also not clear from this whether this is a diagnostic that you can ignore since it did succeed, or a fatal error that you need help solving. If it just a diagnosic, you can probably ignore it, since it was warning that you might get a failure due to this problem. If a package failed, we can help you determine what to do next. luzzekatt wrote: | Code: | 4853072 lrwxrwxrwx 1 root root 20 26 jun 20.26 /usr/src/linux -> linux-5.15.41-gentoo | When I do eselect kernel list it says:
Code: | Available kernel symlink targets:
[1] linux-5.15.75-gentoo |
| Your emerge --depclean removed the 5.15.41 source, which is fine. Nothing updated the symlink to point to the 5.15.75 source that you now have. This would explain the diagnostic message above.
You should update the symlink to point to the installed kernel sources, build a kernel from those sources, and switch to it. In the words of the stable maintainer, "All users must upgrade." If you need help with any of those steps, please ask. luzzekatt wrote: | Also, when I do eselect news read it now says: Code: | /usr/share/eselect/modules/news.eselect: line 36: /var/lib/gentoo/news/news-gentoo.read: Permission denied
!!! Error: Cannot update list of news items for repository "gentoo" |
| You probably ran this as your user, rather than root. You need privilege to mark news as read, and your user normally would not have that. I think running eselect news read as root is typical. |
|
Back to top |
|
|
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Thu Nov 03, 2022 2:07 pm Post subject: Re: Could not find a Makefile in the kernel source directory |
|
|
Thank you for your help!
Hu wrote: | I suggest trying to update every month or so |
Will do! I actually installed and went inactive for two months, otherwise I would've updated earlier.
Hu wrote: | What specifically said this? |
I think I found the culprit in the logs!:
Code: | >>> Messages generated by process 5271 on 2022-10-28 07:15:41 CEST for package net-vpn/wireguard-tools-1.0.20210914:
ERROR: setup
Could not find a Makefile in the kernel source directory.
Please ensure that /usr/src/linux points to a complete set of Linux sources
WARN: setup
Unable to calculate Linux Kernel version for build, attempting to use running version |
Not sure if I need to do something about this? Just update/link my new kernel like you said? As of now I can connect to my VPN with WireGuard and NetworkManager successfully but ever since this (or maybe it’s unrelated), it fails when automatically connecting at boot.
Hu wrote: | You should update the symlink to point to the installed kernel sources, build a kernel from those sources, and switch to it. |
I don't know how to, but I assume I just follow these instructions (step 2-7)? Because did I already emerge the new kernel sources with emerge --ask --verbose --update --deep --newuse @world? And lastly, is this guide appropriate for me since I used genkernel and do I need to take any precautions/follow the guide differently because of it?
Thank you! |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23082
|
Posted: Thu Nov 03, 2022 4:33 pm Post subject: |
|
|
If wireguard built successfully, you don't need to do anything. Some ebuilds that depend on kernel options will fail if your kernel symlink is not set up properly, which is why the ebuild proactively warns.
Failing to connect at boot may be an ordering issue, that it starts before the unencrypted basic network is available. We may be able to help you with that, but it's probably best done in a separate thread.
I don't use genkernel, so I'm not sure how that interacts with this flow. That Wiki looks plausible for a non-genkernel user, if you don't mind building the kernel as root. I discourage that, but it's fairly common advice, and it is popular because it is easier than building as an unprivileged user. |
|
Back to top |
|
|
wjb l33t
Joined: 10 Jul 2005 Posts: 644 Location: Fife, Scotland
|
Posted: Thu Nov 03, 2022 10:16 pm Post subject: |
|
|
You could get this situation by emerging new kernel sources but not building the kernel before doing the depclean? |
|
Back to top |
|
|
sublogic Guru
Joined: 21 Mar 2022 Posts: 307 Location: Pennsylvania, USA
|
Posted: Fri Nov 04, 2022 1:01 am Post subject: |
|
|
About the disappearing linux/Makefile, I noticed that too after an emerge --depclean . The depclean prints a message to the effect that it kept old kernel trees that have modified files, and to remove the old kernels manually, but in fact it deletes *some* of the files in the trees. |
|
Back to top |
|
|
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Fri Nov 04, 2022 11:12 am Post subject: |
|
|
Thanks everyone for the help so far! But...
Since I "unfortunately" use genkernel, I ran eselect kernel set to link(?) my kernel source, and then genkernel all to configure and compile the kernel.
When it finished it said:
Code: | * Kernel compiled successfully!
*
* --no-bootloader set; Skipping bootloader update ...
*
* Required kernel parameter:
*
* root=/dev/$ROOT
*
* Where $ROOT is the device node for your root partition as the
* one specified in /etc/fstab
* If you require Genkernel's hardware detection features, you MUST
* tell your bootloader to use the provided initramfs file '/boot/initramfs-5.15.75-gentoo-x86_64.img'.
* WARNING... WARNING... WARNING...
* Additional kernel parameters that *may* be required to boot properly: |
So, I went into /etc/genkernel.conf and set BOOTLOADER="grub2", and then ran genkernel all again. It succeeded again, same as above, but this time it additionally said:
Code: | * Error! Grub2 configuration file does not exist, please ensure grub2 is correctly setup first. |
I then ran sudo grub-mkconfig -o /boot/grub/grub.cfg and it also said:
Code: | /usr/sbin/grub-mkconfig: line 260: /boot/grub/grub.cfg.new: The file or catalog doesn’t exist |
Translated from Swedish, it’s not the exact message.
Any suggestions or hints on what to do? Am I even going the right direction? Maybe I should just not use genkernel since then I could actually follow the guide. Seems like there isn’t much documentation on genkernel, but maybe I’m misunderstanding.
I also saw that /etc/genkernel.conf has options like:
Code: | # Install to $BOOTDIR
#INSTALL="yes"
# Mount BOOTDIR automatically if it isn't mounted
#MOUNTBOOT="yes"
# Make symlinks in BOOTDIR automatically
#SYMLINK="no" |
Would any of them solve my "issue"? |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2686
|
Posted: Fri Nov 04, 2022 11:37 am Post subject: Re: Could not find a Makefile in the kernel source directory |
|
|
luzzekatt wrote: |
Hu wrote: | You should update the symlink to point to the installed kernel sources, build a kernel from those sources, and switch to it. |
I don't know how to, but I assume I just follow these instructions (step 2-7)? Because did I already emerge the new kernel sources with emerge --ask --verbose --update --deep --newuse @world? And lastly, is this guide appropriate for me since I used genkernel and do I need to take any precautions/follow the guide differently because of it?
Thank you! |
Use eselect kernel set to update the symlink. Then transfer to your new kernel directory your old .config from the directory of your old kernel which should not have been cleaned by --depclean except you manually removed it. Use --ask or --pretend in conjuction with --depclean so that you know what's going to be cleaned and don't end up having cleaned something you don't want.
EDIT: I just saw you're using genkernel. IF you're suing custom kernel, you need use --with-kernel-config or something like that so supply genkernel the kernel configuration. Otherwise it'll use the default values for everything. You might also review the genkernel guide linked at the bottom of the guide you linked in your above post.
sublogic wrote: | The depclean prints a message to the effect that it kept old kernel trees that have modified files |
That's not correct. Portage will remove the kernel sources, but not files created by the kernel compilation. That's why you need to remove the *directories* manually. If you want to keep a kernel, you either emerge it using the syntax: emerge =sys-kernel/gentoo-sources-<version>
or add sys-kernel/gentoo-sources:<version> to your world file. I suggest not to touch the world file until you feel confident you know what and why resides there.
Regards,
Georgi |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23082
|
Posted: Fri Nov 04, 2022 1:51 pm Post subject: |
|
|
sublogic wrote: | About the disappearing linux/Makefile, I noticed that too after an emerge --depclean . The depclean prints a message to the effect that it kept old kernel trees that have modified files, and to remove the old kernels manually, but in fact it deletes *some* of the files in the trees. | To expand on logrusx's explanation: Portage removes all, and only, the files that it installed, as you would see in the CONTENTS file of the package being removed. Portage will additionally remove any directories that the package installed if and only if removing all the package's files left the directory empty. For users who build a kernel as an unprivileged user in a separate directory, the kernel source directory will contain only files that Portage installed, and Portage will remove it completely. For users who build the kernel in place in the source directory, the source directory will have many unmanaged files generated by the compilation. Portage does not remove those files, and because those files exist, the directories are not empty, and are then kept. Portage will remove all the sources it installed, hence the message. luzzekatt wrote: | Code: | /usr/sbin/grub-mkconfig: line 260: /boot/grub/grub.cfg.new: The file or catalog doesn’t exist | Translated from Swedish, it’s not the exact message. | You can force a message to be untranslated by running the command with LC_MESSAGES=C in its environment (assuming you did not set LC_ALL). In this case, your translation is clear enough for us to guess what error the tool was trying to report. I believe the English message would be No such file or directory.
You might also find man errno informative. It lists the symbolic error codes and their canonical human-readable text. If that manpage is localized to your language, you could use that to look up the symbolic code from the Swedish message printed. Setting LC_MESSAGES is easier though. |
|
Back to top |
|
|
sublogic Guru
Joined: 21 Mar 2022 Posts: 307 Location: Pennsylvania, USA
|
Posted: Sat Nov 05, 2022 12:20 am Post subject: |
|
|
logrusx an Hu, thank you for the --depclean clarification. |
|
Back to top |
|
|
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Sat Nov 05, 2022 7:38 am Post subject: |
|
|
I'm still getting the following errors:
After genkernel all:
Code: | * Error! Grub2 configuration file does not exist, please ensure grub2 is correctly setup first. |
After grub-mkconfig -o /boot/grub/grub.cfg:
Code: | /usr/sbin/grub-mkconfig: line 260: /boot/grub/grub.cfg.new: No such file or directory. |
In /boot, there's nothing related to GRUB. So it makes sense.
This is my /etc/fstab:
Code: | #LABEL=boot /boot ext4 noauto,noatime 1 2
#UUID=58e72203-57d1-4497-81ad-97655bd56494 / ext4 noatime 0 1
#LABEL=swap none swap sw 0 0
#/dev/sda1 /boot ext4 defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext4 noatime 0 1 |
I've tried uncommenting LABEL=boot which doesn't seem to do anything and sda1 which gives an error complaining about vfat. How do I know which partition to mount for /boot? If that is even the right direction.
Excuse my unawareness, but first of all, am I right in assuming that I 1) need to mount the /boot partition? If so, how come I can boot into my system fine already and GRUB works fine? (Other than not being able to get it to run my new kernel). And 2), after I've mounted /boot, (even though I can already browse /boot...?), do I need to "install" (again?) GRUB by following this guide? Even though my GRUB already works and I can boot into Gentoo fine? Why would I install GRUB when it's already working?
So confused. Really wish there was a guide for how to update with genkernel. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2686
|
Posted: Sat Nov 05, 2022 9:10 am Post subject: |
|
|
luzzekatt wrote: | I'm still getting the following errors:
After genkernel all:
Code: | * Error! Grub2 configuration file does not exist, please ensure grub2 is correctly setup first. |
After grub-mkconfig -o /boot/grub/grub.cfg:
Code: | /usr/sbin/grub-mkconfig: line 260: /boot/grub/grub.cfg.new: No such file or directory. |
In /boot, there's nothing related to GRUB. So it makes sense.
This is my /etc/fstab:
Code: | #LABEL=boot /boot ext4 noauto,noatime 1 2
#UUID=58e72203-57d1-4497-81ad-97655bd56494 / ext4 noatime 0 1
#LABEL=swap none swap sw 0 0
#/dev/sda1 /boot ext4 defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext4 noatime 0 1 |
I've tried uncommenting LABEL=boot which doesn't seem to do anything and sda1 which gives an error complaining about vfat. |
I suspect you don't have vfat support in your kernel, but when you report a problem, you report the exact error you get. Don't expect us to know every possible situation which may arise and guess 100% correctly what your case is.
See also this guide and the linked resources in the See also section.
Regards,
Georgi |
|
Back to top |
|
|
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Sat Nov 05, 2022 11:38 am Post subject: |
|
|
logrusx wrote: | See also this guide and the linked resources in the See also section |
Thank you!
Doing efibootmgr -v shows:
Code: | Boot0001* gentoo HD(1,GPT,d1171537-377c-6344-b22f-1717e33b8010,0x800,0x80000)/File(\EFI\GENTOO\GRUBX64.EFI) |
I went into /etc/fstab and changed /boot to vfat:
Code: | /dev/sda1 /boot vfat noauto,noatime 0 2 |
I was then able to mount /boot, and after doing genkernel all it said:
Code: | ln: failed to create symbolic link '/boot/kernel': Operation not permitted
* ERROR: Failed to create 'kernel' -> 'vmlinuz-5.15.75-gentoo-x86_64' symlink!
* Please consult '/var/log/genkernel.log' for more information and any
* errors that were reported above.
*
* Report any genkernel bugs to bugs.gentoo.org and
* assign your bug to genkernel@gentoo.org. Please include
* as much information as you can in your bug report; attaching
* '/var/log/genkernel.log' so that your issue can be dealt with effectively.
*
* Please do *not* report kernel compilation failures as genkernel bugs!
* |
Here's the /var/log/genkernel.log:
Code: | * Shall copy new kernel image, automatically managing symlinks and old images.
* Current kernel symlink does NOT exist.
* Defaulted to: vmlinuz-5.15.75-gentoo-x86_64
* Old kernel symlink does NOT exist.
* Defaulted to: vmlinuz-5.15.75-gentoo-x86_64.old
* Actual image file '/boot/vmlinuz-5.15.75-gentoo-x86_64' does NOT exist.
* Actual old image file '/boot/vmlinuz-5.15.75-gentoo-x86_64.old' does NOT exist.
* Old symlink '/boot/kernel' does NOT exist; Skipping ...
* Old symlink '/boot/kernel.old' does NOT exist; Skipping ...
* Same base version (vmlinuz-5.15.75-gentoo-x86_64).
* Copying '/usr/src/linux/arch/x86_64/boot/bzImage' to '/boot/vmlinuz-5.15.75-gentoo-x86_64' ...
* Creating 'kernel' -> 'vmlinuz-5.15.75-gentoo-x86_64' symlink ... |
I guess it's like you said, that I don't have vfat support in my kernel. But did I go the right direction by changing /boot to vfat in my /etc/fstab? I'm on UEFI. Should I follow this? Seems difficult. Or just enable vfat support in my kernel by following the guide you suggested?
If you think I need to do more reading on my own, please let me know! |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54821 Location: 56N 3W
|
Posted: Sat Nov 05, 2022 11:53 am Post subject: |
|
|
luzzekatt,
The vfat filesystem does not support symlinks, so
Code: | ln: failed to create symbolic link '/boot/kernel': Operation not permitted
* ERROR: Failed to create 'kernel' -> 'vmlinuz-5.15.75-gentoo-x86_64' symlink! | is expected.
That error should not be fatal.
Code: | /boot/vmlinuz-5.15.75-gentoo-x86_64 | and its matching initramfs will be there and Code: | grub-mkconfig -o /boot/grub/grub.cfg | should work too.
Inspect /boot/grub/grub.cfg and check that one of the boot stanzas says Code: | linux /vmlinuz-5.15.75-gentoo-x86_64 .... | an a line or two later, mentions the matching initramfs too. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Sat Nov 05, 2022 12:24 pm Post subject: |
|
|
There are mentions of 5.15.75 (the kernel I've eselect kernel set to) in /boot/grub/grub.cfg but no 5.15.75 initramfs:
Code: | echo 'Läser in Linux 5.15.75-gentoo-x86_64 …'
linux /vmlinuz-5.15.75-gentoo-x86_64 root=/dev/sda3 ro |
Ctrl+F "initramfs" only shows old kernel:
Code: | linux /vmlinuz-5.15.41-gentoo-x86_64 root=UUID=e3332f39-bb1c-428f-9f08-31b4fcb504d9 ro
echo 'Läser in initial ramdisk …'
initrd /initramfs-5.15.41-gentoo-x86_64.img |
When I do grub-mkconfig -o /boot/grub/grub.cfg it says:
Code: | Generate configuration file for grub...
Found linux image: /boot/vmlinuz-5.15.75-gentoo-x86_64
Found linux image: /boot/vmlinuz-5.15.41-gentoo-x86_64
Found initrd image: /boot/initramfs-5.15.41-gentoo-x86_64.img
Warning: os probes will not run to identify other bootable partitions.
Their system will not be added to GRUB's boot configuration.\See the documentation for GRUB_DISABLE_OS_PROBER.
Adding boot menu entry for firmware UEFI...
finished |
I automatically translated this last one to English, so it may not be accurate. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54821 Location: 56N 3W
|
Posted: Sat Nov 05, 2022 1:25 pm Post subject: |
|
|
luzzekatt,
should have made and installed the kernel and its matching initramfs.
Use wgetpaste to share the /var/log/genkernel.log file please. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
luzzekatt n00b
Joined: 03 Nov 2022 Posts: 7
|
Posted: Sun Nov 06, 2022 6:58 am Post subject: |
|
|
NeddySeagoon wrote: | Use wgetpaste to share the /var/log/genkernel.log file please. |
Shoot, before I saw your comment I tried genkernel all again, rebooted and got a kernel panic that I’m currently at. I’m in a livecd but I don’t know how to emerge wgetpaste with chroot? It complains about a “failure to validate a sane ‘/dev’; may be an indication of a broken ‘/dev/fd’”. When I know how to emerge it with chroot, I will happily paste the genkernel.log as requested! Will any of these pictures suffice as a clue?
Kernel panic: https://i.imgur.com/x42wLNu.jpg
fdisk: https://i.imgur.com/r8UalQ4.jpg
lsblk: https://i.imgur.com/Q1i7AmS.jpg
/boot contents: https://i.imgur.com/VQiZb78.jpg
grub2 config snippet: https://i.imgur.com/kfLTxwh.jpg
I did make menuconfig and enabled (*) support for ext4 and vfat. After that I simply exited menuconfig though, and didn’t compile again or anything, so I don’t know if my changes were saved. I don’t have this knowledge just yet since I’m new and have only used genkernel, but I’d like to learn. I did try to genkernel all again however as chroot but it failed. I don’t remember what the error was, probably because it was the same as the symlink error I posted earlier in this thread.
Also, currently my /etc/fstab looks like:
Code: | #LABEL=boot /boot ext4 noauto,noatime 1 2
#UUID=58e72203-57d1-4497-81ad-97655bd56494 / ext4 noatime 0 1
#LABEL=swap none swap sw 0 0
/dev/sda1 /boot vfat defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext4 noatime 0 1 |
Before all of this, /dev/sda1 was uncommented and listed as ext4 instead of vfat. Not sure if it matters.
Any clue? Thank you in advance! |
|
Back to top |
|
|
|
|
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
|
|