Giter Site home page Giter Site logo

kernelstub's Introduction

Kernelstub

The automatic manager for booting Linux on (U)EFI.

Kernelstub is a utility to automatically manage your OS's EFI System Partition (ESP). It makes it simple to copy the current kernel and initramfs image onto the ESP so that they are automatically probable by most EFI boot loaders as well as the EFI firmware itself. It can also set up the system's NVRAM to add entries to the firmware boot menu for the kernel (and keep these options up to date when new kernel versions are installed).

Installation

Installation can be handled through the supplied Debian packaging as well as the python packaging. If kernelstub is packaged in your distro's repositories, you can install kernelstub through the kernelstub package.

To build a debian package locally, first install the build dependencies. On Pop!_OS, you can install the build dependencies using this command:

sudo apt build-dep kernelstub

Otherwise, you will need to install the following packages:

python3-all
pyflakes3
debhelper (>= 7.4.3)
dh-python

Then use these commands to build the package:

git clone https://github.com/pop-os/kernelstub
cd kernelstub
dpkg-buildpackage -b -us -uc
sudo dpkg -i ../kernelstub*.deb

For installation on non-debian systems, or if you prefer to use Python packaging, use:

git clone https://github.com/pop-os/kernelstub
cd kernelstub
sudo python3 setup.py install --record=installed_files.txt

For your convenience, this will create a list of all files installed on the system in the installed_files.txt file, so that you can easily remove the package later.

Usage

Usage is fairly straightforward and usually only requires running the command as root with su/sudo. If your computer requires special kernel parameters to boot, you can specify them as such:

sudo kernelstub -o "options_go here wrapped in-quotes"

Running the command with -o will save the options used into the user section of the configuration file (see Configuration below) so that you don't need to specify them manually each time you run it.

Kernelstub assumes the quiet splash options by default, since these generally work on every system, at least for booting up to a usable system.

You can get output of the program using the -v/--verbose option. There are three levels of verbosity. The default is to only show Warning, Error, and Critical failure messages. With one -v, kernelstub will display information about its progress to the command line. Two -v flags will also display debugging information generally only useful to developers.

By default, kernelstub will attempt to set up an entry in the system NVRAM to boot the kernel directly. If you want to use kernelstub with a separate program (e.g. bootctl/systemd-boot or rEFIt/rEFInd), you can use the -m flag. This causes kernelstub to copy the kernel and initrd into the ESP, but not set up any NVRAM entries. The -l option also explicitly sets up the configuration for system-boot or gummiboot. These options are also stored in the config file.

There are other options as well, as detailed below:

Option Action
-h, --help Display the help Text
-c, --dry-run Don't actually copy any files or set anything up.
-p, --print-config Print the current configuration and exit.
Path Options
-r <path>, --root-path <path> Manually specify the root filesystem path.
-e <path>, --esp-path <path> Manually specify the ESP path.*
-k <path>, --kernel-path <path> Manually specify the path to the kernel image.
-i <path>, --initrd-path <path> Manually specify the path to the initrd image.
Kernel Parameters
-o <options>,--options <options> Set kernel boot options.*
-a <options> ,`--add-options Adds new options to the list of kernel boot options.*⁺
-d <options> ,`--delete-options Remove options from the list of kernel boot options.*⁺
Output/logging Options
-v, --verbose Display more information to the command line
-g <log>,--log-file <log> Where to save the log file.
Behavior Options
-l, --loader Create a systemd-boot-compatible loader config.*
-n, --no-loader Turns off creating the loader configuration.
-s, --stub Set up NVRAM entries for the copied kernel.
-m, --manage-only Don't set up any NVRAM entries.*
-f, --force-update Forcefully update the main loader.conf.**

*These options save information to the config file.

**This may overwrite another OS's information.

⁺Does not add options if they are already present in the configuration, or remove options if they are not present. Each option is checked individually.

Configuration

Kernelstub has a robust configuration system with multiple fallbacks for safety. By default, a sample (non-functional) configuration file is provided in /etc/kernelstub/SAMPLE which demonstrates the available options and the JSON syntax. The main configuration file is stored in /etc/kernelstub/configuration, which is created by default if it doesn't exist. Kernelstub also has a copy of the default configuration stored internally, so that it can create a config file if none already exists.

When kernelstub is run with the -o, -l, -s, or -m options, this is recorded in the config file so that future automatic runs or runs without options will work correctly. Options specified on the command line always take precedence over options in the config files.

Your distribution or package maintainer may additionally create a configuration template in /etc/default/kernelstub. This should not be edited except by maintaners. Use the standard config file instead, as this will be loaded instead of the distributor file if it exists, and options will never be saved to the distributor file.

Return codes

If kernelstub is going to be used in a scripted environment, it is useful to know what return codes it provides in the event of errors. The table below details these codes and their meaning:

Exit Code Meaning
0 Success
166 The kernel path supplied/detected was invalid
167 The initrd path supplied/detected was invalid
168 No kernel options found/supplied
169 Malformed configuration found
170 Couldn't copy kernel image to ESP
171 Couldn't copy initrd image to ESP
172 Couldn't create a new NVRAM entry
173 Couldn't remove an old NVRAM entry
174 Couldn't detect the block device file for the root partition
175 Coundn't detect the block device file for the ESP
176 Wasn't run as root
177 Couldn't get a required UUID

Licence

Kernelstub is available under an COLPL + ISC-based license. The full license is supplied in the LICENSE.txt file.

Copyright 2017-2018 Ian Santopietro [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

kernelstub's People

Contributors

13r0ck avatar inzar98 avatar isantop avatar jackpot51 avatar mmstick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kernelstub's Issues

Can't install the new Linux kernel and new initramfs?

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):
linux-image-6.0.6-76060006-generic:
Installed: 6.0.6-76060006.202210290932166906205022.04d94609a
Candidate: 6.0.6-76060006.202210290932
166906205022.04d94609a
Version table:
*** 6.0.6-76060006.202210290932166906205022.04~d94609a 1001
1001 http://apt.pop-os.org/release jammy/main amd64 Packages
100 /var/lib/dpkg/status

