Page 1 of 1

Rasp2 running on USB Stick, kernel upgrade problem

Posted: Wed Jun 21, 2017 1:02 pm
by karvalho
I managed to boot a raspberry pi 2 from a usb stick, using the root parameter on /boot/cmdline.txt in my sd card, and having raspbian copied to my usb drive.

Everything's fine, till I

Code: Select all

apt-get update && apt-get upgrade
Before upgrade, uname -r returns:

Code: Select all

4.4.50-v7+
In the upgrade it's included the package raspberrypi-kernel, a newer kernel, perhaps?

But after upgrading and rebooting, I have a "Failed to start Load Kernel Modules", uname -r still shows 4.4.50-v7+, and depmod returns

Code: Select all

"ERROR: could not open directory /lib/modules/4.4.50-v7+"
I presume the kernel is upgraded on my usb stick, but not on the /boot partition, the reason why these references are broken?

Did I do something wrong, or maybe it's not possible to upgrade the system if you boot to a usb stick?

Thank you

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Thu Jun 22, 2017 8:39 pm
by DougieLawson
What device was mounted as /boot when you ran the upgrade?
What's in /lib/modules?

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 2:11 am
by karvalho
What device was mounted as /boot when you ran the upgrade?
Before the upgrade, it seems /dev/sda1 is properly mounted.

Code: Select all

mount | grep boot
/dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/mmcblk0p1 on /media/pi/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
What's in /lib/modules?

Code: Select all

ls /lib/modules
4.4.50+  4.4.50-v7+

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 7:04 am
by DougieLawson
Where's the root filesystem? What's in /boot/cmdline.txt? What's in /etc/fstab on that root filesystem?

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 12:05 pm
by karvalho
Where's the root filesystem?
If I run "mount", the first line is this:

Code: Select all

/dev/sda2 on / type ext4 (rw,noatime,data=ordered)
It means the root is mounted on my usb stick, right?
What's in /boot/cmdline.txt?
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=402e4a57-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh splash plymouth.ignore-serial-consoles

That UUID? blkid gives me

Code: Select all

/dev/mmcblk0p1: LABEL="boot" UUID="95E0-9AC4" TYPE="vfat" PARTUUID="1f442c82-01"
/dev/mmcblk0p2: UUID="b105f9a8-f450-4976-8ac8-69053f57bab4" TYPE="ext4" PARTUUID="1f442c82-02"
/dev/sda1: LABEL="boot" UUID="95E0-9AC4" TYPE="vfat" PARTUUID="402e4a57-01"

/dev/sda2: UUID="b105f9a8-f450-4976-8ac8-69053f57bab4" TYPE="ext4" PARTUUID="402e4a57-02"

/dev/mmcblk0: PTUUID="1f442c82" PTTYPE="dos"
So I guess that's right, it mounts my usb stick as root, right?

In my sd card, cmdline.txt has this:

Code: Select all

cat /media/pi/boot/cmdline.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
What's in /etc/fstab on that root filesystem?

Code: Select all

cat /etc/fstab 

proc            /proc           proc    defaults          0       0
PARTUUID=402e4a57-01  /boot           vfat    defaults          0       2
PARTUUID=402e4a57-02  /               ext4    defaults,noatime  0       1
Thank you for your patience, sir.

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 12:14 pm
by karvalho
BTW, after upgrading, /lib/modules has these:

Code: Select all

ls /lib/modules
4.9.28+  4.9.28-v7+
But the sd card's /lib/modules still have the files from the original kernel:

Code: Select all

ls /media/pi/b105f9a8-f450-4976-8ac8-69053f57bab4/lib/modules
4.4.50+  4.4.50-v7+
And

Code: Select all

uname -r
4.4.50-v7+

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 2:33 pm
by runboy93
Start from point 0.

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 5:09 pm
by karvalho
Start from point 0.
I just did, and got some interesting results. I managed to get the exact opposite result: uname -r reports a newer kernel, and /lib/modules contains older kernel files.

Code: Select all

uname -r
4.9.28-v7+

ls /lib/modules
4.4.50+  4.4.50-v7+

depmod
depmod: ERROR: could not open directory /lib/modules/4.9.28-v7+: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
I'm probably doing something terribly wrong, so here's all the steps I've taken.

1) I dd'd raspbian image to both devices: the sd card and the usb stick.

Code: Select all

sudo dd bs=4M status=progress if=2017-04-10-raspbian-jessie.img of=/dev/sdd
2) I booted my rasp2 with only the sd-card. uname -r returns 4.4.50-v7+. sudo apt-get update and upgrade it. Reboot. Still working fine, uname -r returns 4.9.28-v7+. Great.

3) Then, I changed the root parameter in /boot/cmdline.txt to /dev/sda2, turned it off, plugged the usb stick, and turned it on.

And that's it. I was expecting uname -r to return the kernel version is in the usb stick, 4.4, not the sd card version, 4.9. It feels like I have a frankenstein, only parts of it are upgraded, and others aren't, and I really can't see what I'm doing wrong.

I'm gonna upgrade it again, now running on my usb stick, and see the results. Thank you.

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sat Jun 24, 2017 11:04 pm
by itimpi
Sounds as if you upgraded the copy of Raspbian on the SD card and then failed to copy the upgraded Raspbian to the USB drive?

Alternatively if you had run step 2 while running with root on the USB stick then it would have upgraded the Boot related files in the boot partition on the SD card and then the main `Raspbian files on the USB stick.

Re: Rasp2 running on USB Stick, kernel upgrade problem

Posted: Sun Jun 25, 2017 11:35 am
by karvalho
Sounds as if you upgraded the copy of Raspbian on the SD card and then failed to copy the upgraded Raspbian to the USB drive?
That's correct. Is it required to keep both upgraded?
Alternatively if you had run step 2 while running with root on the USB stick then it would have upgraded the Boot related files in the boot partition on the SD card and then the main `Raspbian files on the USB stick.
I've tried that several times, it leads to the original problem. The whole system gets upgraded, but not the boot partition, as uname -r reports the old kernel, and that kernel's files are missing on /lib/modules.