alekciy
@alekciy
Вёбных дел мастер

Как обновить ядро Ubuntu 12.04?

Возникла проблема с тем, что apt-get перестал работать (использовать -f пока не рискую). Причина в том, что у меня ядро linux-image-3.2.0-29-generic, а последнее это linux-image-3.2.0-57-generic, но apt его обновить не смог, поэтому я решил обновиться из deb пакета:

# dpkg -i linux-image-3.2.0-57-generic_3.2.0-57.87_amd64.deb 
(Reading database ... 94087 files and directories currently installed.)
Preparing to replace linux-image-3.2.0-57-generic 3.2.0-57.87 (using linux-image-3.2.0-57-generic_3.2.0-57.87_amd64.deb) ...
Done.
Unpacking replacement linux-image-3.2.0-57-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-57-generic /boot/vmlinuz-3.2.0-57-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-57-generic /boot/vmlinuz-3.2.0-57-generic
Setting up linux-image-3.2.0-57-generic (3.2.0-57.87) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
failed to move /initrd.img:Invalid cross-device link at /var/lib/dpkg/info/linux-image-3.2.0-57-generic.postinst line 495.
dpkg: error processing linux-image-3.2.0-57-generic (--install):
 subprocess installed post-installation script returned error exit status 18
Errors were encountered while processing:
 linux-image-3.2.0-57-generic

Смотрю указанный скрипт:
# sed -n 495,500p /var/lib/dpkg/info/linux-image-3.2.0-57-generic.postinst
  rename("$kimage", "$kimage.$$") ||
    die "failed to move " . $image_dest . "$kimage:$!";
  warn "mv $kimage $kimage.$$" if $DEBUG;
  my $Old = $src_dir;
  my $cwd;


И понимаю, что он пытается переименовать старый образ, но не может этого сделать (через хардлинк? с перлом не знаком просто). Причина понятна:

# ls -l /initrd.img 
lrwxrwxrwx 1 root root 33 Sep 12  2012 /initrd.img -> /boot/initrd.img-3.2.0-29-generic


При этом корневая фс:

# mount -l -t xfs
/dev/md2 on / type xfs (rw,usrquota,prjquota)


, а boot:

# mount -l -t ext3
/dev/md1 on /boot type ext3 (rw)


Вот сейчас сижу и пытаюсь сообразить, как при минимум усилий обновиться, но при этом не уронить систему.
  • Вопрос задан
  • 4742 просмотра
Решения вопроса 2
IlyaEvseev
@IlyaEvseev
Opensource geek
Совсем тяжелый случай:
mkdir /boot2
tar cf - -C /boot . | tar xf - -C /boot2
umount /boot
rm /boot
mv /boot2 /boot

После этого apt-get remove и т.д.
Когда всё станет хорошо, снова сделайте mount /boot
Ответ написан
alekciy
@alekciy Автор вопроса
Вёбных дел мастер
Поправил в /etc/kernel-img.conf link_in_boot на yes и новое ядро установилось. Попробую позже с него загрузиться.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 3
IlyaEvseev
@IlyaEvseev
Opensource geek
что говорят "apt-get check" и "apt-get install -f"?
если сломали apt, то лучше починить, а не изобретать обходные костыли.
Ответ написан
Комментировать
alekciy
@alekciy Автор вопроса
Вёбных дел мастер
#apt-get check
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-generic : Depends: linux-image-generic (= 3.2.0.54.64) but 3.2.0.57.68 is installed
 linux-image : Depends: linux-image-generic (= 3.2.0.54.64) but 3.2.0.57.68 is installed
 linux-server : Depends: linux-image-server (= 3.2.0.57.68) but it is not installed
                Depends: linux-headers-server (= 3.2.0.57.68) but it is not installed
E: Unmet dependencies. Try using -f.

Unmet это из-за linux-server который я пытался накатить из deb файла. -f конечно немного боязно запускать, но не помогло в итоге:
# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux linux-generic linux-image
The following packages will be upgraded:
  linux linux-generic linux-image
