View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

Actualizar un equipo rhel4 con núcleo de debian7 a una "debian 7 real" (amd64, hecho en metrosun11/metrosun12

NOTA: al hacerlo en metrosun11/metrosun12, después de rebotar, "no volvieron" (se quedaron sin ping). Eso significa que hay algún problema en el grub o en la initrd. Quizás haciendo un update-grub...

NOTA2: En metrosun11 lo hice sin cambiar el boot no reinstalar el grub. En metrosun12 sí actualicé el boot y el grub-install el grub.

metrosun11
==========

ifconfig
--------

eth0      Link encap:Ethernet  HWaddr 50:3E:AA:1F:63:CE  
          inet addr:16.0.62.42  Bcast:16.0.62.255  Mask:255.255.255.0
          inet6 addr: fe80::523e:aaff:fe1f:63ce/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8171236 errors:0 dropped:5703 overruns:0 frame:0
          TX packets:6356540 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1216852015 (1.1 GiB)  TX bytes:1050067441 (1001.4 MiB)
          Interrupt:138 Base address:0x8000 

eth1      Link encap:Ethernet  HWaddr 04:D9:F5:CF:90:A5  
          inet addr:16.0.63.42  Bcast:16.0.63.255  Mask:255.255.255.0
          inet6 addr: fe80::6d9:f5ff:fecf:90a5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:723494 errors:0 dropped:5711 overruns:0 frame:0
          TX packets:60358 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:45983028 (43.8 MiB)  TX bytes:8644876 (8.2 MiB)
          Interrupt:139 Base address:0x6000 


/etc/fstab
----------

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/sda2       /                       ext3    defaults        1 1
/dev/sda1       /boot                   ext2    defaults        1 2
/dev/sda3       swap                    swap    defaults        0 0
none            /dev/pts                devpts  gid=5,mode=620  0 0
none            /dev/shm                tmpfs   defaults        0 0
none            /proc                   proc    defaults        0 0
none            /sys                    sysfs   defaults        0 0
16.3.74.120:/Cohesity_Oracle_SRA        /METROSUN_BBDD  nfs     rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0,suid


df
--

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2            107128872  72882228  28804752  72% /
/dev/sda1              4128448     37588   3881148   1% /boot
none                   1960724         0   1960724   0% /dev/shm
16.3.74.120:/Cohesity_Oracle_SRA
                     497530112    228352 497301760   1% /METROSUN_BBDD


metrosun12
==========

/sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 50:3E:AA:11:FA:10  
          inet addr:16.0.62.43  Bcast:16.0.62.255  Mask:255.255.255.0
          inet6 addr: fe80::523e:aaff:fe11:fa10/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28449625 errors:0 dropped:5978 overruns:0 frame:0
          TX packets:23178682 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19806851473 (18.4 GiB)  TX bytes:6781758320 (6.3 GiB)
          Interrupt:138 Base address:0x8000 

eth1      Link encap:Ethernet  HWaddr 04:D9:F5:CE:82:B4  
          inet addr:16.0.63.43  Bcast:16.0.63.255  Mask:255.255.255.0
          inet6 addr: fe80::6d9:f5ff:fece:82b4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3458082 errors:0 dropped:5990 overruns:0 frame:0
          TX packets:2796959 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:229450900 (218.8 MiB)  TX bytes:784466334 (748.1 MiB)
          Interrupt:139 Base address:0x6000 


/etc/fstab
----------

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/sda2       /                       ext3    defaults        1 1
/dev/sda1       /boot                   ext2    defaults        1 2
/dev/sda3       swap                    swap    defaults        0 0
none            /dev/pts                devpts  gid=5,mode=620  0 0
none            /dev/shm                tmpfs   defaults        0 0
none            /proc                   proc    defaults        0 0
none            /sys                    sysfs   defaults        0 0
16.3.74.120:/Cohesity_Oracle_SRA        /METROSUN_BBDD  nfs     rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0,suid


df
--

S.ficheros         Bloques de 1K   Usado    Dispon Uso% Montado en
/dev/sda2            107128872  34330628  67356352  34% /
/dev/sda1              4128448     37588   3881148   1% /boot
none                   1960720         0   1960720   0% /dev/shm
16.3.74.120:/Cohesity_Oracle_SRA
                     497530112    228352 497301760   1% /METROSUN_BBDD


COMUN
=====

/oldroot
--------

(vacio)


/realroot
---------

(lo del debian7.11)


Instrucciones
-------------

Como root, en metrosun11

/realroot/bin/bash-static
cd /realroot
cp /bin/mv /
cp /bin/cp /
/mv /bin /oldroot
/mv bin /
/mv /lib /oldroot
/mv lib /
/bin/mv /lib64 /oldroot/
lib64/ld-linux-x86-64.so.2 /bin/mv lib64 /
cd /
ps -efa | grep "sendmail\|snmpd\|oracle\|pgsql\|cupsd" | grep -v grep | sed "s/  */ /g" | /oldroot/bin/cut -d ' ' -f 2 | xargs kill -9
for i in * ; do if [ ! -e realroot/$i ] && [ ! -e oldroot/$i ] && [ "$i" != "oldroot" ] && [ "$i" != "realroot" ] ; then mv -v $i oldroot/ ; fi ; done
mv oldroot/run /
mv realroot/run /
# NOTA: en este punto se puede volver a entrar en la máquina desde main1 haciendo un
# rsh -l root metrosun11
cd /
for i in usr sbin tmp selinux srv var media mnt opt etc; do mv -v $i oldroot/ ; mv -v realroot/$i / ; done
# EDITAMOS EL FSTAB
cat > /etc/fstab <<'EOF'
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/vda1 during installation
/dev/sda2 /               ext3    errors=remount-ro 0       1
/dev/sda1 /boot           ext2    errors=remount-ro 0       2
/dev/sda3 none            swap    defaults              0       0
EOF
# EDITAMOS EL network/interfaces
cp /oldroot/etc/init.d/route-setup.sh /etc/init.d/route-setup.sh
cat > /etc/network/interfaces <<'EOF'
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 16.0.62.42
        netmask 255.255.255.0
        network 16.0.62.0
        broadcast 16.0.62.255
        gateway 16.0.62.1
        post-up /etc/init.d/route-setup.sh

# The secondary network interface
auto eth1
iface eth1 inet static
        address 16.0.63.42
        netmask 255.255.255.0
        network 16.0.63.0
        broadcast 16.0.63.255
        gateway 16.0.63.1
        post-up /etc/init.d/route-setup.sh

EOF
# EDITAMOS EL /etc/udev/rules.d/70-persistent-net.rules
# para poner las MACs reales de la máquina
vi /etc/udev/rules.d/70-persistent-net.rules
# Añadimos (temporalmente) la clave de main1 a las authorized_keys
cat >> /root/.ssh/authorized_keys <<'EOF'
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEApUob7+RUvakF9Z1wSHgPcJhbgT5RwaZ0XfDnncEImb1GVBrTLHVB0L3UOD/pxqDbEuok6SuNnTpuGMuUSKg8fHkw529lZ5cWHTPysenwzMm6FEtLfVARlI9CxREJc1t9Ec2Z4ryOEIyE2ORODex1O/Fb/r9xk/I/rgZ1HTs70Ws= metro@manten01
EOF
# Ponemos la antigua identificacion (para que no de problemas)
cp /oldroot/etc/ssh/ssh_host_* /etc/ssh/
/etc/init.d/ssh restart
mv /etc/resolv.conf /etc/resolv.conf.disabled
ln -s /dev/initctl /run/initctl
mv realroot/vmlinuz realroot/initrd.img /
mkdir /oldroot/boot
cd /boot
mv * /oldroot/boot/
mv /realroot/boot/* .
rmdir /realroot/boot
cd /dev
mknod sda b 8 0
chmod 660 sda
update-grub
/usr/sbin/grub-install /dev/sda
cd /run
ln -s /dev/initctl .
shutdown -r now
reboot


Para arreglar el arranque:
En el menú del grub, se pulsa "c"
linux (hd0,msdos1)/vm<TAB> root=/dev/sda2
initrd (hd0,msdos1)/init<TAB>
boot


Y luego en el S.O.:
update-grub
/usr/sbin/grub-install /dev/sda


Update 20220711 Actualización a debian 8

Siguiendo este howto de sico para actualizar debian en campo, se ha hecho lo siguiente aparte de lo que dice ahí:

en metrosun11, como root:
echo "127.0.0.1 archive.debian.org" >> /etc/hosts


En la redirección inicial de uiharu, se han cambiado todas las IPs por la de archive.debian.org (130.89.148.13), quedando:

En uiharu (3.0.1.3, sico) se hace, como usuario:

 ssh metro@main1 -R 8081:141.76.2.4:80 -R 8082:212.211.132.250:80 -R 8083:212.211.132.250:443


Y luego, para el debian-keyring, se ha descargado el de debian 9 (vale tanto para debian 7 como para debian 8, así como debian 9) y se ha instalado a mano

Como fallaba la clave de firma de jessie, también se ha hecho lo siguiente:
En uiharu, como usuario:
cd /tmp
gpg --keyserver keyserver.ubuntu.com --recv-key 8B48AD6246925553
gpg -a --export 8B48AD6246925553 > jessie.key
scp jessie.key metro@main1:/tmp


Y luego, como root en metrosun11:
 cat jessie.key | apt-key add -

Con eso ya he podido hacer la actualización normalmente (da un error de clave expirada, pero se le puede dar "s" para continuar):
En metrosun11, como root:
cd /etc/apt
cp sources.list sources.list.wheezy
sed -i s/wheezy/jessie/g sources.list
apt-get update
apt-get dist-upgrade


Una vez terminada la actualización, se han añadido los "kex algorithms" al sshd para que siga funcionando el ssh desde main1:
En metrosun11, como root
echo "KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,\
diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1" >> /etc/ssh/sshd_config


Update 20220712 Actualización a Debian 9

Se siguen los pasos de http://3.0.1.46:8000/HowTo/266 exactamente.

En metrosun11, como root, se hace:
cd /etc/apt/
cp sources.list sources.list.jessie
sed -i "s/jessie/stretch/g" sources.list
sed -i "s/archive.debian.org/ftp.de.debian.org/g" sources.list
apt-get update
apt-get dist-upgrade