Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-30 Thread Paul de Weerd
On Mon, Aug 30, 2010 at 04:28:08PM +0200, Martin Schr?der wrote:
| 2010/8/27 Paul de Weerd :
| > This new uid stuff is really cool, thanks jsing@ !
|
| Cool :-) 4.8?

See revisions 1.161, 1.162, 1.163 and 1.164 of sbin/disklabel.c for a
smaple of some of the changes that were committed.  These examples
were all ~4 months ago, so well before the lock for 4.8.  Draw your
own conclusions from that :)

So, yeah, pre-order 4.8 as soon as you can !

Cheers,

Paul 'WEiRD' de Weerd

--
>[<++>-]<+++.>+++[<-->-]<.>+++[<+
+++>-]<.>++[<>-]<+.--.[-]
 http://www.undeadly.org



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-30 Thread Martin Schröder
2010/8/27 Paul de Weerd :
> This new uid stuff is really cool, thanks jsing@ !

Cool :-) 4.8?

Best
   Martin



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-30 Thread Raimo Niskanen
On Sat, Aug 28, 2010 at 05:05:27AM -0400, Olivier Cherrier wrote:
> On Fri, Aug 27, 2010 at 05:04:57PM +0200, we...@weirdnet.nl wrote:
> > Don't. There's no need. Here's how you do it even easier (requires
> > recent snap / source)
> > 
> > [ -f /dev/diskmap ] || ( cd /dev; sudo MAKEDEV diskmap ) 
> > echo wq | disklabel -E YOURDISK
> > UID=`disklabel YOURDISK | grep ^uid: | cut -f2 -d' '`
> > { echo ",s#/dev/YOURDISK#${UID}.#"; echo w; } | ed - /etc/fstab
> > 
> > Do not try this until you understand what it does.  You'll have to
> > edit it to your needs anyway.
> > 
> > This new uid stuff is really cool, thanks jsing@ !
> 
> Yes, it's great... especially with softraid volumes!
> Thanks Joel!
> 
> $ grep '\.' /etc/fstab
> 08552bb5b53ec2df.a /usr ffs rw,nodev 1 2
> 08552bb5b53ec2df.g /usr/X11R6 ffs rw,nodev 1 2
> 08552bb5b53ec2df.b /usr/local ffs rw,nodev 1 2
> 08552bb5b53ec2df.e /usr/obj ffs rw,nodev,nosuid 1 2
> 08552bb5b53ec2df.h /usr/ports ffs rw,nodev,nosuid 1 2
> 08552bb5b53ec2df.d /usr/src ffs rw,nodev,nosuid 1 2
> 08552bb5b53ec2df.f /usr/xenocara ffs rw,nodev,nosuid 1 2
> 08552bb5b53ec2df.i /var ffs rw,nodev,nosuid 1 2
> 08552bb5b53ec2df.j /home ffs rw,nodev,nosuid 1 2
> 482c4eac2228bc96.a /data/tmp ffs rw,nodev,nosuid 1 2
> 482c4eac2228bc96.b /var/squidffs rw,nodev,nosuid 1 2
> c3b17d16762bcaf9.a /data/clients ffs rw 1 2

This is great! I have long been missing this kind of feature,
allthough I anticipated being able to mount by label, but this
might even be better...


I solved the problem together with the problem of encrypting
(through softraid) as much of the installation as possible for
example system configuration files under /etc roughly like this:
* USB disk partitions for swap, / and encrypted softraid.
* Encrypted softraid disk partitions for /etc, /altroot, /var, /tmp,
  /usr, /home, ...
* Hard links between /etc/{fstab,login.conf,ttys,rc,boot.conf} and
  /etc.boot/ on the USB disk, to be able to fix these files after
  the upcoming mount over of /etc.
* A new /etc/rc script on the USB key that:
  - Open (decrypt) the softraid encrypted disk.
  - fsck the softraid/etc partition
  - mount the softraid/etc partition over /etc
  - ed the new /etc/fstab to change the disk names into what