Issue/Bug Description:
For some reason, I cannot update the new Linux kernel. I have not had problems doing it before, but now this time, it errors out on me saying it cannot copy the Kernel to the ESP. I have tried some of the steps at the package manager issues page to no avail and the dev on Discord who tried fixing it sent me here to report it if that failed. Additionally, the laptop said I had nothing to boot from and so I had to go to the boot menu and launch the old kernel. I have no idea what went wrong so I'm reporting it here to see if someone will help me get this working or fix this bug.

Steps to reproduce (if you know):

Run sudo apt upgrade

Expected behavior:

Successfully compile and install the kernel and initramfs

Other Notes:
I am using a Dell XPS 7590.
Here are the logs from when I ran sudo apt upgrade -f.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-6.0.6-76060006-generic (6.0.6-76060006.202210290932~1669062050~22.04~d94609a) ...
Setting up initramfs-tools (0.140ubuntu13) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for linux-image-6.0.6-76060006-generic (6.0.6-76060006.202210290932~1669062050~22.04~d94609a) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 6.0.6-76060006-generic
Error! The /var/lib/dkms/wireguard/1.0.20210606/6.0.6-76060006-generic/x86_64/dkms.conf for module wireguard includes a BUILD_EXCLUSIVE directive which does not
 match this kernel/arch.
This indicates that it should not be built.
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.0.6-76060006-generic
cryptsetup: WARNING: Resume target cryptswap uses a key file
kernelstub.Config    : INFO     Looking for configuration...
kernelstub           : INFO     System information: 

    OS:..................Pop!_OS 22.04
    Root partition:....../dev/dm-1
    Root FS UUID:........eb92492b-ba9f-476f-a91b-57e33582ae33
    ESP Path:............/boot/efi
    ESP Partition:......./dev/nvme0n1p1
    ESP Partition #:.....1
    NVRAM entry #:.......-1
    Boot Variable #:.....0000
    Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash
    Kernel Image Path:.../boot/vmlinuz-6.0.6-76060006-generic
    Initrd Image Path:.../boot/initrd.img-6.0.6-76060006-generic
    Force-overwrite:.....False

kernelstub.Installer : INFO     Copying Kernel into ESP
kernelstub.Installer : ERROR    Couldn't copy the kernel onto the ESP!
This is a critical error and we cannot continue. Check your settings to see if t
here is a typo. Otherwise, check permissions and try again.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 271, in co
py_files
    shutil.copy(src, dest)
  File "/usr/lib/python3.10/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.10/shutil.py", line 256, in copyfile
    with open(dst, 'wb') as fdst:
