The officially official Devuan Forum!

You are not logged in.

#1 2021-03-25 15:22:52

Bill Evans
Member
Registered: 2020-08-06
Posts: 18  

[SOLVED] finding package for correct version of linux source

Months ago I downloaded and burned a devuan DVD. When I install it, uname -r yields 4.19.0-9-amd64. (Old, I know.) I'm trying to compile a set of drivers from asterisk.org, and quite understandably they want me to have copy of Linux source which matches the Linux version I'm running. But when I do apt-get --yes install linux-source, I get the source for Linux 4.19.0-14-amd64. How do I get the Linux source that matches the version of Linux that I'm running? I know I could probably work around this by re-burning the DVD, but that means I would probably bump against this problem again later, so I'd like to know how to match up the Linux source I get with the version of Linux I'm running.

Offline

#2 2021-03-25 15:40:09

dice
Member
Registered: 2020-11-22
Posts: 421  
Website

Re: [SOLVED] finding package for correct version of linux source

To me it sounds like you need to update to that kernel unless i am not understanding what it is you want.

so just

# apt update && apt dist-upgrade

Do good things.  Share.  Be helpful.  Be decent.  Live large.
E.V.I.L = Electronic Virtual Intelligent Life

Offline

#3 2021-03-25 16:24:54

Bill Evans
Member
Registered: 2020-08-06
Posts: 18  

Re: [SOLVED] finding package for correct version of linux source

My environment involves machines which do not have internet access, and it would be really, really, really handy to be able to use this DVD, and this version of Linux, and its matching source. Is there any way at all that I can get the matching source?

Last edited by Bill Evans (2021-03-25 16:25:24)

Offline

#4 2021-03-25 16:27:22

rolfie
Member
Registered: 2017-11-25
Posts: 507  

Re: [SOLVED] finding package for correct version of linux source

I guess you need to load the kernel headers, afaik there is no linux-source in Devuan. You can either run an apt update as suggested by dice and then install linux-headers-amd64, or you try apt install linux-headers-4.19.0-9-amd64 which is outdated by now, but fits to the kernel you use.

rolfie

Last edited by rolfie (2021-03-25 16:27:56)

Offline

#5 2021-03-25 17:15:38

Bill Evans
Member
Registered: 2020-08-06
Posts: 18  

Re: [SOLVED] finding package for correct version of linux source

Thanks for the suggestions.

For the reasons I mentioned, apt update isn't going to work.

And in case this might be of interest, yes, there is a devuan package named linux-source, and I'm not yet sure that the third party drivers I'm trying to compile will be content with just linux-headers. To find out, obviously I need to install the linux headers. When I tried what you suggested, though, I got:

root@tigress:~# apt install linux-headers-4.19.0-9-amd64
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-headers-4.19.0-9-amd64
E: Couldn't find any package by glob 'linux-headers-4.19.0-9-amd64'
E: Couldn't find any package by regex 'linux-headers-4.19.0-9-amd64'
root@tigress:~# 

Offline

#6 2021-03-25 18:02:11

rolfie
Member
Registered: 2017-11-25
Posts: 507  

Re: [SOLVED] finding package for correct version of linux source

I have no idea how to access the packages on a Devuan DVD correctly. In the internet there should be instructions how to address such a DVD in the sources.list. I consider this to be the pre-requisite for a successful installation of any package from that DVD. I guess thats missing in your case. Unfortunately I never had to go this path, I can't help.

In addition I searched Debian.org for the a package called linux-source. I never came across that. This really exists, its a meta-package that adresses the latest kernel sources, not just the headers. There also is a linux-source-4.19 meta-package. When the DVD is set up correctly in the sources.list, you should get the matching source for your kernel.

rolfie

Last edited by rolfie (2021-03-25 18:02:33)

Offline

#7 2021-03-25 18:32:32

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 1,597  
Website

Re: [SOLVED] finding package for correct version of linux source

The headers are all you need to compile new drivers. EDIT: and the build-essential package.

To add the DVD to your sources first copy the image to the root filesystem, create a mountpoint for it and mount the image:

# mkdir /usr/local/dvd
# mkdir /dvd
# cp devuan.iso /usr/local/dvd/
# mount /usr/local/dvd/devuan.iso /dvd

Then create an fstab entry so it is mounted at every boot:

# grep /dvd /proc/self/mounts >> /etc/fstab

And add it to /etc/apt/sources.list:

deb [trusted=yes] file:/dvd beowulf main

You should now be able to install packages from the DVD:

# apt update
# apt install linux-headers-amd64 build-essential

Last edited by Head_on_a_Stick (2021-03-25 18:33:34)


Black Lives Matter

Offline

#8 2021-04-04 07:11:27

Bill Evans
Member
Registered: 2020-08-06
Posts: 18  

Re: [SOLVED] finding package for correct version of linux source

I apologize for my clumsiness. I didn't make it clear what my overall requirements are. I've fulfilled them, and will describe the solution.

The requirements are these:

Step alpha:  After doing a stock devuan installation on a system which has Internet access, install a shopping list of packages (and those on which they depend, of course). For me, not all of these are available on the desktop.iso, things like clisp, valgrind, and dos2unix. When the smoke clears, I want directory /usr/src to contain linux-headers-$(uname -r); I do not want to see the linux headers for any other version of the system. Just deleting the wrong ones won't work, because their presence is evidence that I've installed something that depends on them, and that needs to be avoided at the outset.

