Search My Techie Guy

Tuesday, May 3, 2016

mount_msdosfs: /dev/da1s1: No such file or directory when trying to mount a flash to juniper ex series switch

Summary: 

When trying to mount a flash disk to a juniper switch, i got this error "mount_msdosfs: /dev/da1s1: No such file or directory"

Problem or Goal:

root@:RE:0% mkdir /var/tmp/usb
root@:RE:0% mount_msdosfs /dev/da1s1 /var/tmp/usb
mount_msdosfs: /dev/da1s1: No such file or directory

on the console, when i insert the flash drive, i observe these errors:

root@:RE:0% umass1: Alcor Micro Mass Storage Device, rev 2.00/0.01, addr 4
da1 at umass-sim1 bus 1 target 0 lun 0
da1: <Generic USB Flash Disk 7.76> Removable Direct Access SCSI-4 device 
da1: 40.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
(da1:umass-sim1:1:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0 
(da1:umass-sim1:1:0:0): CAM Status: SCSI Status Error
(da1:umass-sim1:1:0:0): SCSI Status: Check Condition
(da1:umass-sim1:1:0:0): NOT READY asc:3a,0
(da1:umass-sim1:1:0:0): Medium not present
(da1:umass-sim1:1:0:0): Unretryable error
Opened disk da1 -> 6
(da1:umass-sim1:1:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0 
(da1:umass-sim1:1:0:0): CAM Status: SCSI Status Error
(da1:umass-sim1:1:0:0): SCSI Status: Check Condition
(da1:umass-sim1:1:0:0): NOT READY asc:3a,0
(da1:umass-sim1:1:0:0): Medium not present
(da1:umass-sim1:1:0:0): Unretryable error
Opened disk da1 -> 6

Cause:

Most probably, the flash disk is not well formatted.

Solution: 

I took out the flash drive from the switch and formatted it on a windows PC using file system FAT

Problem Solved?

Yes, after i inserted it back in the switch and i was able to mount it.

root@:RE:0% umass1: Generic Mass Storage, rev 2.00/1.06, addr 4
da1 at umass-sim1 bus 1 target 0 lun 0
da1: <Generic Flash Disk 8.07> Removable Direct Access SCSI-4 device 
da1: 40.000MB/s transfers
da1: 7800MB (15974400 512 byte sectors: 255H 63S/T 994C)

root@:RE:0% mount_msdosfs /dev/da1s1 /var/tmp/usb
root@:RE:0% ls -ltr /var/tmp/usb/
total 219776
-rwxr-xr-x  1 root  field  112517772 May  2  2016 jinstall-ex-4500-12.3R12.4-domestic-signed.tgz

How to mount USB flash drive on Juniper EX series switches

Summary:

Am trying to upgrade my juniper EX4200 from JUNOS Base OS Software Suite [12.3R9.4] to 12.3R12.4 in preparation for virtual chassis, Juniper recommends that all switches within the same virtual chassis run the same software version. And because my VC will be a mixture of EX4550/EX4500/EX4200, juniper recommended that i use 12.3R12.4

So i have my software already downloaded and on a flash disk

Problem or Goal:

I need to transfer the software to the switches using a flash drive

Cause:

You probably have no network connectivity to the switches to do an FTP transfer, or you are working on a new switch.

Solution: 

1. Enter the shell as root:

root> start shell user root
root@:RE:0%

2. Before inserting the USB device, perform the following:

root@:RE:0% ls /dev/da*
/dev/da0        /dev/da0s1c     /dev/da0s2c     /dev/da0s3d     /dev/da0s4c
/dev/da0s1      /dev/da0s2      /dev/da0s3      /dev/da0s3e     /dev/da0s4d
/dev/da0s1a     /dev/da0s2a     /dev/da0s3c     /dev/da0s4

3. Insert the USB drive in the USB port. The following output will be displayed:

root@:RE:0% umass1: Generic Mass Storage, rev 2.00/1.06, addr 3
da1 at umass-sim1 bus 1 target 0 lun 0
da1: <Generic Flash Disk 8.07> Removable Direct Access SCSI-4 device
da1: 40.000MB/s transfers
da1: 7800MB (15974400 512 byte sectors: 255H 63S/T 994C)

root@:RE:0% ls /dev/da*
/dev/da0        /dev/da0s2      /dev/da0s3c     /dev/da0s4c
/dev/da0s1      /dev/da0s2a     /dev/da0s3d     /dev/da0s4d
/dev/da0s1a     /dev/da0s2c     /dev/da0s3e     /dev/da1
/dev/da0s1c     /dev/da0s3      /dev/da0s4      /dev/da1s1

Note: if you compare the "ls /dev/da*" output before inserting the flash drive and after inserting the drive, you will notice these have been added:

/dev/da1 and "/dev/da1s1"

Your USB drive is located here "/dev/da1s1"

4. Create a directory for the USB drive to mount to:

root@:RE:0% mkdir /var/tmp/usb

5. Mount the USB drive to the /var/tmp/usb directory:

root@:RE:0% mount_msdosfs /dev/da1s1 /var/tmp/usb

root@:RE:0% ls /var/tmp/usb
jinstall-ex-4200-12.3R12.4-domestic-signed.tgz
jinstall-ex-4500-12.3R12.4-domestic-signed.tgz

Problem Solved?

Yes 

6. You can now copy any of the USB files to the /var/tmp directory on the switch:

root@:RE:0% cp /var/tmp/usb/jinstall-ex-4200-12.3R12.4-domestic-signed.tgz /var/tmp

7. Now unmount the USB drive after the file is completely copied:

root@:RE:0% umount /var/tmp/usb

References: juniper.net

Monday, May 2, 2016

DRUPAL WEBSITE PERMISSIONS FIX

Summary: 
DRUPAL WEBSITE PERMISSIONS FIX (UNIX/LINUX)

Problem or Goal:
Recommended steps to fix the website file/folder permissions

Cause: 
File Permission issues on drupal

Solution: 

# 1. Create a new example user.

useradd -s /bin/bash -m example;

# 2. Now add that user to the Apache group. On Ubuntu/Debian this group is usually
# called www-data, on CentOS it's usually apache.

usermod -a -G www-data example;

# 3. Set up a password for this user.
  
passwd example;

# 4. Now set the group to the Apache group. -R means recursive, and -v means 
# verbose mode.

chgrp -Rv www-data sites/default/files

# 5. Next we'll set up permissions so that the web server can always write to any 
# file that is in this directory. We do this by using 2775 in our chmod command. 
# The 2 means that the group id will be preserved for any new files created in this 
# directory. What that means is that www--data will always be the group on any files, 
# thereby ensuring that web server and the user will both always have write 
# permissions to any new files that are placed in this directory. 

chmod 2775 sites/default/files

# 6. If there are any existing files in this directory, be sure the web server has 
# write perms on them.

chmod g+w -R sites/default/files

# 7. Ensure that all users only have read permissions.

chmod 444 sites/default/settings.php

# ------------------------------------------------------

Problem Solved?

Yes, Comment if there are any questions.

Friday, April 22, 2016

Sendmail SMTP Port 25 - Unable to connect to remote host: Connection refused

Summary: 

When you telnet a local address on port 25 (SMTP) you get error below:

"Unable to connect to remote host: Connection refused"

Problem or Goal:

When you attempt to connect to port 25 on a local address, you get error:
 "Unable to connect to remote host: Connection refused"

root@mail:/etc/mail# telnet 10.0.40.104 25
Trying 10.0.40.104...
telnet: Unable to connect to remote host: Connection refused

Yet you can successfully connect to port 25 on localhost or 127.0.0.1

root@mail:/etc/mail# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.


Cause: 

By default, sendmail will only listen on localhost.

Solution: 

Set it to listen on all interfaces instead:

1. Open /etc/mail/sendmail.cf
2. Find the line starting with DaemonPortOptions and then modify it so it looks like this:

Before:
# SMTP daemon options
O DaemonPortOptions=Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1

After:
# SMTP daemon options
O DaemonPortOptions=Family=inet,  Name=MTA-v4, Port=smtp, Addr=0.0.0.0

3. Make sure to restart sendmail so that our new configuration is taken in to effect:

/etc/init.d/sendmail restart

Problem Solved?

YES

root@mail:/etc/mail# telnet 10.0.40.104 25
Trying 10.0.40.104...
Connected to 10.0.40.104.
Escape character is '^]'.