PDA

View Full Version : [SOLVED] Help me please! I can not boot my Fedora due to rc.local



User808
5th October 2017, 12:30 PM
Hi.
After creation of:
/etc/rc.d/rc.local
then:
sudo chmod 777 /etc/rc.d/rc.local

& all of this for automatic start of ccpd of Canon printer, I spent 4 days without problem in launching my system.

Today, I launched my laptop, but screen sticked at Fedora icon (F) see screenshot 1.

I press Esc key, & saw log of process: PC sticked at:
"A start job is running for /etc/rc.d/rc.local Compatibality (...... / no limit) see screenshot 2

I tried emergancy boot, but same !

I tried to enter to my hard using live usb Linux distro to brows files then delete /etc/rc.d/rc.local

I found file but I could not delete it (permission denied: no right) ! I used GUI browser to find & delete this file but it failed to delete it.

Please help me ! How to fix this ??

Please notice that there is file called ccpd inside folder init.d, so deleting ccpd file help or will creat other problem ?

User808
5th October 2017, 12:40 PM
Hi. I can not attached screenshot. I post from my mobile & it seem that my mobile browser do not support this feature.

glennzo
5th October 2017, 12:41 PM
Boot to a command prompt, login as root and do what you have to do. Reboot.

Or, while this nonsense is happening, are you able to switch to a VT using CTRL/ALT/F# ??? If so, login as root there and do what you have to do. Then reboot.

dswaner
5th October 2017, 12:47 PM
In emergency mode, move /etc/rc.d/rc.local to /root, just to save it. And then reboot (# shutdown -r now).

If necessary, see if you can switch to another console (by pressing ctl-alt-f3, for example), and login as root (with or without emergency mode), and then move /etc/rc.d/rc.local.

User808
5th October 2017, 01:15 PM
Boot to a command prompt, login as root and do what you have to do. Reboot.

Or, while this nonsense is happening, are you able to switch to a VT using CTRL/ALT/F# ??? If so, login as root there and do what you have to do. Then reboot.

Hi. Thank you for support.

1) how can I boot to a command prompt ?

2) while this nonsense happining, I could not enter tty terminal by Ctrl+Alt+F2. Trying this will lead me to black screen but no login prompet appeared ! Only prompet blancking & I could not type any thing .......

By the way, I mean by emurgency boot that I tried: is the selection of lowest choice of kernel choices at boot screen (rescue choice)

User808
5th October 2017, 03:17 PM
Hi. Thank you for support.

1) how can I boot to a command prompt ?

2) while this nonsense happining, I could not enter tty terminal by Ctrl+Alt+F2. Trying this will lead me to black screen but no login prompet appeared ! Only prompet blancking & I could not type any thing .......

By the way, I mean by emurgency boot that I tried: is the selection of lowest choice of kernel choices at boot screen (rescue choice)

Any help please ?

User808
5th October 2017, 04:42 PM
Hi. I found this link in this forum but it deal with Fedora19. Please review it. Is it still valid for Fedora 26 ? Does I need to mount my hard drive by specific command after boot to terminal or my hard disk will mount automatically ?

Can I login as sudo user or must be root (su) ?

Please your kind help I have no previous experiment with this work at all !

Why this problem happened ? Is it Fedora fault or Canon driver fault ?

Yeastardy, I launched my laptop without problem, used my Canon printer to print questions for examination of my students & printing was done very smoothly without problem. Then I powered my PC. What was happened ??!!!

Link is bellow:

https://forums.fedoraforum.org/showthread.php?t=260080

dcrdev
5th October 2017, 04:44 PM
Just go into the dracut emergency shell - add "rd.shell" to your kernel parameters by pressing 'e' on the default grub entry at boot.

Enter your root password when prompted and then type:

rm -rf /etc/rc.d/rc.local && reboot

User808
5th October 2017, 05:08 PM
Just go into the dracut emergency shell - add "rd.shell" to your kernel parameters by pressing 'e' on the default grub entry at boot.

Enter your root password when prompted and then type:

You mean the following:
1) use arrow to select kernel at onset of screen boot,
2) press e,
3) add "rd.shell" (please can you explain at which line I have to add this ?)
4) what I have to do further ? Save what I entered ? And how ? Or no save needed ? And what I have to press further to bring terminal ?

In post about Fedora 19 said:
1) use arrow to select kernel,
2) press e,
3) move by arrow to line started by "kernel" & at it's end add space then 3
4) press b to boot (but if I press b do it will be add b aftsr "3" in kernel line ? What I have to press after edit finish to be able later to press b or somthing else without add further to kernel line ?)

I need more explanation ...

Best.