the boot disk and the encrypted softraid disk now are.
Use mount_mfs to create a writable /tmp in the process.
  - Start a background shell with the new /etc/ directory
as working directory to protect against accidental umount.
  - exec /bin/sh /etc/rc ${1+"$@"}
* A /etc/rc.shutdown script that updated /etc.boot/boot.conf on
  the USB disk with the content in /etc/boot.conf on the encrypted
  softraid disk.


Most of the difficult hazzle of editing /etc/fstab is hereby
unnecessary, so I can think hard about if the encryption of
/etc really is necessary for me.

Thank you very much for this usability improvement!

> 
> -- 
> Olivier Cherrier - Symacx.com
> mailto:o...@symacx.com

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-28 Thread Olivier Cherrier
On Fri, Aug 27, 2010 at 05:04:57PM +0200, we...@weirdnet.nl wrote:
> Don't. There's no need. Here's how you do it even easier (requires
> recent snap / source)
> 
> [ -f /dev/diskmap ] || ( cd /dev; sudo MAKEDEV diskmap ) 
> echo wq | disklabel -E YOURDISK
> UID=`disklabel YOURDISK | grep ^uid: | cut -f2 -d' '`
> { echo ",s#/dev/YOURDISK#${UID}.#"; echo w; } | ed - /etc/fstab
> 
> Do not try this until you understand what it does.  You'll have to
> edit it to your needs anyway.
> 
> This new uid stuff is really cool, thanks jsing@ !

Yes, it's great... especially with softraid volumes!
Thanks Joel!

$ grep '\.' /etc/fstab
08552bb5b53ec2df.a /usr ffs rw,nodev 1 2
08552bb5b53ec2df.g /usr/X11R6 ffs rw,nodev 1 2
08552bb5b53ec2df.b /usr/local ffs rw,nodev 1 2
08552bb5b53ec2df.e /usr/obj ffs rw,nodev,nosuid 1 2
08552bb5b53ec2df.h /usr/ports ffs rw,nodev,nosuid 1 2
08552bb5b53ec2df.d /usr/src ffs rw,nodev,nosuid 1 2
08552bb5b53ec2df.f /usr/xenocara ffs rw,nodev,nosuid 1 2
08552bb5b53ec2df.i /var ffs rw,nodev,nosuid 1 2
08552bb5b53ec2df.j /home ffs rw,nodev,nosuid 1 2
482c4eac2228bc96.a /data/tmp ffs rw,nodev,nosuid 1 2
482c4eac2228bc96.b /var/squidffs rw,nodev,nosuid 1 2
c3b17d16762bcaf9.a /data/clients ffs rw 1 2

-- 
Olivier Cherrier - Symacx.com
mailto:o...@symacx.com



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread sven falempin
Hello,

