Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspbian has 2 kernel Image files. #146

Closed
takichikawa opened this issue Apr 9, 2019 · 15 comments
Closed

Raspbian has 2 kernel Image files. #146

takichikawa opened this issue Apr 9, 2019 · 15 comments
Milestone

Comments

@takichikawa
Copy link

Raspbian(debian/ubuntu) has 2 kernel Image files.

# dpkg -L raspberrypi-kernel | grep "/boot/.*\.img"
/boot/kernel.img
/boot/kernel7.img

https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md

  • kernel.img (For Pi 1, Pi Zero)
    --> "4.14.98+"
  • kernel7.img (For Pi 2, Pi 3)
    --> "4.14.98-v7+"

When Boot it select, able to OS SDcard change to other Raspi.
But, I only use Raspberry Pi(1 B+),

# needrestart -b
NEEDRESTART-VER: 2.11
NEEDRESTART-KCUR: 4.14.98+
NEEDRESTART-KEXP: 4.14.98-v7+
NEEDRESTART-KSTA: 3

Then, I do "mv /boot/kernel7.img /boot/kernel7.img.unused", every kernel package update.
Can't do it better?
( /perl5/NeedRestart/Kernel/Linux.pm nr_kernel_check_real )

@liske
Copy link
Owner

liske commented Apr 13, 2019

I don't think there is a generic way of filtering kernel images which are incompatible. It might be possible to add a configuration option for white or blacklisting kernel images.

@liske liske added this to the v3.5 milestone Apr 13, 2019
@jplitza
Copy link
Contributor

jplitza commented Jun 24, 2019

For the moment, one might want to install something like the following in /etc/kernel/postinst.d/remove-unnecessary:

#!/bin/sh

version="$1"
file="$2"

if [ -n "$file" ] && [ "$file" != "/boot/kernel.img" ]; then
  rm -f "$file"
fi

@takichikawa
Copy link
Author

It is not the fault of this command. sorry.

I am sloth. :-)
In RaspberryPi, one SD card with Raspbian installed as MASTER can copy for multiple hardwares.
Then, for example, RaspberryPi ZeroW automatically uses "kernel.img", and RaspberryPi 3B + automatically uses "kernel7.img".

And when the 3B+ troubled, same SD card used by 3B+ can be boot as it is for ZeroW.
but

 root@raspberrypi3p:~# needrestart -b
 NEEDRESTART-VER: 2.11
 NEEDRESTART-KCUR: 4.19.42-v7+
 NEEDRESTART-KEXP: 4.19.42-v7+
 NEEDRESTART-KSTA: 1
 root@raspberrypi3p:~#

boot same SD card.

 root@raspberrypi0w:~# needrestart -b
 NEEDRESTART-VER: 2.11
 NEEDRESTART-KCUR: 4.19.42+
 NEEDRESTART-KEXP: 4.19.42-v7+
 NEEDRESTART-KSTA: 3
 root@raspberrypi0w:~#

RaspberryPi / Raspbian may not ordinary . but
It is nice to be able to judge the kernel image depending on the environment occasion.

Another just amateur idea
Linux.pm: $iversion =~ s/-v7//s;
but also maybe "-v8" and future "-v9" ...

... not have to consider it.

@iandstanley
Copy link

This is still an issue as the default behaviour of needrestart is to put up a MODAL DIALOG box breaking automation scripts used in modern administration

The error then occurs after every install if a package forcing the admin to sit in front of the screen and manually press enter after every single package install.

It wouldn’t be such a problem if this was a rarely used script but it is a dependency on docker and some other big names in the Linux world

I would give a patch but I can’t get my head around Perl and would probably cause more damage than I fix.

Could I suggest than before comparing the Kernel files you Just regex for only the kernel version number and drop off the -v* at the end

Alternatively you could change the default behaviour to report to standard error and not dialog box

@licaon-kter
Copy link

Still and issue on RPi1

The currently running kernel version is 5.10.11+ which is not the expected kernel version 5.10.11-v7+. 

@Tuffiglig
Copy link

Tuffiglig commented Feb 15, 2021

Other models as well.

Raspberry Pi Model B Rev 2 & Raspberry Pi Model B Plus Rev 1.2:

NEEDRESTART-KCUR: 5.10.11+
NEEDRESTART-KEXP: 5.10.11-v8+

Raspberry Pi 3 Model B Rev 1.2:

NEEDRESTART-KCUR: 5.10.11-v7+
NEEDRESTART-KEXP: 5.10.11-v8

Raspberry Pi 4 Model B Rev 1.1:

NEEDRESTART-KCUR: 5.10.11-v7l+
NEEDRESTART-KEXP: 5.10.11-v8+

@licaon-kter
Copy link

@Tuffiglig yes and no, those could run the other kernel, but not on RPi1 ;)

@GRArmstrong
Copy link

GRArmstrong commented Feb 24, 2021

Still and issue on RPi1

The currently running kernel version is 5.10.11+ which is not the expected kernel version 5.10.11-v7+. 

Got this issue as well on my Pi 3b, I've just removed the needrestart package to get rid of the error. ¯\_(ツ)_/¯

@licaon-kter
Copy link

There's a config option that moves this to a warning line.

@llucax
Copy link

llucax commented Feb 25, 2021

Any further details on how to fix this issue by changing a config file? Which config file is it? What should be added/removed/changed?

@licaon-kter
Copy link

/etc/needrestart/needrestart.conf uncomment and set $nrconf {kernelhints} = -1

@llucax
Copy link

llucax commented Feb 26, 2021

Thanks. This is just a mitigation, right? You'll stop getting the false positives (warnings about a new kernel that is not really there) but you'll also start "getting" false negatives (never getting notified when a real new kernel was installed and a restart is really needed) or am I missing something?

@shutterfreak
Copy link

shutterfreak commented May 19, 2021

Ideally there would be a simple way to override the default kernel image checker code. On raspbian you could then ditch the '-v7+' / '-v8+' tail fragment of the kernel identifier before comparing the kernel versions.

Alternatively, you could tell needrestart to either look only at 'v7+' kernel images when running in 32-bit mode (v8 for 64-bit mode), or conversely to disregard 'irrelevant' kernel image identifiers. Either can easily be implemented with a regex pattern.

@liske
Copy link
Owner

liske commented Sep 18, 2021

It should be possible to add some perl code to needrestart.conf on Raspian setting the filter accordingly. Since it is Raspian specific it is not part of the upstream config. So it sounds like an packaging issue.

@azlux
Copy link

azlux commented Dec 20, 2022

Look at https://github.com/liske/needrestart/blob/master/README.raspberry.md , the filter is documented here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants