[SOLVED]How can I delete and install kernels safely?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

[SOLVED]How can I delete and install kernels safely?

Post by alro7779 »

Hey, guys!

I'm having random freezing problems, and I think it might be due to the Liquorix kernel I'm using since my hardware is not the newest one. So I've been thinking on uninstalling it and use the default 5.4 instead. If a go to Update Manager, I can't see the Liquorix kernel there, so I don't know a safety way to uninstall it. Could you please tell me how I must proceed?

Code: Select all

$ inxi -Fxzr
System:
  Kernel: 5.14.0-6.2-liquorix-amd64 x86_64 bits: 64 compiler: N/A 
  Desktop: Xfce 4.16.0 Distro: Linux Mint 20.2 Uma base: Ubuntu 20.04 focal 
Machine:
  Type: Desktop Mobo: ASRock model: B450M Pro4-F serial: <filter> 
  UEFI [Legacy]: American Megatrends v: P2.20 date: 07/27/2020 
CPU:
  Topology: Quad Core model: AMD Ryzen 3 1300X bits: 64 type: MCP arch: Zen 
  rev: 1 L2 cache: 2048 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 27944 
  Speed: 1375 MHz min/max: 1550/3500 MHz Core speeds (MHz): 1: 1375 2: 1552 
  3: 1438 4: 1375 
Graphics:
  Device-1: NVIDIA GP107 [GeForce GTX 1050] vendor: Gigabyte driver: nvidia 
  v: 470.63.01 bus ID: 06:00.0 
  Display: x11 server: X.Org 1.20.11 driver: nvidia 
  unloaded: fbdev,modesetting,nouveau,vesa resolution: 1360x768~60Hz 
  OpenGL: renderer: NVIDIA GeForce GTX 1050/PCIe/SSE2 
  v: 4.6.0 NVIDIA 470.63.01 direct render: Yes 
Audio:
  Device-1: NVIDIA GP107GL High Definition Audio vendor: Gigabyte 
  driver: snd_hda_intel v: kernel bus ID: 06:00.1 
  Device-2: AMD Family 17h HD Audio vendor: ASRock driver: snd_hda_intel 
  v: kernel bus ID: 08:00.3 
  Sound Server: ALSA v: k5.14.0-6.2-liquorix-amd64 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: ASRock driver: r8169 v: kernel port: f000 bus ID: 04:00.0 
  IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:
  Local Storage: total: 1.14 TiB used: 31.51 GiB (2.7%) 
  ID-1: /dev/sda vendor: Western Digital model: WD10EZEX-08WN4A0 
  size: 931.51 GiB 
  ID-2: /dev/sdb vendor: A-Data model: SU800NS38 size: 238.47 GiB 
Partition:
  ID-1: / size: 90.71 GiB used: 31.51 GiB (34.7%) fs: ext4 dev: /dev/sdb6 
Sensors:
  System Temperatures: cpu: 53.1 C mobo: N/A gpu: nvidia temp: 49 C 
  Fan Speeds (RPM): N/A gpu: nvidia fan: 0% 
Repos:
  No active apt repos in: /etc/apt/sources.list 
  No active apt repos in: /etc/apt/sources.list.d/damentz-liquorix-focal.list 
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 
  1: deb http://packages.linuxmint.com uma main upstream import backport
  2: deb http://mirror.lstn.net/ubuntu focal main restricted universe multiverse
  3: deb http://mirror.lstn.net/ubuntu focal-updates main restricted universe multiverse
  4: deb http://mirror.lstn.net/ubuntu focal-backports main restricted universe multiverse
  5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
  6: deb http://archive.canonical.com/ubuntu/ focal partner
Info:
  Processes: 234 Uptime: 2h 05m Memory: 15.57 GiB used: 2.00 GiB (12.8%) 
  Init: systemd runlevel: 5 Compilers: gcc: 9.3.0 Shell: bash v: 5.0.17 
  inxi: 3.0.38
Thanks in advance!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

If you in a terminal run apt search $(uname -r) you supposedly see a bunch of linux-*-5.14.0-6.2-liquorix-* packages installed (i.e., with an "i" in the first column). You'd get rid of them by

Code: Select all

sudo apt-get purge --autoremove "linux-*-5.14.0-6.2-liquorix-*"
and rebooting into your then newest installed kernel.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

