Re: [gentoo-user] Re: basic trouble with sendmail config
On Sunday 04 Dec 2016 21:28:06 John Covici wrote: > On Sun, 04 Dec 2016 21:23:34 -0500, > > Harry Putnam wrote: > > Volker Armin Hemmannwrites: > > > Am 04.12.2016 um 20:09 schrieb Harry Putnam: > > > > > > is there a good reason you chose sendmail over postfix? Do you hate > > > yourself? You are a masochist? > > > > > > I found sendmail the worst piece of software I ever had to deal with. > > > Windows XP user management in a mixed environment with shares is > > > delightful, writing bind config files or XFree86 configs by hand was > > > nice, easy and a joy compared to sendmail. > > > > All the above. If you are really into pain... where pulled > > fingernails are the lowest starter level ... sendmail is something > > I'd only dreamed about till now. > > > > OK, is there really nobody here that uses sendmail? > > > > I'm pretty sure the kind of immediate and complete failure I'm seeing > > is something horribly missconfigured and might not be that much to > > fix. If I could understand what is causing the fuss. > > I use it all the time with no problems. Did you do the -X or increase > the loglevel? What John said. In addition, pay particular attention both to ownership and access rights for sendmail directories and config files. They should not be world accessible for obvious security reasons and in addition access.db and aliases.db files should be owned by root. -- Regards, Mick signature.asc Description: This is a digitally signed message part.
Re: [gentoo-user] Re: basic trouble with sendmail config
On Sun, 04 Dec 2016 21:23:34 -0500, Harry Putnam wrote: > > Volker Armin Hemmannwrites: > > > Am 04.12.2016 um 20:09 schrieb Harry Putnam: > > > > is there a good reason you chose sendmail over postfix? Do you hate > > yourself? You are a masochist? > > > > I found sendmail the worst piece of software I ever had to deal with. > > Windows XP user management in a mixed environment with shares is > > delightful, writing bind config files or XFree86 configs by hand was > > nice, easy and a joy compared to sendmail. > > All the above. If you are really into pain... where pulled > fingernails are the lowest starter level ... sendmail is something > I'd only dreamed about till now. > > OK, is there really nobody here that uses sendmail? > > I'm pretty sure the kind of immediate and complete failure I'm seeing > is something horribly missconfigured and might not be that much to > fix. If I could understand what is causing the fuss. I use it all the time with no problems. Did you do the -X or increase the loglevel? -- Your life is like a penny. You're going to lose it. The question is: How do you spend it? John Covici cov...@ccs.covici.com
[gentoo-user] Re: basic trouble with sendmail config
Volker Armin Hemmannwrites: > Am 04.12.2016 um 20:09 schrieb Harry Putnam: > > is there a good reason you chose sendmail over postfix? Do you hate > yourself? You are a masochist? > > I found sendmail the worst piece of software I ever had to deal with. > Windows XP user management in a mixed environment with shares is > delightful, writing bind config files or XFree86 configs by hand was > nice, easy and a joy compared to sendmail. All the above. If you are really into pain... where pulled fingernails are the lowest starter level ... sendmail is something I'd only dreamed about till now. OK, is there really nobody here that uses sendmail? I'm pretty sure the kind of immediate and complete failure I'm seeing is something horribly missconfigured and might not be that much to fix. If I could understand what is causing the fuss.
Re: [gentoo-user] basic trouble with sendmail config
Am 04.12.2016 um 20:09 schrieb Harry Putnam: is there a good reason you chose sendmail over postfix? Do you hate yourself? You are a masochist? I found sendmail the worst piece of software I ever had to deal with. Windows XP user management in a mixed environment with shares is delightful, writing bind config files or XFree86 configs by hand was nice, easy and a joy compared to sendmail.
[gentoo-user] Re: basic trouble with sendmail config
"J. Roeleveld"writes: [...] > I stopped using sendmail when easier to configure alternatives came along. > Currently using Postfix. > > As such, I can't help in checking your config. But I do remember you > had to compile the config files into a format sendmail actually can > read. Did you do that part? Yes I m4'ed as explained in /usr/share/sendmail-cf/README I didn't post the *.cf files because the sendmail.cf if very long and not all that readable... and anyway what is in it is a direct result of what is in sendmail.mc I'm adding another piece of the output puzzle from /var/log/mail.log Dec 4 15:44:58 g0 sm-cm[8151]: uB4J3YBB003855: to=hputn...@gmail.com, ctladdr=harry (1000/1050), delay=01:41:24, xdelay=00:00:00, mailer=relay, pri=936804, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: 451 4.3.0 Temporary system failure. Please try again later.
Re: [gentoo-user] basic trouble with sendmail config
On Sun, 04 Dec 2016 14:09:39 -0500, Harry Putnam wrote: > > After setting up the files for sendmail on my first attempt at > sending a msg I get this error as reported in the smtp conversation: > >Temporary system failure > > That is a new one to me, and doesn't give much to start on. > > It appears not to even get past the submit agent. > > (Running a little script that uses mailx in verbose mode to capture > the action .. Runs the mailx command as shown below: > > harry > tmail hputn...@gmail.com > sending like this: > mailx -v -s "TEST 161204_134640 g0" hputn...@gmail.com < > /tmp/msg-161204_134640 > hputn...@gmail.com... Connecting to [127.0.0.1] via relay... > 220 g0.local.lan ESMTP Sendmail 8.14.9/8.14.9; Sun, 4 Dec 2016 13:46:43 > -0500 > >>> EHLO g0.local.lan > 250-g0.local.lan Hello g0.local.lan [127.0.0.1], pleased to meet you > 250 ENHANCEDSTATUSCODES > >>> MAIL From:> 451 4.3.0 Temporary system failure. Please try again later. > hputn...@gmail.com... Deferred: 451 4.3.0 Temporary system failure. Please > try again later. > Closing connection to [127.0.0.1] > >>> QUIT > 221 2.0.0 g0.local.lan closing connection > > sendmail.mc and submit.mc posted below: > > (Sorry about excessive data but seems necessary for this) > --- --- ---=--- --- --- > > sendmail.mc: > > divert(-1)dnl > #- > # $Sendmail: debproto.mc,v 8.14.4 2010-11-03 22:42:40 cowboy Exp $ > # > # Copyright (c) 1998-2010 Richard Nelson. All Rights Reserved. > # > # cf/debian/sendmail.mc. Generated from sendmail.mc.in by configure. > # > # sendmail.mc prototype config file for building Sendmail 8.14.4 > # > # Note: the .in file supports 8.7.6 - 9.0.0, but the generated > # file is customized to the version noted above. > # > # This file is used to configure Sendmail for use with Debian systems. > # > # If you modify this file, you will have to regenerate /etc/mail/sendmail.cf > # by running this file through the m4 preprocessor via one of the following: > # * make (or make -C /etc/mail) > # * sendmailconfig > # * m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf > # The first two options are preferred as they will also update other files > # that depend upon the contents of this file. > # > # The best documentation for this .mc file is: > # /usr/share/doc/sendmail-doc/cf.README.gz > # > #- > divert(0)dnl > # > # Copyright (c) 1998-2005 Richard Nelson. All Rights Reserved. > # > # This file is used to configure Sendmail for use with Debian systems. > # > dnl define(`_USE_ETC_MAIL_')dnl > include(`/usr/share/sendmail-cf/m4/cf.m4')dnl > > VERSIONID(`$Id: hp1.mc,v 1.20 2016/12/04 11:17:08 g0 Exp $') > dnl # [HP 161204_101845 OSTYPE(`debian')dnl > dnl # changed to gentoo > OSTYPE(`linux')dnl > dnl # ] > DOMAIN(`generic')dnl > dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE > dnl undefine(`confHOST_STATUS_DIRECTORY')dnl#DAEMON_HOSTSTATS= > dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE > dnl # > dnl # General defines > dnl # > dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot() > dnl # into this directory before writing files. > dnl # If *all* your user accounts are under /home then use that > dnl # instead - it will prevent any writes outside of /home ! > dnl # define(`confSAFE_FILE_ENV', `')dnl > dnl # > dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!! > dnl # Remove `, Addr=' clauses to receive from any interface > dnl # If you want to support IPv6, switch the commented/uncommentd lines > dnl # > define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl > dnl the next one doesn't need to be present for client auth > define(`confAUTH_MECHANISMS',`LOGIN PLAIN')dnl > FEATURE(`access_db',`hash -T /etc/mail/access.db')dnl > > FEATURE(`no_default_msa')dnl > dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl > DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp')dnl > dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, > Addr=::1')dnl > DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, M=Ea')dnl > dnl LOCAL_DOMAIN('g0.local.lan')dnl > dnl # > dnl # Be somewhat anal in what we allow > dnl CK define(`confPRIVACY_FLAGS', > `needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl > dnl # > dnl # Define connection throttling and window length > define(`confCONNECTION_RATE_THROTTLE', `15')dnl > define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl > dnl # > dnl # Features > dnl # > dnl # use /etc/mail/local-host-names > dnl # [HP 161204_101724 FEATURE(`use_cw_file')dnl > dnl # Stopped using cw until further notice ] > dnl # > dnl # The greet_pause feature stops some automail bots - but
Re: [gentoo-user] Bash script: make a convenient /mnt/gentoo tree for a new install or development
On Sun, 04 Dec 2016 13:17:10 -0500, Rich Freeman wrote: > > On Sun, Dec 4, 2016 at 12:59 PM, Gregory Woodburywrote: > > The Gentoo Handbook provides detailed instructions for preparing a > > /mnt/gentoo > > file system tree for new installations. After having to dig through the > > Handbook a > > few times of doing new or re-installs of Gentoo using an existing Gentoo > > install > > as the base system, I wrote this script as a shortcut way to handle the > > process > > of doing the mounting of /mnt/gentoo either the first time or again after a > > re-boot. > > IMO it would be a lot easier if we just had an install CD that > included nspawn. :) For whatever reason there seems to be a lack of > systemd-based rescue CDs out there. While I'm placing orders I'd like > ZFS on Linux support on it as well. :) That would be nice, I have made one, but its customized a bit, but using catalyst it did work. -- Your life is like a penny. You're going to lose it. The question is: How do you spend it? John Covici cov...@ccs.covici.com
Re: [gentoo-user] Bash script: make a convenient /mnt/gentoo tree for a new install or development
On Sun, 4 Dec 2016 13:17:10 -0500, Rich Freeman wrote: > IMO it would be a lot easier if we just had an install CD that > included nspawn. :) For whatever reason there seems to be a lack of > systemd-based rescue CDs out there. While I'm placing orders I'd like > ZFS on Linux support on it as well. :) I'll second that. I'd even go so far as to say I'd pay twice as much for such a CD as I do for System Rescue Cd ;-) -- Neil Bothwick The best things in life are free, but the expensive ones are still worth a look. pgpe2RbGp8OBj.pgp Description: OpenPGP digital signature
Re: [gentoo-user] basic trouble with sendmail config
On December 4, 2016 8:09:39 PM GMT+01:00, Harry Putnamwrote: >After setting up the files for sendmail on my first attempt at >sending a msg I get this error as reported in the smtp conversation: > > Temporary system failure > >That is a new one to me, and doesn't give much to start on. > >It appears not to even get past the submit agent. > >(Running a little script that uses mailx in verbose mode to capture >the action .. Runs the mailx command as shown below: > > harry > tmail hputn...@gmail.com > sending like this: >mailx -v -s "TEST 161204_134640 g0" hputn...@gmail.com < >/tmp/msg-161204_134640 > hputn...@gmail.com... Connecting to [127.0.0.1] via relay... >220 g0.local.lan ESMTP Sendmail 8.14.9/8.14.9; Sun, 4 Dec 2016 13:46:43 >-0500 > >>> EHLO g0.local.lan > 250-g0.local.lan Hello g0.local.lan [127.0.0.1], pleased to meet you > 250 ENHANCEDSTATUSCODES > >>> MAIL From: > 451 4.3.0 Temporary system failure. Please try again later. >hputn...@gmail.com... Deferred: 451 4.3.0 Temporary system failure. >Please try again later. > Closing connection to [127.0.0.1] > >>> QUIT > 221 2.0.0 g0.local.lan closing connection > >sendmail.mc and submit.mc posted below: > >(Sorry about excessive data but seems necessary for this) >--- --- ---=--- --- --- > >sendmail.mc: > >divert(-1)dnl >#- ># $Sendmail: debproto.mc,v 8.14.4 2010-11-03 22:42:40 cowboy Exp $ ># ># Copyright (c) 1998-2010 Richard Nelson. All Rights Reserved. ># ># cf/debian/sendmail.mc. Generated from sendmail.mc.in by configure. ># ># sendmail.mc prototype config file for building Sendmail 8.14.4 ># ># Note: the .in file supports 8.7.6 - 9.0.0, but the generated ># file is customized to the version noted above. ># ># This file is used to configure Sendmail for use with Debian systems. ># ># If you modify this file, you will have to regenerate >/etc/mail/sendmail.cf ># by running this file through the m4 preprocessor via one of the >following: ># * make (or make -C /etc/mail) ># * sendmailconfig ># * m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf ># The first two options are preferred as they will also update other >files ># that depend upon the contents of this file. ># ># The best documentation for this .mc file is: ># /usr/share/doc/sendmail-doc/cf.README.gz ># >#- >divert(0)dnl ># ># Copyright (c) 1998-2005 Richard Nelson. All Rights Reserved. ># ># This file is used to configure Sendmail for use with Debian systems. ># >dnl define(`_USE_ETC_MAIL_')dnl >include(`/usr/share/sendmail-cf/m4/cf.m4')dnl > >VERSIONID(`$Id: hp1.mc,v 1.20 2016/12/04 11:17:08 g0 Exp $') >dnl # [HP 161204_101845 OSTYPE(`debian')dnl >dnl # changed to gentoo >OSTYPE(`linux')dnl >dnl # ] >DOMAIN(`generic')dnl >dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE >dnl undefine(`confHOST_STATUS_DIRECTORY')dnl#DAEMON_HOSTSTATS= >dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE >dnl # >dnl # General defines >dnl # >dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot() >dnl # into this directory before writing files. >dnl # If *all* your user accounts are under /home then use that >dnl # instead - it will prevent any writes outside of /home ! >dnl # define(`confSAFE_FILE_ENV', `')dnl >dnl # >dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!! >dnl # Remove `, Addr=' clauses to receive from any interface >dnl # If you want to support IPv6, switch the commented/uncommentd >lines >dnl # >define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl >dnl the next one doesn't need to be present for client auth >define(`confAUTH_MECHANISMS',`LOGIN PLAIN')dnl >FEATURE(`access_db',`hash -T /etc/mail/access.db')dnl > >FEATURE(`no_default_msa')dnl >dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl >DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp')dnl >dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, >Addr=::1')dnl >DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, M=Ea')dnl >dnl LOCAL_DOMAIN('g0.local.lan')dnl >dnl # >dnl # Be somewhat anal in what we allow >dnl CK define(`confPRIVACY_FLAGS', >`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl >dnl # >dnl # Define connection throttling and window length >define(`confCONNECTION_RATE_THROTTLE', `15')dnl >define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl >dnl # >dnl # Features >dnl # >dnl # use /etc/mail/local-host-names >dnl # [HP 161204_101724 FEATURE(`use_cw_file')dnl >dnl # Stopped using cw until further notice ] >dnl # >dnl # The greet_pause feature stops some automail bots - but check the >dnl # provided access db for details on excluding localhosts... >FEATURE(`greet_pause',
[gentoo-user] basic trouble with sendmail config
After setting up the files for sendmail on my first attempt at sending a msg I get this error as reported in the smtp conversation: Temporary system failure That is a new one to me, and doesn't give much to start on. It appears not to even get past the submit agent. (Running a little script that uses mailx in verbose mode to capture the action .. Runs the mailx command as shown below: harry > tmail hputn...@gmail.com sending like this: mailx -v -s "TEST 161204_134640 g0" hputn...@gmail.com < /tmp/msg-161204_134640 hputn...@gmail.com... Connecting to [127.0.0.1] via relay... 220 g0.local.lan ESMTP Sendmail 8.14.9/8.14.9; Sun, 4 Dec 2016 13:46:43 -0500 >>> EHLO g0.local.lan 250-g0.local.lan Hello g0.local.lan [127.0.0.1], pleased to meet you 250 ENHANCEDSTATUSCODES >>> MAIL From:451 4.3.0 Temporary system failure. Please try again later. hputn...@gmail.com... Deferred: 451 4.3.0 Temporary system failure. Please try again later. Closing connection to [127.0.0.1] >>> QUIT 221 2.0.0 g0.local.lan closing connection sendmail.mc and submit.mc posted below: (Sorry about excessive data but seems necessary for this) --- --- ---=--- --- --- sendmail.mc: divert(-1)dnl #- # $Sendmail: debproto.mc,v 8.14.4 2010-11-03 22:42:40 cowboy Exp $ # # Copyright (c) 1998-2010 Richard Nelson. All Rights Reserved. # # cf/debian/sendmail.mc. Generated from sendmail.mc.in by configure. # # sendmail.mc prototype config file for building Sendmail 8.14.4 # # Note: the .in file supports 8.7.6 - 9.0.0, but the generated # file is customized to the version noted above. # # This file is used to configure Sendmail for use with Debian systems. # # If you modify this file, you will have to regenerate /etc/mail/sendmail.cf # by running this file through the m4 preprocessor via one of the following: # * make (or make -C /etc/mail) # * sendmailconfig # * m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf # The first two options are preferred as they will also update other files # that depend upon the contents of this file. # # The best documentation for this .mc file is: # /usr/share/doc/sendmail-doc/cf.README.gz # #- divert(0)dnl # # Copyright (c) 1998-2005 Richard Nelson. All Rights Reserved. # # This file is used to configure Sendmail for use with Debian systems. # dnl define(`_USE_ETC_MAIL_')dnl include(`/usr/share/sendmail-cf/m4/cf.m4')dnl VERSIONID(`$Id: hp1.mc,v 1.20 2016/12/04 11:17:08 g0 Exp $') dnl # [HP 161204_101845 OSTYPE(`debian')dnl dnl # changed to gentoo OSTYPE(`linux')dnl dnl # ] DOMAIN(`generic')dnl dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE dnl undefine(`confHOST_STATUS_DIRECTORY')dnl#DAEMON_HOSTSTATS= dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE dnl # dnl # General defines dnl # dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot() dnl # into this directory before writing files. dnl # If *all* your user accounts are under /home then use that dnl # instead - it will prevent any writes outside of /home ! dnl # define(`confSAFE_FILE_ENV', `')dnl dnl # dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!! dnl # Remove `, Addr=' clauses to receive from any interface dnl # If you want to support IPv6, switch the commented/uncommentd lines dnl # define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl dnl the next one doesn't need to be present for client auth define(`confAUTH_MECHANISMS',`LOGIN PLAIN')dnl FEATURE(`access_db',`hash -T /etc/mail/access.db')dnl FEATURE(`no_default_msa')dnl dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp')dnl dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, Addr=::1')dnl DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, M=Ea')dnl dnl LOCAL_DOMAIN('g0.local.lan')dnl dnl # dnl # Be somewhat anal in what we allow dnl CK define(`confPRIVACY_FLAGS', `needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl dnl # dnl # Define connection throttling and window length define(`confCONNECTION_RATE_THROTTLE', `15')dnl define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl dnl # dnl # Features dnl # dnl # use /etc/mail/local-host-names dnl # [HP 161204_101724 FEATURE(`use_cw_file')dnl dnl # Stopped using cw until further notice ] dnl # dnl # The greet_pause feature stops some automail bots - but check the dnl # provided access db for details on excluding localhosts... FEATURE(`greet_pause', `1000')dnl 1 seconds dnl # dnl # Delay_checks allows sender<->recipient checking FEATURE(`delay_checks', `friend', `n')dnl dnl # dnl # If we get too many bad recipients, slow things down... dnl CK
Re: [gentoo-user] Bash script: make a convenient /mnt/gentoo tree for a new install or development
On Sun, Dec 4, 2016 at 12:59 PM, Gregory Woodburywrote: > The Gentoo Handbook provides detailed instructions for preparing a > /mnt/gentoo > file system tree for new installations. After having to dig through the > Handbook a > few times of doing new or re-installs of Gentoo using an existing Gentoo > install > as the base system, I wrote this script as a shortcut way to handle the > process > of doing the mounting of /mnt/gentoo either the first time or again after a > re-boot. IMO it would be a lot easier if we just had an install CD that included nspawn. :) For whatever reason there seems to be a lack of systemd-based rescue CDs out there. While I'm placing orders I'd like ZFS on Linux support on it as well. :) -- Rich
[gentoo-user] Bash script: make a convenient /mnt/gentoo tree for a new install or development
The Gentoo Handbook provides detailed instructions for preparing a /mnt/gentoo file system tree for new installations. After having to dig through the Handbook a few times of doing new or re-installs of Gentoo using an existing Gentoo install as the base system, I wrote this script as a shortcut way to handle the process of doing the mounting of /mnt/gentoo either the first time or again after a re-boot. 1. The device containing the new file-system for the chroot MUST be already made with mkfs. 2. Read through the script and remove, add, or change directory creations or bind/rbind mounts for your environment. 3. This presumes that the sudo command is available and set up for group wheel to have access to all commands with :NOPASSWD and that you are a member of group wheel. 4. Newer file-system types, such as ext4 or btrfs, do not really care about the sequence of directories made in the root. (I just have this habit from doing things on systems that did care.) 5. Watch out for email line wrapping in inappropriate places. 6. Enjoy a hopefully easier experience. - #!/bin/bash # # script to mount the devices for a new chroot of /mnt/gentoo for building a new system # # 2015-05-02 ggwfirst version # 2016-01-23 ggw2nd version # 2016-02-06 ggw some additions # # function usage function usage { echo "usage:$0 " echo " where is the partition to mount as /mnt/gentoo" exit 1 } # check for required argument and then its type if [ $# -lt 1 ] # no argument given? then usage; elif [ ! -b $1 ]# it is not a block device? then usage; fi # presume the argument is what it claims to be FIXME # this needs sudo setup properly, too hard to really check for now rEUID=`id -u` # who are we? if [ $rEUID -eq 0 ] #root? then prefix="" else prefix="/usr/bin/sudo" fi # make sure /mnt/gentoo exists if [ ! -d /mnt/gentoo ] then echo "WARNING: /mnt/gentoo does not exist!" eval $prefix mkdir /mnt/gentoo fi # mount the block device to /mnt/gentoo eval $prefix mount $1 /mnt/gentoo if [ $? -ne 0 ] then echo "FAILURE: cound not mount device, code = " $? exit 3 fi # now mount the proc, dev and sys pseudo-filesystems eval $prefix mkdir -p /mnt/gentoo/proc eval $prefix mount -t proc proc /mnt/gentoo/proc if [ $? -ne 0 ] then echo "FAILURE: could not add new proc filesystem to /mnt/gentoo" exit 4 fi eval $prefix mkdir -p /mnt/gentoo/dev eval $prefix mount --rbind /dev /mnt/gentoo/dev if [ $? -ne 0 ] then echo "FAILURE: cound not bind /dev to /mnt/gentoo/dev" exit 5 fi eval $prefix mkdir -p /mnt/gentoo/sys eval $prefix mount --rbind /sys /mnt/gentoo/sys if [ $? -ne 0 ] then echo "FAILURE: could not bind /sys to /mnt/gentoo/sys" exit 6 fi # check other root directories and make them if necessary pushd /mnt/gentoo 2>&1 >/dev/null umask 0002 if [ ! -d run ]; then eval $prefix mkdir run; fi if [ ! -d boot ]; then eval $prefix mkdir boot; fi if [ ! -d home ]; then eval $prefix mkdir home; fi if [ ! -d bin ]; then eval $prefix mkdir bin; fi if [ ! -d sbin ]; then eval $prefix mkdir sbin; fi if [ ! -d etc ]; then eval $prefix mkdir etc; eval $prefix chgrp wheel etc; fi if [ ! -d lib64]; then eval $prefix mkdir lib64;fi if [ ! -d lib32]; then eval $prefix mkdir lib32;fi if [ `uname -m` == "x86_64" ]; then eval $prefix ln -s lib64 lib; fi if [ ! -d tmp ]; then eval $prefix mkdir tmp; eval $prefix chmod 1777 tmp;fi if [ ! -d usr ]; then eval $prefix mkdir usr; fi if [ ! -d usr/bin ]; then eval $prefix mkdir usr/bin; fi if [ ! -d usr/sbin ]; then eval $prefix mkdir usr/sbin; fi if [ ! -d root ]; then eval $prefix mkdir root; eval $prefix chgrp wheel root; eval $prefix chmod 0771 root; fi if [ ! -d var ]; then eval $prefix mkdir var; fi if [ ! -d opt ]; then eval $prefix mkdir opt; fi if [ ! -d mnt ]; then eval $prefix mkdir mnt; fi if [ ! -d media]; then eval $prefix mkdir media;fi if [ ! -d srv ]; then eval $prefix mkdir srv; fi popd 2>&1 >/dev/null # try rbind mounting of some standard mountpoints (2016-02-06) eval $prefix mount --rbind /boot /mnt/gentoo/boot eval $prefix mount --rbind /home /mnt/gentoo/home findmnt -n /srv && eval $prefix mount --rbind /srv /mnt/gentoo/srv # 2016-02-21 ggwfor convenience, mount the distfiles collection eval $prefix mkdir -p /mnt/gentoo/usr/portage/distfiles && eval $prefix mount --rbind /usr/portage/distfiles /mnt/gentoo/usr/portage/distfiles # so far, so good: tell user to mount any other needed filesystems befor chroot'ing echo "SUCCESS: mount any other desired filesystems before chroot'ing to new instance" exit