In older version, i used a script to modify the fstab during the boot,
something like : root_device=$(dmesg | awk '/root_device/ { print $1 });
perl -pe s/sd0/${root_device}/f -i /etc/fstab, looking for root_device in
dmesg
Sadly, we can't use root_device directly inside the fstab :(

vi won't work until you remount as read / write :mount -u

by

2010/8/27 Bryan Irvine 

> On Fri, Aug 27, 2010 at 5:38 AM, Marcus  wrote:
> > how to fix fstab in single user mode for bootable "Live" USB drive
> >
> > http://www.openbsd.org/faq/faq14.html#flashmemLive
> > says:
> > If your target machine has an ahci(4) or SCSI interface, you will
> > probably find your USB drive's identifier changing. Having multiple
> > versions of your /etc/fstab file may make this easier to "fix" (in
> > single user mode).
> >
> > Install OpenBSD to USB drive in a notbook.   the usb drive is
> > recognized as "sd1"
> >
> > Now put the USB drive into another PC an boot from USB. the usb dirve
> > is recognized as "sd0".
> >
> > in the single user mode.
> > "fsck -p / && mount -uw /"   not work
> > "fsck -p /usr && mount /usr" not work
> > "vi /etc/fstab" not work.
> >
> > question:
> > how to mount root / writable and active vi editor?
>
> Without looking, I'd guess that you need to change the last step to
>
> env TERM=vt100 vi /etc/fstab
>
>


--
 No doubt it is one of the functions of art to replace religious faith by
the effective ingredient of beauty. At least beauty must have the power of a
poem, that is to say of a crime.



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread Bryan Irvine
On Fri, Aug 27, 2010 at 5:38 AM, Marcus  wrote:
> how to fix fstab in single user mode for bootable "Live" USB drive
>
> http://www.openbsd.org/faq/faq14.html#flashmemLive
> says:
> If your target machine has an ahci(4) or SCSI interface, you will
> probably find your USB drive's identifier changing. Having multiple
> versions of your /etc/fstab file may make this easier to "fix" (in
> single user mode).
>
> Install OpenBSD to USB drive in a notbook.   the usb drive is
> recognized as "sd1"
>
> Now put the USB drive into another PC an boot from USB. the usb dirve
> is recognized as "sd0".
>
> in the single user mode.
> "fsck -p / && mount -uw /"   not work
> "fsck -p /usr && mount /usr" not work
> "vi /etc/fstab" not work.
>
> question:
> how to mount root / writable and active vi editor?

Without looking, I'd guess that you need to change the last step to

env TERM=vt100 vi /etc/fstab



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread Kenneth R Westerback
On Fri, Aug 27, 2010 at 05:04:57PM +0200, Paul de Weerd wrote:
> On Fri, Aug 27, 2010 at 08:38:57PM +0800, Marcus wrote:
> | how to fix fstab in single user mode for bootable "Live" USB drive
> | 
> | http://www.openbsd.org/faq/faq14.html#flashmemLive
> | says:
> | If your target machine has an ahci(4) or SCSI interface, you will
> | probably find your USB drive's identifier changing. Having multiple
> | versions of your /etc/fstab file may make this easier to "fix" (in
> | single user mode).
> | 
> | Install OpenBSD to USB drive in a notbook.   the usb drive is
> | recognized as "sd1"
> | 
> | Now put the USB drive into another PC an boot from USB. the usb dirve
> | is recognized as "sd0".
> | 
> | in the single user mode.
> | "fsck -p / && mount -uw /"   not work
> | "fsck -p /usr && mount /usr" not work
> | "vi /etc/fstab" not work.
> | 
> | question:
> | how to mount root / writable and active vi editor?
> 
> Don't. There's no need. Here's how you do it even easier (requires
> recent snap / source)
> 
> [ -f /dev/diskmap ] || ( cd /dev; sudo MAKEDEV diskmap ) 
> echo wq | disklabel -E YOURDISK
> UID=`disklabel YOURDISK | grep ^uid: | cut -f2 -d' '`
> { echo ",s#/dev/YOURDISK#${UID}.#"; echo w; } | ed - /etc/fstab
> 
> Do not try this until you understand what it does.  You'll have to
> edit it to your needs anyway.
> 
> This new uid stuff is really cool, thanks jsing@ !
> 
> Paul 'WEiRD' de Weerd
> 
> -- 
> >[<++>-]<+++.>+++[<-->-]<.>+++[<+
> +++>-]<.>++[<>-]<+.--.[-]
>  http://www.weirdnet.nl/ 

This is the correct answer. I have a USB stick I install/upgrade
to. I boot from it on systems where it appears as sd0, sd1, sd3,
sd4. Works perfectly.

All hail jsing!