dcrdev
5th October 2017, 05:49 PM
You mean the following:
1) use arrow to select kernel at onset of screen boot,
2) press e,
3) add "rd.shell" (please can you explain at which line I have to add this ?)
4) what I have to do further ? Save what I entered ? And how ? Or no save needed ? And what I have to press further to bring terminal ?

In post about Fedora 19 said:
1) use arrow to select kernel,
2) press e,
3) move by arrow to line started by "kernel" & at it's end add space then 3
4) press b to boot (but if I press b do it will be add b aftsr "3" in kernel line ? What I have to press after edit finish to be able later to press b or somthing else without add further to kernel line ?)

I need more explanation ...

Best.

At the grub menu, with the default kernel selected:


Press 'e'
Find the line that contains /vmlinuz in it
At the end of that line add "rd.shell"
Press Ctrl+x


Then you'll be in the dracut emergency shell, it will prompt you for your root password. Once you have typed in your password type exactly this:


rm -rf /etc/rc.d/rc.local && reboot

You do not have to do anything else - the changes we made to the kernel parameters only affect the current boot, they do not persist. If you follow the steps above then you will have successfully removed /etc/rc.d/rc.local and hopefully your system should just boot normally.

marko
5th October 2017, 06:31 PM
rm -rf /etc/rc.d/rc.local && reboot

No need for the very dangerous 'r' recursive flag here to delete one file, just do:


rm -f /etc/rc.d/rc.local && reboot

dcrdev
5th October 2017, 06:39 PM
rm -rf /etc/rc.d/rc.local && reboot

No need for the very dangerous 'r' recursive flag here to delete one file, just do:


rm -f /etc/rc.d/rc.local && reboot

Just a habit - it's a single file, it's not going to do anything.

User808
5th October 2017, 06:42 PM
At the grub menu, with the default kernel selected:


Press 'e'
Find the line that contains /vmlinuz in it
At the end of that line add "rd.shell"
Press Ctrl+x


Then you'll be in the dracut emergency shell, it will prompt you for your root password. Once you have typed in your password type exactly this:


rm -rf /etc/rc.d/rc.local && reboot

You do not have to do anything else - the changes we made to the kernel parameters only affect the current boot, they do not persist. If you follow the steps above then you will have successfully removed /etc/rc.d/rc.local and hopefully your system should just boot normally.

Hi.
I press e & use arrow & found the following in the following arrengment which conifuse me (is it single line or more than one line):

linux16 /vmlinuz-4.12.14-300.fc26.x86_64 root=/dev/mapper/fedora \
ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rbgd quit LANG=en_US.UTF-8
initrd16 /initramfs-4.12.14-300.fc26.x86_64.img

So, where exactly I should add "rd.shell" ?
I'm affraid that appearance effected by screen lowest resolution.

Forgive me from that but really I have no experience & affraid from doing error distroy my system.

What password I have to use ? su or sudo ?

By the way I tried c but command prompet not show me login choice ! Also it do not support shutdown command ? Can I use command prompet to power off my PC to avoid power off it by long press on power bottum ?

Best.

dcrdev
5th October 2017, 06:48 PM
Those lines contain typos, but you get the gist of it below:

Change this part:

ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rbgd quit LANG=en_US.UTF-8

To:

ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rbgd rd.shell quit LANG=en_US.UTF-8

The password you need to enter is your root password, so yes the one you would use for 'su' i.e. not your local account.

My command includes "reboot", this means it will reboot gracefully.

FYI - The 'c' command is a basic shell for interacting with grub, it is of no use to you in this situation. Just follow the instructions I set out above.

marko
5th October 2017, 06:52 PM
Just a habit - it's a single file, it's not going to do anything.

yes, but if you make a typo with -f you just lose one file, with -rf you can lose any number if the file was one letter off of a directory

User808
5th October 2017, 06:54 PM
By the way, I remember the following: yeastarday after complete printing, & just before power off my pc, I deleted my new hp printer (that I set it till that time as dfault wide system printer), then I set Canon printer as default wide system printer from "print" utility of system. I set LBP6000 as default. I have 2 printers for same single Canon printer: LBP6000 & LBP6000-LBP6018. Second do not print while 1st print. I set 1st as default. Does this can cause this problem ? And if yes, then how ?

dcrdev
5th October 2017, 06:59 PM
By the way, I remember the following: yeastarday after complete printing, & just before power off my pc, I deleted my new hp printer (that I set it till that time as dfault wide system printer), then I set Canon printer as default wide system printer from "print" utility of system. I set LBP6000 as default. I have 2 printers for same single Canon printer: LBP6000 & LBP6000-LBP6018. Second do not print while 1st print. I set 1st as default. Does this can cause this problem ? And if yes, then how ?

Don't know not enough information, would need to see what you put into rc.local, as that's what's causing the hiccup.