Thanks for your reply!
This is what I get typing that command:

Code: Select all

$ apt search $(uname -r)
i A linux-headers-5.14.0-6.2-liquor - Header files for Linux 5.14.0-6.2-liquorix
i A linux-image-5.14.0-6.2-liquorix - Linux 5.14 for 64-bit PCs
Notice that the headers kernel is ending with liquor only... should I remove them one by one then?
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

I actually expect that if you drag the right edge of your terminal a bit to the right you will see there's not a difference (and that also that second one wasn't complete). The command as given should work then.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

Code: Select all

$ sudo apt-get purge --autoremove "linux-*-5.14.0-6.2-liquorix-*"
[sudo] password for alejandro:                 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'linux-headers-5.14.0-6.2-liquorix-amd64' for glob 'linux-*-5.14.0-6.2-liquorix-*'
Note, selecting 'linux-image-5.14.0-6.2-liquorix-amd64' for glob 'linux-*-5.14.0-6.2-liquorix-*'
The following packages will be REMOVED:
  libelf-dev* linux-headers-5.14.0-6.2-liquorix-amd64* linux-headers-5.4.0-84* linux-headers-5.4.0-84-generic* linux-headers-liquorix-amd64*
  linux-image-5.14.0-6.2-liquorix-amd64* linux-image-5.4.0-84-generic* linux-image-liquorix-amd64* linux-modules-5.4.0-84-generic*
  linux-modules-extra-5.4.0-84-generic* zlib1g-dev*
0 upgraded, 0 newly installed, 11 to remove and 0 not upgraded.
After this operation, 781 MB disk space will be freed.
Do you want to continue? [Y/n] 
So I can press enter key with no worries?
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

Yes. The extra packages that you see being removed are due to the --autoremove. This in this case includes the 5.4.0-84 kernel, but that's supposedly since you have the 5.4.0-86 one installed by now; sure, hit y.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

Code: Select all

$ sudo apt-get purge --autoremove "linux-*-5.14.0-6.2-liquorix-*"
[sudo] password for alejandro:                 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'linux-image-5.14.0-6.2-liquorix-amd64' for glob 'linux-*-5.14.0-6.2-liquorix-*'
The following packages will be REMOVED:
  linux-image-5.14.0-6.2-liquorix-amd64*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 327 MB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 337648 files and directories currently installed.)
Removing linux-image-5.14.0-6.2-liquorix-amd64 (5.14-2ubuntu1~focal) ...
E: Aborting removal of the running kernel
dpkg: error processing package linux-image-5.14.0-6.2-liquorix-amd64 (--remove):
 installed linux-image-5.14.0-6.2-liquorix-amd64 package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.14.0-6.2-liquorix-amd64
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
I've done that for the second time since it has an error... but now the same.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

alro7779 wrote: Fri Sep 24, 2021 4:50 pm

Code: Select all

Removing linux-image-5.14.0-6.2-liquorix-amd64 (5.14-2ubuntu1~focal) ...
E: Aborting removal of the running kernel
dpkg: error processing package linux-image-5.14.0-6.2-liquorix-amd64 (--remove):
 installed linux-image-5.14.0-6.2-liquorix-amd64 package pre-removal script subprocess returned error exit status 1
Seriously? Standard Ubuntu kernels can be simply removed even if currently running in that manner; "liqourix" is being hand-holdy here.

It's in any case to say you 'll first need to boot into another kernel. You do so by from the Grub menu picking Advanced options and selecting a previous kernel, then when booted into that remove that liquorix kernel again as per above.
motoryzen
Level 10
Level 10
Posts: 3450
Joined: Sun Dec 08, 2019 12:25 am

Re: How can I delete and install kernels safely?

Post by motoryzen »

It's in any case to say you 'll first need to boot into another kernel. You do so by from the Grub menu picking Advanced options and selecting a previous kernel, then when booted into that remove that liquorix kernel again as per above
rene is correct here.

I want to say the keyboard hotkey to select Grub advanced options screen/menu should be still the same . It's either Esc or Shift key if I'm not mistaken
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

When I just now as a test removed my own running kernel on 20.2 things got a bit more hand-holdy than I remember as well by way, although in that case I got at least a Y/n choice in a text UI rather than flatout no as from the liquorix pre-remove script. Any case...