Step beta:  Repeat all of this on a system which does not have Internet access.

The solution may have unnecessary steps or other details, but I've tested it, and it works.

During the stock installation in both steps, in the "Choose software to install" menu, I deselected the Devuan desktop environment and added Console productivity.

A handy command is dpkg --list. Each time I used it, I removed all the output except the bare names of the packages which have been installed. To keep output clean, whenever I wanted to install a package, I checked to see whether it was already installed. The other time I used it was near the end of step alpha, to gather all the packages together in preparation for step beta.

The major discovery in the first step is that one shouldn't put entries for both the DVD and deb.devuan.org in file /etc/apt/sources.list at the same time. If you do, it will always go for the later linux-headers, even if it doesn't match what you're running.  It doesn't matter which entry comes first in the file; you'll always get the problematic result.

Ok, here's step alpha. Consider doing everything under the script command, so you can diagnose problems more easily.

1. I found that /etc/apt/sources.list already referred to the DVD.  I added [trusted=yes] (surrounded by spaces) just after the initial "deb" on the "deb" line. I don't know whether it's necessary, but it works.

2. apt-get update

3. For each package in my shopping list, if it hasn't been installed already while installing prior packages, apt-get --yes install this-package-name; don't worry if you get an error; just keep going.

4. Change /etc/apt/sources.list so that the only entry is deb http://deb.devuan.org/merged beowulf contrib main non-free; of course, you'll want to change beowulf as necessary.

5. Make a list of items on the shopping list which have not yet been (successfully) installed.

6. dhclient; just for kicks and grins, go out of your way to delay doing this until just now.

7. apt-get update

8. For each item on this later list, check whether it's already been installed (perhaps on this step 8); if not, apt-get --yes install this-package-name; blow up if an error happens. After each package has been installed, ls -l /usr/src. If installing this package has resulted in expanding the content of that directory to include a later linux-headers, you have a problem which this whole algorithm won't solve. Sorry.

9. Create an empty directory to contain all the packages you've installed. Copy into it all of /var/cache/apt/archives/*.deb. Those are the packages you installed from the Internet, not from the DVD.

10. From the list of all installed packages, fish out from the DVD the .deb files for all packages not already copied from /var/cache/apt/archives/, and copy them into the directory of packages you're building. I did a one-time check before I set out on this adventure: no package is represented on the DVD with more than one version, and multiple copies of a given package had the same md5sum.

11. tar together the .deb files you've gathered in your new directory.

12. (cd /usr/src; ln -s linux-headers-$(uname -r) linux)

And here's step beta. Once again, consider doing everything under the script command.

1. After a stock installation as described above, get the tarball of the packages you installed in step alpha.

2. dpkg --recursive --install your-package-directory

3. Using the handy-dandy list of already installed packages, list the names of any packages in your directory which were not successfully installed.  If the list is non-empty, go back to step 2. Rinse and repeat until everything has been installed. If you get to the point where another iteration won't solve even one problem, then you're in a situation beyond the scope of this post. Sorry.

In my case, the following happened:

Selecting previously unselected package gawk.
dpkg: regarding .../gawk_4.2.1+dfsg-1_amd64.deb containing gawk, pre-dependency problem:
 gawk pre-depends on libmpfr6 (>= 3.1.3)
  libmpfr6 is not installed.

dpkg: error processing archive packages.d/gawk_4.2.1+dfsg-1_amd64.deb (--install):
 pre-dependency problem - not installing gawk

... and I didn't have to scan all the script output to find this problem, because at the end of the dpkg --recursive command was this:

Errors were encountered while processing:
 packages.d/gawk_4.2.1+dfsg-1_amd64.deb

So I repeated the dpkg --recursive command. I could probably have just installed gawk, but rerunning everything is a robust recovery that will also work in the future if I ever have more complex dependency problems.

Anyway, after success:

4. (cd /usr/src; ln -s linux-headers-$(uname -r) linux)

... and Bob's your uncle.

Last edited by Bill Evans (2021-04-04 07:18:05)

Offline

#9 2021-04-04 07:54:32

GlennW
Member
Registered: 2019-07-18
Posts: 114  

Re: [SOLVED] finding package for correct version of linux source

you may find the headers linux-headers-4.19.0-9-amd64 and "common" (and other versions) off the Beowulf 3.1 dvd here

.../pool/DEBIAN/main/l/linux/linux-headers-4.19.0-9-amd64_4.19.118-2_amd64.deb
.../pool/DEBIAN/main/l/linux/linux-headers-4.19.0-9-common_4.19.118-2_all.deb

updated versions here,
.../pool/DEBIAN/main/l/linux-latest/linux-headers-amd64_4.19+105+deb10u9_amd64.deb (but not the "common"...)

linux-images in here (.deb and .udeb)
.../pool/DEBIAN/main/l/linux-signed-amd64/

hope this helps you for next time. All the best

Offline

#10 2021-04-04 11:06:19

Bill Evans
Member
Registered: 2020-08-06
Posts: 18  

Re: [SOLVED] finding package for correct version of linux source

Glenn, the solution I posted looks rather complex, but it's at least straightforward, to the point where all the grunt work can be reduced to a script of some sort; my weapon of choice is python, but YKMV. The beauty of this is that once everything's in a script, it doesn't matter where linux-headers or anything else is on the DVD; the script will find it. But it's always nice to know a little more about the layout of the DVD, so thanks.

Offline

Board footer