Re: Patch suggestion for sysupgrade
On Fri, Nov 15, 2019 at 07:00:05AM +0100, NilsOla Nilsson wrote: > I have upgraded a machine where /home was NFS-mounted, > like this: > - check that the / partition has space for the files > that will populate /home/_sysupgrade > - unmount /home > - comment ut the /home line in /etc/fstab > - upgrade with sysupgrade > - restore the line in /etc/fstab > - mount -a That is another way to do it. Though, for the last sysupgrade on amd64 6.5 -> 6.6 the _sysupgrade directory used 443M, and to depend on that it is fine to put that on the / partition feels a bit risky... It _should_ work since the / partition is typically 1G and has 833M available, but it feels discomforting. / Raimo > > All this could be done remote. > > Note that I can log in to a user where the home > directory is not NFS-mounted, in our case > /local_home/ > > On Thu, Nov 14, 2019 at 03:01:18PM +0100, Raimo Niskanen wrote: > > The use case for this patch is that in our lab network we have NFS > > automounted /home/* directories, so using /home/_sysupgrade > > for sysupgrade does not work. > > > > With this patch it is easy to modify /usr/sbin/sysupgrade and change > > just the line SETSDIR=/home/_sysupgrade to point to some other local file > > system that is outside hier(7) for example /opt/_sysupgrade > > or /srv/_sysupgrade. > > > > Even using /var/_sysupgrade or /usr/_sysupgrade should work. As far as > > I can tell the sysupgrade directory only has to be on a local file system, > > and not get overwritten by the base system install. > > > > The change for mkdir -p ${SETSDIR} is to make the script more defensive > > about > > the result of mkdir, e.g in case the umask is wrong, or if the directory > > containing the sysupgrade directory has got the wrong group, etc. > > > > > > A follow-up to this patch, should it be accepted, could be to add an option > > -d SysupgradeDir, but I do not know if that would be considered as a too odd > > and error prone feature to merit an option. Or? > > > > The patch is on 6.6 stable. > > > > Index: usr.sbin/sysupgrade/sysupgrade.sh > > === > > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v > > retrieving revision 1.25 > > diff -u -u -r1.25 sysupgrade.sh > > --- usr.sbin/sysupgrade/sysupgrade.sh 28 Sep 2019 17:30:07 - > > 1.25 > > +++ usr.sbin/sysupgrade/sysupgrade.sh 14 Nov 2019 13:27:34 - > > @@ -119,6 +119,7 @@ > > URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ > > fi > > > > +[[ -e ${SETSDIR} ]] || mkdir -p ${SETSDIR} > > if [[ -e ${SETSDIR} ]]; then > > eval $(stat -s ${SETSDIR}) > > [[ $st_uid -eq 0 ]] || > > @@ -127,8 +128,6 @@ > > ug_err "${SETSDIR} needs to be owned by root:wheel" > > [[ $st_mode -eq 040755 ]] || > > ug_err "${SETSDIR} is not a directory with permissions 0755" > > -else > > - mkdir -p ${SETSDIR} > > fi > > > > cd ${SETSDIR} > > @@ -185,7 +184,7 @@ > > > > cat <<__EOT >/auto_upgrade.conf > > Location of sets = disk > > -Pathname to the sets = /home/_sysupgrade/ > > +Pathname to the sets = ${SETSDIR}/ > > Set name(s) = done > > Directory does not contain SHA256.sig. Continue without verification = yes > > __EOT > > @@ -193,7 +192,7 @@ > > if ! ${KEEP}; then > > CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g') > > cat <<__EOT > /etc/rc.firsttime > > -rm -f /home/_sysupgrade/{${CLEAN}} > > +rm -f ${SETSDIR}/{${CLEAN}} > > __EOT > > fi > > > > Best regards > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > -- > Nils Ola Nilsson, email nils...@abc.se, tel +46-70-374 69 89 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB
Re: Patch suggestion for sysupgrade
On Thu, Nov 14, 2019 at 04:59:23PM +, gil...@poolp.org wrote: > A similar patch for this was sent to tech@ by Renaud Allard, you might want to > go review the "sysupgrade: Allow to use another directory for data sets" > thread > and comment it. Thanks for the pointer! I see in that thread that this is hard to find a safe solution to this problem... / Raimo > > > November 14, 2019 3:01 PM, "Raimo Niskanen" > wrote: > > > The use case for this patch is that in our lab network we have NFS > > automounted /home/* directories, so using /home/_sysupgrade > > for sysupgrade does not work. > > > > With this patch it is easy to modify /usr/sbin/sysupgrade and change > > just the line SETSDIR=/home/_sysupgrade to point to some other local file > > system that is outside hier(7) for example /opt/_sysupgrade > > or /srv/_sysupgrade. > > > > Even using /var/_sysupgrade or /usr/_sysupgrade should work. As far as > > I can tell the sysupgrade directory only has to be on a local file system, > > and not get overwritten by the base system install. > > > > The change for mkdir -p ${SETSDIR} is to make the script more defensive > > about > > the result of mkdir, e.g in case the umask is wrong, or if the directory > > containing the sysupgrade directory has got the wrong group, etc. > > > > A follow-up to this patch, should it be accepted, could be to add an option > > -d SysupgradeDir, but I do not know if that would be considered as a too odd > > and error prone feature to merit an option. Or? > > > > The patch is on 6.6 stable. > > > > Index: usr.sbin/sysupgrade/sysupgrade.sh > > === > > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v > > retrieving revision 1.25 > > diff -u -u -r1.25 sysupgrade.sh > > --- usr.sbin/sysupgrade/sysupgrade.sh 28 Sep 2019 17:30:07 - 1.25 > > +++ usr.sbin/sysupgrade/sysupgrade.sh 14 Nov 2019 13:27:34 - > > @@ -119,6 +119,7 @@ > > URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ > > fi > > > > +[[ -e ${SETSDIR} ]] || mkdir -p ${SETSDIR} > > if [[ -e ${SETSDIR} ]]; then > > eval $(stat -s ${SETSDIR}) > > [[ $st_uid -eq 0 ]] || > > @@ -127,8 +128,6 @@ > > ug_err "${SETSDIR} needs to be owned by root:wheel" > > [[ $st_mode -eq 040755 ]] || > > ug_err "${SETSDIR} is not a directory with permissions 0755" > > -else > > - mkdir -p ${SETSDIR} > > fi > > > > cd ${SETSDIR} > > @@ -185,7 +184,7 @@ > > > > cat <<__EOT >/auto_upgrade.conf > > Location of sets = disk > > -Pathname to the sets = /home/_sysupgrade/ > > +Pathname to the sets = ${SETSDIR}/ > > Set name(s) = done > > Directory does not contain SHA256.sig. Continue without verification = yes > > __EOT > > @@ -193,7 +192,7 @@ > > if ! ${KEEP}; then > > CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g') > > cat <<__EOT > /etc/rc.firsttime > > -rm -f /home/_sysupgrade/{${CLEAN}} > > +rm -f ${SETSDIR}/{${CLEAN}} > > __EOT > > fi > > > > Best regards > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB
Re: Patch suggestion for sysupgrade
I have upgraded a machine where /home was NFS-mounted, like this: - check that the / partition has space for the files that will populate /home/_sysupgrade - unmount /home - comment ut the /home line in /etc/fstab - upgrade with sysupgrade - restore the line in /etc/fstab - mount -a All this could be done remote. Note that I can log in to a user where the home directory is not NFS-mounted, in our case /local_home/ On Thu, Nov 14, 2019 at 03:01:18PM +0100, Raimo Niskanen wrote: > The use case for this patch is that in our lab network we have NFS > automounted /home/* directories, so using /home/_sysupgrade > for sysupgrade does not work. > > With this patch it is easy to modify /usr/sbin/sysupgrade and change > just the line SETSDIR=/home/_sysupgrade to point to some other local file > system that is outside hier(7) for example /opt/_sysupgrade > or /srv/_sysupgrade. > > Even using /var/_sysupgrade or /usr/_sysupgrade should work. As far as > I can tell the sysupgrade directory only has to be on a local file system, > and not get overwritten by the base system install. > > The change for mkdir -p ${SETSDIR} is to make the script more defensive about > the result of mkdir, e.g in case the umask is wrong, or if the directory > containing the sysupgrade directory has got the wrong group, etc. > > > A follow-up to this patch, should it be accepted, could be to add an option > -d SysupgradeDir, but I do not know if that would be considered as a too odd > and error prone feature to merit an option. Or? > > The patch is on 6.6 stable. > > Index: usr.sbin/sysupgrade/sysupgrade.sh > === > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v > retrieving revision 1.25 > diff -u -u -r1.25 sysupgrade.sh > --- usr.sbin/sysupgrade/sysupgrade.sh 28 Sep 2019 17:30:07 - 1.25 > +++ usr.sbin/sysupgrade/sysupgrade.sh 14 Nov 2019 13:27:34 - > @@ -119,6 +119,7 @@ > URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ > fi > > +[[ -e ${SETSDIR} ]] || mkdir -p ${SETSDIR} > if [[ -e ${SETSDIR} ]]; then > eval $(stat -s ${SETSDIR}) > [[ $st_uid -eq 0 ]] || > @@ -127,8 +128,6 @@ >ug_err "${SETSDIR} needs to be owned by root:wheel" > [[ $st_mode -eq 040755 ]] || > ug_err "${SETSDIR} is not a directory with permissions 0755" > -else > - mkdir -p ${SETSDIR} > fi > > cd ${SETSDIR} > @@ -185,7 +184,7 @@ > > cat <<__EOT >/auto_upgrade.conf > Location of sets = disk > -Pathname to the sets = /home/_sysupgrade/ > +Pathname to the sets = ${SETSDIR}/ > Set name(s) = done > Directory does not contain SHA256.sig. Continue without verification = yes > __EOT > @@ -193,7 +192,7 @@ > if ! ${KEEP}; then > CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g') > cat <<__EOT > /etc/rc.firsttime > -rm -f /home/_sysupgrade/{${CLEAN}} > +rm -f ${SETSDIR}/{${CLEAN}} > __EOT > fi > > Best regards > -- > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- Nils Ola Nilsson, email nils...@abc.se, tel +46-70-374 69 89 signature.asc Description: PGP signature
Re: Patch suggestion for sysupgrade
A similar patch for this was sent to tech@ by Renaud Allard, you might want to go review the "sysupgrade: Allow to use another directory for data sets" thread and comment it. November 14, 2019 3:01 PM, "Raimo Niskanen" wrote: > The use case for this patch is that in our lab network we have NFS > automounted /home/* directories, so using /home/_sysupgrade > for sysupgrade does not work. > > With this patch it is easy to modify /usr/sbin/sysupgrade and change > just the line SETSDIR=/home/_sysupgrade to point to some other local file > system that is outside hier(7) for example /opt/_sysupgrade > or /srv/_sysupgrade. > > Even using /var/_sysupgrade or /usr/_sysupgrade should work. As far as > I can tell the sysupgrade directory only has to be on a local file system, > and not get overwritten by the base system install. > > The change for mkdir -p ${SETSDIR} is to make the script more defensive about > the result of mkdir, e.g in case the umask is wrong, or if the directory > containing the sysupgrade directory has got the wrong group, etc. > > A follow-up to this patch, should it be accepted, could be to add an option > -d SysupgradeDir, but I do not know if that would be considered as a too odd > and error prone feature to merit an option. Or? > > The patch is on 6.6 stable. > > Index: usr.sbin/sysupgrade/sysupgrade.sh > === > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v > retrieving revision 1.25 > diff -u -u -r1.25 sysupgrade.sh > --- usr.sbin/sysupgrade/sysupgrade.sh 28 Sep 2019 17:30:07 - 1.25 > +++ usr.sbin/sysupgrade/sysupgrade.sh 14 Nov 2019 13:27:34 - > @@ -119,6 +119,7 @@ > URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ > fi > > +[[ -e ${SETSDIR} ]] || mkdir -p ${SETSDIR} > if [[ -e ${SETSDIR} ]]; then > eval $(stat -s ${SETSDIR}) > [[ $st_uid -eq 0 ]] || > @@ -127,8 +128,6 @@ > ug_err "${SETSDIR} needs to be owned by root:wheel" > [[ $st_mode -eq 040755 ]] || > ug_err "${SETSDIR} is not a directory with permissions 0755" > -else > - mkdir -p ${SETSDIR} > fi > > cd ${SETSDIR} > @@ -185,7 +184,7 @@ > > cat <<__EOT >/auto_upgrade.conf > Location of sets = disk > -Pathname to the sets = /home/_sysupgrade/ > +Pathname to the sets = ${SETSDIR}/ > Set name(s) = done > Directory does not contain SHA256.sig. Continue without verification = yes > __EOT > @@ -193,7 +192,7 @@ > if ! ${KEEP}; then > CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g') > cat <<__EOT > /etc/rc.firsttime > -rm -f /home/_sysupgrade/{${CLEAN}} > +rm -f ${SETSDIR}/{${CLEAN}} > __EOT > fi > > Best regards > -- > / Raimo Niskanen, Erlang/OTP, Ericsson AB
Patch suggestion for sysupgrade
The use case for this patch is that in our lab network we have NFS automounted /home/* directories, so using /home/_sysupgrade for sysupgrade does not work. With this patch it is easy to modify /usr/sbin/sysupgrade and change just the line SETSDIR=/home/_sysupgrade to point to some other local file system that is outside hier(7) for example /opt/_sysupgrade or /srv/_sysupgrade. Even using /var/_sysupgrade or /usr/_sysupgrade should work. As far as I can tell the sysupgrade directory only has to be on a local file system, and not get overwritten by the base system install. The change for mkdir -p ${SETSDIR} is to make the script more defensive about the result of mkdir, e.g in case the umask is wrong, or if the directory containing the sysupgrade directory has got the wrong group, etc. A follow-up to this patch, should it be accepted, could be to add an option -d SysupgradeDir, but I do not know if that would be considered as a too odd and error prone feature to merit an option. Or? The patch is on 6.6 stable. Index: usr.sbin/sysupgrade/sysupgrade.sh === RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v retrieving revision 1.25 diff -u -u -r1.25 sysupgrade.sh --- usr.sbin/sysupgrade/sysupgrade.sh 28 Sep 2019 17:30:07 - 1.25 +++ usr.sbin/sysupgrade/sysupgrade.sh 14 Nov 2019 13:27:34 - @@ -119,6 +119,7 @@ URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ fi +[[ -e ${SETSDIR} ]] || mkdir -p ${SETSDIR} if [[ -e ${SETSDIR} ]]; then eval $(stat -s ${SETSDIR}) [[ $st_uid -eq 0 ]] || @@ -127,8 +128,6 @@ ug_err "${SETSDIR} needs to be owned by root:wheel" [[ $st_mode -eq 040755 ]] || ug_err "${SETSDIR} is not a directory with permissions 0755" -else - mkdir -p ${SETSDIR} fi cd ${SETSDIR} @@ -185,7 +184,7 @@ cat <<__EOT >/auto_upgrade.conf Location of sets = disk -Pathname to the sets = /home/_sysupgrade/ +Pathname to the sets = ${SETSDIR}/ Set name(s) = done Directory does not contain SHA256.sig. Continue without verification = yes __EOT @@ -193,7 +192,7 @@ if ! ${KEEP}; then CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g') cat <<__EOT > /etc/rc.firsttime -rm -f /home/_sysupgrade/{${CLEAN}} +rm -f ${SETSDIR}/{${CLEAN}} __EOT fi Best regards -- / Raimo Niskanen, Erlang/OTP, Ericsson AB