User808
5th October 2017, 07:31 PM
At the grub menu, with the default kernel selected:


Press 'e'
Find the line that contains /vmlinuz in it
At the end of that line add "rd.shell"
Press Ctrl+x


Then you'll be in the dracut emergency shell, it will prompt you for your root password. Once you have typed in your password type exactly this:


rm -rf /etc/rc.d/rc.local && reboot

You do not have to do anything else - the changes we made to the kernel parameters only affect the current boot, they do not persist. If you follow the steps above then you will have successfully removed /etc/rc.d/rc.local and hopefully your system should just boot normally.

Hi. What is going by Evil ???!!!!!!!!!!!!!!!

I did what you command me exactly. When I press Ctrl then x the shell screen appeared to me BUT ONLY FOR ABOUT 2 SECOND THEN DISAPPEARED & I redirected to GUI screen. BUT BUT this time it WORKED !!!!!!!!!!! I saw Cinnamon login GUI prompet & enter my sudo password & enter to my system O.K But screen before GUI show me something (log) differ from what I saw before !!!!! It was time to delete /etc/rc.d/rc.local BUT I DID NOT DELETE IT. Instead decided to reboot my system & try default entry. I power system off, wait 3 minutes, then power on laptop, select default (last kernel), just press e to issuer no thing changes & indeed no thing changes it is "rbgd quiet". I press Esc & boot normally, & it was O.K this time !!! It boot without problem.

But take what I discovered !!!!!!!!!!!!!!

I open terminal & check ccpd status by:

service ccpd status

output show me that it is NOT started at boot !!!!!!!

then I open /etc/rc.d/rc.local by

sudo vi /etc/rc.d/rc.local

& here is the surprising thing: it is EMPTY !!!!!!!!!!!!!!!! See attached screenshot !

I added to it following after I created it:

#!/bin/sh
/etc/init.d/ccpd start

where these 2 lines gone ????????????????????? I did not modify it. Later I remember that when I used live USB Linux distro to delete it (& I failed) & tried to view this file & when I opened it it was also EMPTY !!!!!!!!!!!!!!

What was gone ?????????????? How it modified ??????!!!!!!!!!!

User808
5th October 2017, 08:58 PM
I like to recreate file etc/rc.d/rc.local

Please can you assist me in the following:

1) I noticed from problem in this thread that the script in /etc/rc.d/rc.local was (while system was sticked to it) show "No time limit". Please how can I add time limit to it, in such a manner that if failed to start at boot at end of this limit then system will concel it & complete booting process.

2) in an old post - in Ubuntu user community - they said to make start up script as following:

#!/bin/sh
sleep 10 && /etc/init.d/ccpd start

They suggest to add "sleep 10 &&" as a workaround for a problem (ccpd should start after cups already started). But I think in our Fedora cups is started by systemd automatically at boot, so it should ccpd started after it by default without need to add "slepp 10 &&" because ccpd is started by systemV, isn't it ? And indeed it was working fine to me for 4 days without problem till I make LBP6000 my global system default printer. So, does adding "sleep 10 &&" will help to avoid what happened to me or not ?

3) do any of you know or have an idea about HOW /etc/rc.d/rc.local file contents were deleted ??

4) Is there need to open a bug about what happened to me, in Redhat BugZilla ?

User808
6th October 2017, 08:50 AM
Hi. I got following link:
https://ask.fedoraproject.org/en/question/35668/how-can-i-access-terminalcommandline-following-fedora-19-boot-hanging/

It said: change to "text 3". Is this valid on Fedora 26 ? If yes, then what is diffirence between " rd.shell" & "text 3" ?

Also, in post user use other way: just added "3" at end of line started by linux without change any other text. Is this valid on Fedora 26 ? If yes, then where should added exactly ?

------------------------------------
Please do not foget my previous post #19 questions .....

User808
6th October 2017, 10:55 AM
Finally I uploaded screenshot for initial error ! They were of large sizes. I decrease their sizes.

Screenshot 1: Fedora icon that system stick at it during boot (freeze boot)

Screenshot 2: what it appeared to me when I pressed on Esc while I was stick on Fedora icon described above in screenshot 1.

User808
6th October 2017, 04:05 PM
Hi. I discover the following link on Redhat BugZilla, which seem to solve our problem by allow ccpd script to support chkconf command:

https://bugzilla.redhat.com/show_bug.cgi?id=710325

The last comment said:


I see. The main problem with that initscript is that it's missing a chkconfig line, for instance:
# chkconfig: - 90 10

If you add it, "chkconfig --add ccpd" will work and "chkconfig ccpd on" will too.

To what I have to add chkconfig line ? To ccpd script ? I brows my system & found a script called "ccpd" located in /etc/rc.d/init.d (please look to screenshot: ccpd-location).