. Ken



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread Paul de Weerd
On Fri, Aug 27, 2010 at 08:38:57PM +0800, Marcus wrote:
| how to fix fstab in single user mode for bootable "Live" USB drive
| 
| http://www.openbsd.org/faq/faq14.html#flashmemLive
| says:
| If your target machine has an ahci(4) or SCSI interface, you will
| probably find your USB drive's identifier changing. Having multiple
| versions of your /etc/fstab file may make this easier to "fix" (in
| single user mode).
| 
| Install OpenBSD to USB drive in a notbook.   the usb drive is
| recognized as "sd1"
| 
| Now put the USB drive into another PC an boot from USB. the usb dirve
| is recognized as "sd0".
| 
| in the single user mode.
| "fsck -p / && mount -uw /"   not work
| "fsck -p /usr && mount /usr" not work
| "vi /etc/fstab" not work.
| 
| question:
| how to mount root / writable and active vi editor?

Don't. There's no need. Here's how you do it even easier (requires
recent snap / source)

[ -f /dev/diskmap ] || ( cd /dev; sudo MAKEDEV diskmap ) 
echo wq | disklabel -E YOURDISK
UID=`disklabel YOURDISK | grep ^uid: | cut -f2 -d' '`
{ echo ",s#/dev/YOURDISK#${UID}.#"; echo w; } | ed - /etc/fstab

Do not try this until you understand what it does.  You'll have to
edit it to your needs anyway.

This new uid stuff is really cool, thanks jsing@ !

Paul 'WEiRD' de Weerd

-- 
>[<++>-]<+++.>+++[<-->-]<.>+++[<+
+++>-]<.>++[<>-]<+.--.[-]
 http://www.weirdnet.nl/ 



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread Nick Holland

On 08/27/10 08:38, Marcus wrote:

how to fix fstab in single user mode for bootable "Live" USB drive

http://www.openbsd.org/faq/faq14.html#flashmemLive
says:
If your target machine has an ahci(4) or SCSI interface, you will
probably find your USB drive's identifier changing. Having multiple
versions of your /etc/fstab file may make this easier to "fix" (in
single user mode).

Install OpenBSD to USB drive in a notbook.   the usb drive is
recognized as "sd1"

Now put the USB drive into another PC an boot from USB. the usb dirve
is recognized as "sd0".

in the single user mode.
"fsck -p /&&  mount -uw /"   not work
"fsck -p /usr&&  mount /usr" not work
"vi /etc/fstab" not work.

question:
how to mount root / writable and active vi editor?


mount by the device name rather than fstab...

fsck /dev/sd0a
mount /dev/sd0a /
fsck /dev/sd0d
mount /dev/sd0d /usr  # or whatever your /usr partition is
vi /etc/fstab

or... fsck and mount your root partition, and use 'ed(1)' to edit fstab.

Nick.



Re: how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread Antoine Jacoutot
On Fri, 27 Aug 2010, Marcus wrote:

> how to fix fstab in single user mode for bootable "Live" USB drive
> 
> http://www.openbsd.org/faq/faq14.html#flashmemLive
> says:
> If your target machine has an ahci(4) or SCSI interface, you will
> probably find your USB drive's identifier changing. Having multiple
> versions of your /etc/fstab file may make this easier to "fix" (in
> single user mode).
> 
> Install OpenBSD to USB drive in a notbook.   the usb drive is
> recognized as "sd1"
> 
> Now put the USB drive into another PC an boot from USB. the usb dirve
> is recognized as "sd0".

What *I* do is this:
$ sudo config -ef /bsd
-> then disable ahci.

-- 
Antoine



how to fix fstab in single user mode for bootable "Live" USB drive

2010-08-27 Thread Marcus
how to fix fstab in single user mode for bootable "Live" USB drive

http://www.openbsd.org/faq/faq14.html#flashmemLive
says:
If your target machine has an ahci(4) or SCSI interface, you will
probably find your USB drive's identifier changing. Having multiple
versions of your /etc/fstab file may make this easier to "fix" (in
single user mode).

Install OpenBSD to USB drive in a notbook.   the usb drive is
recognized as "sd1"

Now put the USB drive into another PC an boot from USB. the usb dirve
is recognized as "sd0".

in the single user mode.
"fsck -p / && mount -uw /"   not work
"fsck -p /usr && mount /usr" not work
"vi /etc/fstab" not work.

question:
how to mount root / writable and active vi editor?


thanks.