Yes; in a multi-boot situation you get the Grub menu automatically; if not, holding Left-Shift on a legacy system at the point the boot transitions from BIOS to disk; tapping Esc on a UEFI one at said same point.

[EDIT] From the length of time poster is gone one wonders if something went wrong...
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

rene wrote: Fri Sep 24, 2021 5:00 pmIt's in any case to say you 'll first need to boot into another kernel.
I did that and after putting the command, this time everything was fine... no errors. Thanks, man! Now I hope that using this kernel I won't have that freezing problem again.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

You probably will; I believe it's a fairly standard problem on some Zen 1 systems. You may want to try in your BIOS:

https://download.asrock.com/Manual/B450M%20Pro4-F.pdf

1. Advanced -> CPU Configuration -> Cool 'n Quiet : Disable.
2. Advanced -> South Bridge Configuration -> Deep Sleep: Enable
3. Advanced -> AMD CBS -> Zen Common Options -> Global C-state Control : try and disable C6 if possible there; manual is not verbose enough as to options

or any subset thereof (and/or perhaps e.g. disabling Deep Sleep if already enabled).

There's also a newer BIOS available (2.80). I'd try that, even if Asrock is not recommending it for your CPU; your current 2.20 also already is not, so, oh well.

If you can't get things sorted BIOS-sides, I believe you will need: https://github.com/r4m0n/ZenStates-Linux and run

Code: Select all

/where/ever/zenstates.py --c6-disable
first just manually to test things and if functional, through a startup script.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

rene wrote: Fri Sep 24, 2021 8:15 pm You probably will; I believe it's a fairly standard problem on some Zen 1 systems. You may want to try in your BIOS:

https://download.asrock.com/Manual/B450M%20Pro4-F.pdf

1. Advanced -> CPU Configuration -> Cool 'n Quiet : Disable.
2. Advanced -> South Bridge Configuration -> Deep Sleep: Enable
3. Advanced -> AMD CBS -> Zen Common Options -> Global C-state Control : try and disable C6 if possible there; manual is not verbose enough as to options

or any subset thereof (and/or perhaps e.g. disabling Deep Sleep if already enabled).
This is what I got on my BIOS:
  • Cool 'n Quiet: I couldn't find it
    Deep Sleep: Is disabled
    AMD CBS/CPU Common Options/Global C-State Control: Auto (Disabled, Enabled and Auto)
rene wrote: Fri Sep 24, 2021 8:15 pmThere's also a newer BIOS available (2.80). I'd try that, even if Asrock is not recommending it for your CPU; your current 2.20 also already is not, so, oh well.
I'll try that.Thanks!
rene wrote: Fri Sep 24, 2021 8:15 pmIf you can't get things sorted BIOS-sides, I believe you will need: https://github.com/r4m0n/ZenStates-Linux and run

Code: Select all

/where/ever/zenstates.py --c6-disable
first just manually to test things and if functional, through a startup script.
I'll check that link out. Thanks!
Last edited by alro7779 on Sat Sep 25, 2021 12:19 am, edited 2 times in total.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

alro7779 wrote: Fri Sep 24, 2021 9:38 pm
  • Cool 'n Quiet: I couldn't find it
    Deep Sleep: Is disabled
    AMD CBS/CPU Common Options/Global C-State Control: Auto (Disabled, Enabled and Auto)
That Deep Sleep thing, being a South Bridge option, is the by far most unlikely to help and enabling it doubly, but I noticed someone saying it did at some point, so, well, you can always try I guess. Disabling "Cool 'n Quiet" and/or C6 directly was far more likely to help but it seems you can't either then. Nothing specifically concerning C6 in your Advanced options anywhere?

Perhaps a "Power Supply Idle Control" (AMD CBS -> CPU/Zen Common options most likely) option that you can set to "Typical current idle"? If yes, then that's the exact one you're looking for.

C-states are CPU idle power states with C0 being full on and higher numbers denoting ever deeper sleep states on idle. The issue you (or Zen 1 generally at least) experience(d) is that Linux has/had the CPU fall into the very deep sleep C6 state on idle too frequently, causing said frequent freezing. Admittedly I would be wondering why Linux wouldn't have fixed this kernel-sides already if indeed, but, who knows...