I tried "vi /etc/rc.d/init.d/ccpd & output was (I copy/past only upper part of script not all of it)


#!/bin/sh
# startup script for Canon Printer Daemon for CUPS (ccpd)

if [ `ps awx | grep cupsd | grep -v grep | wc -l` -eq 0 ]; then
while [ `ps awx | grep cupsd | grep -v grep | wc -l` -eq 0 ]
do
sleep 3
done
sleep 5
fi

if [ -f /etc/rc.d/init.d/functions ]; then
if [ -f /etc/slackware-version ]; then
SYS_F="SL"
else
. /etc/rc.d/init.d/functions
SYS_F="RH"
fi
elif [ -x /sbin/startproc ]; then
SYS_F="Su"
elif [ -x /sbin/start-stop-daemon ]; then
SYS_F="De"
fi

DAEMON=/usr/sbin/ccpd
LOCKFILE=/var/lock/subsys/ccpd

export PATH=$PATH:/usr/local/sbin:/usr/local/bin

ccpd_start ()
{
echo -n "Starting ${DAEMON}: "

if [ "$SYS_F" = "RH" ]; then
daemon ${DAEMON}
[ "$?" = "0" ] && touch ${LOCKFILE}
echo "."



see screenshot: ccpd also.

So, where I should add chkconfig line & what this line should be exactly be ??

User808
6th October 2017, 06:43 PM
Hi. I discovered where I have to put line:

To make script chkconfig compatible, it should contains: the following 2 header lines, conveniently after 1st line:

# chkconfig: X Y Z
# description: some description

where

X: is leveles to configure
Y: startup order
Z: stop order

So, that script become (I copy/past only upper part of script not all of it):


#!/bin/sh
# chkconfig: X Y Z
# description: ccpd script
# startup script for Canon Printer Daemon for CUPS (ccpd)

if [ `ps awx | grep cupsd | grep -v grep | wc -l` -eq 0 ]; then
while [ `ps awx | grep cupsd | grep -v grep | wc -l` -eq 0 ]
do
sleep 3
done
sleep 5
fi

if [ -f /etc/rc.d/init.d/functions ]; then
if [ -f /etc/slackware-version ]; then
SYS_F="SL"
else
. /etc/rc.d/init.d/functions
SYS_F="RH"
fi
elif [ -x /sbin/startproc ]; then
SYS_F="Su"
elif [ -x /sbin/start-stop-daemon ]; then
SYS_F="De"
fi

DAEMON=/usr/sbin/ccpd
LOCKFILE=/var/lock/subsys/ccpd

export PATH=$PATH:/usr/local/sbin:/usr/local/bin

ccpd_start ()
{
echo -n "Starting ${DAEMON}: "

if [ "$SYS_F" = "RH" ]; then
daemon ${DAEMON}
[ "$?" = "0" ] && touch ${LOCKFILE}
echo "."



Look for what I put in red color: these are what we need to add.

But problem is that I'm not sure what are the correct values of X Y Z ? Can you please just help me with this last issue ? It tiered me too much !

User808
7th October 2017, 06:08 AM
No one help me ! I will continue alone in this thread ! However, I'm progressing in reaching to solution !

I got the following data from Fedora project link: start up order + stop order by default should be = 100 ! So, if we select start up order to be = 99 (to make sure that ccpd run after CUPS already has been run, & I think it will be so even without selection of 99 because CUPS is started at boot by systemd which should be before systemV), then stop order should be 01.

Regarding run level, I found that set it to "-" mean service will be OFF on all level, so no benefit from this since it will be = to "sudo service service enable" then "sudo service service stop" (please correct to me). And since Canon Driver has GUI, so it is better to set run level to 345. So, it seem that it should be:

# chkconfig: 345 99 01

User808
7th October 2017, 12:12 PM
Hi all ! No one like to suggest something ! O.K ! I did it on my own responsibility.

I added just after 1st line of ccpd script, which contain "#!/bin/sh", the following 2 lines:

# chkconfig: 345 99 01
# description: ccpd script

& then saved & exit vim, finally used:

sudo chkconfig --add ccpd

& it gave me no any error message.

Finally reboot my PC.

Waw !!! It worked 100% ! "chkconfig --list" show me ccpd service ON on run level 3,4,5

I plugin my Canon printer, then power it ON, & tried to print a paper & it worked ! Also, I tried to launch GUI of Canon printer driver, & it worked also without problem !

Issue solved finally !

It was nice disaster, making me learn too much in field I was previously very afraid from touching them !

Finally, we solved problem of Canon printerS official driver !! I will update guide of it soon. I would like to suggest on modulator to make this guide (in guide section of this forum) sticky !