OSError: [Errno 30] Read-only file system: '/boot/efi/EFI/Pop_OS-eb92492b-ba9f-4
76f-a91b-57e33582ae33/vmlinuz.efi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 128, in se
tup_kernel
    self.copy_files(
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 275, in co
py_files
    raise FileOpsError("Could not copy one or more files.")
kernelstub.installer.FileOpsError: Could not copy one or more files.
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 1
70
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-6.0.6-76060006-generic (--configure):
 installed linux-image-6.0.6-76060006-generic package post-installation script s
ubprocess returned error exit status 1
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-6.0.6-76060006-generic
cryptsetup: WARNING: Resume target cryptswap uses a key file
kernelstub.Config    : INFO     Looking for configuration...
kernelstub           : INFO     System information: 

    OS:..................Pop!_OS 22.04
    Root partition:....../dev/dm-1
    Root FS UUID:........eb92492b-ba9f-476f-a91b-57e33582ae33
    ESP Path:............/boot/efi
    ESP Partition:......./dev/nvme0n1p1
    ESP Partition #:.....1
    NVRAM entry #:.......-1
    Boot Variable #:.....0000
    Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash
    Kernel Image Path:.../boot/vmlinuz-6.0.6-76060006-generic
    Initrd Image Path:.../boot/initrd.img-6.0.6-76060006-generic
    Force-overwrite:.....False

kernelstub.Installer : INFO     Copying Kernel into ESP
kernelstub.Installer : ERROR    Couldn't copy the kernel onto the ESP!
This is a critical error and we cannot continue. Check your settings to see if t
here is a typo. Otherwise, check permissions and try again.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 271, in co
py_files
    shutil.copy(src, dest)
  File "/usr/lib/python3.10/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.10/shutil.py", line 256, in copyfile
    with open(dst, 'wb') as fdst:
OSError: [Errno 30] Read-only file system: '/boot/efi/EFI/Pop_OS-eb92492b-ba9f-4
76f-a91b-57e33582ae33/vmlinuz.efi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 128, in se
tup_kernel
    self.copy_files(
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 275, in co
py_files
    raise FileOpsError("Could not copy one or more files.")
kernelstub.installer.FileOpsError: Could not copy one or more files.
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 1
70
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned 
error exit status 1
Errors were encountered while processing:
 linux-image-6.0.6-76060006-generic
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

Correction on installation command in Readme

Correction for command under Installation using Python
"sudo python3 setup.py install --record > installed_files.txt" should be "sudo python3 setup.py install --record = installed_files.txt"
(replace ">" with "=")

Tested on: Pop OS 20.04, Python 3.8

ModuleNotFoundError: No module named 'debian'

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="21.04"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 21.04"
VERSION_ID="21.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=hirsute
UBUNTU_CODENAME=hirsute
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

kernelstub:
  Installato: 3.1.4~1631911584~21.04~de5b292
  Candidato:  3.1.4~1631911584~21.04~de5b292
  Tabella versione:
 *** 3.1.4~1631911584~21.04~de5b292 1001
       1001 http://ppa.launchpad.net/system76/pop/ubuntu hirsute/main amd64 Packages
       1001 http://ppa.launchpad.net/system76/pop/ubuntu hirsute/main i386 Packages
        100 /var/lib/dpkg/status

Issue/Bug Description:

✗  sudo apt dist-upgrade
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze... Fatto
Lettura informazioni sullo stato... Fatto
Calcolo dell'aggiornamento... Fatto
0 aggiornati, 0 installati, 0 da rimuovere e 0 non aggiornati.
2 non completamente installati o rimossi.
Dopo quest'operazione, verranno occupati 0 B di spazio su disco.
Continuare? [S/n] S
Configurazione di initramfs-tools (0.139ubuntu3)...
update-initramfs: deferring update (trigger activated)
Configurazione di kernelstub (3.1.4~1631911584~21.04~de5b292)...
Traceback (most recent call last):
  File "/usr/bin/kernelstub", line 44, in <module>
    from kernelstub import application
  File "/usr/lib/python3/dist-packages/kernelstub/application.py", line 59, in <module>
    from . import kernel_option as KernelOption
  File "/usr/lib/python3/dist-packages/kernelstub/kernel_option.py", line 3, in <module>
    from debian.changelog import Version
ModuleNotFoundError: No module named 'debian'
dpkg: errore nell'elaborare il pacchetto kernelstub (--configure):
 il sottoprocesso installato pacchetto kernelstub script post-installation ha restituito lo stato di errore 1
Elaborazione dei trigger per initramfs-tools (0.139ubuntu3)...
update-initramfs: Generating /boot/initrd.img-5.13.0-7614-generic
cryptsetup: WARNING: Resume target cryptswap uses a key file
Traceback (most recent call last):
  File "/usr/bin/kernelstub", line 44, in <module>
    from kernelstub import application
  File "/usr/lib/python3/dist-packages/kernelstub/application.py", line 59, in <module>
    from . import kernel_option as KernelOption
  File "/usr/lib/python3/dist-packages/kernelstub/kernel_option.py", line 3, in <module>
    from debian.changelog import Version
ModuleNotFoundError: No module named 'debian'
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 1
dpkg: errore nell'elaborare il pacchetto initramfs-tools (--configure):
 il sottoprocesso installato pacchetto initramfs-tools script post-installation ha restituito lo stato di errore 1
Si sono verificati degli errori nell'elaborazione:
 kernelstub
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

Steps to reproduce (if you know):
Simply tried to upgrade the system.

Expected behavior:
Should upgrade as always.

Other Notes:

`oldkern` no longer a safe fallback after updating kernel

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

kernelstub:
  Installed: 3.1.4~1674849051~22.04~851230b
  Candidate: 3.1.4~1674849051~22.04~851230b
  Version table:
 *** 3.1.4~1674849051~22.04~851230b 1001
       1001 http://apt.pop-os.org/release jammy/main amd64 Packages
       1001 http://apt.pop-os.org/release jammy/main i386 Packages
        100 /var/lib/dpkg/status

Issue/Bug Description:

Given the heuristics for determining the current and previous images, a broken kernel may end up in the oldkern image. This means it's possible to end up with both current and oldkern being broken if two successive kernel releases are broken on your hardware.

Steps to reproduce (if you know):

  • Boot into oldkern image.
  • Run uname -a and take note of kernel version
  • Update kernel packages. If you're lucky, sudo apt upgrade will do. If you already had the newest kernel installed such that this does not update linux-image-generic, there are a few options:
    • Use mainline to install a newer kernel
    • Add a kernel staging branch and update packages, for example:
    $ sudo apt-manage add popdev:linux-6.5.6
    $ sudo apt update
    $ sudo apt upgrade
    
  • Try to reboot into oldkern image. If successful, run uname -a and observe that it is different from before. Specifically, it's the version that was in the current image before the kernel upgrade.
  • Ponder the consequences of this if the reason you booted into oldkern in the first place were that current was broken for your hardware. Now, that broken kernel has been moved to oldkern and your reboot would have failed.
  • What if the kernel you just installed is also broken on your hardware? Now both bootloader entries point to broken images.

Expected behavior:

I would prefer if oldkern were a safe fallback that always points to an image that is known to boot successfully. In particular, I suggest the following heuristic:

  • If the image that's being put into current is different from the currently running image, put the currently running image in oldkern
  • Otherwise, don't touch oldkern at all

That way, the oldkern image will never be changed to a version that isn't proven to be bootable.

This is relevant because kernels that fail to boot on common hardware are still being released from time to time, see pop-os/pop#3152.

The "currently running" heuristic gets complicated when chrooting from a live USB or similar. Perhaps it's possible to instead identify which images in /boot have ever booted successfully? Or even better, have executed a successful shutdown.

Other Notes:

Related: #40, which anticipated this issue.

distutils is deprecated

Running python -Werror setup.py test on Python 3.10 or newer will generate this error:

DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

This was worked around temporarily in 4c42f32

Spaces between characters in kernel options

Seems the latest version of kernelstub has an issue with the way it is parsing arguments. Unsure on the cause at the moment, but each character in a word is getting a space between it. Currently looking into it.

@isantop

Examples

Hi there,
Can you please add examples to the kernelstub manual such as adding, removing and switching which is the "current" kernel. I find Pop-OS very difficult to manage kernels because it's its very different from how kernels are managed in Ubuntu. Also I've asked via the support channels several times and no one seems to know too much on the subject.

I actually used kernel-install to install and remove a kernel and I'd also like to know how that package works together with kernelstub

Use /boot/vmlinuz.old and /boot/initrd.img.old to get correct kernel and initrd paths for old boot entry

Distribution (run cat /etc/os-release):

$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="21.10"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 21.10"
VERSION_ID="21.10"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=impish
UBUNTU_CODENAME=impish
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

$ apt policy kernelstub
kernelstub:
  Installed: 3.1.4~1631911584~21.10~de5b292
  Candidate: 3.1.4~1631911584~21.10~de5b292
  Version table:
 *** 3.1.4~1631911584~21.10~de5b292 1001
       1001 http://apt.pop-os.org/release impish/main amd64 Packages
       1001 http://apt.pop-os.org/release impish/main i386 Packages
        100 /var/lib/dpkg/status

Issue/Bug Description:
Kernelstub generates two boot entries, one for the current kernel and one for the old kernel. Unfortunately, it appears there is no way to configure which kernel should be used for the old kernel boot entry and it's instead using whichever kernel was previously current (which is a good default). Instead, kernelstub should attempt to resolve old kernel similar to how it resolves current kernel when not manually specifed.

Steps to reproduce (if you know):

  1. symlink /boot/vmlinuz.old and /boot/initrd.old to 5.13.0-7614-generic
  2. run kernelstub

Expected behavior:
Old boot entry should run kernel 5.13.0-7614-generic

Other Notes:
Old boot entry runs kernel 5.15.11-76051511-generic

Relates to isantop#3

Can't install the new Linux kernel and new initramfs?

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):
linux-image-6.0.6-76060006-generic:
Installed: 6.0.6-76060006.202210290932166906205022.04d94609a
Candidate: 6.0.6-76060006.202210290932
166906205022.04d94609a
Version table:
*** 6.0.6-76060006.202210290932166906205022.04~d94609a 1001
1001 http://apt.pop-os.org/release jammy/main amd64 Packages
100 /var/lib/dpkg/status

Issue/Bug Description:
For some reason, I cannot update the new Linux kernel. I have not had problems doing it before, but now this time, it errors out on me saying it cannot copy the Kernel to the ESP. I have tried some of the steps at the package manager issues page to no avail and the dev on Discord who tried fixing it sent me here to report it if that failed. Additionally, the laptop said I had nothing to boot from and so I had to go to the boot menu and launch the old kernel. I have no idea what went wrong so I'm reporting it here to see if someone will help me get this working or fix this bug.

Steps to reproduce (if you know):

Run sudo apt upgrade

Expected behavior:

Successfully compile and install the kernel and initramfs

Other Notes:
I am using a Dell XPS 7590.
Here are the logs from when I ran sudo apt upgrade -f.

`
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-6.0.6-76060006-generic (6.0.6-76060006.202210290932166906205022.04d94609a) ...
Setting up initramfs-tools (0.140ubuntu13) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for linux-image-6.0.6-76060006-generic (6.0.6-76060006.202210290932
166906205022.04d94609a) ...
/etc/kernel/postinst.d/dkms:

  • dkms: running auto installation service for kernel 6.0.6-76060006-generic
    Error! The /var/lib/dkms/wireguard/1.0.20210606/6.0.6-76060006-generic/x86_64/dkms.conf for module wireguard includes a BUILD_EXCLUSIVE directive which does not
    match this kernel/arch.
    This indicates that it should not be built.
    ...done.
    /etc/kernel/postinst.d/initramfs-tools:
    update-initramfs: Generating /boot/initrd.img-6.0.6-76060006-generic
    cryptsetup: WARNING: Resume target cryptswap uses a key file
    kernelstub.Config : INFO Looking for configuration...
    kernelstub : INFO System information:

    OS:..................Pop!_OS 22.04
    Root partition:....../dev/dm-1
    Root FS UUID:........eb92492b-ba9f-476f-a91b-57e33582ae33
    ESP Path:............/boot/efi
    ESP Partition:......./dev/nvme0n1p1
    ESP Partition #:.....1
    NVRAM entry #:.......-1
    Boot Variable #:.....0000
    Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash
    Kernel Image Path:.../boot/vmlinuz-6.0.6-76060006-generic
    Initrd Image Path:.../boot/initrd.img-6.0.6-76060006-generic
    Force-overwrite:.....False

kernelstub.Installer : INFO Copying Kernel into ESP
kernelstub.Installer : ERROR Couldn't copy the kernel onto the ESP!
This is a critical error and we cannot continue. Check your settings to see if t
here is a typo. Otherwise, check permissions and try again.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 271, in co
py_files
shutil.copy(src, dest)
File "/usr/lib/python3.10/shutil.py", line 417, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.10/shutil.py", line 256, in copyfile
with open(dst, 'wb') as fdst:
OSError: [Errno 30] Read-only file system: '/boot/efi/EFI/Pop_OS-eb92492b-ba9f-4
76f-a91b-57e33582ae33/vmlinuz.efi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 128, in se
tup_kernel
self.copy_files(
File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 275, in co
py_files
raise FileOpsError("Could not copy one or more files.")
kernelstub.installer.FileOpsError: Could not copy one or more files.
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 1
70
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-6.0.6-76060006-generic (--configure):
installed linux-image-6.0.6-76060006-generic package post-installation script s
ubprocess returned error exit status 1
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-6.0.6-76060006-generic
cryptsetup: WARNING: Resume target cryptswap uses a key file
kernelstub.Config : INFO Looking for configuration...
kernelstub : INFO System information:

OS:..................Pop!_OS 22.04
Root partition:....../dev/dm-1
Root FS UUID:........eb92492b-ba9f-476f-a91b-57e33582ae33
ESP Path:............/boot/efi
ESP Partition:......./dev/nvme0n1p1
ESP Partition #:.....1
NVRAM entry #:.......-1
Boot Variable #:.....0000
Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash
Kernel Image Path:.../boot/vmlinuz-6.0.6-76060006-generic
Initrd Image Path:.../boot/initrd.img-6.0.6-76060006-generic
Force-overwrite:.....False

kernelstub.Installer : INFO Copying Kernel into ESP
kernelstub.Installer : ERROR Couldn't copy the kernel onto the ESP!
This is a critical error and we cannot continue. Check your settings to see if t
here is a typo. Otherwise, check permissions and try again.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 271, in co
py_files
shutil.copy(src, dest)
File "/usr/lib/python3.10/shutil.py", line 417, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.10/shutil.py", line 256, in copyfile
with open(dst, 'wb') as fdst:
OSError: [Errno 30] Read-only file system: '/boot/efi/EFI/Pop_OS-eb92492b-ba9f-4
76f-a91b-57e33582ae33/vmlinuz.efi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 128, in se
tup_kernel
self.copy_files(
File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 275, in co
py_files
raise FileOpsError("Could not copy one or more files.")
kernelstub.installer.FileOpsError: Could not copy one or more files.
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 1
70
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned
error exit status 1
Errors were encountered while processing:
linux-image-6.0.6-76060006-generic
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
`

Kernelstub fails with more than one kernel line installed

Current implementations of kernelstub on Pop!_OS fail when installing more than one kernel line, such as linux-generic and linux-lowlatency. The alternative, to install only linux-lowlatency and remove linux-generic, also fails because core elements of Pop!_OS (such as the system76-driver) have a hard dependency on linux-generic, and uninstalling the one uninstalls the other.

This is a problem, as the linux-lowlatency or similar kernel line is still important to allow Pop!_OS systems to do low latency processing, such as for digital audio workstations. This prevents Pop!_OS from being a serious consideration for low-latency applications, and thus will alienate or frustrate a core target part of the System76 target demographic: Makers. Specifically, multimedia users, but also in use cases far beyond content creators, such as IoT security: https://www.nabto.com/blog/low-latency

This discussion isn't limited to embedded systems, but also user computing systems (smartphones, tablets, and full-scale laptop and desktop computers, which need to have an "out of the box" low latency interface with the IoT in order for them to work effectively as human interface devices and hubs).

There are three possible and not-mutually-exclusive solutions:

  1. Configure kernelstub to handle more than one kernel line gracefully.
  2. Make the core system76 components dependent on ANY/ALL kernels that system76 provides with Pop!_OS, including -lowlatency, for example, so that installing -lowlatency and uninstalling -generic does not result in the removal of core OS software
  3. Adopt a universal kernel: Explore adopting a philosophy closer to Mac OS X, which has also targeted itself very successfully at the "maker niche." (history available here: https://www.cse.unsw.edu.au/~cs9242/10/lectures/09-OSXAudiox4.pdf, briefly, Apple was dying and only had its multimedia customers while developing OS X, and so multimedia engineers This philosophy is summarized as follows: Make small sacrifices in throughput performance in system and kernel optimization to allow for relatively large gains in latency performance "out of the box."

Make linux-lowlatency or another lowlatency kernel (such as Liqorix) available to install without needing any command line configuration or breaking the system.
Option a. Problem: Currently, kernelstub is only able to handle a single kernel line without becoming a mess. While it is technically possible to install a second kernel, it destroys the functionality of the boot menu and the kernel that gets booted is whatever kernel was updated last. Solution: Make kernelstub able to handle more than one kernel gracefully; the user can choose the latest version of -generic or -lowlatency (or liquorix, etc) via menu at boot
Option b. Problem: Currently, S76 and Pop!_OS have hard dependencies on the -generic kernel line, making it impossible to uninstall the -generic kernel without breaking the system. Solution: Make the -lowlatency alternative a drop-in replacement for the -generic kernel, as an alternate dependency on core Pop!_os and S76 components that currently depend strictly on the -generic kernel.
Option c. Problem: Currently, Pop!_OS does not come with a universal kernel, but linux-generic, which is still insufficient for lowlatency audio and similar latency-dependent work. Solution: Adopt a more universal kernel line that covers most use scenarios at the sacrifice of some throughput performance.

Liquorix.net claims to maintain a kernel that is in-line with this philosophy, and I think it would be worth looking at how their kernel differs from -generic and -lowlatency to determine the extent to which System76 might supply it or a similarly-configured kernel by default in its systems to more effectively cover most usage scenarios, until the -generic kernel line can catch up to the game with the realization that latency performance deserves higher priority, even at the expense of some throughput performance, for most use cases.

This third option makes a lot of sense to me, as System76 is in a similar market niche of providing and controlling and optimizing both hardware and software to go well together. Making this adjustment will be a signficant departure from other distributions that will turn heads and gain attention, which is good marketing potential as well as more respectful of the user psychology.

kernelstub won't update default kernel to older version (6.0.12 -> 5.19.16)

I'm having some issues that seem to be related to kernel 6.0.12 and I just want to downgrade to 5.19.16 but kernelstub -k <vmlinuz_path> -i <initrd.img_path> doesn't change the output of kernelstub -p

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

Issue/Bug Description:
Running kernelstub -k <vmlinuz_path> -i <initrd.img_path> to revert from kernel 6.0.12 to 5.19.16 does not change the output of kernelstub -p to reflect the new default kernel.

Steps to reproduce (if you know):

sudo kernelstub -k <vmlinuz_path> -i <initrd.img_path>
sudo kernelstub -p

Expected behavior:
Should show old kernel. Even after a restart, 6.0.12 is shown.

Other Notes:
I'm using rEFInd to dualboot Windows and Pop!_OS, on two separate drives. I'm able to use rEFInd to boot into the old kernel, but it seems to only want to use integrated graphics, I can't get it to switch to NVIDIA unless I go to the newer kernel.

How to set kernel? Only survives a single boot currently

Distribution (run cat /etc/os-release):

# cat /etc/os-release
NAME="Pop!_OS"
VERSION="20.10"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 20.10"
VERSION_ID="20.10"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=groovy
UBUNTU_CODENAME=groovy
LOGO=distributor-logo-pop-os

Issue/Bug Description:
After setting kernel, kernelstub continues to report old kernel paths. After a single reboot, new kernel setting appears to work, but after another reboot, the previous kernel is in use again.

Steps to reproduce (if you know):

  1. Symlink kernel
    sudo ln -s /boot/initrd.img-5.8.0-7642-generic /boot/initrd.img
    sudo ln -s /boot/vmlinuz-5.8.0-7642-generic /boot/vmlinuz
  2. sudo kernelstub -i /boot/initrd.img -k /boot/vmlinuz -v and observe no errors reported

Expected behavior:

  1. Running sudo kernelstub -p after, I'd expect to see the given paths displayed
  2. Upon multiple reboots, running uname -r should yield "5.8.0-7642-generic"

Observed behavior:

  1. Running sudo kernelstub -p after yields no change from previous values
  2. After the first reboot, expected kernel shows for uname -r, but subsequent reboots have me back on 5.11

Other Notes:

  • kernelstub seems to work fine for managing boot options
  • I'm on a System76 galp5 dGPU, latest firmware and Pop!_OS packages

Kernelstub uses sudo where not necessary

In kernelstub/nvram.py, sudo is used in order to run efibootmgr. Since kernelstub already warns if run while not the root user (or inside sudo), this is redundant and creates a dependency on sudo that is not currently defined in the debian/control file. The best way to resolve this would be to remove the use of sudo from kernelstub/nvram.py.

Kernelstub is not detecting the kernel versions correctly

Distribution (run cat /etc/os-release):
NAME="Pop!_OS"
VERSION="19.10"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Pop!_OS 19.10"
VERSION_ID="19.10"
HOME_URL="https://system76.com/pop"
SUPPORT_URL="http://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=eoan
UBUNTU_CODENAME=eoan
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):
kernelstub:
Installed: 3.1.2157842303419.109086739
Candidate: 3.1.2
157842303419.109086739
Version table:
*** 3.1.2157842303419.10~9086739 1001
1001 http://ppa.launchpad.net/system76/pop/ubuntu eoan/main amd64 Packages
1001 http://ppa.launchpad.net/system76/pop/ubuntu eoan/main i386 Packages
100 /var/lib/dpkg/status
aaronh@pop-os /boot>

Issue/Bug Description:
It looks like kernelstub is trying to find a .old file for the newest kernel and when this happens it can't create the oldkern menu entry. Attached is the full output of some commands.

odd-kernel-issue.txt

Steps to reproduce (if you know):

Expected behavior:
Kernelstub will add a entry for the older kernel to systemd-boot/sd-boot

Other Notes:

Can't redirect output (all output is sent through stderr)

Distribution (run cat /etc/os-release): Pop!_OS 20.04 LTS and 21.10

Related Application and/or Package Version (run apt policy $PACKAGE NAME): de5b292

Issue/Bug Description: When running kernelstub commands such as sudo kernelstub -p (which prints the current configuration), the output cannot be redirected. Trying to | grep xyz doesn't work, and trying to save to a file with > output.txt creates an empty file. The output is always printed directly to the terminal.

Redirecting with 2> output.txt does work; it seems output is always being sent via stderr, instead of stdout. stderr should not be used for regular, non-error output like this.

Steps to reproduce (if you know): Run sudo kernelstub -p | grep Options

Expected behavior: The output should be redirectable like most other CLI applications.

Having kernelstub 2.0.1 installed causes kernel updates or initrd changes to fail

Having Kernelstub installed causes these critically important update processes to fail. This is because the option format in the program was changed, but the initrd and kernel update trigger hooks weren't updated.

Console output:

Setting up libdfu1:amd64 (0.9.7-2ubuntu1) ...
Setting up linux-image-4.13.0-32-generic (4.13.0-32.35) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.0-32-generic /boot/vmlinuz-4.13.0-32-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.13.0-32-generic /boot/vmlinuz-4.13.0-32-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.13.0-32-generic /boot/vmlinuz-4.13.0-32-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-32-generic
usage: kernelstub [-h] [-d] [-e ESP,] [--esp_path ESP] [-k PATH,]
                  [--kernel-path PATH] [-i PATH,] [--initrd-path PATH]
                  [-o "OPTIONS",] [--options "OPTIONS"] [-l] [-s | -m] [-f]
                  [-v]
kernelstub: error: unrecognized arguments: --initrdpath /boot/initrd.img-4.13.0-32-generic --kernelpath /boot/vmlinuz-4.13.0-32-generic
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 2
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.13.0-32-generic.postinst line 1052.
dpkg: error processing package linux-image-4.13.0-32-generic (--configure):

Can't run kernelstub as root

Distribution (run cat /etc/os-release):
Pop!_OS 22.04 LTS

Related Application and/or Package Version (run apt policy $PACKAGE NAME):
kernelstub

Issue/Bug Description:
If I try to run "sudo kernelstub", I get this:

Traceback (most recent call last):
File "/usr/bin/kernelstub", line 244, in
main()
File "/usr/bin/kernelstub", line 241, in main
kernelstub.main(args)
File "/usr/lib/python3/dist-packages/kernelstub/application.py", line 142, in main
config = Config.Config()
File "/usr/lib/python3/dist-packages/kernelstub/config.py", line 50, in init
self.config = self.load_config()
File "/usr/lib/python3/dist-packages/kernelstub/config.py", line 60, in load_config
self.config = json.load(config_file)
File "/usr/lib/python3.10/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 6 column 7 (char 77)

Steps to reproduce (if you know):

Expected behavior:
To show the help page or to say use --help or something?

Other Notes:

Kernelstub overwrites UEFI boot order.

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="21.04"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 21.04"
VERSION_ID="21.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=hirsute
UBUNTU_CODENAME=hirsute
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

kernelstub:
  Installed: 3.1.4~1631911584~21.04~de5b292
  Candidate: 3.1.4~1631911584~21.04~de5b292
  Version table:
 *** 3.1.4~1631911584~21.04~de5b292 1001
       1001 http://ppa.launchpad.net/system76/pop/ubuntu hirsute/main amd64 Packages
       1001 http://ppa.launchpad.net/system76/pop/ubuntu hirsute/main i386 Packages
        100 /var/lib/dpkg/status

Issue/Bug Description:

On every update which causes regeneration of initramfs, kernelstub fires, and resets my boot order. I cannot find out how to tell it to maintain whatever boot order is set in the UEFI interface (alternatively, I can tell kernelstub what my preferred bootorder is, but I can't find how to do that either).

Steps to reproduce (if you know):

sudo update-initramfs -c -k all

Expected behavior:

Kernelstub fires, does its thing, and does not change my bootorder.

Other Notes:

The relevant output from the kernelstub part of the process :

Note that I am currently booted into option 0003, and would really like if that kept being my default option even after kernelstub operations

kernelstub.Installer : INFO     Copying Kernel into ESP
kernelstub.Installer : INFO     Copying initrd.img into ESP
kernelstub.Installer : INFO     Setting up loader.conf configuration
kernelstub.Installer : INFO     Making entry file for Pop!_OS
kernelstub.Installer : INFO     Backing up old kernel
kernelstub.Installer : INFO     Making entry file for Pop!_OS
kernelstub.Installer : INFO     Setting up Kernel EFISTUB loader...
kernelstub.Installer : INFO     Deleting old boot entry
kernelstub.NVRAM     : INFO     Deleting old boot entry: 0007
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0000,0080,0005,0002,0001,0004,0006
Boot0000* Windows Boot Manager
Boot0001* UEFI:CD/DVD Drive
Boot0002* clover
Boot0003* Pop!_OS 21.04
Boot0004* UEFI:Removable Device
Boot0005* ARCHGRUB
Boot0006* UEFI:Network Device
Boot0080* Mac OS X
kernelstub.NVRAM     : INFO     Creating NVRAM entry
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0007,0003,0000,0080,0005,0002,0001,0004,0006
Boot0000* Windows Boot Manager
Boot0001* UEFI:CD/DVD Drive
Boot0002* clover
Boot0003* Pop!_OS 21.04
Boot0004* UEFI:Removable Device
Boot0005* ARCHGRUB
Boot0006* UEFI:Network Device
Boot0080* Mac OS X
Boot0007* Pop_OS 21.04
kernelstub.Installer : INFO     NVRAM configured, new values: 

BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0007,0003,0000,0080,0005,0002,0001,0004,0006
Boot0000* Windows Boot Manager
Boot0001* UEFI:CD/DVD Drive
Boot0002* clover
Boot0003* Pop!_OS 21.04
Boot0004* UEFI:Removable Device
Boot0005* ARCHGRUB
Boot0006* UEFI:Network Device
Boot0007* Pop_OS 21.04
Boot0080* Mac OS X

Errors for building kernelstub

Distribution (run cat /etc/os-release):
NAME="Pop!_OS"
VERSION="21.10"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 21.10"
VERSION_ID="21.10"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=impish
UBUNTU_CODENAME=impish
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):
kernelstub:
Installed: 3.1.4163191158421.10de5b292
Candidate: 3.1.4
163191158421.10de5b292
Version table:
*** 3.1.4163191158421.10~de5b292 1001
1001 http://apt.pop-os.org/release impish/main amd64 Packages
1001 http://apt.pop-os.org/release impish/main i386 Packages
100 /var/lib/dpkg/status

± % apt policy python                                                     !2332
python:
  Installed: (none)
  Candidate: 2.7.17-2pop1~1580508288~21.10~6895a24
  Version table:
     2.7.17-2pop1~1580508288~21.10~6895a24 1001
       1001 http://apt.pop-os.org/release impish/main amd64 Packages
       1001 http://apt.pop-os.org/release impish/main i386 Packages

maxpod@pop-os ~/kernelstub [master]
± % apt policy python3                                                    !2333
python3:
  Installed: 3.9.4-1build1
  Candidate: 3.9.4-1build1
  Version table:
 *** 3.9.4-1build1 500
        500 http://us.archive.ubuntu.com/ubuntu impish/main amd64 Packages
        100 /var/lib/dpkg/status

Issue/Bug Description:
Error for trying to install dependencies and error for trying to build & install kernelstub.

  1. install build dependencies, git clone, and try to build kernelstub -> error
  2. sudo apt remove kernelstub / build & install kernelstub -> error

Steps to reproduce (if you know):

Expected behavior:
Perhaps not so many errors.

Error for installing self-built kernelstub:

± % sudo dpkg -i ../kernelstub*.deb                                       !2324
(Reading database ... 334988 files and directories currently installed.)
Preparing to unpack ../kernelstub_3.1.4_all.deb ...
Unpacking kernelstub (3.1.4) over (3.1.4~1631911584~21.10~de5b292) ...
Setting up kernelstub (3.1.4) ...
kernelstub.Config    : INFO     Looking for configuration...
Traceback (most recent call last):
  File "/usr/bin/kernelstub", line 244, in <module>
    main()
  File "/usr/bin/kernelstub", line 241, in main
    kernelstub.main(args)
  File "/usr/lib/python3/dist-packages/kernelstub/application.py", line 142, in main
    config = Config.Config()
  File "/usr/lib/python3/dist-packages/kernelstub/config.py", line 50, in __init__
    self.config = self.load_config()
  File "/usr/lib/python3/dist-packages/kernelstub/config.py", line 60, in load_config
    self.config = json.load(config_file)
  File "/usr/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 22 column 5 (char 450)
dpkg: error processing package kernelstub (--install):
 installed kernelstub package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 kernelstub

sudo apt-build-dep kernelstub

± % sudo apt build-dep kernelstub                                         !2329
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up kernelstub (3.1.4~1631911584~21.10~de5b292) ...
kernelstub.Config    : INFO     Looking for configuration...
Traceback (most recent call last):
  File "/usr/bin/kernelstub", line 244, in <module>
    main()
  File "/usr/bin/kernelstub", line 241, in main
    kernelstub.main(args)
  File "/usr/lib/python3/dist-packages/kernelstub/application.py", line 142, in 
main
    config = Config.Config()
  File "/usr/lib/python3/dist-packages/kernelstub/config.py", line 50, in __init
__
    self.config = self.load_config()
  File "/usr/lib/python3/dist-packages/kernelstub/config.py", line 60, in load_c
onfig
    self.config = json.load(config_file)
  File "/usr/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 22 column 5 (char 450)
dpkg: error processing package kernelstub (--configure):
 installed kernelstub package post-installation script subprocess returned error
 exit status 1
Errors were encountered while processing:
 kernelstub
E: Sub-process /usr/bin/dpkg returned an error code (1)
E: Failed to process build dependencies

Kernelstub can't find itself and therefore doesn't allow updates with apt

Distribution (run cat /etc/os-release):
Pop!_OS 22.04 LTS

Related Application and/or Package Version (run apt policy $PACKAGE NAME):
kernelstub: 3.1.4~1658498801~22.04~41819bb

Issue/Bug Description:
Running sudo kernelstub results in:

Traceback (most recent call last):
  File "/usr/bin/kernelstub", line 44, in <module>
    from kernelstub import application
ModuleNotFoundError: No module named 'kernelstub'

This error also appears when running sudo apt full-upgrade, which blocks linux-firmware (and consequentially a host of other packages) from updating.

Steps to reproduce (if you know):
Unknown

Expected behavior:
Normal kernelstub -h output from sudo kernelstub. Ability to update linux-firmware.

Other Notes:
lspci -vv output is available here: (https://pastebin.com/9h6dAR3Z)[ https://pastebin.com/9h6dAR3Z]

Bug in kernelstub on btrfs multi-device filesystems (patch included)

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="18.10"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Pop!_OS 18.10"
VERSION_ID="18.10"
HOME_URL="https://system76.com/pop"
SUPPORT_URL="http://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=cosmic
UBUNTU_CODENAME=cosmic

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

kernelstub:
# ...
     3.1.0~1539360058~18.10~64d0caf 1001
       1001 http://ppa.launchpad.net/system76/pop/ubuntu cosmic/main amd64 Packages
       1001 http://ppa.launchpad.net/system76/pop/ubuntu cosmic/main i386 Packages

Issue/Bug Description:

Multi-device BTRFS setups cause kernel stub to fail.
This has flow on effects, for example updates stop working.

Steps to reproduce (if you know):

  1. Boot Pop_OS with multi-device btrfs filesystem as the root filesystem, i.e. a btrfs RAID setup.
  2. Run kernelstub

Expected behavior:

The system operates as it would on any other filesystem.

Other Notes:

I've already created a patch that fixes this problem and created a pull request, but I haven't got any response after a week. There are more details in that pull request:

isantop#22

Looses boot parameters on upgrade

I've recently upgraded from 20.10 to 21.04. I'm running Pop!_OS on a Clevo barebone. I had some very nice boot paramters set in my kernelstub.conf. They were all wiped. Unfortunately I did not have a backup of it.

I think that a upgrade should not wipe those parameters. BTW these parameters where set at some point in time with the kernelstub -a ... command. Please look into this.

Also, any where, there is some upgrade backup location, where I can find my old kernelstub.conf ?

sudo apt autoclean

update-initramfs: Generating /boot/initrd.img-5.0.0-13-generic
kernelstub.Config : INFO Looking for configuration...
kernelstub.Drive : ERROR Could not get a UUID for the a filesystem. This is a critical error and we cannot continue
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/drive.py", line 59, in init
self.root_uuid = self.get_uuid(self.root_fs[5:])
File "/usr/lib/python3/dist-packages/kernelstub/drive.py", line 115, in get_uuid
raise UUIDNotFoundError
kernelstub.drive.UUIDNotFoundError
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 177
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt-cache policy kernelstub
kernelstub:
Installed: 3.1.0153936005819.0464d0caf
Candidate: 3.1.0
153936005819.0464d0caf
Version table:
*** 3.1.0153936005819.04~64d0caf 1001
1001 http://ppa.launchpad.net/system76/pop/ubuntu disco/main amd64 Packages
1001 http://ppa.launchpad.net/system76/pop/ubuntu disco/main i386 Packages
100 /var/lib/dpkg/status

Parallel installations overwrite each other's loader entries

The loader entry filename generated by kernelstub only depends on the OS name and does not include a unique identifier:

os.path.join(self.entry_dir, '%s-current' % self.opsys.name))

This causes parallel installations of Pop!_OS to overwrite each other's loader entries. This is inconvenient if you just want to set up a throwaway partition to test something (see, e.g., pop-os/pop#3152 (comment)).

As a point of comparison, the loader entries generated by EndeavourOS (an arch-derivative) include a UUID in the loader entry filename:

root@thelaptop:/boot/efi/loader/entries# ls -l
total 24
-rwx------ 1 root root 542 Oct 16 08:30 843d283c5bc34d10bf2bc80afb2556e8-6.1.58-1-lts.conf
-rwx------ 1 root root 582 Oct 16 08:30 843d283c5bc34d10bf2bc80afb2556e8-6.1.58-1-lts-fallback.conf
-rwx------ 1 root root 546 Oct 15 20:52 843d283c5bc34d10bf2bc80afb2556e8-6.5.7-arch1-1.conf
-rwx------ 1 root root 586 Oct 15 20:52 843d283c5bc34d10bf2bc80afb2556e8-6.5.7-arch1-1-fallback.conf
-rwx------ 1 root root 256 Oct 16 11:27 Pop_OS-current.conf
-rwx------ 1 root root 274 Oct 16 11:27 Pop_OS-oldkern.conf

As far as I can tell, there's no way to work around this using a config option, since the OS name used by kernelstub is derived directly from /etc/os-release via the lines below. I suppose I could edit this file manually to disambiguate the installations, but that seems a bit hacky, I'm not sure what other tools might be reading this file.

def get_os_release(self):
try:
with open('/etc/os-release') as os_release_file:
os_release = os_release_file.readlines()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.