If you have definitively no option for disabling C6 in the BIOS that linked zenstates.py tool should be useful, and I believe you can also boot with the processor.max_cstate=5 kernel parameter for a slightly less focussed version of the same; that with =1 for a much less. To pass a kernel parameter please see viewtopic.php?f=42&t=349669
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

I'm moving this message from my last reply in here...

EDIT: I went to Suspend Mode, and after an hour or so, pressing any key for waking up the system the screen doesn't respond, and it's blank... even though the keyboard and mouse responded, but I had to reboot the system by pressing Ctrl+Alt+Del. I suppose now it has to do with BIOS upgrade or changing those mentioned options? Maybe installing the kernel 5.11 could resolve the issue too? What do you think I should do first?

I'll read your last reply, rene, as soon as possible. Thanks!
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

And I take it then you are certain that it didn't use to do that. Yes, that Southbridge "Deep Sleep" option, if it was disabled and you now enabled it, would supposedly be something that could be related. Cool 'n Quiet you didn't have, and I don't believe you did anything with that Global C-state Control option? Even if you did; doesn't sound like it would matter --- but as said, that Deep Sleep one probably could.

Upgrading kernel is (almost) never a bad idea, but mixing too many changes is at the very least in the sense of diagnosis; sure, if some more initial poking around in the BIOS doesn't show anything sensible, certainly feel free, but perhaps first try if you can pin things down further. It's not the case that 5.11 would/could be expected to fix the Zen idle-state thing if 5.4 hadn't yet --- I'd say. And that suspend thing is indeed likely a matter of that Deep Sleep option now having been enabled.

Suppose it's also a bit dependent on how quickly you can reproduce freezes and/or be "sure" they're gone.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

The "Sleep mode" option is disabled, and I didn't touch it. So, if the problem with "Suspend mode" persists, must be related to another thing, I suppose.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

By "Sleep mode option" I take it you refer to the BIOS option "Deep Sleep" and by "Suspend mode" to making the computer suspend through the operating system.

Well, yes, if you didn't change any options then clearly they're not related to a suspend issue; a BIOS update which you seemingly did do is also quite unlikely so frankly I'm not too sure this wasn't "always" (or at least since some time) the case.

As to the issue at hand, to try:

1. Look for that "Power Supply Idle Control" or alike option with possibility "Typical current idle" or alilke.

If not available or not helped

2. Boot with the processor.max_cstate=5 or processor.max_cstate=1 parameter as per linked post.

If not helped

3. Download that zenstates.py script and run e.g. python ~/Downloads/zenstates.py --c6-disable

If helped

4. Arrange for said script to be run automatically each boot; we'll get to that then.

[EDIT] Oh, and stick a "upgrade to kernel 5.11" somewhere in between; doubt it'll do much for the freezes if they still happen on 5.4; perhaps the suspend issue.
alro7779
Level 1
Level 1
Posts: 20
Joined: Fri Aug 27, 2021 12:18 pm

Re: How can I delete and install kernels safely?

Post by alro7779 »

I went to Asrock support page, and on the previous BIOS version 2.10 says:

*ASRock do NOT recommend updating this BIOS if Pinnacle, Raven or Summit Ridge CPU is being used on your system.

https://www.asrock.com/MB/AMD/B450M%20P ... x.asp#BIOS

I got the Ryzen 3 1300X Summit Ridge, and from BIOS 1.60 version says the same! So, I'm not using a BIOS version recommended by Asrock?
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: How can I delete and install kernels safely?

Post by rene »

I alluded to that Asrock recommendation above, yes. I don't expect it actually means much; it was/is a common issue that supporting newer Zen architecture level CPUs by a board requires fairly significant space in the BIOS; that some boards for example could not get up to the 5000 series due to that issue alone.

Asrock might just be saying that first gen users such as you have no use for those newest BIOS versions. Yes, possibly also that some features of older BIOSen may have been scrapped to make room --- but I doubt it, and even if so then certainly doubt it would be anything significant. And as such, as said, given that you're on 2.20 already might as well try 2.80. Commonly it's not possible to downgrade BIOS but if in this case it is you could try 1.50 --- and I expect neither to do anything for your freeze problem.

See above for the things I do expect can be useful; if you'd want to try and solve things you'd supposedly try some, or if you do/did. be clearer on what it is you do/did and did not.
Locked

Return to “Xfce”