3 upgraded, 0 newly installed, 0 to remove and 177 not upgraded.
8 not fully installed or removed.
Need to get 0 B/5,118 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up linux-image-3.2.0-57-generic (3.2.0-57.87) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
failed to move /initrd.img:Invalid cross-device link at /var/lib/dpkg/info/linux-image-3.2.0-57-generic.postinst line 495.
dpkg: error processing linux-image-3.2.0-57-generic (--configure):
 subprocess installed post-installation script returned error exit status 18
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-57-generic; however:
  Package linux-image-3.2.0-57-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 3.2.0.54.64); however:
  Version of linux-image-generic on system is 3.2.0.57.68.
 linux-generic depends on linux-headers-generic (= 3.2.0.54.64); however:
  Version of linux-headers-generic on system is 3.2.0.57.68.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image:
 linux-image depends on linux-image-generic (= 3.2.0.54.64); however:
  Version of linux-image-generic on system is 3.2.0.57.68.
dpkg: error processing linux-image (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux:
 linux depends on linux-image (= 3.2.0.54.64); however:
  Package linux-image is not configured yet.
dpkg: error processing linux (--configure):
 dependency problems - leaving unconfigured
Setting up linux-image-3.2.0-54-generic (3.2.No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                                                       No apport report written because MaxReports is reached already
      No apport report written because MaxReports is reached already
                                                                    0-54.82) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
failed to move /initrd.img:Invalid cross-device link at /var/lib/dpkg/info/linux-image-3.2.0-54-generic.postinst line 495.
dpkg: error processing linux-image-3.2.0-54-generic (--configure):
 subprocess installed post-installation script returned error exit status 18
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of linux-image-server:
 linux-image-server depends on linux-image-3.2.0-57-generic; however:
  Package linux-image-3.2.0-57-generic is not configured yet.
dpkg: error processing linux-image-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (= 3.2.0.57.68); however:
  Package linux-image-server is not configured yet.
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-3.2.0-57-generic
 linux-image-generic
 linux-generic
 linux-image
 linux
 linux-image-3.2.0-54-generic
 linux-image-server
 linux-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

linux-server я конечно выпилю, но подозреваю, что в итоге все равно не даст обновиться. Авторы пакета явно не расчитывали, что симлинк окажется на другой фс.
Ответ написан
alekciy
@alekciy Автор вопроса
Вёбных дел мастер
@IlyaEvseev я так пытался, даже более, делал purge. Но все тчетно:
]$ sudo apt-get remove linux-server linux-image-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package linux-image-server is not installed, so not removed
Package linux-server is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 177 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-3.2.0-57-generic (3.2.0-57.87) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
failed to move /initrd.img:Invalid cross-device link at /var/lib/dpkg/info/linux-image-3.2.0-57-generic.postinst line 495.
dpkg: error processing linux-image-3.2.0-57-generic (--configure):
 subprocess installed post-installation script returned error exit status 18
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-57-generic; however:
  Package linux-image-3.2.0-57-generic is not configured yet.
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image:
 linux-image depends on linux-image-generic (= 3.2.0.57.68); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-image (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 linux-image-3.2.0-57-generic
 linux-image-generic
 linux-image
E: Sub-process /usr/bin/dpkg returned an error code (1)
]$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 177 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-3.2.0-57-generic (3.2.0-57.87) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
failed to move /initrd.img:Invalid cross-device link at /var/lib/dpkg/info/linux-image-3.2.0-57-generic.postinst line 495.
dpkg: error processing linux-image-3.2.0-57-generic (--configure):
 subprocess installed post-installation script returned error exit status 18
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-57-generic; however:
  Package linux-image-3.2.0-57-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image:
 linux-image depends on linux-image-generic (= 3.2.0.57.68); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-image (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
     Errors were encountered while processing:
 linux-image-3.2.0-57-generic
 linux-image-generic
 linux-image
E: Sub-process /usr/bin/dpkg returned an error code (1)

Как я понимаю мейтейдер пакета даже вообразить не мог о такой разбивке дисков поэтому обновить ядро из стандартных пакетов видимо уже не получиться. А замораживать в apt текущую версию ядра я не хочу ибо оно с дырявое и локальный юзер может повысить привилегии до root-а.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы